vitest 0.0.125 → 0.0.129

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-9fdde2e8.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-42a3a132.js';
3
3
  import { createServer, mergeConfig } from 'vite';
4
4
  import path$a from 'path';
5
5
  import process$1 from 'process';
@@ -7,16 +7,17 @@ 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 { d as defaultInclude, a as defaultExclude, b as defaultPort, c as distDir, e as configFiles } from './constants-8b3a9b31.js';
11
- import MagicString from './magic-string.es-94000aea.js';
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';
12
13
  import { performance } from 'perf_hooks';
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';
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';
15
16
  import { createRequire } from 'module';
16
17
  import { pathToFileURL } from 'url';
17
18
  import { MessageChannel } from 'worker_threads';
18
19
  import { Tinypool } from 'tinypool';
19
- import { c as createBirpc } from './index-e909c175.js';
20
+ import { c as createBirpc } from './index-a73f33e0.js';
20
21
 
21
22
  /*
22
23
  How it works:
@@ -4984,61 +4985,65 @@ var out$3 = {};
4984
4985
 
4985
4986
  var async$5 = {};
4986
4987
 
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);
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);
5017
5022
  }
5018
5023
 
5019
5024
  var sync$7 = {};
5020
5025
 
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
- }
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
+ }
5042
5047
  sync$7.read = read$2;
5043
5048
 
5044
5049
  var settings$3 = {};
@@ -5046,63 +5051,64 @@ var settings$3 = {};
5046
5051
  var fs$5 = {};
5047
5052
 
5048
5053
  (function (exports) {
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
- }
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
+ }
5064
5069
  exports.createFileSystemAdapter = createFileSystemAdapter;
5065
5070
  }(fs$5));
5066
5071
 
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
- }
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
+ }
5081
5086
  settings$3.default = Settings$2;
5082
5087
 
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);
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);
5106
5112
  }
5107
5113
 
5108
5114
  var out$2 = {};
@@ -5120,7 +5126,7 @@ var async$1 = {};
5120
5126
  let promise;
5121
5127
 
5122
5128
  var queueMicrotask_1 = typeof queueMicrotask === 'function'
5123
- ? queueMicrotask.bind(globalThis)
5129
+ ? queueMicrotask.bind(typeof window !== 'undefined' ? window : commonjsGlobal)
5124
5130
  // reuse resolved promise, and allocate it lazily
5125
5131
  : cb => (promise || (promise = Promise.resolve()))
5126
5132
  .then(cb)
@@ -5181,209 +5187,224 @@ function runParallel (tasks, cb) {
5181
5187
 
5182
5188
  var constants = {};
5183
5189
 
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
- */
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
+ */
5196
5205
  constants.IS_SUPPORT_READDIR_WITH_FILE_TYPES = IS_MATCHED_BY_MAJOR || IS_MATCHED_BY_MAJOR_AND_MINOR;
5197
5206
 
5198
5207
  var utils$9 = {};
5199
5208
 
5200
5209
  var fs$3 = {};
5201
5210
 
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
- }
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
+ }
5219
5228
  fs$3.createDirentFromStats = createDirentFromStats;
5220
5229
 
5221
- Object.defineProperty(utils$9, "__esModule", { value: true });
5222
- utils$9.fs = void 0;
5223
- const fs$2 = fs$3;
5230
+ Object.defineProperty(utils$9, "__esModule", { value: true });
5231
+ utils$9.fs = void 0;
5232
+ const fs$2 = fs$3;
5224
5233
  utils$9.fs = fs$2;
5225
5234
 
5226
5235
  var common$6 = {};
5227
5236
 
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
- }
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
+ }
5239
5248
  common$6.joinPathSegments = joinPathSegments$1;
5240
5249
 
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);
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);
5331
5352
  }
5332
5353
 
5333
5354
  var sync$5 = {};
5334
5355
 
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
- }
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
+ }
5387
5408
  sync$5.readdir = readdir;
5388
5409
 
5389
5410
  var settings$2 = {};
@@ -5391,74 +5412,77 @@ var settings$2 = {};
5391
5412
  var fs$1 = {};
5392
5413
 
5393
5414
  (function (exports) {
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
- }
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
+ }
5411
5432
  exports.createFileSystemAdapter = createFileSystemAdapter;
5412
5433
  }(fs$1));
5413
5434
 
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
- }
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
+ }
5436
5457
  settings$2.default = Settings$1;
5437
5458
 
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);
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);
5461
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);
5483
+ }
5484
+
5485
+ var queue = {exports: {}};
5462
5486
 
5463
5487
  function reusify$1 (Constructor) {
5464
5488
  var head = new Constructor();
@@ -5492,6 +5516,8 @@ function reusify$1 (Constructor) {
5492
5516
 
5493
5517
  var reusify_1 = reusify$1;
5494
5518
 
5519
+ /* eslint-disable no-var */
5520
+
5495
5521
  var reusify = reusify_1;
5496
5522
 
5497
5523
  function fastqueue (context, worker, concurrency) {
@@ -5692,352 +5718,432 @@ function Task () {
5692
5718
  };
5693
5719
  }
5694
5720
 
5695
- var queue = fastqueue;
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;
5696
5800
 
5697
5801
  var common$3 = {};
5698
5802
 
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
- }
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
+ }
5728
5832
  common$3.joinPathSegments = joinPathSegments;
5729
5833
 
5730
5834
  var reader$1 = {};
5731
5835
 
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
- }
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
+ }
5741
5845
  reader$1.default = Reader$1;
5742
5846
 
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
- }
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
+ }
5837
5942
  async$2.default = AsyncReader;
5838
5943
 
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);
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);
5867
5972
  }
5868
5973
 
5869
5974
  var stream$1 = {};
5870
5975
 
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
- }
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
+ }
5903
6008
  stream$1.default = StreamProvider;
5904
6009
 
5905
6010
  var sync$3 = {};
5906
6011
 
5907
6012
  var sync$2 = {};
5908
6013
 
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
- }
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
+ }
5966
6071
  sync$2.default = SyncReader;
5967
6072
 
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
- }
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
+ }
5980
6085
  sync$3.default = SyncProvider;
5981
6086
 
5982
6087
  var settings$1 = {};
5983
6088
 
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
- }
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
+ }
6008
6113
  settings$1.default = Settings;
6009
6114
 
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);
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);
6041
6147
  }
6042
6148
 
6043
6149
  var reader = {};
@@ -7597,7 +7703,6 @@ createLogUpdate(process$1.stdout);
7597
7703
  createLogUpdate(process$1.stderr);
7598
7704
 
7599
7705
  const DURATION_LONG = 300;
7600
- const MAX_HEIGHT = 20;
7601
7706
  const outputMap = new WeakMap();
7602
7707
  function formatFilepath(path) {
7603
7708
  const lastSlash = Math.max(path.lastIndexOf("/") + 1, 0);
@@ -7643,7 +7748,7 @@ function renderTree(tasks, options, level = 0) {
7643
7748
  output = output.concat(renderTree(task.tasks, options, level + 1));
7644
7749
  }
7645
7750
  }
7646
- return output.slice(0, MAX_HEIGHT).join("\n");
7751
+ return output.join("\n");
7647
7752
  }
7648
7753
  const createListRenderer = (_tasks, options) => {
7649
7754
  let tasks = _tasks;
@@ -7824,25 +7929,25 @@ const ReportersMap = {
7824
7929
  dot: DotReporter
7825
7930
  };
7826
7931
 
7827
- var __defProp$1 = Object.defineProperty;
7828
- var __defProps$1 = Object.defineProperties;
7829
- var __getOwnPropDescs$1 = Object.getOwnPropertyDescriptors;
7830
- var __getOwnPropSymbols$1 = Object.getOwnPropertySymbols;
7831
- var __hasOwnProp$1 = Object.prototype.hasOwnProperty;
7832
- var __propIsEnum$1 = Object.prototype.propertyIsEnumerable;
7833
- var __defNormalProp$1 = (obj, key, value) => key in obj ? __defProp$1(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
7834
- var __spreadValues$1 = (a, b) => {
7932
+ var __defProp$2 = Object.defineProperty;
7933
+ var __defProps$2 = Object.defineProperties;
7934
+ var __getOwnPropDescs$2 = Object.getOwnPropertyDescriptors;
7935
+ var __getOwnPropSymbols$2 = Object.getOwnPropertySymbols;
7936
+ var __hasOwnProp$2 = Object.prototype.hasOwnProperty;
7937
+ var __propIsEnum$2 = Object.prototype.propertyIsEnumerable;
7938
+ var __defNormalProp$2 = (obj, key, value) => key in obj ? __defProp$2(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
7939
+ var __spreadValues$2 = (a, b) => {
7835
7940
  for (var prop in b || (b = {}))
7836
- if (__hasOwnProp$1.call(b, prop))
7837
- __defNormalProp$1(a, prop, b[prop]);
7838
- if (__getOwnPropSymbols$1)
7839
- for (var prop of __getOwnPropSymbols$1(b)) {
7840
- if (__propIsEnum$1.call(b, prop))
7841
- __defNormalProp$1(a, prop, b[prop]);
7941
+ if (__hasOwnProp$2.call(b, prop))
7942
+ __defNormalProp$2(a, prop, b[prop]);
7943
+ if (__getOwnPropSymbols$2)
7944
+ for (var prop of __getOwnPropSymbols$2(b)) {
7945
+ if (__propIsEnum$2.call(b, prop))
7946
+ __defNormalProp$2(a, prop, b[prop]);
7842
7947
  }
7843
7948
  return a;
7844
7949
  };
7845
- var __spreadProps$1 = (a, b) => __defProps$1(a, __getOwnPropDescs$1(b));
7950
+ var __spreadProps$2 = (a, b) => __defProps$2(a, __getOwnPropDescs$2(b));
7846
7951
  const defaultExcludes = [
7847
7952
  "coverage/**",
7848
7953
  "packages/*/test{,s}/**",
@@ -7855,7 +7960,7 @@ const defaultExcludes = [
7855
7960
  "**/.{eslint,mocha}rc.{js,cjs}"
7856
7961
  ];
7857
7962
  function resolveC8Options(options, root) {
7858
- const resolved = __spreadValues$1({
7963
+ const resolved = __spreadValues$2({
7859
7964
  enabled: false,
7860
7965
  clean: true,
7861
7966
  cleanOnRerun: false,
@@ -7884,7 +7989,7 @@ async function reportCoverage(ctx) {
7884
7989
  const url = pathToFileURL(file).href;
7885
7990
  const sources = map.sources.length ? map.sources.map((i) => pathToFileURL(i).href) : [url];
7886
7991
  report.sourceMapCache[url] = {
7887
- data: __spreadProps$1(__spreadValues$1({}, map), { sources })
7992
+ data: __spreadProps$2(__spreadValues$2({}, map), { sources })
7888
7993
  };
7889
7994
  });
7890
7995
  await report.run();
@@ -7925,30 +8030,56 @@ class StateManager {
7925
8030
  }
7926
8031
  }
7927
8032
 
7928
- var __defProp = Object.defineProperty;
7929
- var __defProps = Object.defineProperties;
7930
- var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
7931
- var __getOwnPropSymbols = Object.getOwnPropertySymbols;
7932
- var __hasOwnProp = Object.prototype.hasOwnProperty;
7933
- var __propIsEnum = Object.prototype.propertyIsEnumerable;
7934
- var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
7935
- var __spreadValues = (a, b) => {
8033
+ var __defProp$1 = Object.defineProperty;
8034
+ var __defProps$1 = Object.defineProperties;
8035
+ var __getOwnPropDescs$1 = Object.getOwnPropertyDescriptors;
8036
+ var __getOwnPropSymbols$1 = Object.getOwnPropertySymbols;
8037
+ var __hasOwnProp$1 = Object.prototype.hasOwnProperty;
8038
+ var __propIsEnum$1 = Object.prototype.propertyIsEnumerable;
8039
+ var __defNormalProp$1 = (obj, key, value) => key in obj ? __defProp$1(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
8040
+ var __spreadValues$1 = (a, b) => {
7936
8041
  for (var prop in b || (b = {}))
7937
- if (__hasOwnProp.call(b, prop))
7938
- __defNormalProp(a, prop, b[prop]);
7939
- if (__getOwnPropSymbols)
7940
- for (var prop of __getOwnPropSymbols(b)) {
7941
- if (__propIsEnum.call(b, prop))
7942
- __defNormalProp(a, prop, b[prop]);
8042
+ if (__hasOwnProp$1.call(b, prop))
8043
+ __defNormalProp$1(a, prop, b[prop]);
8044
+ if (__getOwnPropSymbols$1)
8045
+ for (var prop of __getOwnPropSymbols$1(b)) {
8046
+ if (__propIsEnum$1.call(b, prop))
8047
+ __defNormalProp$1(a, prop, b[prop]);
7943
8048
  }
7944
8049
  return a;
7945
8050
  };
7946
- var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
8051
+ var __spreadProps$1 = (a, b) => __defProps$1(a, __getOwnPropDescs$1(b));
8052
+ function resolveApiConfig(options, viteOverrides) {
8053
+ let api;
8054
+ if (options.api === true)
8055
+ api = { port: defaultPort };
8056
+ else if (typeof options.api === "number")
8057
+ api = { port: options.api };
8058
+ if (typeof options.api === "object") {
8059
+ if (api) {
8060
+ if (options.api.port)
8061
+ api.port = options.api.port;
8062
+ if (options.api.strictPort)
8063
+ api.strictPort = options.api.strictPort;
8064
+ if (options.api.host)
8065
+ api.host = options.api.host;
8066
+ } else {
8067
+ api = __spreadValues$1({}, options.api);
8068
+ }
8069
+ }
8070
+ if (api) {
8071
+ if (!api.port)
8072
+ api.port = defaultPort;
8073
+ if (viteOverrides)
8074
+ viteOverrides.server = Object.assign(viteOverrides.server || {}, api);
8075
+ }
8076
+ return api;
8077
+ }
7947
8078
  function resolveConfig(options, viteConfig) {
7948
8079
  var _a, _b, _c, _d;
7949
8080
  if (options.dom)
7950
8081
  options.environment = "happy-dom";
7951
- const resolved = __spreadProps(__spreadValues({}, deepMerge(options, viteConfig.test)), {
8082
+ const resolved = __spreadProps$1(__spreadValues$1({}, deepMerge(options, viteConfig.test)), {
7952
8083
  root: viteConfig.root
7953
8084
  });
7954
8085
  resolved.coverage = resolveC8Options(resolved.coverage, resolved.root);
@@ -7978,8 +8109,7 @@ function resolveConfig(options, viteConfig) {
7978
8109
  if (process.env.VITEST_MIN_THREADS)
7979
8110
  resolved.minThreads = parseInt(process.env.VITEST_MIN_THREADS);
7980
8111
  resolved.setupFiles = Array.from(resolved.setupFiles || []).map((i) => resolve(resolved.root, i));
7981
- if (resolved.api === true)
7982
- resolved.api = defaultPort;
8112
+ resolved.api = resolveApiConfig(options);
7983
8113
  if (options.related)
7984
8114
  resolved.related = toArray(options.related).map((file) => resolve(resolved.root, file));
7985
8115
  return resolved;
@@ -8137,6 +8267,25 @@ function createChannel(ctx) {
8137
8267
  return { workerPort, port };
8138
8268
  }
8139
8269
 
8270
+ var __defProp = Object.defineProperty;
8271
+ var __defProps = Object.defineProperties;
8272
+ var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
8273
+ var __getOwnPropSymbols = Object.getOwnPropertySymbols;
8274
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
8275
+ var __propIsEnum = Object.prototype.propertyIsEnumerable;
8276
+ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
8277
+ var __spreadValues = (a, b) => {
8278
+ for (var prop in b || (b = {}))
8279
+ if (__hasOwnProp.call(b, prop))
8280
+ __defNormalProp(a, prop, b[prop]);
8281
+ if (__getOwnPropSymbols)
8282
+ for (var prop of __getOwnPropSymbols(b)) {
8283
+ if (__propIsEnum.call(b, prop))
8284
+ __defNormalProp(a, prop, b[prop]);
8285
+ }
8286
+ return a;
8287
+ };
8288
+ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
8140
8289
  const WATCHER_DEBOUNCE = 100;
8141
8290
  class Vitest {
8142
8291
  constructor() {
@@ -8377,6 +8526,7 @@ class Vitest {
8377
8526
  }
8378
8527
  }
8379
8528
  async function createVitest(options, viteOverrides = {}) {
8529
+ var _a;
8380
8530
  const ctx = new Vitest();
8381
8531
  const root = resolve(options.root || process.cwd());
8382
8532
  const configPath = options.config ? resolve(root, options.config) : await findUp(configFiles, { cwd: root });
@@ -8387,6 +8537,7 @@ async function createVitest(options, viteOverrides = {}) {
8387
8537
  await ensurePackageInstalled("@vitest/ui");
8388
8538
  return (await import('@vitest/ui')).default();
8389
8539
  }
8540
+ options.api = resolveApiConfig(options, viteOverrides);
8390
8541
  const config = {
8391
8542
  root,
8392
8543
  logLevel: "error",
@@ -8395,35 +8546,33 @@ async function createVitest(options, viteOverrides = {}) {
8395
8546
  plugins: [
8396
8547
  {
8397
8548
  name: "vitest",
8549
+ enforce: "pre",
8398
8550
  async configureServer(server2) {
8399
8551
  if (haveStarted)
8400
8552
  await ctx.report("onServerRestart");
8401
8553
  await ctx.setServer(options, server2);
8402
8554
  haveStarted = true;
8403
8555
  if (options.api)
8404
- (await import('./setup-b0d2ca33.js')).setup(ctx);
8556
+ (await import('./setup-6e09a65a.js')).setup(ctx);
8557
+ if (!options.watch)
8558
+ await server2.watcher.close();
8405
8559
  }
8406
8560
  },
8407
8561
  MocksPlugin(),
8408
8562
  await UIPlugin()
8409
8563
  ],
8410
- server: {
8564
+ server: __spreadProps(__spreadValues({}, options.api), {
8411
8565
  open: options.open ? "/__vitest__/" : void 0,
8412
- strictPort: true,
8413
8566
  preTransformRequests: false
8414
- },
8567
+ }),
8415
8568
  build: {
8416
8569
  sourcemap: true
8417
8570
  }
8418
8571
  };
8419
8572
  const server = await createServer(mergeConfig(config, viteOverrides));
8420
8573
  await server.pluginContainer.buildStart({});
8421
- if (options.api === true)
8422
- options.api = defaultPort;
8423
- if (options.open && typeof options.api !== "number")
8424
- options.api = defaultPort;
8425
- if (typeof options.api === "number")
8426
- await server.listen(options.api);
8574
+ if ((_a = options.api) == null ? void 0 : _a.port)
8575
+ await server.listen();
8427
8576
  return ctx;
8428
8577
  }
8429
8578