vite-plugin-sitemap 0.4.2 → 0.5.1

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
  }
@@ -4138,92 +4166,127 @@ var utils$k = {};
4138
4166
 
4139
4167
  var array$1 = {};
4140
4168
 
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
- }
4169
+ Object.defineProperty(array$1, "__esModule", { value: true });
4170
+ array$1.splitWhen = array$1.flatten = void 0;
4171
+ function flatten(items) {
4172
+ return items.reduce((collection, item) => [].concat(collection, item), []);
4173
+ }
4174
+ array$1.flatten = flatten;
4175
+ function splitWhen(items, predicate) {
4176
+ const result = [[]];
4177
+ let groupIndex = 0;
4178
+ for (const item of items) {
4179
+ if (predicate(item)) {
4180
+ groupIndex++;
4181
+ result[groupIndex] = [];
4182
+ }
4183
+ else {
4184
+ result[groupIndex].push(item);
4185
+ }
4186
+ }
4187
+ return result;
4188
+ }
4161
4189
  array$1.splitWhen = splitWhen;
4162
4190
 
4163
4191
  var errno$1 = {};
4164
4192
 
4165
- Object.defineProperty(errno$1, "__esModule", { value: true });
4166
- errno$1.isEnoentCodeError = void 0;
4167
- function isEnoentCodeError(error) {
4168
- return error.code === 'ENOENT';
4169
- }
4193
+ Object.defineProperty(errno$1, "__esModule", { value: true });
4194
+ errno$1.isEnoentCodeError = void 0;
4195
+ function isEnoentCodeError(error) {
4196
+ return error.code === 'ENOENT';
4197
+ }
4170
4198
  errno$1.isEnoentCodeError = isEnoentCodeError;
4171
4199
 
4172
4200
  var fs$7 = {};
4173
4201
 
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
- }
4202
+ Object.defineProperty(fs$7, "__esModule", { value: true });
4203
+ fs$7.createDirentFromStats = void 0;
4204
+ let DirentFromStats$1 = class DirentFromStats {
4205
+ constructor(name, stats) {
4206
+ this.name = name;
4207
+ this.isBlockDevice = stats.isBlockDevice.bind(stats);
4208
+ this.isCharacterDevice = stats.isCharacterDevice.bind(stats);
4209
+ this.isDirectory = stats.isDirectory.bind(stats);
4210
+ this.isFIFO = stats.isFIFO.bind(stats);
4211
+ this.isFile = stats.isFile.bind(stats);
4212
+ this.isSocket = stats.isSocket.bind(stats);
4213
+ this.isSymbolicLink = stats.isSymbolicLink.bind(stats);
4214
+ }
4215
+ };
4216
+ function createDirentFromStats$1(name, stats) {
4217
+ return new DirentFromStats$1(name, stats);
4218
+ }
4191
4219
  fs$7.createDirentFromStats = createDirentFromStats$1;
4192
4220
 
4193
4221
  var path$9 = {};
4194
4222
 
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
- }
4223
+ Object.defineProperty(path$9, "__esModule", { value: true });
4224
+ 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;
4225
+ const os = require$$0$4;
4226
+ const path$8 = require$$0$2;
4227
+ const IS_WINDOWS_PLATFORM = os.platform() === 'win32';
4228
+ const LEADING_DOT_SEGMENT_CHARACTERS_COUNT = 2; // ./ or .\\
4229
+ /**
4230
+ * All non-escaped special characters.
4231
+ * Posix: ()*?[\]{|}, !+@ before (, ! at the beginning, \\ before non-special characters.
4232
+ * Windows: (){}, !+@ before (, ! at the beginning.
4233
+ */
4234
+ const POSIX_UNESCAPED_GLOB_SYMBOLS_RE = /(\\?)([()*?[\]{|}]|^!|[!+@](?=\()|\\(?![!()*+?@[\]{|}]))/g;
4235
+ const WINDOWS_UNESCAPED_GLOB_SYMBOLS_RE = /(\\?)([(){}]|^!|[!+@](?=\())/g;
4236
+ /**
4237
+ * The device path (\\.\ or \\?\).
4238
+ * https://learn.microsoft.com/en-us/dotnet/standard/io/file-path-formats#dos-device-paths
4239
+ */
4240
+ const DOS_DEVICE_PATH_RE = /^\\\\([.?])/;
4241
+ /**
4242
+ * All backslashes except those escaping special characters.
4243
+ * Windows: !()+@{}
4244
+ * https://learn.microsoft.com/en-us/windows/win32/fileio/naming-a-file#naming-conventions
4245
+ */
4246
+ const WINDOWS_BACKSLASHES_RE = /\\(?![!()+@{}])/g;
4247
+ /**
4248
+ * Designed to work only with simple paths: `dir\\file`.
4249
+ */
4250
+ function unixify(filepath) {
4251
+ return filepath.replace(/\\/g, '/');
4252
+ }
4253
+ path$9.unixify = unixify;
4254
+ function makeAbsolute(cwd, filepath) {
4255
+ return path$8.resolve(cwd, filepath);
4256
+ }
4257
+ path$9.makeAbsolute = makeAbsolute;
4258
+ function removeLeadingDotSegment(entry) {
4259
+ // We do not use `startsWith` because this is 10x slower than current implementation for some cases.
4260
+ // eslint-disable-next-line @typescript-eslint/prefer-string-starts-ends-with
4261
+ if (entry.charAt(0) === '.') {
4262
+ const secondCharactery = entry.charAt(1);
4263
+ if (secondCharactery === '/' || secondCharactery === '\\') {
4264
+ return entry.slice(LEADING_DOT_SEGMENT_CHARACTERS_COUNT);
4265
+ }
4266
+ }
4267
+ return entry;
4268
+ }
4226
4269
  path$9.removeLeadingDotSegment = removeLeadingDotSegment;
4270
+ path$9.escape = IS_WINDOWS_PLATFORM ? escapeWindowsPath : escapePosixPath;
4271
+ function escapeWindowsPath(pattern) {
4272
+ return pattern.replace(WINDOWS_UNESCAPED_GLOB_SYMBOLS_RE, '\\$2');
4273
+ }
4274
+ path$9.escapeWindowsPath = escapeWindowsPath;
4275
+ function escapePosixPath(pattern) {
4276
+ return pattern.replace(POSIX_UNESCAPED_GLOB_SYMBOLS_RE, '\\$2');
4277
+ }
4278
+ path$9.escapePosixPath = escapePosixPath;
4279
+ path$9.convertPathToPattern = IS_WINDOWS_PLATFORM ? convertWindowsPathToPattern : convertPosixPathToPattern;
4280
+ function convertWindowsPathToPattern(filepath) {
4281
+ return escapeWindowsPath(filepath)
4282
+ .replace(DOS_DEVICE_PATH_RE, '//$1')
4283
+ .replace(WINDOWS_BACKSLASHES_RE, '/');
4284
+ }
4285
+ path$9.convertWindowsPathToPattern = convertWindowsPathToPattern;
4286
+ function convertPosixPathToPattern(filepath) {
4287
+ return escapePosixPath(filepath);
4288
+ }
4289
+ path$9.convertPosixPathToPattern = convertPosixPathToPattern;
4227
4290
 
4228
4291
  var pattern$1 = {};
4229
4292
 
@@ -4400,8 +4463,8 @@ var isGlob$1 = function isGlob(str, options) {
4400
4463
  };
4401
4464
 
4402
4465
  var isGlob = isGlob$1;
4403
- var pathPosixDirname = require$$0__default$2["default"].posix.dirname;
4404
- var isWin32 = require$$2__default$1["default"].platform() === 'win32';
4466
+ var pathPosixDirname = require$$0$2.posix.dirname;
4467
+ var isWin32 = require$$0$4.platform() === 'win32';
4405
4468
 
4406
4469
  var slash = '/';
4407
4470
  var backslash = /\\/g;
@@ -4897,12 +4960,12 @@ var toRegexRange_1 = toRegexRange$1;
4897
4960
  * Licensed under the MIT License.
4898
4961
  */
4899
4962
 
4900
- const util$1 = require$$0__default$3["default"];
4963
+ const util$1 = require$$0$3;
4901
4964
  const toRegexRange = toRegexRange_1;
4902
4965
 
4903
4966
  const isObject$1 = val => val !== null && typeof val === 'object' && !Array.isArray(val);
4904
4967
 
4905
- const transform$1 = toNumber => {
4968
+ const transform = toNumber => {
4906
4969
  return value => toNumber === true ? Number(value) : String(value);
4907
4970
  };
4908
4971
 
@@ -5039,7 +5102,7 @@ const fillNumbers = (start, end, step = 1, options = {}) => {
5039
5102
  let padded = zeros(startString) || zeros(endString) || zeros(stepString);
5040
5103
  let maxLen = padded ? Math.max(startString.length, endString.length, stepString.length) : 0;
5041
5104
  let toNumber = padded === false && stringify$3(start, end, options) === false;
5042
- let format = options.transform || transform$1(toNumber);
5105
+ let format = options.transform || transform(toNumber);
5043
5106
 
5044
5107
  if (options.toRegex && step === 1) {
5045
5108
  return toRange(toMaxLen(start, maxLen), toMaxLen(end, maxLen), true, options);
@@ -5862,7 +5925,7 @@ var braces_1 = braces$1;
5862
5925
 
5863
5926
  var utils$f = {};
5864
5927
 
5865
- const path$7 = require$$0__default$2["default"];
5928
+ const path$7 = require$$0$2;
5866
5929
  const WIN_SLASH = '\\\\/';
5867
5930
  const WIN_NO_SLASH = `[^${WIN_SLASH}]`;
5868
5931
 
@@ -6042,7 +6105,7 @@ var constants$3 = {
6042
6105
 
6043
6106
  (function (exports) {
6044
6107
 
6045
- const path = require$$0__default$2["default"];
6108
+ const path = require$$0$2;
6046
6109
  const win32 = process.platform === 'win32';
6047
6110
  const {
6048
6111
  REGEX_BACKSLASH,
@@ -7586,7 +7649,7 @@ parse$1.fastpaths = (input, options) => {
7586
7649
 
7587
7650
  var parse_1 = parse$1;
7588
7651
 
7589
- const path$6 = require$$0__default$2["default"];
7652
+ const path$6 = require$$0$2;
7590
7653
  const scan = scan_1;
7591
7654
  const parse = parse_1;
7592
7655
  const utils$c = utils$f;
@@ -7929,7 +7992,7 @@ var picomatch_1 = picomatch$2;
7929
7992
 
7930
7993
  var picomatch$1 = picomatch_1;
7931
7994
 
7932
- const util = require$$0__default$3["default"];
7995
+ const util = require$$0$3;
7933
7996
  const braces = braces_1;
7934
7997
  const picomatch = picomatch$1;
7935
7998
  const utils$b = utils$f;
@@ -8395,174 +8458,193 @@ micromatch$1.braceExpand = (pattern, options) => {
8395
8458
 
8396
8459
  var micromatch_1 = micromatch$1;
8397
8460
 
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
- }
8461
+ Object.defineProperty(pattern$1, "__esModule", { value: true });
8462
+ 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;
8463
+ const path$5 = require$$0$2;
8464
+ const globParent = globParent$1;
8465
+ const micromatch = micromatch_1;
8466
+ const GLOBSTAR = '**';
8467
+ const ESCAPE_SYMBOL = '\\';
8468
+ const COMMON_GLOB_SYMBOLS_RE = /[*?]|^!/;
8469
+ const REGEX_CHARACTER_CLASS_SYMBOLS_RE = /\[[^[]*]/;
8470
+ const REGEX_GROUP_SYMBOLS_RE = /(?:^|[^!*+?@])\([^(]*\|[^|]*\)/;
8471
+ const GLOB_EXTENSION_SYMBOLS_RE = /[!*+?@]\([^(]*\)/;
8472
+ const BRACE_EXPANSION_SEPARATORS_RE = /,|\.\./;
8473
+ /**
8474
+ * Matches a sequence of two or more consecutive slashes, excluding the first two slashes at the beginning of the string.
8475
+ * The latter is due to the presence of the device path at the beginning of the UNC path.
8476
+ */
8477
+ const DOUBLE_SLASH_RE = /(?!^)\/{2,}/g;
8478
+ function isStaticPattern(pattern, options = {}) {
8479
+ return !isDynamicPattern(pattern, options);
8480
+ }
8481
+ pattern$1.isStaticPattern = isStaticPattern;
8482
+ function isDynamicPattern(pattern, options = {}) {
8483
+ /**
8484
+ * A special case with an empty string is necessary for matching patterns that start with a forward slash.
8485
+ * An empty string cannot be a dynamic pattern.
8486
+ * For example, the pattern `/lib/*` will be spread into parts: '', 'lib', '*'.
8487
+ */
8488
+ if (pattern === '') {
8489
+ return false;
8490
+ }
8491
+ /**
8492
+ * When the `caseSensitiveMatch` option is disabled, all patterns must be marked as dynamic, because we cannot check
8493
+ * filepath directly (without read directory).
8494
+ */
8495
+ if (options.caseSensitiveMatch === false || pattern.includes(ESCAPE_SYMBOL)) {
8496
+ return true;
8497
+ }
8498
+ if (COMMON_GLOB_SYMBOLS_RE.test(pattern) || REGEX_CHARACTER_CLASS_SYMBOLS_RE.test(pattern) || REGEX_GROUP_SYMBOLS_RE.test(pattern)) {
8499
+ return true;
8500
+ }
8501
+ if (options.extglob !== false && GLOB_EXTENSION_SYMBOLS_RE.test(pattern)) {
8502
+ return true;
8503
+ }
8504
+ if (options.braceExpansion !== false && hasBraceExpansion(pattern)) {
8505
+ return true;
8506
+ }
8507
+ return false;
8508
+ }
8509
+ pattern$1.isDynamicPattern = isDynamicPattern;
8510
+ function hasBraceExpansion(pattern) {
8511
+ const openingBraceIndex = pattern.indexOf('{');
8512
+ if (openingBraceIndex === -1) {
8513
+ return false;
8514
+ }
8515
+ const closingBraceIndex = pattern.indexOf('}', openingBraceIndex + 1);
8516
+ if (closingBraceIndex === -1) {
8517
+ return false;
8518
+ }
8519
+ const braceContent = pattern.slice(openingBraceIndex, closingBraceIndex);
8520
+ return BRACE_EXPANSION_SEPARATORS_RE.test(braceContent);
8521
+ }
8522
+ function convertToPositivePattern(pattern) {
8523
+ return isNegativePattern(pattern) ? pattern.slice(1) : pattern;
8524
+ }
8525
+ pattern$1.convertToPositivePattern = convertToPositivePattern;
8526
+ function convertToNegativePattern(pattern) {
8527
+ return '!' + pattern;
8528
+ }
8529
+ pattern$1.convertToNegativePattern = convertToNegativePattern;
8530
+ function isNegativePattern(pattern) {
8531
+ return pattern.startsWith('!') && pattern[1] !== '(';
8532
+ }
8533
+ pattern$1.isNegativePattern = isNegativePattern;
8534
+ function isPositivePattern(pattern) {
8535
+ return !isNegativePattern(pattern);
8536
+ }
8537
+ pattern$1.isPositivePattern = isPositivePattern;
8538
+ function getNegativePatterns(patterns) {
8539
+ return patterns.filter(isNegativePattern);
8540
+ }
8541
+ pattern$1.getNegativePatterns = getNegativePatterns;
8542
+ function getPositivePatterns$1(patterns) {
8543
+ return patterns.filter(isPositivePattern);
8544
+ }
8545
+ pattern$1.getPositivePatterns = getPositivePatterns$1;
8546
+ /**
8547
+ * Returns patterns that can be applied inside the current directory.
8548
+ *
8549
+ * @example
8550
+ * // ['./*', '*', 'a/*']
8551
+ * getPatternsInsideCurrentDirectory(['./*', '*', 'a/*', '../*', './../*'])
8552
+ */
8553
+ function getPatternsInsideCurrentDirectory(patterns) {
8554
+ return patterns.filter((pattern) => !isPatternRelatedToParentDirectory(pattern));
8555
+ }
8556
+ pattern$1.getPatternsInsideCurrentDirectory = getPatternsInsideCurrentDirectory;
8557
+ /**
8558
+ * Returns patterns to be expanded relative to (outside) the current directory.
8559
+ *
8560
+ * @example
8561
+ * // ['../*', './../*']
8562
+ * getPatternsInsideCurrentDirectory(['./*', '*', 'a/*', '../*', './../*'])
8563
+ */
8564
+ function getPatternsOutsideCurrentDirectory(patterns) {
8565
+ return patterns.filter(isPatternRelatedToParentDirectory);
8566
+ }
8567
+ pattern$1.getPatternsOutsideCurrentDirectory = getPatternsOutsideCurrentDirectory;
8568
+ function isPatternRelatedToParentDirectory(pattern) {
8569
+ return pattern.startsWith('..') || pattern.startsWith('./..');
8570
+ }
8571
+ pattern$1.isPatternRelatedToParentDirectory = isPatternRelatedToParentDirectory;
8572
+ function getBaseDirectory(pattern) {
8573
+ return globParent(pattern, { flipBackslashes: false });
8574
+ }
8575
+ pattern$1.getBaseDirectory = getBaseDirectory;
8576
+ function hasGlobStar(pattern) {
8577
+ return pattern.includes(GLOBSTAR);
8578
+ }
8579
+ pattern$1.hasGlobStar = hasGlobStar;
8580
+ function endsWithSlashGlobStar(pattern) {
8581
+ return pattern.endsWith('/' + GLOBSTAR);
8582
+ }
8583
+ pattern$1.endsWithSlashGlobStar = endsWithSlashGlobStar;
8584
+ function isAffectDepthOfReadingPattern(pattern) {
8585
+ const basename = path$5.basename(pattern);
8586
+ return endsWithSlashGlobStar(pattern) || isStaticPattern(basename);
8587
+ }
8588
+ pattern$1.isAffectDepthOfReadingPattern = isAffectDepthOfReadingPattern;
8589
+ function expandPatternsWithBraceExpansion(patterns) {
8590
+ return patterns.reduce((collection, pattern) => {
8591
+ return collection.concat(expandBraceExpansion(pattern));
8592
+ }, []);
8593
+ }
8594
+ pattern$1.expandPatternsWithBraceExpansion = expandPatternsWithBraceExpansion;
8595
+ function expandBraceExpansion(pattern) {
8596
+ const patterns = micromatch.braces(pattern, { expand: true, nodupes: true });
8597
+ /**
8598
+ * Sort the patterns by length so that the same depth patterns are processed side by side.
8599
+ * `a/{b,}/{c,}/*` – `['a///*', 'a/b//*', 'a//c/*', 'a/b/c/*']`
8600
+ */
8601
+ patterns.sort((a, b) => a.length - b.length);
8602
+ /**
8603
+ * Micromatch can return an empty string in the case of patterns like `{a,}`.
8604
+ */
8605
+ return patterns.filter((pattern) => pattern !== '');
8606
+ }
8607
+ pattern$1.expandBraceExpansion = expandBraceExpansion;
8608
+ function getPatternParts(pattern, options) {
8609
+ let { parts } = micromatch.scan(pattern, Object.assign(Object.assign({}, options), { parts: true }));
8610
+ /**
8611
+ * The scan method returns an empty array in some cases.
8612
+ * See micromatch/picomatch#58 for more details.
8613
+ */
8614
+ if (parts.length === 0) {
8615
+ parts = [pattern];
8616
+ }
8617
+ /**
8618
+ * The scan method does not return an empty part for the pattern with a forward slash.
8619
+ * This is another part of micromatch/picomatch#58.
8620
+ */
8621
+ if (parts[0].startsWith('/')) {
8622
+ parts[0] = parts[0].slice(1);
8623
+ parts.unshift('');
8624
+ }
8625
+ return parts;
8626
+ }
8627
+ pattern$1.getPatternParts = getPatternParts;
8628
+ function makeRe(pattern, options) {
8629
+ return micromatch.makeRe(pattern, options);
8630
+ }
8631
+ pattern$1.makeRe = makeRe;
8632
+ function convertPatternsToRe(patterns, options) {
8633
+ return patterns.map((pattern) => makeRe(pattern, options));
8634
+ }
8635
+ pattern$1.convertPatternsToRe = convertPatternsToRe;
8636
+ function matchAny(entry, patternsRe) {
8637
+ return patternsRe.some((patternRe) => patternRe.test(entry));
8638
+ }
8565
8639
  pattern$1.matchAny = matchAny;
8640
+ /**
8641
+ * This package only works with forward slashes as a path separator.
8642
+ * Because of this, we cannot use the standard `path.normalize` method, because on Windows platform it will use of backslashes.
8643
+ */
8644
+ function removeDuplicateSlashes(pattern) {
8645
+ return pattern.replace(DOUBLE_SLASH_RE, '/');
8646
+ }
8647
+ pattern$1.removeDuplicateSlashes = removeDuplicateSlashes;
8566
8648
 
8567
8649
  var stream$4 = {};
8568
8650
 
@@ -8573,7 +8655,7 @@ var stream$4 = {};
8573
8655
  * Copyright (c) 2014-2020 Teambition
8574
8656
  * Licensed under the MIT license.
8575
8657
  */
8576
- const Stream = require$$0__default["default"];
8658
+ const Stream = require$$0;
8577
8659
  const PassThrough = Stream.PassThrough;
8578
8660
  const slice = Array.prototype.slice;
8579
8661
 
@@ -8710,156 +8792,163 @@ function pauseStreams (streams, options) {
8710
8792
  return streams
8711
8793
  }
8712
8794
 
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'));
8795
+ Object.defineProperty(stream$4, "__esModule", { value: true });
8796
+ stream$4.merge = void 0;
8797
+ const merge2 = merge2_1;
8798
+ function merge(streams) {
8799
+ const mergedStream = merge2(streams);
8800
+ streams.forEach((stream) => {
8801
+ stream.once('error', (error) => mergedStream.emit('error', error));
8802
+ });
8803
+ mergedStream.once('close', () => propagateCloseEventToSources(streams));
8804
+ mergedStream.once('end', () => propagateCloseEventToSources(streams));
8805
+ return mergedStream;
8806
+ }
8807
+ stream$4.merge = merge;
8808
+ function propagateCloseEventToSources(streams) {
8809
+ streams.forEach((stream) => stream.emit('close'));
8728
8810
  }
8729
8811
 
8730
8812
  var string$1 = {};
8731
8813
 
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
- }
8814
+ Object.defineProperty(string$1, "__esModule", { value: true });
8815
+ string$1.isEmpty = string$1.isString = void 0;
8816
+ function isString(input) {
8817
+ return typeof input === 'string';
8818
+ }
8819
+ string$1.isString = isString;
8820
+ function isEmpty(input) {
8821
+ return input === '';
8822
+ }
8741
8823
  string$1.isEmpty = isEmpty;
8742
8824
 
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;
8825
+ Object.defineProperty(utils$k, "__esModule", { value: true });
8826
+ utils$k.string = utils$k.stream = utils$k.pattern = utils$k.path = utils$k.fs = utils$k.errno = utils$k.array = void 0;
8827
+ const array = array$1;
8828
+ utils$k.array = array;
8829
+ const errno = errno$1;
8830
+ utils$k.errno = errno;
8831
+ const fs$6 = fs$7;
8832
+ utils$k.fs = fs$6;
8833
+ const path$4 = path$9;
8834
+ utils$k.path = path$4;
8835
+ const pattern = pattern$1;
8836
+ utils$k.pattern = pattern;
8837
+ const stream$3 = stream$4;
8838
+ utils$k.stream = stream$3;
8839
+ const string = string$1;
8758
8840
  utils$k.string = string;
8759
8841
 
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
- }
8842
+ Object.defineProperty(tasks, "__esModule", { value: true });
8843
+ tasks.convertPatternGroupToTask = tasks.convertPatternGroupsToTasks = tasks.groupPatternsByBaseDirectory = tasks.getNegativePatternsAsPositive = tasks.getPositivePatterns = tasks.convertPatternsToTasks = tasks.generate = void 0;
8844
+ const utils$a = utils$k;
8845
+ function generate(input, settings) {
8846
+ const patterns = processPatterns(input, settings);
8847
+ const ignore = processPatterns(settings.ignore, settings);
8848
+ const positivePatterns = getPositivePatterns(patterns);
8849
+ const negativePatterns = getNegativePatternsAsPositive(patterns, ignore);
8850
+ const staticPatterns = positivePatterns.filter((pattern) => utils$a.pattern.isStaticPattern(pattern, settings));
8851
+ const dynamicPatterns = positivePatterns.filter((pattern) => utils$a.pattern.isDynamicPattern(pattern, settings));
8852
+ const staticTasks = convertPatternsToTasks(staticPatterns, negativePatterns, /* dynamic */ false);
8853
+ const dynamicTasks = convertPatternsToTasks(dynamicPatterns, negativePatterns, /* dynamic */ true);
8854
+ return staticTasks.concat(dynamicTasks);
8855
+ }
8856
+ tasks.generate = generate;
8857
+ function processPatterns(input, settings) {
8858
+ let patterns = input;
8859
+ /**
8860
+ * The original pattern like `{,*,**,a/*}` can lead to problems checking the depth when matching entry
8861
+ * and some problems with the micromatch package (see fast-glob issues: #365, #394).
8862
+ *
8863
+ * To solve this problem, we expand all patterns containing brace expansion. This can lead to a slight slowdown
8864
+ * in matching in the case of a large set of patterns after expansion.
8865
+ */
8866
+ if (settings.braceExpansion) {
8867
+ patterns = utils$a.pattern.expandPatternsWithBraceExpansion(patterns);
8868
+ }
8869
+ /**
8870
+ * If the `baseNameMatch` option is enabled, we must add globstar to patterns, so that they can be used
8871
+ * at any nesting level.
8872
+ *
8873
+ * We do this here, because otherwise we have to complicate the filtering logic. For example, we need to change
8874
+ * the pattern in the filter before creating a regular expression. There is no need to change the patterns
8875
+ * in the application. Only on the input.
8876
+ */
8877
+ if (settings.baseNameMatch) {
8878
+ patterns = patterns.map((pattern) => pattern.includes('/') ? pattern : `**/${pattern}`);
8879
+ }
8880
+ /**
8881
+ * This method also removes duplicate slashes that may have been in the pattern or formed as a result of expansion.
8882
+ */
8883
+ return patterns.map((pattern) => utils$a.pattern.removeDuplicateSlashes(pattern));
8884
+ }
8885
+ /**
8886
+ * Returns tasks grouped by basic pattern directories.
8887
+ *
8888
+ * Patterns that can be found inside (`./`) and outside (`../`) the current directory are handled separately.
8889
+ * This is necessary because directory traversal starts at the base directory and goes deeper.
8890
+ */
8891
+ function convertPatternsToTasks(positive, negative, dynamic) {
8892
+ const tasks = [];
8893
+ const patternsOutsideCurrentDirectory = utils$a.pattern.getPatternsOutsideCurrentDirectory(positive);
8894
+ const patternsInsideCurrentDirectory = utils$a.pattern.getPatternsInsideCurrentDirectory(positive);
8895
+ const outsideCurrentDirectoryGroup = groupPatternsByBaseDirectory(patternsOutsideCurrentDirectory);
8896
+ const insideCurrentDirectoryGroup = groupPatternsByBaseDirectory(patternsInsideCurrentDirectory);
8897
+ tasks.push(...convertPatternGroupsToTasks(outsideCurrentDirectoryGroup, negative, dynamic));
8898
+ /*
8899
+ * For the sake of reducing future accesses to the file system, we merge all tasks within the current directory
8900
+ * into a global task, if at least one pattern refers to the root (`.`). In this case, the global task covers the rest.
8901
+ */
8902
+ if ('.' in insideCurrentDirectoryGroup) {
8903
+ tasks.push(convertPatternGroupToTask('.', patternsInsideCurrentDirectory, negative, dynamic));
8904
+ }
8905
+ else {
8906
+ tasks.push(...convertPatternGroupsToTasks(insideCurrentDirectoryGroup, negative, dynamic));
8907
+ }
8908
+ return tasks;
8909
+ }
8910
+ tasks.convertPatternsToTasks = convertPatternsToTasks;
8911
+ function getPositivePatterns(patterns) {
8912
+ return utils$a.pattern.getPositivePatterns(patterns);
8913
+ }
8914
+ tasks.getPositivePatterns = getPositivePatterns;
8915
+ function getNegativePatternsAsPositive(patterns, ignore) {
8916
+ const negative = utils$a.pattern.getNegativePatterns(patterns).concat(ignore);
8917
+ const positive = negative.map(utils$a.pattern.convertToPositivePattern);
8918
+ return positive;
8919
+ }
8920
+ tasks.getNegativePatternsAsPositive = getNegativePatternsAsPositive;
8921
+ function groupPatternsByBaseDirectory(patterns) {
8922
+ const group = {};
8923
+ return patterns.reduce((collection, pattern) => {
8924
+ const base = utils$a.pattern.getBaseDirectory(pattern);
8925
+ if (base in collection) {
8926
+ collection[base].push(pattern);
8927
+ }
8928
+ else {
8929
+ collection[base] = [pattern];
8930
+ }
8931
+ return collection;
8932
+ }, group);
8933
+ }
8934
+ tasks.groupPatternsByBaseDirectory = groupPatternsByBaseDirectory;
8935
+ function convertPatternGroupsToTasks(positive, negative, dynamic) {
8936
+ return Object.keys(positive).map((base) => {
8937
+ return convertPatternGroupToTask(base, positive[base], negative, dynamic);
8938
+ });
8939
+ }
8940
+ tasks.convertPatternGroupsToTasks = convertPatternGroupsToTasks;
8941
+ function convertPatternGroupToTask(base, positive, negative, dynamic) {
8942
+ return {
8943
+ dynamic,
8944
+ positive,
8945
+ negative,
8946
+ base,
8947
+ patterns: [].concat(positive, negative.map(utils$a.pattern.convertToNegativePattern))
8948
+ };
8949
+ }
8838
8950
  tasks.convertPatternGroupToTask = convertPatternGroupToTask;
8839
8951
 
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
8952
  var async$7 = {};
8864
8953
 
8865
8954
  var async$6 = {};
@@ -8946,7 +9035,7 @@ var fs$5 = {};
8946
9035
  (function (exports) {
8947
9036
  Object.defineProperty(exports, "__esModule", { value: true });
8948
9037
  exports.createFileSystemAdapter = exports.FILE_SYSTEM_ADAPTER = void 0;
8949
- const fs = require$$0__default$1["default"];
9038
+ const fs = require$$0$1;
8950
9039
  exports.FILE_SYSTEM_ADAPTER = {
8951
9040
  lstat: fs.lstat,
8952
9041
  stat: fs.stat,
@@ -8964,7 +9053,7 @@ var fs$5 = {};
8964
9053
 
8965
9054
  Object.defineProperty(settings$3, "__esModule", { value: true });
8966
9055
  const fs$4 = fs$5;
8967
- class Settings$2 {
9056
+ let Settings$2 = class Settings {
8968
9057
  constructor(_options = {}) {
8969
9058
  this._options = _options;
8970
9059
  this.followSymbolicLink = this._getValue(this._options.followSymbolicLink, true);
@@ -8975,7 +9064,7 @@ class Settings$2 {
8975
9064
  _getValue(option, value) {
8976
9065
  return option !== null && option !== void 0 ? option : value;
8977
9066
  }
8978
- }
9067
+ };
8979
9068
  settings$3.default = Settings$2;
8980
9069
 
8981
9070
  Object.defineProperty(out$1, "__esModule", { value: true });
@@ -9297,7 +9386,7 @@ var fs$1 = {};
9297
9386
  (function (exports) {
9298
9387
  Object.defineProperty(exports, "__esModule", { value: true });
9299
9388
  exports.createFileSystemAdapter = exports.FILE_SYSTEM_ADAPTER = void 0;
9300
- const fs = require$$0__default$1["default"];
9389
+ const fs = require$$0$1;
9301
9390
  exports.FILE_SYSTEM_ADAPTER = {
9302
9391
  lstat: fs.lstat,
9303
9392
  stat: fs.stat,
@@ -9316,10 +9405,10 @@ var fs$1 = {};
9316
9405
  } (fs$1));
9317
9406
 
9318
9407
  Object.defineProperty(settings$2, "__esModule", { value: true });
9319
- const path$3 = require$$0__default$2["default"];
9408
+ const path$3 = require$$0$2;
9320
9409
  const fsStat$3 = out$1;
9321
9410
  const fs = fs$1;
9322
- class Settings$1 {
9411
+ let Settings$1 = class Settings {
9323
9412
  constructor(_options = {}) {
9324
9413
  this._options = _options;
9325
9414
  this.followSymbolicLinks = this._getValue(this._options.followSymbolicLinks, false);
@@ -9336,7 +9425,7 @@ class Settings$1 {
9336
9425
  _getValue(option, value) {
9337
9426
  return option !== null && option !== void 0 ? option : value;
9338
9427
  }
9339
- }
9428
+ };
9340
9429
  settings$2.default = Settings$1;
9341
9430
 
9342
9431
  Object.defineProperty(out$2, "__esModule", { value: true });
@@ -9665,6 +9754,12 @@ function queueAsPromised (context, worker, concurrency) {
9665
9754
  }
9666
9755
 
9667
9756
  function drained () {
9757
+ if (queue.idle()) {
9758
+ return new Promise(function (resolve) {
9759
+ resolve();
9760
+ })
9761
+ }
9762
+
9668
9763
  var previousDrain = queue.drain;
9669
9764
 
9670
9765
  var p = new Promise(function (resolve) {
@@ -9720,17 +9815,17 @@ var reader$1 = {};
9720
9815
 
9721
9816
  Object.defineProperty(reader$1, "__esModule", { value: true });
9722
9817
  const common$2 = common$3;
9723
- class Reader$1 {
9818
+ let Reader$1 = class Reader {
9724
9819
  constructor(_root, _settings) {
9725
9820
  this._root = _root;
9726
9821
  this._settings = _settings;
9727
9822
  this._root = common$2.replacePathSegmentSeparator(_root, _settings.pathSegmentSeparator);
9728
9823
  }
9729
- }
9824
+ };
9730
9825
  reader$1.default = Reader$1;
9731
9826
 
9732
9827
  Object.defineProperty(async$4, "__esModule", { value: true });
9733
- const events_1 = require$$0__default$4["default"];
9828
+ const events_1 = require$$0$5;
9734
9829
  const fsScandir$2 = out$2;
9735
9830
  const fastq = queueExports;
9736
9831
  const common$1 = common$3;
@@ -9859,7 +9954,7 @@ function callSuccessCallback(callback, entries) {
9859
9954
  var stream$2 = {};
9860
9955
 
9861
9956
  Object.defineProperty(stream$2, "__esModule", { value: true });
9862
- const stream_1$5 = require$$0__default["default"];
9957
+ const stream_1$5 = require$$0;
9863
9958
  const async_1$3 = async$4;
9864
9959
  class StreamProvider {
9865
9960
  constructor(_root, _settings) {
@@ -9972,7 +10067,7 @@ sync$3.default = SyncProvider;
9972
10067
  var settings$1 = {};
9973
10068
 
9974
10069
  Object.defineProperty(settings$1, "__esModule", { value: true });
9975
- const path$2 = require$$0__default$2["default"];
10070
+ const path$2 = require$$0$2;
9976
10071
  const fsScandir = out$2;
9977
10072
  class Settings {
9978
10073
  constructor(_options = {}) {
@@ -10033,129 +10128,129 @@ function getSettings(settingsOrOptions = {}) {
10033
10128
 
10034
10129
  var reader = {};
10035
10130
 
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
- }
10131
+ Object.defineProperty(reader, "__esModule", { value: true });
10132
+ const path$1 = require$$0$2;
10133
+ const fsStat$2 = out$1;
10134
+ const utils$6 = utils$k;
10135
+ class Reader {
10136
+ constructor(_settings) {
10137
+ this._settings = _settings;
10138
+ this._fsStatSettings = new fsStat$2.Settings({
10139
+ followSymbolicLink: this._settings.followSymbolicLinks,
10140
+ fs: this._settings.fs,
10141
+ throwErrorOnBrokenSymbolicLink: this._settings.followSymbolicLinks
10142
+ });
10143
+ }
10144
+ _getFullEntryPath(filepath) {
10145
+ return path$1.resolve(this._settings.cwd, filepath);
10146
+ }
10147
+ _makeEntry(stats, pattern) {
10148
+ const entry = {
10149
+ name: pattern,
10150
+ path: pattern,
10151
+ dirent: utils$6.fs.createDirentFromStats(pattern, stats)
10152
+ };
10153
+ if (this._settings.stats) {
10154
+ entry.stats = stats;
10155
+ }
10156
+ return entry;
10157
+ }
10158
+ _isFatalError(error) {
10159
+ return !utils$6.errno.isEnoentCodeError(error) && !this._settings.suppressErrors;
10160
+ }
10161
+ }
10067
10162
  reader.default = Reader;
10068
10163
 
10069
10164
  var stream$1 = {};
10070
10165
 
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
- }
10166
+ Object.defineProperty(stream$1, "__esModule", { value: true });
10167
+ const stream_1$3 = require$$0;
10168
+ const fsStat$1 = out$1;
10169
+ const fsWalk$2 = out$3;
10170
+ const reader_1$2 = reader;
10171
+ class ReaderStream extends reader_1$2.default {
10172
+ constructor() {
10173
+ super(...arguments);
10174
+ this._walkStream = fsWalk$2.walkStream;
10175
+ this._stat = fsStat$1.stat;
10176
+ }
10177
+ dynamic(root, options) {
10178
+ return this._walkStream(root, options);
10179
+ }
10180
+ static(patterns, options) {
10181
+ const filepaths = patterns.map(this._getFullEntryPath, this);
10182
+ const stream = new stream_1$3.PassThrough({ objectMode: true });
10183
+ stream._write = (index, _enc, done) => {
10184
+ return this._getEntry(filepaths[index], patterns[index], options)
10185
+ .then((entry) => {
10186
+ if (entry !== null && options.entryFilter(entry)) {
10187
+ stream.push(entry);
10188
+ }
10189
+ if (index === filepaths.length - 1) {
10190
+ stream.end();
10191
+ }
10192
+ done();
10193
+ })
10194
+ .catch(done);
10195
+ };
10196
+ for (let i = 0; i < filepaths.length; i++) {
10197
+ stream.write(i);
10198
+ }
10199
+ return stream;
10200
+ }
10201
+ _getEntry(filepath, pattern, options) {
10202
+ return this._getStat(filepath)
10203
+ .then((stats) => this._makeEntry(stats, pattern))
10204
+ .catch((error) => {
10205
+ if (options.errorFilter(error)) {
10206
+ return null;
10207
+ }
10208
+ throw error;
10209
+ });
10210
+ }
10211
+ _getStat(filepath) {
10212
+ return new Promise((resolve, reject) => {
10213
+ this._stat(filepath, this._fsStatSettings, (error, stats) => {
10214
+ return error === null ? resolve(stats) : reject(error);
10215
+ });
10216
+ });
10217
+ }
10218
+ }
10124
10219
  stream$1.default = ReaderStream;
10125
10220
 
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
- }
10221
+ Object.defineProperty(async$6, "__esModule", { value: true });
10222
+ const fsWalk$1 = out$3;
10223
+ const reader_1$1 = reader;
10224
+ const stream_1$2 = stream$1;
10225
+ class ReaderAsync extends reader_1$1.default {
10226
+ constructor() {
10227
+ super(...arguments);
10228
+ this._walkAsync = fsWalk$1.walk;
10229
+ this._readerStream = new stream_1$2.default(this._settings);
10230
+ }
10231
+ dynamic(root, options) {
10232
+ return new Promise((resolve, reject) => {
10233
+ this._walkAsync(root, options, (error, entries) => {
10234
+ if (error === null) {
10235
+ resolve(entries);
10236
+ }
10237
+ else {
10238
+ reject(error);
10239
+ }
10240
+ });
10241
+ });
10242
+ }
10243
+ async static(patterns, options) {
10244
+ const entries = [];
10245
+ const stream = this._readerStream.static(patterns, options);
10246
+ // After #235, replace it with an asynchronous iterator.
10247
+ return new Promise((resolve, reject) => {
10248
+ stream.once('error', reject);
10249
+ stream.on('data', (entry) => entries.push(entry));
10250
+ stream.once('end', () => resolve(entries));
10251
+ });
10252
+ }
10253
+ }
10159
10254
  async$6.default = ReaderAsync;
10160
10255
 
10161
10256
  var provider = {};
@@ -10166,591 +10261,621 @@ var partial = {};
10166
10261
 
10167
10262
  var matcher = {};
10168
10263
 
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
- }
10264
+ Object.defineProperty(matcher, "__esModule", { value: true });
10265
+ const utils$5 = utils$k;
10266
+ class Matcher {
10267
+ constructor(_patterns, _settings, _micromatchOptions) {
10268
+ this._patterns = _patterns;
10269
+ this._settings = _settings;
10270
+ this._micromatchOptions = _micromatchOptions;
10271
+ this._storage = [];
10272
+ this._fillStorage();
10273
+ }
10274
+ _fillStorage() {
10275
+ for (const pattern of this._patterns) {
10276
+ const segments = this._getPatternSegments(pattern);
10277
+ const sections = this._splitSegmentsIntoSections(segments);
10278
+ this._storage.push({
10279
+ complete: sections.length <= 1,
10280
+ pattern,
10281
+ segments,
10282
+ sections
10283
+ });
10284
+ }
10285
+ }
10286
+ _getPatternSegments(pattern) {
10287
+ const parts = utils$5.pattern.getPatternParts(pattern, this._micromatchOptions);
10288
+ return parts.map((part) => {
10289
+ const dynamic = utils$5.pattern.isDynamicPattern(part, this._settings);
10290
+ if (!dynamic) {
10291
+ return {
10292
+ dynamic: false,
10293
+ pattern: part
10294
+ };
10295
+ }
10296
+ return {
10297
+ dynamic: true,
10298
+ pattern: part,
10299
+ patternRe: utils$5.pattern.makeRe(part, this._micromatchOptions)
10300
+ };
10301
+ });
10302
+ }
10303
+ _splitSegmentsIntoSections(segments) {
10304
+ return utils$5.array.splitWhen(segments, (segment) => segment.dynamic && utils$5.pattern.hasGlobStar(segment.pattern));
10305
+ }
10306
+ }
10217
10307
  matcher.default = Matcher;
10218
10308
 
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
- }
10309
+ Object.defineProperty(partial, "__esModule", { value: true });
10310
+ const matcher_1 = matcher;
10311
+ class PartialMatcher extends matcher_1.default {
10312
+ match(filepath) {
10313
+ const parts = filepath.split('/');
10314
+ const levels = parts.length;
10315
+ const patterns = this._storage.filter((info) => !info.complete || info.segments.length > levels);
10316
+ for (const pattern of patterns) {
10317
+ const section = pattern.sections[0];
10318
+ /**
10319
+ * In this case, the pattern has a globstar and we must read all directories unconditionally,
10320
+ * but only if the level has reached the end of the first group.
10321
+ *
10322
+ * fixtures/{a,b}/**
10323
+ * ^ true/false ^ always true
10324
+ */
10325
+ if (!pattern.complete && levels > section.length) {
10326
+ return true;
10327
+ }
10328
+ const match = parts.every((part, index) => {
10329
+ const segment = pattern.segments[index];
10330
+ if (segment.dynamic && segment.patternRe.test(part)) {
10331
+ return true;
10332
+ }
10333
+ if (!segment.dynamic && segment.pattern === part) {
10334
+ return true;
10335
+ }
10336
+ return false;
10337
+ });
10338
+ if (match) {
10339
+ return true;
10340
+ }
10341
+ }
10342
+ return false;
10343
+ }
10344
+ }
10255
10345
  partial.default = PartialMatcher;
10256
10346
 
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
- }
10347
+ Object.defineProperty(deep, "__esModule", { value: true });
10348
+ const utils$4 = utils$k;
10349
+ const partial_1 = partial;
10350
+ class DeepFilter {
10351
+ constructor(_settings, _micromatchOptions) {
10352
+ this._settings = _settings;
10353
+ this._micromatchOptions = _micromatchOptions;
10354
+ }
10355
+ getFilter(basePath, positive, negative) {
10356
+ const matcher = this._getMatcher(positive);
10357
+ const negativeRe = this._getNegativePatternsRe(negative);
10358
+ return (entry) => this._filter(basePath, entry, matcher, negativeRe);
10359
+ }
10360
+ _getMatcher(patterns) {
10361
+ return new partial_1.default(patterns, this._settings, this._micromatchOptions);
10362
+ }
10363
+ _getNegativePatternsRe(patterns) {
10364
+ const affectDepthOfReadingPatterns = patterns.filter(utils$4.pattern.isAffectDepthOfReadingPattern);
10365
+ return utils$4.pattern.convertPatternsToRe(affectDepthOfReadingPatterns, this._micromatchOptions);
10366
+ }
10367
+ _filter(basePath, entry, matcher, negativeRe) {
10368
+ if (this._isSkippedByDeep(basePath, entry.path)) {
10369
+ return false;
10370
+ }
10371
+ if (this._isSkippedSymbolicLink(entry)) {
10372
+ return false;
10373
+ }
10374
+ const filepath = utils$4.path.removeLeadingDotSegment(entry.path);
10375
+ if (this._isSkippedByPositivePatterns(filepath, matcher)) {
10376
+ return false;
10377
+ }
10378
+ return this._isSkippedByNegativePatterns(filepath, negativeRe);
10379
+ }
10380
+ _isSkippedByDeep(basePath, entryPath) {
10381
+ /**
10382
+ * Avoid unnecessary depth calculations when it doesn't matter.
10383
+ */
10384
+ if (this._settings.deep === Infinity) {
10385
+ return false;
10386
+ }
10387
+ return this._getEntryLevel(basePath, entryPath) >= this._settings.deep;
10388
+ }
10389
+ _getEntryLevel(basePath, entryPath) {
10390
+ const entryPathDepth = entryPath.split('/').length;
10391
+ if (basePath === '') {
10392
+ return entryPathDepth;
10393
+ }
10394
+ const basePathDepth = basePath.split('/').length;
10395
+ return entryPathDepth - basePathDepth;
10396
+ }
10397
+ _isSkippedSymbolicLink(entry) {
10398
+ return !this._settings.followSymbolicLinks && entry.dirent.isSymbolicLink();
10399
+ }
10400
+ _isSkippedByPositivePatterns(entryPath, matcher) {
10401
+ return !this._settings.baseNameMatch && !matcher.match(entryPath);
10402
+ }
10403
+ _isSkippedByNegativePatterns(entryPath, patternsRe) {
10404
+ return !utils$4.pattern.matchAny(entryPath, patternsRe);
10405
+ }
10406
+ }
10317
10407
  deep.default = DeepFilter;
10318
10408
 
10319
10409
  var entry$1 = {};
10320
10410
 
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
- }
10411
+ Object.defineProperty(entry$1, "__esModule", { value: true });
10412
+ const utils$3 = utils$k;
10413
+ class EntryFilter {
10414
+ constructor(_settings, _micromatchOptions) {
10415
+ this._settings = _settings;
10416
+ this._micromatchOptions = _micromatchOptions;
10417
+ this.index = new Map();
10418
+ }
10419
+ getFilter(positive, negative) {
10420
+ const positiveRe = utils$3.pattern.convertPatternsToRe(positive, this._micromatchOptions);
10421
+ const negativeRe = utils$3.pattern.convertPatternsToRe(negative, Object.assign(Object.assign({}, this._micromatchOptions), { dot: true }));
10422
+ return (entry) => this._filter(entry, positiveRe, negativeRe);
10423
+ }
10424
+ _filter(entry, positiveRe, negativeRe) {
10425
+ const filepath = utils$3.path.removeLeadingDotSegment(entry.path);
10426
+ if (this._settings.unique && this._isDuplicateEntry(filepath)) {
10427
+ return false;
10428
+ }
10429
+ if (this._onlyFileFilter(entry) || this._onlyDirectoryFilter(entry)) {
10430
+ return false;
10431
+ }
10432
+ if (this._isSkippedByAbsoluteNegativePatterns(filepath, negativeRe)) {
10433
+ return false;
10434
+ }
10435
+ const isDirectory = entry.dirent.isDirectory();
10436
+ const isMatched = this._isMatchToPatterns(filepath, positiveRe, isDirectory) && !this._isMatchToPatterns(filepath, negativeRe, isDirectory);
10437
+ if (this._settings.unique && isMatched) {
10438
+ this._createIndexRecord(filepath);
10439
+ }
10440
+ return isMatched;
10441
+ }
10442
+ _isDuplicateEntry(filepath) {
10443
+ return this.index.has(filepath);
10444
+ }
10445
+ _createIndexRecord(filepath) {
10446
+ this.index.set(filepath, undefined);
10447
+ }
10448
+ _onlyFileFilter(entry) {
10449
+ return this._settings.onlyFiles && !entry.dirent.isFile();
10450
+ }
10451
+ _onlyDirectoryFilter(entry) {
10452
+ return this._settings.onlyDirectories && !entry.dirent.isDirectory();
10453
+ }
10454
+ _isSkippedByAbsoluteNegativePatterns(entryPath, patternsRe) {
10455
+ if (!this._settings.absolute) {
10456
+ return false;
10457
+ }
10458
+ const fullpath = utils$3.path.makeAbsolute(this._settings.cwd, entryPath);
10459
+ return utils$3.pattern.matchAny(fullpath, patternsRe);
10460
+ }
10461
+ _isMatchToPatterns(filepath, patternsRe, isDirectory) {
10462
+ // Trying to match files and directories by patterns.
10463
+ const isMatched = utils$3.pattern.matchAny(filepath, patternsRe);
10464
+ // A pattern with a trailling slash can be used for directory matching.
10465
+ // To apply such pattern, we need to add a tralling slash to the path.
10466
+ if (!isMatched && isDirectory) {
10467
+ return utils$3.pattern.matchAny(filepath + '/', patternsRe);
10468
+ }
10469
+ return isMatched;
10470
+ }
10471
+ }
10383
10472
  entry$1.default = EntryFilter;
10384
10473
 
10385
10474
  var error = {};
10386
10475
 
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
- }
10476
+ Object.defineProperty(error, "__esModule", { value: true });
10477
+ const utils$2 = utils$k;
10478
+ class ErrorFilter {
10479
+ constructor(_settings) {
10480
+ this._settings = _settings;
10481
+ }
10482
+ getFilter() {
10483
+ return (error) => this._isNonFatalError(error);
10484
+ }
10485
+ _isNonFatalError(error) {
10486
+ return utils$2.errno.isEnoentCodeError(error) || this._settings.suppressErrors;
10487
+ }
10488
+ }
10400
10489
  error.default = ErrorFilter;
10401
10490
 
10402
10491
  var entry = {};
10403
10492
 
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
- }
10493
+ Object.defineProperty(entry, "__esModule", { value: true });
10494
+ const utils$1 = utils$k;
10495
+ class EntryTransformer {
10496
+ constructor(_settings) {
10497
+ this._settings = _settings;
10498
+ }
10499
+ getTransformer() {
10500
+ return (entry) => this._transform(entry);
10501
+ }
10502
+ _transform(entry) {
10503
+ let filepath = entry.path;
10504
+ if (this._settings.absolute) {
10505
+ filepath = utils$1.path.makeAbsolute(this._settings.cwd, filepath);
10506
+ filepath = utils$1.path.unixify(filepath);
10507
+ }
10508
+ if (this._settings.markDirectories && entry.dirent.isDirectory()) {
10509
+ filepath += '/';
10510
+ }
10511
+ if (!this._settings.objectMode) {
10512
+ return filepath;
10513
+ }
10514
+ return Object.assign(Object.assign({}, entry), { path: filepath });
10515
+ }
10516
+ }
10428
10517
  entry.default = EntryTransformer;
10429
10518
 
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
- }
10519
+ Object.defineProperty(provider, "__esModule", { value: true });
10520
+ const path = require$$0$2;
10521
+ const deep_1 = deep;
10522
+ const entry_1 = entry$1;
10523
+ const error_1 = error;
10524
+ const entry_2 = entry;
10525
+ class Provider {
10526
+ constructor(_settings) {
10527
+ this._settings = _settings;
10528
+ this.errorFilter = new error_1.default(this._settings);
10529
+ this.entryFilter = new entry_1.default(this._settings, this._getMicromatchOptions());
10530
+ this.deepFilter = new deep_1.default(this._settings, this._getMicromatchOptions());
10531
+ this.entryTransformer = new entry_2.default(this._settings);
10532
+ }
10533
+ _getRootDirectory(task) {
10534
+ return path.resolve(this._settings.cwd, task.base);
10535
+ }
10536
+ _getReaderOptions(task) {
10537
+ const basePath = task.base === '.' ? '' : task.base;
10538
+ return {
10539
+ basePath,
10540
+ pathSegmentSeparator: '/',
10541
+ concurrency: this._settings.concurrency,
10542
+ deepFilter: this.deepFilter.getFilter(basePath, task.positive, task.negative),
10543
+ entryFilter: this.entryFilter.getFilter(task.positive, task.negative),
10544
+ errorFilter: this.errorFilter.getFilter(),
10545
+ followSymbolicLinks: this._settings.followSymbolicLinks,
10546
+ fs: this._settings.fs,
10547
+ stats: this._settings.stats,
10548
+ throwErrorOnBrokenSymbolicLink: this._settings.throwErrorOnBrokenSymbolicLink,
10549
+ transform: this.entryTransformer.getTransformer()
10550
+ };
10551
+ }
10552
+ _getMicromatchOptions() {
10553
+ return {
10554
+ dot: this._settings.dot,
10555
+ matchBase: this._settings.baseNameMatch,
10556
+ nobrace: !this._settings.braceExpansion,
10557
+ nocase: !this._settings.caseSensitiveMatch,
10558
+ noext: !this._settings.extglob,
10559
+ noglobstar: !this._settings.globstar,
10560
+ posix: true,
10561
+ strictSlashes: false
10562
+ };
10563
+ }
10564
+ }
10476
10565
  provider.default = Provider;
10477
10566
 
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
- }
10567
+ Object.defineProperty(async$7, "__esModule", { value: true });
10568
+ const async_1$1 = async$6;
10569
+ const provider_1$2 = provider;
10570
+ class ProviderAsync extends provider_1$2.default {
10571
+ constructor() {
10572
+ super(...arguments);
10573
+ this._reader = new async_1$1.default(this._settings);
10574
+ }
10575
+ async read(task) {
10576
+ const root = this._getRootDirectory(task);
10577
+ const options = this._getReaderOptions(task);
10578
+ const entries = await this.api(root, task, options);
10579
+ return entries.map((entry) => options.transform(entry));
10580
+ }
10581
+ api(root, task, options) {
10582
+ if (task.dynamic) {
10583
+ return this._reader.dynamic(root, options);
10584
+ }
10585
+ return this._reader.static(task.patterns, options);
10586
+ }
10587
+ }
10499
10588
  async$7.default = ProviderAsync;
10500
10589
 
10501
10590
  var stream = {};
10502
10591
 
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
- }
10592
+ Object.defineProperty(stream, "__esModule", { value: true });
10593
+ const stream_1$1 = require$$0;
10594
+ const stream_2 = stream$1;
10595
+ const provider_1$1 = provider;
10596
+ class ProviderStream extends provider_1$1.default {
10597
+ constructor() {
10598
+ super(...arguments);
10599
+ this._reader = new stream_2.default(this._settings);
10600
+ }
10601
+ read(task) {
10602
+ const root = this._getRootDirectory(task);
10603
+ const options = this._getReaderOptions(task);
10604
+ const source = this.api(root, task, options);
10605
+ const destination = new stream_1$1.Readable({ objectMode: true, read: () => { } });
10606
+ source
10607
+ .once('error', (error) => destination.emit('error', error))
10608
+ .on('data', (entry) => destination.emit('data', options.transform(entry)))
10609
+ .once('end', () => destination.emit('end'));
10610
+ destination
10611
+ .once('close', () => source.destroy());
10612
+ return destination;
10613
+ }
10614
+ api(root, task, options) {
10615
+ if (task.dynamic) {
10616
+ return this._reader.dynamic(root, options);
10617
+ }
10618
+ return this._reader.static(task.patterns, options);
10619
+ }
10620
+ }
10532
10621
  stream.default = ProviderStream;
10533
10622
 
10534
10623
  var sync$1 = {};
10535
10624
 
10536
10625
  var sync = {};
10537
10626
 
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
- }
10627
+ Object.defineProperty(sync, "__esModule", { value: true });
10628
+ const fsStat = out$1;
10629
+ const fsWalk = out$3;
10630
+ const reader_1 = reader;
10631
+ class ReaderSync extends reader_1.default {
10632
+ constructor() {
10633
+ super(...arguments);
10634
+ this._walkSync = fsWalk.walkSync;
10635
+ this._statSync = fsStat.statSync;
10636
+ }
10637
+ dynamic(root, options) {
10638
+ return this._walkSync(root, options);
10639
+ }
10640
+ static(patterns, options) {
10641
+ const entries = [];
10642
+ for (const pattern of patterns) {
10643
+ const filepath = this._getFullEntryPath(pattern);
10644
+ const entry = this._getEntry(filepath, pattern, options);
10645
+ if (entry === null || !options.entryFilter(entry)) {
10646
+ continue;
10647
+ }
10648
+ entries.push(entry);
10649
+ }
10650
+ return entries;
10651
+ }
10652
+ _getEntry(filepath, pattern, options) {
10653
+ try {
10654
+ const stats = this._getStat(filepath);
10655
+ return this._makeEntry(stats, pattern);
10656
+ }
10657
+ catch (error) {
10658
+ if (options.errorFilter(error)) {
10659
+ return null;
10660
+ }
10661
+ throw error;
10662
+ }
10663
+ }
10664
+ _getStat(filepath) {
10665
+ return this._statSync(filepath, this._fsStatSettings);
10666
+ }
10667
+ }
10579
10668
  sync.default = ReaderSync;
10580
10669
 
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
- }
10670
+ Object.defineProperty(sync$1, "__esModule", { value: true });
10671
+ const sync_1$1 = sync;
10672
+ const provider_1 = provider;
10673
+ class ProviderSync extends provider_1.default {
10674
+ constructor() {
10675
+ super(...arguments);
10676
+ this._reader = new sync_1$1.default(this._settings);
10677
+ }
10678
+ read(task) {
10679
+ const root = this._getRootDirectory(task);
10680
+ const options = this._getReaderOptions(task);
10681
+ const entries = this.api(root, task, options);
10682
+ return entries.map(options.transform);
10683
+ }
10684
+ api(root, task, options) {
10685
+ if (task.dynamic) {
10686
+ return this._reader.dynamic(root, options);
10687
+ }
10688
+ return this._reader.static(task.patterns, options);
10689
+ }
10690
+ }
10602
10691
  sync$1.default = ProviderSync;
10603
10692
 
10604
10693
  var settings = {};
10605
10694
 
10606
10695
  (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
- }
10696
+ Object.defineProperty(exports, "__esModule", { value: true });
10697
+ exports.DEFAULT_FILE_SYSTEM_ADAPTER = void 0;
10698
+ const fs = require$$0$1;
10699
+ const os = require$$0$4;
10700
+ /**
10701
+ * The `os.cpus` method can return zero. We expect the number of cores to be greater than zero.
10702
+ * https://github.com/nodejs/node/blob/7faeddf23a98c53896f8b574a6e66589e8fb1eb8/lib/os.js#L106-L107
10703
+ */
10704
+ const CPU_COUNT = Math.max(os.cpus().length, 1);
10705
+ exports.DEFAULT_FILE_SYSTEM_ADAPTER = {
10706
+ lstat: fs.lstat,
10707
+ lstatSync: fs.lstatSync,
10708
+ stat: fs.stat,
10709
+ statSync: fs.statSync,
10710
+ readdir: fs.readdir,
10711
+ readdirSync: fs.readdirSync
10712
+ };
10713
+ class Settings {
10714
+ constructor(_options = {}) {
10715
+ this._options = _options;
10716
+ this.absolute = this._getValue(this._options.absolute, false);
10717
+ this.baseNameMatch = this._getValue(this._options.baseNameMatch, false);
10718
+ this.braceExpansion = this._getValue(this._options.braceExpansion, true);
10719
+ this.caseSensitiveMatch = this._getValue(this._options.caseSensitiveMatch, true);
10720
+ this.concurrency = this._getValue(this._options.concurrency, CPU_COUNT);
10721
+ this.cwd = this._getValue(this._options.cwd, process.cwd());
10722
+ this.deep = this._getValue(this._options.deep, Infinity);
10723
+ this.dot = this._getValue(this._options.dot, false);
10724
+ this.extglob = this._getValue(this._options.extglob, true);
10725
+ this.followSymbolicLinks = this._getValue(this._options.followSymbolicLinks, true);
10726
+ this.fs = this._getFileSystemMethods(this._options.fs);
10727
+ this.globstar = this._getValue(this._options.globstar, true);
10728
+ this.ignore = this._getValue(this._options.ignore, []);
10729
+ this.markDirectories = this._getValue(this._options.markDirectories, false);
10730
+ this.objectMode = this._getValue(this._options.objectMode, false);
10731
+ this.onlyDirectories = this._getValue(this._options.onlyDirectories, false);
10732
+ this.onlyFiles = this._getValue(this._options.onlyFiles, true);
10733
+ this.stats = this._getValue(this._options.stats, false);
10734
+ this.suppressErrors = this._getValue(this._options.suppressErrors, false);
10735
+ this.throwErrorOnBrokenSymbolicLink = this._getValue(this._options.throwErrorOnBrokenSymbolicLink, false);
10736
+ this.unique = this._getValue(this._options.unique, true);
10737
+ if (this.onlyDirectories) {
10738
+ this.onlyFiles = false;
10739
+ }
10740
+ if (this.stats) {
10741
+ this.objectMode = true;
10742
+ }
10743
+ // Remove the cast to the array in the next major (#404).
10744
+ this.ignore = [].concat(this.ignore);
10745
+ }
10746
+ _getValue(option, value) {
10747
+ return option === undefined ? value : option;
10748
+ }
10749
+ _getFileSystemMethods(methods = {}) {
10750
+ return Object.assign(Object.assign({}, exports.DEFAULT_FILE_SYSTEM_ADAPTER), methods);
10751
+ }
10752
+ }
10662
10753
  exports.default = Settings;
10663
10754
  } (settings));
10664
10755
 
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
- }
10756
+ const taskManager = tasks;
10757
+ const async_1 = async$7;
10758
+ const stream_1 = stream;
10759
+ const sync_1 = sync$1;
10760
+ const settings_1 = settings;
10761
+ const utils = utils$k;
10762
+ async function FastGlob(source, options) {
10763
+ assertPatternsInput(source);
10764
+ const works = getWorks(source, async_1.default, options);
10765
+ const result = await Promise.all(works);
10766
+ return utils.array.flatten(result);
10767
+ }
10768
+ // https://github.com/typescript-eslint/typescript-eslint/issues/60
10769
+ // eslint-disable-next-line no-redeclare
10770
+ (function (FastGlob) {
10771
+ FastGlob.glob = FastGlob;
10772
+ FastGlob.globSync = sync;
10773
+ FastGlob.globStream = stream;
10774
+ FastGlob.async = FastGlob;
10775
+ function sync(source, options) {
10776
+ assertPatternsInput(source);
10777
+ const works = getWorks(source, sync_1.default, options);
10778
+ return utils.array.flatten(works);
10779
+ }
10780
+ FastGlob.sync = sync;
10781
+ function stream(source, options) {
10782
+ assertPatternsInput(source);
10783
+ const works = getWorks(source, stream_1.default, options);
10784
+ /**
10785
+ * The stream returned by the provider cannot work with an asynchronous iterator.
10786
+ * To support asynchronous iterators, regardless of the number of tasks, we always multiplex streams.
10787
+ * This affects performance (+25%). I don't see best solution right now.
10788
+ */
10789
+ return utils.stream.merge(works);
10790
+ }
10791
+ FastGlob.stream = stream;
10792
+ function generateTasks(source, options) {
10793
+ assertPatternsInput(source);
10794
+ const patterns = [].concat(source);
10795
+ const settings = new settings_1.default(options);
10796
+ return taskManager.generate(patterns, settings);
10797
+ }
10798
+ FastGlob.generateTasks = generateTasks;
10799
+ function isDynamicPattern(source, options) {
10800
+ assertPatternsInput(source);
10801
+ const settings = new settings_1.default(options);
10802
+ return utils.pattern.isDynamicPattern(source, settings);
10803
+ }
10804
+ FastGlob.isDynamicPattern = isDynamicPattern;
10805
+ function escapePath(source) {
10806
+ assertPatternsInput(source);
10807
+ return utils.path.escape(source);
10808
+ }
10809
+ FastGlob.escapePath = escapePath;
10810
+ function convertPathToPattern(source) {
10811
+ assertPatternsInput(source);
10812
+ return utils.path.convertPathToPattern(source);
10813
+ }
10814
+ FastGlob.convertPathToPattern = convertPathToPattern;
10815
+ (function (posix) {
10816
+ function escapePath(source) {
10817
+ assertPatternsInput(source);
10818
+ return utils.path.escapePosixPath(source);
10819
+ }
10820
+ posix.escapePath = escapePath;
10821
+ function convertPathToPattern(source) {
10822
+ assertPatternsInput(source);
10823
+ return utils.path.convertPosixPathToPattern(source);
10824
+ }
10825
+ posix.convertPathToPattern = convertPathToPattern;
10826
+ })(FastGlob.posix || (FastGlob.posix = {}));
10827
+ (function (win32) {
10828
+ function escapePath(source) {
10829
+ assertPatternsInput(source);
10830
+ return utils.path.escapeWindowsPath(source);
10831
+ }
10832
+ win32.escapePath = escapePath;
10833
+ function convertPathToPattern(source) {
10834
+ assertPatternsInput(source);
10835
+ return utils.path.convertWindowsPathToPattern(source);
10836
+ }
10837
+ win32.convertPathToPattern = convertPathToPattern;
10838
+ })(FastGlob.win32 || (FastGlob.win32 = {}));
10839
+ })(FastGlob || (FastGlob = {}));
10840
+ function getWorks(source, _Provider, options) {
10841
+ const patterns = [].concat(source);
10842
+ const settings = new settings_1.default(options);
10843
+ const tasks = taskManager.generate(patterns, settings);
10844
+ const provider = new _Provider(settings);
10845
+ return tasks.map(provider.read, provider);
10846
+ }
10847
+ function assertPatternsInput(input) {
10848
+ const source = [].concat(input);
10849
+ const isValidSource = source.every((item) => utils.string.isString(item) && !utils.string.isEmpty(item));
10850
+ if (!isValidSource) {
10851
+ throw new TypeError('Patterns must be a string (non empty) or an array of strings');
10852
+ }
10853
+ }
10731
10854
  var out = FastGlob;
10732
10855
 
10733
10856
  var fg = /*@__PURE__*/getDefaultExportFromCjs(out);
10734
10857
 
10858
+ const defaultOptions = {
10859
+ hostname: "http://localhost/",
10860
+ dynamicRoutes: [],
10861
+ exclude: [],
10862
+ basePath: "",
10863
+ outDir: "dist",
10864
+ extensions: "html",
10865
+ changefreq: "daily",
10866
+ priority: 1,
10867
+ lastmod: /* @__PURE__ */ new Date(),
10868
+ readable: false,
10869
+ generateRobotsTxt: true,
10870
+ robots: [{
10871
+ userAgent: "*",
10872
+ allow: "/"
10873
+ }]
10874
+ };
10735
10875
  function resolveOptions(userOptions) {
10736
10876
  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
- },
10877
+ {},
10878
+ defaultOptions,
10754
10879
  userOptions
10755
10880
  );
10756
10881
  }
@@ -10815,12 +10940,22 @@ function getRoutes(options) {
10815
10940
  ...options.dynamicRoutes.map((route) => slash$1(node_path.join("/", node_path.join(node_path.parse(route).dir, node_path.parse(route).name))))
10816
10941
  ].filter((route) => !options.exclude.includes(route));
10817
10942
  }
10943
+ function getOptionByRoute(options, route) {
10944
+ if (options instanceof Date || typeof options === "string" || typeof options === "number")
10945
+ return options;
10946
+ const givenRoutes = Object.keys(options);
10947
+ if (givenRoutes.includes(route))
10948
+ return options[route];
10949
+ if (givenRoutes.includes("*"))
10950
+ return options["*"];
10951
+ return void 0;
10952
+ }
10818
10953
  function getFormattedSitemap(options, routes) {
10819
10954
  return routes.map((route) => ({
10820
10955
  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
10956
+ changefreq: getOptionByRoute(options.changefreq, route) ?? defaultOptions.changefreq,
10957
+ priority: getOptionByRoute(options.priority, route) ?? defaultOptions.priority,
10958
+ lastmod: getOptionByRoute(options.lastmod, route) ?? defaultOptions.lastmod
10824
10959
  }));
10825
10960
  }
10826
10961