vitest 0.0.129 → 0.0.130

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,5 +1,5 @@
1
1
  import fs$8, { promises, existsSync } from 'fs';
2
- import { c, s as slash$1, a as isAbsolute, r as relative, d as dirname, b as basename, g as getFullName, h as hasFailed, f as getSuites, j as getTests, t as toArray, k as resolve, l as deepMerge, m as toFilePath, n as noop$1, e as ensurePackageInstalled } from './index-42a3a132.js';
2
+ import { c, s as slash$1, a as isAbsolute, r as relative, d as dirname, b as basename, g as getFullName, h as hasFailed, f as getSuites, j as getTests, t as toArray, k as resolve, l as deepMerge, m as toFilePath, n as noop$1, e as ensurePackageInstalled } from './index-9fdde2e8.js';
3
3
  import { createServer, mergeConfig } from 'vite';
4
4
  import path$a from 'path';
5
5
  import process$1 from 'process';
@@ -7,17 +7,16 @@ import require$$0 from 'os';
7
7
  import require$$0$1 from 'util';
8
8
  import require$$0$2 from 'stream';
9
9
  import require$$2 from 'events';
10
- import { c as commonjsGlobal } from './_commonjsHelpers-c9e3b764.js';
11
- import { d as defaultPort, a as defaultInclude, b as defaultExclude, c as distDir, e as configFiles } from './constants-868b9a2e.js';
12
- import MagicString from './magic-string.es-98a8bfa0.js';
10
+ import { d as defaultPort, a as defaultInclude, b as defaultExclude, c as distDir, e as configFiles } from './constants-5b9c0d41.js';
11
+ import MagicString from './magic-string.es-94000aea.js';
13
12
  import { performance } from 'perf_hooks';
14
- import { F as F_POINTER, a as F_DOWN, s as stripAnsi, b as F_LONG_DASH, c as F_DOWN_RIGHT, d as F_DOT, e as F_CHECK, f as F_CROSS, g as F_RIGHT, p as printError, h as stringWidth, i as ansiStyles, j as sliceAnsi, k as cliTruncate } from './diff-be830986.js';
15
- import { o as onetime, s as signalExit } from './index-cb02ee01.js';
13
+ import { F as F_POINTER, a as F_DOWN, s as stripAnsi, b as F_LONG_DASH, c as F_DOWN_RIGHT, d as F_DOT, e as F_CHECK, f as F_CROSS, g as F_RIGHT, p as printError, h as stringWidth, i as ansiStyles, j as sliceAnsi, k as cliTruncate } from './diff-3adb959a.js';
14
+ import { o as onetime, s as signalExit } from './index-648e7ab2.js';
16
15
  import { createRequire } from 'module';
17
16
  import { pathToFileURL } from 'url';
18
17
  import { MessageChannel } from 'worker_threads';
19
18
  import { Tinypool } from 'tinypool';
20
- import { c as createBirpc } from './index-a73f33e0.js';
19
+ import { c as createBirpc } from './index-e909c175.js';
21
20
 
22
21
  /*
23
22
  How it works:
@@ -4985,65 +4984,61 @@ var out$3 = {};
4985
4984
 
4986
4985
  var async$5 = {};
4987
4986
 
4988
- Object.defineProperty(async$5, "__esModule", { value: true });
4989
- async$5.read = void 0;
4990
- function read$3(path, settings, callback) {
4991
- settings.fs.lstat(path, (lstatError, lstat) => {
4992
- if (lstatError !== null) {
4993
- callFailureCallback$2(callback, lstatError);
4994
- return;
4995
- }
4996
- if (!lstat.isSymbolicLink() || !settings.followSymbolicLink) {
4997
- callSuccessCallback$2(callback, lstat);
4998
- return;
4999
- }
5000
- settings.fs.stat(path, (statError, stat) => {
5001
- if (statError !== null) {
5002
- if (settings.throwErrorOnBrokenSymbolicLink) {
5003
- callFailureCallback$2(callback, statError);
5004
- return;
5005
- }
5006
- callSuccessCallback$2(callback, lstat);
5007
- return;
5008
- }
5009
- if (settings.markSymbolicLink) {
5010
- stat.isSymbolicLink = () => true;
5011
- }
5012
- callSuccessCallback$2(callback, stat);
5013
- });
5014
- });
5015
- }
5016
- async$5.read = read$3;
5017
- function callFailureCallback$2(callback, error) {
5018
- callback(error);
5019
- }
5020
- function callSuccessCallback$2(callback, result) {
5021
- callback(null, result);
4987
+ Object.defineProperty(async$5, "__esModule", { value: true });
4988
+ async$5.read = void 0;
4989
+ function read$3(path, settings, callback) {
4990
+ settings.fs.lstat(path, (lstatError, lstat) => {
4991
+ if (lstatError !== null) {
4992
+ return callFailureCallback$2(callback, lstatError);
4993
+ }
4994
+ if (!lstat.isSymbolicLink() || !settings.followSymbolicLink) {
4995
+ return callSuccessCallback$2(callback, lstat);
4996
+ }
4997
+ settings.fs.stat(path, (statError, stat) => {
4998
+ if (statError !== null) {
4999
+ if (settings.throwErrorOnBrokenSymbolicLink) {
5000
+ return callFailureCallback$2(callback, statError);
5001
+ }
5002
+ return callSuccessCallback$2(callback, lstat);
5003
+ }
5004
+ if (settings.markSymbolicLink) {
5005
+ stat.isSymbolicLink = () => true;
5006
+ }
5007
+ callSuccessCallback$2(callback, stat);
5008
+ });
5009
+ });
5010
+ }
5011
+ async$5.read = read$3;
5012
+ function callFailureCallback$2(callback, error) {
5013
+ callback(error);
5014
+ }
5015
+ function callSuccessCallback$2(callback, result) {
5016
+ callback(null, result);
5022
5017
  }
5023
5018
 
5024
5019
  var sync$7 = {};
5025
5020
 
5026
- Object.defineProperty(sync$7, "__esModule", { value: true });
5027
- sync$7.read = void 0;
5028
- function read$2(path, settings) {
5029
- const lstat = settings.fs.lstatSync(path);
5030
- if (!lstat.isSymbolicLink() || !settings.followSymbolicLink) {
5031
- return lstat;
5032
- }
5033
- try {
5034
- const stat = settings.fs.statSync(path);
5035
- if (settings.markSymbolicLink) {
5036
- stat.isSymbolicLink = () => true;
5037
- }
5038
- return stat;
5039
- }
5040
- catch (error) {
5041
- if (!settings.throwErrorOnBrokenSymbolicLink) {
5042
- return lstat;
5043
- }
5044
- throw error;
5045
- }
5046
- }
5021
+ Object.defineProperty(sync$7, "__esModule", { value: true });
5022
+ sync$7.read = void 0;
5023
+ function read$2(path, settings) {
5024
+ const lstat = settings.fs.lstatSync(path);
5025
+ if (!lstat.isSymbolicLink() || !settings.followSymbolicLink) {
5026
+ return lstat;
5027
+ }
5028
+ try {
5029
+ const stat = settings.fs.statSync(path);
5030
+ if (settings.markSymbolicLink) {
5031
+ stat.isSymbolicLink = () => true;
5032
+ }
5033
+ return stat;
5034
+ }
5035
+ catch (error) {
5036
+ if (!settings.throwErrorOnBrokenSymbolicLink) {
5037
+ return lstat;
5038
+ }
5039
+ throw error;
5040
+ }
5041
+ }
5047
5042
  sync$7.read = read$2;
5048
5043
 
5049
5044
  var settings$3 = {};
@@ -5051,64 +5046,63 @@ var settings$3 = {};
5051
5046
  var fs$5 = {};
5052
5047
 
5053
5048
  (function (exports) {
5054
- Object.defineProperty(exports, "__esModule", { value: true });
5055
- exports.createFileSystemAdapter = exports.FILE_SYSTEM_ADAPTER = void 0;
5056
- const fs = fs$8;
5057
- exports.FILE_SYSTEM_ADAPTER = {
5058
- lstat: fs.lstat,
5059
- stat: fs.stat,
5060
- lstatSync: fs.lstatSync,
5061
- statSync: fs.statSync
5062
- };
5063
- function createFileSystemAdapter(fsMethods) {
5064
- if (fsMethods === undefined) {
5065
- return exports.FILE_SYSTEM_ADAPTER;
5066
- }
5067
- return Object.assign(Object.assign({}, exports.FILE_SYSTEM_ADAPTER), fsMethods);
5068
- }
5049
+ Object.defineProperty(exports, "__esModule", { value: true });
5050
+ exports.createFileSystemAdapter = exports.FILE_SYSTEM_ADAPTER = void 0;
5051
+ const fs = fs$8;
5052
+ exports.FILE_SYSTEM_ADAPTER = {
5053
+ lstat: fs.lstat,
5054
+ stat: fs.stat,
5055
+ lstatSync: fs.lstatSync,
5056
+ statSync: fs.statSync
5057
+ };
5058
+ function createFileSystemAdapter(fsMethods) {
5059
+ if (fsMethods === undefined) {
5060
+ return exports.FILE_SYSTEM_ADAPTER;
5061
+ }
5062
+ return Object.assign(Object.assign({}, exports.FILE_SYSTEM_ADAPTER), fsMethods);
5063
+ }
5069
5064
  exports.createFileSystemAdapter = createFileSystemAdapter;
5070
5065
  }(fs$5));
5071
5066
 
5072
- Object.defineProperty(settings$3, "__esModule", { value: true });
5073
- const fs$4 = fs$5;
5074
- class Settings$2 {
5075
- constructor(_options = {}) {
5076
- this._options = _options;
5077
- this.followSymbolicLink = this._getValue(this._options.followSymbolicLink, true);
5078
- this.fs = fs$4.createFileSystemAdapter(this._options.fs);
5079
- this.markSymbolicLink = this._getValue(this._options.markSymbolicLink, false);
5080
- this.throwErrorOnBrokenSymbolicLink = this._getValue(this._options.throwErrorOnBrokenSymbolicLink, true);
5081
- }
5082
- _getValue(option, value) {
5083
- return option !== null && option !== void 0 ? option : value;
5084
- }
5085
- }
5067
+ Object.defineProperty(settings$3, "__esModule", { value: true });
5068
+ const fs$4 = fs$5;
5069
+ class Settings$2 {
5070
+ constructor(_options = {}) {
5071
+ this._options = _options;
5072
+ this.followSymbolicLink = this._getValue(this._options.followSymbolicLink, true);
5073
+ this.fs = fs$4.createFileSystemAdapter(this._options.fs);
5074
+ this.markSymbolicLink = this._getValue(this._options.markSymbolicLink, false);
5075
+ this.throwErrorOnBrokenSymbolicLink = this._getValue(this._options.throwErrorOnBrokenSymbolicLink, true);
5076
+ }
5077
+ _getValue(option, value) {
5078
+ return option !== null && option !== void 0 ? option : value;
5079
+ }
5080
+ }
5086
5081
  settings$3.default = Settings$2;
5087
5082
 
5088
- Object.defineProperty(out$3, "__esModule", { value: true });
5089
- out$3.statSync = out$3.stat = out$3.Settings = void 0;
5090
- const async$4 = async$5;
5091
- const sync$6 = sync$7;
5092
- const settings_1$3 = settings$3;
5093
- out$3.Settings = settings_1$3.default;
5094
- function stat(path, optionsOrSettingsOrCallback, callback) {
5095
- if (typeof optionsOrSettingsOrCallback === 'function') {
5096
- async$4.read(path, getSettings$2(), optionsOrSettingsOrCallback);
5097
- return;
5098
- }
5099
- async$4.read(path, getSettings$2(optionsOrSettingsOrCallback), callback);
5100
- }
5101
- out$3.stat = stat;
5102
- function statSync(path, optionsOrSettings) {
5103
- const settings = getSettings$2(optionsOrSettings);
5104
- return sync$6.read(path, settings);
5105
- }
5106
- out$3.statSync = statSync;
5107
- function getSettings$2(settingsOrOptions = {}) {
5108
- if (settingsOrOptions instanceof settings_1$3.default) {
5109
- return settingsOrOptions;
5110
- }
5111
- return new settings_1$3.default(settingsOrOptions);
5083
+ Object.defineProperty(out$3, "__esModule", { value: true });
5084
+ out$3.statSync = out$3.stat = out$3.Settings = void 0;
5085
+ const async$4 = async$5;
5086
+ const sync$6 = sync$7;
5087
+ const settings_1$3 = settings$3;
5088
+ out$3.Settings = settings_1$3.default;
5089
+ function stat(path, optionsOrSettingsOrCallback, callback) {
5090
+ if (typeof optionsOrSettingsOrCallback === 'function') {
5091
+ return async$4.read(path, getSettings$2(), optionsOrSettingsOrCallback);
5092
+ }
5093
+ async$4.read(path, getSettings$2(optionsOrSettingsOrCallback), callback);
5094
+ }
5095
+ out$3.stat = stat;
5096
+ function statSync(path, optionsOrSettings) {
5097
+ const settings = getSettings$2(optionsOrSettings);
5098
+ return sync$6.read(path, settings);
5099
+ }
5100
+ out$3.statSync = statSync;
5101
+ function getSettings$2(settingsOrOptions = {}) {
5102
+ if (settingsOrOptions instanceof settings_1$3.default) {
5103
+ return settingsOrOptions;
5104
+ }
5105
+ return new settings_1$3.default(settingsOrOptions);
5112
5106
  }
5113
5107
 
5114
5108
  var out$2 = {};
@@ -5126,7 +5120,7 @@ var async$1 = {};
5126
5120
  let promise;
5127
5121
 
5128
5122
  var queueMicrotask_1 = typeof queueMicrotask === 'function'
5129
- ? queueMicrotask.bind(typeof window !== 'undefined' ? window : commonjsGlobal)
5123
+ ? queueMicrotask.bind(globalThis)
5130
5124
  // reuse resolved promise, and allocate it lazily
5131
5125
  : cb => (promise || (promise = Promise.resolve()))
5132
5126
  .then(cb)
@@ -5187,224 +5181,209 @@ function runParallel (tasks, cb) {
5187
5181
 
5188
5182
  var constants = {};
5189
5183
 
5190
- Object.defineProperty(constants, "__esModule", { value: true });
5191
- constants.IS_SUPPORT_READDIR_WITH_FILE_TYPES = void 0;
5192
- const NODE_PROCESS_VERSION_PARTS = process.versions.node.split('.');
5193
- if (NODE_PROCESS_VERSION_PARTS[0] === undefined || NODE_PROCESS_VERSION_PARTS[1] === undefined) {
5194
- throw new Error(`Unexpected behavior. The 'process.versions.node' variable has invalid value: ${process.versions.node}`);
5195
- }
5196
- const MAJOR_VERSION = Number.parseInt(NODE_PROCESS_VERSION_PARTS[0], 10);
5197
- const MINOR_VERSION = Number.parseInt(NODE_PROCESS_VERSION_PARTS[1], 10);
5198
- const SUPPORTED_MAJOR_VERSION = 10;
5199
- const SUPPORTED_MINOR_VERSION = 10;
5200
- const IS_MATCHED_BY_MAJOR = MAJOR_VERSION > SUPPORTED_MAJOR_VERSION;
5201
- const IS_MATCHED_BY_MAJOR_AND_MINOR = MAJOR_VERSION === SUPPORTED_MAJOR_VERSION && MINOR_VERSION >= SUPPORTED_MINOR_VERSION;
5202
- /**
5203
- * IS `true` for Node.js 10.10 and greater.
5204
- */
5184
+ Object.defineProperty(constants, "__esModule", { value: true });
5185
+ constants.IS_SUPPORT_READDIR_WITH_FILE_TYPES = void 0;
5186
+ const NODE_PROCESS_VERSION_PARTS = process.versions.node.split('.');
5187
+ const MAJOR_VERSION = parseInt(NODE_PROCESS_VERSION_PARTS[0], 10);
5188
+ const MINOR_VERSION = parseInt(NODE_PROCESS_VERSION_PARTS[1], 10);
5189
+ const SUPPORTED_MAJOR_VERSION = 10;
5190
+ const SUPPORTED_MINOR_VERSION = 10;
5191
+ const IS_MATCHED_BY_MAJOR = MAJOR_VERSION > SUPPORTED_MAJOR_VERSION;
5192
+ const IS_MATCHED_BY_MAJOR_AND_MINOR = MAJOR_VERSION === SUPPORTED_MAJOR_VERSION && MINOR_VERSION >= SUPPORTED_MINOR_VERSION;
5193
+ /**
5194
+ * IS `true` for Node.js 10.10 and greater.
5195
+ */
5205
5196
  constants.IS_SUPPORT_READDIR_WITH_FILE_TYPES = IS_MATCHED_BY_MAJOR || IS_MATCHED_BY_MAJOR_AND_MINOR;
5206
5197
 
5207
5198
  var utils$9 = {};
5208
5199
 
5209
5200
  var fs$3 = {};
5210
5201
 
5211
- Object.defineProperty(fs$3, "__esModule", { value: true });
5212
- fs$3.createDirentFromStats = void 0;
5213
- class DirentFromStats {
5214
- constructor(name, stats) {
5215
- this.name = name;
5216
- this.isBlockDevice = stats.isBlockDevice.bind(stats);
5217
- this.isCharacterDevice = stats.isCharacterDevice.bind(stats);
5218
- this.isDirectory = stats.isDirectory.bind(stats);
5219
- this.isFIFO = stats.isFIFO.bind(stats);
5220
- this.isFile = stats.isFile.bind(stats);
5221
- this.isSocket = stats.isSocket.bind(stats);
5222
- this.isSymbolicLink = stats.isSymbolicLink.bind(stats);
5223
- }
5224
- }
5225
- function createDirentFromStats(name, stats) {
5226
- return new DirentFromStats(name, stats);
5227
- }
5202
+ Object.defineProperty(fs$3, "__esModule", { value: true });
5203
+ fs$3.createDirentFromStats = void 0;
5204
+ class DirentFromStats {
5205
+ constructor(name, stats) {
5206
+ this.name = name;
5207
+ this.isBlockDevice = stats.isBlockDevice.bind(stats);
5208
+ this.isCharacterDevice = stats.isCharacterDevice.bind(stats);
5209
+ this.isDirectory = stats.isDirectory.bind(stats);
5210
+ this.isFIFO = stats.isFIFO.bind(stats);
5211
+ this.isFile = stats.isFile.bind(stats);
5212
+ this.isSocket = stats.isSocket.bind(stats);
5213
+ this.isSymbolicLink = stats.isSymbolicLink.bind(stats);
5214
+ }
5215
+ }
5216
+ function createDirentFromStats(name, stats) {
5217
+ return new DirentFromStats(name, stats);
5218
+ }
5228
5219
  fs$3.createDirentFromStats = createDirentFromStats;
5229
5220
 
5230
- Object.defineProperty(utils$9, "__esModule", { value: true });
5231
- utils$9.fs = void 0;
5232
- const fs$2 = fs$3;
5221
+ Object.defineProperty(utils$9, "__esModule", { value: true });
5222
+ utils$9.fs = void 0;
5223
+ const fs$2 = fs$3;
5233
5224
  utils$9.fs = fs$2;
5234
5225
 
5235
5226
  var common$6 = {};
5236
5227
 
5237
- Object.defineProperty(common$6, "__esModule", { value: true });
5238
- common$6.joinPathSegments = void 0;
5239
- function joinPathSegments$1(a, b, separator) {
5240
- /**
5241
- * The correct handling of cases when the first segment is a root (`/`, `C:/`) or UNC path (`//?/C:/`).
5242
- */
5243
- if (a.endsWith(separator)) {
5244
- return a + b;
5245
- }
5246
- return a + separator + b;
5247
- }
5228
+ Object.defineProperty(common$6, "__esModule", { value: true });
5229
+ common$6.joinPathSegments = void 0;
5230
+ function joinPathSegments$1(a, b, separator) {
5231
+ /**
5232
+ * The correct handling of cases when the first segment is a root (`/`, `C:/`) or UNC path (`//?/C:/`).
5233
+ */
5234
+ if (a.endsWith(separator)) {
5235
+ return a + b;
5236
+ }
5237
+ return a + separator + b;
5238
+ }
5248
5239
  common$6.joinPathSegments = joinPathSegments$1;
5249
5240
 
5250
- Object.defineProperty(async$1, "__esModule", { value: true });
5251
- async$1.readdir = async$1.readdirWithFileTypes = async$1.read = void 0;
5252
- const fsStat$5 = out$3;
5253
- const rpl = runParallel_1;
5254
- const constants_1$1 = constants;
5255
- const utils$8 = utils$9;
5256
- const common$5 = common$6;
5257
- function read$1(directory, settings, callback) {
5258
- if (!settings.stats && constants_1$1.IS_SUPPORT_READDIR_WITH_FILE_TYPES) {
5259
- readdirWithFileTypes$1(directory, settings, callback);
5260
- return;
5261
- }
5262
- readdir$1(directory, settings, callback);
5263
- }
5264
- async$1.read = read$1;
5265
- function readdirWithFileTypes$1(directory, settings, callback) {
5266
- settings.fs.readdir(directory, { withFileTypes: true }, (readdirError, dirents) => {
5267
- if (readdirError !== null) {
5268
- callFailureCallback$1(callback, readdirError);
5269
- return;
5270
- }
5271
- const entries = dirents.map((dirent) => ({
5272
- dirent,
5273
- name: dirent.name,
5274
- path: common$5.joinPathSegments(directory, dirent.name, settings.pathSegmentSeparator)
5275
- }));
5276
- if (!settings.followSymbolicLinks) {
5277
- callSuccessCallback$1(callback, entries);
5278
- return;
5279
- }
5280
- const tasks = entries.map((entry) => makeRplTaskEntry(entry, settings));
5281
- rpl(tasks, (rplError, rplEntries) => {
5282
- if (rplError !== null) {
5283
- callFailureCallback$1(callback, rplError);
5284
- return;
5285
- }
5286
- callSuccessCallback$1(callback, rplEntries);
5287
- });
5288
- });
5289
- }
5290
- async$1.readdirWithFileTypes = readdirWithFileTypes$1;
5291
- function makeRplTaskEntry(entry, settings) {
5292
- return (done) => {
5293
- if (!entry.dirent.isSymbolicLink()) {
5294
- done(null, entry);
5295
- return;
5296
- }
5297
- settings.fs.stat(entry.path, (statError, stats) => {
5298
- if (statError !== null) {
5299
- if (settings.throwErrorOnBrokenSymbolicLink) {
5300
- done(statError);
5301
- return;
5302
- }
5303
- done(null, entry);
5304
- return;
5305
- }
5306
- entry.dirent = utils$8.fs.createDirentFromStats(entry.name, stats);
5307
- done(null, entry);
5308
- });
5309
- };
5310
- }
5311
- function readdir$1(directory, settings, callback) {
5312
- settings.fs.readdir(directory, (readdirError, names) => {
5313
- if (readdirError !== null) {
5314
- callFailureCallback$1(callback, readdirError);
5315
- return;
5316
- }
5317
- const tasks = names.map((name) => {
5318
- const path = common$5.joinPathSegments(directory, name, settings.pathSegmentSeparator);
5319
- return (done) => {
5320
- fsStat$5.stat(path, settings.fsStatSettings, (error, stats) => {
5321
- if (error !== null) {
5322
- done(error);
5323
- return;
5324
- }
5325
- const entry = {
5326
- name,
5327
- path,
5328
- dirent: utils$8.fs.createDirentFromStats(name, stats)
5329
- };
5330
- if (settings.stats) {
5331
- entry.stats = stats;
5332
- }
5333
- done(null, entry);
5334
- });
5335
- };
5336
- });
5337
- rpl(tasks, (rplError, entries) => {
5338
- if (rplError !== null) {
5339
- callFailureCallback$1(callback, rplError);
5340
- return;
5341
- }
5342
- callSuccessCallback$1(callback, entries);
5343
- });
5344
- });
5345
- }
5346
- async$1.readdir = readdir$1;
5347
- function callFailureCallback$1(callback, error) {
5348
- callback(error);
5349
- }
5350
- function callSuccessCallback$1(callback, result) {
5351
- callback(null, result);
5241
+ Object.defineProperty(async$1, "__esModule", { value: true });
5242
+ async$1.readdir = async$1.readdirWithFileTypes = async$1.read = void 0;
5243
+ const fsStat$5 = out$3;
5244
+ const rpl = runParallel_1;
5245
+ const constants_1$1 = constants;
5246
+ const utils$8 = utils$9;
5247
+ const common$5 = common$6;
5248
+ function read$1(directory, settings, callback) {
5249
+ if (!settings.stats && constants_1$1.IS_SUPPORT_READDIR_WITH_FILE_TYPES) {
5250
+ return readdirWithFileTypes$1(directory, settings, callback);
5251
+ }
5252
+ return readdir$1(directory, settings, callback);
5253
+ }
5254
+ async$1.read = read$1;
5255
+ function readdirWithFileTypes$1(directory, settings, callback) {
5256
+ settings.fs.readdir(directory, { withFileTypes: true }, (readdirError, dirents) => {
5257
+ if (readdirError !== null) {
5258
+ return callFailureCallback$1(callback, readdirError);
5259
+ }
5260
+ const entries = dirents.map((dirent) => ({
5261
+ dirent,
5262
+ name: dirent.name,
5263
+ path: common$5.joinPathSegments(directory, dirent.name, settings.pathSegmentSeparator)
5264
+ }));
5265
+ if (!settings.followSymbolicLinks) {
5266
+ return callSuccessCallback$1(callback, entries);
5267
+ }
5268
+ const tasks = entries.map((entry) => makeRplTaskEntry(entry, settings));
5269
+ rpl(tasks, (rplError, rplEntries) => {
5270
+ if (rplError !== null) {
5271
+ return callFailureCallback$1(callback, rplError);
5272
+ }
5273
+ callSuccessCallback$1(callback, rplEntries);
5274
+ });
5275
+ });
5276
+ }
5277
+ async$1.readdirWithFileTypes = readdirWithFileTypes$1;
5278
+ function makeRplTaskEntry(entry, settings) {
5279
+ return (done) => {
5280
+ if (!entry.dirent.isSymbolicLink()) {
5281
+ return done(null, entry);
5282
+ }
5283
+ settings.fs.stat(entry.path, (statError, stats) => {
5284
+ if (statError !== null) {
5285
+ if (settings.throwErrorOnBrokenSymbolicLink) {
5286
+ return done(statError);
5287
+ }
5288
+ return done(null, entry);
5289
+ }
5290
+ entry.dirent = utils$8.fs.createDirentFromStats(entry.name, stats);
5291
+ return done(null, entry);
5292
+ });
5293
+ };
5294
+ }
5295
+ function readdir$1(directory, settings, callback) {
5296
+ settings.fs.readdir(directory, (readdirError, names) => {
5297
+ if (readdirError !== null) {
5298
+ return callFailureCallback$1(callback, readdirError);
5299
+ }
5300
+ const filepaths = names.map((name) => common$5.joinPathSegments(directory, name, settings.pathSegmentSeparator));
5301
+ const tasks = filepaths.map((filepath) => {
5302
+ return (done) => fsStat$5.stat(filepath, settings.fsStatSettings, done);
5303
+ });
5304
+ rpl(tasks, (rplError, results) => {
5305
+ if (rplError !== null) {
5306
+ return callFailureCallback$1(callback, rplError);
5307
+ }
5308
+ const entries = [];
5309
+ names.forEach((name, index) => {
5310
+ const stats = results[index];
5311
+ const entry = {
5312
+ name,
5313
+ path: filepaths[index],
5314
+ dirent: utils$8.fs.createDirentFromStats(name, stats)
5315
+ };
5316
+ if (settings.stats) {
5317
+ entry.stats = stats;
5318
+ }
5319
+ entries.push(entry);
5320
+ });
5321
+ callSuccessCallback$1(callback, entries);
5322
+ });
5323
+ });
5324
+ }
5325
+ async$1.readdir = readdir$1;
5326
+ function callFailureCallback$1(callback, error) {
5327
+ callback(error);
5328
+ }
5329
+ function callSuccessCallback$1(callback, result) {
5330
+ callback(null, result);
5352
5331
  }
5353
5332
 
5354
5333
  var sync$5 = {};
5355
5334
 
5356
- Object.defineProperty(sync$5, "__esModule", { value: true });
5357
- sync$5.readdir = sync$5.readdirWithFileTypes = sync$5.read = void 0;
5358
- const fsStat$4 = out$3;
5359
- const constants_1 = constants;
5360
- const utils$7 = utils$9;
5361
- const common$4 = common$6;
5362
- function read(directory, settings) {
5363
- if (!settings.stats && constants_1.IS_SUPPORT_READDIR_WITH_FILE_TYPES) {
5364
- return readdirWithFileTypes(directory, settings);
5365
- }
5366
- return readdir(directory, settings);
5367
- }
5368
- sync$5.read = read;
5369
- function readdirWithFileTypes(directory, settings) {
5370
- const dirents = settings.fs.readdirSync(directory, { withFileTypes: true });
5371
- return dirents.map((dirent) => {
5372
- const entry = {
5373
- dirent,
5374
- name: dirent.name,
5375
- path: common$4.joinPathSegments(directory, dirent.name, settings.pathSegmentSeparator)
5376
- };
5377
- if (entry.dirent.isSymbolicLink() && settings.followSymbolicLinks) {
5378
- try {
5379
- const stats = settings.fs.statSync(entry.path);
5380
- entry.dirent = utils$7.fs.createDirentFromStats(entry.name, stats);
5381
- }
5382
- catch (error) {
5383
- if (settings.throwErrorOnBrokenSymbolicLink) {
5384
- throw error;
5385
- }
5386
- }
5387
- }
5388
- return entry;
5389
- });
5390
- }
5391
- sync$5.readdirWithFileTypes = readdirWithFileTypes;
5392
- function readdir(directory, settings) {
5393
- const names = settings.fs.readdirSync(directory);
5394
- return names.map((name) => {
5395
- const entryPath = common$4.joinPathSegments(directory, name, settings.pathSegmentSeparator);
5396
- const stats = fsStat$4.statSync(entryPath, settings.fsStatSettings);
5397
- const entry = {
5398
- name,
5399
- path: entryPath,
5400
- dirent: utils$7.fs.createDirentFromStats(name, stats)
5401
- };
5402
- if (settings.stats) {
5403
- entry.stats = stats;
5404
- }
5405
- return entry;
5406
- });
5407
- }
5335
+ Object.defineProperty(sync$5, "__esModule", { value: true });
5336
+ sync$5.readdir = sync$5.readdirWithFileTypes = sync$5.read = void 0;
5337
+ const fsStat$4 = out$3;
5338
+ const constants_1 = constants;
5339
+ const utils$7 = utils$9;
5340
+ const common$4 = common$6;
5341
+ function read(directory, settings) {
5342
+ if (!settings.stats && constants_1.IS_SUPPORT_READDIR_WITH_FILE_TYPES) {
5343
+ return readdirWithFileTypes(directory, settings);
5344
+ }
5345
+ return readdir(directory, settings);
5346
+ }
5347
+ sync$5.read = read;
5348
+ function readdirWithFileTypes(directory, settings) {
5349
+ const dirents = settings.fs.readdirSync(directory, { withFileTypes: true });
5350
+ return dirents.map((dirent) => {
5351
+ const entry = {
5352
+ dirent,
5353
+ name: dirent.name,
5354
+ path: common$4.joinPathSegments(directory, dirent.name, settings.pathSegmentSeparator)
5355
+ };
5356
+ if (entry.dirent.isSymbolicLink() && settings.followSymbolicLinks) {
5357
+ try {
5358
+ const stats = settings.fs.statSync(entry.path);
5359
+ entry.dirent = utils$7.fs.createDirentFromStats(entry.name, stats);
5360
+ }
5361
+ catch (error) {
5362
+ if (settings.throwErrorOnBrokenSymbolicLink) {
5363
+ throw error;
5364
+ }
5365
+ }
5366
+ }
5367
+ return entry;
5368
+ });
5369
+ }
5370
+ sync$5.readdirWithFileTypes = readdirWithFileTypes;
5371
+ function readdir(directory, settings) {
5372
+ const names = settings.fs.readdirSync(directory);
5373
+ return names.map((name) => {
5374
+ const entryPath = common$4.joinPathSegments(directory, name, settings.pathSegmentSeparator);
5375
+ const stats = fsStat$4.statSync(entryPath, settings.fsStatSettings);
5376
+ const entry = {
5377
+ name,
5378
+ path: entryPath,
5379
+ dirent: utils$7.fs.createDirentFromStats(name, stats)
5380
+ };
5381
+ if (settings.stats) {
5382
+ entry.stats = stats;
5383
+ }
5384
+ return entry;
5385
+ });
5386
+ }
5408
5387
  sync$5.readdir = readdir;
5409
5388
 
5410
5389
  var settings$2 = {};
@@ -5412,78 +5391,75 @@ var settings$2 = {};
5412
5391
  var fs$1 = {};
5413
5392
 
5414
5393
  (function (exports) {
5415
- Object.defineProperty(exports, "__esModule", { value: true });
5416
- exports.createFileSystemAdapter = exports.FILE_SYSTEM_ADAPTER = void 0;
5417
- const fs = fs$8;
5418
- exports.FILE_SYSTEM_ADAPTER = {
5419
- lstat: fs.lstat,
5420
- stat: fs.stat,
5421
- lstatSync: fs.lstatSync,
5422
- statSync: fs.statSync,
5423
- readdir: fs.readdir,
5424
- readdirSync: fs.readdirSync
5425
- };
5426
- function createFileSystemAdapter(fsMethods) {
5427
- if (fsMethods === undefined) {
5428
- return exports.FILE_SYSTEM_ADAPTER;
5429
- }
5430
- return Object.assign(Object.assign({}, exports.FILE_SYSTEM_ADAPTER), fsMethods);
5431
- }
5394
+ Object.defineProperty(exports, "__esModule", { value: true });
5395
+ exports.createFileSystemAdapter = exports.FILE_SYSTEM_ADAPTER = void 0;
5396
+ const fs = fs$8;
5397
+ exports.FILE_SYSTEM_ADAPTER = {
5398
+ lstat: fs.lstat,
5399
+ stat: fs.stat,
5400
+ lstatSync: fs.lstatSync,
5401
+ statSync: fs.statSync,
5402
+ readdir: fs.readdir,
5403
+ readdirSync: fs.readdirSync
5404
+ };
5405
+ function createFileSystemAdapter(fsMethods) {
5406
+ if (fsMethods === undefined) {
5407
+ return exports.FILE_SYSTEM_ADAPTER;
5408
+ }
5409
+ return Object.assign(Object.assign({}, exports.FILE_SYSTEM_ADAPTER), fsMethods);
5410
+ }
5432
5411
  exports.createFileSystemAdapter = createFileSystemAdapter;
5433
5412
  }(fs$1));
5434
5413
 
5435
- Object.defineProperty(settings$2, "__esModule", { value: true });
5436
- const path$3 = path$a;
5437
- const fsStat$3 = out$3;
5438
- const fs = fs$1;
5439
- class Settings$1 {
5440
- constructor(_options = {}) {
5441
- this._options = _options;
5442
- this.followSymbolicLinks = this._getValue(this._options.followSymbolicLinks, false);
5443
- this.fs = fs.createFileSystemAdapter(this._options.fs);
5444
- this.pathSegmentSeparator = this._getValue(this._options.pathSegmentSeparator, path$3.sep);
5445
- this.stats = this._getValue(this._options.stats, false);
5446
- this.throwErrorOnBrokenSymbolicLink = this._getValue(this._options.throwErrorOnBrokenSymbolicLink, true);
5447
- this.fsStatSettings = new fsStat$3.Settings({
5448
- followSymbolicLink: this.followSymbolicLinks,
5449
- fs: this.fs,
5450
- throwErrorOnBrokenSymbolicLink: this.throwErrorOnBrokenSymbolicLink
5451
- });
5452
- }
5453
- _getValue(option, value) {
5454
- return option !== null && option !== void 0 ? option : value;
5455
- }
5456
- }
5414
+ Object.defineProperty(settings$2, "__esModule", { value: true });
5415
+ const path$3 = path$a;
5416
+ const fsStat$3 = out$3;
5417
+ const fs = fs$1;
5418
+ class Settings$1 {
5419
+ constructor(_options = {}) {
5420
+ this._options = _options;
5421
+ this.followSymbolicLinks = this._getValue(this._options.followSymbolicLinks, false);
5422
+ this.fs = fs.createFileSystemAdapter(this._options.fs);
5423
+ this.pathSegmentSeparator = this._getValue(this._options.pathSegmentSeparator, path$3.sep);
5424
+ this.stats = this._getValue(this._options.stats, false);
5425
+ this.throwErrorOnBrokenSymbolicLink = this._getValue(this._options.throwErrorOnBrokenSymbolicLink, true);
5426
+ this.fsStatSettings = new fsStat$3.Settings({
5427
+ followSymbolicLink: this.followSymbolicLinks,
5428
+ fs: this.fs,
5429
+ throwErrorOnBrokenSymbolicLink: this.throwErrorOnBrokenSymbolicLink
5430
+ });
5431
+ }
5432
+ _getValue(option, value) {
5433
+ return option !== null && option !== void 0 ? option : value;
5434
+ }
5435
+ }
5457
5436
  settings$2.default = Settings$1;
5458
5437
 
5459
- Object.defineProperty(out$1, "__esModule", { value: true });
5460
- out$1.Settings = out$1.scandirSync = out$1.scandir = void 0;
5461
- const async = async$1;
5462
- const sync$4 = sync$5;
5463
- const settings_1$2 = settings$2;
5464
- out$1.Settings = settings_1$2.default;
5465
- function scandir(path, optionsOrSettingsOrCallback, callback) {
5466
- if (typeof optionsOrSettingsOrCallback === 'function') {
5467
- async.read(path, getSettings$1(), optionsOrSettingsOrCallback);
5468
- return;
5469
- }
5470
- async.read(path, getSettings$1(optionsOrSettingsOrCallback), callback);
5471
- }
5472
- out$1.scandir = scandir;
5473
- function scandirSync(path, optionsOrSettings) {
5474
- const settings = getSettings$1(optionsOrSettings);
5475
- return sync$4.read(path, settings);
5476
- }
5477
- out$1.scandirSync = scandirSync;
5478
- function getSettings$1(settingsOrOptions = {}) {
5479
- if (settingsOrOptions instanceof settings_1$2.default) {
5480
- return settingsOrOptions;
5481
- }
5482
- return new settings_1$2.default(settingsOrOptions);
5438
+ Object.defineProperty(out$1, "__esModule", { value: true });
5439
+ out$1.Settings = out$1.scandirSync = out$1.scandir = void 0;
5440
+ const async = async$1;
5441
+ const sync$4 = sync$5;
5442
+ const settings_1$2 = settings$2;
5443
+ out$1.Settings = settings_1$2.default;
5444
+ function scandir(path, optionsOrSettingsOrCallback, callback) {
5445
+ if (typeof optionsOrSettingsOrCallback === 'function') {
5446
+ return async.read(path, getSettings$1(), optionsOrSettingsOrCallback);
5447
+ }
5448
+ async.read(path, getSettings$1(optionsOrSettingsOrCallback), callback);
5449
+ }
5450
+ out$1.scandir = scandir;
5451
+ function scandirSync(path, optionsOrSettings) {
5452
+ const settings = getSettings$1(optionsOrSettings);
5453
+ return sync$4.read(path, settings);
5454
+ }
5455
+ out$1.scandirSync = scandirSync;
5456
+ function getSettings$1(settingsOrOptions = {}) {
5457
+ if (settingsOrOptions instanceof settings_1$2.default) {
5458
+ return settingsOrOptions;
5459
+ }
5460
+ return new settings_1$2.default(settingsOrOptions);
5483
5461
  }
5484
5462
 
5485
- var queue = {exports: {}};
5486
-
5487
5463
  function reusify$1 (Constructor) {
5488
5464
  var head = new Constructor();
5489
5465
  var tail = head;
@@ -5516,8 +5492,6 @@ function reusify$1 (Constructor) {
5516
5492
 
5517
5493
  var reusify_1 = reusify$1;
5518
5494
 
5519
- /* eslint-disable no-var */
5520
-
5521
5495
  var reusify = reusify_1;
5522
5496
 
5523
5497
  function fastqueue (context, worker, concurrency) {
@@ -5718,432 +5692,352 @@ function Task () {
5718
5692
  };
5719
5693
  }
5720
5694
 
5721
- function queueAsPromised (context, worker, concurrency) {
5722
- if (typeof context === 'function') {
5723
- concurrency = worker;
5724
- worker = context;
5725
- context = null;
5726
- }
5727
-
5728
- function asyncWrapper (arg, cb) {
5729
- worker.call(this, arg)
5730
- .then(function (res) {
5731
- cb(null, res);
5732
- }, cb);
5733
- }
5734
-
5735
- var queue = fastqueue(context, asyncWrapper, concurrency);
5736
-
5737
- var pushCb = queue.push;
5738
- var unshiftCb = queue.unshift;
5739
-
5740
- queue.push = push;
5741
- queue.unshift = unshift;
5742
- queue.drained = drained;
5743
-
5744
- return queue
5745
-
5746
- function push (value) {
5747
- var p = new Promise(function (resolve, reject) {
5748
- pushCb(value, function (err, result) {
5749
- if (err) {
5750
- reject(err);
5751
- return
5752
- }
5753
- resolve(result);
5754
- });
5755
- });
5756
-
5757
- // Let's fork the promise chain to
5758
- // make the error bubble up to the user but
5759
- // not lead to a unhandledRejection
5760
- p.catch(noop);
5761
-
5762
- return p
5763
- }
5764
-
5765
- function unshift (value) {
5766
- var p = new Promise(function (resolve, reject) {
5767
- unshiftCb(value, function (err, result) {
5768
- if (err) {
5769
- reject(err);
5770
- return
5771
- }
5772
- resolve(result);
5773
- });
5774
- });
5775
-
5776
- // Let's fork the promise chain to
5777
- // make the error bubble up to the user but
5778
- // not lead to a unhandledRejection
5779
- p.catch(noop);
5780
-
5781
- return p
5782
- }
5783
-
5784
- function drained () {
5785
- var previousDrain = queue.drain;
5786
-
5787
- var p = new Promise(function (resolve) {
5788
- queue.drain = function () {
5789
- previousDrain();
5790
- resolve();
5791
- };
5792
- });
5793
-
5794
- return p
5795
- }
5796
- }
5797
-
5798
- queue.exports = fastqueue;
5799
- queue.exports.promise = queueAsPromised;
5695
+ var queue = fastqueue;
5800
5696
 
5801
5697
  var common$3 = {};
5802
5698
 
5803
- Object.defineProperty(common$3, "__esModule", { value: true });
5804
- common$3.joinPathSegments = common$3.replacePathSegmentSeparator = common$3.isAppliedFilter = common$3.isFatalError = void 0;
5805
- function isFatalError(settings, error) {
5806
- if (settings.errorFilter === null) {
5807
- return true;
5808
- }
5809
- return !settings.errorFilter(error);
5810
- }
5811
- common$3.isFatalError = isFatalError;
5812
- function isAppliedFilter(filter, value) {
5813
- return filter === null || filter(value);
5814
- }
5815
- common$3.isAppliedFilter = isAppliedFilter;
5816
- function replacePathSegmentSeparator(filepath, separator) {
5817
- return filepath.split(/[/\\]/).join(separator);
5818
- }
5819
- common$3.replacePathSegmentSeparator = replacePathSegmentSeparator;
5820
- function joinPathSegments(a, b, separator) {
5821
- if (a === '') {
5822
- return b;
5823
- }
5824
- /**
5825
- * The correct handling of cases when the first segment is a root (`/`, `C:/`) or UNC path (`//?/C:/`).
5826
- */
5827
- if (a.endsWith(separator)) {
5828
- return a + b;
5829
- }
5830
- return a + separator + b;
5831
- }
5699
+ Object.defineProperty(common$3, "__esModule", { value: true });
5700
+ common$3.joinPathSegments = common$3.replacePathSegmentSeparator = common$3.isAppliedFilter = common$3.isFatalError = void 0;
5701
+ function isFatalError(settings, error) {
5702
+ if (settings.errorFilter === null) {
5703
+ return true;
5704
+ }
5705
+ return !settings.errorFilter(error);
5706
+ }
5707
+ common$3.isFatalError = isFatalError;
5708
+ function isAppliedFilter(filter, value) {
5709
+ return filter === null || filter(value);
5710
+ }
5711
+ common$3.isAppliedFilter = isAppliedFilter;
5712
+ function replacePathSegmentSeparator(filepath, separator) {
5713
+ return filepath.split(/[/\\]/).join(separator);
5714
+ }
5715
+ common$3.replacePathSegmentSeparator = replacePathSegmentSeparator;
5716
+ function joinPathSegments(a, b, separator) {
5717
+ if (a === '') {
5718
+ return b;
5719
+ }
5720
+ /**
5721
+ * The correct handling of cases when the first segment is a root (`/`, `C:/`) or UNC path (`//?/C:/`).
5722
+ */
5723
+ if (a.endsWith(separator)) {
5724
+ return a + b;
5725
+ }
5726
+ return a + separator + b;
5727
+ }
5832
5728
  common$3.joinPathSegments = joinPathSegments;
5833
5729
 
5834
5730
  var reader$1 = {};
5835
5731
 
5836
- Object.defineProperty(reader$1, "__esModule", { value: true });
5837
- const common$2 = common$3;
5838
- class Reader$1 {
5839
- constructor(_root, _settings) {
5840
- this._root = _root;
5841
- this._settings = _settings;
5842
- this._root = common$2.replacePathSegmentSeparator(_root, _settings.pathSegmentSeparator);
5843
- }
5844
- }
5732
+ Object.defineProperty(reader$1, "__esModule", { value: true });
5733
+ const common$2 = common$3;
5734
+ class Reader$1 {
5735
+ constructor(_root, _settings) {
5736
+ this._root = _root;
5737
+ this._settings = _settings;
5738
+ this._root = common$2.replacePathSegmentSeparator(_root, _settings.pathSegmentSeparator);
5739
+ }
5740
+ }
5845
5741
  reader$1.default = Reader$1;
5846
5742
 
5847
- Object.defineProperty(async$2, "__esModule", { value: true });
5848
- const events_1 = require$$2;
5849
- const fsScandir$2 = out$1;
5850
- const fastq = queue.exports;
5851
- const common$1 = common$3;
5852
- const reader_1$3 = reader$1;
5853
- class AsyncReader extends reader_1$3.default {
5854
- constructor(_root, _settings) {
5855
- super(_root, _settings);
5856
- this._settings = _settings;
5857
- this._scandir = fsScandir$2.scandir;
5858
- this._emitter = new events_1.EventEmitter();
5859
- this._queue = fastq(this._worker.bind(this), this._settings.concurrency);
5860
- this._isFatalError = false;
5861
- this._isDestroyed = false;
5862
- this._queue.drain = () => {
5863
- if (!this._isFatalError) {
5864
- this._emitter.emit('end');
5865
- }
5866
- };
5867
- }
5868
- read() {
5869
- this._isFatalError = false;
5870
- this._isDestroyed = false;
5871
- setImmediate(() => {
5872
- this._pushToQueue(this._root, this._settings.basePath);
5873
- });
5874
- return this._emitter;
5875
- }
5876
- get isDestroyed() {
5877
- return this._isDestroyed;
5878
- }
5879
- destroy() {
5880
- if (this._isDestroyed) {
5881
- throw new Error('The reader is already destroyed');
5882
- }
5883
- this._isDestroyed = true;
5884
- this._queue.killAndDrain();
5885
- }
5886
- onEntry(callback) {
5887
- this._emitter.on('entry', callback);
5888
- }
5889
- onError(callback) {
5890
- this._emitter.once('error', callback);
5891
- }
5892
- onEnd(callback) {
5893
- this._emitter.once('end', callback);
5894
- }
5895
- _pushToQueue(directory, base) {
5896
- const queueItem = { directory, base };
5897
- this._queue.push(queueItem, (error) => {
5898
- if (error !== null) {
5899
- this._handleError(error);
5900
- }
5901
- });
5902
- }
5903
- _worker(item, done) {
5904
- this._scandir(item.directory, this._settings.fsScandirSettings, (error, entries) => {
5905
- if (error !== null) {
5906
- done(error, undefined);
5907
- return;
5908
- }
5909
- for (const entry of entries) {
5910
- this._handleEntry(entry, item.base);
5911
- }
5912
- done(null, undefined);
5913
- });
5914
- }
5915
- _handleError(error) {
5916
- if (this._isDestroyed || !common$1.isFatalError(this._settings, error)) {
5917
- return;
5918
- }
5919
- this._isFatalError = true;
5920
- this._isDestroyed = true;
5921
- this._emitter.emit('error', error);
5922
- }
5923
- _handleEntry(entry, base) {
5924
- if (this._isDestroyed || this._isFatalError) {
5925
- return;
5926
- }
5927
- const fullpath = entry.path;
5928
- if (base !== undefined) {
5929
- entry.path = common$1.joinPathSegments(base, entry.name, this._settings.pathSegmentSeparator);
5930
- }
5931
- if (common$1.isAppliedFilter(this._settings.entryFilter, entry)) {
5932
- this._emitEntry(entry);
5933
- }
5934
- if (entry.dirent.isDirectory() && common$1.isAppliedFilter(this._settings.deepFilter, entry)) {
5935
- this._pushToQueue(fullpath, base === undefined ? undefined : entry.path);
5936
- }
5937
- }
5938
- _emitEntry(entry) {
5939
- this._emitter.emit('entry', entry);
5940
- }
5941
- }
5743
+ Object.defineProperty(async$2, "__esModule", { value: true });
5744
+ const events_1 = require$$2;
5745
+ const fsScandir$2 = out$1;
5746
+ const fastq = queue;
5747
+ const common$1 = common$3;
5748
+ const reader_1$3 = reader$1;
5749
+ class AsyncReader extends reader_1$3.default {
5750
+ constructor(_root, _settings) {
5751
+ super(_root, _settings);
5752
+ this._settings = _settings;
5753
+ this._scandir = fsScandir$2.scandir;
5754
+ this._emitter = new events_1.EventEmitter();
5755
+ this._queue = fastq(this._worker.bind(this), this._settings.concurrency);
5756
+ this._isFatalError = false;
5757
+ this._isDestroyed = false;
5758
+ this._queue.drain = () => {
5759
+ if (!this._isFatalError) {
5760
+ this._emitter.emit('end');
5761
+ }
5762
+ };
5763
+ }
5764
+ read() {
5765
+ this._isFatalError = false;
5766
+ this._isDestroyed = false;
5767
+ setImmediate(() => {
5768
+ this._pushToQueue(this._root, this._settings.basePath);
5769
+ });
5770
+ return this._emitter;
5771
+ }
5772
+ get isDestroyed() {
5773
+ return this._isDestroyed;
5774
+ }
5775
+ destroy() {
5776
+ if (this._isDestroyed) {
5777
+ throw new Error('The reader is already destroyed');
5778
+ }
5779
+ this._isDestroyed = true;
5780
+ this._queue.killAndDrain();
5781
+ }
5782
+ onEntry(callback) {
5783
+ this._emitter.on('entry', callback);
5784
+ }
5785
+ onError(callback) {
5786
+ this._emitter.once('error', callback);
5787
+ }
5788
+ onEnd(callback) {
5789
+ this._emitter.once('end', callback);
5790
+ }
5791
+ _pushToQueue(directory, base) {
5792
+ const queueItem = { directory, base };
5793
+ this._queue.push(queueItem, (error) => {
5794
+ if (error !== null) {
5795
+ this._handleError(error);
5796
+ }
5797
+ });
5798
+ }
5799
+ _worker(item, done) {
5800
+ this._scandir(item.directory, this._settings.fsScandirSettings, (error, entries) => {
5801
+ if (error !== null) {
5802
+ return done(error, undefined);
5803
+ }
5804
+ for (const entry of entries) {
5805
+ this._handleEntry(entry, item.base);
5806
+ }
5807
+ done(null, undefined);
5808
+ });
5809
+ }
5810
+ _handleError(error) {
5811
+ if (this._isDestroyed || !common$1.isFatalError(this._settings, error)) {
5812
+ return;
5813
+ }
5814
+ this._isFatalError = true;
5815
+ this._isDestroyed = true;
5816
+ this._emitter.emit('error', error);
5817
+ }
5818
+ _handleEntry(entry, base) {
5819
+ if (this._isDestroyed || this._isFatalError) {
5820
+ return;
5821
+ }
5822
+ const fullpath = entry.path;
5823
+ if (base !== undefined) {
5824
+ entry.path = common$1.joinPathSegments(base, entry.name, this._settings.pathSegmentSeparator);
5825
+ }
5826
+ if (common$1.isAppliedFilter(this._settings.entryFilter, entry)) {
5827
+ this._emitEntry(entry);
5828
+ }
5829
+ if (entry.dirent.isDirectory() && common$1.isAppliedFilter(this._settings.deepFilter, entry)) {
5830
+ this._pushToQueue(fullpath, entry.path);
5831
+ }
5832
+ }
5833
+ _emitEntry(entry) {
5834
+ this._emitter.emit('entry', entry);
5835
+ }
5836
+ }
5942
5837
  async$2.default = AsyncReader;
5943
5838
 
5944
- Object.defineProperty(async$3, "__esModule", { value: true });
5945
- const async_1$3 = async$2;
5946
- class AsyncProvider {
5947
- constructor(_root, _settings) {
5948
- this._root = _root;
5949
- this._settings = _settings;
5950
- this._reader = new async_1$3.default(this._root, this._settings);
5951
- this._storage = [];
5952
- }
5953
- read(callback) {
5954
- this._reader.onError((error) => {
5955
- callFailureCallback(callback, error);
5956
- });
5957
- this._reader.onEntry((entry) => {
5958
- this._storage.push(entry);
5959
- });
5960
- this._reader.onEnd(() => {
5961
- callSuccessCallback(callback, this._storage);
5962
- });
5963
- this._reader.read();
5964
- }
5965
- }
5966
- async$3.default = AsyncProvider;
5967
- function callFailureCallback(callback, error) {
5968
- callback(error);
5969
- }
5970
- function callSuccessCallback(callback, entries) {
5971
- callback(null, entries);
5839
+ Object.defineProperty(async$3, "__esModule", { value: true });
5840
+ const async_1$3 = async$2;
5841
+ class AsyncProvider {
5842
+ constructor(_root, _settings) {
5843
+ this._root = _root;
5844
+ this._settings = _settings;
5845
+ this._reader = new async_1$3.default(this._root, this._settings);
5846
+ this._storage = new Set();
5847
+ }
5848
+ read(callback) {
5849
+ this._reader.onError((error) => {
5850
+ callFailureCallback(callback, error);
5851
+ });
5852
+ this._reader.onEntry((entry) => {
5853
+ this._storage.add(entry);
5854
+ });
5855
+ this._reader.onEnd(() => {
5856
+ callSuccessCallback(callback, [...this._storage]);
5857
+ });
5858
+ this._reader.read();
5859
+ }
5860
+ }
5861
+ async$3.default = AsyncProvider;
5862
+ function callFailureCallback(callback, error) {
5863
+ callback(error);
5864
+ }
5865
+ function callSuccessCallback(callback, entries) {
5866
+ callback(null, entries);
5972
5867
  }
5973
5868
 
5974
5869
  var stream$1 = {};
5975
5870
 
5976
- Object.defineProperty(stream$1, "__esModule", { value: true });
5977
- const stream_1$5 = require$$0$2;
5978
- const async_1$2 = async$2;
5979
- class StreamProvider {
5980
- constructor(_root, _settings) {
5981
- this._root = _root;
5982
- this._settings = _settings;
5983
- this._reader = new async_1$2.default(this._root, this._settings);
5984
- this._stream = new stream_1$5.Readable({
5985
- objectMode: true,
5986
- read: () => { },
5987
- destroy: () => {
5988
- if (!this._reader.isDestroyed) {
5989
- this._reader.destroy();
5990
- }
5991
- }
5992
- });
5993
- }
5994
- read() {
5995
- this._reader.onError((error) => {
5996
- this._stream.emit('error', error);
5997
- });
5998
- this._reader.onEntry((entry) => {
5999
- this._stream.push(entry);
6000
- });
6001
- this._reader.onEnd(() => {
6002
- this._stream.push(null);
6003
- });
6004
- this._reader.read();
6005
- return this._stream;
6006
- }
6007
- }
5871
+ Object.defineProperty(stream$1, "__esModule", { value: true });
5872
+ const stream_1$5 = require$$0$2;
5873
+ const async_1$2 = async$2;
5874
+ class StreamProvider {
5875
+ constructor(_root, _settings) {
5876
+ this._root = _root;
5877
+ this._settings = _settings;
5878
+ this._reader = new async_1$2.default(this._root, this._settings);
5879
+ this._stream = new stream_1$5.Readable({
5880
+ objectMode: true,
5881
+ read: () => { },
5882
+ destroy: () => {
5883
+ if (!this._reader.isDestroyed) {
5884
+ this._reader.destroy();
5885
+ }
5886
+ }
5887
+ });
5888
+ }
5889
+ read() {
5890
+ this._reader.onError((error) => {
5891
+ this._stream.emit('error', error);
5892
+ });
5893
+ this._reader.onEntry((entry) => {
5894
+ this._stream.push(entry);
5895
+ });
5896
+ this._reader.onEnd(() => {
5897
+ this._stream.push(null);
5898
+ });
5899
+ this._reader.read();
5900
+ return this._stream;
5901
+ }
5902
+ }
6008
5903
  stream$1.default = StreamProvider;
6009
5904
 
6010
5905
  var sync$3 = {};
6011
5906
 
6012
5907
  var sync$2 = {};
6013
5908
 
6014
- Object.defineProperty(sync$2, "__esModule", { value: true });
6015
- const fsScandir$1 = out$1;
6016
- const common = common$3;
6017
- const reader_1$2 = reader$1;
6018
- class SyncReader extends reader_1$2.default {
6019
- constructor() {
6020
- super(...arguments);
6021
- this._scandir = fsScandir$1.scandirSync;
6022
- this._storage = [];
6023
- this._queue = new Set();
6024
- }
6025
- read() {
6026
- this._pushToQueue(this._root, this._settings.basePath);
6027
- this._handleQueue();
6028
- return this._storage;
6029
- }
6030
- _pushToQueue(directory, base) {
6031
- this._queue.add({ directory, base });
6032
- }
6033
- _handleQueue() {
6034
- for (const item of this._queue.values()) {
6035
- this._handleDirectory(item.directory, item.base);
6036
- }
6037
- }
6038
- _handleDirectory(directory, base) {
6039
- try {
6040
- const entries = this._scandir(directory, this._settings.fsScandirSettings);
6041
- for (const entry of entries) {
6042
- this._handleEntry(entry, base);
6043
- }
6044
- }
6045
- catch (error) {
6046
- this._handleError(error);
6047
- }
6048
- }
6049
- _handleError(error) {
6050
- if (!common.isFatalError(this._settings, error)) {
6051
- return;
6052
- }
6053
- throw error;
6054
- }
6055
- _handleEntry(entry, base) {
6056
- const fullpath = entry.path;
6057
- if (base !== undefined) {
6058
- entry.path = common.joinPathSegments(base, entry.name, this._settings.pathSegmentSeparator);
6059
- }
6060
- if (common.isAppliedFilter(this._settings.entryFilter, entry)) {
6061
- this._pushToStorage(entry);
6062
- }
6063
- if (entry.dirent.isDirectory() && common.isAppliedFilter(this._settings.deepFilter, entry)) {
6064
- this._pushToQueue(fullpath, base === undefined ? undefined : entry.path);
6065
- }
6066
- }
6067
- _pushToStorage(entry) {
6068
- this._storage.push(entry);
6069
- }
6070
- }
5909
+ Object.defineProperty(sync$2, "__esModule", { value: true });
5910
+ const fsScandir$1 = out$1;
5911
+ const common = common$3;
5912
+ const reader_1$2 = reader$1;
5913
+ class SyncReader extends reader_1$2.default {
5914
+ constructor() {
5915
+ super(...arguments);
5916
+ this._scandir = fsScandir$1.scandirSync;
5917
+ this._storage = new Set();
5918
+ this._queue = new Set();
5919
+ }
5920
+ read() {
5921
+ this._pushToQueue(this._root, this._settings.basePath);
5922
+ this._handleQueue();
5923
+ return [...this._storage];
5924
+ }
5925
+ _pushToQueue(directory, base) {
5926
+ this._queue.add({ directory, base });
5927
+ }
5928
+ _handleQueue() {
5929
+ for (const item of this._queue.values()) {
5930
+ this._handleDirectory(item.directory, item.base);
5931
+ }
5932
+ }
5933
+ _handleDirectory(directory, base) {
5934
+ try {
5935
+ const entries = this._scandir(directory, this._settings.fsScandirSettings);
5936
+ for (const entry of entries) {
5937
+ this._handleEntry(entry, base);
5938
+ }
5939
+ }
5940
+ catch (error) {
5941
+ this._handleError(error);
5942
+ }
5943
+ }
5944
+ _handleError(error) {
5945
+ if (!common.isFatalError(this._settings, error)) {
5946
+ return;
5947
+ }
5948
+ throw error;
5949
+ }
5950
+ _handleEntry(entry, base) {
5951
+ const fullpath = entry.path;
5952
+ if (base !== undefined) {
5953
+ entry.path = common.joinPathSegments(base, entry.name, this._settings.pathSegmentSeparator);
5954
+ }
5955
+ if (common.isAppliedFilter(this._settings.entryFilter, entry)) {
5956
+ this._pushToStorage(entry);
5957
+ }
5958
+ if (entry.dirent.isDirectory() && common.isAppliedFilter(this._settings.deepFilter, entry)) {
5959
+ this._pushToQueue(fullpath, entry.path);
5960
+ }
5961
+ }
5962
+ _pushToStorage(entry) {
5963
+ this._storage.add(entry);
5964
+ }
5965
+ }
6071
5966
  sync$2.default = SyncReader;
6072
5967
 
6073
- Object.defineProperty(sync$3, "__esModule", { value: true });
6074
- const sync_1$3 = sync$2;
6075
- class SyncProvider {
6076
- constructor(_root, _settings) {
6077
- this._root = _root;
6078
- this._settings = _settings;
6079
- this._reader = new sync_1$3.default(this._root, this._settings);
6080
- }
6081
- read() {
6082
- return this._reader.read();
6083
- }
6084
- }
5968
+ Object.defineProperty(sync$3, "__esModule", { value: true });
5969
+ const sync_1$3 = sync$2;
5970
+ class SyncProvider {
5971
+ constructor(_root, _settings) {
5972
+ this._root = _root;
5973
+ this._settings = _settings;
5974
+ this._reader = new sync_1$3.default(this._root, this._settings);
5975
+ }
5976
+ read() {
5977
+ return this._reader.read();
5978
+ }
5979
+ }
6085
5980
  sync$3.default = SyncProvider;
6086
5981
 
6087
5982
  var settings$1 = {};
6088
5983
 
6089
- Object.defineProperty(settings$1, "__esModule", { value: true });
6090
- const path$2 = path$a;
6091
- const fsScandir = out$1;
6092
- class Settings {
6093
- constructor(_options = {}) {
6094
- this._options = _options;
6095
- this.basePath = this._getValue(this._options.basePath, undefined);
6096
- this.concurrency = this._getValue(this._options.concurrency, Number.POSITIVE_INFINITY);
6097
- this.deepFilter = this._getValue(this._options.deepFilter, null);
6098
- this.entryFilter = this._getValue(this._options.entryFilter, null);
6099
- this.errorFilter = this._getValue(this._options.errorFilter, null);
6100
- this.pathSegmentSeparator = this._getValue(this._options.pathSegmentSeparator, path$2.sep);
6101
- this.fsScandirSettings = new fsScandir.Settings({
6102
- followSymbolicLinks: this._options.followSymbolicLinks,
6103
- fs: this._options.fs,
6104
- pathSegmentSeparator: this._options.pathSegmentSeparator,
6105
- stats: this._options.stats,
6106
- throwErrorOnBrokenSymbolicLink: this._options.throwErrorOnBrokenSymbolicLink
6107
- });
6108
- }
6109
- _getValue(option, value) {
6110
- return option !== null && option !== void 0 ? option : value;
6111
- }
6112
- }
5984
+ Object.defineProperty(settings$1, "__esModule", { value: true });
5985
+ const path$2 = path$a;
5986
+ const fsScandir = out$1;
5987
+ class Settings {
5988
+ constructor(_options = {}) {
5989
+ this._options = _options;
5990
+ this.basePath = this._getValue(this._options.basePath, undefined);
5991
+ this.concurrency = this._getValue(this._options.concurrency, Infinity);
5992
+ this.deepFilter = this._getValue(this._options.deepFilter, null);
5993
+ this.entryFilter = this._getValue(this._options.entryFilter, null);
5994
+ this.errorFilter = this._getValue(this._options.errorFilter, null);
5995
+ this.pathSegmentSeparator = this._getValue(this._options.pathSegmentSeparator, path$2.sep);
5996
+ this.fsScandirSettings = new fsScandir.Settings({
5997
+ followSymbolicLinks: this._options.followSymbolicLinks,
5998
+ fs: this._options.fs,
5999
+ pathSegmentSeparator: this._options.pathSegmentSeparator,
6000
+ stats: this._options.stats,
6001
+ throwErrorOnBrokenSymbolicLink: this._options.throwErrorOnBrokenSymbolicLink
6002
+ });
6003
+ }
6004
+ _getValue(option, value) {
6005
+ return option !== null && option !== void 0 ? option : value;
6006
+ }
6007
+ }
6113
6008
  settings$1.default = Settings;
6114
6009
 
6115
- Object.defineProperty(out$2, "__esModule", { value: true });
6116
- out$2.Settings = out$2.walkStream = out$2.walkSync = out$2.walk = void 0;
6117
- const async_1$1 = async$3;
6118
- const stream_1$4 = stream$1;
6119
- const sync_1$2 = sync$3;
6120
- const settings_1$1 = settings$1;
6121
- out$2.Settings = settings_1$1.default;
6122
- function walk(directory, optionsOrSettingsOrCallback, callback) {
6123
- if (typeof optionsOrSettingsOrCallback === 'function') {
6124
- new async_1$1.default(directory, getSettings()).read(optionsOrSettingsOrCallback);
6125
- return;
6126
- }
6127
- new async_1$1.default(directory, getSettings(optionsOrSettingsOrCallback)).read(callback);
6128
- }
6129
- out$2.walk = walk;
6130
- function walkSync(directory, optionsOrSettings) {
6131
- const settings = getSettings(optionsOrSettings);
6132
- const provider = new sync_1$2.default(directory, settings);
6133
- return provider.read();
6134
- }
6135
- out$2.walkSync = walkSync;
6136
- function walkStream(directory, optionsOrSettings) {
6137
- const settings = getSettings(optionsOrSettings);
6138
- const provider = new stream_1$4.default(directory, settings);
6139
- return provider.read();
6140
- }
6141
- out$2.walkStream = walkStream;
6142
- function getSettings(settingsOrOptions = {}) {
6143
- if (settingsOrOptions instanceof settings_1$1.default) {
6144
- return settingsOrOptions;
6145
- }
6146
- return new settings_1$1.default(settingsOrOptions);
6010
+ Object.defineProperty(out$2, "__esModule", { value: true });
6011
+ out$2.Settings = out$2.walkStream = out$2.walkSync = out$2.walk = void 0;
6012
+ const async_1$1 = async$3;
6013
+ const stream_1$4 = stream$1;
6014
+ const sync_1$2 = sync$3;
6015
+ const settings_1$1 = settings$1;
6016
+ out$2.Settings = settings_1$1.default;
6017
+ function walk(directory, optionsOrSettingsOrCallback, callback) {
6018
+ if (typeof optionsOrSettingsOrCallback === 'function') {
6019
+ return new async_1$1.default(directory, getSettings()).read(optionsOrSettingsOrCallback);
6020
+ }
6021
+ new async_1$1.default(directory, getSettings(optionsOrSettingsOrCallback)).read(callback);
6022
+ }
6023
+ out$2.walk = walk;
6024
+ function walkSync(directory, optionsOrSettings) {
6025
+ const settings = getSettings(optionsOrSettings);
6026
+ const provider = new sync_1$2.default(directory, settings);
6027
+ return provider.read();
6028
+ }
6029
+ out$2.walkSync = walkSync;
6030
+ function walkStream(directory, optionsOrSettings) {
6031
+ const settings = getSettings(optionsOrSettings);
6032
+ const provider = new stream_1$4.default(directory, settings);
6033
+ return provider.read();
6034
+ }
6035
+ out$2.walkStream = walkStream;
6036
+ function getSettings(settingsOrOptions = {}) {
6037
+ if (settingsOrOptions instanceof settings_1$1.default) {
6038
+ return settingsOrOptions;
6039
+ }
6040
+ return new settings_1$1.default(settingsOrOptions);
6147
6041
  }
6148
6042
 
6149
6043
  var reader = {};
@@ -8336,7 +8230,7 @@ class Vitest {
8336
8230
  await cleanCoverage(resolved.coverage, resolved.coverage.clean);
8337
8231
  }
8338
8232
  async start(filters) {
8339
- this.report("onInit", this);
8233
+ await this.report("onInit", this);
8340
8234
  const files = await this.filterTestsBySource(await this.globTestFiles(filters));
8341
8235
  if (!files.length) {
8342
8236
  if (this.config.passWithNoTests)
@@ -8553,7 +8447,7 @@ async function createVitest(options, viteOverrides = {}) {
8553
8447
  await ctx.setServer(options, server2);
8554
8448
  haveStarted = true;
8555
8449
  if (options.api)
8556
- (await import('./setup-6e09a65a.js')).setup(ctx);
8450
+ (await import('./setup-a6f22d64.js')).setup(ctx);
8557
8451
  if (!options.watch)
8558
8452
  await server2.watcher.close();
8559
8453
  }