vitest 0.0.96 → 0.0.100

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,14 +1,16 @@
1
- import path$2, { isAbsolute, relative, dirname, basename, resolve } from 'path';
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$a from 'path';
3
4
  import process$1 from 'process';
4
- import { promises } from 'fs';
5
- import fg from 'fast-glob';
6
- import require$$0 from 'util';
7
- import { d as defaultInclude, a as defaultExclude, b as defaultPort, c as distDir, e as configFiles } from './constants-9cfa4d7b.js';
8
- 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-576876dc.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';
9
11
  import { performance } from 'perf_hooks';
10
- 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-81292c96.js';
11
- 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';
12
14
  import { MessageChannel } from 'worker_threads';
13
15
  import { pathToFileURL } from 'url';
14
16
  import { Tinypool } from 'tinypool';
@@ -226,7 +228,7 @@ async function locatePath(
226
228
 
227
229
  return pLocate(paths, async path_ => {
228
230
  try {
229
- const stat = await statFunction(path$2.resolve(cwd, path_));
231
+ const stat = await statFunction(path$a.resolve(cwd, path_));
230
232
  return matchType(type, stat);
231
233
  } catch {
232
234
  return false;
@@ -237,9 +239,9 @@ async function locatePath(
237
239
  const findUpStop = Symbol('findUpStop');
238
240
 
239
241
  async function findUpMultiple(name, options = {}) {
240
- let directory = path$2.resolve(options.cwd || '');
241
- const {root} = path$2.parse(directory);
242
- 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);
243
245
  const limit = options.limit || Number.POSITIVE_INFINITY;
244
246
  const paths = [name].flat();
245
247
 
@@ -267,14 +269,14 @@ async function findUpMultiple(name, options = {}) {
267
269
  }
268
270
 
269
271
  if (foundPath) {
270
- matches.push(path$2.resolve(directory, foundPath));
272
+ matches.push(path$a.resolve(directory, foundPath));
271
273
  }
272
274
 
273
275
  if (directory === stopAt || matches.length >= limit) {
274
276
  break;
275
277
  }
276
278
 
277
- directory = path$2.dirname(directory);
279
+ directory = path$a.dirname(directory);
278
280
  }
279
281
 
280
282
  return matches;
@@ -285,7 +287,315 @@ async function findUp(name, options = {}) {
285
287
  return matches[0];
286
288
  }
287
289
 
288
- 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 = {};
289
599
 
290
600
  (function (exports) {
291
601
 
@@ -399,18 +709,18 @@ exports.flatten = (...args) => {
399
709
  flat(args);
400
710
  return result;
401
711
  };
402
- }(utils$8));
712
+ }(utils$j));
403
713
 
404
- const utils$7 = utils$8;
714
+ const utils$i = utils$j;
405
715
 
406
716
  var stringify$4 = (ast, options = {}) => {
407
717
  let stringify = (node, parent = {}) => {
408
- let invalidBlock = options.escapeInvalid && utils$7.isInvalidBrace(parent);
718
+ let invalidBlock = options.escapeInvalid && utils$i.isInvalidBrace(parent);
409
719
  let invalidNode = node.invalid === true && options.escapeInvalid === true;
410
720
  let output = '';
411
721
 
412
722
  if (node.value) {
413
- if ((invalidBlock || invalidNode) && utils$7.isOpenOrClose(node)) {
723
+ if ((invalidBlock || invalidNode) && utils$i.isOpenOrClose(node)) {
414
724
  return '\\' + node.value;
415
725
  }
416
726
  return node.value;
@@ -742,7 +1052,7 @@ var toRegexRange_1 = toRegexRange$1;
742
1052
  * Licensed under the MIT License.
743
1053
  */
744
1054
 
745
- const util$1 = require$$0;
1055
+ const util$1 = require$$0$1;
746
1056
  const toRegexRange = toRegexRange_1;
747
1057
 
748
1058
  const isObject$1 = val => val !== null && typeof val === 'object' && !Array.isArray(val);
@@ -984,11 +1294,11 @@ const fill$2 = (start, end, step, options = {}) => {
984
1294
  var fillRange = fill$2;
985
1295
 
986
1296
  const fill$1 = fillRange;
987
- const utils$6 = utils$8;
1297
+ const utils$h = utils$j;
988
1298
 
989
1299
  const compile$1 = (ast, options = {}) => {
990
1300
  let walk = (node, parent = {}) => {
991
- let invalidBlock = utils$6.isInvalidBrace(parent);
1301
+ let invalidBlock = utils$h.isInvalidBrace(parent);
992
1302
  let invalidNode = node.invalid === true && options.escapeInvalid === true;
993
1303
  let invalid = invalidBlock === true || invalidNode === true;
994
1304
  let prefix = options.escapeInvalid === true ? '\\' : '';
@@ -1018,7 +1328,7 @@ const compile$1 = (ast, options = {}) => {
1018
1328
  }
1019
1329
 
1020
1330
  if (node.nodes && node.ranges > 0) {
1021
- let args = utils$6.reduce(node.nodes);
1331
+ let args = utils$h.reduce(node.nodes);
1022
1332
  let range = fill$1(...args, { ...options, wrap: false, toRegex: true });
1023
1333
 
1024
1334
  if (range.length !== 0) {
@@ -1041,7 +1351,7 @@ var compile_1 = compile$1;
1041
1351
 
1042
1352
  const fill = fillRange;
1043
1353
  const stringify$2 = stringify$4;
1044
- const utils$5 = utils$8;
1354
+ const utils$g = utils$j;
1045
1355
 
1046
1356
  const append = (queue = '', stash = '', enclose = false) => {
1047
1357
  let result = [];
@@ -1051,7 +1361,7 @@ const append = (queue = '', stash = '', enclose = false) => {
1051
1361
 
1052
1362
  if (!stash.length) return queue;
1053
1363
  if (!queue.length) {
1054
- return enclose ? utils$5.flatten(stash).map(ele => `{${ele}}`) : stash;
1364
+ return enclose ? utils$g.flatten(stash).map(ele => `{${ele}}`) : stash;
1055
1365
  }
1056
1366
 
1057
1367
  for (let item of queue) {
@@ -1066,7 +1376,7 @@ const append = (queue = '', stash = '', enclose = false) => {
1066
1376
  }
1067
1377
  }
1068
1378
  }
1069
- return utils$5.flatten(result);
1379
+ return utils$g.flatten(result);
1070
1380
  };
1071
1381
 
1072
1382
  const expand$1 = (ast, options = {}) => {
@@ -1094,9 +1404,9 @@ const expand$1 = (ast, options = {}) => {
1094
1404
  }
1095
1405
 
1096
1406
  if (node.nodes && node.ranges > 0) {
1097
- let args = utils$5.reduce(node.nodes);
1407
+ let args = utils$g.reduce(node.nodes);
1098
1408
 
1099
- if (utils$5.exceedsLimit(...args, options.step, rangeLimit)) {
1409
+ if (utils$g.exceedsLimit(...args, options.step, rangeLimit)) {
1100
1410
  throw new RangeError('expanded array length exceeds range limit. Use options.rangeLimit to increase or disable the limit.');
1101
1411
  }
1102
1412
 
@@ -1110,7 +1420,7 @@ const expand$1 = (ast, options = {}) => {
1110
1420
  return;
1111
1421
  }
1112
1422
 
1113
- let enclose = utils$5.encloseBrace(node);
1423
+ let enclose = utils$g.encloseBrace(node);
1114
1424
  let queue = node.queue;
1115
1425
  let block = node;
1116
1426
 
@@ -1146,12 +1456,12 @@ const expand$1 = (ast, options = {}) => {
1146
1456
  return queue;
1147
1457
  };
1148
1458
 
1149
- return utils$5.flatten(walk(ast));
1459
+ return utils$g.flatten(walk(ast));
1150
1460
  };
1151
1461
 
1152
1462
  var expand_1 = expand$1;
1153
1463
 
1154
- var constants$3 = {
1464
+ var constants$4 = {
1155
1465
  MAX_LENGTH: 1024 * 64,
1156
1466
 
1157
1467
  // Digits
@@ -1229,7 +1539,7 @@ const {
1229
1539
  CHAR_SINGLE_QUOTE, /* ' */
1230
1540
  CHAR_NO_BREAK_SPACE,
1231
1541
  CHAR_ZERO_WIDTH_NOBREAK_SPACE
1232
- } = constants$3;
1542
+ } = constants$4;
1233
1543
 
1234
1544
  /**
1235
1545
  * parse
@@ -1705,9 +2015,9 @@ braces$1.create = (input, options = {}) => {
1705
2015
 
1706
2016
  var braces_1 = braces$1;
1707
2017
 
1708
- var utils$4 = {};
2018
+ var utils$f = {};
1709
2019
 
1710
- const path$1 = path$2;
2020
+ const path$7 = path$a;
1711
2021
  const WIN_SLASH = '\\\\/';
1712
2022
  const WIN_NO_SLASH = `[^${WIN_SLASH}]`;
1713
2023
 
@@ -1790,7 +2100,7 @@ const POSIX_REGEX_SOURCE$1 = {
1790
2100
  xdigit: 'A-Fa-f0-9'
1791
2101
  };
1792
2102
 
1793
- var constants$2 = {
2103
+ var constants$3 = {
1794
2104
  MAX_LENGTH: 1024 * 64,
1795
2105
  POSIX_REGEX_SOURCE: POSIX_REGEX_SOURCE$1,
1796
2106
 
@@ -1860,7 +2170,7 @@ var constants$2 = {
1860
2170
  CHAR_VERTICAL_LINE: 124, /* | */
1861
2171
  CHAR_ZERO_WIDTH_NOBREAK_SPACE: 65279, /* \uFEFF */
1862
2172
 
1863
- SEP: path$1.sep,
2173
+ SEP: path$7.sep,
1864
2174
 
1865
2175
  /**
1866
2176
  * Create EXTGLOB_CHARS
@@ -1887,14 +2197,14 @@ var constants$2 = {
1887
2197
 
1888
2198
  (function (exports) {
1889
2199
 
1890
- const path = path$2;
2200
+ const path = path$a;
1891
2201
  const win32 = process.platform === 'win32';
1892
2202
  const {
1893
2203
  REGEX_BACKSLASH,
1894
2204
  REGEX_REMOVE_BACKSLASH,
1895
2205
  REGEX_SPECIAL_CHARS,
1896
2206
  REGEX_SPECIAL_CHARS_GLOBAL
1897
- } = constants$2;
2207
+ } = constants$3;
1898
2208
 
1899
2209
  exports.isObject = val => val !== null && typeof val === 'object' && !Array.isArray(val);
1900
2210
  exports.hasRegexChars = str => REGEX_SPECIAL_CHARS.test(str);
@@ -1949,9 +2259,9 @@ exports.wrapOutput = (input, state = {}, options = {}) => {
1949
2259
  }
1950
2260
  return output;
1951
2261
  };
1952
- }(utils$4));
2262
+ }(utils$f));
1953
2263
 
1954
- const utils$3 = utils$4;
2264
+ const utils$e = utils$f;
1955
2265
  const {
1956
2266
  CHAR_ASTERISK, /* * */
1957
2267
  CHAR_AT, /* @ */
@@ -1968,7 +2278,7 @@ const {
1968
2278
  CHAR_RIGHT_CURLY_BRACE, /* } */
1969
2279
  CHAR_RIGHT_PARENTHESES, /* ) */
1970
2280
  CHAR_RIGHT_SQUARE_BRACKET /* ] */
1971
- } = constants$2;
2281
+ } = constants$3;
1972
2282
 
1973
2283
  const isPathSeparator = code => {
1974
2284
  return code === CHAR_FORWARD_SLASH || code === CHAR_BACKWARD_SLASH;
@@ -2268,10 +2578,10 @@ const scan$1 = (input, options) => {
2268
2578
  }
2269
2579
 
2270
2580
  if (opts.unescape === true) {
2271
- if (glob) glob = utils$3.removeBackslashes(glob);
2581
+ if (glob) glob = utils$e.removeBackslashes(glob);
2272
2582
 
2273
2583
  if (base && backslashes === true) {
2274
- base = utils$3.removeBackslashes(base);
2584
+ base = utils$e.removeBackslashes(base);
2275
2585
  }
2276
2586
  }
2277
2587
 
@@ -2341,8 +2651,8 @@ const scan$1 = (input, options) => {
2341
2651
 
2342
2652
  var scan_1 = scan$1;
2343
2653
 
2344
- const constants$1 = constants$2;
2345
- const utils$2 = utils$4;
2654
+ const constants$2 = constants$3;
2655
+ const utils$d = utils$f;
2346
2656
 
2347
2657
  /**
2348
2658
  * Constants
@@ -2354,7 +2664,7 @@ const {
2354
2664
  REGEX_NON_SPECIAL_CHARS,
2355
2665
  REGEX_SPECIAL_CHARS_BACKREF,
2356
2666
  REPLACEMENTS
2357
- } = constants$1;
2667
+ } = constants$2;
2358
2668
 
2359
2669
  /**
2360
2670
  * Helpers
@@ -2372,7 +2682,7 @@ const expandRange = (args, options) => {
2372
2682
  /* eslint-disable-next-line no-new */
2373
2683
  new RegExp(value);
2374
2684
  } catch (ex) {
2375
- return args.map(v => utils$2.escapeRegex(v)).join('..');
2685
+ return args.map(v => utils$d.escapeRegex(v)).join('..');
2376
2686
  }
2377
2687
 
2378
2688
  return value;
@@ -2412,11 +2722,11 @@ const parse$1 = (input, options) => {
2412
2722
  const tokens = [bos];
2413
2723
 
2414
2724
  const capture = opts.capture ? '' : '?:';
2415
- const win32 = utils$2.isWindows(options);
2725
+ const win32 = utils$d.isWindows(options);
2416
2726
 
2417
2727
  // create constants based on platform, for windows or posix
2418
- const PLATFORM_CHARS = constants$1.globChars(win32);
2419
- 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);
2420
2730
 
2421
2731
  const {
2422
2732
  DOT_LITERAL,
@@ -2468,7 +2778,7 @@ const parse$1 = (input, options) => {
2468
2778
  tokens
2469
2779
  };
2470
2780
 
2471
- input = utils$2.removePrefix(input, state);
2781
+ input = utils$d.removePrefix(input, state);
2472
2782
  len = input.length;
2473
2783
 
2474
2784
  const extglobs = [];
@@ -2654,7 +2964,7 @@ const parse$1 = (input, options) => {
2654
2964
  return state;
2655
2965
  }
2656
2966
 
2657
- state.output = utils$2.wrapOutput(output, state, options);
2967
+ state.output = utils$d.wrapOutput(output, state, options);
2658
2968
  return state;
2659
2969
  }
2660
2970
 
@@ -2767,7 +3077,7 @@ const parse$1 = (input, options) => {
2767
3077
  */
2768
3078
 
2769
3079
  if (state.quotes === 1 && value !== '"') {
2770
- value = utils$2.escapeRegex(value);
3080
+ value = utils$d.escapeRegex(value);
2771
3081
  prev.value += value;
2772
3082
  append({ value });
2773
3083
  continue;
@@ -2857,11 +3167,11 @@ const parse$1 = (input, options) => {
2857
3167
 
2858
3168
  // when literal brackets are explicitly disabled
2859
3169
  // assume we should match with a regex character class
2860
- if (opts.literalBrackets === false || utils$2.hasRegexChars(prevValue)) {
3170
+ if (opts.literalBrackets === false || utils$d.hasRegexChars(prevValue)) {
2861
3171
  continue;
2862
3172
  }
2863
3173
 
2864
- const escaped = utils$2.escapeRegex(prev.value);
3174
+ const escaped = utils$d.escapeRegex(prev.value);
2865
3175
  state.output = state.output.slice(0, -prev.value.length);
2866
3176
 
2867
3177
  // when literal brackets are explicitly enabled
@@ -3033,7 +3343,7 @@ const parse$1 = (input, options) => {
3033
3343
  const next = peek();
3034
3344
  let output = value;
3035
3345
 
3036
- if (next === '<' && !utils$2.supportsLookbehinds()) {
3346
+ if (next === '<' && !utils$d.supportsLookbehinds()) {
3037
3347
  throw new Error('Node.js v10 or higher is required for regex lookbehinds');
3038
3348
  }
3039
3349
 
@@ -3293,19 +3603,19 @@ const parse$1 = (input, options) => {
3293
3603
 
3294
3604
  while (state.brackets > 0) {
3295
3605
  if (opts.strictBrackets === true) throw new SyntaxError(syntaxError('closing', ']'));
3296
- state.output = utils$2.escapeLast(state.output, '[');
3606
+ state.output = utils$d.escapeLast(state.output, '[');
3297
3607
  decrement('brackets');
3298
3608
  }
3299
3609
 
3300
3610
  while (state.parens > 0) {
3301
3611
  if (opts.strictBrackets === true) throw new SyntaxError(syntaxError('closing', ')'));
3302
- state.output = utils$2.escapeLast(state.output, '(');
3612
+ state.output = utils$d.escapeLast(state.output, '(');
3303
3613
  decrement('parens');
3304
3614
  }
3305
3615
 
3306
3616
  while (state.braces > 0) {
3307
3617
  if (opts.strictBrackets === true) throw new SyntaxError(syntaxError('closing', '}'));
3308
- state.output = utils$2.escapeLast(state.output, '{');
3618
+ state.output = utils$d.escapeLast(state.output, '{');
3309
3619
  decrement('braces');
3310
3620
  }
3311
3621
 
@@ -3344,7 +3654,7 @@ parse$1.fastpaths = (input, options) => {
3344
3654
  }
3345
3655
 
3346
3656
  input = REPLACEMENTS[input] || input;
3347
- const win32 = utils$2.isWindows(options);
3657
+ const win32 = utils$d.isWindows(options);
3348
3658
 
3349
3659
  // create constants based on platform, for windows or posix
3350
3660
  const {
@@ -3357,7 +3667,7 @@ parse$1.fastpaths = (input, options) => {
3357
3667
  NO_DOTS_SLASH,
3358
3668
  STAR,
3359
3669
  START_ANCHOR
3360
- } = constants$1.globChars(win32);
3670
+ } = constants$2.globChars(win32);
3361
3671
 
3362
3672
  const nodot = opts.dot ? NO_DOTS : NO_DOT;
3363
3673
  const slashDot = opts.dot ? NO_DOTS_SLASH : NO_DOT;
@@ -3412,7 +3722,7 @@ parse$1.fastpaths = (input, options) => {
3412
3722
  }
3413
3723
  };
3414
3724
 
3415
- const output = utils$2.removePrefix(input, state);
3725
+ const output = utils$d.removePrefix(input, state);
3416
3726
  let source = create(output);
3417
3727
 
3418
3728
  if (source && opts.strictSlashes !== true) {
@@ -3424,11 +3734,11 @@ parse$1.fastpaths = (input, options) => {
3424
3734
 
3425
3735
  var parse_1 = parse$1;
3426
3736
 
3427
- const path = path$2;
3737
+ const path$6 = path$a;
3428
3738
  const scan = scan_1;
3429
3739
  const parse = parse_1;
3430
- const utils$1 = utils$4;
3431
- const constants = constants$2;
3740
+ const utils$c = utils$f;
3741
+ const constants$1 = constants$3;
3432
3742
  const isObject = val => val && typeof val === 'object' && !Array.isArray(val);
3433
3743
 
3434
3744
  /**
@@ -3473,7 +3783,7 @@ const picomatch$2 = (glob, options, returnState = false) => {
3473
3783
  }
3474
3784
 
3475
3785
  const opts = options || {};
3476
- const posix = utils$1.isWindows(options);
3786
+ const posix = utils$c.isWindows(options);
3477
3787
  const regex = isState
3478
3788
  ? picomatch$2.compileRe(glob, options)
3479
3789
  : picomatch$2.makeRe(glob, options, false, true);
@@ -3548,7 +3858,7 @@ picomatch$2.test = (input, regex, options, { glob, posix } = {}) => {
3548
3858
  }
3549
3859
 
3550
3860
  const opts = options || {};
3551
- const format = opts.format || (posix ? utils$1.toPosixSlashes : null);
3861
+ const format = opts.format || (posix ? utils$c.toPosixSlashes : null);
3552
3862
  let match = input === glob;
3553
3863
  let output = (match && format) ? format(input) : input;
3554
3864
 
@@ -3582,9 +3892,9 @@ picomatch$2.test = (input, regex, options, { glob, posix } = {}) => {
3582
3892
  * @api public
3583
3893
  */
3584
3894
 
3585
- picomatch$2.matchBase = (input, glob, options, posix = utils$1.isWindows(options)) => {
3895
+ picomatch$2.matchBase = (input, glob, options, posix = utils$c.isWindows(options)) => {
3586
3896
  const regex = glob instanceof RegExp ? glob : picomatch$2.makeRe(glob, options);
3587
- return regex.test(path.basename(input));
3897
+ return regex.test(path$6.basename(input));
3588
3898
  };
3589
3899
 
3590
3900
  /**
@@ -3757,7 +4067,7 @@ picomatch$2.toRegex = (source, options) => {
3757
4067
  * @return {Object}
3758
4068
  */
3759
4069
 
3760
- picomatch$2.constants = constants;
4070
+ picomatch$2.constants = constants$1;
3761
4071
 
3762
4072
  /**
3763
4073
  * Expose "picomatch"
@@ -3767,10 +4077,10 @@ var picomatch_1 = picomatch$2;
3767
4077
 
3768
4078
  var picomatch$1 = picomatch_1;
3769
4079
 
3770
- const util = require$$0;
4080
+ const util = require$$0$1;
3771
4081
  const braces = braces_1;
3772
4082
  const picomatch = picomatch$1;
3773
- const utils = utils$4;
4083
+ const utils$b = utils$f;
3774
4084
  const isEmptyString = val => val === '' || val === './';
3775
4085
 
3776
4086
  /**
@@ -3791,7 +4101,7 @@ const isEmptyString = val => val === '' || val === './';
3791
4101
  * @api public
3792
4102
  */
3793
4103
 
3794
- const micromatch = (list, patterns, options) => {
4104
+ const micromatch$1 = (list, patterns, options) => {
3795
4105
  patterns = [].concat(patterns);
3796
4106
  list = [].concat(list);
3797
4107
 
@@ -3847,7 +4157,7 @@ const micromatch = (list, patterns, options) => {
3847
4157
  * Backwards compatibility
3848
4158
  */
3849
4159
 
3850
- micromatch.match = micromatch;
4160
+ micromatch$1.match = micromatch$1;
3851
4161
 
3852
4162
  /**
3853
4163
  * Returns a matcher function from the given glob `pattern` and `options`.
@@ -3868,7 +4178,7 @@ micromatch.match = micromatch;
3868
4178
  * @api public
3869
4179
  */
3870
4180
 
3871
- micromatch.matcher = (pattern, options) => picomatch(pattern, options);
4181
+ micromatch$1.matcher = (pattern, options) => picomatch(pattern, options);
3872
4182
 
3873
4183
  /**
3874
4184
  * Returns true if **any** of the given glob `patterns` match the specified `string`.
@@ -3887,13 +4197,13 @@ micromatch.matcher = (pattern, options) => picomatch(pattern, options);
3887
4197
  * @api public
3888
4198
  */
3889
4199
 
3890
- micromatch.isMatch = (str, patterns, options) => picomatch(patterns, options)(str);
4200
+ micromatch$1.isMatch = (str, patterns, options) => picomatch(patterns, options)(str);
3891
4201
 
3892
4202
  /**
3893
4203
  * Backwards compatibility
3894
4204
  */
3895
4205
 
3896
- micromatch.any = micromatch.isMatch;
4206
+ micromatch$1.any = micromatch$1.isMatch;
3897
4207
 
3898
4208
  /**
3899
4209
  * Returns a list of strings that _**do not match any**_ of the given `patterns`.
@@ -3912,7 +4222,7 @@ micromatch.any = micromatch.isMatch;
3912
4222
  * @api public
3913
4223
  */
3914
4224
 
3915
- micromatch.not = (list, patterns, options = {}) => {
4225
+ micromatch$1.not = (list, patterns, options = {}) => {
3916
4226
  patterns = [].concat(patterns).map(String);
3917
4227
  let result = new Set();
3918
4228
  let items = [];
@@ -3922,7 +4232,7 @@ micromatch.not = (list, patterns, options = {}) => {
3922
4232
  items.push(state.output);
3923
4233
  };
3924
4234
 
3925
- let matches = micromatch(list, patterns, { ...options, onResult });
4235
+ let matches = micromatch$1(list, patterns, { ...options, onResult });
3926
4236
 
3927
4237
  for (let item of items) {
3928
4238
  if (!matches.includes(item)) {
@@ -3952,13 +4262,13 @@ micromatch.not = (list, patterns, options = {}) => {
3952
4262
  * @api public
3953
4263
  */
3954
4264
 
3955
- micromatch.contains = (str, pattern, options) => {
4265
+ micromatch$1.contains = (str, pattern, options) => {
3956
4266
  if (typeof str !== 'string') {
3957
4267
  throw new TypeError(`Expected a string: "${util.inspect(str)}"`);
3958
4268
  }
3959
4269
 
3960
4270
  if (Array.isArray(pattern)) {
3961
- return pattern.some(p => micromatch.contains(str, p, options));
4271
+ return pattern.some(p => micromatch$1.contains(str, p, options));
3962
4272
  }
3963
4273
 
3964
4274
  if (typeof pattern === 'string') {
@@ -3971,7 +4281,7 @@ micromatch.contains = (str, pattern, options) => {
3971
4281
  }
3972
4282
  }
3973
4283
 
3974
- return micromatch.isMatch(str, pattern, { ...options, contains: true });
4284
+ return micromatch$1.isMatch(str, pattern, { ...options, contains: true });
3975
4285
  };
3976
4286
 
3977
4287
  /**
@@ -3994,11 +4304,11 @@ micromatch.contains = (str, pattern, options) => {
3994
4304
  * @api public
3995
4305
  */
3996
4306
 
3997
- micromatch.matchKeys = (obj, patterns, options) => {
3998
- if (!utils.isObject(obj)) {
4307
+ micromatch$1.matchKeys = (obj, patterns, options) => {
4308
+ if (!utils$b.isObject(obj)) {
3999
4309
  throw new TypeError('Expected the first argument to be an object');
4000
4310
  }
4001
- let keys = micromatch(Object.keys(obj), patterns, options);
4311
+ let keys = micromatch$1(Object.keys(obj), patterns, options);
4002
4312
  let res = {};
4003
4313
  for (let key of keys) res[key] = obj[key];
4004
4314
  return res;
@@ -4023,7 +4333,7 @@ micromatch.matchKeys = (obj, patterns, options) => {
4023
4333
  * @api public
4024
4334
  */
4025
4335
 
4026
- micromatch.some = (list, patterns, options) => {
4336
+ micromatch$1.some = (list, patterns, options) => {
4027
4337
  let items = [].concat(list);
4028
4338
 
4029
4339
  for (let pattern of [].concat(patterns)) {
@@ -4059,7 +4369,7 @@ micromatch.some = (list, patterns, options) => {
4059
4369
  * @api public
4060
4370
  */
4061
4371
 
4062
- micromatch.every = (list, patterns, options) => {
4372
+ micromatch$1.every = (list, patterns, options) => {
4063
4373
  let items = [].concat(list);
4064
4374
 
4065
4375
  for (let pattern of [].concat(patterns)) {
@@ -4098,7 +4408,7 @@ micromatch.every = (list, patterns, options) => {
4098
4408
  * @api public
4099
4409
  */
4100
4410
 
4101
- micromatch.all = (str, patterns, options) => {
4411
+ micromatch$1.all = (str, patterns, options) => {
4102
4412
  if (typeof str !== 'string') {
4103
4413
  throw new TypeError(`Expected a string: "${util.inspect(str)}"`);
4104
4414
  }
@@ -4125,10 +4435,10 @@ micromatch.all = (str, patterns, options) => {
4125
4435
  * @api public
4126
4436
  */
4127
4437
 
4128
- micromatch.capture = (glob, input, options) => {
4129
- let posix = utils.isWindows(options);
4438
+ micromatch$1.capture = (glob, input, options) => {
4439
+ let posix = utils$b.isWindows(options);
4130
4440
  let regex = picomatch.makeRe(String(glob), { ...options, capture: true });
4131
- let match = regex.exec(posix ? utils.toPosixSlashes(input) : input);
4441
+ let match = regex.exec(posix ? utils$b.toPosixSlashes(input) : input);
4132
4442
 
4133
4443
  if (match) {
4134
4444
  return match.slice(1).map(v => v === void 0 ? '' : v);
@@ -4151,7 +4461,7 @@ micromatch.capture = (glob, input, options) => {
4151
4461
  * @api public
4152
4462
  */
4153
4463
 
4154
- micromatch.makeRe = (...args) => picomatch.makeRe(...args);
4464
+ micromatch$1.makeRe = (...args) => picomatch.makeRe(...args);
4155
4465
 
4156
4466
  /**
4157
4467
  * Scan a glob pattern to separate the pattern into segments. Used
@@ -4167,7 +4477,7 @@ micromatch.makeRe = (...args) => picomatch.makeRe(...args);
4167
4477
  * @api public
4168
4478
  */
4169
4479
 
4170
- micromatch.scan = (...args) => picomatch.scan(...args);
4480
+ micromatch$1.scan = (...args) => picomatch.scan(...args);
4171
4481
 
4172
4482
  /**
4173
4483
  * Parse a glob pattern to create the source string for a regular
@@ -4183,7 +4493,7 @@ micromatch.scan = (...args) => picomatch.scan(...args);
4183
4493
  * @api public
4184
4494
  */
4185
4495
 
4186
- micromatch.parse = (patterns, options) => {
4496
+ micromatch$1.parse = (patterns, options) => {
4187
4497
  let res = [];
4188
4498
  for (let pattern of [].concat(patterns || [])) {
4189
4499
  for (let str of braces(String(pattern), options)) {
@@ -4210,7 +4520,7 @@ micromatch.parse = (patterns, options) => {
4210
4520
  * @api public
4211
4521
  */
4212
4522
 
4213
- micromatch.braces = (pattern, options) => {
4523
+ micromatch$1.braces = (pattern, options) => {
4214
4524
  if (typeof pattern !== 'string') throw new TypeError('Expected a string');
4215
4525
  if ((options && options.nobrace === true) || !/\{.*\}/.test(pattern)) {
4216
4526
  return [pattern];
@@ -4222,16 +4532,2168 @@ micromatch.braces = (pattern, options) => {
4222
4532
  * Expand braces
4223
4533
  */
4224
4534
 
4225
- micromatch.braceExpand = (pattern, options) => {
4535
+ micromatch$1.braceExpand = (pattern, options) => {
4226
4536
  if (typeof pattern !== 'string') throw new TypeError('Expected a string');
4227
- return micromatch.braces(pattern, { ...options, expand: true });
4537
+ return micromatch$1.braces(pattern, { ...options, expand: true });
4228
4538
  };
4229
4539
 
4230
4540
  /**
4231
4541
  * Expose micromatch
4232
4542
  */
4233
4543
 
4234
- 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;
4235
6697
 
4236
6698
  class SnapshotManager {
4237
6699
  constructor(config) {
@@ -4805,7 +7267,7 @@ function formatTestPath(root, path) {
4805
7267
  const dir = dirname(path);
4806
7268
  const ext = ((_a = path.match(/(\.(spec|test)\.[cm]?[tj]sx?)$/)) == null ? void 0 : _a[0]) || "";
4807
7269
  const base = basename(path, ext);
4808
- return slash(c.dim(`${dir}/`) + c.bold(base)) + c.dim(ext);
7270
+ return slash$1(c.dim(`${dir}/`) + c.bold(base)) + c.dim(ext);
4809
7271
  }
4810
7272
  function renderSnapshotSummary(rootDir, snapshots) {
4811
7273
  const summary = [];
@@ -4968,7 +7430,6 @@ class ConsoleReporter {
4968
7430
  this.ctx = ctx;
4969
7431
  this.start = 0;
4970
7432
  this.end = 0;
4971
- this.console = globalThis.console;
4972
7433
  this.isFirstWatchRun = true;
4973
7434
  const mode = ctx.config.watch ? c.yellow(" DEV ") : c.cyan(" RUN ");
4974
7435
  this.log(`
@@ -4979,12 +7440,12 @@ ${c.inverse(c.bold(mode))} ${c.gray(this.ctx.config.root)}
4979
7440
  log(...args) {
4980
7441
  if (this.ctx.config.silent)
4981
7442
  return;
4982
- this.console.log(...args);
7443
+ this.ctx.console.log(...args);
4983
7444
  }
4984
7445
  error(...args) {
4985
7446
  if (this.ctx.config.silent)
4986
7447
  return;
4987
- this.console.error(...args);
7448
+ this.ctx.console.error(...args);
4988
7449
  }
4989
7450
  relative(path) {
4990
7451
  return relative(this.ctx.config.root, path);
@@ -5092,9 +7553,11 @@ ${c.bold(c.inverse(c.green(" PASS ")))}${c.green(" Waiting for file changes...")
5092
7553
  async onWatcherRerun(files, trigger) {
5093
7554
  await this.stopListRender();
5094
7555
  this.watchFilters = files;
5095
- this.console.clear();
5096
- this.log(c.blue("Re-running tests...") + c.dim(` [ ${this.relative(trigger)} ]
7556
+ if (!this.ctx.config.silent) {
7557
+ this.ctx.console.clear();
7558
+ this.log(c.blue("Re-running tests...") + c.dim(` [ ${this.relative(trigger)} ]
5097
7559
  `));
7560
+ }
5098
7561
  }
5099
7562
  async stopListRender() {
5100
7563
  var _a;
@@ -5183,6 +7646,9 @@ function resolveConfig(options, viteConfig) {
5183
7646
  resolved.interpretDefault = resolved.interpretDefault ?? true;
5184
7647
  resolved.include = resolved.include ?? defaultInclude;
5185
7648
  resolved.exclude = resolved.exclude ?? defaultExclude;
7649
+ resolved.testTimeout = resolved.testTimeout ?? 5e3;
7650
+ resolved.hookTimeout = resolved.hookTimeout ?? 1e4;
7651
+ resolved.watchIgnore = resolved.watchIgnore ?? [/\/node_modules\//, /\/dist\//];
5186
7652
  const CI = !!process.env.CI;
5187
7653
  const UPDATE_SNAPSHOT = resolved.update || process.env.UPDATE_SNAPSHOT;
5188
7654
  resolved.snapshotOptions = {
@@ -5230,7 +7696,7 @@ function createPool(ctx) {
5230
7696
  else
5231
7697
  return createFakePool(ctx);
5232
7698
  }
5233
- const workerPath = new URL("./dist/worker.js", pathToFileURL(distDir)).href;
7699
+ const workerPath = pathToFileURL(resolve(distDir, "./worker.js")).href;
5234
7700
  function createFakePool(ctx) {
5235
7701
  const runWithFiles = (name) => {
5236
7702
  return async (files, invalidates) => {
@@ -5345,7 +7811,7 @@ class Vitest {
5345
7811
  this.isFirstRun = true;
5346
7812
  this.restartsCount = 0;
5347
7813
  this._onRestartListeners = [];
5348
- this.unregisterWatcher = noop;
7814
+ this.unregisterWatcher = noop$1;
5349
7815
  this.console = globalThis.console;
5350
7816
  }
5351
7817
  setServer(options, server) {
@@ -5361,7 +7827,7 @@ class Vitest {
5361
7827
  this.state = new StateManager();
5362
7828
  this.snapshot = new SnapshotManager(resolved);
5363
7829
  this.reporters = toArray(resolved.reporters);
5364
- if (!this.reporters.length)
7830
+ if (!this.reporters.length && !this.config.silent)
5365
7831
  this.reporters.push(new ConsoleReporter(this));
5366
7832
  if (this.config.watch)
5367
7833
  this.registerWatcher();
@@ -5409,7 +7875,9 @@ class Vitest {
5409
7875
  if (this.restartsCount !== currentCount)
5410
7876
  return;
5411
7877
  this.isFirstRun = false;
7878
+ this.snapshot.clear();
5412
7879
  const files = Array.from(this.changedTests);
7880
+ this.changedTests.clear();
5413
7881
  await this.report("onWatcherRerun", files, triggerId);
5414
7882
  await this.runFiles(files);
5415
7883
  await this.report("onWatcherStart");
@@ -5417,13 +7885,13 @@ class Vitest {
5417
7885
  }
5418
7886
  registerWatcher() {
5419
7887
  const onChange = (id) => {
5420
- id = slash(id);
7888
+ id = slash$1(id);
5421
7889
  this.handleFileChanged(id);
5422
7890
  if (this.changedTests.size)
5423
7891
  this.scheduleRerun(id);
5424
7892
  };
5425
7893
  const onUnlink = (id) => {
5426
- id = slash(id);
7894
+ id = slash$1(id);
5427
7895
  this.invalidates.add(id);
5428
7896
  if (id in this.state.filesMap) {
5429
7897
  delete this.state.filesMap[id];
@@ -5431,7 +7899,7 @@ class Vitest {
5431
7899
  }
5432
7900
  };
5433
7901
  const onAdd = (id) => {
5434
- id = slash(id);
7902
+ id = slash$1(id);
5435
7903
  if (this.isTargetFile(id)) {
5436
7904
  this.changedTests.add(id);
5437
7905
  this.scheduleRerun(id);
@@ -5445,24 +7913,24 @@ class Vitest {
5445
7913
  watcher.off("change", onChange);
5446
7914
  watcher.off("unlink", onUnlink);
5447
7915
  watcher.off("add", onAdd);
5448
- this.unregisterWatcher = noop;
7916
+ this.unregisterWatcher = noop$1;
5449
7917
  };
5450
7918
  }
5451
7919
  handleFileChanged(id) {
5452
- if (this.changedTests.has(id) || this.invalidates.has(id) || id.includes("/node_modules/") || id.includes("/vitest/dist/"))
7920
+ if (this.changedTests.has(id) || this.invalidates.has(id) || this.config.watchIgnore.some((i) => id.match(i)))
7921
+ return;
7922
+ const mod = this.server.moduleGraph.getModuleById(id);
7923
+ if (!mod)
5453
7924
  return;
5454
7925
  this.invalidates.add(id);
5455
7926
  if (id in this.state.filesMap) {
5456
7927
  this.changedTests.add(id);
5457
7928
  return;
5458
7929
  }
5459
- const mod = this.server.moduleGraph.getModuleById(id);
5460
- if (mod) {
5461
- mod.importers.forEach((i) => {
5462
- if (i.id)
5463
- this.handleFileChanged(i.id);
5464
- });
5465
- }
7930
+ mod.importers.forEach((i) => {
7931
+ if (i.id)
7932
+ this.handleFileChanged(i.id);
7933
+ });
5466
7934
  }
5467
7935
  async close() {
5468
7936
  var _a;
@@ -5476,7 +7944,7 @@ class Vitest {
5476
7944
  }));
5477
7945
  }
5478
7946
  async globTestFiles(filters) {
5479
- let files = await fg(this.config.include, {
7947
+ let files = await out(this.config.include, {
5480
7948
  absolute: true,
5481
7949
  cwd: this.config.root,
5482
7950
  ignore: this.config.exclude
@@ -5513,7 +7981,7 @@ async function createVitest(options, viteOverrides = {}) {
5513
7981
  ctx.setServer(options, server2);
5514
7982
  haveStarted = true;
5515
7983
  if (options.api)
5516
- server2.middlewares.use((await import('./middleware-bf0f818d.js')).default(ctx));
7984
+ server2.middlewares.use((await import('./middleware-991dfa87.js')).default(ctx));
5517
7985
  }
5518
7986
  }
5519
7987
  ],