vite-plugin-sitemap 0.5.0 → 0.5.3

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.
package/dist/index.js CHANGED
@@ -12,23 +12,10 @@ var require$$1$1 = require('string_decoder');
12
12
  var require$$1$2 = require('zlib');
13
13
  var require$$0$3 = require('util');
14
14
  var node_path = require('node:path');
15
- var require$$2$1 = require('os');
16
- var require$$0$4 = require('events');
17
-
18
- function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
19
-
20
- var require$$0__default = /*#__PURE__*/_interopDefaultLegacy(require$$0);
21
- var require$$0__default$1 = /*#__PURE__*/_interopDefaultLegacy(require$$0$1);
22
- var require$$2__default = /*#__PURE__*/_interopDefaultLegacy(require$$2);
23
- var require$$3__default = /*#__PURE__*/_interopDefaultLegacy(require$$3);
24
- var require$$0__default$2 = /*#__PURE__*/_interopDefaultLegacy(require$$0$2);
25
- var require$$1__default = /*#__PURE__*/_interopDefaultLegacy(require$$1);
26
- var require$$1__default$1 = /*#__PURE__*/_interopDefaultLegacy(require$$1$1);
27
- var require$$1__default$2 = /*#__PURE__*/_interopDefaultLegacy(require$$1$2);
28
- var require$$0__default$3 = /*#__PURE__*/_interopDefaultLegacy(require$$0$3);
29
- var require$$2__default$1 = /*#__PURE__*/_interopDefaultLegacy(require$$2$1);
30
- var require$$0__default$4 = /*#__PURE__*/_interopDefaultLegacy(require$$0$4);
15
+ var require$$0$4 = require('os');
16
+ var require$$0$5 = require('events');
31
17
 
18
+ var _documentCurrentScript = typeof document !== 'undefined' ? document.currentScript : null;
32
19
  var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
33
20
 
34
21
  function getDefaultExportFromCjs (x) {
@@ -476,7 +463,7 @@ sitemapXml.element = element;
476
463
 
477
464
  Object.defineProperty(sitemapItemStream, "__esModule", { value: true });
478
465
  sitemapItemStream.SitemapItemStream = void 0;
479
- const stream_1$9 = require$$0__default["default"];
466
+ const stream_1$9 = require$$0;
480
467
  const errors_1$2 = errors;
481
468
  const types_1$3 = types;
482
469
  const sitemap_xml_1 = sitemapXml;
@@ -680,10 +667,10 @@ utils$l.normalizeURL = utils$l.chunk = utils$l.lineSeparatedURLsToSitemapOptions
680
667
  * Copyright(c) 2011 Eugene Kalinin
681
668
  * MIT Licensed
682
669
  */
683
- const fs_1 = require$$0__default$1["default"];
684
- const stream_1$8 = require$$0__default["default"];
685
- const readline_1 = require$$2__default["default"];
686
- const url_1 = require$$3__default["default"];
670
+ const fs_1 = require$$0$1;
671
+ const stream_1$8 = require$$0;
672
+ const readline_1 = require$$2;
673
+ const url_1 = require$$3;
687
674
  const types_1$2 = types;
688
675
  const errors_1$1 = errors;
689
676
  const types_2 = types;
@@ -1029,7 +1016,7 @@ utils$l.normalizeURL = normalizeURL;
1029
1016
  (function (exports) {
1030
1017
  Object.defineProperty(exports, "__esModule", { value: true });
1031
1018
  exports.streamToPromise = exports.SitemapStream = exports.closetag = exports.stylesheetInclude = void 0;
1032
- const stream_1 = require$$0__default["default"];
1019
+ const stream_1 = require$$0;
1033
1020
  const types_1 = types;
1034
1021
  const utils_1 = utils$l;
1035
1022
  const sitemap_item_stream_1 = sitemapItemStream;
@@ -1144,7 +1131,7 @@ utils$l.normalizeURL = normalizeURL;
1144
1131
  (function (exports) {
1145
1132
  Object.defineProperty(exports, "__esModule", { value: true });
1146
1133
  exports.SitemapAndIndexStream = exports.SitemapIndexStream = exports.IndexTagNames = void 0;
1147
- const stream_1 = require$$0__default["default"];
1134
+ const stream_1 = require$$0;
1148
1135
  const types_1 = types;
1149
1136
  const sitemap_stream_1 = sitemapStream;
1150
1137
  const sitemap_xml_1 = sitemapXml;
@@ -1250,8 +1237,8 @@ var xmllint = {};
1250
1237
 
1251
1238
  Object.defineProperty(xmllint, "__esModule", { value: true });
1252
1239
  xmllint.xmlLint = void 0;
1253
- const path_1 = require$$0__default$2["default"];
1254
- const child_process_1 = require$$1__default["default"];
1240
+ const path_1 = require$$0$2;
1241
+ const child_process_1 = require$$1;
1255
1242
  const errors_1 = errors;
1256
1243
  /**
1257
1244
  * Verify the passed in xml is valid. Requires xmllib be installed
@@ -1295,7 +1282,7 @@ var sitemapParser = {};
1295
1282
 
1296
1283
  var require$1 = (
1297
1284
  false
1298
- ? /* @__PURE__ */ module$1.createRequire((typeof document === 'undefined' ? new (require('u' + 'rl').URL)('file:' + __filename).href : (document.currentScript && document.currentScript.src || new URL('index.js', document.baseURI).href)))
1285
+ ? /* @__PURE__ */ module$1.createRequire((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.src || new URL('index.js', document.baseURI).href)))
1299
1286
  : require
1300
1287
  );
1301
1288
 
@@ -1468,6 +1455,7 @@ var sax = {};
1468
1455
  } catch (ex) {
1469
1456
  Stream = function () {};
1470
1457
  }
1458
+ if (!Stream) Stream = function () {};
1471
1459
 
1472
1460
  var streamWraps = sax.EVENTS.filter(function (ev) {
1473
1461
  return ev !== 'error' && ev !== 'end'
@@ -1534,7 +1522,7 @@ var sax = {};
1534
1522
  typeof Buffer.isBuffer === 'function' &&
1535
1523
  Buffer.isBuffer(data)) {
1536
1524
  if (!this._decoder) {
1537
- var SD = require$$1__default$1["default"].StringDecoder;
1525
+ var SD = require$$1$1.StringDecoder;
1538
1526
  this._decoder = new SD('utf8');
1539
1527
  }
1540
1528
  data = this._decoder.write(data);
@@ -2784,9 +2772,16 @@ var sax = {};
2784
2772
  }
2785
2773
 
2786
2774
  if (c === ';') {
2787
- parser[buffer] += parseEntity(parser);
2788
- parser.entity = '';
2789
- parser.state = returnState;
2775
+ if (parser.opt.unparsedEntities) {
2776
+ var parsedEntity = parseEntity(parser);
2777
+ parser.entity = '';
2778
+ parser.state = returnState;
2779
+ parser.write(parsedEntity);
2780
+ } else {
2781
+ parser[buffer] += parseEntity(parser);
2782
+ parser.entity = '';
2783
+ parser.state = returnState;
2784
+ }
2790
2785
  } else if (isMatch(parser.entity.length ? entityBody : entityStart, c)) {
2791
2786
  parser.entity += c;
2792
2787
  } else {
@@ -2798,8 +2793,9 @@ var sax = {};
2798
2793
 
2799
2794
  continue
2800
2795
 
2801
- default:
2796
+ default: /* istanbul ignore next */ {
2802
2797
  throw new Error(parser, 'Unknown state: ' + parser.state)
2798
+ }
2803
2799
  }
2804
2800
  } // while
2805
2801
 
@@ -2873,7 +2869,7 @@ var __importDefault$1 = (commonjsGlobal && commonjsGlobal.__importDefault) || fu
2873
2869
  Object.defineProperty(sitemapParser, "__esModule", { value: true });
2874
2870
  sitemapParser.ObjectStreamToJSON = sitemapParser.parseSitemap = sitemapParser.XMLToSitemapItemStream = void 0;
2875
2871
  const sax_1$1 = __importDefault$1(sax);
2876
- const stream_1$7 = require$$0__default["default"];
2872
+ const stream_1$7 = require$$0;
2877
2873
  const types_1$1 = types;
2878
2874
  function isValidTagName$1(tagName) {
2879
2875
  // This only works because the enum name and value are the same
@@ -3388,7 +3384,7 @@ var __importDefault = (commonjsGlobal && commonjsGlobal.__importDefault) || func
3388
3384
  Object.defineProperty(sitemapIndexParser, "__esModule", { value: true });
3389
3385
  sitemapIndexParser.IndexObjectStreamToJSON = sitemapIndexParser.parseSitemapIndex = sitemapIndexParser.XMLToSitemapIndexStream = void 0;
3390
3386
  const sax_1 = __importDefault(sax);
3391
- const stream_1$6 = require$$0__default["default"];
3387
+ const stream_1$6 = require$$0;
3392
3388
  const types_1 = types;
3393
3389
  function isValidTagName(tagName) {
3394
3390
  // This only works because the enum name and value are the same
@@ -3573,12 +3569,12 @@ function requireSitemapSimple () {
3573
3569
  Object.defineProperty(exports, "__esModule", { value: true });
3574
3570
  exports.simpleSitemapAndIndex = void 0;
3575
3571
  const index_1 = requireDist();
3576
- const zlib_1 = require$$1__default$2["default"];
3577
- const fs_1 = require$$0__default$1["default"];
3578
- const path_1 = require$$0__default$2["default"];
3579
- const stream_1 = require$$0__default["default"];
3580
- const util_1 = require$$0__default$3["default"];
3581
- const url_1 = require$$3__default["default"];
3572
+ const zlib_1 = require$$1$2;
3573
+ const fs_1 = require$$0$1;
3574
+ const path_1 = require$$0$2;
3575
+ const stream_1 = require$$0;
3576
+ const util_1 = require$$0$3;
3577
+ const url_1 = require$$3;
3582
3578
  const pipeline = (0, util_1.promisify)(stream_1.pipeline);
3583
3579
  /**
3584
3580
  *
@@ -3715,8 +3711,6 @@ var cjs$1 = {exports: {}};
3715
3711
 
3716
3712
  var cjs = {exports: {}};
3717
3713
 
3718
- cjs.exports;
3719
-
3720
3714
  (function (module, exports) {
3721
3715
  Object.defineProperty(exports, "__esModule", { value: true });
3722
3716
  exports.ParsingError = void 0;
@@ -3830,14 +3824,28 @@ cjs.exports;
3830
3824
  child = nextChild();
3831
3825
  }
3832
3826
  // closing
3833
- match(/^<\/\s*[\w-:.\u00C0-\u00FF]+>/);
3827
+ if (parsingState.options.strictMode) {
3828
+ const closingTag = `</${node.name}>`;
3829
+ if (parsingState.xml.startsWith(closingTag)) {
3830
+ parsingState.xml = parsingState.xml.slice(closingTag.length);
3831
+ }
3832
+ else {
3833
+ throw new ParsingError('Failed to parse XML', `Closing tag not matching "${closingTag}"`);
3834
+ }
3835
+ }
3836
+ else {
3837
+ match(/^<\/\s*[\w-:.\u00C0-\u00FF]+>/);
3838
+ }
3834
3839
  return {
3835
3840
  excluded,
3836
3841
  node
3837
3842
  };
3838
3843
  }
3839
3844
  function doctype() {
3840
- const m = match(/^<!DOCTYPE\s+[^>]*>/);
3845
+ const m = match(/^<!DOCTYPE\s+\S+\s+SYSTEM[^>]*>/) ||
3846
+ match(/^<!DOCTYPE\s+\S+\s+PUBLIC[^>]*>/) ||
3847
+ match(/^<!DOCTYPE\s+\S+\s*\[[^\]]*]>/) ||
3848
+ match(/^<!DOCTYPE\s+\S+\s*>/);
3841
3849
  if (m) {
3842
3850
  const node = {
3843
3851
  type: 'DocumentType',
@@ -3934,7 +3942,7 @@ cjs.exports;
3934
3942
  const filter = options.filter || (() => true);
3935
3943
  parsingState = {
3936
3944
  xml,
3937
- options: Object.assign(Object.assign({}, options), { filter })
3945
+ options: Object.assign(Object.assign({}, options), { filter, strictMode: options.strictMode === true })
3938
3946
  };
3939
3947
  return parseDocument();
3940
3948
  }
@@ -3947,8 +3955,6 @@ cjs.exports;
3947
3955
 
3948
3956
  var cjsExports$1 = cjs.exports;
3949
3957
 
3950
- cjs$1.exports;
3951
-
3952
3958
  (function (module, exports) {
3953
3959
  var __importDefault = (commonjsGlobal && commonjsGlobal.__importDefault) || function (mod) {
3954
3960
  return (mod && mod.__esModule) ? mod : { "default": mod };
@@ -3964,6 +3970,13 @@ cjs$1.exports;
3964
3970
  state.content += state.options.indentation;
3965
3971
  }
3966
3972
  }
3973
+ function indent(state) {
3974
+ state.content = state.content.replace(/ +$/, '');
3975
+ let i;
3976
+ for (i = 0; i < state.level; i++) {
3977
+ state.content += state.options.indentation;
3978
+ }
3979
+ }
3967
3980
  function appendContent(state, content) {
3968
3981
  state.content += content;
3969
3982
  }
@@ -3998,13 +4011,19 @@ cjs$1.exports;
3998
4011
  appendContent(state, content);
3999
4012
  }
4000
4013
  }
4014
+ function isPathMatchingIgnoredPaths(path, ignoredPaths) {
4015
+ const fullPath = '/' + path.join('/');
4016
+ const pathLastPart = path[path.length - 1];
4017
+ return ignoredPaths.includes(pathLastPart) || ignoredPaths.includes(fullPath);
4018
+ }
4001
4019
  function processElementNode(node, state, preserveSpace) {
4020
+ state.path.push(node.name);
4002
4021
  if (!preserveSpace && state.content.length > 0) {
4003
4022
  newLine(state);
4004
4023
  }
4005
4024
  appendContent(state, '<' + node.name);
4006
4025
  processAttributes(state, node.attributes);
4007
- if (node.children === null) {
4026
+ if (node.children === null || (state.options.forceSelfClosingEmptyTag && node.children.length === 0)) {
4008
4027
  const selfClosingNodeClosingTag = state.options.whiteSpaceAtEndOfSelfclosingTag ? ' />' : '/>';
4009
4028
  // self-closing node
4010
4029
  appendContent(state, selfClosingNodeClosingTag);
@@ -4018,6 +4037,11 @@ cjs$1.exports;
4018
4037
  appendContent(state, '>');
4019
4038
  state.level++;
4020
4039
  let nodePreserveSpace = node.attributes['xml:space'] === 'preserve';
4040
+ let ignoredPath = false;
4041
+ if (!nodePreserveSpace && state.options.ignoredPaths) {
4042
+ ignoredPath = isPathMatchingIgnoredPaths(state.path, state.options.ignoredPaths);
4043
+ nodePreserveSpace = ignoredPath;
4044
+ }
4021
4045
  if (!nodePreserveSpace && state.options.collapseContent) {
4022
4046
  let containsTextNodes = false;
4023
4047
  let containsTextNodesWithLineBreaks = false;
@@ -4056,8 +4080,12 @@ cjs$1.exports;
4056
4080
  if (!preserveSpace && !nodePreserveSpace) {
4057
4081
  newLine(state);
4058
4082
  }
4083
+ if (ignoredPath) {
4084
+ indent(state);
4085
+ }
4059
4086
  appendContent(state, '</' + node.name + '>');
4060
4087
  }
4088
+ state.path.pop();
4061
4089
  }
4062
4090
  function processAttributes(state, attributes) {
4063
4091
  Object.keys(attributes).forEach(function (attr) {
@@ -4083,8 +4111,8 @@ cjs$1.exports;
4083
4111
  options.whiteSpaceAtEndOfSelfclosingTag = options.whiteSpaceAtEndOfSelfclosingTag === true;
4084
4112
  options.throwOnFailure = options.throwOnFailure !== false;
4085
4113
  try {
4086
- const parsedXml = (0, xml_parser_xo_1.default)(xml, { filter: options.filter });
4087
- const state = { content: '', level: 0, options: options };
4114
+ const parsedXml = (0, xml_parser_xo_1.default)(xml, { filter: options.filter, strictMode: options.strictMode });
4115
+ const state = { content: '', level: 0, options: options, path: [] };
4088
4116
  if (parsedXml.declaration) {
4089
4117
  processProcessingIntruction(parsedXml.declaration, state);
4090
4118
  }
@@ -4126,11 +4154,6 @@ function ensurePrefix(prefix, str) {
4126
4154
  return prefix + str;
4127
4155
  return str;
4128
4156
  }
4129
- function ensureSuffix(suffix, str) {
4130
- if (!str.endsWith(suffix))
4131
- return str + suffix;
4132
- return str;
4133
- }
4134
4157
 
4135
4158
  var tasks = {};
4136
4159
 
@@ -4138,92 +4161,127 @@ var utils$k = {};
4138
4161
 
4139
4162
  var array$1 = {};
4140
4163
 
4141
- Object.defineProperty(array$1, "__esModule", { value: true });
4142
- array$1.splitWhen = array$1.flatten = void 0;
4143
- function flatten(items) {
4144
- return items.reduce((collection, item) => [].concat(collection, item), []);
4145
- }
4146
- array$1.flatten = flatten;
4147
- function splitWhen(items, predicate) {
4148
- const result = [[]];
4149
- let groupIndex = 0;
4150
- for (const item of items) {
4151
- if (predicate(item)) {
4152
- groupIndex++;
4153
- result[groupIndex] = [];
4154
- }
4155
- else {
4156
- result[groupIndex].push(item);
4157
- }
4158
- }
4159
- return result;
4160
- }
4164
+ Object.defineProperty(array$1, "__esModule", { value: true });
4165
+ array$1.splitWhen = array$1.flatten = void 0;
4166
+ function flatten(items) {
4167
+ return items.reduce((collection, item) => [].concat(collection, item), []);
4168
+ }
4169
+ array$1.flatten = flatten;
4170
+ function splitWhen(items, predicate) {
4171
+ const result = [[]];
4172
+ let groupIndex = 0;
4173
+ for (const item of items) {
4174
+ if (predicate(item)) {
4175
+ groupIndex++;
4176
+ result[groupIndex] = [];
4177
+ }
4178
+ else {
4179
+ result[groupIndex].push(item);
4180
+ }
4181
+ }
4182
+ return result;
4183
+ }
4161
4184
  array$1.splitWhen = splitWhen;
4162
4185
 
4163
4186
  var errno$1 = {};
4164
4187
 
4165
- Object.defineProperty(errno$1, "__esModule", { value: true });
4166
- errno$1.isEnoentCodeError = void 0;
4167
- function isEnoentCodeError(error) {
4168
- return error.code === 'ENOENT';
4169
- }
4188
+ Object.defineProperty(errno$1, "__esModule", { value: true });
4189
+ errno$1.isEnoentCodeError = void 0;
4190
+ function isEnoentCodeError(error) {
4191
+ return error.code === 'ENOENT';
4192
+ }
4170
4193
  errno$1.isEnoentCodeError = isEnoentCodeError;
4171
4194
 
4172
4195
  var fs$7 = {};
4173
4196
 
4174
- Object.defineProperty(fs$7, "__esModule", { value: true });
4175
- fs$7.createDirentFromStats = void 0;
4176
- class DirentFromStats$1 {
4177
- constructor(name, stats) {
4178
- this.name = name;
4179
- this.isBlockDevice = stats.isBlockDevice.bind(stats);
4180
- this.isCharacterDevice = stats.isCharacterDevice.bind(stats);
4181
- this.isDirectory = stats.isDirectory.bind(stats);
4182
- this.isFIFO = stats.isFIFO.bind(stats);
4183
- this.isFile = stats.isFile.bind(stats);
4184
- this.isSocket = stats.isSocket.bind(stats);
4185
- this.isSymbolicLink = stats.isSymbolicLink.bind(stats);
4186
- }
4187
- }
4188
- function createDirentFromStats$1(name, stats) {
4189
- return new DirentFromStats$1(name, stats);
4190
- }
4197
+ Object.defineProperty(fs$7, "__esModule", { value: true });
4198
+ fs$7.createDirentFromStats = void 0;
4199
+ let DirentFromStats$1 = class DirentFromStats {
4200
+ constructor(name, stats) {
4201
+ this.name = name;
4202
+ this.isBlockDevice = stats.isBlockDevice.bind(stats);
4203
+ this.isCharacterDevice = stats.isCharacterDevice.bind(stats);
4204
+ this.isDirectory = stats.isDirectory.bind(stats);
4205
+ this.isFIFO = stats.isFIFO.bind(stats);
4206
+ this.isFile = stats.isFile.bind(stats);
4207
+ this.isSocket = stats.isSocket.bind(stats);
4208
+ this.isSymbolicLink = stats.isSymbolicLink.bind(stats);
4209
+ }
4210
+ };
4211
+ function createDirentFromStats$1(name, stats) {
4212
+ return new DirentFromStats$1(name, stats);
4213
+ }
4191
4214
  fs$7.createDirentFromStats = createDirentFromStats$1;
4192
4215
 
4193
4216
  var path$9 = {};
4194
4217
 
4195
- Object.defineProperty(path$9, "__esModule", { value: true });
4196
- path$9.removeLeadingDotSegment = path$9.escape = path$9.makeAbsolute = path$9.unixify = void 0;
4197
- const path$8 = require$$0__default$2["default"];
4198
- const LEADING_DOT_SEGMENT_CHARACTERS_COUNT = 2; // ./ or .\\
4199
- const UNESCAPED_GLOB_SYMBOLS_RE = /(\\?)([()*?[\]{|}]|^!|[!+@](?=\())/g;
4200
- /**
4201
- * Designed to work only with simple paths: `dir\\file`.
4202
- */
4203
- function unixify(filepath) {
4204
- return filepath.replace(/\\/g, '/');
4205
- }
4206
- path$9.unixify = unixify;
4207
- function makeAbsolute(cwd, filepath) {
4208
- return path$8.resolve(cwd, filepath);
4209
- }
4210
- path$9.makeAbsolute = makeAbsolute;
4211
- function escape(pattern) {
4212
- return pattern.replace(UNESCAPED_GLOB_SYMBOLS_RE, '\\$2');
4213
- }
4214
- path$9.escape = escape;
4215
- function removeLeadingDotSegment(entry) {
4216
- // We do not use `startsWith` because this is 10x slower than current implementation for some cases.
4217
- // eslint-disable-next-line @typescript-eslint/prefer-string-starts-ends-with
4218
- if (entry.charAt(0) === '.') {
4219
- const secondCharactery = entry.charAt(1);
4220
- if (secondCharactery === '/' || secondCharactery === '\\') {
4221
- return entry.slice(LEADING_DOT_SEGMENT_CHARACTERS_COUNT);
4222
- }
4223
- }
4224
- return entry;
4225
- }
4218
+ Object.defineProperty(path$9, "__esModule", { value: true });
4219
+ path$9.convertPosixPathToPattern = path$9.convertWindowsPathToPattern = path$9.convertPathToPattern = path$9.escapePosixPath = path$9.escapeWindowsPath = path$9.escape = path$9.removeLeadingDotSegment = path$9.makeAbsolute = path$9.unixify = void 0;
4220
+ const os = require$$0$4;
4221
+ const path$8 = require$$0$2;
4222
+ const IS_WINDOWS_PLATFORM = os.platform() === 'win32';
4223
+ const LEADING_DOT_SEGMENT_CHARACTERS_COUNT = 2; // ./ or .\\
4224
+ /**
4225
+ * All non-escaped special characters.
4226
+ * Posix: ()*?[\]{|}, !+@ before (, ! at the beginning, \\ before non-special characters.
4227
+ * Windows: (){}, !+@ before (, ! at the beginning.
4228
+ */
4229
+ const POSIX_UNESCAPED_GLOB_SYMBOLS_RE = /(\\?)([()*?[\]{|}]|^!|[!+@](?=\()|\\(?![!()*+?@[\]{|}]))/g;
4230
+ const WINDOWS_UNESCAPED_GLOB_SYMBOLS_RE = /(\\?)([(){}]|^!|[!+@](?=\())/g;
4231
+ /**
4232
+ * The device path (\\.\ or \\?\).
4233
+ * https://learn.microsoft.com/en-us/dotnet/standard/io/file-path-formats#dos-device-paths
4234
+ */
4235
+ const DOS_DEVICE_PATH_RE = /^\\\\([.?])/;
4236
+ /**
4237
+ * All backslashes except those escaping special characters.
4238
+ * Windows: !()+@{}
4239
+ * https://learn.microsoft.com/en-us/windows/win32/fileio/naming-a-file#naming-conventions
4240
+ */
4241
+ const WINDOWS_BACKSLASHES_RE = /\\(?![!()+@{}])/g;
4242
+ /**
4243
+ * Designed to work only with simple paths: `dir\\file`.
4244
+ */
4245
+ function unixify(filepath) {
4246
+ return filepath.replace(/\\/g, '/');
4247
+ }
4248
+ path$9.unixify = unixify;
4249
+ function makeAbsolute(cwd, filepath) {
4250
+ return path$8.resolve(cwd, filepath);
4251
+ }
4252
+ path$9.makeAbsolute = makeAbsolute;
4253
+ function removeLeadingDotSegment(entry) {
4254
+ // We do not use `startsWith` because this is 10x slower than current implementation for some cases.
4255
+ // eslint-disable-next-line @typescript-eslint/prefer-string-starts-ends-with
4256
+ if (entry.charAt(0) === '.') {
4257
+ const secondCharactery = entry.charAt(1);
4258
+ if (secondCharactery === '/' || secondCharactery === '\\') {
4259
+ return entry.slice(LEADING_DOT_SEGMENT_CHARACTERS_COUNT);
4260
+ }
4261
+ }
4262
+ return entry;
4263
+ }
4226
4264
  path$9.removeLeadingDotSegment = removeLeadingDotSegment;
4265
+ path$9.escape = IS_WINDOWS_PLATFORM ? escapeWindowsPath : escapePosixPath;
4266
+ function escapeWindowsPath(pattern) {
4267
+ return pattern.replace(WINDOWS_UNESCAPED_GLOB_SYMBOLS_RE, '\\$2');
4268
+ }
4269
+ path$9.escapeWindowsPath = escapeWindowsPath;
4270
+ function escapePosixPath(pattern) {
4271
+ return pattern.replace(POSIX_UNESCAPED_GLOB_SYMBOLS_RE, '\\$2');
4272
+ }
4273
+ path$9.escapePosixPath = escapePosixPath;
4274
+ path$9.convertPathToPattern = IS_WINDOWS_PLATFORM ? convertWindowsPathToPattern : convertPosixPathToPattern;
4275
+ function convertWindowsPathToPattern(filepath) {
4276
+ return escapeWindowsPath(filepath)
4277
+ .replace(DOS_DEVICE_PATH_RE, '//$1')
4278
+ .replace(WINDOWS_BACKSLASHES_RE, '/');
4279
+ }
4280
+ path$9.convertWindowsPathToPattern = convertWindowsPathToPattern;
4281
+ function convertPosixPathToPattern(filepath) {
4282
+ return escapePosixPath(filepath);
4283
+ }
4284
+ path$9.convertPosixPathToPattern = convertPosixPathToPattern;
4227
4285
 
4228
4286
  var pattern$1 = {};
4229
4287
 
@@ -4400,8 +4458,8 @@ var isGlob$1 = function isGlob(str, options) {
4400
4458
  };
4401
4459
 
4402
4460
  var isGlob = isGlob$1;
4403
- var pathPosixDirname = require$$0__default$2["default"].posix.dirname;
4404
- var isWin32 = require$$2__default$1["default"].platform() === 'win32';
4461
+ var pathPosixDirname = require$$0$2.posix.dirname;
4462
+ var isWin32 = require$$0$4.platform() === 'win32';
4405
4463
 
4406
4464
  var slash = '/';
4407
4465
  var backslash = /\\/g;
@@ -4897,12 +4955,12 @@ var toRegexRange_1 = toRegexRange$1;
4897
4955
  * Licensed under the MIT License.
4898
4956
  */
4899
4957
 
4900
- const util$1 = require$$0__default$3["default"];
4958
+ const util$1 = require$$0$3;
4901
4959
  const toRegexRange = toRegexRange_1;
4902
4960
 
4903
4961
  const isObject$1 = val => val !== null && typeof val === 'object' && !Array.isArray(val);
4904
4962
 
4905
- const transform$1 = toNumber => {
4963
+ const transform = toNumber => {
4906
4964
  return value => toNumber === true ? Number(value) : String(value);
4907
4965
  };
4908
4966
 
@@ -5039,7 +5097,7 @@ const fillNumbers = (start, end, step = 1, options = {}) => {
5039
5097
  let padded = zeros(startString) || zeros(endString) || zeros(stepString);
5040
5098
  let maxLen = padded ? Math.max(startString.length, endString.length, stepString.length) : 0;
5041
5099
  let toNumber = padded === false && stringify$3(start, end, options) === false;
5042
- let format = options.transform || transform$1(toNumber);
5100
+ let format = options.transform || transform(toNumber);
5043
5101
 
5044
5102
  if (options.toRegex && step === 1) {
5045
5103
  return toRange(toMaxLen(start, maxLen), toMaxLen(end, maxLen), true, options);
@@ -5862,7 +5920,7 @@ var braces_1 = braces$1;
5862
5920
 
5863
5921
  var utils$f = {};
5864
5922
 
5865
- const path$7 = require$$0__default$2["default"];
5923
+ const path$7 = require$$0$2;
5866
5924
  const WIN_SLASH = '\\\\/';
5867
5925
  const WIN_NO_SLASH = `[^${WIN_SLASH}]`;
5868
5926
 
@@ -6042,7 +6100,7 @@ var constants$3 = {
6042
6100
 
6043
6101
  (function (exports) {
6044
6102
 
6045
- const path = require$$0__default$2["default"];
6103
+ const path = require$$0$2;
6046
6104
  const win32 = process.platform === 'win32';
6047
6105
  const {
6048
6106
  REGEX_BACKSLASH,
@@ -7586,7 +7644,7 @@ parse$1.fastpaths = (input, options) => {
7586
7644
 
7587
7645
  var parse_1 = parse$1;
7588
7646
 
7589
- const path$6 = require$$0__default$2["default"];
7647
+ const path$6 = require$$0$2;
7590
7648
  const scan = scan_1;
7591
7649
  const parse = parse_1;
7592
7650
  const utils$c = utils$f;
@@ -7929,7 +7987,7 @@ var picomatch_1 = picomatch$2;
7929
7987
 
7930
7988
  var picomatch$1 = picomatch_1;
7931
7989
 
7932
- const util = require$$0__default$3["default"];
7990
+ const util = require$$0$3;
7933
7991
  const braces = braces_1;
7934
7992
  const picomatch = picomatch$1;
7935
7993
  const utils$b = utils$f;
@@ -8395,174 +8453,193 @@ micromatch$1.braceExpand = (pattern, options) => {
8395
8453
 
8396
8454
  var micromatch_1 = micromatch$1;
8397
8455
 
8398
- Object.defineProperty(pattern$1, "__esModule", { value: true });
8399
- pattern$1.matchAny = pattern$1.convertPatternsToRe = pattern$1.makeRe = pattern$1.getPatternParts = pattern$1.expandBraceExpansion = pattern$1.expandPatternsWithBraceExpansion = pattern$1.isAffectDepthOfReadingPattern = pattern$1.endsWithSlashGlobStar = pattern$1.hasGlobStar = pattern$1.getBaseDirectory = pattern$1.isPatternRelatedToParentDirectory = pattern$1.getPatternsOutsideCurrentDirectory = pattern$1.getPatternsInsideCurrentDirectory = pattern$1.getPositivePatterns = pattern$1.getNegativePatterns = pattern$1.isPositivePattern = pattern$1.isNegativePattern = pattern$1.convertToNegativePattern = pattern$1.convertToPositivePattern = pattern$1.isDynamicPattern = pattern$1.isStaticPattern = void 0;
8400
- const path$5 = require$$0__default$2["default"];
8401
- const globParent = globParent$1;
8402
- const micromatch = micromatch_1;
8403
- const GLOBSTAR = '**';
8404
- const ESCAPE_SYMBOL = '\\';
8405
- const COMMON_GLOB_SYMBOLS_RE = /[*?]|^!/;
8406
- const REGEX_CHARACTER_CLASS_SYMBOLS_RE = /\[[^[]*]/;
8407
- const REGEX_GROUP_SYMBOLS_RE = /(?:^|[^!*+?@])\([^(]*\|[^|]*\)/;
8408
- const GLOB_EXTENSION_SYMBOLS_RE = /[!*+?@]\([^(]*\)/;
8409
- const BRACE_EXPANSION_SEPARATORS_RE = /,|\.\./;
8410
- function isStaticPattern(pattern, options = {}) {
8411
- return !isDynamicPattern(pattern, options);
8412
- }
8413
- pattern$1.isStaticPattern = isStaticPattern;
8414
- function isDynamicPattern(pattern, options = {}) {
8415
- /**
8416
- * A special case with an empty string is necessary for matching patterns that start with a forward slash.
8417
- * An empty string cannot be a dynamic pattern.
8418
- * For example, the pattern `/lib/*` will be spread into parts: '', 'lib', '*'.
8419
- */
8420
- if (pattern === '') {
8421
- return false;
8422
- }
8423
- /**
8424
- * When the `caseSensitiveMatch` option is disabled, all patterns must be marked as dynamic, because we cannot check
8425
- * filepath directly (without read directory).
8426
- */
8427
- if (options.caseSensitiveMatch === false || pattern.includes(ESCAPE_SYMBOL)) {
8428
- return true;
8429
- }
8430
- if (COMMON_GLOB_SYMBOLS_RE.test(pattern) || REGEX_CHARACTER_CLASS_SYMBOLS_RE.test(pattern) || REGEX_GROUP_SYMBOLS_RE.test(pattern)) {
8431
- return true;
8432
- }
8433
- if (options.extglob !== false && GLOB_EXTENSION_SYMBOLS_RE.test(pattern)) {
8434
- return true;
8435
- }
8436
- if (options.braceExpansion !== false && hasBraceExpansion(pattern)) {
8437
- return true;
8438
- }
8439
- return false;
8440
- }
8441
- pattern$1.isDynamicPattern = isDynamicPattern;
8442
- function hasBraceExpansion(pattern) {
8443
- const openingBraceIndex = pattern.indexOf('{');
8444
- if (openingBraceIndex === -1) {
8445
- return false;
8446
- }
8447
- const closingBraceIndex = pattern.indexOf('}', openingBraceIndex + 1);
8448
- if (closingBraceIndex === -1) {
8449
- return false;
8450
- }
8451
- const braceContent = pattern.slice(openingBraceIndex, closingBraceIndex);
8452
- return BRACE_EXPANSION_SEPARATORS_RE.test(braceContent);
8453
- }
8454
- function convertToPositivePattern(pattern) {
8455
- return isNegativePattern(pattern) ? pattern.slice(1) : pattern;
8456
- }
8457
- pattern$1.convertToPositivePattern = convertToPositivePattern;
8458
- function convertToNegativePattern(pattern) {
8459
- return '!' + pattern;
8460
- }
8461
- pattern$1.convertToNegativePattern = convertToNegativePattern;
8462
- function isNegativePattern(pattern) {
8463
- return pattern.startsWith('!') && pattern[1] !== '(';
8464
- }
8465
- pattern$1.isNegativePattern = isNegativePattern;
8466
- function isPositivePattern(pattern) {
8467
- return !isNegativePattern(pattern);
8468
- }
8469
- pattern$1.isPositivePattern = isPositivePattern;
8470
- function getNegativePatterns(patterns) {
8471
- return patterns.filter(isNegativePattern);
8472
- }
8473
- pattern$1.getNegativePatterns = getNegativePatterns;
8474
- function getPositivePatterns$1(patterns) {
8475
- return patterns.filter(isPositivePattern);
8476
- }
8477
- pattern$1.getPositivePatterns = getPositivePatterns$1;
8478
- /**
8479
- * Returns patterns that can be applied inside the current directory.
8480
- *
8481
- * @example
8482
- * // ['./*', '*', 'a/*']
8483
- * getPatternsInsideCurrentDirectory(['./*', '*', 'a/*', '../*', './../*'])
8484
- */
8485
- function getPatternsInsideCurrentDirectory(patterns) {
8486
- return patterns.filter((pattern) => !isPatternRelatedToParentDirectory(pattern));
8487
- }
8488
- pattern$1.getPatternsInsideCurrentDirectory = getPatternsInsideCurrentDirectory;
8489
- /**
8490
- * Returns patterns to be expanded relative to (outside) the current directory.
8491
- *
8492
- * @example
8493
- * // ['../*', './../*']
8494
- * getPatternsInsideCurrentDirectory(['./*', '*', 'a/*', '../*', './../*'])
8495
- */
8496
- function getPatternsOutsideCurrentDirectory(patterns) {
8497
- return patterns.filter(isPatternRelatedToParentDirectory);
8498
- }
8499
- pattern$1.getPatternsOutsideCurrentDirectory = getPatternsOutsideCurrentDirectory;
8500
- function isPatternRelatedToParentDirectory(pattern) {
8501
- return pattern.startsWith('..') || pattern.startsWith('./..');
8502
- }
8503
- pattern$1.isPatternRelatedToParentDirectory = isPatternRelatedToParentDirectory;
8504
- function getBaseDirectory(pattern) {
8505
- return globParent(pattern, { flipBackslashes: false });
8506
- }
8507
- pattern$1.getBaseDirectory = getBaseDirectory;
8508
- function hasGlobStar(pattern) {
8509
- return pattern.includes(GLOBSTAR);
8510
- }
8511
- pattern$1.hasGlobStar = hasGlobStar;
8512
- function endsWithSlashGlobStar(pattern) {
8513
- return pattern.endsWith('/' + GLOBSTAR);
8514
- }
8515
- pattern$1.endsWithSlashGlobStar = endsWithSlashGlobStar;
8516
- function isAffectDepthOfReadingPattern(pattern) {
8517
- const basename = path$5.basename(pattern);
8518
- return endsWithSlashGlobStar(pattern) || isStaticPattern(basename);
8519
- }
8520
- pattern$1.isAffectDepthOfReadingPattern = isAffectDepthOfReadingPattern;
8521
- function expandPatternsWithBraceExpansion(patterns) {
8522
- return patterns.reduce((collection, pattern) => {
8523
- return collection.concat(expandBraceExpansion(pattern));
8524
- }, []);
8525
- }
8526
- pattern$1.expandPatternsWithBraceExpansion = expandPatternsWithBraceExpansion;
8527
- function expandBraceExpansion(pattern) {
8528
- return micromatch.braces(pattern, {
8529
- expand: true,
8530
- nodupes: true
8531
- });
8532
- }
8533
- pattern$1.expandBraceExpansion = expandBraceExpansion;
8534
- function getPatternParts(pattern, options) {
8535
- let { parts } = micromatch.scan(pattern, Object.assign(Object.assign({}, options), { parts: true }));
8536
- /**
8537
- * The scan method returns an empty array in some cases.
8538
- * See micromatch/picomatch#58 for more details.
8539
- */
8540
- if (parts.length === 0) {
8541
- parts = [pattern];
8542
- }
8543
- /**
8544
- * The scan method does not return an empty part for the pattern with a forward slash.
8545
- * This is another part of micromatch/picomatch#58.
8546
- */
8547
- if (parts[0].startsWith('/')) {
8548
- parts[0] = parts[0].slice(1);
8549
- parts.unshift('');
8550
- }
8551
- return parts;
8552
- }
8553
- pattern$1.getPatternParts = getPatternParts;
8554
- function makeRe(pattern, options) {
8555
- return micromatch.makeRe(pattern, options);
8556
- }
8557
- pattern$1.makeRe = makeRe;
8558
- function convertPatternsToRe(patterns, options) {
8559
- return patterns.map((pattern) => makeRe(pattern, options));
8560
- }
8561
- pattern$1.convertPatternsToRe = convertPatternsToRe;
8562
- function matchAny(entry, patternsRe) {
8563
- return patternsRe.some((patternRe) => patternRe.test(entry));
8564
- }
8456
+ Object.defineProperty(pattern$1, "__esModule", { value: true });
8457
+ pattern$1.removeDuplicateSlashes = pattern$1.matchAny = pattern$1.convertPatternsToRe = pattern$1.makeRe = pattern$1.getPatternParts = pattern$1.expandBraceExpansion = pattern$1.expandPatternsWithBraceExpansion = pattern$1.isAffectDepthOfReadingPattern = pattern$1.endsWithSlashGlobStar = pattern$1.hasGlobStar = pattern$1.getBaseDirectory = pattern$1.isPatternRelatedToParentDirectory = pattern$1.getPatternsOutsideCurrentDirectory = pattern$1.getPatternsInsideCurrentDirectory = pattern$1.getPositivePatterns = pattern$1.getNegativePatterns = pattern$1.isPositivePattern = pattern$1.isNegativePattern = pattern$1.convertToNegativePattern = pattern$1.convertToPositivePattern = pattern$1.isDynamicPattern = pattern$1.isStaticPattern = void 0;
8458
+ const path$5 = require$$0$2;
8459
+ const globParent = globParent$1;
8460
+ const micromatch = micromatch_1;
8461
+ const GLOBSTAR = '**';
8462
+ const ESCAPE_SYMBOL = '\\';
8463
+ const COMMON_GLOB_SYMBOLS_RE = /[*?]|^!/;
8464
+ const REGEX_CHARACTER_CLASS_SYMBOLS_RE = /\[[^[]*]/;
8465
+ const REGEX_GROUP_SYMBOLS_RE = /(?:^|[^!*+?@])\([^(]*\|[^|]*\)/;
8466
+ const GLOB_EXTENSION_SYMBOLS_RE = /[!*+?@]\([^(]*\)/;
8467
+ const BRACE_EXPANSION_SEPARATORS_RE = /,|\.\./;
8468
+ /**
8469
+ * Matches a sequence of two or more consecutive slashes, excluding the first two slashes at the beginning of the string.
8470
+ * The latter is due to the presence of the device path at the beginning of the UNC path.
8471
+ */
8472
+ const DOUBLE_SLASH_RE = /(?!^)\/{2,}/g;
8473
+ function isStaticPattern(pattern, options = {}) {
8474
+ return !isDynamicPattern(pattern, options);
8475
+ }
8476
+ pattern$1.isStaticPattern = isStaticPattern;
8477
+ function isDynamicPattern(pattern, options = {}) {
8478
+ /**
8479
+ * A special case with an empty string is necessary for matching patterns that start with a forward slash.
8480
+ * An empty string cannot be a dynamic pattern.
8481
+ * For example, the pattern `/lib/*` will be spread into parts: '', 'lib', '*'.
8482
+ */
8483
+ if (pattern === '') {
8484
+ return false;
8485
+ }
8486
+ /**
8487
+ * When the `caseSensitiveMatch` option is disabled, all patterns must be marked as dynamic, because we cannot check
8488
+ * filepath directly (without read directory).
8489
+ */
8490
+ if (options.caseSensitiveMatch === false || pattern.includes(ESCAPE_SYMBOL)) {
8491
+ return true;
8492
+ }
8493
+ if (COMMON_GLOB_SYMBOLS_RE.test(pattern) || REGEX_CHARACTER_CLASS_SYMBOLS_RE.test(pattern) || REGEX_GROUP_SYMBOLS_RE.test(pattern)) {
8494
+ return true;
8495
+ }
8496
+ if (options.extglob !== false && GLOB_EXTENSION_SYMBOLS_RE.test(pattern)) {
8497
+ return true;
8498
+ }
8499
+ if (options.braceExpansion !== false && hasBraceExpansion(pattern)) {
8500
+ return true;
8501
+ }
8502
+ return false;
8503
+ }
8504
+ pattern$1.isDynamicPattern = isDynamicPattern;
8505
+ function hasBraceExpansion(pattern) {
8506
+ const openingBraceIndex = pattern.indexOf('{');
8507
+ if (openingBraceIndex === -1) {
8508
+ return false;
8509
+ }
8510
+ const closingBraceIndex = pattern.indexOf('}', openingBraceIndex + 1);
8511
+ if (closingBraceIndex === -1) {
8512
+ return false;
8513
+ }
8514
+ const braceContent = pattern.slice(openingBraceIndex, closingBraceIndex);
8515
+ return BRACE_EXPANSION_SEPARATORS_RE.test(braceContent);
8516
+ }
8517
+ function convertToPositivePattern(pattern) {
8518
+ return isNegativePattern(pattern) ? pattern.slice(1) : pattern;
8519
+ }
8520
+ pattern$1.convertToPositivePattern = convertToPositivePattern;
8521
+ function convertToNegativePattern(pattern) {
8522
+ return '!' + pattern;
8523
+ }
8524
+ pattern$1.convertToNegativePattern = convertToNegativePattern;
8525
+ function isNegativePattern(pattern) {
8526
+ return pattern.startsWith('!') && pattern[1] !== '(';
8527
+ }
8528
+ pattern$1.isNegativePattern = isNegativePattern;
8529
+ function isPositivePattern(pattern) {
8530
+ return !isNegativePattern(pattern);
8531
+ }
8532
+ pattern$1.isPositivePattern = isPositivePattern;
8533
+ function getNegativePatterns(patterns) {
8534
+ return patterns.filter(isNegativePattern);
8535
+ }
8536
+ pattern$1.getNegativePatterns = getNegativePatterns;
8537
+ function getPositivePatterns$1(patterns) {
8538
+ return patterns.filter(isPositivePattern);
8539
+ }
8540
+ pattern$1.getPositivePatterns = getPositivePatterns$1;
8541
+ /**
8542
+ * Returns patterns that can be applied inside the current directory.
8543
+ *
8544
+ * @example
8545
+ * // ['./*', '*', 'a/*']
8546
+ * getPatternsInsideCurrentDirectory(['./*', '*', 'a/*', '../*', './../*'])
8547
+ */
8548
+ function getPatternsInsideCurrentDirectory(patterns) {
8549
+ return patterns.filter((pattern) => !isPatternRelatedToParentDirectory(pattern));
8550
+ }
8551
+ pattern$1.getPatternsInsideCurrentDirectory = getPatternsInsideCurrentDirectory;
8552
+ /**
8553
+ * Returns patterns to be expanded relative to (outside) the current directory.
8554
+ *
8555
+ * @example
8556
+ * // ['../*', './../*']
8557
+ * getPatternsInsideCurrentDirectory(['./*', '*', 'a/*', '../*', './../*'])
8558
+ */
8559
+ function getPatternsOutsideCurrentDirectory(patterns) {
8560
+ return patterns.filter(isPatternRelatedToParentDirectory);
8561
+ }
8562
+ pattern$1.getPatternsOutsideCurrentDirectory = getPatternsOutsideCurrentDirectory;
8563
+ function isPatternRelatedToParentDirectory(pattern) {
8564
+ return pattern.startsWith('..') || pattern.startsWith('./..');
8565
+ }
8566
+ pattern$1.isPatternRelatedToParentDirectory = isPatternRelatedToParentDirectory;
8567
+ function getBaseDirectory(pattern) {
8568
+ return globParent(pattern, { flipBackslashes: false });
8569
+ }
8570
+ pattern$1.getBaseDirectory = getBaseDirectory;
8571
+ function hasGlobStar(pattern) {
8572
+ return pattern.includes(GLOBSTAR);
8573
+ }
8574
+ pattern$1.hasGlobStar = hasGlobStar;
8575
+ function endsWithSlashGlobStar(pattern) {
8576
+ return pattern.endsWith('/' + GLOBSTAR);
8577
+ }
8578
+ pattern$1.endsWithSlashGlobStar = endsWithSlashGlobStar;
8579
+ function isAffectDepthOfReadingPattern(pattern) {
8580
+ const basename = path$5.basename(pattern);
8581
+ return endsWithSlashGlobStar(pattern) || isStaticPattern(basename);
8582
+ }
8583
+ pattern$1.isAffectDepthOfReadingPattern = isAffectDepthOfReadingPattern;
8584
+ function expandPatternsWithBraceExpansion(patterns) {
8585
+ return patterns.reduce((collection, pattern) => {
8586
+ return collection.concat(expandBraceExpansion(pattern));
8587
+ }, []);
8588
+ }
8589
+ pattern$1.expandPatternsWithBraceExpansion = expandPatternsWithBraceExpansion;
8590
+ function expandBraceExpansion(pattern) {
8591
+ const patterns = micromatch.braces(pattern, { expand: true, nodupes: true });
8592
+ /**
8593
+ * Sort the patterns by length so that the same depth patterns are processed side by side.
8594
+ * `a/{b,}/{c,}/*` – `['a///*', 'a/b//*', 'a//c/*', 'a/b/c/*']`
8595
+ */
8596
+ patterns.sort((a, b) => a.length - b.length);
8597
+ /**
8598
+ * Micromatch can return an empty string in the case of patterns like `{a,}`.
8599
+ */
8600
+ return patterns.filter((pattern) => pattern !== '');
8601
+ }
8602
+ pattern$1.expandBraceExpansion = expandBraceExpansion;
8603
+ function getPatternParts(pattern, options) {
8604
+ let { parts } = micromatch.scan(pattern, Object.assign(Object.assign({}, options), { parts: true }));
8605
+ /**
8606
+ * The scan method returns an empty array in some cases.
8607
+ * See micromatch/picomatch#58 for more details.
8608
+ */
8609
+ if (parts.length === 0) {
8610
+ parts = [pattern];
8611
+ }
8612
+ /**
8613
+ * The scan method does not return an empty part for the pattern with a forward slash.
8614
+ * This is another part of micromatch/picomatch#58.
8615
+ */
8616
+ if (parts[0].startsWith('/')) {
8617
+ parts[0] = parts[0].slice(1);
8618
+ parts.unshift('');
8619
+ }
8620
+ return parts;
8621
+ }
8622
+ pattern$1.getPatternParts = getPatternParts;
8623
+ function makeRe(pattern, options) {
8624
+ return micromatch.makeRe(pattern, options);
8625
+ }
8626
+ pattern$1.makeRe = makeRe;
8627
+ function convertPatternsToRe(patterns, options) {
8628
+ return patterns.map((pattern) => makeRe(pattern, options));
8629
+ }
8630
+ pattern$1.convertPatternsToRe = convertPatternsToRe;
8631
+ function matchAny(entry, patternsRe) {
8632
+ return patternsRe.some((patternRe) => patternRe.test(entry));
8633
+ }
8565
8634
  pattern$1.matchAny = matchAny;
8635
+ /**
8636
+ * This package only works with forward slashes as a path separator.
8637
+ * Because of this, we cannot use the standard `path.normalize` method, because on Windows platform it will use of backslashes.
8638
+ */
8639
+ function removeDuplicateSlashes(pattern) {
8640
+ return pattern.replace(DOUBLE_SLASH_RE, '/');
8641
+ }
8642
+ pattern$1.removeDuplicateSlashes = removeDuplicateSlashes;
8566
8643
 
8567
8644
  var stream$4 = {};
8568
8645
 
@@ -8573,7 +8650,7 @@ var stream$4 = {};
8573
8650
  * Copyright (c) 2014-2020 Teambition
8574
8651
  * Licensed under the MIT license.
8575
8652
  */
8576
- const Stream = require$$0__default["default"];
8653
+ const Stream = require$$0;
8577
8654
  const PassThrough = Stream.PassThrough;
8578
8655
  const slice = Array.prototype.slice;
8579
8656
 
@@ -8710,156 +8787,163 @@ function pauseStreams (streams, options) {
8710
8787
  return streams
8711
8788
  }
8712
8789
 
8713
- Object.defineProperty(stream$4, "__esModule", { value: true });
8714
- stream$4.merge = void 0;
8715
- const merge2 = merge2_1;
8716
- function merge(streams) {
8717
- const mergedStream = merge2(streams);
8718
- streams.forEach((stream) => {
8719
- stream.once('error', (error) => mergedStream.emit('error', error));
8720
- });
8721
- mergedStream.once('close', () => propagateCloseEventToSources(streams));
8722
- mergedStream.once('end', () => propagateCloseEventToSources(streams));
8723
- return mergedStream;
8724
- }
8725
- stream$4.merge = merge;
8726
- function propagateCloseEventToSources(streams) {
8727
- streams.forEach((stream) => stream.emit('close'));
8790
+ Object.defineProperty(stream$4, "__esModule", { value: true });
8791
+ stream$4.merge = void 0;
8792
+ const merge2 = merge2_1;
8793
+ function merge(streams) {
8794
+ const mergedStream = merge2(streams);
8795
+ streams.forEach((stream) => {
8796
+ stream.once('error', (error) => mergedStream.emit('error', error));
8797
+ });
8798
+ mergedStream.once('close', () => propagateCloseEventToSources(streams));
8799
+ mergedStream.once('end', () => propagateCloseEventToSources(streams));
8800
+ return mergedStream;
8801
+ }
8802
+ stream$4.merge = merge;
8803
+ function propagateCloseEventToSources(streams) {
8804
+ streams.forEach((stream) => stream.emit('close'));
8728
8805
  }
8729
8806
 
8730
8807
  var string$1 = {};
8731
8808
 
8732
- Object.defineProperty(string$1, "__esModule", { value: true });
8733
- string$1.isEmpty = string$1.isString = void 0;
8734
- function isString(input) {
8735
- return typeof input === 'string';
8736
- }
8737
- string$1.isString = isString;
8738
- function isEmpty(input) {
8739
- return input === '';
8740
- }
8809
+ Object.defineProperty(string$1, "__esModule", { value: true });
8810
+ string$1.isEmpty = string$1.isString = void 0;
8811
+ function isString(input) {
8812
+ return typeof input === 'string';
8813
+ }
8814
+ string$1.isString = isString;
8815
+ function isEmpty(input) {
8816
+ return input === '';
8817
+ }
8741
8818
  string$1.isEmpty = isEmpty;
8742
8819
 
8743
- Object.defineProperty(utils$k, "__esModule", { value: true });
8744
- utils$k.string = utils$k.stream = utils$k.pattern = utils$k.path = utils$k.fs = utils$k.errno = utils$k.array = void 0;
8745
- const array = array$1;
8746
- utils$k.array = array;
8747
- const errno = errno$1;
8748
- utils$k.errno = errno;
8749
- const fs$6 = fs$7;
8750
- utils$k.fs = fs$6;
8751
- const path$4 = path$9;
8752
- utils$k.path = path$4;
8753
- const pattern = pattern$1;
8754
- utils$k.pattern = pattern;
8755
- const stream$3 = stream$4;
8756
- utils$k.stream = stream$3;
8757
- const string = string$1;
8820
+ Object.defineProperty(utils$k, "__esModule", { value: true });
8821
+ utils$k.string = utils$k.stream = utils$k.pattern = utils$k.path = utils$k.fs = utils$k.errno = utils$k.array = void 0;
8822
+ const array = array$1;
8823
+ utils$k.array = array;
8824
+ const errno = errno$1;
8825
+ utils$k.errno = errno;
8826
+ const fs$6 = fs$7;
8827
+ utils$k.fs = fs$6;
8828
+ const path$4 = path$9;
8829
+ utils$k.path = path$4;
8830
+ const pattern = pattern$1;
8831
+ utils$k.pattern = pattern;
8832
+ const stream$3 = stream$4;
8833
+ utils$k.stream = stream$3;
8834
+ const string = string$1;
8758
8835
  utils$k.string = string;
8759
8836
 
8760
- Object.defineProperty(tasks, "__esModule", { value: true });
8761
- tasks.convertPatternGroupToTask = tasks.convertPatternGroupsToTasks = tasks.groupPatternsByBaseDirectory = tasks.getNegativePatternsAsPositive = tasks.getPositivePatterns = tasks.convertPatternsToTasks = tasks.generate = void 0;
8762
- const utils$a = utils$k;
8763
- function generate(patterns, settings) {
8764
- const positivePatterns = getPositivePatterns(patterns);
8765
- const negativePatterns = getNegativePatternsAsPositive(patterns, settings.ignore);
8766
- const staticPatterns = positivePatterns.filter((pattern) => utils$a.pattern.isStaticPattern(pattern, settings));
8767
- const dynamicPatterns = positivePatterns.filter((pattern) => utils$a.pattern.isDynamicPattern(pattern, settings));
8768
- const staticTasks = convertPatternsToTasks(staticPatterns, negativePatterns, /* dynamic */ false);
8769
- const dynamicTasks = convertPatternsToTasks(dynamicPatterns, negativePatterns, /* dynamic */ true);
8770
- return staticTasks.concat(dynamicTasks);
8771
- }
8772
- tasks.generate = generate;
8773
- /**
8774
- * Returns tasks grouped by basic pattern directories.
8775
- *
8776
- * Patterns that can be found inside (`./`) and outside (`../`) the current directory are handled separately.
8777
- * This is necessary because directory traversal starts at the base directory and goes deeper.
8778
- */
8779
- function convertPatternsToTasks(positive, negative, dynamic) {
8780
- const tasks = [];
8781
- const patternsOutsideCurrentDirectory = utils$a.pattern.getPatternsOutsideCurrentDirectory(positive);
8782
- const patternsInsideCurrentDirectory = utils$a.pattern.getPatternsInsideCurrentDirectory(positive);
8783
- const outsideCurrentDirectoryGroup = groupPatternsByBaseDirectory(patternsOutsideCurrentDirectory);
8784
- const insideCurrentDirectoryGroup = groupPatternsByBaseDirectory(patternsInsideCurrentDirectory);
8785
- tasks.push(...convertPatternGroupsToTasks(outsideCurrentDirectoryGroup, negative, dynamic));
8786
- /*
8787
- * For the sake of reducing future accesses to the file system, we merge all tasks within the current directory
8788
- * into a global task, if at least one pattern refers to the root (`.`). In this case, the global task covers the rest.
8789
- */
8790
- if ('.' in insideCurrentDirectoryGroup) {
8791
- tasks.push(convertPatternGroupToTask('.', patternsInsideCurrentDirectory, negative, dynamic));
8792
- }
8793
- else {
8794
- tasks.push(...convertPatternGroupsToTasks(insideCurrentDirectoryGroup, negative, dynamic));
8795
- }
8796
- return tasks;
8797
- }
8798
- tasks.convertPatternsToTasks = convertPatternsToTasks;
8799
- function getPositivePatterns(patterns) {
8800
- return utils$a.pattern.getPositivePatterns(patterns);
8801
- }
8802
- tasks.getPositivePatterns = getPositivePatterns;
8803
- function getNegativePatternsAsPositive(patterns, ignore) {
8804
- const negative = utils$a.pattern.getNegativePatterns(patterns).concat(ignore);
8805
- const positive = negative.map(utils$a.pattern.convertToPositivePattern);
8806
- return positive;
8807
- }
8808
- tasks.getNegativePatternsAsPositive = getNegativePatternsAsPositive;
8809
- function groupPatternsByBaseDirectory(patterns) {
8810
- const group = {};
8811
- return patterns.reduce((collection, pattern) => {
8812
- const base = utils$a.pattern.getBaseDirectory(pattern);
8813
- if (base in collection) {
8814
- collection[base].push(pattern);
8815
- }
8816
- else {
8817
- collection[base] = [pattern];
8818
- }
8819
- return collection;
8820
- }, group);
8821
- }
8822
- tasks.groupPatternsByBaseDirectory = groupPatternsByBaseDirectory;
8823
- function convertPatternGroupsToTasks(positive, negative, dynamic) {
8824
- return Object.keys(positive).map((base) => {
8825
- return convertPatternGroupToTask(base, positive[base], negative, dynamic);
8826
- });
8827
- }
8828
- tasks.convertPatternGroupsToTasks = convertPatternGroupsToTasks;
8829
- function convertPatternGroupToTask(base, positive, negative, dynamic) {
8830
- return {
8831
- dynamic,
8832
- positive,
8833
- negative,
8834
- base,
8835
- patterns: [].concat(positive, negative.map(utils$a.pattern.convertToNegativePattern))
8836
- };
8837
- }
8837
+ Object.defineProperty(tasks, "__esModule", { value: true });
8838
+ tasks.convertPatternGroupToTask = tasks.convertPatternGroupsToTasks = tasks.groupPatternsByBaseDirectory = tasks.getNegativePatternsAsPositive = tasks.getPositivePatterns = tasks.convertPatternsToTasks = tasks.generate = void 0;
8839
+ const utils$a = utils$k;
8840
+ function generate(input, settings) {
8841
+ const patterns = processPatterns(input, settings);
8842
+ const ignore = processPatterns(settings.ignore, settings);
8843
+ const positivePatterns = getPositivePatterns(patterns);
8844
+ const negativePatterns = getNegativePatternsAsPositive(patterns, ignore);
8845
+ const staticPatterns = positivePatterns.filter((pattern) => utils$a.pattern.isStaticPattern(pattern, settings));
8846
+ const dynamicPatterns = positivePatterns.filter((pattern) => utils$a.pattern.isDynamicPattern(pattern, settings));
8847
+ const staticTasks = convertPatternsToTasks(staticPatterns, negativePatterns, /* dynamic */ false);
8848
+ const dynamicTasks = convertPatternsToTasks(dynamicPatterns, negativePatterns, /* dynamic */ true);
8849
+ return staticTasks.concat(dynamicTasks);
8850
+ }
8851
+ tasks.generate = generate;
8852
+ function processPatterns(input, settings) {
8853
+ let patterns = input;
8854
+ /**
8855
+ * The original pattern like `{,*,**,a/*}` can lead to problems checking the depth when matching entry
8856
+ * and some problems with the micromatch package (see fast-glob issues: #365, #394).
8857
+ *
8858
+ * To solve this problem, we expand all patterns containing brace expansion. This can lead to a slight slowdown
8859
+ * in matching in the case of a large set of patterns after expansion.
8860
+ */
8861
+ if (settings.braceExpansion) {
8862
+ patterns = utils$a.pattern.expandPatternsWithBraceExpansion(patterns);
8863
+ }
8864
+ /**
8865
+ * If the `baseNameMatch` option is enabled, we must add globstar to patterns, so that they can be used
8866
+ * at any nesting level.
8867
+ *
8868
+ * We do this here, because otherwise we have to complicate the filtering logic. For example, we need to change
8869
+ * the pattern in the filter before creating a regular expression. There is no need to change the patterns
8870
+ * in the application. Only on the input.
8871
+ */
8872
+ if (settings.baseNameMatch) {
8873
+ patterns = patterns.map((pattern) => pattern.includes('/') ? pattern : `**/${pattern}`);
8874
+ }
8875
+ /**
8876
+ * This method also removes duplicate slashes that may have been in the pattern or formed as a result of expansion.
8877
+ */
8878
+ return patterns.map((pattern) => utils$a.pattern.removeDuplicateSlashes(pattern));
8879
+ }
8880
+ /**
8881
+ * Returns tasks grouped by basic pattern directories.
8882
+ *
8883
+ * Patterns that can be found inside (`./`) and outside (`../`) the current directory are handled separately.
8884
+ * This is necessary because directory traversal starts at the base directory and goes deeper.
8885
+ */
8886
+ function convertPatternsToTasks(positive, negative, dynamic) {
8887
+ const tasks = [];
8888
+ const patternsOutsideCurrentDirectory = utils$a.pattern.getPatternsOutsideCurrentDirectory(positive);
8889
+ const patternsInsideCurrentDirectory = utils$a.pattern.getPatternsInsideCurrentDirectory(positive);
8890
+ const outsideCurrentDirectoryGroup = groupPatternsByBaseDirectory(patternsOutsideCurrentDirectory);
8891
+ const insideCurrentDirectoryGroup = groupPatternsByBaseDirectory(patternsInsideCurrentDirectory);
8892
+ tasks.push(...convertPatternGroupsToTasks(outsideCurrentDirectoryGroup, negative, dynamic));
8893
+ /*
8894
+ * For the sake of reducing future accesses to the file system, we merge all tasks within the current directory
8895
+ * into a global task, if at least one pattern refers to the root (`.`). In this case, the global task covers the rest.
8896
+ */
8897
+ if ('.' in insideCurrentDirectoryGroup) {
8898
+ tasks.push(convertPatternGroupToTask('.', patternsInsideCurrentDirectory, negative, dynamic));
8899
+ }
8900
+ else {
8901
+ tasks.push(...convertPatternGroupsToTasks(insideCurrentDirectoryGroup, negative, dynamic));
8902
+ }
8903
+ return tasks;
8904
+ }
8905
+ tasks.convertPatternsToTasks = convertPatternsToTasks;
8906
+ function getPositivePatterns(patterns) {
8907
+ return utils$a.pattern.getPositivePatterns(patterns);
8908
+ }
8909
+ tasks.getPositivePatterns = getPositivePatterns;
8910
+ function getNegativePatternsAsPositive(patterns, ignore) {
8911
+ const negative = utils$a.pattern.getNegativePatterns(patterns).concat(ignore);
8912
+ const positive = negative.map(utils$a.pattern.convertToPositivePattern);
8913
+ return positive;
8914
+ }
8915
+ tasks.getNegativePatternsAsPositive = getNegativePatternsAsPositive;
8916
+ function groupPatternsByBaseDirectory(patterns) {
8917
+ const group = {};
8918
+ return patterns.reduce((collection, pattern) => {
8919
+ const base = utils$a.pattern.getBaseDirectory(pattern);
8920
+ if (base in collection) {
8921
+ collection[base].push(pattern);
8922
+ }
8923
+ else {
8924
+ collection[base] = [pattern];
8925
+ }
8926
+ return collection;
8927
+ }, group);
8928
+ }
8929
+ tasks.groupPatternsByBaseDirectory = groupPatternsByBaseDirectory;
8930
+ function convertPatternGroupsToTasks(positive, negative, dynamic) {
8931
+ return Object.keys(positive).map((base) => {
8932
+ return convertPatternGroupToTask(base, positive[base], negative, dynamic);
8933
+ });
8934
+ }
8935
+ tasks.convertPatternGroupsToTasks = convertPatternGroupsToTasks;
8936
+ function convertPatternGroupToTask(base, positive, negative, dynamic) {
8937
+ return {
8938
+ dynamic,
8939
+ positive,
8940
+ negative,
8941
+ base,
8942
+ patterns: [].concat(positive, negative.map(utils$a.pattern.convertToNegativePattern))
8943
+ };
8944
+ }
8838
8945
  tasks.convertPatternGroupToTask = convertPatternGroupToTask;
8839
8946
 
8840
- var patterns = {};
8841
-
8842
- Object.defineProperty(patterns, "__esModule", { value: true });
8843
- patterns.removeDuplicateSlashes = patterns.transform = void 0;
8844
- /**
8845
- * Matches a sequence of two or more consecutive slashes, excluding the first two slashes at the beginning of the string.
8846
- * The latter is due to the presence of the device path at the beginning of the UNC path.
8847
- * @todo rewrite to negative lookbehind with the next major release.
8848
- */
8849
- const DOUBLE_SLASH_RE = /(?!^)\/{2,}/g;
8850
- function transform(patterns) {
8851
- return patterns.map((pattern) => removeDuplicateSlashes(pattern));
8852
- }
8853
- patterns.transform = transform;
8854
- /**
8855
- * This package only works with forward slashes as a path separator.
8856
- * Because of this, we cannot use the standard `path.normalize` method, because on Windows platform it will use of backslashes.
8857
- */
8858
- function removeDuplicateSlashes(pattern) {
8859
- return pattern.replace(DOUBLE_SLASH_RE, '/');
8860
- }
8861
- patterns.removeDuplicateSlashes = removeDuplicateSlashes;
8862
-
8863
8947
  var async$7 = {};
8864
8948
 
8865
8949
  var async$6 = {};
@@ -8946,7 +9030,7 @@ var fs$5 = {};
8946
9030
  (function (exports) {
8947
9031
  Object.defineProperty(exports, "__esModule", { value: true });
8948
9032
  exports.createFileSystemAdapter = exports.FILE_SYSTEM_ADAPTER = void 0;
8949
- const fs = require$$0__default$1["default"];
9033
+ const fs = require$$0$1;
8950
9034
  exports.FILE_SYSTEM_ADAPTER = {
8951
9035
  lstat: fs.lstat,
8952
9036
  stat: fs.stat,
@@ -8964,7 +9048,7 @@ var fs$5 = {};
8964
9048
 
8965
9049
  Object.defineProperty(settings$3, "__esModule", { value: true });
8966
9050
  const fs$4 = fs$5;
8967
- class Settings$2 {
9051
+ let Settings$2 = class Settings {
8968
9052
  constructor(_options = {}) {
8969
9053
  this._options = _options;
8970
9054
  this.followSymbolicLink = this._getValue(this._options.followSymbolicLink, true);
@@ -8975,7 +9059,7 @@ class Settings$2 {
8975
9059
  _getValue(option, value) {
8976
9060
  return option !== null && option !== void 0 ? option : value;
8977
9061
  }
8978
- }
9062
+ };
8979
9063
  settings$3.default = Settings$2;
8980
9064
 
8981
9065
  Object.defineProperty(out$1, "__esModule", { value: true });
@@ -9297,7 +9381,7 @@ var fs$1 = {};
9297
9381
  (function (exports) {
9298
9382
  Object.defineProperty(exports, "__esModule", { value: true });
9299
9383
  exports.createFileSystemAdapter = exports.FILE_SYSTEM_ADAPTER = void 0;
9300
- const fs = require$$0__default$1["default"];
9384
+ const fs = require$$0$1;
9301
9385
  exports.FILE_SYSTEM_ADAPTER = {
9302
9386
  lstat: fs.lstat,
9303
9387
  stat: fs.stat,
@@ -9316,10 +9400,10 @@ var fs$1 = {};
9316
9400
  } (fs$1));
9317
9401
 
9318
9402
  Object.defineProperty(settings$2, "__esModule", { value: true });
9319
- const path$3 = require$$0__default$2["default"];
9403
+ const path$3 = require$$0$2;
9320
9404
  const fsStat$3 = out$1;
9321
9405
  const fs = fs$1;
9322
- class Settings$1 {
9406
+ let Settings$1 = class Settings {
9323
9407
  constructor(_options = {}) {
9324
9408
  this._options = _options;
9325
9409
  this.followSymbolicLinks = this._getValue(this._options.followSymbolicLinks, false);
@@ -9336,7 +9420,7 @@ class Settings$1 {
9336
9420
  _getValue(option, value) {
9337
9421
  return option !== null && option !== void 0 ? option : value;
9338
9422
  }
9339
- }
9423
+ };
9340
9424
  settings$2.default = Settings$1;
9341
9425
 
9342
9426
  Object.defineProperty(out$2, "__esModule", { value: true });
@@ -9665,6 +9749,12 @@ function queueAsPromised (context, worker, concurrency) {
9665
9749
  }
9666
9750
 
9667
9751
  function drained () {
9752
+ if (queue.idle()) {
9753
+ return new Promise(function (resolve) {
9754
+ resolve();
9755
+ })
9756
+ }
9757
+
9668
9758
  var previousDrain = queue.drain;
9669
9759
 
9670
9760
  var p = new Promise(function (resolve) {
@@ -9720,17 +9810,17 @@ var reader$1 = {};
9720
9810
 
9721
9811
  Object.defineProperty(reader$1, "__esModule", { value: true });
9722
9812
  const common$2 = common$3;
9723
- class Reader$1 {
9813
+ let Reader$1 = class Reader {
9724
9814
  constructor(_root, _settings) {
9725
9815
  this._root = _root;
9726
9816
  this._settings = _settings;
9727
9817
  this._root = common$2.replacePathSegmentSeparator(_root, _settings.pathSegmentSeparator);
9728
9818
  }
9729
- }
9819
+ };
9730
9820
  reader$1.default = Reader$1;
9731
9821
 
9732
9822
  Object.defineProperty(async$4, "__esModule", { value: true });
9733
- const events_1 = require$$0__default$4["default"];
9823
+ const events_1 = require$$0$5;
9734
9824
  const fsScandir$2 = out$2;
9735
9825
  const fastq = queueExports;
9736
9826
  const common$1 = common$3;
@@ -9859,7 +9949,7 @@ function callSuccessCallback(callback, entries) {
9859
9949
  var stream$2 = {};
9860
9950
 
9861
9951
  Object.defineProperty(stream$2, "__esModule", { value: true });
9862
- const stream_1$5 = require$$0__default["default"];
9952
+ const stream_1$5 = require$$0;
9863
9953
  const async_1$3 = async$4;
9864
9954
  class StreamProvider {
9865
9955
  constructor(_root, _settings) {
@@ -9972,7 +10062,7 @@ sync$3.default = SyncProvider;
9972
10062
  var settings$1 = {};
9973
10063
 
9974
10064
  Object.defineProperty(settings$1, "__esModule", { value: true });
9975
- const path$2 = require$$0__default$2["default"];
10065
+ const path$2 = require$$0$2;
9976
10066
  const fsScandir = out$2;
9977
10067
  class Settings {
9978
10068
  constructor(_options = {}) {
@@ -10033,129 +10123,129 @@ function getSettings(settingsOrOptions = {}) {
10033
10123
 
10034
10124
  var reader = {};
10035
10125
 
10036
- Object.defineProperty(reader, "__esModule", { value: true });
10037
- const path$1 = require$$0__default$2["default"];
10038
- const fsStat$2 = out$1;
10039
- const utils$6 = utils$k;
10040
- class Reader {
10041
- constructor(_settings) {
10042
- this._settings = _settings;
10043
- this._fsStatSettings = new fsStat$2.Settings({
10044
- followSymbolicLink: this._settings.followSymbolicLinks,
10045
- fs: this._settings.fs,
10046
- throwErrorOnBrokenSymbolicLink: this._settings.followSymbolicLinks
10047
- });
10048
- }
10049
- _getFullEntryPath(filepath) {
10050
- return path$1.resolve(this._settings.cwd, filepath);
10051
- }
10052
- _makeEntry(stats, pattern) {
10053
- const entry = {
10054
- name: pattern,
10055
- path: pattern,
10056
- dirent: utils$6.fs.createDirentFromStats(pattern, stats)
10057
- };
10058
- if (this._settings.stats) {
10059
- entry.stats = stats;
10060
- }
10061
- return entry;
10062
- }
10063
- _isFatalError(error) {
10064
- return !utils$6.errno.isEnoentCodeError(error) && !this._settings.suppressErrors;
10065
- }
10066
- }
10126
+ Object.defineProperty(reader, "__esModule", { value: true });
10127
+ const path$1 = require$$0$2;
10128
+ const fsStat$2 = out$1;
10129
+ const utils$6 = utils$k;
10130
+ class Reader {
10131
+ constructor(_settings) {
10132
+ this._settings = _settings;
10133
+ this._fsStatSettings = new fsStat$2.Settings({
10134
+ followSymbolicLink: this._settings.followSymbolicLinks,
10135
+ fs: this._settings.fs,
10136
+ throwErrorOnBrokenSymbolicLink: this._settings.followSymbolicLinks
10137
+ });
10138
+ }
10139
+ _getFullEntryPath(filepath) {
10140
+ return path$1.resolve(this._settings.cwd, filepath);
10141
+ }
10142
+ _makeEntry(stats, pattern) {
10143
+ const entry = {
10144
+ name: pattern,
10145
+ path: pattern,
10146
+ dirent: utils$6.fs.createDirentFromStats(pattern, stats)
10147
+ };
10148
+ if (this._settings.stats) {
10149
+ entry.stats = stats;
10150
+ }
10151
+ return entry;
10152
+ }
10153
+ _isFatalError(error) {
10154
+ return !utils$6.errno.isEnoentCodeError(error) && !this._settings.suppressErrors;
10155
+ }
10156
+ }
10067
10157
  reader.default = Reader;
10068
10158
 
10069
10159
  var stream$1 = {};
10070
10160
 
10071
- Object.defineProperty(stream$1, "__esModule", { value: true });
10072
- const stream_1$3 = require$$0__default["default"];
10073
- const fsStat$1 = out$1;
10074
- const fsWalk$2 = out$3;
10075
- const reader_1$2 = reader;
10076
- class ReaderStream extends reader_1$2.default {
10077
- constructor() {
10078
- super(...arguments);
10079
- this._walkStream = fsWalk$2.walkStream;
10080
- this._stat = fsStat$1.stat;
10081
- }
10082
- dynamic(root, options) {
10083
- return this._walkStream(root, options);
10084
- }
10085
- static(patterns, options) {
10086
- const filepaths = patterns.map(this._getFullEntryPath, this);
10087
- const stream = new stream_1$3.PassThrough({ objectMode: true });
10088
- stream._write = (index, _enc, done) => {
10089
- return this._getEntry(filepaths[index], patterns[index], options)
10090
- .then((entry) => {
10091
- if (entry !== null && options.entryFilter(entry)) {
10092
- stream.push(entry);
10093
- }
10094
- if (index === filepaths.length - 1) {
10095
- stream.end();
10096
- }
10097
- done();
10098
- })
10099
- .catch(done);
10100
- };
10101
- for (let i = 0; i < filepaths.length; i++) {
10102
- stream.write(i);
10103
- }
10104
- return stream;
10105
- }
10106
- _getEntry(filepath, pattern, options) {
10107
- return this._getStat(filepath)
10108
- .then((stats) => this._makeEntry(stats, pattern))
10109
- .catch((error) => {
10110
- if (options.errorFilter(error)) {
10111
- return null;
10112
- }
10113
- throw error;
10114
- });
10115
- }
10116
- _getStat(filepath) {
10117
- return new Promise((resolve, reject) => {
10118
- this._stat(filepath, this._fsStatSettings, (error, stats) => {
10119
- return error === null ? resolve(stats) : reject(error);
10120
- });
10121
- });
10122
- }
10123
- }
10161
+ Object.defineProperty(stream$1, "__esModule", { value: true });
10162
+ const stream_1$3 = require$$0;
10163
+ const fsStat$1 = out$1;
10164
+ const fsWalk$2 = out$3;
10165
+ const reader_1$2 = reader;
10166
+ class ReaderStream extends reader_1$2.default {
10167
+ constructor() {
10168
+ super(...arguments);
10169
+ this._walkStream = fsWalk$2.walkStream;
10170
+ this._stat = fsStat$1.stat;
10171
+ }
10172
+ dynamic(root, options) {
10173
+ return this._walkStream(root, options);
10174
+ }
10175
+ static(patterns, options) {
10176
+ const filepaths = patterns.map(this._getFullEntryPath, this);
10177
+ const stream = new stream_1$3.PassThrough({ objectMode: true });
10178
+ stream._write = (index, _enc, done) => {
10179
+ return this._getEntry(filepaths[index], patterns[index], options)
10180
+ .then((entry) => {
10181
+ if (entry !== null && options.entryFilter(entry)) {
10182
+ stream.push(entry);
10183
+ }
10184
+ if (index === filepaths.length - 1) {
10185
+ stream.end();
10186
+ }
10187
+ done();
10188
+ })
10189
+ .catch(done);
10190
+ };
10191
+ for (let i = 0; i < filepaths.length; i++) {
10192
+ stream.write(i);
10193
+ }
10194
+ return stream;
10195
+ }
10196
+ _getEntry(filepath, pattern, options) {
10197
+ return this._getStat(filepath)
10198
+ .then((stats) => this._makeEntry(stats, pattern))
10199
+ .catch((error) => {
10200
+ if (options.errorFilter(error)) {
10201
+ return null;
10202
+ }
10203
+ throw error;
10204
+ });
10205
+ }
10206
+ _getStat(filepath) {
10207
+ return new Promise((resolve, reject) => {
10208
+ this._stat(filepath, this._fsStatSettings, (error, stats) => {
10209
+ return error === null ? resolve(stats) : reject(error);
10210
+ });
10211
+ });
10212
+ }
10213
+ }
10124
10214
  stream$1.default = ReaderStream;
10125
10215
 
10126
- Object.defineProperty(async$6, "__esModule", { value: true });
10127
- const fsWalk$1 = out$3;
10128
- const reader_1$1 = reader;
10129
- const stream_1$2 = stream$1;
10130
- class ReaderAsync extends reader_1$1.default {
10131
- constructor() {
10132
- super(...arguments);
10133
- this._walkAsync = fsWalk$1.walk;
10134
- this._readerStream = new stream_1$2.default(this._settings);
10135
- }
10136
- dynamic(root, options) {
10137
- return new Promise((resolve, reject) => {
10138
- this._walkAsync(root, options, (error, entries) => {
10139
- if (error === null) {
10140
- resolve(entries);
10141
- }
10142
- else {
10143
- reject(error);
10144
- }
10145
- });
10146
- });
10147
- }
10148
- async static(patterns, options) {
10149
- const entries = [];
10150
- const stream = this._readerStream.static(patterns, options);
10151
- // After #235, replace it with an asynchronous iterator.
10152
- return new Promise((resolve, reject) => {
10153
- stream.once('error', reject);
10154
- stream.on('data', (entry) => entries.push(entry));
10155
- stream.once('end', () => resolve(entries));
10156
- });
10157
- }
10158
- }
10216
+ Object.defineProperty(async$6, "__esModule", { value: true });
10217
+ const fsWalk$1 = out$3;
10218
+ const reader_1$1 = reader;
10219
+ const stream_1$2 = stream$1;
10220
+ class ReaderAsync extends reader_1$1.default {
10221
+ constructor() {
10222
+ super(...arguments);
10223
+ this._walkAsync = fsWalk$1.walk;
10224
+ this._readerStream = new stream_1$2.default(this._settings);
10225
+ }
10226
+ dynamic(root, options) {
10227
+ return new Promise((resolve, reject) => {
10228
+ this._walkAsync(root, options, (error, entries) => {
10229
+ if (error === null) {
10230
+ resolve(entries);
10231
+ }
10232
+ else {
10233
+ reject(error);
10234
+ }
10235
+ });
10236
+ });
10237
+ }
10238
+ async static(patterns, options) {
10239
+ const entries = [];
10240
+ const stream = this._readerStream.static(patterns, options);
10241
+ // After #235, replace it with an asynchronous iterator.
10242
+ return new Promise((resolve, reject) => {
10243
+ stream.once('error', reject);
10244
+ stream.on('data', (entry) => entries.push(entry));
10245
+ stream.once('end', () => resolve(entries));
10246
+ });
10247
+ }
10248
+ }
10159
10249
  async$6.default = ReaderAsync;
10160
10250
 
10161
10251
  var provider = {};
@@ -10166,595 +10256,637 @@ var partial = {};
10166
10256
 
10167
10257
  var matcher = {};
10168
10258
 
10169
- Object.defineProperty(matcher, "__esModule", { value: true });
10170
- const utils$5 = utils$k;
10171
- class Matcher {
10172
- constructor(_patterns, _settings, _micromatchOptions) {
10173
- this._patterns = _patterns;
10174
- this._settings = _settings;
10175
- this._micromatchOptions = _micromatchOptions;
10176
- this._storage = [];
10177
- this._fillStorage();
10178
- }
10179
- _fillStorage() {
10180
- /**
10181
- * The original pattern may include `{,*,**,a/*}`, which will lead to problems with matching (unresolved level).
10182
- * So, before expand patterns with brace expansion into separated patterns.
10183
- */
10184
- const patterns = utils$5.pattern.expandPatternsWithBraceExpansion(this._patterns);
10185
- for (const pattern of patterns) {
10186
- const segments = this._getPatternSegments(pattern);
10187
- const sections = this._splitSegmentsIntoSections(segments);
10188
- this._storage.push({
10189
- complete: sections.length <= 1,
10190
- pattern,
10191
- segments,
10192
- sections
10193
- });
10194
- }
10195
- }
10196
- _getPatternSegments(pattern) {
10197
- const parts = utils$5.pattern.getPatternParts(pattern, this._micromatchOptions);
10198
- return parts.map((part) => {
10199
- const dynamic = utils$5.pattern.isDynamicPattern(part, this._settings);
10200
- if (!dynamic) {
10201
- return {
10202
- dynamic: false,
10203
- pattern: part
10204
- };
10205
- }
10206
- return {
10207
- dynamic: true,
10208
- pattern: part,
10209
- patternRe: utils$5.pattern.makeRe(part, this._micromatchOptions)
10210
- };
10211
- });
10212
- }
10213
- _splitSegmentsIntoSections(segments) {
10214
- return utils$5.array.splitWhen(segments, (segment) => segment.dynamic && utils$5.pattern.hasGlobStar(segment.pattern));
10215
- }
10216
- }
10259
+ Object.defineProperty(matcher, "__esModule", { value: true });
10260
+ const utils$5 = utils$k;
10261
+ class Matcher {
10262
+ constructor(_patterns, _settings, _micromatchOptions) {
10263
+ this._patterns = _patterns;
10264
+ this._settings = _settings;
10265
+ this._micromatchOptions = _micromatchOptions;
10266
+ this._storage = [];
10267
+ this._fillStorage();
10268
+ }
10269
+ _fillStorage() {
10270
+ for (const pattern of this._patterns) {
10271
+ const segments = this._getPatternSegments(pattern);
10272
+ const sections = this._splitSegmentsIntoSections(segments);
10273
+ this._storage.push({
10274
+ complete: sections.length <= 1,
10275
+ pattern,
10276
+ segments,
10277
+ sections
10278
+ });
10279
+ }
10280
+ }
10281
+ _getPatternSegments(pattern) {
10282
+ const parts = utils$5.pattern.getPatternParts(pattern, this._micromatchOptions);
10283
+ return parts.map((part) => {
10284
+ const dynamic = utils$5.pattern.isDynamicPattern(part, this._settings);
10285
+ if (!dynamic) {
10286
+ return {
10287
+ dynamic: false,
10288
+ pattern: part
10289
+ };
10290
+ }
10291
+ return {
10292
+ dynamic: true,
10293
+ pattern: part,
10294
+ patternRe: utils$5.pattern.makeRe(part, this._micromatchOptions)
10295
+ };
10296
+ });
10297
+ }
10298
+ _splitSegmentsIntoSections(segments) {
10299
+ return utils$5.array.splitWhen(segments, (segment) => segment.dynamic && utils$5.pattern.hasGlobStar(segment.pattern));
10300
+ }
10301
+ }
10217
10302
  matcher.default = Matcher;
10218
10303
 
10219
- Object.defineProperty(partial, "__esModule", { value: true });
10220
- const matcher_1 = matcher;
10221
- class PartialMatcher extends matcher_1.default {
10222
- match(filepath) {
10223
- const parts = filepath.split('/');
10224
- const levels = parts.length;
10225
- const patterns = this._storage.filter((info) => !info.complete || info.segments.length > levels);
10226
- for (const pattern of patterns) {
10227
- const section = pattern.sections[0];
10228
- /**
10229
- * In this case, the pattern has a globstar and we must read all directories unconditionally,
10230
- * but only if the level has reached the end of the first group.
10231
- *
10232
- * fixtures/{a,b}/**
10233
- * ^ true/false ^ always true
10234
- */
10235
- if (!pattern.complete && levels > section.length) {
10236
- return true;
10237
- }
10238
- const match = parts.every((part, index) => {
10239
- const segment = pattern.segments[index];
10240
- if (segment.dynamic && segment.patternRe.test(part)) {
10241
- return true;
10242
- }
10243
- if (!segment.dynamic && segment.pattern === part) {
10244
- return true;
10245
- }
10246
- return false;
10247
- });
10248
- if (match) {
10249
- return true;
10250
- }
10251
- }
10252
- return false;
10253
- }
10254
- }
10304
+ Object.defineProperty(partial, "__esModule", { value: true });
10305
+ const matcher_1 = matcher;
10306
+ class PartialMatcher extends matcher_1.default {
10307
+ match(filepath) {
10308
+ const parts = filepath.split('/');
10309
+ const levels = parts.length;
10310
+ const patterns = this._storage.filter((info) => !info.complete || info.segments.length > levels);
10311
+ for (const pattern of patterns) {
10312
+ const section = pattern.sections[0];
10313
+ /**
10314
+ * In this case, the pattern has a globstar and we must read all directories unconditionally,
10315
+ * but only if the level has reached the end of the first group.
10316
+ *
10317
+ * fixtures/{a,b}/**
10318
+ * ^ true/false ^ always true
10319
+ */
10320
+ if (!pattern.complete && levels > section.length) {
10321
+ return true;
10322
+ }
10323
+ const match = parts.every((part, index) => {
10324
+ const segment = pattern.segments[index];
10325
+ if (segment.dynamic && segment.patternRe.test(part)) {
10326
+ return true;
10327
+ }
10328
+ if (!segment.dynamic && segment.pattern === part) {
10329
+ return true;
10330
+ }
10331
+ return false;
10332
+ });
10333
+ if (match) {
10334
+ return true;
10335
+ }
10336
+ }
10337
+ return false;
10338
+ }
10339
+ }
10255
10340
  partial.default = PartialMatcher;
10256
10341
 
10257
- Object.defineProperty(deep, "__esModule", { value: true });
10258
- const utils$4 = utils$k;
10259
- const partial_1 = partial;
10260
- class DeepFilter {
10261
- constructor(_settings, _micromatchOptions) {
10262
- this._settings = _settings;
10263
- this._micromatchOptions = _micromatchOptions;
10264
- }
10265
- getFilter(basePath, positive, negative) {
10266
- const matcher = this._getMatcher(positive);
10267
- const negativeRe = this._getNegativePatternsRe(negative);
10268
- return (entry) => this._filter(basePath, entry, matcher, negativeRe);
10269
- }
10270
- _getMatcher(patterns) {
10271
- return new partial_1.default(patterns, this._settings, this._micromatchOptions);
10272
- }
10273
- _getNegativePatternsRe(patterns) {
10274
- const affectDepthOfReadingPatterns = patterns.filter(utils$4.pattern.isAffectDepthOfReadingPattern);
10275
- return utils$4.pattern.convertPatternsToRe(affectDepthOfReadingPatterns, this._micromatchOptions);
10276
- }
10277
- _filter(basePath, entry, matcher, negativeRe) {
10278
- if (this._isSkippedByDeep(basePath, entry.path)) {
10279
- return false;
10280
- }
10281
- if (this._isSkippedSymbolicLink(entry)) {
10282
- return false;
10283
- }
10284
- const filepath = utils$4.path.removeLeadingDotSegment(entry.path);
10285
- if (this._isSkippedByPositivePatterns(filepath, matcher)) {
10286
- return false;
10287
- }
10288
- return this._isSkippedByNegativePatterns(filepath, negativeRe);
10289
- }
10290
- _isSkippedByDeep(basePath, entryPath) {
10291
- /**
10292
- * Avoid unnecessary depth calculations when it doesn't matter.
10293
- */
10294
- if (this._settings.deep === Infinity) {
10295
- return false;
10296
- }
10297
- return this._getEntryLevel(basePath, entryPath) >= this._settings.deep;
10298
- }
10299
- _getEntryLevel(basePath, entryPath) {
10300
- const entryPathDepth = entryPath.split('/').length;
10301
- if (basePath === '') {
10302
- return entryPathDepth;
10303
- }
10304
- const basePathDepth = basePath.split('/').length;
10305
- return entryPathDepth - basePathDepth;
10306
- }
10307
- _isSkippedSymbolicLink(entry) {
10308
- return !this._settings.followSymbolicLinks && entry.dirent.isSymbolicLink();
10309
- }
10310
- _isSkippedByPositivePatterns(entryPath, matcher) {
10311
- return !this._settings.baseNameMatch && !matcher.match(entryPath);
10312
- }
10313
- _isSkippedByNegativePatterns(entryPath, patternsRe) {
10314
- return !utils$4.pattern.matchAny(entryPath, patternsRe);
10315
- }
10316
- }
10342
+ Object.defineProperty(deep, "__esModule", { value: true });
10343
+ const utils$4 = utils$k;
10344
+ const partial_1 = partial;
10345
+ class DeepFilter {
10346
+ constructor(_settings, _micromatchOptions) {
10347
+ this._settings = _settings;
10348
+ this._micromatchOptions = _micromatchOptions;
10349
+ }
10350
+ getFilter(basePath, positive, negative) {
10351
+ const matcher = this._getMatcher(positive);
10352
+ const negativeRe = this._getNegativePatternsRe(negative);
10353
+ return (entry) => this._filter(basePath, entry, matcher, negativeRe);
10354
+ }
10355
+ _getMatcher(patterns) {
10356
+ return new partial_1.default(patterns, this._settings, this._micromatchOptions);
10357
+ }
10358
+ _getNegativePatternsRe(patterns) {
10359
+ const affectDepthOfReadingPatterns = patterns.filter(utils$4.pattern.isAffectDepthOfReadingPattern);
10360
+ return utils$4.pattern.convertPatternsToRe(affectDepthOfReadingPatterns, this._micromatchOptions);
10361
+ }
10362
+ _filter(basePath, entry, matcher, negativeRe) {
10363
+ if (this._isSkippedByDeep(basePath, entry.path)) {
10364
+ return false;
10365
+ }
10366
+ if (this._isSkippedSymbolicLink(entry)) {
10367
+ return false;
10368
+ }
10369
+ const filepath = utils$4.path.removeLeadingDotSegment(entry.path);
10370
+ if (this._isSkippedByPositivePatterns(filepath, matcher)) {
10371
+ return false;
10372
+ }
10373
+ return this._isSkippedByNegativePatterns(filepath, negativeRe);
10374
+ }
10375
+ _isSkippedByDeep(basePath, entryPath) {
10376
+ /**
10377
+ * Avoid unnecessary depth calculations when it doesn't matter.
10378
+ */
10379
+ if (this._settings.deep === Infinity) {
10380
+ return false;
10381
+ }
10382
+ return this._getEntryLevel(basePath, entryPath) >= this._settings.deep;
10383
+ }
10384
+ _getEntryLevel(basePath, entryPath) {
10385
+ const entryPathDepth = entryPath.split('/').length;
10386
+ if (basePath === '') {
10387
+ return entryPathDepth;
10388
+ }
10389
+ const basePathDepth = basePath.split('/').length;
10390
+ return entryPathDepth - basePathDepth;
10391
+ }
10392
+ _isSkippedSymbolicLink(entry) {
10393
+ return !this._settings.followSymbolicLinks && entry.dirent.isSymbolicLink();
10394
+ }
10395
+ _isSkippedByPositivePatterns(entryPath, matcher) {
10396
+ return !this._settings.baseNameMatch && !matcher.match(entryPath);
10397
+ }
10398
+ _isSkippedByNegativePatterns(entryPath, patternsRe) {
10399
+ return !utils$4.pattern.matchAny(entryPath, patternsRe);
10400
+ }
10401
+ }
10317
10402
  deep.default = DeepFilter;
10318
10403
 
10319
10404
  var entry$1 = {};
10320
10405
 
10321
- Object.defineProperty(entry$1, "__esModule", { value: true });
10322
- const utils$3 = utils$k;
10323
- class EntryFilter {
10324
- constructor(_settings, _micromatchOptions) {
10325
- this._settings = _settings;
10326
- this._micromatchOptions = _micromatchOptions;
10327
- this.index = new Map();
10328
- }
10329
- getFilter(positive, negative) {
10330
- const positiveRe = utils$3.pattern.convertPatternsToRe(positive, this._micromatchOptions);
10331
- const negativeRe = utils$3.pattern.convertPatternsToRe(negative, this._micromatchOptions);
10332
- return (entry) => this._filter(entry, positiveRe, negativeRe);
10333
- }
10334
- _filter(entry, positiveRe, negativeRe) {
10335
- if (this._settings.unique && this._isDuplicateEntry(entry)) {
10336
- return false;
10337
- }
10338
- if (this._onlyFileFilter(entry) || this._onlyDirectoryFilter(entry)) {
10339
- return false;
10340
- }
10341
- if (this._isSkippedByAbsoluteNegativePatterns(entry.path, negativeRe)) {
10342
- return false;
10343
- }
10344
- const filepath = this._settings.baseNameMatch ? entry.name : entry.path;
10345
- const isDirectory = entry.dirent.isDirectory();
10346
- const isMatched = this._isMatchToPatterns(filepath, positiveRe, isDirectory) && !this._isMatchToPatterns(entry.path, negativeRe, isDirectory);
10347
- if (this._settings.unique && isMatched) {
10348
- this._createIndexRecord(entry);
10349
- }
10350
- return isMatched;
10351
- }
10352
- _isDuplicateEntry(entry) {
10353
- return this.index.has(entry.path);
10354
- }
10355
- _createIndexRecord(entry) {
10356
- this.index.set(entry.path, undefined);
10357
- }
10358
- _onlyFileFilter(entry) {
10359
- return this._settings.onlyFiles && !entry.dirent.isFile();
10360
- }
10361
- _onlyDirectoryFilter(entry) {
10362
- return this._settings.onlyDirectories && !entry.dirent.isDirectory();
10363
- }
10364
- _isSkippedByAbsoluteNegativePatterns(entryPath, patternsRe) {
10365
- if (!this._settings.absolute) {
10366
- return false;
10367
- }
10368
- const fullpath = utils$3.path.makeAbsolute(this._settings.cwd, entryPath);
10369
- return utils$3.pattern.matchAny(fullpath, patternsRe);
10370
- }
10371
- _isMatchToPatterns(entryPath, patternsRe, isDirectory) {
10372
- const filepath = utils$3.path.removeLeadingDotSegment(entryPath);
10373
- // Trying to match files and directories by patterns.
10374
- const isMatched = utils$3.pattern.matchAny(filepath, patternsRe);
10375
- // A pattern with a trailling slash can be used for directory matching.
10376
- // To apply such pattern, we need to add a tralling slash to the path.
10377
- if (!isMatched && isDirectory) {
10378
- return utils$3.pattern.matchAny(filepath + '/', patternsRe);
10379
- }
10380
- return isMatched;
10381
- }
10382
- }
10406
+ Object.defineProperty(entry$1, "__esModule", { value: true });
10407
+ const utils$3 = utils$k;
10408
+ class EntryFilter {
10409
+ constructor(_settings, _micromatchOptions) {
10410
+ this._settings = _settings;
10411
+ this._micromatchOptions = _micromatchOptions;
10412
+ this.index = new Map();
10413
+ }
10414
+ getFilter(positive, negative) {
10415
+ const positiveRe = utils$3.pattern.convertPatternsToRe(positive, this._micromatchOptions);
10416
+ const negativeRe = utils$3.pattern.convertPatternsToRe(negative, Object.assign(Object.assign({}, this._micromatchOptions), { dot: true }));
10417
+ return (entry) => this._filter(entry, positiveRe, negativeRe);
10418
+ }
10419
+ _filter(entry, positiveRe, negativeRe) {
10420
+ const filepath = utils$3.path.removeLeadingDotSegment(entry.path);
10421
+ if (this._settings.unique && this._isDuplicateEntry(filepath)) {
10422
+ return false;
10423
+ }
10424
+ if (this._onlyFileFilter(entry) || this._onlyDirectoryFilter(entry)) {
10425
+ return false;
10426
+ }
10427
+ if (this._isSkippedByAbsoluteNegativePatterns(filepath, negativeRe)) {
10428
+ return false;
10429
+ }
10430
+ const isDirectory = entry.dirent.isDirectory();
10431
+ const isMatched = this._isMatchToPatterns(filepath, positiveRe, isDirectory) && !this._isMatchToPatterns(filepath, negativeRe, isDirectory);
10432
+ if (this._settings.unique && isMatched) {
10433
+ this._createIndexRecord(filepath);
10434
+ }
10435
+ return isMatched;
10436
+ }
10437
+ _isDuplicateEntry(filepath) {
10438
+ return this.index.has(filepath);
10439
+ }
10440
+ _createIndexRecord(filepath) {
10441
+ this.index.set(filepath, undefined);
10442
+ }
10443
+ _onlyFileFilter(entry) {
10444
+ return this._settings.onlyFiles && !entry.dirent.isFile();
10445
+ }
10446
+ _onlyDirectoryFilter(entry) {
10447
+ return this._settings.onlyDirectories && !entry.dirent.isDirectory();
10448
+ }
10449
+ _isSkippedByAbsoluteNegativePatterns(entryPath, patternsRe) {
10450
+ if (!this._settings.absolute) {
10451
+ return false;
10452
+ }
10453
+ const fullpath = utils$3.path.makeAbsolute(this._settings.cwd, entryPath);
10454
+ return utils$3.pattern.matchAny(fullpath, patternsRe);
10455
+ }
10456
+ _isMatchToPatterns(filepath, patternsRe, isDirectory) {
10457
+ // Trying to match files and directories by patterns.
10458
+ const isMatched = utils$3.pattern.matchAny(filepath, patternsRe);
10459
+ // A pattern with a trailling slash can be used for directory matching.
10460
+ // To apply such pattern, we need to add a tralling slash to the path.
10461
+ if (!isMatched && isDirectory) {
10462
+ return utils$3.pattern.matchAny(filepath + '/', patternsRe);
10463
+ }
10464
+ return isMatched;
10465
+ }
10466
+ }
10383
10467
  entry$1.default = EntryFilter;
10384
10468
 
10385
10469
  var error = {};
10386
10470
 
10387
- Object.defineProperty(error, "__esModule", { value: true });
10388
- const utils$2 = utils$k;
10389
- class ErrorFilter {
10390
- constructor(_settings) {
10391
- this._settings = _settings;
10392
- }
10393
- getFilter() {
10394
- return (error) => this._isNonFatalError(error);
10395
- }
10396
- _isNonFatalError(error) {
10397
- return utils$2.errno.isEnoentCodeError(error) || this._settings.suppressErrors;
10398
- }
10399
- }
10471
+ Object.defineProperty(error, "__esModule", { value: true });
10472
+ const utils$2 = utils$k;
10473
+ class ErrorFilter {
10474
+ constructor(_settings) {
10475
+ this._settings = _settings;
10476
+ }
10477
+ getFilter() {
10478
+ return (error) => this._isNonFatalError(error);
10479
+ }
10480
+ _isNonFatalError(error) {
10481
+ return utils$2.errno.isEnoentCodeError(error) || this._settings.suppressErrors;
10482
+ }
10483
+ }
10400
10484
  error.default = ErrorFilter;
10401
10485
 
10402
10486
  var entry = {};
10403
10487
 
10404
- Object.defineProperty(entry, "__esModule", { value: true });
10405
- const utils$1 = utils$k;
10406
- class EntryTransformer {
10407
- constructor(_settings) {
10408
- this._settings = _settings;
10409
- }
10410
- getTransformer() {
10411
- return (entry) => this._transform(entry);
10412
- }
10413
- _transform(entry) {
10414
- let filepath = entry.path;
10415
- if (this._settings.absolute) {
10416
- filepath = utils$1.path.makeAbsolute(this._settings.cwd, filepath);
10417
- filepath = utils$1.path.unixify(filepath);
10418
- }
10419
- if (this._settings.markDirectories && entry.dirent.isDirectory()) {
10420
- filepath += '/';
10421
- }
10422
- if (!this._settings.objectMode) {
10423
- return filepath;
10424
- }
10425
- return Object.assign(Object.assign({}, entry), { path: filepath });
10426
- }
10427
- }
10488
+ Object.defineProperty(entry, "__esModule", { value: true });
10489
+ const utils$1 = utils$k;
10490
+ class EntryTransformer {
10491
+ constructor(_settings) {
10492
+ this._settings = _settings;
10493
+ }
10494
+ getTransformer() {
10495
+ return (entry) => this._transform(entry);
10496
+ }
10497
+ _transform(entry) {
10498
+ let filepath = entry.path;
10499
+ if (this._settings.absolute) {
10500
+ filepath = utils$1.path.makeAbsolute(this._settings.cwd, filepath);
10501
+ filepath = utils$1.path.unixify(filepath);
10502
+ }
10503
+ if (this._settings.markDirectories && entry.dirent.isDirectory()) {
10504
+ filepath += '/';
10505
+ }
10506
+ if (!this._settings.objectMode) {
10507
+ return filepath;
10508
+ }
10509
+ return Object.assign(Object.assign({}, entry), { path: filepath });
10510
+ }
10511
+ }
10428
10512
  entry.default = EntryTransformer;
10429
10513
 
10430
- Object.defineProperty(provider, "__esModule", { value: true });
10431
- const path = require$$0__default$2["default"];
10432
- const deep_1 = deep;
10433
- const entry_1 = entry$1;
10434
- const error_1 = error;
10435
- const entry_2 = entry;
10436
- class Provider {
10437
- constructor(_settings) {
10438
- this._settings = _settings;
10439
- this.errorFilter = new error_1.default(this._settings);
10440
- this.entryFilter = new entry_1.default(this._settings, this._getMicromatchOptions());
10441
- this.deepFilter = new deep_1.default(this._settings, this._getMicromatchOptions());
10442
- this.entryTransformer = new entry_2.default(this._settings);
10443
- }
10444
- _getRootDirectory(task) {
10445
- return path.resolve(this._settings.cwd, task.base);
10446
- }
10447
- _getReaderOptions(task) {
10448
- const basePath = task.base === '.' ? '' : task.base;
10449
- return {
10450
- basePath,
10451
- pathSegmentSeparator: '/',
10452
- concurrency: this._settings.concurrency,
10453
- deepFilter: this.deepFilter.getFilter(basePath, task.positive, task.negative),
10454
- entryFilter: this.entryFilter.getFilter(task.positive, task.negative),
10455
- errorFilter: this.errorFilter.getFilter(),
10456
- followSymbolicLinks: this._settings.followSymbolicLinks,
10457
- fs: this._settings.fs,
10458
- stats: this._settings.stats,
10459
- throwErrorOnBrokenSymbolicLink: this._settings.throwErrorOnBrokenSymbolicLink,
10460
- transform: this.entryTransformer.getTransformer()
10461
- };
10462
- }
10463
- _getMicromatchOptions() {
10464
- return {
10465
- dot: this._settings.dot,
10466
- matchBase: this._settings.baseNameMatch,
10467
- nobrace: !this._settings.braceExpansion,
10468
- nocase: !this._settings.caseSensitiveMatch,
10469
- noext: !this._settings.extglob,
10470
- noglobstar: !this._settings.globstar,
10471
- posix: true,
10472
- strictSlashes: false
10473
- };
10474
- }
10475
- }
10514
+ Object.defineProperty(provider, "__esModule", { value: true });
10515
+ const path = require$$0$2;
10516
+ const deep_1 = deep;
10517
+ const entry_1 = entry$1;
10518
+ const error_1 = error;
10519
+ const entry_2 = entry;
10520
+ class Provider {
10521
+ constructor(_settings) {
10522
+ this._settings = _settings;
10523
+ this.errorFilter = new error_1.default(this._settings);
10524
+ this.entryFilter = new entry_1.default(this._settings, this._getMicromatchOptions());
10525
+ this.deepFilter = new deep_1.default(this._settings, this._getMicromatchOptions());
10526
+ this.entryTransformer = new entry_2.default(this._settings);
10527
+ }
10528
+ _getRootDirectory(task) {
10529
+ return path.resolve(this._settings.cwd, task.base);
10530
+ }
10531
+ _getReaderOptions(task) {
10532
+ const basePath = task.base === '.' ? '' : task.base;
10533
+ return {
10534
+ basePath,
10535
+ pathSegmentSeparator: '/',
10536
+ concurrency: this._settings.concurrency,
10537
+ deepFilter: this.deepFilter.getFilter(basePath, task.positive, task.negative),
10538
+ entryFilter: this.entryFilter.getFilter(task.positive, task.negative),
10539
+ errorFilter: this.errorFilter.getFilter(),
10540
+ followSymbolicLinks: this._settings.followSymbolicLinks,
10541
+ fs: this._settings.fs,
10542
+ stats: this._settings.stats,
10543
+ throwErrorOnBrokenSymbolicLink: this._settings.throwErrorOnBrokenSymbolicLink,
10544
+ transform: this.entryTransformer.getTransformer()
10545
+ };
10546
+ }
10547
+ _getMicromatchOptions() {
10548
+ return {
10549
+ dot: this._settings.dot,
10550
+ matchBase: this._settings.baseNameMatch,
10551
+ nobrace: !this._settings.braceExpansion,
10552
+ nocase: !this._settings.caseSensitiveMatch,
10553
+ noext: !this._settings.extglob,
10554
+ noglobstar: !this._settings.globstar,
10555
+ posix: true,
10556
+ strictSlashes: false
10557
+ };
10558
+ }
10559
+ }
10476
10560
  provider.default = Provider;
10477
10561
 
10478
- Object.defineProperty(async$7, "__esModule", { value: true });
10479
- const async_1$1 = async$6;
10480
- const provider_1$2 = provider;
10481
- class ProviderAsync extends provider_1$2.default {
10482
- constructor() {
10483
- super(...arguments);
10484
- this._reader = new async_1$1.default(this._settings);
10485
- }
10486
- async read(task) {
10487
- const root = this._getRootDirectory(task);
10488
- const options = this._getReaderOptions(task);
10489
- const entries = await this.api(root, task, options);
10490
- return entries.map((entry) => options.transform(entry));
10491
- }
10492
- api(root, task, options) {
10493
- if (task.dynamic) {
10494
- return this._reader.dynamic(root, options);
10495
- }
10496
- return this._reader.static(task.patterns, options);
10497
- }
10498
- }
10562
+ Object.defineProperty(async$7, "__esModule", { value: true });
10563
+ const async_1$1 = async$6;
10564
+ const provider_1$2 = provider;
10565
+ class ProviderAsync extends provider_1$2.default {
10566
+ constructor() {
10567
+ super(...arguments);
10568
+ this._reader = new async_1$1.default(this._settings);
10569
+ }
10570
+ async read(task) {
10571
+ const root = this._getRootDirectory(task);
10572
+ const options = this._getReaderOptions(task);
10573
+ const entries = await this.api(root, task, options);
10574
+ return entries.map((entry) => options.transform(entry));
10575
+ }
10576
+ api(root, task, options) {
10577
+ if (task.dynamic) {
10578
+ return this._reader.dynamic(root, options);
10579
+ }
10580
+ return this._reader.static(task.patterns, options);
10581
+ }
10582
+ }
10499
10583
  async$7.default = ProviderAsync;
10500
10584
 
10501
10585
  var stream = {};
10502
10586
 
10503
- Object.defineProperty(stream, "__esModule", { value: true });
10504
- const stream_1$1 = require$$0__default["default"];
10505
- const stream_2 = stream$1;
10506
- const provider_1$1 = provider;
10507
- class ProviderStream extends provider_1$1.default {
10508
- constructor() {
10509
- super(...arguments);
10510
- this._reader = new stream_2.default(this._settings);
10511
- }
10512
- read(task) {
10513
- const root = this._getRootDirectory(task);
10514
- const options = this._getReaderOptions(task);
10515
- const source = this.api(root, task, options);
10516
- const destination = new stream_1$1.Readable({ objectMode: true, read: () => { } });
10517
- source
10518
- .once('error', (error) => destination.emit('error', error))
10519
- .on('data', (entry) => destination.emit('data', options.transform(entry)))
10520
- .once('end', () => destination.emit('end'));
10521
- destination
10522
- .once('close', () => source.destroy());
10523
- return destination;
10524
- }
10525
- api(root, task, options) {
10526
- if (task.dynamic) {
10527
- return this._reader.dynamic(root, options);
10528
- }
10529
- return this._reader.static(task.patterns, options);
10530
- }
10531
- }
10587
+ Object.defineProperty(stream, "__esModule", { value: true });
10588
+ const stream_1$1 = require$$0;
10589
+ const stream_2 = stream$1;
10590
+ const provider_1$1 = provider;
10591
+ class ProviderStream extends provider_1$1.default {
10592
+ constructor() {
10593
+ super(...arguments);
10594
+ this._reader = new stream_2.default(this._settings);
10595
+ }
10596
+ read(task) {
10597
+ const root = this._getRootDirectory(task);
10598
+ const options = this._getReaderOptions(task);
10599
+ const source = this.api(root, task, options);
10600
+ const destination = new stream_1$1.Readable({ objectMode: true, read: () => { } });
10601
+ source
10602
+ .once('error', (error) => destination.emit('error', error))
10603
+ .on('data', (entry) => destination.emit('data', options.transform(entry)))
10604
+ .once('end', () => destination.emit('end'));
10605
+ destination
10606
+ .once('close', () => source.destroy());
10607
+ return destination;
10608
+ }
10609
+ api(root, task, options) {
10610
+ if (task.dynamic) {
10611
+ return this._reader.dynamic(root, options);
10612
+ }
10613
+ return this._reader.static(task.patterns, options);
10614
+ }
10615
+ }
10532
10616
  stream.default = ProviderStream;
10533
10617
 
10534
10618
  var sync$1 = {};
10535
10619
 
10536
10620
  var sync = {};
10537
10621
 
10538
- Object.defineProperty(sync, "__esModule", { value: true });
10539
- const fsStat = out$1;
10540
- const fsWalk = out$3;
10541
- const reader_1 = reader;
10542
- class ReaderSync extends reader_1.default {
10543
- constructor() {
10544
- super(...arguments);
10545
- this._walkSync = fsWalk.walkSync;
10546
- this._statSync = fsStat.statSync;
10547
- }
10548
- dynamic(root, options) {
10549
- return this._walkSync(root, options);
10550
- }
10551
- static(patterns, options) {
10552
- const entries = [];
10553
- for (const pattern of patterns) {
10554
- const filepath = this._getFullEntryPath(pattern);
10555
- const entry = this._getEntry(filepath, pattern, options);
10556
- if (entry === null || !options.entryFilter(entry)) {
10557
- continue;
10558
- }
10559
- entries.push(entry);
10560
- }
10561
- return entries;
10562
- }
10563
- _getEntry(filepath, pattern, options) {
10564
- try {
10565
- const stats = this._getStat(filepath);
10566
- return this._makeEntry(stats, pattern);
10567
- }
10568
- catch (error) {
10569
- if (options.errorFilter(error)) {
10570
- return null;
10571
- }
10572
- throw error;
10573
- }
10574
- }
10575
- _getStat(filepath) {
10576
- return this._statSync(filepath, this._fsStatSettings);
10577
- }
10578
- }
10622
+ Object.defineProperty(sync, "__esModule", { value: true });
10623
+ const fsStat = out$1;
10624
+ const fsWalk = out$3;
10625
+ const reader_1 = reader;
10626
+ class ReaderSync extends reader_1.default {
10627
+ constructor() {
10628
+ super(...arguments);
10629
+ this._walkSync = fsWalk.walkSync;
10630
+ this._statSync = fsStat.statSync;
10631
+ }
10632
+ dynamic(root, options) {
10633
+ return this._walkSync(root, options);
10634
+ }
10635
+ static(patterns, options) {
10636
+ const entries = [];
10637
+ for (const pattern of patterns) {
10638
+ const filepath = this._getFullEntryPath(pattern);
10639
+ const entry = this._getEntry(filepath, pattern, options);
10640
+ if (entry === null || !options.entryFilter(entry)) {
10641
+ continue;
10642
+ }
10643
+ entries.push(entry);
10644
+ }
10645
+ return entries;
10646
+ }
10647
+ _getEntry(filepath, pattern, options) {
10648
+ try {
10649
+ const stats = this._getStat(filepath);
10650
+ return this._makeEntry(stats, pattern);
10651
+ }
10652
+ catch (error) {
10653
+ if (options.errorFilter(error)) {
10654
+ return null;
10655
+ }
10656
+ throw error;
10657
+ }
10658
+ }
10659
+ _getStat(filepath) {
10660
+ return this._statSync(filepath, this._fsStatSettings);
10661
+ }
10662
+ }
10579
10663
  sync.default = ReaderSync;
10580
10664
 
10581
- Object.defineProperty(sync$1, "__esModule", { value: true });
10582
- const sync_1$1 = sync;
10583
- const provider_1 = provider;
10584
- class ProviderSync extends provider_1.default {
10585
- constructor() {
10586
- super(...arguments);
10587
- this._reader = new sync_1$1.default(this._settings);
10588
- }
10589
- read(task) {
10590
- const root = this._getRootDirectory(task);
10591
- const options = this._getReaderOptions(task);
10592
- const entries = this.api(root, task, options);
10593
- return entries.map(options.transform);
10594
- }
10595
- api(root, task, options) {
10596
- if (task.dynamic) {
10597
- return this._reader.dynamic(root, options);
10598
- }
10599
- return this._reader.static(task.patterns, options);
10600
- }
10601
- }
10665
+ Object.defineProperty(sync$1, "__esModule", { value: true });
10666
+ const sync_1$1 = sync;
10667
+ const provider_1 = provider;
10668
+ class ProviderSync extends provider_1.default {
10669
+ constructor() {
10670
+ super(...arguments);
10671
+ this._reader = new sync_1$1.default(this._settings);
10672
+ }
10673
+ read(task) {
10674
+ const root = this._getRootDirectory(task);
10675
+ const options = this._getReaderOptions(task);
10676
+ const entries = this.api(root, task, options);
10677
+ return entries.map(options.transform);
10678
+ }
10679
+ api(root, task, options) {
10680
+ if (task.dynamic) {
10681
+ return this._reader.dynamic(root, options);
10682
+ }
10683
+ return this._reader.static(task.patterns, options);
10684
+ }
10685
+ }
10602
10686
  sync$1.default = ProviderSync;
10603
10687
 
10604
10688
  var settings = {};
10605
10689
 
10606
10690
  (function (exports) {
10607
- Object.defineProperty(exports, "__esModule", { value: true });
10608
- exports.DEFAULT_FILE_SYSTEM_ADAPTER = void 0;
10609
- const fs = require$$0__default$1["default"];
10610
- const os = require$$2__default$1["default"];
10611
- /**
10612
- * The `os.cpus` method can return zero. We expect the number of cores to be greater than zero.
10613
- * https://github.com/nodejs/node/blob/7faeddf23a98c53896f8b574a6e66589e8fb1eb8/lib/os.js#L106-L107
10614
- */
10615
- const CPU_COUNT = Math.max(os.cpus().length, 1);
10616
- exports.DEFAULT_FILE_SYSTEM_ADAPTER = {
10617
- lstat: fs.lstat,
10618
- lstatSync: fs.lstatSync,
10619
- stat: fs.stat,
10620
- statSync: fs.statSync,
10621
- readdir: fs.readdir,
10622
- readdirSync: fs.readdirSync
10623
- };
10624
- class Settings {
10625
- constructor(_options = {}) {
10626
- this._options = _options;
10627
- this.absolute = this._getValue(this._options.absolute, false);
10628
- this.baseNameMatch = this._getValue(this._options.baseNameMatch, false);
10629
- this.braceExpansion = this._getValue(this._options.braceExpansion, true);
10630
- this.caseSensitiveMatch = this._getValue(this._options.caseSensitiveMatch, true);
10631
- this.concurrency = this._getValue(this._options.concurrency, CPU_COUNT);
10632
- this.cwd = this._getValue(this._options.cwd, process.cwd());
10633
- this.deep = this._getValue(this._options.deep, Infinity);
10634
- this.dot = this._getValue(this._options.dot, false);
10635
- this.extglob = this._getValue(this._options.extglob, true);
10636
- this.followSymbolicLinks = this._getValue(this._options.followSymbolicLinks, true);
10637
- this.fs = this._getFileSystemMethods(this._options.fs);
10638
- this.globstar = this._getValue(this._options.globstar, true);
10639
- this.ignore = this._getValue(this._options.ignore, []);
10640
- this.markDirectories = this._getValue(this._options.markDirectories, false);
10641
- this.objectMode = this._getValue(this._options.objectMode, false);
10642
- this.onlyDirectories = this._getValue(this._options.onlyDirectories, false);
10643
- this.onlyFiles = this._getValue(this._options.onlyFiles, true);
10644
- this.stats = this._getValue(this._options.stats, false);
10645
- this.suppressErrors = this._getValue(this._options.suppressErrors, false);
10646
- this.throwErrorOnBrokenSymbolicLink = this._getValue(this._options.throwErrorOnBrokenSymbolicLink, false);
10647
- this.unique = this._getValue(this._options.unique, true);
10648
- if (this.onlyDirectories) {
10649
- this.onlyFiles = false;
10650
- }
10651
- if (this.stats) {
10652
- this.objectMode = true;
10653
- }
10654
- }
10655
- _getValue(option, value) {
10656
- return option === undefined ? value : option;
10657
- }
10658
- _getFileSystemMethods(methods = {}) {
10659
- return Object.assign(Object.assign({}, exports.DEFAULT_FILE_SYSTEM_ADAPTER), methods);
10660
- }
10661
- }
10691
+ Object.defineProperty(exports, "__esModule", { value: true });
10692
+ exports.DEFAULT_FILE_SYSTEM_ADAPTER = void 0;
10693
+ const fs = require$$0$1;
10694
+ const os = require$$0$4;
10695
+ /**
10696
+ * The `os.cpus` method can return zero. We expect the number of cores to be greater than zero.
10697
+ * https://github.com/nodejs/node/blob/7faeddf23a98c53896f8b574a6e66589e8fb1eb8/lib/os.js#L106-L107
10698
+ */
10699
+ const CPU_COUNT = Math.max(os.cpus().length, 1);
10700
+ exports.DEFAULT_FILE_SYSTEM_ADAPTER = {
10701
+ lstat: fs.lstat,
10702
+ lstatSync: fs.lstatSync,
10703
+ stat: fs.stat,
10704
+ statSync: fs.statSync,
10705
+ readdir: fs.readdir,
10706
+ readdirSync: fs.readdirSync
10707
+ };
10708
+ class Settings {
10709
+ constructor(_options = {}) {
10710
+ this._options = _options;
10711
+ this.absolute = this._getValue(this._options.absolute, false);
10712
+ this.baseNameMatch = this._getValue(this._options.baseNameMatch, false);
10713
+ this.braceExpansion = this._getValue(this._options.braceExpansion, true);
10714
+ this.caseSensitiveMatch = this._getValue(this._options.caseSensitiveMatch, true);
10715
+ this.concurrency = this._getValue(this._options.concurrency, CPU_COUNT);
10716
+ this.cwd = this._getValue(this._options.cwd, process.cwd());
10717
+ this.deep = this._getValue(this._options.deep, Infinity);
10718
+ this.dot = this._getValue(this._options.dot, false);
10719
+ this.extglob = this._getValue(this._options.extglob, true);
10720
+ this.followSymbolicLinks = this._getValue(this._options.followSymbolicLinks, true);
10721
+ this.fs = this._getFileSystemMethods(this._options.fs);
10722
+ this.globstar = this._getValue(this._options.globstar, true);
10723
+ this.ignore = this._getValue(this._options.ignore, []);
10724
+ this.markDirectories = this._getValue(this._options.markDirectories, false);
10725
+ this.objectMode = this._getValue(this._options.objectMode, false);
10726
+ this.onlyDirectories = this._getValue(this._options.onlyDirectories, false);
10727
+ this.onlyFiles = this._getValue(this._options.onlyFiles, true);
10728
+ this.stats = this._getValue(this._options.stats, false);
10729
+ this.suppressErrors = this._getValue(this._options.suppressErrors, false);
10730
+ this.throwErrorOnBrokenSymbolicLink = this._getValue(this._options.throwErrorOnBrokenSymbolicLink, false);
10731
+ this.unique = this._getValue(this._options.unique, true);
10732
+ if (this.onlyDirectories) {
10733
+ this.onlyFiles = false;
10734
+ }
10735
+ if (this.stats) {
10736
+ this.objectMode = true;
10737
+ }
10738
+ // Remove the cast to the array in the next major (#404).
10739
+ this.ignore = [].concat(this.ignore);
10740
+ }
10741
+ _getValue(option, value) {
10742
+ return option === undefined ? value : option;
10743
+ }
10744
+ _getFileSystemMethods(methods = {}) {
10745
+ return Object.assign(Object.assign({}, exports.DEFAULT_FILE_SYSTEM_ADAPTER), methods);
10746
+ }
10747
+ }
10662
10748
  exports.default = Settings;
10663
10749
  } (settings));
10664
10750
 
10665
- const taskManager = tasks;
10666
- const patternManager = patterns;
10667
- const async_1 = async$7;
10668
- const stream_1 = stream;
10669
- const sync_1 = sync$1;
10670
- const settings_1 = settings;
10671
- const utils = utils$k;
10672
- async function FastGlob(source, options) {
10673
- assertPatternsInput(source);
10674
- const works = getWorks(source, async_1.default, options);
10675
- const result = await Promise.all(works);
10676
- return utils.array.flatten(result);
10677
- }
10678
- // https://github.com/typescript-eslint/typescript-eslint/issues/60
10679
- // eslint-disable-next-line no-redeclare
10680
- (function (FastGlob) {
10681
- function sync(source, options) {
10682
- assertPatternsInput(source);
10683
- const works = getWorks(source, sync_1.default, options);
10684
- return utils.array.flatten(works);
10685
- }
10686
- FastGlob.sync = sync;
10687
- function stream(source, options) {
10688
- assertPatternsInput(source);
10689
- const works = getWorks(source, stream_1.default, options);
10690
- /**
10691
- * The stream returned by the provider cannot work with an asynchronous iterator.
10692
- * To support asynchronous iterators, regardless of the number of tasks, we always multiplex streams.
10693
- * This affects performance (+25%). I don't see best solution right now.
10694
- */
10695
- return utils.stream.merge(works);
10696
- }
10697
- FastGlob.stream = stream;
10698
- function generateTasks(source, options) {
10699
- assertPatternsInput(source);
10700
- const patterns = patternManager.transform([].concat(source));
10701
- const settings = new settings_1.default(options);
10702
- return taskManager.generate(patterns, settings);
10703
- }
10704
- FastGlob.generateTasks = generateTasks;
10705
- function isDynamicPattern(source, options) {
10706
- assertPatternsInput(source);
10707
- const settings = new settings_1.default(options);
10708
- return utils.pattern.isDynamicPattern(source, settings);
10709
- }
10710
- FastGlob.isDynamicPattern = isDynamicPattern;
10711
- function escapePath(source) {
10712
- assertPatternsInput(source);
10713
- return utils.path.escape(source);
10714
- }
10715
- FastGlob.escapePath = escapePath;
10716
- })(FastGlob || (FastGlob = {}));
10717
- function getWorks(source, _Provider, options) {
10718
- const patterns = patternManager.transform([].concat(source));
10719
- const settings = new settings_1.default(options);
10720
- const tasks = taskManager.generate(patterns, settings);
10721
- const provider = new _Provider(settings);
10722
- return tasks.map(provider.read, provider);
10723
- }
10724
- function assertPatternsInput(input) {
10725
- const source = [].concat(input);
10726
- const isValidSource = source.every((item) => utils.string.isString(item) && !utils.string.isEmpty(item));
10727
- if (!isValidSource) {
10728
- throw new TypeError('Patterns must be a string (non empty) or an array of strings');
10729
- }
10730
- }
10751
+ const taskManager = tasks;
10752
+ const async_1 = async$7;
10753
+ const stream_1 = stream;
10754
+ const sync_1 = sync$1;
10755
+ const settings_1 = settings;
10756
+ const utils = utils$k;
10757
+ async function FastGlob(source, options) {
10758
+ assertPatternsInput(source);
10759
+ const works = getWorks(source, async_1.default, options);
10760
+ const result = await Promise.all(works);
10761
+ return utils.array.flatten(result);
10762
+ }
10763
+ // https://github.com/typescript-eslint/typescript-eslint/issues/60
10764
+ // eslint-disable-next-line no-redeclare
10765
+ (function (FastGlob) {
10766
+ FastGlob.glob = FastGlob;
10767
+ FastGlob.globSync = sync;
10768
+ FastGlob.globStream = stream;
10769
+ FastGlob.async = FastGlob;
10770
+ function sync(source, options) {
10771
+ assertPatternsInput(source);
10772
+ const works = getWorks(source, sync_1.default, options);
10773
+ return utils.array.flatten(works);
10774
+ }
10775
+ FastGlob.sync = sync;
10776
+ function stream(source, options) {
10777
+ assertPatternsInput(source);
10778
+ const works = getWorks(source, stream_1.default, options);
10779
+ /**
10780
+ * The stream returned by the provider cannot work with an asynchronous iterator.
10781
+ * To support asynchronous iterators, regardless of the number of tasks, we always multiplex streams.
10782
+ * This affects performance (+25%). I don't see best solution right now.
10783
+ */
10784
+ return utils.stream.merge(works);
10785
+ }
10786
+ FastGlob.stream = stream;
10787
+ function generateTasks(source, options) {
10788
+ assertPatternsInput(source);
10789
+ const patterns = [].concat(source);
10790
+ const settings = new settings_1.default(options);
10791
+ return taskManager.generate(patterns, settings);
10792
+ }
10793
+ FastGlob.generateTasks = generateTasks;
10794
+ function isDynamicPattern(source, options) {
10795
+ assertPatternsInput(source);
10796
+ const settings = new settings_1.default(options);
10797
+ return utils.pattern.isDynamicPattern(source, settings);
10798
+ }
10799
+ FastGlob.isDynamicPattern = isDynamicPattern;
10800
+ function escapePath(source) {
10801
+ assertPatternsInput(source);
10802
+ return utils.path.escape(source);
10803
+ }
10804
+ FastGlob.escapePath = escapePath;
10805
+ function convertPathToPattern(source) {
10806
+ assertPatternsInput(source);
10807
+ return utils.path.convertPathToPattern(source);
10808
+ }
10809
+ FastGlob.convertPathToPattern = convertPathToPattern;
10810
+ (function (posix) {
10811
+ function escapePath(source) {
10812
+ assertPatternsInput(source);
10813
+ return utils.path.escapePosixPath(source);
10814
+ }
10815
+ posix.escapePath = escapePath;
10816
+ function convertPathToPattern(source) {
10817
+ assertPatternsInput(source);
10818
+ return utils.path.convertPosixPathToPattern(source);
10819
+ }
10820
+ posix.convertPathToPattern = convertPathToPattern;
10821
+ })(FastGlob.posix || (FastGlob.posix = {}));
10822
+ (function (win32) {
10823
+ function escapePath(source) {
10824
+ assertPatternsInput(source);
10825
+ return utils.path.escapeWindowsPath(source);
10826
+ }
10827
+ win32.escapePath = escapePath;
10828
+ function convertPathToPattern(source) {
10829
+ assertPatternsInput(source);
10830
+ return utils.path.convertWindowsPathToPattern(source);
10831
+ }
10832
+ win32.convertPathToPattern = convertPathToPattern;
10833
+ })(FastGlob.win32 || (FastGlob.win32 = {}));
10834
+ })(FastGlob || (FastGlob = {}));
10835
+ function getWorks(source, _Provider, options) {
10836
+ const patterns = [].concat(source);
10837
+ const settings = new settings_1.default(options);
10838
+ const tasks = taskManager.generate(patterns, settings);
10839
+ const provider = new _Provider(settings);
10840
+ return tasks.map(provider.read, provider);
10841
+ }
10842
+ function assertPatternsInput(input) {
10843
+ const source = [].concat(input);
10844
+ const isValidSource = source.every((item) => utils.string.isString(item) && !utils.string.isEmpty(item));
10845
+ if (!isValidSource) {
10846
+ throw new TypeError('Patterns must be a string (non empty) or an array of strings');
10847
+ }
10848
+ }
10731
10849
  var out = FastGlob;
10732
10850
 
10733
10851
  var fg = /*@__PURE__*/getDefaultExportFromCjs(out);
10734
10852
 
10853
+ const defaultOptions = {
10854
+ hostname: "http://localhost/",
10855
+ dynamicRoutes: [],
10856
+ exclude: [],
10857
+ externalSitemaps: [],
10858
+ basePath: "",
10859
+ outDir: "dist",
10860
+ extensions: "html",
10861
+ changefreq: "daily",
10862
+ priority: 1,
10863
+ lastmod: /* @__PURE__ */ new Date(),
10864
+ readable: false,
10865
+ generateRobotsTxt: true,
10866
+ robots: [{
10867
+ userAgent: "*",
10868
+ allow: "/"
10869
+ }]
10870
+ };
10735
10871
  function resolveOptions(userOptions) {
10736
10872
  return Object.assign(
10737
- {
10738
- hostname: "http://localhost/",
10739
- dynamicRoutes: [],
10740
- exclude: [],
10741
- basePath: "",
10742
- outDir: "dist",
10743
- extensions: "html",
10744
- changefreq: "daily",
10745
- priority: 1,
10746
- lastmod: /* @__PURE__ */ new Date(),
10747
- readable: false,
10748
- generateRobotsTxt: true,
10749
- robots: [{
10750
- userAgent: "*",
10751
- allow: "/"
10752
- }]
10753
- },
10873
+ {},
10874
+ defaultOptions,
10754
10875
  userOptions
10755
10876
  );
10756
10877
  }
10757
10878
 
10879
+ function getResolvedPath(file, resolvedOptions) {
10880
+ if (node_path.isAbsolute(resolvedOptions.outDir))
10881
+ return node_path.resolve(`${resolvedOptions.outDir}/${file}`);
10882
+ return node_path.resolve(`${ensurePrefix("./", resolvedOptions.outDir)}/${file}`);
10883
+ }
10884
+ function removeMaybeSuffix(suffix, str) {
10885
+ if (!str.endsWith(suffix))
10886
+ return str;
10887
+ return str.slice(0, -suffix.length);
10888
+ }
10889
+
10758
10890
  var RobotCorrespondences = /* @__PURE__ */ ((RobotCorrespondences2) => {
10759
10891
  RobotCorrespondences2["userAgent"] = "User-agent";
10760
10892
  RobotCorrespondences2["allow"] = "Allow";
@@ -10779,24 +10911,14 @@ function getRules(options) {
10779
10911
  });
10780
10912
  return rules;
10781
10913
  }
10782
- function getContent(rules, hostname) {
10914
+ function getContent(rules, hostname, externalSitemaps) {
10783
10915
  return rules.map((rule) => `${rule.key}: ${String(rule.value).trim()}`).join("\n").concat(`
10784
10916
 
10785
- Sitemap: ${getFinalSitemapPath(hostname)}`);
10786
- }
10787
- function getFinalSitemapPath(hostname) {
10788
- return `${ensureSuffix("/", hostname)}sitemap.xml`;
10789
- }
10790
-
10791
- function getResolvedPath(file, resolvedOptions) {
10792
- if (node_path.isAbsolute(resolvedOptions.outDir))
10793
- return node_path.resolve(`${resolvedOptions.outDir}/${file}`);
10794
- return node_path.resolve(`${ensurePrefix("./", resolvedOptions.outDir)}/${file}`);
10917
+ Sitemap: ${getFinalSitemapPath(hostname)}`).concat(externalSitemaps.map((s) => `
10918
+ Sitemap: ${s.startsWith("http") ? s : getFinalSitemapPath(hostname, s)}`).join(""));
10795
10919
  }
10796
- function removeMaybeSuffix(suffix, str) {
10797
- if (!str.endsWith(suffix))
10798
- return str;
10799
- return str.slice(0, -suffix.length);
10920
+ function getFinalSitemapPath(hostname, file = "/sitemap.xml") {
10921
+ return `${removeMaybeSuffix("/", hostname)}${ensurePrefix("/", file)}`;
10800
10922
  }
10801
10923
 
10802
10924
  function getRoutes(options) {
@@ -10815,12 +10937,22 @@ function getRoutes(options) {
10815
10937
  ...options.dynamicRoutes.map((route) => slash$1(node_path.join("/", node_path.join(node_path.parse(route).dir, node_path.parse(route).name))))
10816
10938
  ].filter((route) => !options.exclude.includes(route));
10817
10939
  }
10940
+ function getOptionByRoute(options, route) {
10941
+ if (options instanceof Date || typeof options === "string" || typeof options === "number")
10942
+ return options;
10943
+ const givenRoutes = Object.keys(options);
10944
+ if (givenRoutes.includes(route))
10945
+ return options[route];
10946
+ if (givenRoutes.includes("*"))
10947
+ return options["*"];
10948
+ return void 0;
10949
+ }
10818
10950
  function getFormattedSitemap(options, routes) {
10819
10951
  return routes.map((route) => ({
10820
10952
  url: new URL(options.basePath ? ensurePrefix("/", options.basePath) + ensurePrefix("/", route) : ensurePrefix("/", route), removeMaybeSuffix("/", options.hostname)).href,
10821
- changefreq: options.changefreq,
10822
- priority: options.priority,
10823
- lastmod: options.lastmod
10953
+ changefreq: getOptionByRoute(options.changefreq, route) ?? defaultOptions.changefreq,
10954
+ priority: getOptionByRoute(options.priority, route) ?? defaultOptions.priority,
10955
+ lastmod: getOptionByRoute(options.lastmod, route) ?? defaultOptions.lastmod
10824
10956
  }));
10825
10957
  }
10826
10958
 
@@ -10828,7 +10960,7 @@ function generateSitemap(options = {}) {
10828
10960
  const resolvedOptions = resolveOptions(options);
10829
10961
  if (resolvedOptions.generateRobotsTxt) {
10830
10962
  const robotRules = getRules(resolvedOptions.robots);
10831
- const robotContent = getContent(robotRules, resolvedOptions.hostname);
10963
+ const robotContent = getContent(robotRules, resolvedOptions.hostname, resolvedOptions.externalSitemaps);
10832
10964
  node_fs.writeFileSync(getResolvedPath("robots.txt", resolvedOptions), robotContent);
10833
10965
  }
10834
10966
  const routes = getRoutes(resolvedOptions);