vite-plugin-sitemap 0.5.0 → 0.5.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.mjs CHANGED
@@ -10,8 +10,8 @@ import require$$1$1 from 'string_decoder';
10
10
  import require$$1$2 from 'zlib';
11
11
  import require$$0$3 from 'util';
12
12
  import { isAbsolute, resolve, parse as parse$4, join } from 'node:path';
13
- import require$$2$1 from 'os';
14
- import require$$0$4 from 'events';
13
+ import require$$0$4 from 'os';
14
+ import require$$0$5 from 'events';
15
15
 
16
16
  var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
17
17
 
@@ -1452,6 +1452,7 @@ var sax = {};
1452
1452
  } catch (ex) {
1453
1453
  Stream = function () {};
1454
1454
  }
1455
+ if (!Stream) Stream = function () {};
1455
1456
 
1456
1457
  var streamWraps = sax.EVENTS.filter(function (ev) {
1457
1458
  return ev !== 'error' && ev !== 'end'
@@ -2768,9 +2769,16 @@ var sax = {};
2768
2769
  }
2769
2770
 
2770
2771
  if (c === ';') {
2771
- parser[buffer] += parseEntity(parser);
2772
- parser.entity = '';
2773
- parser.state = returnState;
2772
+ if (parser.opt.unparsedEntities) {
2773
+ var parsedEntity = parseEntity(parser);
2774
+ parser.entity = '';
2775
+ parser.state = returnState;
2776
+ parser.write(parsedEntity);
2777
+ } else {
2778
+ parser[buffer] += parseEntity(parser);
2779
+ parser.entity = '';
2780
+ parser.state = returnState;
2781
+ }
2774
2782
  } else if (isMatch(parser.entity.length ? entityBody : entityStart, c)) {
2775
2783
  parser.entity += c;
2776
2784
  } else {
@@ -2782,8 +2790,9 @@ var sax = {};
2782
2790
 
2783
2791
  continue
2784
2792
 
2785
- default:
2793
+ default: /* istanbul ignore next */ {
2786
2794
  throw new Error(parser, 'Unknown state: ' + parser.state)
2795
+ }
2787
2796
  }
2788
2797
  } // while
2789
2798
 
@@ -3699,8 +3708,6 @@ var cjs$1 = {exports: {}};
3699
3708
 
3700
3709
  var cjs = {exports: {}};
3701
3710
 
3702
- cjs.exports;
3703
-
3704
3711
  (function (module, exports) {
3705
3712
  Object.defineProperty(exports, "__esModule", { value: true });
3706
3713
  exports.ParsingError = void 0;
@@ -3814,14 +3821,28 @@ cjs.exports;
3814
3821
  child = nextChild();
3815
3822
  }
3816
3823
  // closing
3817
- match(/^<\/\s*[\w-:.\u00C0-\u00FF]+>/);
3824
+ if (parsingState.options.strictMode) {
3825
+ const closingTag = `</${node.name}>`;
3826
+ if (parsingState.xml.startsWith(closingTag)) {
3827
+ parsingState.xml = parsingState.xml.slice(closingTag.length);
3828
+ }
3829
+ else {
3830
+ throw new ParsingError('Failed to parse XML', `Closing tag not matching "${closingTag}"`);
3831
+ }
3832
+ }
3833
+ else {
3834
+ match(/^<\/\s*[\w-:.\u00C0-\u00FF]+>/);
3835
+ }
3818
3836
  return {
3819
3837
  excluded,
3820
3838
  node
3821
3839
  };
3822
3840
  }
3823
3841
  function doctype() {
3824
- const m = match(/^<!DOCTYPE\s+[^>]*>/);
3842
+ const m = match(/^<!DOCTYPE\s+\S+\s+SYSTEM[^>]*>/) ||
3843
+ match(/^<!DOCTYPE\s+\S+\s+PUBLIC[^>]*>/) ||
3844
+ match(/^<!DOCTYPE\s+\S+\s*\[[^\]]*]>/) ||
3845
+ match(/^<!DOCTYPE\s+\S+\s*>/);
3825
3846
  if (m) {
3826
3847
  const node = {
3827
3848
  type: 'DocumentType',
@@ -3918,7 +3939,7 @@ cjs.exports;
3918
3939
  const filter = options.filter || (() => true);
3919
3940
  parsingState = {
3920
3941
  xml,
3921
- options: Object.assign(Object.assign({}, options), { filter })
3942
+ options: Object.assign(Object.assign({}, options), { filter, strictMode: options.strictMode === true })
3922
3943
  };
3923
3944
  return parseDocument();
3924
3945
  }
@@ -3931,8 +3952,6 @@ cjs.exports;
3931
3952
 
3932
3953
  var cjsExports$1 = cjs.exports;
3933
3954
 
3934
- cjs$1.exports;
3935
-
3936
3955
  (function (module, exports) {
3937
3956
  var __importDefault = (commonjsGlobal && commonjsGlobal.__importDefault) || function (mod) {
3938
3957
  return (mod && mod.__esModule) ? mod : { "default": mod };
@@ -3948,6 +3967,13 @@ cjs$1.exports;
3948
3967
  state.content += state.options.indentation;
3949
3968
  }
3950
3969
  }
3970
+ function indent(state) {
3971
+ state.content = state.content.replace(/ +$/, '');
3972
+ let i;
3973
+ for (i = 0; i < state.level; i++) {
3974
+ state.content += state.options.indentation;
3975
+ }
3976
+ }
3951
3977
  function appendContent(state, content) {
3952
3978
  state.content += content;
3953
3979
  }
@@ -3982,13 +4008,19 @@ cjs$1.exports;
3982
4008
  appendContent(state, content);
3983
4009
  }
3984
4010
  }
4011
+ function isPathMatchingIgnoredPaths(path, ignoredPaths) {
4012
+ const fullPath = '/' + path.join('/');
4013
+ const pathLastPart = path[path.length - 1];
4014
+ return ignoredPaths.includes(pathLastPart) || ignoredPaths.includes(fullPath);
4015
+ }
3985
4016
  function processElementNode(node, state, preserveSpace) {
4017
+ state.path.push(node.name);
3986
4018
  if (!preserveSpace && state.content.length > 0) {
3987
4019
  newLine(state);
3988
4020
  }
3989
4021
  appendContent(state, '<' + node.name);
3990
4022
  processAttributes(state, node.attributes);
3991
- if (node.children === null) {
4023
+ if (node.children === null || (state.options.forceSelfClosingEmptyTag && node.children.length === 0)) {
3992
4024
  const selfClosingNodeClosingTag = state.options.whiteSpaceAtEndOfSelfclosingTag ? ' />' : '/>';
3993
4025
  // self-closing node
3994
4026
  appendContent(state, selfClosingNodeClosingTag);
@@ -4002,6 +4034,11 @@ cjs$1.exports;
4002
4034
  appendContent(state, '>');
4003
4035
  state.level++;
4004
4036
  let nodePreserveSpace = node.attributes['xml:space'] === 'preserve';
4037
+ let ignoredPath = false;
4038
+ if (!nodePreserveSpace && state.options.ignoredPaths) {
4039
+ ignoredPath = isPathMatchingIgnoredPaths(state.path, state.options.ignoredPaths);
4040
+ nodePreserveSpace = ignoredPath;
4041
+ }
4005
4042
  if (!nodePreserveSpace && state.options.collapseContent) {
4006
4043
  let containsTextNodes = false;
4007
4044
  let containsTextNodesWithLineBreaks = false;
@@ -4040,8 +4077,12 @@ cjs$1.exports;
4040
4077
  if (!preserveSpace && !nodePreserveSpace) {
4041
4078
  newLine(state);
4042
4079
  }
4080
+ if (ignoredPath) {
4081
+ indent(state);
4082
+ }
4043
4083
  appendContent(state, '</' + node.name + '>');
4044
4084
  }
4085
+ state.path.pop();
4045
4086
  }
4046
4087
  function processAttributes(state, attributes) {
4047
4088
  Object.keys(attributes).forEach(function (attr) {
@@ -4067,8 +4108,8 @@ cjs$1.exports;
4067
4108
  options.whiteSpaceAtEndOfSelfclosingTag = options.whiteSpaceAtEndOfSelfclosingTag === true;
4068
4109
  options.throwOnFailure = options.throwOnFailure !== false;
4069
4110
  try {
4070
- const parsedXml = (0, xml_parser_xo_1.default)(xml, { filter: options.filter });
4071
- const state = { content: '', level: 0, options: options };
4111
+ const parsedXml = (0, xml_parser_xo_1.default)(xml, { filter: options.filter, strictMode: options.strictMode });
4112
+ const state = { content: '', level: 0, options: options, path: [] };
4072
4113
  if (parsedXml.declaration) {
4073
4114
  processProcessingIntruction(parsedXml.declaration, state);
4074
4115
  }
@@ -4110,11 +4151,6 @@ function ensurePrefix(prefix, str) {
4110
4151
  return prefix + str;
4111
4152
  return str;
4112
4153
  }
4113
- function ensureSuffix(suffix, str) {
4114
- if (!str.endsWith(suffix))
4115
- return str + suffix;
4116
- return str;
4117
- }
4118
4154
 
4119
4155
  var tasks = {};
4120
4156
 
@@ -4122,92 +4158,127 @@ var utils$k = {};
4122
4158
 
4123
4159
  var array$1 = {};
4124
4160
 
4125
- Object.defineProperty(array$1, "__esModule", { value: true });
4126
- array$1.splitWhen = array$1.flatten = void 0;
4127
- function flatten(items) {
4128
- return items.reduce((collection, item) => [].concat(collection, item), []);
4129
- }
4130
- array$1.flatten = flatten;
4131
- function splitWhen(items, predicate) {
4132
- const result = [[]];
4133
- let groupIndex = 0;
4134
- for (const item of items) {
4135
- if (predicate(item)) {
4136
- groupIndex++;
4137
- result[groupIndex] = [];
4138
- }
4139
- else {
4140
- result[groupIndex].push(item);
4141
- }
4142
- }
4143
- return result;
4144
- }
4161
+ Object.defineProperty(array$1, "__esModule", { value: true });
4162
+ array$1.splitWhen = array$1.flatten = void 0;
4163
+ function flatten(items) {
4164
+ return items.reduce((collection, item) => [].concat(collection, item), []);
4165
+ }
4166
+ array$1.flatten = flatten;
4167
+ function splitWhen(items, predicate) {
4168
+ const result = [[]];
4169
+ let groupIndex = 0;
4170
+ for (const item of items) {
4171
+ if (predicate(item)) {
4172
+ groupIndex++;
4173
+ result[groupIndex] = [];
4174
+ }
4175
+ else {
4176
+ result[groupIndex].push(item);
4177
+ }
4178
+ }
4179
+ return result;
4180
+ }
4145
4181
  array$1.splitWhen = splitWhen;
4146
4182
 
4147
4183
  var errno$1 = {};
4148
4184
 
4149
- Object.defineProperty(errno$1, "__esModule", { value: true });
4150
- errno$1.isEnoentCodeError = void 0;
4151
- function isEnoentCodeError(error) {
4152
- return error.code === 'ENOENT';
4153
- }
4185
+ Object.defineProperty(errno$1, "__esModule", { value: true });
4186
+ errno$1.isEnoentCodeError = void 0;
4187
+ function isEnoentCodeError(error) {
4188
+ return error.code === 'ENOENT';
4189
+ }
4154
4190
  errno$1.isEnoentCodeError = isEnoentCodeError;
4155
4191
 
4156
4192
  var fs$7 = {};
4157
4193
 
4158
- Object.defineProperty(fs$7, "__esModule", { value: true });
4159
- fs$7.createDirentFromStats = void 0;
4160
- class DirentFromStats$1 {
4161
- constructor(name, stats) {
4162
- this.name = name;
4163
- this.isBlockDevice = stats.isBlockDevice.bind(stats);
4164
- this.isCharacterDevice = stats.isCharacterDevice.bind(stats);
4165
- this.isDirectory = stats.isDirectory.bind(stats);
4166
- this.isFIFO = stats.isFIFO.bind(stats);
4167
- this.isFile = stats.isFile.bind(stats);
4168
- this.isSocket = stats.isSocket.bind(stats);
4169
- this.isSymbolicLink = stats.isSymbolicLink.bind(stats);
4170
- }
4171
- }
4172
- function createDirentFromStats$1(name, stats) {
4173
- return new DirentFromStats$1(name, stats);
4174
- }
4194
+ Object.defineProperty(fs$7, "__esModule", { value: true });
4195
+ fs$7.createDirentFromStats = void 0;
4196
+ let DirentFromStats$1 = class DirentFromStats {
4197
+ constructor(name, stats) {
4198
+ this.name = name;
4199
+ this.isBlockDevice = stats.isBlockDevice.bind(stats);
4200
+ this.isCharacterDevice = stats.isCharacterDevice.bind(stats);
4201
+ this.isDirectory = stats.isDirectory.bind(stats);
4202
+ this.isFIFO = stats.isFIFO.bind(stats);
4203
+ this.isFile = stats.isFile.bind(stats);
4204
+ this.isSocket = stats.isSocket.bind(stats);
4205
+ this.isSymbolicLink = stats.isSymbolicLink.bind(stats);
4206
+ }
4207
+ };
4208
+ function createDirentFromStats$1(name, stats) {
4209
+ return new DirentFromStats$1(name, stats);
4210
+ }
4175
4211
  fs$7.createDirentFromStats = createDirentFromStats$1;
4176
4212
 
4177
4213
  var path$9 = {};
4178
4214
 
4179
- Object.defineProperty(path$9, "__esModule", { value: true });
4180
- path$9.removeLeadingDotSegment = path$9.escape = path$9.makeAbsolute = path$9.unixify = void 0;
4181
- const path$8 = require$$0$2;
4182
- const LEADING_DOT_SEGMENT_CHARACTERS_COUNT = 2; // ./ or .\\
4183
- const UNESCAPED_GLOB_SYMBOLS_RE = /(\\?)([()*?[\]{|}]|^!|[!+@](?=\())/g;
4184
- /**
4185
- * Designed to work only with simple paths: `dir\\file`.
4186
- */
4187
- function unixify(filepath) {
4188
- return filepath.replace(/\\/g, '/');
4189
- }
4190
- path$9.unixify = unixify;
4191
- function makeAbsolute(cwd, filepath) {
4192
- return path$8.resolve(cwd, filepath);
4193
- }
4194
- path$9.makeAbsolute = makeAbsolute;
4195
- function escape(pattern) {
4196
- return pattern.replace(UNESCAPED_GLOB_SYMBOLS_RE, '\\$2');
4197
- }
4198
- path$9.escape = escape;
4199
- function removeLeadingDotSegment(entry) {
4200
- // We do not use `startsWith` because this is 10x slower than current implementation for some cases.
4201
- // eslint-disable-next-line @typescript-eslint/prefer-string-starts-ends-with
4202
- if (entry.charAt(0) === '.') {
4203
- const secondCharactery = entry.charAt(1);
4204
- if (secondCharactery === '/' || secondCharactery === '\\') {
4205
- return entry.slice(LEADING_DOT_SEGMENT_CHARACTERS_COUNT);
4206
- }
4207
- }
4208
- return entry;
4209
- }
4215
+ Object.defineProperty(path$9, "__esModule", { value: true });
4216
+ 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;
4217
+ const os = require$$0$4;
4218
+ const path$8 = require$$0$2;
4219
+ const IS_WINDOWS_PLATFORM = os.platform() === 'win32';
4220
+ const LEADING_DOT_SEGMENT_CHARACTERS_COUNT = 2; // ./ or .\\
4221
+ /**
4222
+ * All non-escaped special characters.
4223
+ * Posix: ()*?[\]{|}, !+@ before (, ! at the beginning, \\ before non-special characters.
4224
+ * Windows: (){}, !+@ before (, ! at the beginning.
4225
+ */
4226
+ const POSIX_UNESCAPED_GLOB_SYMBOLS_RE = /(\\?)([()*?[\]{|}]|^!|[!+@](?=\()|\\(?![!()*+?@[\]{|}]))/g;
4227
+ const WINDOWS_UNESCAPED_GLOB_SYMBOLS_RE = /(\\?)([(){}]|^!|[!+@](?=\())/g;
4228
+ /**
4229
+ * The device path (\\.\ or \\?\).
4230
+ * https://learn.microsoft.com/en-us/dotnet/standard/io/file-path-formats#dos-device-paths
4231
+ */
4232
+ const DOS_DEVICE_PATH_RE = /^\\\\([.?])/;
4233
+ /**
4234
+ * All backslashes except those escaping special characters.
4235
+ * Windows: !()+@{}
4236
+ * https://learn.microsoft.com/en-us/windows/win32/fileio/naming-a-file#naming-conventions
4237
+ */
4238
+ const WINDOWS_BACKSLASHES_RE = /\\(?![!()+@{}])/g;
4239
+ /**
4240
+ * Designed to work only with simple paths: `dir\\file`.
4241
+ */
4242
+ function unixify(filepath) {
4243
+ return filepath.replace(/\\/g, '/');
4244
+ }
4245
+ path$9.unixify = unixify;
4246
+ function makeAbsolute(cwd, filepath) {
4247
+ return path$8.resolve(cwd, filepath);
4248
+ }
4249
+ path$9.makeAbsolute = makeAbsolute;
4250
+ function removeLeadingDotSegment(entry) {
4251
+ // We do not use `startsWith` because this is 10x slower than current implementation for some cases.
4252
+ // eslint-disable-next-line @typescript-eslint/prefer-string-starts-ends-with
4253
+ if (entry.charAt(0) === '.') {
4254
+ const secondCharactery = entry.charAt(1);
4255
+ if (secondCharactery === '/' || secondCharactery === '\\') {
4256
+ return entry.slice(LEADING_DOT_SEGMENT_CHARACTERS_COUNT);
4257
+ }
4258
+ }
4259
+ return entry;
4260
+ }
4210
4261
  path$9.removeLeadingDotSegment = removeLeadingDotSegment;
4262
+ path$9.escape = IS_WINDOWS_PLATFORM ? escapeWindowsPath : escapePosixPath;
4263
+ function escapeWindowsPath(pattern) {
4264
+ return pattern.replace(WINDOWS_UNESCAPED_GLOB_SYMBOLS_RE, '\\$2');
4265
+ }
4266
+ path$9.escapeWindowsPath = escapeWindowsPath;
4267
+ function escapePosixPath(pattern) {
4268
+ return pattern.replace(POSIX_UNESCAPED_GLOB_SYMBOLS_RE, '\\$2');
4269
+ }
4270
+ path$9.escapePosixPath = escapePosixPath;
4271
+ path$9.convertPathToPattern = IS_WINDOWS_PLATFORM ? convertWindowsPathToPattern : convertPosixPathToPattern;
4272
+ function convertWindowsPathToPattern(filepath) {
4273
+ return escapeWindowsPath(filepath)
4274
+ .replace(DOS_DEVICE_PATH_RE, '//$1')
4275
+ .replace(WINDOWS_BACKSLASHES_RE, '/');
4276
+ }
4277
+ path$9.convertWindowsPathToPattern = convertWindowsPathToPattern;
4278
+ function convertPosixPathToPattern(filepath) {
4279
+ return escapePosixPath(filepath);
4280
+ }
4281
+ path$9.convertPosixPathToPattern = convertPosixPathToPattern;
4211
4282
 
4212
4283
  var pattern$1 = {};
4213
4284
 
@@ -4385,7 +4456,7 @@ var isGlob$1 = function isGlob(str, options) {
4385
4456
 
4386
4457
  var isGlob = isGlob$1;
4387
4458
  var pathPosixDirname = require$$0$2.posix.dirname;
4388
- var isWin32 = require$$2$1.platform() === 'win32';
4459
+ var isWin32 = require$$0$4.platform() === 'win32';
4389
4460
 
4390
4461
  var slash = '/';
4391
4462
  var backslash = /\\/g;
@@ -4886,7 +4957,7 @@ const toRegexRange = toRegexRange_1;
4886
4957
 
4887
4958
  const isObject$1 = val => val !== null && typeof val === 'object' && !Array.isArray(val);
4888
4959
 
4889
- const transform$1 = toNumber => {
4960
+ const transform = toNumber => {
4890
4961
  return value => toNumber === true ? Number(value) : String(value);
4891
4962
  };
4892
4963
 
@@ -5023,7 +5094,7 @@ const fillNumbers = (start, end, step = 1, options = {}) => {
5023
5094
  let padded = zeros(startString) || zeros(endString) || zeros(stepString);
5024
5095
  let maxLen = padded ? Math.max(startString.length, endString.length, stepString.length) : 0;
5025
5096
  let toNumber = padded === false && stringify$3(start, end, options) === false;
5026
- let format = options.transform || transform$1(toNumber);
5097
+ let format = options.transform || transform(toNumber);
5027
5098
 
5028
5099
  if (options.toRegex && step === 1) {
5029
5100
  return toRange(toMaxLen(start, maxLen), toMaxLen(end, maxLen), true, options);
@@ -8379,174 +8450,193 @@ micromatch$1.braceExpand = (pattern, options) => {
8379
8450
 
8380
8451
  var micromatch_1 = micromatch$1;
8381
8452
 
8382
- Object.defineProperty(pattern$1, "__esModule", { value: true });
8383
- 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;
8384
- const path$5 = require$$0$2;
8385
- const globParent = globParent$1;
8386
- const micromatch = micromatch_1;
8387
- const GLOBSTAR = '**';
8388
- const ESCAPE_SYMBOL = '\\';
8389
- const COMMON_GLOB_SYMBOLS_RE = /[*?]|^!/;
8390
- const REGEX_CHARACTER_CLASS_SYMBOLS_RE = /\[[^[]*]/;
8391
- const REGEX_GROUP_SYMBOLS_RE = /(?:^|[^!*+?@])\([^(]*\|[^|]*\)/;
8392
- const GLOB_EXTENSION_SYMBOLS_RE = /[!*+?@]\([^(]*\)/;
8393
- const BRACE_EXPANSION_SEPARATORS_RE = /,|\.\./;
8394
- function isStaticPattern(pattern, options = {}) {
8395
- return !isDynamicPattern(pattern, options);
8396
- }
8397
- pattern$1.isStaticPattern = isStaticPattern;
8398
- function isDynamicPattern(pattern, options = {}) {
8399
- /**
8400
- * A special case with an empty string is necessary for matching patterns that start with a forward slash.
8401
- * An empty string cannot be a dynamic pattern.
8402
- * For example, the pattern `/lib/*` will be spread into parts: '', 'lib', '*'.
8403
- */
8404
- if (pattern === '') {
8405
- return false;
8406
- }
8407
- /**
8408
- * When the `caseSensitiveMatch` option is disabled, all patterns must be marked as dynamic, because we cannot check
8409
- * filepath directly (without read directory).
8410
- */
8411
- if (options.caseSensitiveMatch === false || pattern.includes(ESCAPE_SYMBOL)) {
8412
- return true;
8413
- }
8414
- if (COMMON_GLOB_SYMBOLS_RE.test(pattern) || REGEX_CHARACTER_CLASS_SYMBOLS_RE.test(pattern) || REGEX_GROUP_SYMBOLS_RE.test(pattern)) {
8415
- return true;
8416
- }
8417
- if (options.extglob !== false && GLOB_EXTENSION_SYMBOLS_RE.test(pattern)) {
8418
- return true;
8419
- }
8420
- if (options.braceExpansion !== false && hasBraceExpansion(pattern)) {
8421
- return true;
8422
- }
8423
- return false;
8424
- }
8425
- pattern$1.isDynamicPattern = isDynamicPattern;
8426
- function hasBraceExpansion(pattern) {
8427
- const openingBraceIndex = pattern.indexOf('{');
8428
- if (openingBraceIndex === -1) {
8429
- return false;
8430
- }
8431
- const closingBraceIndex = pattern.indexOf('}', openingBraceIndex + 1);
8432
- if (closingBraceIndex === -1) {
8433
- return false;
8434
- }
8435
- const braceContent = pattern.slice(openingBraceIndex, closingBraceIndex);
8436
- return BRACE_EXPANSION_SEPARATORS_RE.test(braceContent);
8437
- }
8438
- function convertToPositivePattern(pattern) {
8439
- return isNegativePattern(pattern) ? pattern.slice(1) : pattern;
8440
- }
8441
- pattern$1.convertToPositivePattern = convertToPositivePattern;
8442
- function convertToNegativePattern(pattern) {
8443
- return '!' + pattern;
8444
- }
8445
- pattern$1.convertToNegativePattern = convertToNegativePattern;
8446
- function isNegativePattern(pattern) {
8447
- return pattern.startsWith('!') && pattern[1] !== '(';
8448
- }
8449
- pattern$1.isNegativePattern = isNegativePattern;
8450
- function isPositivePattern(pattern) {
8451
- return !isNegativePattern(pattern);
8452
- }
8453
- pattern$1.isPositivePattern = isPositivePattern;
8454
- function getNegativePatterns(patterns) {
8455
- return patterns.filter(isNegativePattern);
8456
- }
8457
- pattern$1.getNegativePatterns = getNegativePatterns;
8458
- function getPositivePatterns$1(patterns) {
8459
- return patterns.filter(isPositivePattern);
8460
- }
8461
- pattern$1.getPositivePatterns = getPositivePatterns$1;
8462
- /**
8463
- * Returns patterns that can be applied inside the current directory.
8464
- *
8465
- * @example
8466
- * // ['./*', '*', 'a/*']
8467
- * getPatternsInsideCurrentDirectory(['./*', '*', 'a/*', '../*', './../*'])
8468
- */
8469
- function getPatternsInsideCurrentDirectory(patterns) {
8470
- return patterns.filter((pattern) => !isPatternRelatedToParentDirectory(pattern));
8471
- }
8472
- pattern$1.getPatternsInsideCurrentDirectory = getPatternsInsideCurrentDirectory;
8473
- /**
8474
- * Returns patterns to be expanded relative to (outside) the current directory.
8475
- *
8476
- * @example
8477
- * // ['../*', './../*']
8478
- * getPatternsInsideCurrentDirectory(['./*', '*', 'a/*', '../*', './../*'])
8479
- */
8480
- function getPatternsOutsideCurrentDirectory(patterns) {
8481
- return patterns.filter(isPatternRelatedToParentDirectory);
8482
- }
8483
- pattern$1.getPatternsOutsideCurrentDirectory = getPatternsOutsideCurrentDirectory;
8484
- function isPatternRelatedToParentDirectory(pattern) {
8485
- return pattern.startsWith('..') || pattern.startsWith('./..');
8486
- }
8487
- pattern$1.isPatternRelatedToParentDirectory = isPatternRelatedToParentDirectory;
8488
- function getBaseDirectory(pattern) {
8489
- return globParent(pattern, { flipBackslashes: false });
8490
- }
8491
- pattern$1.getBaseDirectory = getBaseDirectory;
8492
- function hasGlobStar(pattern) {
8493
- return pattern.includes(GLOBSTAR);
8494
- }
8495
- pattern$1.hasGlobStar = hasGlobStar;
8496
- function endsWithSlashGlobStar(pattern) {
8497
- return pattern.endsWith('/' + GLOBSTAR);
8498
- }
8499
- pattern$1.endsWithSlashGlobStar = endsWithSlashGlobStar;
8500
- function isAffectDepthOfReadingPattern(pattern) {
8501
- const basename = path$5.basename(pattern);
8502
- return endsWithSlashGlobStar(pattern) || isStaticPattern(basename);
8503
- }
8504
- pattern$1.isAffectDepthOfReadingPattern = isAffectDepthOfReadingPattern;
8505
- function expandPatternsWithBraceExpansion(patterns) {
8506
- return patterns.reduce((collection, pattern) => {
8507
- return collection.concat(expandBraceExpansion(pattern));
8508
- }, []);
8509
- }
8510
- pattern$1.expandPatternsWithBraceExpansion = expandPatternsWithBraceExpansion;
8511
- function expandBraceExpansion(pattern) {
8512
- return micromatch.braces(pattern, {
8513
- expand: true,
8514
- nodupes: true
8515
- });
8516
- }
8517
- pattern$1.expandBraceExpansion = expandBraceExpansion;
8518
- function getPatternParts(pattern, options) {
8519
- let { parts } = micromatch.scan(pattern, Object.assign(Object.assign({}, options), { parts: true }));
8520
- /**
8521
- * The scan method returns an empty array in some cases.
8522
- * See micromatch/picomatch#58 for more details.
8523
- */
8524
- if (parts.length === 0) {
8525
- parts = [pattern];
8526
- }
8527
- /**
8528
- * The scan method does not return an empty part for the pattern with a forward slash.
8529
- * This is another part of micromatch/picomatch#58.
8530
- */
8531
- if (parts[0].startsWith('/')) {
8532
- parts[0] = parts[0].slice(1);
8533
- parts.unshift('');
8534
- }
8535
- return parts;
8536
- }
8537
- pattern$1.getPatternParts = getPatternParts;
8538
- function makeRe(pattern, options) {
8539
- return micromatch.makeRe(pattern, options);
8540
- }
8541
- pattern$1.makeRe = makeRe;
8542
- function convertPatternsToRe(patterns, options) {
8543
- return patterns.map((pattern) => makeRe(pattern, options));
8544
- }
8545
- pattern$1.convertPatternsToRe = convertPatternsToRe;
8546
- function matchAny(entry, patternsRe) {
8547
- return patternsRe.some((patternRe) => patternRe.test(entry));
8548
- }
8453
+ Object.defineProperty(pattern$1, "__esModule", { value: true });
8454
+ 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;
8455
+ const path$5 = require$$0$2;
8456
+ const globParent = globParent$1;
8457
+ const micromatch = micromatch_1;
8458
+ const GLOBSTAR = '**';
8459
+ const ESCAPE_SYMBOL = '\\';
8460
+ const COMMON_GLOB_SYMBOLS_RE = /[*?]|^!/;
8461
+ const REGEX_CHARACTER_CLASS_SYMBOLS_RE = /\[[^[]*]/;
8462
+ const REGEX_GROUP_SYMBOLS_RE = /(?:^|[^!*+?@])\([^(]*\|[^|]*\)/;
8463
+ const GLOB_EXTENSION_SYMBOLS_RE = /[!*+?@]\([^(]*\)/;
8464
+ const BRACE_EXPANSION_SEPARATORS_RE = /,|\.\./;
8465
+ /**
8466
+ * Matches a sequence of two or more consecutive slashes, excluding the first two slashes at the beginning of the string.
8467
+ * The latter is due to the presence of the device path at the beginning of the UNC path.
8468
+ */
8469
+ const DOUBLE_SLASH_RE = /(?!^)\/{2,}/g;
8470
+ function isStaticPattern(pattern, options = {}) {
8471
+ return !isDynamicPattern(pattern, options);
8472
+ }
8473
+ pattern$1.isStaticPattern = isStaticPattern;
8474
+ function isDynamicPattern(pattern, options = {}) {
8475
+ /**
8476
+ * A special case with an empty string is necessary for matching patterns that start with a forward slash.
8477
+ * An empty string cannot be a dynamic pattern.
8478
+ * For example, the pattern `/lib/*` will be spread into parts: '', 'lib', '*'.
8479
+ */
8480
+ if (pattern === '') {
8481
+ return false;
8482
+ }
8483
+ /**
8484
+ * When the `caseSensitiveMatch` option is disabled, all patterns must be marked as dynamic, because we cannot check
8485
+ * filepath directly (without read directory).
8486
+ */
8487
+ if (options.caseSensitiveMatch === false || pattern.includes(ESCAPE_SYMBOL)) {
8488
+ return true;
8489
+ }
8490
+ if (COMMON_GLOB_SYMBOLS_RE.test(pattern) || REGEX_CHARACTER_CLASS_SYMBOLS_RE.test(pattern) || REGEX_GROUP_SYMBOLS_RE.test(pattern)) {
8491
+ return true;
8492
+ }
8493
+ if (options.extglob !== false && GLOB_EXTENSION_SYMBOLS_RE.test(pattern)) {
8494
+ return true;
8495
+ }
8496
+ if (options.braceExpansion !== false && hasBraceExpansion(pattern)) {
8497
+ return true;
8498
+ }
8499
+ return false;
8500
+ }
8501
+ pattern$1.isDynamicPattern = isDynamicPattern;
8502
+ function hasBraceExpansion(pattern) {
8503
+ const openingBraceIndex = pattern.indexOf('{');
8504
+ if (openingBraceIndex === -1) {
8505
+ return false;
8506
+ }
8507
+ const closingBraceIndex = pattern.indexOf('}', openingBraceIndex + 1);
8508
+ if (closingBraceIndex === -1) {
8509
+ return false;
8510
+ }
8511
+ const braceContent = pattern.slice(openingBraceIndex, closingBraceIndex);
8512
+ return BRACE_EXPANSION_SEPARATORS_RE.test(braceContent);
8513
+ }
8514
+ function convertToPositivePattern(pattern) {
8515
+ return isNegativePattern(pattern) ? pattern.slice(1) : pattern;
8516
+ }
8517
+ pattern$1.convertToPositivePattern = convertToPositivePattern;
8518
+ function convertToNegativePattern(pattern) {
8519
+ return '!' + pattern;
8520
+ }
8521
+ pattern$1.convertToNegativePattern = convertToNegativePattern;
8522
+ function isNegativePattern(pattern) {
8523
+ return pattern.startsWith('!') && pattern[1] !== '(';
8524
+ }
8525
+ pattern$1.isNegativePattern = isNegativePattern;
8526
+ function isPositivePattern(pattern) {
8527
+ return !isNegativePattern(pattern);
8528
+ }
8529
+ pattern$1.isPositivePattern = isPositivePattern;
8530
+ function getNegativePatterns(patterns) {
8531
+ return patterns.filter(isNegativePattern);
8532
+ }
8533
+ pattern$1.getNegativePatterns = getNegativePatterns;
8534
+ function getPositivePatterns$1(patterns) {
8535
+ return patterns.filter(isPositivePattern);
8536
+ }
8537
+ pattern$1.getPositivePatterns = getPositivePatterns$1;
8538
+ /**
8539
+ * Returns patterns that can be applied inside the current directory.
8540
+ *
8541
+ * @example
8542
+ * // ['./*', '*', 'a/*']
8543
+ * getPatternsInsideCurrentDirectory(['./*', '*', 'a/*', '../*', './../*'])
8544
+ */
8545
+ function getPatternsInsideCurrentDirectory(patterns) {
8546
+ return patterns.filter((pattern) => !isPatternRelatedToParentDirectory(pattern));
8547
+ }
8548
+ pattern$1.getPatternsInsideCurrentDirectory = getPatternsInsideCurrentDirectory;
8549
+ /**
8550
+ * Returns patterns to be expanded relative to (outside) the current directory.
8551
+ *
8552
+ * @example
8553
+ * // ['../*', './../*']
8554
+ * getPatternsInsideCurrentDirectory(['./*', '*', 'a/*', '../*', './../*'])
8555
+ */
8556
+ function getPatternsOutsideCurrentDirectory(patterns) {
8557
+ return patterns.filter(isPatternRelatedToParentDirectory);
8558
+ }
8559
+ pattern$1.getPatternsOutsideCurrentDirectory = getPatternsOutsideCurrentDirectory;
8560
+ function isPatternRelatedToParentDirectory(pattern) {
8561
+ return pattern.startsWith('..') || pattern.startsWith('./..');
8562
+ }
8563
+ pattern$1.isPatternRelatedToParentDirectory = isPatternRelatedToParentDirectory;
8564
+ function getBaseDirectory(pattern) {
8565
+ return globParent(pattern, { flipBackslashes: false });
8566
+ }
8567
+ pattern$1.getBaseDirectory = getBaseDirectory;
8568
+ function hasGlobStar(pattern) {
8569
+ return pattern.includes(GLOBSTAR);
8570
+ }
8571
+ pattern$1.hasGlobStar = hasGlobStar;
8572
+ function endsWithSlashGlobStar(pattern) {
8573
+ return pattern.endsWith('/' + GLOBSTAR);
8574
+ }
8575
+ pattern$1.endsWithSlashGlobStar = endsWithSlashGlobStar;
8576
+ function isAffectDepthOfReadingPattern(pattern) {
8577
+ const basename = path$5.basename(pattern);
8578
+ return endsWithSlashGlobStar(pattern) || isStaticPattern(basename);
8579
+ }
8580
+ pattern$1.isAffectDepthOfReadingPattern = isAffectDepthOfReadingPattern;
8581
+ function expandPatternsWithBraceExpansion(patterns) {
8582
+ return patterns.reduce((collection, pattern) => {
8583
+ return collection.concat(expandBraceExpansion(pattern));
8584
+ }, []);
8585
+ }
8586
+ pattern$1.expandPatternsWithBraceExpansion = expandPatternsWithBraceExpansion;
8587
+ function expandBraceExpansion(pattern) {
8588
+ const patterns = micromatch.braces(pattern, { expand: true, nodupes: true });
8589
+ /**
8590
+ * Sort the patterns by length so that the same depth patterns are processed side by side.
8591
+ * `a/{b,}/{c,}/*` – `['a///*', 'a/b//*', 'a//c/*', 'a/b/c/*']`
8592
+ */
8593
+ patterns.sort((a, b) => a.length - b.length);
8594
+ /**
8595
+ * Micromatch can return an empty string in the case of patterns like `{a,}`.
8596
+ */
8597
+ return patterns.filter((pattern) => pattern !== '');
8598
+ }
8599
+ pattern$1.expandBraceExpansion = expandBraceExpansion;
8600
+ function getPatternParts(pattern, options) {
8601
+ let { parts } = micromatch.scan(pattern, Object.assign(Object.assign({}, options), { parts: true }));
8602
+ /**
8603
+ * The scan method returns an empty array in some cases.
8604
+ * See micromatch/picomatch#58 for more details.
8605
+ */
8606
+ if (parts.length === 0) {
8607
+ parts = [pattern];
8608
+ }
8609
+ /**
8610
+ * The scan method does not return an empty part for the pattern with a forward slash.
8611
+ * This is another part of micromatch/picomatch#58.
8612
+ */
8613
+ if (parts[0].startsWith('/')) {
8614
+ parts[0] = parts[0].slice(1);
8615
+ parts.unshift('');
8616
+ }
8617
+ return parts;
8618
+ }
8619
+ pattern$1.getPatternParts = getPatternParts;
8620
+ function makeRe(pattern, options) {
8621
+ return micromatch.makeRe(pattern, options);
8622
+ }
8623
+ pattern$1.makeRe = makeRe;
8624
+ function convertPatternsToRe(patterns, options) {
8625
+ return patterns.map((pattern) => makeRe(pattern, options));
8626
+ }
8627
+ pattern$1.convertPatternsToRe = convertPatternsToRe;
8628
+ function matchAny(entry, patternsRe) {
8629
+ return patternsRe.some((patternRe) => patternRe.test(entry));
8630
+ }
8549
8631
  pattern$1.matchAny = matchAny;
8632
+ /**
8633
+ * This package only works with forward slashes as a path separator.
8634
+ * Because of this, we cannot use the standard `path.normalize` method, because on Windows platform it will use of backslashes.
8635
+ */
8636
+ function removeDuplicateSlashes(pattern) {
8637
+ return pattern.replace(DOUBLE_SLASH_RE, '/');
8638
+ }
8639
+ pattern$1.removeDuplicateSlashes = removeDuplicateSlashes;
8550
8640
 
8551
8641
  var stream$4 = {};
8552
8642
 
@@ -8694,156 +8784,163 @@ function pauseStreams (streams, options) {
8694
8784
  return streams
8695
8785
  }
8696
8786
 
8697
- Object.defineProperty(stream$4, "__esModule", { value: true });
8698
- stream$4.merge = void 0;
8699
- const merge2 = merge2_1;
8700
- function merge(streams) {
8701
- const mergedStream = merge2(streams);
8702
- streams.forEach((stream) => {
8703
- stream.once('error', (error) => mergedStream.emit('error', error));
8704
- });
8705
- mergedStream.once('close', () => propagateCloseEventToSources(streams));
8706
- mergedStream.once('end', () => propagateCloseEventToSources(streams));
8707
- return mergedStream;
8708
- }
8709
- stream$4.merge = merge;
8710
- function propagateCloseEventToSources(streams) {
8711
- streams.forEach((stream) => stream.emit('close'));
8787
+ Object.defineProperty(stream$4, "__esModule", { value: true });
8788
+ stream$4.merge = void 0;
8789
+ const merge2 = merge2_1;
8790
+ function merge(streams) {
8791
+ const mergedStream = merge2(streams);
8792
+ streams.forEach((stream) => {
8793
+ stream.once('error', (error) => mergedStream.emit('error', error));
8794
+ });
8795
+ mergedStream.once('close', () => propagateCloseEventToSources(streams));
8796
+ mergedStream.once('end', () => propagateCloseEventToSources(streams));
8797
+ return mergedStream;
8798
+ }
8799
+ stream$4.merge = merge;
8800
+ function propagateCloseEventToSources(streams) {
8801
+ streams.forEach((stream) => stream.emit('close'));
8712
8802
  }
8713
8803
 
8714
8804
  var string$1 = {};
8715
8805
 
8716
- Object.defineProperty(string$1, "__esModule", { value: true });
8717
- string$1.isEmpty = string$1.isString = void 0;
8718
- function isString(input) {
8719
- return typeof input === 'string';
8720
- }
8721
- string$1.isString = isString;
8722
- function isEmpty(input) {
8723
- return input === '';
8724
- }
8806
+ Object.defineProperty(string$1, "__esModule", { value: true });
8807
+ string$1.isEmpty = string$1.isString = void 0;
8808
+ function isString(input) {
8809
+ return typeof input === 'string';
8810
+ }
8811
+ string$1.isString = isString;
8812
+ function isEmpty(input) {
8813
+ return input === '';
8814
+ }
8725
8815
  string$1.isEmpty = isEmpty;
8726
8816
 
8727
- Object.defineProperty(utils$k, "__esModule", { value: true });
8728
- utils$k.string = utils$k.stream = utils$k.pattern = utils$k.path = utils$k.fs = utils$k.errno = utils$k.array = void 0;
8729
- const array = array$1;
8730
- utils$k.array = array;
8731
- const errno = errno$1;
8732
- utils$k.errno = errno;
8733
- const fs$6 = fs$7;
8734
- utils$k.fs = fs$6;
8735
- const path$4 = path$9;
8736
- utils$k.path = path$4;
8737
- const pattern = pattern$1;
8738
- utils$k.pattern = pattern;
8739
- const stream$3 = stream$4;
8740
- utils$k.stream = stream$3;
8741
- const string = string$1;
8817
+ Object.defineProperty(utils$k, "__esModule", { value: true });
8818
+ utils$k.string = utils$k.stream = utils$k.pattern = utils$k.path = utils$k.fs = utils$k.errno = utils$k.array = void 0;
8819
+ const array = array$1;
8820
+ utils$k.array = array;
8821
+ const errno = errno$1;
8822
+ utils$k.errno = errno;
8823
+ const fs$6 = fs$7;
8824
+ utils$k.fs = fs$6;
8825
+ const path$4 = path$9;
8826
+ utils$k.path = path$4;
8827
+ const pattern = pattern$1;
8828
+ utils$k.pattern = pattern;
8829
+ const stream$3 = stream$4;
8830
+ utils$k.stream = stream$3;
8831
+ const string = string$1;
8742
8832
  utils$k.string = string;
8743
8833
 
8744
- Object.defineProperty(tasks, "__esModule", { value: true });
8745
- tasks.convertPatternGroupToTask = tasks.convertPatternGroupsToTasks = tasks.groupPatternsByBaseDirectory = tasks.getNegativePatternsAsPositive = tasks.getPositivePatterns = tasks.convertPatternsToTasks = tasks.generate = void 0;
8746
- const utils$a = utils$k;
8747
- function generate(patterns, settings) {
8748
- const positivePatterns = getPositivePatterns(patterns);
8749
- const negativePatterns = getNegativePatternsAsPositive(patterns, settings.ignore);
8750
- const staticPatterns = positivePatterns.filter((pattern) => utils$a.pattern.isStaticPattern(pattern, settings));
8751
- const dynamicPatterns = positivePatterns.filter((pattern) => utils$a.pattern.isDynamicPattern(pattern, settings));
8752
- const staticTasks = convertPatternsToTasks(staticPatterns, negativePatterns, /* dynamic */ false);
8753
- const dynamicTasks = convertPatternsToTasks(dynamicPatterns, negativePatterns, /* dynamic */ true);
8754
- return staticTasks.concat(dynamicTasks);
8755
- }
8756
- tasks.generate = generate;
8757
- /**
8758
- * Returns tasks grouped by basic pattern directories.
8759
- *
8760
- * Patterns that can be found inside (`./`) and outside (`../`) the current directory are handled separately.
8761
- * This is necessary because directory traversal starts at the base directory and goes deeper.
8762
- */
8763
- function convertPatternsToTasks(positive, negative, dynamic) {
8764
- const tasks = [];
8765
- const patternsOutsideCurrentDirectory = utils$a.pattern.getPatternsOutsideCurrentDirectory(positive);
8766
- const patternsInsideCurrentDirectory = utils$a.pattern.getPatternsInsideCurrentDirectory(positive);
8767
- const outsideCurrentDirectoryGroup = groupPatternsByBaseDirectory(patternsOutsideCurrentDirectory);
8768
- const insideCurrentDirectoryGroup = groupPatternsByBaseDirectory(patternsInsideCurrentDirectory);
8769
- tasks.push(...convertPatternGroupsToTasks(outsideCurrentDirectoryGroup, negative, dynamic));
8770
- /*
8771
- * For the sake of reducing future accesses to the file system, we merge all tasks within the current directory
8772
- * into a global task, if at least one pattern refers to the root (`.`). In this case, the global task covers the rest.
8773
- */
8774
- if ('.' in insideCurrentDirectoryGroup) {
8775
- tasks.push(convertPatternGroupToTask('.', patternsInsideCurrentDirectory, negative, dynamic));
8776
- }
8777
- else {
8778
- tasks.push(...convertPatternGroupsToTasks(insideCurrentDirectoryGroup, negative, dynamic));
8779
- }
8780
- return tasks;
8781
- }
8782
- tasks.convertPatternsToTasks = convertPatternsToTasks;
8783
- function getPositivePatterns(patterns) {
8784
- return utils$a.pattern.getPositivePatterns(patterns);
8785
- }
8786
- tasks.getPositivePatterns = getPositivePatterns;
8787
- function getNegativePatternsAsPositive(patterns, ignore) {
8788
- const negative = utils$a.pattern.getNegativePatterns(patterns).concat(ignore);
8789
- const positive = negative.map(utils$a.pattern.convertToPositivePattern);
8790
- return positive;
8791
- }
8792
- tasks.getNegativePatternsAsPositive = getNegativePatternsAsPositive;
8793
- function groupPatternsByBaseDirectory(patterns) {
8794
- const group = {};
8795
- return patterns.reduce((collection, pattern) => {
8796
- const base = utils$a.pattern.getBaseDirectory(pattern);
8797
- if (base in collection) {
8798
- collection[base].push(pattern);
8799
- }
8800
- else {
8801
- collection[base] = [pattern];
8802
- }
8803
- return collection;
8804
- }, group);
8805
- }
8806
- tasks.groupPatternsByBaseDirectory = groupPatternsByBaseDirectory;
8807
- function convertPatternGroupsToTasks(positive, negative, dynamic) {
8808
- return Object.keys(positive).map((base) => {
8809
- return convertPatternGroupToTask(base, positive[base], negative, dynamic);
8810
- });
8811
- }
8812
- tasks.convertPatternGroupsToTasks = convertPatternGroupsToTasks;
8813
- function convertPatternGroupToTask(base, positive, negative, dynamic) {
8814
- return {
8815
- dynamic,
8816
- positive,
8817
- negative,
8818
- base,
8819
- patterns: [].concat(positive, negative.map(utils$a.pattern.convertToNegativePattern))
8820
- };
8821
- }
8834
+ Object.defineProperty(tasks, "__esModule", { value: true });
8835
+ tasks.convertPatternGroupToTask = tasks.convertPatternGroupsToTasks = tasks.groupPatternsByBaseDirectory = tasks.getNegativePatternsAsPositive = tasks.getPositivePatterns = tasks.convertPatternsToTasks = tasks.generate = void 0;
8836
+ const utils$a = utils$k;
8837
+ function generate(input, settings) {
8838
+ const patterns = processPatterns(input, settings);
8839
+ const ignore = processPatterns(settings.ignore, settings);
8840
+ const positivePatterns = getPositivePatterns(patterns);
8841
+ const negativePatterns = getNegativePatternsAsPositive(patterns, ignore);
8842
+ const staticPatterns = positivePatterns.filter((pattern) => utils$a.pattern.isStaticPattern(pattern, settings));
8843
+ const dynamicPatterns = positivePatterns.filter((pattern) => utils$a.pattern.isDynamicPattern(pattern, settings));
8844
+ const staticTasks = convertPatternsToTasks(staticPatterns, negativePatterns, /* dynamic */ false);
8845
+ const dynamicTasks = convertPatternsToTasks(dynamicPatterns, negativePatterns, /* dynamic */ true);
8846
+ return staticTasks.concat(dynamicTasks);
8847
+ }
8848
+ tasks.generate = generate;
8849
+ function processPatterns(input, settings) {
8850
+ let patterns = input;
8851
+ /**
8852
+ * The original pattern like `{,*,**,a/*}` can lead to problems checking the depth when matching entry
8853
+ * and some problems with the micromatch package (see fast-glob issues: #365, #394).
8854
+ *
8855
+ * To solve this problem, we expand all patterns containing brace expansion. This can lead to a slight slowdown
8856
+ * in matching in the case of a large set of patterns after expansion.
8857
+ */
8858
+ if (settings.braceExpansion) {
8859
+ patterns = utils$a.pattern.expandPatternsWithBraceExpansion(patterns);
8860
+ }
8861
+ /**
8862
+ * If the `baseNameMatch` option is enabled, we must add globstar to patterns, so that they can be used
8863
+ * at any nesting level.
8864
+ *
8865
+ * We do this here, because otherwise we have to complicate the filtering logic. For example, we need to change
8866
+ * the pattern in the filter before creating a regular expression. There is no need to change the patterns
8867
+ * in the application. Only on the input.
8868
+ */
8869
+ if (settings.baseNameMatch) {
8870
+ patterns = patterns.map((pattern) => pattern.includes('/') ? pattern : `**/${pattern}`);
8871
+ }
8872
+ /**
8873
+ * This method also removes duplicate slashes that may have been in the pattern or formed as a result of expansion.
8874
+ */
8875
+ return patterns.map((pattern) => utils$a.pattern.removeDuplicateSlashes(pattern));
8876
+ }
8877
+ /**
8878
+ * Returns tasks grouped by basic pattern directories.
8879
+ *
8880
+ * Patterns that can be found inside (`./`) and outside (`../`) the current directory are handled separately.
8881
+ * This is necessary because directory traversal starts at the base directory and goes deeper.
8882
+ */
8883
+ function convertPatternsToTasks(positive, negative, dynamic) {
8884
+ const tasks = [];
8885
+ const patternsOutsideCurrentDirectory = utils$a.pattern.getPatternsOutsideCurrentDirectory(positive);
8886
+ const patternsInsideCurrentDirectory = utils$a.pattern.getPatternsInsideCurrentDirectory(positive);
8887
+ const outsideCurrentDirectoryGroup = groupPatternsByBaseDirectory(patternsOutsideCurrentDirectory);
8888
+ const insideCurrentDirectoryGroup = groupPatternsByBaseDirectory(patternsInsideCurrentDirectory);
8889
+ tasks.push(...convertPatternGroupsToTasks(outsideCurrentDirectoryGroup, negative, dynamic));
8890
+ /*
8891
+ * For the sake of reducing future accesses to the file system, we merge all tasks within the current directory
8892
+ * into a global task, if at least one pattern refers to the root (`.`). In this case, the global task covers the rest.
8893
+ */
8894
+ if ('.' in insideCurrentDirectoryGroup) {
8895
+ tasks.push(convertPatternGroupToTask('.', patternsInsideCurrentDirectory, negative, dynamic));
8896
+ }
8897
+ else {
8898
+ tasks.push(...convertPatternGroupsToTasks(insideCurrentDirectoryGroup, negative, dynamic));
8899
+ }
8900
+ return tasks;
8901
+ }
8902
+ tasks.convertPatternsToTasks = convertPatternsToTasks;
8903
+ function getPositivePatterns(patterns) {
8904
+ return utils$a.pattern.getPositivePatterns(patterns);
8905
+ }
8906
+ tasks.getPositivePatterns = getPositivePatterns;
8907
+ function getNegativePatternsAsPositive(patterns, ignore) {
8908
+ const negative = utils$a.pattern.getNegativePatterns(patterns).concat(ignore);
8909
+ const positive = negative.map(utils$a.pattern.convertToPositivePattern);
8910
+ return positive;
8911
+ }
8912
+ tasks.getNegativePatternsAsPositive = getNegativePatternsAsPositive;
8913
+ function groupPatternsByBaseDirectory(patterns) {
8914
+ const group = {};
8915
+ return patterns.reduce((collection, pattern) => {
8916
+ const base = utils$a.pattern.getBaseDirectory(pattern);
8917
+ if (base in collection) {
8918
+ collection[base].push(pattern);
8919
+ }
8920
+ else {
8921
+ collection[base] = [pattern];
8922
+ }
8923
+ return collection;
8924
+ }, group);
8925
+ }
8926
+ tasks.groupPatternsByBaseDirectory = groupPatternsByBaseDirectory;
8927
+ function convertPatternGroupsToTasks(positive, negative, dynamic) {
8928
+ return Object.keys(positive).map((base) => {
8929
+ return convertPatternGroupToTask(base, positive[base], negative, dynamic);
8930
+ });
8931
+ }
8932
+ tasks.convertPatternGroupsToTasks = convertPatternGroupsToTasks;
8933
+ function convertPatternGroupToTask(base, positive, negative, dynamic) {
8934
+ return {
8935
+ dynamic,
8936
+ positive,
8937
+ negative,
8938
+ base,
8939
+ patterns: [].concat(positive, negative.map(utils$a.pattern.convertToNegativePattern))
8940
+ };
8941
+ }
8822
8942
  tasks.convertPatternGroupToTask = convertPatternGroupToTask;
8823
8943
 
8824
- var patterns = {};
8825
-
8826
- Object.defineProperty(patterns, "__esModule", { value: true });
8827
- patterns.removeDuplicateSlashes = patterns.transform = void 0;
8828
- /**
8829
- * Matches a sequence of two or more consecutive slashes, excluding the first two slashes at the beginning of the string.
8830
- * The latter is due to the presence of the device path at the beginning of the UNC path.
8831
- * @todo rewrite to negative lookbehind with the next major release.
8832
- */
8833
- const DOUBLE_SLASH_RE = /(?!^)\/{2,}/g;
8834
- function transform(patterns) {
8835
- return patterns.map((pattern) => removeDuplicateSlashes(pattern));
8836
- }
8837
- patterns.transform = transform;
8838
- /**
8839
- * This package only works with forward slashes as a path separator.
8840
- * Because of this, we cannot use the standard `path.normalize` method, because on Windows platform it will use of backslashes.
8841
- */
8842
- function removeDuplicateSlashes(pattern) {
8843
- return pattern.replace(DOUBLE_SLASH_RE, '/');
8844
- }
8845
- patterns.removeDuplicateSlashes = removeDuplicateSlashes;
8846
-
8847
8944
  var async$7 = {};
8848
8945
 
8849
8946
  var async$6 = {};
@@ -8948,7 +9045,7 @@ var fs$5 = {};
8948
9045
 
8949
9046
  Object.defineProperty(settings$3, "__esModule", { value: true });
8950
9047
  const fs$4 = fs$5;
8951
- class Settings$2 {
9048
+ let Settings$2 = class Settings {
8952
9049
  constructor(_options = {}) {
8953
9050
  this._options = _options;
8954
9051
  this.followSymbolicLink = this._getValue(this._options.followSymbolicLink, true);
@@ -8959,7 +9056,7 @@ class Settings$2 {
8959
9056
  _getValue(option, value) {
8960
9057
  return option !== null && option !== void 0 ? option : value;
8961
9058
  }
8962
- }
9059
+ };
8963
9060
  settings$3.default = Settings$2;
8964
9061
 
8965
9062
  Object.defineProperty(out$1, "__esModule", { value: true });
@@ -9303,7 +9400,7 @@ Object.defineProperty(settings$2, "__esModule", { value: true });
9303
9400
  const path$3 = require$$0$2;
9304
9401
  const fsStat$3 = out$1;
9305
9402
  const fs = fs$1;
9306
- class Settings$1 {
9403
+ let Settings$1 = class Settings {
9307
9404
  constructor(_options = {}) {
9308
9405
  this._options = _options;
9309
9406
  this.followSymbolicLinks = this._getValue(this._options.followSymbolicLinks, false);
@@ -9320,7 +9417,7 @@ class Settings$1 {
9320
9417
  _getValue(option, value) {
9321
9418
  return option !== null && option !== void 0 ? option : value;
9322
9419
  }
9323
- }
9420
+ };
9324
9421
  settings$2.default = Settings$1;
9325
9422
 
9326
9423
  Object.defineProperty(out$2, "__esModule", { value: true });
@@ -9649,6 +9746,12 @@ function queueAsPromised (context, worker, concurrency) {
9649
9746
  }
9650
9747
 
9651
9748
  function drained () {
9749
+ if (queue.idle()) {
9750
+ return new Promise(function (resolve) {
9751
+ resolve();
9752
+ })
9753
+ }
9754
+
9652
9755
  var previousDrain = queue.drain;
9653
9756
 
9654
9757
  var p = new Promise(function (resolve) {
@@ -9704,17 +9807,17 @@ var reader$1 = {};
9704
9807
 
9705
9808
  Object.defineProperty(reader$1, "__esModule", { value: true });
9706
9809
  const common$2 = common$3;
9707
- class Reader$1 {
9810
+ let Reader$1 = class Reader {
9708
9811
  constructor(_root, _settings) {
9709
9812
  this._root = _root;
9710
9813
  this._settings = _settings;
9711
9814
  this._root = common$2.replacePathSegmentSeparator(_root, _settings.pathSegmentSeparator);
9712
9815
  }
9713
- }
9816
+ };
9714
9817
  reader$1.default = Reader$1;
9715
9818
 
9716
9819
  Object.defineProperty(async$4, "__esModule", { value: true });
9717
- const events_1 = require$$0$4;
9820
+ const events_1 = require$$0$5;
9718
9821
  const fsScandir$2 = out$2;
9719
9822
  const fastq = queueExports;
9720
9823
  const common$1 = common$3;
@@ -10017,129 +10120,129 @@ function getSettings(settingsOrOptions = {}) {
10017
10120
 
10018
10121
  var reader = {};
10019
10122
 
10020
- Object.defineProperty(reader, "__esModule", { value: true });
10021
- const path$1 = require$$0$2;
10022
- const fsStat$2 = out$1;
10023
- const utils$6 = utils$k;
10024
- class Reader {
10025
- constructor(_settings) {
10026
- this._settings = _settings;
10027
- this._fsStatSettings = new fsStat$2.Settings({
10028
- followSymbolicLink: this._settings.followSymbolicLinks,
10029
- fs: this._settings.fs,
10030
- throwErrorOnBrokenSymbolicLink: this._settings.followSymbolicLinks
10031
- });
10032
- }
10033
- _getFullEntryPath(filepath) {
10034
- return path$1.resolve(this._settings.cwd, filepath);
10035
- }
10036
- _makeEntry(stats, pattern) {
10037
- const entry = {
10038
- name: pattern,
10039
- path: pattern,
10040
- dirent: utils$6.fs.createDirentFromStats(pattern, stats)
10041
- };
10042
- if (this._settings.stats) {
10043
- entry.stats = stats;
10044
- }
10045
- return entry;
10046
- }
10047
- _isFatalError(error) {
10048
- return !utils$6.errno.isEnoentCodeError(error) && !this._settings.suppressErrors;
10049
- }
10050
- }
10123
+ Object.defineProperty(reader, "__esModule", { value: true });
10124
+ const path$1 = require$$0$2;
10125
+ const fsStat$2 = out$1;
10126
+ const utils$6 = utils$k;
10127
+ class Reader {
10128
+ constructor(_settings) {
10129
+ this._settings = _settings;
10130
+ this._fsStatSettings = new fsStat$2.Settings({
10131
+ followSymbolicLink: this._settings.followSymbolicLinks,
10132
+ fs: this._settings.fs,
10133
+ throwErrorOnBrokenSymbolicLink: this._settings.followSymbolicLinks
10134
+ });
10135
+ }
10136
+ _getFullEntryPath(filepath) {
10137
+ return path$1.resolve(this._settings.cwd, filepath);
10138
+ }
10139
+ _makeEntry(stats, pattern) {
10140
+ const entry = {
10141
+ name: pattern,
10142
+ path: pattern,
10143
+ dirent: utils$6.fs.createDirentFromStats(pattern, stats)
10144
+ };
10145
+ if (this._settings.stats) {
10146
+ entry.stats = stats;
10147
+ }
10148
+ return entry;
10149
+ }
10150
+ _isFatalError(error) {
10151
+ return !utils$6.errno.isEnoentCodeError(error) && !this._settings.suppressErrors;
10152
+ }
10153
+ }
10051
10154
  reader.default = Reader;
10052
10155
 
10053
10156
  var stream$1 = {};
10054
10157
 
10055
- Object.defineProperty(stream$1, "__esModule", { value: true });
10056
- const stream_1$3 = require$$0;
10057
- const fsStat$1 = out$1;
10058
- const fsWalk$2 = out$3;
10059
- const reader_1$2 = reader;
10060
- class ReaderStream extends reader_1$2.default {
10061
- constructor() {
10062
- super(...arguments);
10063
- this._walkStream = fsWalk$2.walkStream;
10064
- this._stat = fsStat$1.stat;
10065
- }
10066
- dynamic(root, options) {
10067
- return this._walkStream(root, options);
10068
- }
10069
- static(patterns, options) {
10070
- const filepaths = patterns.map(this._getFullEntryPath, this);
10071
- const stream = new stream_1$3.PassThrough({ objectMode: true });
10072
- stream._write = (index, _enc, done) => {
10073
- return this._getEntry(filepaths[index], patterns[index], options)
10074
- .then((entry) => {
10075
- if (entry !== null && options.entryFilter(entry)) {
10076
- stream.push(entry);
10077
- }
10078
- if (index === filepaths.length - 1) {
10079
- stream.end();
10080
- }
10081
- done();
10082
- })
10083
- .catch(done);
10084
- };
10085
- for (let i = 0; i < filepaths.length; i++) {
10086
- stream.write(i);
10087
- }
10088
- return stream;
10089
- }
10090
- _getEntry(filepath, pattern, options) {
10091
- return this._getStat(filepath)
10092
- .then((stats) => this._makeEntry(stats, pattern))
10093
- .catch((error) => {
10094
- if (options.errorFilter(error)) {
10095
- return null;
10096
- }
10097
- throw error;
10098
- });
10099
- }
10100
- _getStat(filepath) {
10101
- return new Promise((resolve, reject) => {
10102
- this._stat(filepath, this._fsStatSettings, (error, stats) => {
10103
- return error === null ? resolve(stats) : reject(error);
10104
- });
10105
- });
10106
- }
10107
- }
10158
+ Object.defineProperty(stream$1, "__esModule", { value: true });
10159
+ const stream_1$3 = require$$0;
10160
+ const fsStat$1 = out$1;
10161
+ const fsWalk$2 = out$3;
10162
+ const reader_1$2 = reader;
10163
+ class ReaderStream extends reader_1$2.default {
10164
+ constructor() {
10165
+ super(...arguments);
10166
+ this._walkStream = fsWalk$2.walkStream;
10167
+ this._stat = fsStat$1.stat;
10168
+ }
10169
+ dynamic(root, options) {
10170
+ return this._walkStream(root, options);
10171
+ }
10172
+ static(patterns, options) {
10173
+ const filepaths = patterns.map(this._getFullEntryPath, this);
10174
+ const stream = new stream_1$3.PassThrough({ objectMode: true });
10175
+ stream._write = (index, _enc, done) => {
10176
+ return this._getEntry(filepaths[index], patterns[index], options)
10177
+ .then((entry) => {
10178
+ if (entry !== null && options.entryFilter(entry)) {
10179
+ stream.push(entry);
10180
+ }
10181
+ if (index === filepaths.length - 1) {
10182
+ stream.end();
10183
+ }
10184
+ done();
10185
+ })
10186
+ .catch(done);
10187
+ };
10188
+ for (let i = 0; i < filepaths.length; i++) {
10189
+ stream.write(i);
10190
+ }
10191
+ return stream;
10192
+ }
10193
+ _getEntry(filepath, pattern, options) {
10194
+ return this._getStat(filepath)
10195
+ .then((stats) => this._makeEntry(stats, pattern))
10196
+ .catch((error) => {
10197
+ if (options.errorFilter(error)) {
10198
+ return null;
10199
+ }
10200
+ throw error;
10201
+ });
10202
+ }
10203
+ _getStat(filepath) {
10204
+ return new Promise((resolve, reject) => {
10205
+ this._stat(filepath, this._fsStatSettings, (error, stats) => {
10206
+ return error === null ? resolve(stats) : reject(error);
10207
+ });
10208
+ });
10209
+ }
10210
+ }
10108
10211
  stream$1.default = ReaderStream;
10109
10212
 
10110
- Object.defineProperty(async$6, "__esModule", { value: true });
10111
- const fsWalk$1 = out$3;
10112
- const reader_1$1 = reader;
10113
- const stream_1$2 = stream$1;
10114
- class ReaderAsync extends reader_1$1.default {
10115
- constructor() {
10116
- super(...arguments);
10117
- this._walkAsync = fsWalk$1.walk;
10118
- this._readerStream = new stream_1$2.default(this._settings);
10119
- }
10120
- dynamic(root, options) {
10121
- return new Promise((resolve, reject) => {
10122
- this._walkAsync(root, options, (error, entries) => {
10123
- if (error === null) {
10124
- resolve(entries);
10125
- }
10126
- else {
10127
- reject(error);
10128
- }
10129
- });
10130
- });
10131
- }
10132
- async static(patterns, options) {
10133
- const entries = [];
10134
- const stream = this._readerStream.static(patterns, options);
10135
- // After #235, replace it with an asynchronous iterator.
10136
- return new Promise((resolve, reject) => {
10137
- stream.once('error', reject);
10138
- stream.on('data', (entry) => entries.push(entry));
10139
- stream.once('end', () => resolve(entries));
10140
- });
10141
- }
10142
- }
10213
+ Object.defineProperty(async$6, "__esModule", { value: true });
10214
+ const fsWalk$1 = out$3;
10215
+ const reader_1$1 = reader;
10216
+ const stream_1$2 = stream$1;
10217
+ class ReaderAsync extends reader_1$1.default {
10218
+ constructor() {
10219
+ super(...arguments);
10220
+ this._walkAsync = fsWalk$1.walk;
10221
+ this._readerStream = new stream_1$2.default(this._settings);
10222
+ }
10223
+ dynamic(root, options) {
10224
+ return new Promise((resolve, reject) => {
10225
+ this._walkAsync(root, options, (error, entries) => {
10226
+ if (error === null) {
10227
+ resolve(entries);
10228
+ }
10229
+ else {
10230
+ reject(error);
10231
+ }
10232
+ });
10233
+ });
10234
+ }
10235
+ async static(patterns, options) {
10236
+ const entries = [];
10237
+ const stream = this._readerStream.static(patterns, options);
10238
+ // After #235, replace it with an asynchronous iterator.
10239
+ return new Promise((resolve, reject) => {
10240
+ stream.once('error', reject);
10241
+ stream.on('data', (entry) => entries.push(entry));
10242
+ stream.once('end', () => resolve(entries));
10243
+ });
10244
+ }
10245
+ }
10143
10246
  async$6.default = ReaderAsync;
10144
10247
 
10145
10248
  var provider = {};
@@ -10150,595 +10253,637 @@ var partial = {};
10150
10253
 
10151
10254
  var matcher = {};
10152
10255
 
10153
- Object.defineProperty(matcher, "__esModule", { value: true });
10154
- const utils$5 = utils$k;
10155
- class Matcher {
10156
- constructor(_patterns, _settings, _micromatchOptions) {
10157
- this._patterns = _patterns;
10158
- this._settings = _settings;
10159
- this._micromatchOptions = _micromatchOptions;
10160
- this._storage = [];
10161
- this._fillStorage();
10162
- }
10163
- _fillStorage() {
10164
- /**
10165
- * The original pattern may include `{,*,**,a/*}`, which will lead to problems with matching (unresolved level).
10166
- * So, before expand patterns with brace expansion into separated patterns.
10167
- */
10168
- const patterns = utils$5.pattern.expandPatternsWithBraceExpansion(this._patterns);
10169
- for (const pattern of patterns) {
10170
- const segments = this._getPatternSegments(pattern);
10171
- const sections = this._splitSegmentsIntoSections(segments);
10172
- this._storage.push({
10173
- complete: sections.length <= 1,
10174
- pattern,
10175
- segments,
10176
- sections
10177
- });
10178
- }
10179
- }
10180
- _getPatternSegments(pattern) {
10181
- const parts = utils$5.pattern.getPatternParts(pattern, this._micromatchOptions);
10182
- return parts.map((part) => {
10183
- const dynamic = utils$5.pattern.isDynamicPattern(part, this._settings);
10184
- if (!dynamic) {
10185
- return {
10186
- dynamic: false,
10187
- pattern: part
10188
- };
10189
- }
10190
- return {
10191
- dynamic: true,
10192
- pattern: part,
10193
- patternRe: utils$5.pattern.makeRe(part, this._micromatchOptions)
10194
- };
10195
- });
10196
- }
10197
- _splitSegmentsIntoSections(segments) {
10198
- return utils$5.array.splitWhen(segments, (segment) => segment.dynamic && utils$5.pattern.hasGlobStar(segment.pattern));
10199
- }
10200
- }
10256
+ Object.defineProperty(matcher, "__esModule", { value: true });
10257
+ const utils$5 = utils$k;
10258
+ class Matcher {
10259
+ constructor(_patterns, _settings, _micromatchOptions) {
10260
+ this._patterns = _patterns;
10261
+ this._settings = _settings;
10262
+ this._micromatchOptions = _micromatchOptions;
10263
+ this._storage = [];
10264
+ this._fillStorage();
10265
+ }
10266
+ _fillStorage() {
10267
+ for (const pattern of this._patterns) {
10268
+ const segments = this._getPatternSegments(pattern);
10269
+ const sections = this._splitSegmentsIntoSections(segments);
10270
+ this._storage.push({
10271
+ complete: sections.length <= 1,
10272
+ pattern,
10273
+ segments,
10274
+ sections
10275
+ });
10276
+ }
10277
+ }
10278
+ _getPatternSegments(pattern) {
10279
+ const parts = utils$5.pattern.getPatternParts(pattern, this._micromatchOptions);
10280
+ return parts.map((part) => {
10281
+ const dynamic = utils$5.pattern.isDynamicPattern(part, this._settings);
10282
+ if (!dynamic) {
10283
+ return {
10284
+ dynamic: false,
10285
+ pattern: part
10286
+ };
10287
+ }
10288
+ return {
10289
+ dynamic: true,
10290
+ pattern: part,
10291
+ patternRe: utils$5.pattern.makeRe(part, this._micromatchOptions)
10292
+ };
10293
+ });
10294
+ }
10295
+ _splitSegmentsIntoSections(segments) {
10296
+ return utils$5.array.splitWhen(segments, (segment) => segment.dynamic && utils$5.pattern.hasGlobStar(segment.pattern));
10297
+ }
10298
+ }
10201
10299
  matcher.default = Matcher;
10202
10300
 
10203
- Object.defineProperty(partial, "__esModule", { value: true });
10204
- const matcher_1 = matcher;
10205
- class PartialMatcher extends matcher_1.default {
10206
- match(filepath) {
10207
- const parts = filepath.split('/');
10208
- const levels = parts.length;
10209
- const patterns = this._storage.filter((info) => !info.complete || info.segments.length > levels);
10210
- for (const pattern of patterns) {
10211
- const section = pattern.sections[0];
10212
- /**
10213
- * In this case, the pattern has a globstar and we must read all directories unconditionally,
10214
- * but only if the level has reached the end of the first group.
10215
- *
10216
- * fixtures/{a,b}/**
10217
- * ^ true/false ^ always true
10218
- */
10219
- if (!pattern.complete && levels > section.length) {
10220
- return true;
10221
- }
10222
- const match = parts.every((part, index) => {
10223
- const segment = pattern.segments[index];
10224
- if (segment.dynamic && segment.patternRe.test(part)) {
10225
- return true;
10226
- }
10227
- if (!segment.dynamic && segment.pattern === part) {
10228
- return true;
10229
- }
10230
- return false;
10231
- });
10232
- if (match) {
10233
- return true;
10234
- }
10235
- }
10236
- return false;
10237
- }
10238
- }
10301
+ Object.defineProperty(partial, "__esModule", { value: true });
10302
+ const matcher_1 = matcher;
10303
+ class PartialMatcher extends matcher_1.default {
10304
+ match(filepath) {
10305
+ const parts = filepath.split('/');
10306
+ const levels = parts.length;
10307
+ const patterns = this._storage.filter((info) => !info.complete || info.segments.length > levels);
10308
+ for (const pattern of patterns) {
10309
+ const section = pattern.sections[0];
10310
+ /**
10311
+ * In this case, the pattern has a globstar and we must read all directories unconditionally,
10312
+ * but only if the level has reached the end of the first group.
10313
+ *
10314
+ * fixtures/{a,b}/**
10315
+ * ^ true/false ^ always true
10316
+ */
10317
+ if (!pattern.complete && levels > section.length) {
10318
+ return true;
10319
+ }
10320
+ const match = parts.every((part, index) => {
10321
+ const segment = pattern.segments[index];
10322
+ if (segment.dynamic && segment.patternRe.test(part)) {
10323
+ return true;
10324
+ }
10325
+ if (!segment.dynamic && segment.pattern === part) {
10326
+ return true;
10327
+ }
10328
+ return false;
10329
+ });
10330
+ if (match) {
10331
+ return true;
10332
+ }
10333
+ }
10334
+ return false;
10335
+ }
10336
+ }
10239
10337
  partial.default = PartialMatcher;
10240
10338
 
10241
- Object.defineProperty(deep, "__esModule", { value: true });
10242
- const utils$4 = utils$k;
10243
- const partial_1 = partial;
10244
- class DeepFilter {
10245
- constructor(_settings, _micromatchOptions) {
10246
- this._settings = _settings;
10247
- this._micromatchOptions = _micromatchOptions;
10248
- }
10249
- getFilter(basePath, positive, negative) {
10250
- const matcher = this._getMatcher(positive);
10251
- const negativeRe = this._getNegativePatternsRe(negative);
10252
- return (entry) => this._filter(basePath, entry, matcher, negativeRe);
10253
- }
10254
- _getMatcher(patterns) {
10255
- return new partial_1.default(patterns, this._settings, this._micromatchOptions);
10256
- }
10257
- _getNegativePatternsRe(patterns) {
10258
- const affectDepthOfReadingPatterns = patterns.filter(utils$4.pattern.isAffectDepthOfReadingPattern);
10259
- return utils$4.pattern.convertPatternsToRe(affectDepthOfReadingPatterns, this._micromatchOptions);
10260
- }
10261
- _filter(basePath, entry, matcher, negativeRe) {
10262
- if (this._isSkippedByDeep(basePath, entry.path)) {
10263
- return false;
10264
- }
10265
- if (this._isSkippedSymbolicLink(entry)) {
10266
- return false;
10267
- }
10268
- const filepath = utils$4.path.removeLeadingDotSegment(entry.path);
10269
- if (this._isSkippedByPositivePatterns(filepath, matcher)) {
10270
- return false;
10271
- }
10272
- return this._isSkippedByNegativePatterns(filepath, negativeRe);
10273
- }
10274
- _isSkippedByDeep(basePath, entryPath) {
10275
- /**
10276
- * Avoid unnecessary depth calculations when it doesn't matter.
10277
- */
10278
- if (this._settings.deep === Infinity) {
10279
- return false;
10280
- }
10281
- return this._getEntryLevel(basePath, entryPath) >= this._settings.deep;
10282
- }
10283
- _getEntryLevel(basePath, entryPath) {
10284
- const entryPathDepth = entryPath.split('/').length;
10285
- if (basePath === '') {
10286
- return entryPathDepth;
10287
- }
10288
- const basePathDepth = basePath.split('/').length;
10289
- return entryPathDepth - basePathDepth;
10290
- }
10291
- _isSkippedSymbolicLink(entry) {
10292
- return !this._settings.followSymbolicLinks && entry.dirent.isSymbolicLink();
10293
- }
10294
- _isSkippedByPositivePatterns(entryPath, matcher) {
10295
- return !this._settings.baseNameMatch && !matcher.match(entryPath);
10296
- }
10297
- _isSkippedByNegativePatterns(entryPath, patternsRe) {
10298
- return !utils$4.pattern.matchAny(entryPath, patternsRe);
10299
- }
10300
- }
10339
+ Object.defineProperty(deep, "__esModule", { value: true });
10340
+ const utils$4 = utils$k;
10341
+ const partial_1 = partial;
10342
+ class DeepFilter {
10343
+ constructor(_settings, _micromatchOptions) {
10344
+ this._settings = _settings;
10345
+ this._micromatchOptions = _micromatchOptions;
10346
+ }
10347
+ getFilter(basePath, positive, negative) {
10348
+ const matcher = this._getMatcher(positive);
10349
+ const negativeRe = this._getNegativePatternsRe(negative);
10350
+ return (entry) => this._filter(basePath, entry, matcher, negativeRe);
10351
+ }
10352
+ _getMatcher(patterns) {
10353
+ return new partial_1.default(patterns, this._settings, this._micromatchOptions);
10354
+ }
10355
+ _getNegativePatternsRe(patterns) {
10356
+ const affectDepthOfReadingPatterns = patterns.filter(utils$4.pattern.isAffectDepthOfReadingPattern);
10357
+ return utils$4.pattern.convertPatternsToRe(affectDepthOfReadingPatterns, this._micromatchOptions);
10358
+ }
10359
+ _filter(basePath, entry, matcher, negativeRe) {
10360
+ if (this._isSkippedByDeep(basePath, entry.path)) {
10361
+ return false;
10362
+ }
10363
+ if (this._isSkippedSymbolicLink(entry)) {
10364
+ return false;
10365
+ }
10366
+ const filepath = utils$4.path.removeLeadingDotSegment(entry.path);
10367
+ if (this._isSkippedByPositivePatterns(filepath, matcher)) {
10368
+ return false;
10369
+ }
10370
+ return this._isSkippedByNegativePatterns(filepath, negativeRe);
10371
+ }
10372
+ _isSkippedByDeep(basePath, entryPath) {
10373
+ /**
10374
+ * Avoid unnecessary depth calculations when it doesn't matter.
10375
+ */
10376
+ if (this._settings.deep === Infinity) {
10377
+ return false;
10378
+ }
10379
+ return this._getEntryLevel(basePath, entryPath) >= this._settings.deep;
10380
+ }
10381
+ _getEntryLevel(basePath, entryPath) {
10382
+ const entryPathDepth = entryPath.split('/').length;
10383
+ if (basePath === '') {
10384
+ return entryPathDepth;
10385
+ }
10386
+ const basePathDepth = basePath.split('/').length;
10387
+ return entryPathDepth - basePathDepth;
10388
+ }
10389
+ _isSkippedSymbolicLink(entry) {
10390
+ return !this._settings.followSymbolicLinks && entry.dirent.isSymbolicLink();
10391
+ }
10392
+ _isSkippedByPositivePatterns(entryPath, matcher) {
10393
+ return !this._settings.baseNameMatch && !matcher.match(entryPath);
10394
+ }
10395
+ _isSkippedByNegativePatterns(entryPath, patternsRe) {
10396
+ return !utils$4.pattern.matchAny(entryPath, patternsRe);
10397
+ }
10398
+ }
10301
10399
  deep.default = DeepFilter;
10302
10400
 
10303
10401
  var entry$1 = {};
10304
10402
 
10305
- Object.defineProperty(entry$1, "__esModule", { value: true });
10306
- const utils$3 = utils$k;
10307
- class EntryFilter {
10308
- constructor(_settings, _micromatchOptions) {
10309
- this._settings = _settings;
10310
- this._micromatchOptions = _micromatchOptions;
10311
- this.index = new Map();
10312
- }
10313
- getFilter(positive, negative) {
10314
- const positiveRe = utils$3.pattern.convertPatternsToRe(positive, this._micromatchOptions);
10315
- const negativeRe = utils$3.pattern.convertPatternsToRe(negative, this._micromatchOptions);
10316
- return (entry) => this._filter(entry, positiveRe, negativeRe);
10317
- }
10318
- _filter(entry, positiveRe, negativeRe) {
10319
- if (this._settings.unique && this._isDuplicateEntry(entry)) {
10320
- return false;
10321
- }
10322
- if (this._onlyFileFilter(entry) || this._onlyDirectoryFilter(entry)) {
10323
- return false;
10324
- }
10325
- if (this._isSkippedByAbsoluteNegativePatterns(entry.path, negativeRe)) {
10326
- return false;
10327
- }
10328
- const filepath = this._settings.baseNameMatch ? entry.name : entry.path;
10329
- const isDirectory = entry.dirent.isDirectory();
10330
- const isMatched = this._isMatchToPatterns(filepath, positiveRe, isDirectory) && !this._isMatchToPatterns(entry.path, negativeRe, isDirectory);
10331
- if (this._settings.unique && isMatched) {
10332
- this._createIndexRecord(entry);
10333
- }
10334
- return isMatched;
10335
- }
10336
- _isDuplicateEntry(entry) {
10337
- return this.index.has(entry.path);
10338
- }
10339
- _createIndexRecord(entry) {
10340
- this.index.set(entry.path, undefined);
10341
- }
10342
- _onlyFileFilter(entry) {
10343
- return this._settings.onlyFiles && !entry.dirent.isFile();
10344
- }
10345
- _onlyDirectoryFilter(entry) {
10346
- return this._settings.onlyDirectories && !entry.dirent.isDirectory();
10347
- }
10348
- _isSkippedByAbsoluteNegativePatterns(entryPath, patternsRe) {
10349
- if (!this._settings.absolute) {
10350
- return false;
10351
- }
10352
- const fullpath = utils$3.path.makeAbsolute(this._settings.cwd, entryPath);
10353
- return utils$3.pattern.matchAny(fullpath, patternsRe);
10354
- }
10355
- _isMatchToPatterns(entryPath, patternsRe, isDirectory) {
10356
- const filepath = utils$3.path.removeLeadingDotSegment(entryPath);
10357
- // Trying to match files and directories by patterns.
10358
- const isMatched = utils$3.pattern.matchAny(filepath, patternsRe);
10359
- // A pattern with a trailling slash can be used for directory matching.
10360
- // To apply such pattern, we need to add a tralling slash to the path.
10361
- if (!isMatched && isDirectory) {
10362
- return utils$3.pattern.matchAny(filepath + '/', patternsRe);
10363
- }
10364
- return isMatched;
10365
- }
10366
- }
10403
+ Object.defineProperty(entry$1, "__esModule", { value: true });
10404
+ const utils$3 = utils$k;
10405
+ class EntryFilter {
10406
+ constructor(_settings, _micromatchOptions) {
10407
+ this._settings = _settings;
10408
+ this._micromatchOptions = _micromatchOptions;
10409
+ this.index = new Map();
10410
+ }
10411
+ getFilter(positive, negative) {
10412
+ const positiveRe = utils$3.pattern.convertPatternsToRe(positive, this._micromatchOptions);
10413
+ const negativeRe = utils$3.pattern.convertPatternsToRe(negative, Object.assign(Object.assign({}, this._micromatchOptions), { dot: true }));
10414
+ return (entry) => this._filter(entry, positiveRe, negativeRe);
10415
+ }
10416
+ _filter(entry, positiveRe, negativeRe) {
10417
+ const filepath = utils$3.path.removeLeadingDotSegment(entry.path);
10418
+ if (this._settings.unique && this._isDuplicateEntry(filepath)) {
10419
+ return false;
10420
+ }
10421
+ if (this._onlyFileFilter(entry) || this._onlyDirectoryFilter(entry)) {
10422
+ return false;
10423
+ }
10424
+ if (this._isSkippedByAbsoluteNegativePatterns(filepath, negativeRe)) {
10425
+ return false;
10426
+ }
10427
+ const isDirectory = entry.dirent.isDirectory();
10428
+ const isMatched = this._isMatchToPatterns(filepath, positiveRe, isDirectory) && !this._isMatchToPatterns(filepath, negativeRe, isDirectory);
10429
+ if (this._settings.unique && isMatched) {
10430
+ this._createIndexRecord(filepath);
10431
+ }
10432
+ return isMatched;
10433
+ }
10434
+ _isDuplicateEntry(filepath) {
10435
+ return this.index.has(filepath);
10436
+ }
10437
+ _createIndexRecord(filepath) {
10438
+ this.index.set(filepath, undefined);
10439
+ }
10440
+ _onlyFileFilter(entry) {
10441
+ return this._settings.onlyFiles && !entry.dirent.isFile();
10442
+ }
10443
+ _onlyDirectoryFilter(entry) {
10444
+ return this._settings.onlyDirectories && !entry.dirent.isDirectory();
10445
+ }
10446
+ _isSkippedByAbsoluteNegativePatterns(entryPath, patternsRe) {
10447
+ if (!this._settings.absolute) {
10448
+ return false;
10449
+ }
10450
+ const fullpath = utils$3.path.makeAbsolute(this._settings.cwd, entryPath);
10451
+ return utils$3.pattern.matchAny(fullpath, patternsRe);
10452
+ }
10453
+ _isMatchToPatterns(filepath, patternsRe, isDirectory) {
10454
+ // Trying to match files and directories by patterns.
10455
+ const isMatched = utils$3.pattern.matchAny(filepath, patternsRe);
10456
+ // A pattern with a trailling slash can be used for directory matching.
10457
+ // To apply such pattern, we need to add a tralling slash to the path.
10458
+ if (!isMatched && isDirectory) {
10459
+ return utils$3.pattern.matchAny(filepath + '/', patternsRe);
10460
+ }
10461
+ return isMatched;
10462
+ }
10463
+ }
10367
10464
  entry$1.default = EntryFilter;
10368
10465
 
10369
10466
  var error = {};
10370
10467
 
10371
- Object.defineProperty(error, "__esModule", { value: true });
10372
- const utils$2 = utils$k;
10373
- class ErrorFilter {
10374
- constructor(_settings) {
10375
- this._settings = _settings;
10376
- }
10377
- getFilter() {
10378
- return (error) => this._isNonFatalError(error);
10379
- }
10380
- _isNonFatalError(error) {
10381
- return utils$2.errno.isEnoentCodeError(error) || this._settings.suppressErrors;
10382
- }
10383
- }
10468
+ Object.defineProperty(error, "__esModule", { value: true });
10469
+ const utils$2 = utils$k;
10470
+ class ErrorFilter {
10471
+ constructor(_settings) {
10472
+ this._settings = _settings;
10473
+ }
10474
+ getFilter() {
10475
+ return (error) => this._isNonFatalError(error);
10476
+ }
10477
+ _isNonFatalError(error) {
10478
+ return utils$2.errno.isEnoentCodeError(error) || this._settings.suppressErrors;
10479
+ }
10480
+ }
10384
10481
  error.default = ErrorFilter;
10385
10482
 
10386
10483
  var entry = {};
10387
10484
 
10388
- Object.defineProperty(entry, "__esModule", { value: true });
10389
- const utils$1 = utils$k;
10390
- class EntryTransformer {
10391
- constructor(_settings) {
10392
- this._settings = _settings;
10393
- }
10394
- getTransformer() {
10395
- return (entry) => this._transform(entry);
10396
- }
10397
- _transform(entry) {
10398
- let filepath = entry.path;
10399
- if (this._settings.absolute) {
10400
- filepath = utils$1.path.makeAbsolute(this._settings.cwd, filepath);
10401
- filepath = utils$1.path.unixify(filepath);
10402
- }
10403
- if (this._settings.markDirectories && entry.dirent.isDirectory()) {
10404
- filepath += '/';
10405
- }
10406
- if (!this._settings.objectMode) {
10407
- return filepath;
10408
- }
10409
- return Object.assign(Object.assign({}, entry), { path: filepath });
10410
- }
10411
- }
10485
+ Object.defineProperty(entry, "__esModule", { value: true });
10486
+ const utils$1 = utils$k;
10487
+ class EntryTransformer {
10488
+ constructor(_settings) {
10489
+ this._settings = _settings;
10490
+ }
10491
+ getTransformer() {
10492
+ return (entry) => this._transform(entry);
10493
+ }
10494
+ _transform(entry) {
10495
+ let filepath = entry.path;
10496
+ if (this._settings.absolute) {
10497
+ filepath = utils$1.path.makeAbsolute(this._settings.cwd, filepath);
10498
+ filepath = utils$1.path.unixify(filepath);
10499
+ }
10500
+ if (this._settings.markDirectories && entry.dirent.isDirectory()) {
10501
+ filepath += '/';
10502
+ }
10503
+ if (!this._settings.objectMode) {
10504
+ return filepath;
10505
+ }
10506
+ return Object.assign(Object.assign({}, entry), { path: filepath });
10507
+ }
10508
+ }
10412
10509
  entry.default = EntryTransformer;
10413
10510
 
10414
- Object.defineProperty(provider, "__esModule", { value: true });
10415
- const path = require$$0$2;
10416
- const deep_1 = deep;
10417
- const entry_1 = entry$1;
10418
- const error_1 = error;
10419
- const entry_2 = entry;
10420
- class Provider {
10421
- constructor(_settings) {
10422
- this._settings = _settings;
10423
- this.errorFilter = new error_1.default(this._settings);
10424
- this.entryFilter = new entry_1.default(this._settings, this._getMicromatchOptions());
10425
- this.deepFilter = new deep_1.default(this._settings, this._getMicromatchOptions());
10426
- this.entryTransformer = new entry_2.default(this._settings);
10427
- }
10428
- _getRootDirectory(task) {
10429
- return path.resolve(this._settings.cwd, task.base);
10430
- }
10431
- _getReaderOptions(task) {
10432
- const basePath = task.base === '.' ? '' : task.base;
10433
- return {
10434
- basePath,
10435
- pathSegmentSeparator: '/',
10436
- concurrency: this._settings.concurrency,
10437
- deepFilter: this.deepFilter.getFilter(basePath, task.positive, task.negative),
10438
- entryFilter: this.entryFilter.getFilter(task.positive, task.negative),
10439
- errorFilter: this.errorFilter.getFilter(),
10440
- followSymbolicLinks: this._settings.followSymbolicLinks,
10441
- fs: this._settings.fs,
10442
- stats: this._settings.stats,
10443
- throwErrorOnBrokenSymbolicLink: this._settings.throwErrorOnBrokenSymbolicLink,
10444
- transform: this.entryTransformer.getTransformer()
10445
- };
10446
- }
10447
- _getMicromatchOptions() {
10448
- return {
10449
- dot: this._settings.dot,
10450
- matchBase: this._settings.baseNameMatch,
10451
- nobrace: !this._settings.braceExpansion,
10452
- nocase: !this._settings.caseSensitiveMatch,
10453
- noext: !this._settings.extglob,
10454
- noglobstar: !this._settings.globstar,
10455
- posix: true,
10456
- strictSlashes: false
10457
- };
10458
- }
10459
- }
10511
+ Object.defineProperty(provider, "__esModule", { value: true });
10512
+ const path = require$$0$2;
10513
+ const deep_1 = deep;
10514
+ const entry_1 = entry$1;
10515
+ const error_1 = error;
10516
+ const entry_2 = entry;
10517
+ class Provider {
10518
+ constructor(_settings) {
10519
+ this._settings = _settings;
10520
+ this.errorFilter = new error_1.default(this._settings);
10521
+ this.entryFilter = new entry_1.default(this._settings, this._getMicromatchOptions());
10522
+ this.deepFilter = new deep_1.default(this._settings, this._getMicromatchOptions());
10523
+ this.entryTransformer = new entry_2.default(this._settings);
10524
+ }
10525
+ _getRootDirectory(task) {
10526
+ return path.resolve(this._settings.cwd, task.base);
10527
+ }
10528
+ _getReaderOptions(task) {
10529
+ const basePath = task.base === '.' ? '' : task.base;
10530
+ return {
10531
+ basePath,
10532
+ pathSegmentSeparator: '/',
10533
+ concurrency: this._settings.concurrency,
10534
+ deepFilter: this.deepFilter.getFilter(basePath, task.positive, task.negative),
10535
+ entryFilter: this.entryFilter.getFilter(task.positive, task.negative),
10536
+ errorFilter: this.errorFilter.getFilter(),
10537
+ followSymbolicLinks: this._settings.followSymbolicLinks,
10538
+ fs: this._settings.fs,
10539
+ stats: this._settings.stats,
10540
+ throwErrorOnBrokenSymbolicLink: this._settings.throwErrorOnBrokenSymbolicLink,
10541
+ transform: this.entryTransformer.getTransformer()
10542
+ };
10543
+ }
10544
+ _getMicromatchOptions() {
10545
+ return {
10546
+ dot: this._settings.dot,
10547
+ matchBase: this._settings.baseNameMatch,
10548
+ nobrace: !this._settings.braceExpansion,
10549
+ nocase: !this._settings.caseSensitiveMatch,
10550
+ noext: !this._settings.extglob,
10551
+ noglobstar: !this._settings.globstar,
10552
+ posix: true,
10553
+ strictSlashes: false
10554
+ };
10555
+ }
10556
+ }
10460
10557
  provider.default = Provider;
10461
10558
 
10462
- Object.defineProperty(async$7, "__esModule", { value: true });
10463
- const async_1$1 = async$6;
10464
- const provider_1$2 = provider;
10465
- class ProviderAsync extends provider_1$2.default {
10466
- constructor() {
10467
- super(...arguments);
10468
- this._reader = new async_1$1.default(this._settings);
10469
- }
10470
- async read(task) {
10471
- const root = this._getRootDirectory(task);
10472
- const options = this._getReaderOptions(task);
10473
- const entries = await this.api(root, task, options);
10474
- return entries.map((entry) => options.transform(entry));
10475
- }
10476
- api(root, task, options) {
10477
- if (task.dynamic) {
10478
- return this._reader.dynamic(root, options);
10479
- }
10480
- return this._reader.static(task.patterns, options);
10481
- }
10482
- }
10559
+ Object.defineProperty(async$7, "__esModule", { value: true });
10560
+ const async_1$1 = async$6;
10561
+ const provider_1$2 = provider;
10562
+ class ProviderAsync extends provider_1$2.default {
10563
+ constructor() {
10564
+ super(...arguments);
10565
+ this._reader = new async_1$1.default(this._settings);
10566
+ }
10567
+ async read(task) {
10568
+ const root = this._getRootDirectory(task);
10569
+ const options = this._getReaderOptions(task);
10570
+ const entries = await this.api(root, task, options);
10571
+ return entries.map((entry) => options.transform(entry));
10572
+ }
10573
+ api(root, task, options) {
10574
+ if (task.dynamic) {
10575
+ return this._reader.dynamic(root, options);
10576
+ }
10577
+ return this._reader.static(task.patterns, options);
10578
+ }
10579
+ }
10483
10580
  async$7.default = ProviderAsync;
10484
10581
 
10485
10582
  var stream = {};
10486
10583
 
10487
- Object.defineProperty(stream, "__esModule", { value: true });
10488
- const stream_1$1 = require$$0;
10489
- const stream_2 = stream$1;
10490
- const provider_1$1 = provider;
10491
- class ProviderStream extends provider_1$1.default {
10492
- constructor() {
10493
- super(...arguments);
10494
- this._reader = new stream_2.default(this._settings);
10495
- }
10496
- read(task) {
10497
- const root = this._getRootDirectory(task);
10498
- const options = this._getReaderOptions(task);
10499
- const source = this.api(root, task, options);
10500
- const destination = new stream_1$1.Readable({ objectMode: true, read: () => { } });
10501
- source
10502
- .once('error', (error) => destination.emit('error', error))
10503
- .on('data', (entry) => destination.emit('data', options.transform(entry)))
10504
- .once('end', () => destination.emit('end'));
10505
- destination
10506
- .once('close', () => source.destroy());
10507
- return destination;
10508
- }
10509
- api(root, task, options) {
10510
- if (task.dynamic) {
10511
- return this._reader.dynamic(root, options);
10512
- }
10513
- return this._reader.static(task.patterns, options);
10514
- }
10515
- }
10584
+ Object.defineProperty(stream, "__esModule", { value: true });
10585
+ const stream_1$1 = require$$0;
10586
+ const stream_2 = stream$1;
10587
+ const provider_1$1 = provider;
10588
+ class ProviderStream extends provider_1$1.default {
10589
+ constructor() {
10590
+ super(...arguments);
10591
+ this._reader = new stream_2.default(this._settings);
10592
+ }
10593
+ read(task) {
10594
+ const root = this._getRootDirectory(task);
10595
+ const options = this._getReaderOptions(task);
10596
+ const source = this.api(root, task, options);
10597
+ const destination = new stream_1$1.Readable({ objectMode: true, read: () => { } });
10598
+ source
10599
+ .once('error', (error) => destination.emit('error', error))
10600
+ .on('data', (entry) => destination.emit('data', options.transform(entry)))
10601
+ .once('end', () => destination.emit('end'));
10602
+ destination
10603
+ .once('close', () => source.destroy());
10604
+ return destination;
10605
+ }
10606
+ api(root, task, options) {
10607
+ if (task.dynamic) {
10608
+ return this._reader.dynamic(root, options);
10609
+ }
10610
+ return this._reader.static(task.patterns, options);
10611
+ }
10612
+ }
10516
10613
  stream.default = ProviderStream;
10517
10614
 
10518
10615
  var sync$1 = {};
10519
10616
 
10520
10617
  var sync = {};
10521
10618
 
10522
- Object.defineProperty(sync, "__esModule", { value: true });
10523
- const fsStat = out$1;
10524
- const fsWalk = out$3;
10525
- const reader_1 = reader;
10526
- class ReaderSync extends reader_1.default {
10527
- constructor() {
10528
- super(...arguments);
10529
- this._walkSync = fsWalk.walkSync;
10530
- this._statSync = fsStat.statSync;
10531
- }
10532
- dynamic(root, options) {
10533
- return this._walkSync(root, options);
10534
- }
10535
- static(patterns, options) {
10536
- const entries = [];
10537
- for (const pattern of patterns) {
10538
- const filepath = this._getFullEntryPath(pattern);
10539
- const entry = this._getEntry(filepath, pattern, options);
10540
- if (entry === null || !options.entryFilter(entry)) {
10541
- continue;
10542
- }
10543
- entries.push(entry);
10544
- }
10545
- return entries;
10546
- }
10547
- _getEntry(filepath, pattern, options) {
10548
- try {
10549
- const stats = this._getStat(filepath);
10550
- return this._makeEntry(stats, pattern);
10551
- }
10552
- catch (error) {
10553
- if (options.errorFilter(error)) {
10554
- return null;
10555
- }
10556
- throw error;
10557
- }
10558
- }
10559
- _getStat(filepath) {
10560
- return this._statSync(filepath, this._fsStatSettings);
10561
- }
10562
- }
10619
+ Object.defineProperty(sync, "__esModule", { value: true });
10620
+ const fsStat = out$1;
10621
+ const fsWalk = out$3;
10622
+ const reader_1 = reader;
10623
+ class ReaderSync extends reader_1.default {
10624
+ constructor() {
10625
+ super(...arguments);
10626
+ this._walkSync = fsWalk.walkSync;
10627
+ this._statSync = fsStat.statSync;
10628
+ }
10629
+ dynamic(root, options) {
10630
+ return this._walkSync(root, options);
10631
+ }
10632
+ static(patterns, options) {
10633
+ const entries = [];
10634
+ for (const pattern of patterns) {
10635
+ const filepath = this._getFullEntryPath(pattern);
10636
+ const entry = this._getEntry(filepath, pattern, options);
10637
+ if (entry === null || !options.entryFilter(entry)) {
10638
+ continue;
10639
+ }
10640
+ entries.push(entry);
10641
+ }
10642
+ return entries;
10643
+ }
10644
+ _getEntry(filepath, pattern, options) {
10645
+ try {
10646
+ const stats = this._getStat(filepath);
10647
+ return this._makeEntry(stats, pattern);
10648
+ }
10649
+ catch (error) {
10650
+ if (options.errorFilter(error)) {
10651
+ return null;
10652
+ }
10653
+ throw error;
10654
+ }
10655
+ }
10656
+ _getStat(filepath) {
10657
+ return this._statSync(filepath, this._fsStatSettings);
10658
+ }
10659
+ }
10563
10660
  sync.default = ReaderSync;
10564
10661
 
10565
- Object.defineProperty(sync$1, "__esModule", { value: true });
10566
- const sync_1$1 = sync;
10567
- const provider_1 = provider;
10568
- class ProviderSync extends provider_1.default {
10569
- constructor() {
10570
- super(...arguments);
10571
- this._reader = new sync_1$1.default(this._settings);
10572
- }
10573
- read(task) {
10574
- const root = this._getRootDirectory(task);
10575
- const options = this._getReaderOptions(task);
10576
- const entries = this.api(root, task, options);
10577
- return entries.map(options.transform);
10578
- }
10579
- api(root, task, options) {
10580
- if (task.dynamic) {
10581
- return this._reader.dynamic(root, options);
10582
- }
10583
- return this._reader.static(task.patterns, options);
10584
- }
10585
- }
10662
+ Object.defineProperty(sync$1, "__esModule", { value: true });
10663
+ const sync_1$1 = sync;
10664
+ const provider_1 = provider;
10665
+ class ProviderSync extends provider_1.default {
10666
+ constructor() {
10667
+ super(...arguments);
10668
+ this._reader = new sync_1$1.default(this._settings);
10669
+ }
10670
+ read(task) {
10671
+ const root = this._getRootDirectory(task);
10672
+ const options = this._getReaderOptions(task);
10673
+ const entries = this.api(root, task, options);
10674
+ return entries.map(options.transform);
10675
+ }
10676
+ api(root, task, options) {
10677
+ if (task.dynamic) {
10678
+ return this._reader.dynamic(root, options);
10679
+ }
10680
+ return this._reader.static(task.patterns, options);
10681
+ }
10682
+ }
10586
10683
  sync$1.default = ProviderSync;
10587
10684
 
10588
10685
  var settings = {};
10589
10686
 
10590
10687
  (function (exports) {
10591
- Object.defineProperty(exports, "__esModule", { value: true });
10592
- exports.DEFAULT_FILE_SYSTEM_ADAPTER = void 0;
10593
- const fs = require$$0$1;
10594
- const os = require$$2$1;
10595
- /**
10596
- * The `os.cpus` method can return zero. We expect the number of cores to be greater than zero.
10597
- * https://github.com/nodejs/node/blob/7faeddf23a98c53896f8b574a6e66589e8fb1eb8/lib/os.js#L106-L107
10598
- */
10599
- const CPU_COUNT = Math.max(os.cpus().length, 1);
10600
- exports.DEFAULT_FILE_SYSTEM_ADAPTER = {
10601
- lstat: fs.lstat,
10602
- lstatSync: fs.lstatSync,
10603
- stat: fs.stat,
10604
- statSync: fs.statSync,
10605
- readdir: fs.readdir,
10606
- readdirSync: fs.readdirSync
10607
- };
10608
- class Settings {
10609
- constructor(_options = {}) {
10610
- this._options = _options;
10611
- this.absolute = this._getValue(this._options.absolute, false);
10612
- this.baseNameMatch = this._getValue(this._options.baseNameMatch, false);
10613
- this.braceExpansion = this._getValue(this._options.braceExpansion, true);
10614
- this.caseSensitiveMatch = this._getValue(this._options.caseSensitiveMatch, true);
10615
- this.concurrency = this._getValue(this._options.concurrency, CPU_COUNT);
10616
- this.cwd = this._getValue(this._options.cwd, process.cwd());
10617
- this.deep = this._getValue(this._options.deep, Infinity);
10618
- this.dot = this._getValue(this._options.dot, false);
10619
- this.extglob = this._getValue(this._options.extglob, true);
10620
- this.followSymbolicLinks = this._getValue(this._options.followSymbolicLinks, true);
10621
- this.fs = this._getFileSystemMethods(this._options.fs);
10622
- this.globstar = this._getValue(this._options.globstar, true);
10623
- this.ignore = this._getValue(this._options.ignore, []);
10624
- this.markDirectories = this._getValue(this._options.markDirectories, false);
10625
- this.objectMode = this._getValue(this._options.objectMode, false);
10626
- this.onlyDirectories = this._getValue(this._options.onlyDirectories, false);
10627
- this.onlyFiles = this._getValue(this._options.onlyFiles, true);
10628
- this.stats = this._getValue(this._options.stats, false);
10629
- this.suppressErrors = this._getValue(this._options.suppressErrors, false);
10630
- this.throwErrorOnBrokenSymbolicLink = this._getValue(this._options.throwErrorOnBrokenSymbolicLink, false);
10631
- this.unique = this._getValue(this._options.unique, true);
10632
- if (this.onlyDirectories) {
10633
- this.onlyFiles = false;
10634
- }
10635
- if (this.stats) {
10636
- this.objectMode = true;
10637
- }
10638
- }
10639
- _getValue(option, value) {
10640
- return option === undefined ? value : option;
10641
- }
10642
- _getFileSystemMethods(methods = {}) {
10643
- return Object.assign(Object.assign({}, exports.DEFAULT_FILE_SYSTEM_ADAPTER), methods);
10644
- }
10645
- }
10688
+ Object.defineProperty(exports, "__esModule", { value: true });
10689
+ exports.DEFAULT_FILE_SYSTEM_ADAPTER = void 0;
10690
+ const fs = require$$0$1;
10691
+ const os = require$$0$4;
10692
+ /**
10693
+ * The `os.cpus` method can return zero. We expect the number of cores to be greater than zero.
10694
+ * https://github.com/nodejs/node/blob/7faeddf23a98c53896f8b574a6e66589e8fb1eb8/lib/os.js#L106-L107
10695
+ */
10696
+ const CPU_COUNT = Math.max(os.cpus().length, 1);
10697
+ exports.DEFAULT_FILE_SYSTEM_ADAPTER = {
10698
+ lstat: fs.lstat,
10699
+ lstatSync: fs.lstatSync,
10700
+ stat: fs.stat,
10701
+ statSync: fs.statSync,
10702
+ readdir: fs.readdir,
10703
+ readdirSync: fs.readdirSync
10704
+ };
10705
+ class Settings {
10706
+ constructor(_options = {}) {
10707
+ this._options = _options;
10708
+ this.absolute = this._getValue(this._options.absolute, false);
10709
+ this.baseNameMatch = this._getValue(this._options.baseNameMatch, false);
10710
+ this.braceExpansion = this._getValue(this._options.braceExpansion, true);
10711
+ this.caseSensitiveMatch = this._getValue(this._options.caseSensitiveMatch, true);
10712
+ this.concurrency = this._getValue(this._options.concurrency, CPU_COUNT);
10713
+ this.cwd = this._getValue(this._options.cwd, process.cwd());
10714
+ this.deep = this._getValue(this._options.deep, Infinity);
10715
+ this.dot = this._getValue(this._options.dot, false);
10716
+ this.extglob = this._getValue(this._options.extglob, true);
10717
+ this.followSymbolicLinks = this._getValue(this._options.followSymbolicLinks, true);
10718
+ this.fs = this._getFileSystemMethods(this._options.fs);
10719
+ this.globstar = this._getValue(this._options.globstar, true);
10720
+ this.ignore = this._getValue(this._options.ignore, []);
10721
+ this.markDirectories = this._getValue(this._options.markDirectories, false);
10722
+ this.objectMode = this._getValue(this._options.objectMode, false);
10723
+ this.onlyDirectories = this._getValue(this._options.onlyDirectories, false);
10724
+ this.onlyFiles = this._getValue(this._options.onlyFiles, true);
10725
+ this.stats = this._getValue(this._options.stats, false);
10726
+ this.suppressErrors = this._getValue(this._options.suppressErrors, false);
10727
+ this.throwErrorOnBrokenSymbolicLink = this._getValue(this._options.throwErrorOnBrokenSymbolicLink, false);
10728
+ this.unique = this._getValue(this._options.unique, true);
10729
+ if (this.onlyDirectories) {
10730
+ this.onlyFiles = false;
10731
+ }
10732
+ if (this.stats) {
10733
+ this.objectMode = true;
10734
+ }
10735
+ // Remove the cast to the array in the next major (#404).
10736
+ this.ignore = [].concat(this.ignore);
10737
+ }
10738
+ _getValue(option, value) {
10739
+ return option === undefined ? value : option;
10740
+ }
10741
+ _getFileSystemMethods(methods = {}) {
10742
+ return Object.assign(Object.assign({}, exports.DEFAULT_FILE_SYSTEM_ADAPTER), methods);
10743
+ }
10744
+ }
10646
10745
  exports.default = Settings;
10647
10746
  } (settings));
10648
10747
 
10649
- const taskManager = tasks;
10650
- const patternManager = patterns;
10651
- const async_1 = async$7;
10652
- const stream_1 = stream;
10653
- const sync_1 = sync$1;
10654
- const settings_1 = settings;
10655
- const utils = utils$k;
10656
- async function FastGlob(source, options) {
10657
- assertPatternsInput(source);
10658
- const works = getWorks(source, async_1.default, options);
10659
- const result = await Promise.all(works);
10660
- return utils.array.flatten(result);
10661
- }
10662
- // https://github.com/typescript-eslint/typescript-eslint/issues/60
10663
- // eslint-disable-next-line no-redeclare
10664
- (function (FastGlob) {
10665
- function sync(source, options) {
10666
- assertPatternsInput(source);
10667
- const works = getWorks(source, sync_1.default, options);
10668
- return utils.array.flatten(works);
10669
- }
10670
- FastGlob.sync = sync;
10671
- function stream(source, options) {
10672
- assertPatternsInput(source);
10673
- const works = getWorks(source, stream_1.default, options);
10674
- /**
10675
- * The stream returned by the provider cannot work with an asynchronous iterator.
10676
- * To support asynchronous iterators, regardless of the number of tasks, we always multiplex streams.
10677
- * This affects performance (+25%). I don't see best solution right now.
10678
- */
10679
- return utils.stream.merge(works);
10680
- }
10681
- FastGlob.stream = stream;
10682
- function generateTasks(source, options) {
10683
- assertPatternsInput(source);
10684
- const patterns = patternManager.transform([].concat(source));
10685
- const settings = new settings_1.default(options);
10686
- return taskManager.generate(patterns, settings);
10687
- }
10688
- FastGlob.generateTasks = generateTasks;
10689
- function isDynamicPattern(source, options) {
10690
- assertPatternsInput(source);
10691
- const settings = new settings_1.default(options);
10692
- return utils.pattern.isDynamicPattern(source, settings);
10693
- }
10694
- FastGlob.isDynamicPattern = isDynamicPattern;
10695
- function escapePath(source) {
10696
- assertPatternsInput(source);
10697
- return utils.path.escape(source);
10698
- }
10699
- FastGlob.escapePath = escapePath;
10700
- })(FastGlob || (FastGlob = {}));
10701
- function getWorks(source, _Provider, options) {
10702
- const patterns = patternManager.transform([].concat(source));
10703
- const settings = new settings_1.default(options);
10704
- const tasks = taskManager.generate(patterns, settings);
10705
- const provider = new _Provider(settings);
10706
- return tasks.map(provider.read, provider);
10707
- }
10708
- function assertPatternsInput(input) {
10709
- const source = [].concat(input);
10710
- const isValidSource = source.every((item) => utils.string.isString(item) && !utils.string.isEmpty(item));
10711
- if (!isValidSource) {
10712
- throw new TypeError('Patterns must be a string (non empty) or an array of strings');
10713
- }
10714
- }
10748
+ const taskManager = tasks;
10749
+ const async_1 = async$7;
10750
+ const stream_1 = stream;
10751
+ const sync_1 = sync$1;
10752
+ const settings_1 = settings;
10753
+ const utils = utils$k;
10754
+ async function FastGlob(source, options) {
10755
+ assertPatternsInput(source);
10756
+ const works = getWorks(source, async_1.default, options);
10757
+ const result = await Promise.all(works);
10758
+ return utils.array.flatten(result);
10759
+ }
10760
+ // https://github.com/typescript-eslint/typescript-eslint/issues/60
10761
+ // eslint-disable-next-line no-redeclare
10762
+ (function (FastGlob) {
10763
+ FastGlob.glob = FastGlob;
10764
+ FastGlob.globSync = sync;
10765
+ FastGlob.globStream = stream;
10766
+ FastGlob.async = FastGlob;
10767
+ function sync(source, options) {
10768
+ assertPatternsInput(source);
10769
+ const works = getWorks(source, sync_1.default, options);
10770
+ return utils.array.flatten(works);
10771
+ }
10772
+ FastGlob.sync = sync;
10773
+ function stream(source, options) {
10774
+ assertPatternsInput(source);
10775
+ const works = getWorks(source, stream_1.default, options);
10776
+ /**
10777
+ * The stream returned by the provider cannot work with an asynchronous iterator.
10778
+ * To support asynchronous iterators, regardless of the number of tasks, we always multiplex streams.
10779
+ * This affects performance (+25%). I don't see best solution right now.
10780
+ */
10781
+ return utils.stream.merge(works);
10782
+ }
10783
+ FastGlob.stream = stream;
10784
+ function generateTasks(source, options) {
10785
+ assertPatternsInput(source);
10786
+ const patterns = [].concat(source);
10787
+ const settings = new settings_1.default(options);
10788
+ return taskManager.generate(patterns, settings);
10789
+ }
10790
+ FastGlob.generateTasks = generateTasks;
10791
+ function isDynamicPattern(source, options) {
10792
+ assertPatternsInput(source);
10793
+ const settings = new settings_1.default(options);
10794
+ return utils.pattern.isDynamicPattern(source, settings);
10795
+ }
10796
+ FastGlob.isDynamicPattern = isDynamicPattern;
10797
+ function escapePath(source) {
10798
+ assertPatternsInput(source);
10799
+ return utils.path.escape(source);
10800
+ }
10801
+ FastGlob.escapePath = escapePath;
10802
+ function convertPathToPattern(source) {
10803
+ assertPatternsInput(source);
10804
+ return utils.path.convertPathToPattern(source);
10805
+ }
10806
+ FastGlob.convertPathToPattern = convertPathToPattern;
10807
+ (function (posix) {
10808
+ function escapePath(source) {
10809
+ assertPatternsInput(source);
10810
+ return utils.path.escapePosixPath(source);
10811
+ }
10812
+ posix.escapePath = escapePath;
10813
+ function convertPathToPattern(source) {
10814
+ assertPatternsInput(source);
10815
+ return utils.path.convertPosixPathToPattern(source);
10816
+ }
10817
+ posix.convertPathToPattern = convertPathToPattern;
10818
+ })(FastGlob.posix || (FastGlob.posix = {}));
10819
+ (function (win32) {
10820
+ function escapePath(source) {
10821
+ assertPatternsInput(source);
10822
+ return utils.path.escapeWindowsPath(source);
10823
+ }
10824
+ win32.escapePath = escapePath;
10825
+ function convertPathToPattern(source) {
10826
+ assertPatternsInput(source);
10827
+ return utils.path.convertWindowsPathToPattern(source);
10828
+ }
10829
+ win32.convertPathToPattern = convertPathToPattern;
10830
+ })(FastGlob.win32 || (FastGlob.win32 = {}));
10831
+ })(FastGlob || (FastGlob = {}));
10832
+ function getWorks(source, _Provider, options) {
10833
+ const patterns = [].concat(source);
10834
+ const settings = new settings_1.default(options);
10835
+ const tasks = taskManager.generate(patterns, settings);
10836
+ const provider = new _Provider(settings);
10837
+ return tasks.map(provider.read, provider);
10838
+ }
10839
+ function assertPatternsInput(input) {
10840
+ const source = [].concat(input);
10841
+ const isValidSource = source.every((item) => utils.string.isString(item) && !utils.string.isEmpty(item));
10842
+ if (!isValidSource) {
10843
+ throw new TypeError('Patterns must be a string (non empty) or an array of strings');
10844
+ }
10845
+ }
10715
10846
  var out = FastGlob;
10716
10847
 
10717
10848
  var fg = /*@__PURE__*/getDefaultExportFromCjs(out);
10718
10849
 
10850
+ const defaultOptions = {
10851
+ hostname: "http://localhost/",
10852
+ dynamicRoutes: [],
10853
+ exclude: [],
10854
+ externalSitemaps: [],
10855
+ basePath: "",
10856
+ outDir: "dist",
10857
+ extensions: "html",
10858
+ changefreq: "daily",
10859
+ priority: 1,
10860
+ lastmod: /* @__PURE__ */ new Date(),
10861
+ readable: false,
10862
+ generateRobotsTxt: true,
10863
+ robots: [{
10864
+ userAgent: "*",
10865
+ allow: "/"
10866
+ }]
10867
+ };
10719
10868
  function resolveOptions(userOptions) {
10720
10869
  return Object.assign(
10721
- {
10722
- hostname: "http://localhost/",
10723
- dynamicRoutes: [],
10724
- exclude: [],
10725
- basePath: "",
10726
- outDir: "dist",
10727
- extensions: "html",
10728
- changefreq: "daily",
10729
- priority: 1,
10730
- lastmod: /* @__PURE__ */ new Date(),
10731
- readable: false,
10732
- generateRobotsTxt: true,
10733
- robots: [{
10734
- userAgent: "*",
10735
- allow: "/"
10736
- }]
10737
- },
10870
+ {},
10871
+ defaultOptions,
10738
10872
  userOptions
10739
10873
  );
10740
10874
  }
10741
10875
 
10876
+ function getResolvedPath(file, resolvedOptions) {
10877
+ if (isAbsolute(resolvedOptions.outDir))
10878
+ return resolve(`${resolvedOptions.outDir}/${file}`);
10879
+ return resolve(`${ensurePrefix("./", resolvedOptions.outDir)}/${file}`);
10880
+ }
10881
+ function removeMaybeSuffix(suffix, str) {
10882
+ if (!str.endsWith(suffix))
10883
+ return str;
10884
+ return str.slice(0, -suffix.length);
10885
+ }
10886
+
10742
10887
  var RobotCorrespondences = /* @__PURE__ */ ((RobotCorrespondences2) => {
10743
10888
  RobotCorrespondences2["userAgent"] = "User-agent";
10744
10889
  RobotCorrespondences2["allow"] = "Allow";
@@ -10763,24 +10908,14 @@ function getRules(options) {
10763
10908
  });
10764
10909
  return rules;
10765
10910
  }
10766
- function getContent(rules, hostname) {
10911
+ function getContent(rules, hostname, externalSitemaps) {
10767
10912
  return rules.map((rule) => `${rule.key}: ${String(rule.value).trim()}`).join("\n").concat(`
10768
10913
 
10769
- Sitemap: ${getFinalSitemapPath(hostname)}`);
10770
- }
10771
- function getFinalSitemapPath(hostname) {
10772
- return `${ensureSuffix("/", hostname)}sitemap.xml`;
10773
- }
10774
-
10775
- function getResolvedPath(file, resolvedOptions) {
10776
- if (isAbsolute(resolvedOptions.outDir))
10777
- return resolve(`${resolvedOptions.outDir}/${file}`);
10778
- return resolve(`${ensurePrefix("./", resolvedOptions.outDir)}/${file}`);
10914
+ Sitemap: ${getFinalSitemapPath(hostname)}`).concat(externalSitemaps.map((s) => `
10915
+ Sitemap: ${s.startsWith("http") ? s : getFinalSitemapPath(hostname, s)}`).join(""));
10779
10916
  }
10780
- function removeMaybeSuffix(suffix, str) {
10781
- if (!str.endsWith(suffix))
10782
- return str;
10783
- return str.slice(0, -suffix.length);
10917
+ function getFinalSitemapPath(hostname, file = "/sitemap.xml") {
10918
+ return `${removeMaybeSuffix("/", hostname)}${ensurePrefix("/", file)}`;
10784
10919
  }
10785
10920
 
10786
10921
  function getRoutes(options) {
@@ -10799,12 +10934,22 @@ function getRoutes(options) {
10799
10934
  ...options.dynamicRoutes.map((route) => slash$1(join("/", join(parse$4(route).dir, parse$4(route).name))))
10800
10935
  ].filter((route) => !options.exclude.includes(route));
10801
10936
  }
10937
+ function getOptionByRoute(options, route) {
10938
+ if (options instanceof Date || typeof options === "string" || typeof options === "number")
10939
+ return options;
10940
+ const givenRoutes = Object.keys(options);
10941
+ if (givenRoutes.includes(route))
10942
+ return options[route];
10943
+ if (givenRoutes.includes("*"))
10944
+ return options["*"];
10945
+ return void 0;
10946
+ }
10802
10947
  function getFormattedSitemap(options, routes) {
10803
10948
  return routes.map((route) => ({
10804
10949
  url: new URL(options.basePath ? ensurePrefix("/", options.basePath) + ensurePrefix("/", route) : ensurePrefix("/", route), removeMaybeSuffix("/", options.hostname)).href,
10805
- changefreq: options.changefreq,
10806
- priority: options.priority,
10807
- lastmod: options.lastmod
10950
+ changefreq: getOptionByRoute(options.changefreq, route) ?? defaultOptions.changefreq,
10951
+ priority: getOptionByRoute(options.priority, route) ?? defaultOptions.priority,
10952
+ lastmod: getOptionByRoute(options.lastmod, route) ?? defaultOptions.lastmod
10808
10953
  }));
10809
10954
  }
10810
10955
 
@@ -10812,7 +10957,7 @@ function generateSitemap(options = {}) {
10812
10957
  const resolvedOptions = resolveOptions(options);
10813
10958
  if (resolvedOptions.generateRobotsTxt) {
10814
10959
  const robotRules = getRules(resolvedOptions.robots);
10815
- const robotContent = getContent(robotRules, resolvedOptions.hostname);
10960
+ const robotContent = getContent(robotRules, resolvedOptions.hostname, resolvedOptions.externalSitemaps);
10816
10961
  writeFileSync(getResolvedPath("robots.txt", resolvedOptions), robotContent);
10817
10962
  }
10818
10963
  const routes = getRoutes(resolvedOptions);