vite 6.1.0 → 6.1.2

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.
@@ -7,7 +7,7 @@ import { promisify as promisify$4, format as format$2, inspect, stripVTControlCh
7
7
  import { performance } from 'node:perf_hooks';
8
8
  import require$$0$6, { createRequire as createRequire$1, builtinModules } from 'node:module';
9
9
  import crypto$2 from 'node:crypto';
10
- import esbuild, { transform as transform$1, formatMessages, build as build$b } from 'esbuild';
10
+ import esbuild, { transform as transform$1, formatMessages, build as build$j } from 'esbuild';
11
11
  import { CLIENT_ENTRY, OPTIMIZABLE_ENTRY_RE, wildcardHosts, loopbackHosts, FS_PREFIX, CLIENT_PUBLIC_PATH, ENV_PUBLIC_PATH, DEFAULT_ASSETS_INLINE_LIMIT, ENV_ENTRY, DEP_VERSION_RE, SPECIAL_QUERY_RE, DEV_PROD_CONDITION, JS_TYPES_RE, KNOWN_ASSET_TYPES, CSS_LANGS_RE, METADATA_FILENAME, ESBUILD_MODULES_TARGET, ERR_OPTIMIZE_DEPS_PROCESSING_ERROR, ERR_FILE_NOT_FOUND_IN_OPTIMIZED_DEP_DIR, VITE_PACKAGE_DIR, DEFAULT_DEV_PORT, defaultAllowedOrigins, CLIENT_DIR, VERSION, ROLLUP_HOOKS, DEFAULT_PREVIEW_PORT, DEFAULT_ASSETS_RE, DEFAULT_CONFIG_FILES, DEFAULT_CLIENT_MAIN_FIELDS, DEFAULT_SERVER_MAIN_FIELDS, DEFAULT_CLIENT_CONDITIONS, DEFAULT_SERVER_CONDITIONS } from '../constants.js';
12
12
  import require$$0$2, { posix, win32, isAbsolute, resolve as resolve$3, relative as relative$1, basename as basename$1, extname, dirname as dirname$1, join, sep } from 'path';
13
13
  import require$$0$3, { existsSync, readFileSync, statSync, readdirSync } from 'fs';
@@ -24,6 +24,7 @@ import require$$0$8 from 'stream';
24
24
  import require$$2 from 'os';
25
25
  import require$$2$1 from 'child_process';
26
26
  import os$3 from 'node:os';
27
+ import net$1 from 'node:net';
27
28
  import { promises } from 'node:dns';
28
29
  import { ModuleRunner, ESModulesEvaluator } from 'vite/module-runner';
29
30
  import { parseAstAsync, parseAst } from 'rollup/parseAst';
@@ -40,7 +41,6 @@ import zlib$1 from 'zlib';
40
41
  import require$$0$9 from 'buffer';
41
42
  import require$$1$3 from 'https';
42
43
  import require$$4$2 from 'tls';
43
- import net$1 from 'node:net';
44
44
  import require$$4$3 from 'assert';
45
45
  import * as qs from 'node:querystring';
46
46
  import { gzip } from 'node:zlib';
@@ -135,7 +135,7 @@ picocolors.exports.createColors = createColors;
135
135
  var picocolorsExports = picocolors.exports;
136
136
  var colors$1 = /*@__PURE__*/getDefaultExportFromCjs(picocolorsExports);
137
137
 
138
- var utils$d = {};
138
+ var utils$e = {};
139
139
 
140
140
  const WIN_SLASH$1 = '\\\\/';
141
141
  const WIN_NO_SLASH$1 = `[^${WIN_SLASH$1}]`;
@@ -388,9 +388,9 @@ var constants$8 = {
388
388
 
389
389
  return last;
390
390
  };
391
- } (utils$d));
391
+ } (utils$e));
392
392
 
393
- const utils$c = utils$d;
393
+ const utils$d = utils$e;
394
394
  const {
395
395
  CHAR_ASTERISK: CHAR_ASTERISK$1, /* * */
396
396
  CHAR_AT: CHAR_AT$1, /* @ */
@@ -707,10 +707,10 @@ const scan$3 = (input, options) => {
707
707
  }
708
708
 
709
709
  if (opts.unescape === true) {
710
- if (glob) glob = utils$c.removeBackslashes(glob);
710
+ if (glob) glob = utils$d.removeBackslashes(glob);
711
711
 
712
712
  if (base && backslashes === true) {
713
- base = utils$c.removeBackslashes(base);
713
+ base = utils$d.removeBackslashes(base);
714
714
  }
715
715
  }
716
716
 
@@ -781,7 +781,7 @@ const scan$3 = (input, options) => {
781
781
  var scan_1$1 = scan$3;
782
782
 
783
783
  const constants$7 = constants$8;
784
- const utils$b = utils$d;
784
+ const utils$c = utils$e;
785
785
 
786
786
  /**
787
787
  * Constants
@@ -899,7 +899,7 @@ const parse$h = (input, options) => {
899
899
  tokens
900
900
  };
901
901
 
902
- input = utils$b.removePrefix(input, state);
902
+ input = utils$c.removePrefix(input, state);
903
903
  len = input.length;
904
904
 
905
905
  const extglobs = [];
@@ -1092,7 +1092,7 @@ const parse$h = (input, options) => {
1092
1092
  return state;
1093
1093
  }
1094
1094
 
1095
- state.output = utils$b.wrapOutput(output, state, options);
1095
+ state.output = utils$c.wrapOutput(output, state, options);
1096
1096
  return state;
1097
1097
  }
1098
1098
 
@@ -1205,7 +1205,7 @@ const parse$h = (input, options) => {
1205
1205
  */
1206
1206
 
1207
1207
  if (state.quotes === 1 && value !== '"') {
1208
- value = utils$b.escapeRegex(value);
1208
+ value = utils$c.escapeRegex(value);
1209
1209
  prev.value += value;
1210
1210
  append({ value });
1211
1211
  continue;
@@ -1295,11 +1295,11 @@ const parse$h = (input, options) => {
1295
1295
 
1296
1296
  // when literal brackets are explicitly disabled
1297
1297
  // assume we should match with a regex character class
1298
- if (opts.literalBrackets === false || utils$b.hasRegexChars(prevValue)) {
1298
+ if (opts.literalBrackets === false || utils$c.hasRegexChars(prevValue)) {
1299
1299
  continue;
1300
1300
  }
1301
1301
 
1302
- const escaped = utils$b.escapeRegex(prev.value);
1302
+ const escaped = utils$c.escapeRegex(prev.value);
1303
1303
  state.output = state.output.slice(0, -prev.value.length);
1304
1304
 
1305
1305
  // when literal brackets are explicitly enabled
@@ -1727,19 +1727,19 @@ const parse$h = (input, options) => {
1727
1727
 
1728
1728
  while (state.brackets > 0) {
1729
1729
  if (opts.strictBrackets === true) throw new SyntaxError(syntaxError$1('closing', ']'));
1730
- state.output = utils$b.escapeLast(state.output, '[');
1730
+ state.output = utils$c.escapeLast(state.output, '[');
1731
1731
  decrement('brackets');
1732
1732
  }
1733
1733
 
1734
1734
  while (state.parens > 0) {
1735
1735
  if (opts.strictBrackets === true) throw new SyntaxError(syntaxError$1('closing', ')'));
1736
- state.output = utils$b.escapeLast(state.output, '(');
1736
+ state.output = utils$c.escapeLast(state.output, '(');
1737
1737
  decrement('parens');
1738
1738
  }
1739
1739
 
1740
1740
  while (state.braces > 0) {
1741
1741
  if (opts.strictBrackets === true) throw new SyntaxError(syntaxError$1('closing', '}'));
1742
- state.output = utils$b.escapeLast(state.output, '{');
1742
+ state.output = utils$c.escapeLast(state.output, '{');
1743
1743
  decrement('braces');
1744
1744
  }
1745
1745
 
@@ -1845,7 +1845,7 @@ parse$h.fastpaths = (input, options) => {
1845
1845
  }
1846
1846
  };
1847
1847
 
1848
- const output = utils$b.removePrefix(input, state);
1848
+ const output = utils$c.removePrefix(input, state);
1849
1849
  let source = create(output);
1850
1850
 
1851
1851
  if (source && opts.strictSlashes !== true) {
@@ -1859,7 +1859,7 @@ var parse_1$4 = parse$h;
1859
1859
 
1860
1860
  const scan$2 = scan_1$1;
1861
1861
  const parse$g = parse_1$4;
1862
- const utils$a = utils$d;
1862
+ const utils$b = utils$e;
1863
1863
  const constants$6 = constants$8;
1864
1864
  const isObject$4 = val => val && typeof val === 'object' && !Array.isArray(val);
1865
1865
 
@@ -1980,7 +1980,7 @@ picomatch$6.test = (input, regex, options, { glob, posix } = {}) => {
1980
1980
  }
1981
1981
 
1982
1982
  const opts = options || {};
1983
- const format = opts.format || (posix ? utils$a.toPosixSlashes : null);
1983
+ const format = opts.format || (posix ? utils$b.toPosixSlashes : null);
1984
1984
  let match = input === glob;
1985
1985
  let output = (match && format) ? format(input) : input;
1986
1986
 
@@ -2016,7 +2016,7 @@ picomatch$6.test = (input, regex, options, { glob, posix } = {}) => {
2016
2016
 
2017
2017
  picomatch$6.matchBase = (input, glob, options) => {
2018
2018
  const regex = glob instanceof RegExp ? glob : picomatch$6.makeRe(glob, options);
2019
- return regex.test(utils$a.basename(input));
2019
+ return regex.test(utils$b.basename(input));
2020
2020
  };
2021
2021
 
2022
2022
  /**
@@ -2198,13 +2198,13 @@ picomatch$6.constants = constants$6;
2198
2198
  var picomatch_1$2 = picomatch$6;
2199
2199
 
2200
2200
  const pico = picomatch_1$2;
2201
- const utils$9 = utils$d;
2201
+ const utils$a = utils$e;
2202
2202
 
2203
2203
  function picomatch$4(glob, options, returnState = false) {
2204
2204
  // default to os.platform()
2205
2205
  if (options && (options.windows === null || options.windows === undefined)) {
2206
2206
  // don't mutate the original options object
2207
- options = { ...options, windows: utils$9.isWindows() };
2207
+ options = { ...options, windows: utils$a.isWindows() };
2208
2208
  }
2209
2209
 
2210
2210
  return pico(glob, options, returnState);
@@ -2610,23 +2610,23 @@ function ensureArray(thing) {
2610
2610
  }
2611
2611
 
2612
2612
  const normalizePathRegExp = new RegExp(`\\${win32.sep}`, 'g');
2613
- const normalizePath$6 = function normalizePath(filename) {
2613
+ const normalizePath$7 = function normalizePath(filename) {
2614
2614
  return filename.replace(normalizePathRegExp, posix.sep);
2615
2615
  };
2616
2616
 
2617
2617
  function getMatcherString(id, resolutionBase) {
2618
2618
  if (resolutionBase === false || isAbsolute(id) || id.startsWith('**')) {
2619
- return normalizePath$6(id);
2619
+ return normalizePath$7(id);
2620
2620
  }
2621
2621
  // resolve('') is valid and will default to process.cwd()
2622
- const basePath = normalizePath$6(resolve$3(resolutionBase || ''))
2622
+ const basePath = normalizePath$7(resolve$3(resolutionBase || ''))
2623
2623
  // escape all possible (posix + win) path characters that might interfere with regex
2624
2624
  .replace(/[-^$*+?.()|[\]{}]/g, '\\$&');
2625
2625
  // Note that we use posix.join because:
2626
2626
  // 1. the basePath has been normalized to use /
2627
2627
  // 2. the incoming glob (id) matcher, also uses /
2628
2628
  // otherwise Node will force backslash (\) on windows
2629
- return posix.join(basePath, normalizePath$6(id));
2629
+ return posix.join(basePath, normalizePath$7(id));
2630
2630
  }
2631
2631
  const createFilter$1 = function createFilter(include, exclude, options) {
2632
2632
  const resolutionBase = options && options.resolve;
@@ -2650,7 +2650,7 @@ const createFilter$1 = function createFilter(include, exclude, options) {
2650
2650
  return false;
2651
2651
  if (id.includes('\0'))
2652
2652
  return false;
2653
- const pathId = normalizePath$6(id);
2653
+ const pathId = normalizePath$7(id);
2654
2654
  for (let i = 0; i < excludeMatchers.length; ++i) {
2655
2655
  const matcher = excludeMatchers[i];
2656
2656
  if (matcher instanceof RegExp) {
@@ -2830,98 +2830,98 @@ var commondir = function (basedir, relfiles) {
2830
2830
 
2831
2831
  var getCommonDir = /*@__PURE__*/getDefaultExportFromCjs(commondir);
2832
2832
 
2833
- var dist = {};
2833
+ var dist$1 = {};
2834
2834
 
2835
- var builder = {};
2835
+ var builder$1 = {};
2836
2836
 
2837
- var apiBuilder = {};
2837
+ var apiBuilder$1 = {};
2838
2838
 
2839
- var async = {};
2839
+ var async$1 = {};
2840
2840
 
2841
- var walker = {};
2841
+ var walker$1 = {};
2842
2842
 
2843
- var utils$8 = {};
2843
+ var utils$9 = {};
2844
2844
 
2845
- Object.defineProperty(utils$8, "__esModule", { value: true });
2846
- utils$8.normalizePath = utils$8.convertSlashes = utils$8.cleanPath = undefined;
2847
- const path_1$4 = require$$0$2;
2848
- function cleanPath(path) {
2849
- let normalized = (0, path_1$4.normalize)(path);
2845
+ Object.defineProperty(utils$9, "__esModule", { value: true });
2846
+ utils$9.normalizePath = utils$9.convertSlashes = utils$9.cleanPath = undefined;
2847
+ const path_1$9 = require$$0$2;
2848
+ function cleanPath$1(path) {
2849
+ let normalized = (0, path_1$9.normalize)(path);
2850
2850
  // we have to remove the last path separator
2851
2851
  // to account for / root path
2852
- if (normalized.length > 1 && normalized[normalized.length - 1] === path_1$4.sep)
2852
+ if (normalized.length > 1 && normalized[normalized.length - 1] === path_1$9.sep)
2853
2853
  normalized = normalized.substring(0, normalized.length - 1);
2854
2854
  return normalized;
2855
2855
  }
2856
- utils$8.cleanPath = cleanPath;
2857
- const SLASHES_REGEX = /[\\/]/g;
2858
- function convertSlashes(path, separator) {
2859
- return path.replace(SLASHES_REGEX, separator);
2856
+ utils$9.cleanPath = cleanPath$1;
2857
+ const SLASHES_REGEX$1 = /[\\/]/g;
2858
+ function convertSlashes$1(path, separator) {
2859
+ return path.replace(SLASHES_REGEX$1, separator);
2860
2860
  }
2861
- utils$8.convertSlashes = convertSlashes;
2862
- function normalizePath$5(path, options) {
2861
+ utils$9.convertSlashes = convertSlashes$1;
2862
+ function normalizePath$6(path, options) {
2863
2863
  const { resolvePaths, normalizePath, pathSeparator } = options;
2864
2864
  const pathNeedsCleaning = (process.platform === "win32" && path.includes("/")) ||
2865
2865
  path.startsWith(".");
2866
2866
  if (resolvePaths)
2867
- path = (0, path_1$4.resolve)(path);
2867
+ path = (0, path_1$9.resolve)(path);
2868
2868
  if (normalizePath || pathNeedsCleaning)
2869
- path = cleanPath(path);
2869
+ path = cleanPath$1(path);
2870
2870
  if (path === ".")
2871
2871
  return "";
2872
2872
  const needsSeperator = path[path.length - 1] !== pathSeparator;
2873
- return convertSlashes(needsSeperator ? path + pathSeparator : path, pathSeparator);
2873
+ return convertSlashes$1(needsSeperator ? path + pathSeparator : path, pathSeparator);
2874
2874
  }
2875
- utils$8.normalizePath = normalizePath$5;
2875
+ utils$9.normalizePath = normalizePath$6;
2876
2876
 
2877
- var joinPath$2 = {};
2877
+ var joinPath$5 = {};
2878
2878
 
2879
- Object.defineProperty(joinPath$2, "__esModule", { value: true });
2880
- joinPath$2.build = joinPath$2.joinDirectoryPath = joinPath$2.joinPathWithBasePath = undefined;
2881
- const path_1$3 = require$$0$2;
2882
- const utils_1$1 = utils$8;
2883
- function joinPathWithBasePath(filename, directoryPath) {
2879
+ Object.defineProperty(joinPath$5, "__esModule", { value: true });
2880
+ joinPath$5.build = joinPath$5.joinDirectoryPath = joinPath$5.joinPathWithBasePath = undefined;
2881
+ const path_1$8 = require$$0$2;
2882
+ const utils_1$3 = utils$9;
2883
+ function joinPathWithBasePath$1(filename, directoryPath) {
2884
2884
  return directoryPath + filename;
2885
2885
  }
2886
- joinPath$2.joinPathWithBasePath = joinPathWithBasePath;
2887
- function joinPathWithRelativePath(root, options) {
2886
+ joinPath$5.joinPathWithBasePath = joinPathWithBasePath$1;
2887
+ function joinPathWithRelativePath$1(root, options) {
2888
2888
  return function (filename, directoryPath) {
2889
2889
  const sameRoot = directoryPath.startsWith(root);
2890
2890
  if (sameRoot)
2891
2891
  return directoryPath.replace(root, "") + filename;
2892
2892
  else
2893
- return ((0, utils_1$1.convertSlashes)((0, path_1$3.relative)(root, directoryPath), options.pathSeparator) +
2893
+ return ((0, utils_1$3.convertSlashes)((0, path_1$8.relative)(root, directoryPath), options.pathSeparator) +
2894
2894
  options.pathSeparator +
2895
2895
  filename);
2896
2896
  };
2897
2897
  }
2898
- function joinPath$1(filename) {
2898
+ function joinPath$4(filename) {
2899
2899
  return filename;
2900
2900
  }
2901
- function joinDirectoryPath(filename, directoryPath, separator) {
2901
+ function joinDirectoryPath$1(filename, directoryPath, separator) {
2902
2902
  return directoryPath + filename + separator;
2903
2903
  }
2904
- joinPath$2.joinDirectoryPath = joinDirectoryPath;
2905
- function build$a(root, options) {
2904
+ joinPath$5.joinDirectoryPath = joinDirectoryPath$1;
2905
+ function build$i(root, options) {
2906
2906
  const { relativePaths, includeBasePath } = options;
2907
2907
  return relativePaths && root
2908
- ? joinPathWithRelativePath(root, options)
2908
+ ? joinPathWithRelativePath$1(root, options)
2909
2909
  : includeBasePath
2910
- ? joinPathWithBasePath
2911
- : joinPath$1;
2910
+ ? joinPathWithBasePath$1
2911
+ : joinPath$4;
2912
2912
  }
2913
- joinPath$2.build = build$a;
2913
+ joinPath$5.build = build$i;
2914
2914
 
2915
- var pushDirectory$2 = {};
2915
+ var pushDirectory$5 = {};
2916
2916
 
2917
- Object.defineProperty(pushDirectory$2, "__esModule", { value: true });
2918
- pushDirectory$2.build = undefined;
2919
- function pushDirectoryWithRelativePath(root) {
2917
+ Object.defineProperty(pushDirectory$5, "__esModule", { value: true });
2918
+ pushDirectory$5.build = undefined;
2919
+ function pushDirectoryWithRelativePath$1(root) {
2920
2920
  return function (directoryPath, paths) {
2921
2921
  paths.push(directoryPath.substring(root.length) || ".");
2922
2922
  };
2923
2923
  }
2924
- function pushDirectoryFilterWithRelativePath(root) {
2924
+ function pushDirectoryFilterWithRelativePath$1(root) {
2925
2925
  return function (directoryPath, paths, filters) {
2926
2926
  const relativePath = directoryPath.substring(root.length) || ".";
2927
2927
  if (filters.every((filter) => filter(relativePath, true))) {
@@ -2929,123 +2929,123 @@ function pushDirectoryFilterWithRelativePath(root) {
2929
2929
  }
2930
2930
  };
2931
2931
  }
2932
- const pushDirectory$1 = (directoryPath, paths) => {
2932
+ const pushDirectory$4 = (directoryPath, paths) => {
2933
2933
  paths.push(directoryPath || ".");
2934
2934
  };
2935
- const pushDirectoryFilter = (directoryPath, paths, filters) => {
2935
+ const pushDirectoryFilter$1 = (directoryPath, paths, filters) => {
2936
2936
  const path = directoryPath || ".";
2937
2937
  if (filters.every((filter) => filter(path, true))) {
2938
2938
  paths.push(path);
2939
2939
  }
2940
2940
  };
2941
- const empty$2 = () => { };
2942
- function build$9(root, options) {
2941
+ const empty$5 = () => { };
2942
+ function build$h(root, options) {
2943
2943
  const { includeDirs, filters, relativePaths } = options;
2944
2944
  if (!includeDirs)
2945
- return empty$2;
2945
+ return empty$5;
2946
2946
  if (relativePaths)
2947
2947
  return filters && filters.length
2948
- ? pushDirectoryFilterWithRelativePath(root)
2949
- : pushDirectoryWithRelativePath(root);
2950
- return filters && filters.length ? pushDirectoryFilter : pushDirectory$1;
2948
+ ? pushDirectoryFilterWithRelativePath$1(root)
2949
+ : pushDirectoryWithRelativePath$1(root);
2950
+ return filters && filters.length ? pushDirectoryFilter$1 : pushDirectory$4;
2951
2951
  }
2952
- pushDirectory$2.build = build$9;
2952
+ pushDirectory$5.build = build$h;
2953
2953
 
2954
- var pushFile$2 = {};
2954
+ var pushFile$5 = {};
2955
2955
 
2956
- Object.defineProperty(pushFile$2, "__esModule", { value: true });
2957
- pushFile$2.build = undefined;
2958
- const pushFileFilterAndCount = (filename, _paths, counts, filters) => {
2956
+ Object.defineProperty(pushFile$5, "__esModule", { value: true });
2957
+ pushFile$5.build = undefined;
2958
+ const pushFileFilterAndCount$1 = (filename, _paths, counts, filters) => {
2959
2959
  if (filters.every((filter) => filter(filename, false)))
2960
2960
  counts.files++;
2961
2961
  };
2962
- const pushFileFilter = (filename, paths, _counts, filters) => {
2962
+ const pushFileFilter$1 = (filename, paths, _counts, filters) => {
2963
2963
  if (filters.every((filter) => filter(filename, false)))
2964
2964
  paths.push(filename);
2965
2965
  };
2966
- const pushFileCount = (_filename, _paths, counts, _filters) => {
2966
+ const pushFileCount$1 = (_filename, _paths, counts, _filters) => {
2967
2967
  counts.files++;
2968
2968
  };
2969
- const pushFile$1 = (filename, paths) => {
2969
+ const pushFile$4 = (filename, paths) => {
2970
2970
  paths.push(filename);
2971
2971
  };
2972
- const empty$1 = () => { };
2973
- function build$8(options) {
2972
+ const empty$4 = () => { };
2973
+ function build$g(options) {
2974
2974
  const { excludeFiles, filters, onlyCounts } = options;
2975
2975
  if (excludeFiles)
2976
- return empty$1;
2976
+ return empty$4;
2977
2977
  if (filters && filters.length) {
2978
- return onlyCounts ? pushFileFilterAndCount : pushFileFilter;
2978
+ return onlyCounts ? pushFileFilterAndCount$1 : pushFileFilter$1;
2979
2979
  }
2980
2980
  else if (onlyCounts) {
2981
- return pushFileCount;
2981
+ return pushFileCount$1;
2982
2982
  }
2983
2983
  else {
2984
- return pushFile$1;
2984
+ return pushFile$4;
2985
2985
  }
2986
2986
  }
2987
- pushFile$2.build = build$8;
2987
+ pushFile$5.build = build$g;
2988
2988
 
2989
- var getArray$2 = {};
2989
+ var getArray$5 = {};
2990
2990
 
2991
- Object.defineProperty(getArray$2, "__esModule", { value: true });
2992
- getArray$2.build = undefined;
2993
- const getArray$1 = (paths) => {
2991
+ Object.defineProperty(getArray$5, "__esModule", { value: true });
2992
+ getArray$5.build = undefined;
2993
+ const getArray$4 = (paths) => {
2994
2994
  return paths;
2995
2995
  };
2996
- const getArrayGroup = () => {
2996
+ const getArrayGroup$1 = () => {
2997
2997
  return [""].slice(0, 0);
2998
2998
  };
2999
- function build$7(options) {
3000
- return options.group ? getArrayGroup : getArray$1;
2999
+ function build$f(options) {
3000
+ return options.group ? getArrayGroup$1 : getArray$4;
3001
3001
  }
3002
- getArray$2.build = build$7;
3002
+ getArray$5.build = build$f;
3003
3003
 
3004
- var groupFiles$2 = {};
3004
+ var groupFiles$5 = {};
3005
3005
 
3006
- Object.defineProperty(groupFiles$2, "__esModule", { value: true });
3007
- groupFiles$2.build = undefined;
3008
- const groupFiles$1 = (groups, directory, files) => {
3006
+ Object.defineProperty(groupFiles$5, "__esModule", { value: true });
3007
+ groupFiles$5.build = undefined;
3008
+ const groupFiles$4 = (groups, directory, files) => {
3009
3009
  groups.push({ directory, files, dir: directory });
3010
3010
  };
3011
- const empty = () => { };
3012
- function build$6(options) {
3013
- return options.group ? groupFiles$1 : empty;
3011
+ const empty$3 = () => { };
3012
+ function build$e(options) {
3013
+ return options.group ? groupFiles$4 : empty$3;
3014
3014
  }
3015
- groupFiles$2.build = build$6;
3015
+ groupFiles$5.build = build$e;
3016
3016
 
3017
- var resolveSymlink$1 = {};
3017
+ var resolveSymlink$3 = {};
3018
3018
 
3019
- var __importDefault$1 = (resolveSymlink$1.__importDefault) || function (mod) {
3019
+ var __importDefault$3 = (resolveSymlink$3.__importDefault) || function (mod) {
3020
3020
  return (mod && mod.__esModule) ? mod : { "default": mod };
3021
3021
  };
3022
- Object.defineProperty(resolveSymlink$1, "__esModule", { value: true });
3023
- resolveSymlink$1.build = undefined;
3024
- const fs_1$1 = __importDefault$1(require$$0$3);
3025
- const path_1$2 = require$$0$2;
3026
- const resolveSymlinksAsync = function (path, state, callback) {
3022
+ Object.defineProperty(resolveSymlink$3, "__esModule", { value: true });
3023
+ resolveSymlink$3.build = undefined;
3024
+ const fs_1$3 = __importDefault$3(require$$0$3);
3025
+ const path_1$7 = require$$0$2;
3026
+ const resolveSymlinksAsync$1 = function (path, state, callback) {
3027
3027
  const { queue, options: { suppressErrors }, } = state;
3028
3028
  queue.enqueue();
3029
- fs_1$1.default.realpath(path, (error, resolvedPath) => {
3029
+ fs_1$3.default.realpath(path, (error, resolvedPath) => {
3030
3030
  if (error)
3031
3031
  return queue.dequeue(suppressErrors ? null : error, state);
3032
- fs_1$1.default.stat(resolvedPath, (error, stat) => {
3032
+ fs_1$3.default.stat(resolvedPath, (error, stat) => {
3033
3033
  if (error)
3034
3034
  return queue.dequeue(suppressErrors ? null : error, state);
3035
- if (stat.isDirectory() && isRecursive(path, resolvedPath, state))
3035
+ if (stat.isDirectory() && isRecursive$1(path, resolvedPath, state))
3036
3036
  return queue.dequeue(null, state);
3037
3037
  callback(stat, resolvedPath);
3038
3038
  queue.dequeue(null, state);
3039
3039
  });
3040
3040
  });
3041
3041
  };
3042
- const resolveSymlinks = function (path, state, callback) {
3042
+ const resolveSymlinks$1 = function (path, state, callback) {
3043
3043
  const { queue, options: { suppressErrors }, } = state;
3044
3044
  queue.enqueue();
3045
3045
  try {
3046
- const resolvedPath = fs_1$1.default.realpathSync(path);
3047
- const stat = fs_1$1.default.statSync(resolvedPath);
3048
- if (stat.isDirectory() && isRecursive(path, resolvedPath, state))
3046
+ const resolvedPath = fs_1$3.default.realpathSync(path);
3047
+ const stat = fs_1$3.default.statSync(resolvedPath);
3048
+ if (stat.isDirectory() && isRecursive$1(path, resolvedPath, state))
3049
3049
  return;
3050
3050
  callback(stat, resolvedPath);
3051
3051
  }
@@ -3054,16 +3054,16 @@ const resolveSymlinks = function (path, state, callback) {
3054
3054
  throw e;
3055
3055
  }
3056
3056
  };
3057
- function build$5(options, isSynchronous) {
3057
+ function build$d(options, isSynchronous) {
3058
3058
  if (!options.resolveSymlinks || options.excludeSymlinks)
3059
3059
  return null;
3060
- return isSynchronous ? resolveSymlinks : resolveSymlinksAsync;
3060
+ return isSynchronous ? resolveSymlinks$1 : resolveSymlinksAsync$1;
3061
3061
  }
3062
- resolveSymlink$1.build = build$5;
3063
- function isRecursive(path, resolved, state) {
3062
+ resolveSymlink$3.build = build$d;
3063
+ function isRecursive$1(path, resolved, state) {
3064
3064
  if (state.options.useRealPaths)
3065
- return isRecursiveUsingRealPaths(resolved, state);
3066
- let parent = (0, path_1$2.dirname)(path);
3065
+ return isRecursiveUsingRealPaths$1(resolved, state);
3066
+ let parent = (0, path_1$7.dirname)(path);
3067
3067
  let depth = 1;
3068
3068
  while (parent !== state.root && depth < 2) {
3069
3069
  const resolvedPath = state.symlinks.get(parent);
@@ -3074,84 +3074,84 @@ function isRecursive(path, resolved, state) {
3074
3074
  if (isSameRoot)
3075
3075
  depth++;
3076
3076
  else
3077
- parent = (0, path_1$2.dirname)(parent);
3077
+ parent = (0, path_1$7.dirname)(parent);
3078
3078
  }
3079
3079
  state.symlinks.set(path, resolved);
3080
3080
  return depth > 1;
3081
3081
  }
3082
- function isRecursiveUsingRealPaths(resolved, state) {
3082
+ function isRecursiveUsingRealPaths$1(resolved, state) {
3083
3083
  return state.visited.includes(resolved + state.options.pathSeparator);
3084
3084
  }
3085
3085
 
3086
- var invokeCallback$1 = {};
3086
+ var invokeCallback$3 = {};
3087
3087
 
3088
- Object.defineProperty(invokeCallback$1, "__esModule", { value: true });
3089
- invokeCallback$1.build = undefined;
3090
- const onlyCountsSync = (state) => {
3088
+ Object.defineProperty(invokeCallback$3, "__esModule", { value: true });
3089
+ invokeCallback$3.build = undefined;
3090
+ const onlyCountsSync$1 = (state) => {
3091
3091
  return state.counts;
3092
3092
  };
3093
- const groupsSync = (state) => {
3093
+ const groupsSync$1 = (state) => {
3094
3094
  return state.groups;
3095
3095
  };
3096
- const defaultSync = (state) => {
3096
+ const defaultSync$1 = (state) => {
3097
3097
  return state.paths;
3098
3098
  };
3099
- const limitFilesSync = (state) => {
3099
+ const limitFilesSync$1 = (state) => {
3100
3100
  return state.paths.slice(0, state.options.maxFiles);
3101
3101
  };
3102
- const onlyCountsAsync = (state, error, callback) => {
3103
- report(error, callback, state.counts, state.options.suppressErrors);
3102
+ const onlyCountsAsync$1 = (state, error, callback) => {
3103
+ report$1(error, callback, state.counts, state.options.suppressErrors);
3104
3104
  return null;
3105
3105
  };
3106
- const defaultAsync = (state, error, callback) => {
3107
- report(error, callback, state.paths, state.options.suppressErrors);
3106
+ const defaultAsync$1 = (state, error, callback) => {
3107
+ report$1(error, callback, state.paths, state.options.suppressErrors);
3108
3108
  return null;
3109
3109
  };
3110
- const limitFilesAsync = (state, error, callback) => {
3111
- report(error, callback, state.paths.slice(0, state.options.maxFiles), state.options.suppressErrors);
3110
+ const limitFilesAsync$1 = (state, error, callback) => {
3111
+ report$1(error, callback, state.paths.slice(0, state.options.maxFiles), state.options.suppressErrors);
3112
3112
  return null;
3113
3113
  };
3114
- const groupsAsync = (state, error, callback) => {
3115
- report(error, callback, state.groups, state.options.suppressErrors);
3114
+ const groupsAsync$1 = (state, error, callback) => {
3115
+ report$1(error, callback, state.groups, state.options.suppressErrors);
3116
3116
  return null;
3117
3117
  };
3118
- function report(error, callback, output, suppressErrors) {
3118
+ function report$1(error, callback, output, suppressErrors) {
3119
3119
  if (error && !suppressErrors)
3120
3120
  callback(error, output);
3121
3121
  else
3122
3122
  callback(null, output);
3123
3123
  }
3124
- function build$4(options, isSynchronous) {
3124
+ function build$c(options, isSynchronous) {
3125
3125
  const { onlyCounts, group, maxFiles } = options;
3126
3126
  if (onlyCounts)
3127
3127
  return isSynchronous
3128
- ? onlyCountsSync
3129
- : onlyCountsAsync;
3128
+ ? onlyCountsSync$1
3129
+ : onlyCountsAsync$1;
3130
3130
  else if (group)
3131
3131
  return isSynchronous
3132
- ? groupsSync
3133
- : groupsAsync;
3132
+ ? groupsSync$1
3133
+ : groupsAsync$1;
3134
3134
  else if (maxFiles)
3135
3135
  return isSynchronous
3136
- ? limitFilesSync
3137
- : limitFilesAsync;
3136
+ ? limitFilesSync$1
3137
+ : limitFilesAsync$1;
3138
3138
  else
3139
3139
  return isSynchronous
3140
- ? defaultSync
3141
- : defaultAsync;
3140
+ ? defaultSync$1
3141
+ : defaultAsync$1;
3142
3142
  }
3143
- invokeCallback$1.build = build$4;
3143
+ invokeCallback$3.build = build$c;
3144
3144
 
3145
- var walkDirectory$1 = {};
3145
+ var walkDirectory$3 = {};
3146
3146
 
3147
- var __importDefault = (walkDirectory$1.__importDefault) || function (mod) {
3147
+ var __importDefault$2 = (walkDirectory$3.__importDefault) || function (mod) {
3148
3148
  return (mod && mod.__esModule) ? mod : { "default": mod };
3149
3149
  };
3150
- Object.defineProperty(walkDirectory$1, "__esModule", { value: true });
3151
- walkDirectory$1.build = undefined;
3152
- const fs_1 = __importDefault(require$$0$3);
3153
- const readdirOpts = { withFileTypes: true };
3154
- const walkAsync = (state, crawlPath, directoryPath, currentDepth, callback) => {
3150
+ Object.defineProperty(walkDirectory$3, "__esModule", { value: true });
3151
+ walkDirectory$3.build = undefined;
3152
+ const fs_1$2 = __importDefault$2(require$$0$3);
3153
+ const readdirOpts$1 = { withFileTypes: true };
3154
+ const walkAsync$1 = (state, crawlPath, directoryPath, currentDepth, callback) => {
3155
3155
  if (currentDepth < 0)
3156
3156
  return state.queue.dequeue(null, state);
3157
3157
  state.visited.push(crawlPath);
@@ -3159,19 +3159,19 @@ const walkAsync = (state, crawlPath, directoryPath, currentDepth, callback) => {
3159
3159
  state.queue.enqueue();
3160
3160
  // Perf: Node >= 10 introduced withFileTypes that helps us
3161
3161
  // skip an extra fs.stat call.
3162
- fs_1.default.readdir(crawlPath || ".", readdirOpts, (error, entries = []) => {
3162
+ fs_1$2.default.readdir(crawlPath || ".", readdirOpts$1, (error, entries = []) => {
3163
3163
  callback(entries, directoryPath, currentDepth);
3164
3164
  state.queue.dequeue(state.options.suppressErrors ? null : error, state);
3165
3165
  });
3166
3166
  };
3167
- const walkSync = (state, crawlPath, directoryPath, currentDepth, callback) => {
3167
+ const walkSync$1 = (state, crawlPath, directoryPath, currentDepth, callback) => {
3168
3168
  if (currentDepth < 0)
3169
3169
  return;
3170
3170
  state.visited.push(crawlPath);
3171
3171
  state.counts.directories++;
3172
3172
  let entries = [];
3173
3173
  try {
3174
- entries = fs_1.default.readdirSync(crawlPath || ".", readdirOpts);
3174
+ entries = fs_1$2.default.readdirSync(crawlPath || ".", readdirOpts$1);
3175
3175
  }
3176
3176
  catch (e) {
3177
3177
  if (!state.options.suppressErrors)
@@ -3179,21 +3179,21 @@ const walkSync = (state, crawlPath, directoryPath, currentDepth, callback) => {
3179
3179
  }
3180
3180
  callback(entries, directoryPath, currentDepth);
3181
3181
  };
3182
- function build$3(isSynchronous) {
3183
- return isSynchronous ? walkSync : walkAsync;
3182
+ function build$b(isSynchronous) {
3183
+ return isSynchronous ? walkSync$1 : walkAsync$1;
3184
3184
  }
3185
- walkDirectory$1.build = build$3;
3185
+ walkDirectory$3.build = build$b;
3186
3186
 
3187
- var queue = {};
3187
+ var queue$1 = {};
3188
3188
 
3189
- Object.defineProperty(queue, "__esModule", { value: true });
3190
- queue.Queue = undefined;
3189
+ Object.defineProperty(queue$1, "__esModule", { value: true });
3190
+ queue$1.Queue = undefined;
3191
3191
  /**
3192
3192
  * This is a custom stateless queue to track concurrent async fs calls.
3193
3193
  * It increments a counter whenever a call is queued and decrements it
3194
3194
  * as soon as it completes. When the counter hits 0, it calls onQueueEmpty.
3195
3195
  */
3196
- class Queue {
3196
+ let Queue$1 = class Queue {
3197
3197
  onQueueEmpty;
3198
3198
  count = 0;
3199
3199
  constructor(onQueueEmpty) {
@@ -3206,14 +3206,14 @@ class Queue {
3206
3206
  if (--this.count <= 0 || error)
3207
3207
  this.onQueueEmpty(error, output);
3208
3208
  }
3209
- }
3210
- queue.Queue = Queue;
3209
+ };
3210
+ queue$1.Queue = Queue$1;
3211
3211
 
3212
- var counter = {};
3212
+ var counter$1 = {};
3213
3213
 
3214
- Object.defineProperty(counter, "__esModule", { value: true });
3215
- counter.Counter = undefined;
3216
- class Counter {
3214
+ Object.defineProperty(counter$1, "__esModule", { value: true });
3215
+ counter$1.Counter = undefined;
3216
+ let Counter$1 = class Counter {
3217
3217
  _files = 0;
3218
3218
  _directories = 0;
3219
3219
  set files(num) {
@@ -3235,10 +3235,10 @@ class Counter {
3235
3235
  get dirs() {
3236
3236
  return this._directories;
3237
3237
  }
3238
- }
3239
- counter.Counter = Counter;
3238
+ };
3239
+ counter$1.Counter = Counter$1;
3240
3240
 
3241
- var __createBinding = (walker.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3241
+ var __createBinding$1 = (walker$1.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3242
3242
  if (k2 === undefined) k2 = k;
3243
3243
  var desc = Object.getOwnPropertyDescriptor(m, k);
3244
3244
  if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
@@ -3249,33 +3249,33 @@ var __createBinding = (walker.__createBinding) || (Object.create ? (function(o,
3249
3249
  if (k2 === undefined) k2 = k;
3250
3250
  o[k2] = m[k];
3251
3251
  }));
3252
- var __setModuleDefault = (walker.__setModuleDefault) || (Object.create ? (function(o, v) {
3252
+ var __setModuleDefault$1 = (walker$1.__setModuleDefault) || (Object.create ? (function(o, v) {
3253
3253
  Object.defineProperty(o, "default", { enumerable: true, value: v });
3254
3254
  }) : function(o, v) {
3255
3255
  o["default"] = v;
3256
3256
  });
3257
- var __importStar = (walker.__importStar) || function (mod) {
3257
+ var __importStar$1 = (walker$1.__importStar) || function (mod) {
3258
3258
  if (mod && mod.__esModule) return mod;
3259
3259
  var result = {};
3260
- if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
3261
- __setModuleDefault(result, mod);
3260
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding$1(result, mod, k);
3261
+ __setModuleDefault$1(result, mod);
3262
3262
  return result;
3263
3263
  };
3264
- Object.defineProperty(walker, "__esModule", { value: true });
3265
- walker.Walker = undefined;
3266
- const path_1$1 = require$$0$2;
3267
- const utils_1 = utils$8;
3268
- const joinPath = __importStar(joinPath$2);
3269
- const pushDirectory = __importStar(pushDirectory$2);
3270
- const pushFile = __importStar(pushFile$2);
3271
- const getArray = __importStar(getArray$2);
3272
- const groupFiles = __importStar(groupFiles$2);
3273
- const resolveSymlink = __importStar(resolveSymlink$1);
3274
- const invokeCallback = __importStar(invokeCallback$1);
3275
- const walkDirectory = __importStar(walkDirectory$1);
3276
- const queue_1 = queue;
3277
- const counter_1 = counter;
3278
- class Walker {
3264
+ Object.defineProperty(walker$1, "__esModule", { value: true });
3265
+ walker$1.Walker = undefined;
3266
+ const path_1$6 = require$$0$2;
3267
+ const utils_1$2 = utils$9;
3268
+ const joinPath$3 = __importStar$1(joinPath$5);
3269
+ const pushDirectory$3 = __importStar$1(pushDirectory$5);
3270
+ const pushFile$3 = __importStar$1(pushFile$5);
3271
+ const getArray$3 = __importStar$1(getArray$5);
3272
+ const groupFiles$3 = __importStar$1(groupFiles$5);
3273
+ const resolveSymlink$2 = __importStar$1(resolveSymlink$3);
3274
+ const invokeCallback$2 = __importStar$1(invokeCallback$3);
3275
+ const walkDirectory$2 = __importStar$1(walkDirectory$3);
3276
+ const queue_1$1 = queue$1;
3277
+ const counter_1$1 = counter$1;
3278
+ let Walker$1 = class Walker {
3279
3279
  root;
3280
3280
  isSynchronous;
3281
3281
  state;
@@ -3289,16 +3289,16 @@ class Walker {
3289
3289
  callbackInvoker;
3290
3290
  constructor(root, options, callback) {
3291
3291
  this.isSynchronous = !callback;
3292
- this.callbackInvoker = invokeCallback.build(options, this.isSynchronous);
3293
- this.root = (0, utils_1.normalizePath)(root, options);
3292
+ this.callbackInvoker = invokeCallback$2.build(options, this.isSynchronous);
3293
+ this.root = (0, utils_1$2.normalizePath)(root, options);
3294
3294
  this.state = {
3295
3295
  root: this.root.slice(0, -1),
3296
3296
  // Perf: we explicitly tell the compiler to optimize for String arrays
3297
3297
  paths: [""].slice(0, 0),
3298
3298
  groups: [],
3299
- counts: new counter_1.Counter(),
3299
+ counts: new counter_1$1.Counter(),
3300
3300
  options,
3301
- queue: new queue_1.Queue((error, state) => this.callbackInvoker(state, error, callback)),
3301
+ queue: new queue_1$1.Queue((error, state) => this.callbackInvoker(state, error, callback)),
3302
3302
  symlinks: new Map(),
3303
3303
  visited: [""].slice(0, 0),
3304
3304
  };
@@ -3307,13 +3307,13 @@ class Walker {
3307
3307
  * performance boost. Since these functions are so small, they are automatically inlined
3308
3308
  * by the javascript engine so there's no function call overhead (in most cases).
3309
3309
  */
3310
- this.joinPath = joinPath.build(this.root, options);
3311
- this.pushDirectory = pushDirectory.build(this.root, options);
3312
- this.pushFile = pushFile.build(options);
3313
- this.getArray = getArray.build(options);
3314
- this.groupFiles = groupFiles.build(options);
3315
- this.resolveSymlink = resolveSymlink.build(options, this.isSynchronous);
3316
- this.walkDirectory = walkDirectory.build(this.isSynchronous);
3310
+ this.joinPath = joinPath$3.build(this.root, options);
3311
+ this.pushDirectory = pushDirectory$3.build(this.root, options);
3312
+ this.pushFile = pushFile$3.build(options);
3313
+ this.getArray = getArray$3.build(options);
3314
+ this.groupFiles = groupFiles$3.build(options);
3315
+ this.resolveSymlink = resolveSymlink$2.build(options, this.isSynchronous);
3316
+ this.walkDirectory = walkDirectory$2.build(this.isSynchronous);
3317
3317
  }
3318
3318
  start() {
3319
3319
  this.walkDirectory(this.state, this.root, this.root, this.state.options.maxDepth, this.walk);
@@ -3333,24 +3333,24 @@ class Walker {
3333
3333
  this.pushFile(filename, files, this.state.counts, filters);
3334
3334
  }
3335
3335
  else if (entry.isDirectory()) {
3336
- let path = joinPath.joinDirectoryPath(entry.name, directoryPath, this.state.options.pathSeparator);
3336
+ let path = joinPath$3.joinDirectoryPath(entry.name, directoryPath, this.state.options.pathSeparator);
3337
3337
  if (exclude && exclude(entry.name, path))
3338
3338
  continue;
3339
3339
  this.walkDirectory(this.state, path, path, depth - 1, this.walk);
3340
3340
  }
3341
3341
  else if (entry.isSymbolicLink() && this.resolveSymlink) {
3342
- let path = joinPath.joinPathWithBasePath(entry.name, directoryPath);
3342
+ let path = joinPath$3.joinPathWithBasePath(entry.name, directoryPath);
3343
3343
  this.resolveSymlink(path, this.state, (stat, resolvedPath) => {
3344
3344
  if (stat.isDirectory()) {
3345
- resolvedPath = (0, utils_1.normalizePath)(resolvedPath, this.state.options);
3345
+ resolvedPath = (0, utils_1$2.normalizePath)(resolvedPath, this.state.options);
3346
3346
  if (exclude && exclude(entry.name, resolvedPath))
3347
3347
  return;
3348
3348
  this.walkDirectory(this.state, resolvedPath, useRealPaths ? resolvedPath : path + pathSeparator, depth - 1, this.walk);
3349
3349
  }
3350
3350
  else {
3351
3351
  resolvedPath = useRealPaths ? resolvedPath : path;
3352
- const filename = (0, path_1$1.basename)(resolvedPath);
3353
- const directoryPath = (0, utils_1.normalizePath)((0, path_1$1.dirname)(resolvedPath), this.state.options);
3352
+ const filename = (0, path_1$6.basename)(resolvedPath);
3353
+ const directoryPath = (0, utils_1$2.normalizePath)((0, path_1$6.dirname)(resolvedPath), this.state.options);
3354
3354
  resolvedPath = this.joinPath(filename, directoryPath);
3355
3355
  this.pushFile(resolvedPath, files, this.state.counts, filters);
3356
3356
  }
@@ -3359,44 +3359,44 @@ class Walker {
3359
3359
  }
3360
3360
  this.groupFiles(this.state.groups, directoryPath, files);
3361
3361
  };
3362
- }
3363
- walker.Walker = Walker;
3362
+ };
3363
+ walker$1.Walker = Walker$1;
3364
3364
 
3365
- Object.defineProperty(async, "__esModule", { value: true });
3366
- async.callback = async.promise = undefined;
3367
- const walker_1$1 = walker;
3368
- function promise(root, options) {
3365
+ Object.defineProperty(async$1, "__esModule", { value: true });
3366
+ async$1.callback = async$1.promise = undefined;
3367
+ const walker_1$3 = walker$1;
3368
+ function promise$1(root, options) {
3369
3369
  return new Promise((resolve, reject) => {
3370
- callback(root, options, (err, output) => {
3370
+ callback$1(root, options, (err, output) => {
3371
3371
  if (err)
3372
3372
  return reject(err);
3373
3373
  resolve(output);
3374
3374
  });
3375
3375
  });
3376
3376
  }
3377
- async.promise = promise;
3378
- function callback(root, options, callback) {
3379
- let walker = new walker_1$1.Walker(root, options, callback);
3377
+ async$1.promise = promise$1;
3378
+ function callback$1(root, options, callback) {
3379
+ let walker = new walker_1$3.Walker(root, options, callback);
3380
3380
  walker.start();
3381
3381
  }
3382
- async.callback = callback;
3382
+ async$1.callback = callback$1;
3383
3383
 
3384
- var sync$2 = {};
3384
+ var sync$4 = {};
3385
3385
 
3386
- Object.defineProperty(sync$2, "__esModule", { value: true });
3387
- sync$2.sync = undefined;
3388
- const walker_1 = walker;
3389
- function sync$1(root, options) {
3390
- const walker = new walker_1.Walker(root, options);
3386
+ Object.defineProperty(sync$4, "__esModule", { value: true });
3387
+ sync$4.sync = undefined;
3388
+ const walker_1$2 = walker$1;
3389
+ function sync$3(root, options) {
3390
+ const walker = new walker_1$2.Walker(root, options);
3391
3391
  return walker.start();
3392
3392
  }
3393
- sync$2.sync = sync$1;
3393
+ sync$4.sync = sync$3;
3394
3394
 
3395
- Object.defineProperty(apiBuilder, "__esModule", { value: true });
3396
- apiBuilder.APIBuilder = undefined;
3397
- const async_1 = async;
3398
- const sync_1 = sync$2;
3399
- class APIBuilder {
3395
+ Object.defineProperty(apiBuilder$1, "__esModule", { value: true });
3396
+ apiBuilder$1.APIBuilder = undefined;
3397
+ const async_1$1 = async$1;
3398
+ const sync_1$1 = sync$4;
3399
+ let APIBuilder$1 = class APIBuilder {
3400
3400
  root;
3401
3401
  options;
3402
3402
  constructor(root, options) {
@@ -3404,36 +3404,36 @@ class APIBuilder {
3404
3404
  this.options = options;
3405
3405
  }
3406
3406
  withPromise() {
3407
- return (0, async_1.promise)(this.root, this.options);
3407
+ return (0, async_1$1.promise)(this.root, this.options);
3408
3408
  }
3409
3409
  withCallback(cb) {
3410
- (0, async_1.callback)(this.root, this.options, cb);
3410
+ (0, async_1$1.callback)(this.root, this.options, cb);
3411
3411
  }
3412
3412
  sync() {
3413
- return (0, sync_1.sync)(this.root, this.options);
3413
+ return (0, sync_1$1.sync)(this.root, this.options);
3414
3414
  }
3415
- }
3416
- apiBuilder.APIBuilder = APIBuilder;
3415
+ };
3416
+ apiBuilder$1.APIBuilder = APIBuilder$1;
3417
3417
 
3418
- Object.defineProperty(builder, "__esModule", { value: true });
3419
- builder.Builder = undefined;
3420
- const path_1 = require$$0$2;
3421
- const api_builder_1 = apiBuilder;
3422
- var pm = null;
3418
+ Object.defineProperty(builder$1, "__esModule", { value: true });
3419
+ builder$1.Builder = undefined;
3420
+ const path_1$5 = require$$0$2;
3421
+ const api_builder_1$1 = apiBuilder$1;
3422
+ var pm$1 = null;
3423
3423
  /* c8 ignore next 6 */
3424
3424
  try {
3425
3425
  require.resolve("picomatch");
3426
- pm = picomatch_1$1;
3426
+ pm$1 = picomatch_1$1;
3427
3427
  }
3428
3428
  catch (_e) {
3429
3429
  // do nothing
3430
3430
  }
3431
- class Builder {
3431
+ let Builder$1 = class Builder {
3432
3432
  globCache = {};
3433
3433
  options = {
3434
3434
  maxDepth: Infinity,
3435
3435
  suppressErrors: true,
3436
- pathSeparator: path_1.sep,
3436
+ pathSeparator: path_1$5.sep,
3437
3437
  filters: [],
3438
3438
  };
3439
3439
  globFunction;
@@ -3509,7 +3509,7 @@ class Builder {
3509
3509
  return this;
3510
3510
  }
3511
3511
  crawl(root) {
3512
- return new api_builder_1.APIBuilder(root || ".", this.options);
3512
+ return new api_builder_1$1.APIBuilder(root || ".", this.options);
3513
3513
  }
3514
3514
  withGlobFunction(fn) {
3515
3515
  // cast this since we don't have the new type params yet
@@ -3526,7 +3526,7 @@ class Builder {
3526
3526
  /* c8 ignore next 4 */
3527
3527
  crawlWithOptions(root, options) {
3528
3528
  this.options = { ...this.options, ...options };
3529
- return new api_builder_1.APIBuilder(root || ".", this.options);
3529
+ return new api_builder_1$1.APIBuilder(root || ".", this.options);
3530
3530
  }
3531
3531
  glob(...patterns) {
3532
3532
  if (this.globFunction) {
@@ -3535,7 +3535,7 @@ class Builder {
3535
3535
  return this.globWithOptions(patterns, ...[{ dot: true }]);
3536
3536
  }
3537
3537
  globWithOptions(patterns, ...options) {
3538
- const globFn = (this.globFunction || pm);
3538
+ const globFn = (this.globFunction || pm$1);
3539
3539
  /* c8 ignore next 5 */
3540
3540
  if (!globFn) {
3541
3541
  throw new Error('Please specify a glob function to use glob matching.');
@@ -3548,15 +3548,15 @@ class Builder {
3548
3548
  this.options.filters.push((path) => isMatch(path));
3549
3549
  return this;
3550
3550
  }
3551
- }
3552
- builder.Builder = Builder;
3551
+ };
3552
+ builder$1.Builder = Builder$1;
3553
3553
 
3554
- var types$1 = {};
3554
+ var types$2 = {};
3555
3555
 
3556
- Object.defineProperty(types$1, "__esModule", { value: true });
3556
+ Object.defineProperty(types$2, "__esModule", { value: true });
3557
3557
 
3558
3558
  (function (exports) {
3559
- var __createBinding = (dist.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3559
+ var __createBinding = (dist$1.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3560
3560
  if (k2 === undefined) k2 = k;
3561
3561
  var desc = Object.getOwnPropertyDescriptor(m, k);
3562
3562
  if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
@@ -3567,15 +3567,15 @@ Object.defineProperty(types$1, "__esModule", { value: true });
3567
3567
  if (k2 === undefined) k2 = k;
3568
3568
  o[k2] = m[k];
3569
3569
  }));
3570
- var __exportStar = (dist.__exportStar) || function(m, exports) {
3570
+ var __exportStar = (dist$1.__exportStar) || function(m, exports) {
3571
3571
  for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
3572
3572
  };
3573
3573
  Object.defineProperty(exports, "__esModule", { value: true });
3574
3574
  exports.fdir = undefined;
3575
- const builder_1 = builder;
3575
+ const builder_1 = builder$1;
3576
3576
  Object.defineProperty(exports, "fdir", { enumerable: true, get: function () { return builder_1.Builder; } });
3577
- __exportStar(types$1, exports);
3578
- } (dist));
3577
+ __exportStar(types$2, exports);
3578
+ } (dist$1));
3579
3579
 
3580
3580
  const comma = ','.charCodeAt(0);
3581
3581
  const semicolon = ';'.charCodeAt(0);
@@ -5234,7 +5234,7 @@ function getDynamicRequireModules(patterns, dynamicRequireRoot) {
5234
5234
  ? dynamicRequireModules.delete(targetPath)
5235
5235
  : dynamicRequireModules.set(targetPath, resolvedPath);
5236
5236
  // eslint-disable-next-line new-cap
5237
- for (const path of new dist.fdir()
5237
+ for (const path of new dist$1.fdir()
5238
5238
  .withBasePath()
5239
5239
  .withDirs()
5240
5240
  .glob(isNegated ? pattern.substr(1) : pattern)
@@ -7492,7 +7492,7 @@ function stripPathFilename(path) {
7492
7492
  return path.slice(0, index + 1);
7493
7493
  }
7494
7494
  function mergePaths(url, base) {
7495
- normalizePath$4(base, base.type);
7495
+ normalizePath$5(base, base.type);
7496
7496
  // If the path is just a "/", then it was an empty path to begin with (remember, we're a relative
7497
7497
  // path).
7498
7498
  if (url.path === '/') {
@@ -7507,7 +7507,7 @@ function mergePaths(url, base) {
7507
7507
  * The path can have empty directories "//", unneeded parents "foo/..", or current directory
7508
7508
  * "foo/.". We need to normalize to a standard representation.
7509
7509
  */
7510
- function normalizePath$4(url, type) {
7510
+ function normalizePath$5(url, type) {
7511
7511
  const rel = type <= 4 /* RelativePath */;
7512
7512
  const pieces = url.path.split('/');
7513
7513
  // We need to preserve the first piece always, so that we output a leading slash. The item at
@@ -7596,7 +7596,7 @@ function resolve$2(input, base) {
7596
7596
  if (baseType > inputType)
7597
7597
  inputType = baseType;
7598
7598
  }
7599
- normalizePath$4(url, inputType);
7599
+ normalizePath$5(url, inputType);
7600
7600
  const queryHash = url.query + url.hash;
7601
7601
  switch (inputType) {
7602
7602
  // This is impossible, because of the empty checks at the start of the function.
@@ -8231,13 +8231,13 @@ function buildSourceMapTree(input, loader) {
8231
8231
  'Did you specify these with the most recent transformation maps first?');
8232
8232
  }
8233
8233
  }
8234
- let tree = build$2(map, loader, '', 0);
8234
+ let tree = build$a(map, loader, '', 0);
8235
8235
  for (let i = maps.length - 1; i >= 0; i--) {
8236
8236
  tree = MapSource(maps[i], [tree]);
8237
8237
  }
8238
8238
  return tree;
8239
8239
  }
8240
- function build$2(map, loader, importer, importerDepth) {
8240
+ function build$a(map, loader, importer, importerDepth) {
8241
8241
  const { resolvedSources, sourcesContent, ignoreList } = map;
8242
8242
  const depth = importerDepth + 1;
8243
8243
  const children = resolvedSources.map((sourceFile, i) => {
@@ -8258,7 +8258,7 @@ function build$2(map, loader, importer, importerDepth) {
8258
8258
  const { source, content, ignore } = ctx;
8259
8259
  // If there is a sourcemap, then we need to recurse into it to load its source files.
8260
8260
  if (sourceMap)
8261
- return build$2(new TraceMap(sourceMap, source), loader, source, depth);
8261
+ return build$a(new TraceMap(sourceMap, source), loader, source, depth);
8262
8262
  // Else, it's an unmodified source file.
8263
8263
  // The contents of this unmodified source file can be overridden via the loader context,
8264
8264
  // allowing it to be explicitly null or a string. If it remains undefined, we fall back to
@@ -9368,7 +9368,7 @@ if (process.versions.pnp) {
9368
9368
  }
9369
9369
  }
9370
9370
  function invalidatePackageData(packageCache, pkgPath) {
9371
- const pkgDir = normalizePath$3(path$d.dirname(pkgPath));
9371
+ const pkgDir = normalizePath$4(path$d.dirname(pkgPath));
9372
9372
  packageCache.forEach((pkg, cacheKey) => {
9373
9373
  if (pkg.dir === pkgDir) {
9374
9374
  packageCache.delete(cacheKey);
@@ -9461,7 +9461,7 @@ function findNearestMainPackageData(basedir, packageCache) {
9461
9461
  }
9462
9462
  function loadPackageData(pkgPath) {
9463
9463
  const data = JSON.parse(stripBomTag(fs__default.readFileSync(pkgPath, "utf-8")));
9464
- const pkgDir = normalizePath$3(path$d.dirname(pkgPath));
9464
+ const pkgDir = normalizePath$4(path$d.dirname(pkgPath));
9465
9465
  const { sideEffects } = data;
9466
9466
  let hasSideEffects;
9467
9467
  if (typeof sideEffects === "boolean") {
@@ -9715,11 +9715,11 @@ const urlCanParse = (
9715
9715
  );
9716
9716
  const isCaseInsensitiveFS = testCaseInsensitiveFS();
9717
9717
  const VOLUME_RE = /^[A-Z]:/i;
9718
- function normalizePath$3(id) {
9718
+ function normalizePath$4(id) {
9719
9719
  return path$d.posix.normalize(isWindows$3 ? slash$1(id) : id);
9720
9720
  }
9721
9721
  function fsPathFromId(id) {
9722
- const fsPath = normalizePath$3(
9722
+ const fsPath = normalizePath$4(
9723
9723
  id.startsWith(FS_PREFIX) ? id.slice(FS_PREFIX.length) : id
9724
9724
  );
9725
9725
  return fsPath[0] === "/" || VOLUME_RE.test(fsPath) ? fsPath : `/${fsPath}`;
@@ -10024,7 +10024,7 @@ async function recursiveReaddir(dir) {
10024
10024
  const files = await Promise.all(
10025
10025
  dirents.map((dirent) => {
10026
10026
  const res = path$d.resolve(dir, dirent.name);
10027
- return dirent.isDirectory() ? recursiveReaddir(res) : normalizePath$3(res);
10027
+ return dirent.isDirectory() ? recursiveReaddir(res) : normalizePath$4(res);
10028
10028
  })
10029
10029
  );
10030
10030
  return files.flat(1);
@@ -10284,7 +10284,9 @@ function extractHostnamesFromSubjectAltName(subjectAltName) {
10284
10284
  /* for , */
10285
10285
  1
10286
10286
  ).trimStart();
10287
- if (name === "DNS" && value !== "[::1]") {
10287
+ if (name === "DNS" && // [::1] might be included but skip it as it's already included as a local address
10288
+ value !== "[::1]" && // skip *.IPv4 addresses, which is invalid
10289
+ !(value.startsWith("*.") && net$1.isIPv4(value.slice(2)))) {
10288
10290
  hostnames.push(value.replace("*", "vite"));
10289
10291
  }
10290
10292
  }
@@ -10916,7 +10918,7 @@ function buildReporterPlugin(config) {
10916
10918
  const sizePad = displaySize(biggestSize).length;
10917
10919
  const mapPad = displaySize(biggestMap).length;
10918
10920
  const compressPad = displaySize(biggestCompressSize).length;
10919
- const relativeOutDir = normalizePath$3(
10921
+ const relativeOutDir = normalizePath$4(
10920
10922
  path$d.relative(
10921
10923
  config.root,
10922
10924
  path$d.resolve(
@@ -11358,16 +11360,16 @@ function pattern2regex(resolvedPattern, allowJs) {
11358
11360
 
11359
11361
  /**
11360
11362
  * replace tokens like ${configDir}
11361
- * @param {any} tsconfig
11362
- * @param {string} configDir
11363
- * @returns {any}
11364
- */
11365
- function replaceTokens(tsconfig, configDir) {
11366
- return JSON.parse(
11367
- JSON.stringify(tsconfig)
11368
- // replace ${configDir}
11369
- .replaceAll(/"\${configDir}/g, `"${native2posix(configDir)}`)
11370
- );
11363
+ * @param {import('./public.d.ts').TSConfckParseResult} result
11364
+ */
11365
+ function replaceTokens(result) {
11366
+ if (result.tsconfig) {
11367
+ result.tsconfig = JSON.parse(
11368
+ JSON.stringify(result.tsconfig)
11369
+ // replace ${configDir}
11370
+ .replaceAll(/"\${configDir}/g, `"${native2posix(path$d.dirname(result.tsconfigFile))}`)
11371
+ );
11372
+ }
11371
11373
  }
11372
11374
 
11373
11375
  /**
@@ -11646,7 +11648,7 @@ async function parse$f(filename, options) {
11646
11648
  result = await parseFile$1(tsconfigFile, cache, filename === tsconfigFile);
11647
11649
  await Promise.all([parseExtends(result, cache), parseReferences(result, options)]);
11648
11650
  }
11649
- result.tsconfig = replaceTokens(result.tsconfig, path$d.dirname(tsconfigFile));
11651
+ replaceTokens(result);
11650
11652
  resolve(resolveSolutionTSConfig(filename, result));
11651
11653
  } catch (e) {
11652
11654
  reject(e);
@@ -11752,6 +11754,7 @@ async function parseReferences(result, options) {
11752
11754
  await Promise.all(referenced.map((ref) => parseExtends(ref, options?.cache)));
11753
11755
  referenced.forEach((ref) => {
11754
11756
  ref.solution = result;
11757
+ replaceTokens(ref);
11755
11758
  });
11756
11759
  result.referenced = referenced;
11757
11760
  }
@@ -13110,6 +13113,7 @@ const mimes = {
13110
13113
  "jsonml": "application/jsonml+json",
13111
13114
  "jsx": "text/jsx",
13112
13115
  "jt": "model/jt",
13116
+ "jxl": "image/jxl",
13113
13117
  "jxr": "image/jxr",
13114
13118
  "jxra": "image/jxra",
13115
13119
  "jxrs": "image/jxrs",
@@ -13130,6 +13134,8 @@ const mimes = {
13130
13134
  "m1v": "video/mpeg",
13131
13135
  "m21": "application/mp21",
13132
13136
  "m2a": "audio/mpeg",
13137
+ "m2t": "video/mp2t",
13138
+ "m2ts": "video/mp2t",
13133
13139
  "m2v": "video/mpeg",
13134
13140
  "m3a": "audio/mpeg",
13135
13141
  "m4a": "audio/mp4",
@@ -13190,6 +13196,7 @@ const mimes = {
13190
13196
  "msm": "application/octet-stream",
13191
13197
  "msp": "application/octet-stream",
13192
13198
  "mtl": "model/mtl",
13199
+ "mts": "video/mp2t",
13193
13200
  "musd": "application/mmt-usd+xml",
13194
13201
  "mxf": "application/mxf",
13195
13202
  "mxmf": "audio/mobile-xmf",
@@ -13425,9 +13432,9 @@ function checkPublicFile(url, config) {
13425
13432
  const fileName = cleanUrl(url);
13426
13433
  const publicFiles = getPublicFiles(config);
13427
13434
  if (publicFiles) {
13428
- return publicFiles.has(fileName) ? normalizePath$3(path$d.join(publicDir, fileName)) : undefined;
13435
+ return publicFiles.has(fileName) ? normalizePath$4(path$d.join(publicDir, fileName)) : undefined;
13429
13436
  }
13430
- const publicFile = normalizePath$3(path$d.join(publicDir, fileName));
13437
+ const publicFile = normalizePath$4(path$d.join(publicDir, fileName));
13431
13438
  if (!publicFile.startsWith(withTrailingSlash(publicDir))) {
13432
13439
  return;
13433
13440
  }
@@ -13446,7 +13453,6 @@ function registerCustomMime() {
13446
13453
  mimes["cur"] = "image/x-icon";
13447
13454
  mimes["flac"] = "audio/flac";
13448
13455
  mimes["eot"] = "application/vnd.ms-fontobject";
13449
- mimes["jxl"] = "image/jxl";
13450
13456
  }
13451
13457
  function renderAssetUrlInJS(pluginContext, chunk, opts, code) {
13452
13458
  const { environment } = pluginContext;
@@ -13657,7 +13663,7 @@ async function fileToBuiltUrl(pluginContext, id, skipPublicCheck = false, forceI
13657
13663
  if (shouldInline(environment, file, id, content, pluginContext, forceInline)) {
13658
13664
  url = assetToDataURL(environment, file, content);
13659
13665
  } else {
13660
- const originalFileName = normalizePath$3(
13666
+ const originalFileName = normalizePath$4(
13661
13667
  path$d.relative(environment.config.root, file)
13662
13668
  );
13663
13669
  const referenceId = pluginContext.emitFile({
@@ -13855,7 +13861,7 @@ function manifestPlugin() {
13855
13861
  }
13856
13862
  function getChunkOriginalFileName(chunk, root, format) {
13857
13863
  if (chunk.facadeModuleId) {
13858
- let name = normalizePath$3(path$d.relative(root, chunk.facadeModuleId));
13864
+ let name = normalizePath$4(path$d.relative(root, chunk.facadeModuleId));
13859
13865
  if (format === "system" && !chunk.name.includes("-legacy")) {
13860
13866
  const ext = path$d.extname(name);
13861
13867
  const endPos = ext.length !== 0 ? -ext.length : undefined;
@@ -15106,27 +15112,822 @@ var src$1 = rc;
15106
15112
 
15107
15113
  var postcssrc = /*@__PURE__*/getDefaultExportFromCjs(src$1);
15108
15114
 
15115
+ var dist = {};
15116
+
15117
+ var builder = {};
15118
+
15119
+ var apiBuilder = {};
15120
+
15121
+ var async = {};
15122
+
15123
+ var walker = {};
15124
+
15125
+ var utils$8 = {};
15126
+
15127
+ Object.defineProperty(utils$8, "__esModule", { value: true });
15128
+ utils$8.normalizePath = utils$8.convertSlashes = utils$8.cleanPath = undefined;
15129
+ const path_1$4 = require$$0$2;
15130
+ function cleanPath(path) {
15131
+ let normalized = (0, path_1$4.normalize)(path);
15132
+ // we have to remove the last path separator
15133
+ // to account for / root path
15134
+ if (normalized.length > 1 && normalized[normalized.length - 1] === path_1$4.sep)
15135
+ normalized = normalized.substring(0, normalized.length - 1);
15136
+ return normalized;
15137
+ }
15138
+ utils$8.cleanPath = cleanPath;
15139
+ const SLASHES_REGEX = /[\\/]/g;
15140
+ function convertSlashes(path, separator) {
15141
+ return path.replace(SLASHES_REGEX, separator);
15142
+ }
15143
+ utils$8.convertSlashes = convertSlashes;
15144
+ function normalizePath$3(path, options) {
15145
+ const { resolvePaths, normalizePath, pathSeparator } = options;
15146
+ const pathNeedsCleaning = (process.platform === "win32" && path.includes("/")) ||
15147
+ path.startsWith(".");
15148
+ if (resolvePaths)
15149
+ path = (0, path_1$4.resolve)(path);
15150
+ if (normalizePath || pathNeedsCleaning)
15151
+ path = cleanPath(path);
15152
+ if (path === ".")
15153
+ return "";
15154
+ const needsSeperator = path[path.length - 1] !== pathSeparator;
15155
+ return convertSlashes(needsSeperator ? path + pathSeparator : path, pathSeparator);
15156
+ }
15157
+ utils$8.normalizePath = normalizePath$3;
15158
+
15159
+ var joinPath$2 = {};
15160
+
15161
+ Object.defineProperty(joinPath$2, "__esModule", { value: true });
15162
+ joinPath$2.build = joinPath$2.joinDirectoryPath = joinPath$2.joinPathWithBasePath = undefined;
15163
+ const path_1$3 = require$$0$2;
15164
+ const utils_1$1 = utils$8;
15165
+ function joinPathWithBasePath(filename, directoryPath) {
15166
+ return directoryPath + filename;
15167
+ }
15168
+ joinPath$2.joinPathWithBasePath = joinPathWithBasePath;
15169
+ function joinPathWithRelativePath(root, options) {
15170
+ return function (filename, directoryPath) {
15171
+ const sameRoot = directoryPath.startsWith(root);
15172
+ if (sameRoot)
15173
+ return directoryPath.replace(root, "") + filename;
15174
+ else
15175
+ return ((0, utils_1$1.convertSlashes)((0, path_1$3.relative)(root, directoryPath), options.pathSeparator) +
15176
+ options.pathSeparator +
15177
+ filename);
15178
+ };
15179
+ }
15180
+ function joinPath$1(filename) {
15181
+ return filename;
15182
+ }
15183
+ function joinDirectoryPath(filename, directoryPath, separator) {
15184
+ return directoryPath + filename + separator;
15185
+ }
15186
+ joinPath$2.joinDirectoryPath = joinDirectoryPath;
15187
+ function build$9(root, options) {
15188
+ const { relativePaths, includeBasePath } = options;
15189
+ return relativePaths && root
15190
+ ? joinPathWithRelativePath(root, options)
15191
+ : includeBasePath
15192
+ ? joinPathWithBasePath
15193
+ : joinPath$1;
15194
+ }
15195
+ joinPath$2.build = build$9;
15196
+
15197
+ var pushDirectory$2 = {};
15198
+
15199
+ Object.defineProperty(pushDirectory$2, "__esModule", { value: true });
15200
+ pushDirectory$2.build = undefined;
15201
+ function pushDirectoryWithRelativePath(root) {
15202
+ return function (directoryPath, paths) {
15203
+ paths.push(directoryPath.substring(root.length) || ".");
15204
+ };
15205
+ }
15206
+ function pushDirectoryFilterWithRelativePath(root) {
15207
+ return function (directoryPath, paths, filters) {
15208
+ const relativePath = directoryPath.substring(root.length) || ".";
15209
+ if (filters.every((filter) => filter(relativePath, true))) {
15210
+ paths.push(relativePath);
15211
+ }
15212
+ };
15213
+ }
15214
+ const pushDirectory$1 = (directoryPath, paths) => {
15215
+ paths.push(directoryPath || ".");
15216
+ };
15217
+ const pushDirectoryFilter = (directoryPath, paths, filters) => {
15218
+ const path = directoryPath || ".";
15219
+ if (filters.every((filter) => filter(path, true))) {
15220
+ paths.push(path);
15221
+ }
15222
+ };
15223
+ const empty$2 = () => { };
15224
+ function build$8(root, options) {
15225
+ const { includeDirs, filters, relativePaths } = options;
15226
+ if (!includeDirs)
15227
+ return empty$2;
15228
+ if (relativePaths)
15229
+ return filters && filters.length
15230
+ ? pushDirectoryFilterWithRelativePath(root)
15231
+ : pushDirectoryWithRelativePath(root);
15232
+ return filters && filters.length ? pushDirectoryFilter : pushDirectory$1;
15233
+ }
15234
+ pushDirectory$2.build = build$8;
15235
+
15236
+ var pushFile$2 = {};
15237
+
15238
+ Object.defineProperty(pushFile$2, "__esModule", { value: true });
15239
+ pushFile$2.build = undefined;
15240
+ const pushFileFilterAndCount = (filename, _paths, counts, filters) => {
15241
+ if (filters.every((filter) => filter(filename, false)))
15242
+ counts.files++;
15243
+ };
15244
+ const pushFileFilter = (filename, paths, _counts, filters) => {
15245
+ if (filters.every((filter) => filter(filename, false)))
15246
+ paths.push(filename);
15247
+ };
15248
+ const pushFileCount = (_filename, _paths, counts, _filters) => {
15249
+ counts.files++;
15250
+ };
15251
+ const pushFile$1 = (filename, paths) => {
15252
+ paths.push(filename);
15253
+ };
15254
+ const empty$1 = () => { };
15255
+ function build$7(options) {
15256
+ const { excludeFiles, filters, onlyCounts } = options;
15257
+ if (excludeFiles)
15258
+ return empty$1;
15259
+ if (filters && filters.length) {
15260
+ return onlyCounts ? pushFileFilterAndCount : pushFileFilter;
15261
+ }
15262
+ else if (onlyCounts) {
15263
+ return pushFileCount;
15264
+ }
15265
+ else {
15266
+ return pushFile$1;
15267
+ }
15268
+ }
15269
+ pushFile$2.build = build$7;
15270
+
15271
+ var getArray$2 = {};
15272
+
15273
+ Object.defineProperty(getArray$2, "__esModule", { value: true });
15274
+ getArray$2.build = undefined;
15275
+ const getArray$1 = (paths) => {
15276
+ return paths;
15277
+ };
15278
+ const getArrayGroup = () => {
15279
+ return [""].slice(0, 0);
15280
+ };
15281
+ function build$6(options) {
15282
+ return options.group ? getArrayGroup : getArray$1;
15283
+ }
15284
+ getArray$2.build = build$6;
15285
+
15286
+ var groupFiles$2 = {};
15287
+
15288
+ Object.defineProperty(groupFiles$2, "__esModule", { value: true });
15289
+ groupFiles$2.build = undefined;
15290
+ const groupFiles$1 = (groups, directory, files) => {
15291
+ groups.push({ directory, files, dir: directory });
15292
+ };
15293
+ const empty = () => { };
15294
+ function build$5(options) {
15295
+ return options.group ? groupFiles$1 : empty;
15296
+ }
15297
+ groupFiles$2.build = build$5;
15298
+
15299
+ var resolveSymlink$1 = {};
15300
+
15301
+ var __importDefault$1 = (resolveSymlink$1.__importDefault) || function (mod) {
15302
+ return (mod && mod.__esModule) ? mod : { "default": mod };
15303
+ };
15304
+ Object.defineProperty(resolveSymlink$1, "__esModule", { value: true });
15305
+ resolveSymlink$1.build = undefined;
15306
+ const fs_1$1 = __importDefault$1(require$$0$3);
15307
+ const path_1$2 = require$$0$2;
15308
+ const resolveSymlinksAsync = function (path, state, callback) {
15309
+ const { queue, options: { suppressErrors }, } = state;
15310
+ queue.enqueue();
15311
+ fs_1$1.default.realpath(path, (error, resolvedPath) => {
15312
+ if (error)
15313
+ return queue.dequeue(suppressErrors ? null : error, state);
15314
+ fs_1$1.default.stat(resolvedPath, (error, stat) => {
15315
+ if (error)
15316
+ return queue.dequeue(suppressErrors ? null : error, state);
15317
+ if (stat.isDirectory() && isRecursive(path, resolvedPath, state))
15318
+ return queue.dequeue(null, state);
15319
+ callback(stat, resolvedPath);
15320
+ queue.dequeue(null, state);
15321
+ });
15322
+ });
15323
+ };
15324
+ const resolveSymlinks = function (path, state, callback) {
15325
+ const { queue, options: { suppressErrors }, } = state;
15326
+ queue.enqueue();
15327
+ try {
15328
+ const resolvedPath = fs_1$1.default.realpathSync(path);
15329
+ const stat = fs_1$1.default.statSync(resolvedPath);
15330
+ if (stat.isDirectory() && isRecursive(path, resolvedPath, state))
15331
+ return;
15332
+ callback(stat, resolvedPath);
15333
+ }
15334
+ catch (e) {
15335
+ if (!suppressErrors)
15336
+ throw e;
15337
+ }
15338
+ };
15339
+ function build$4(options, isSynchronous) {
15340
+ if (!options.resolveSymlinks || options.excludeSymlinks)
15341
+ return null;
15342
+ return isSynchronous ? resolveSymlinks : resolveSymlinksAsync;
15343
+ }
15344
+ resolveSymlink$1.build = build$4;
15345
+ function isRecursive(path, resolved, state) {
15346
+ if (state.options.useRealPaths)
15347
+ return isRecursiveUsingRealPaths(resolved, state);
15348
+ let parent = (0, path_1$2.dirname)(path);
15349
+ let depth = 1;
15350
+ while (parent !== state.root && depth < 2) {
15351
+ const resolvedPath = state.symlinks.get(parent);
15352
+ const isSameRoot = !!resolvedPath &&
15353
+ (resolvedPath === resolved ||
15354
+ resolvedPath.startsWith(resolved) ||
15355
+ resolved.startsWith(resolvedPath));
15356
+ if (isSameRoot)
15357
+ depth++;
15358
+ else
15359
+ parent = (0, path_1$2.dirname)(parent);
15360
+ }
15361
+ state.symlinks.set(path, resolved);
15362
+ return depth > 1;
15363
+ }
15364
+ function isRecursiveUsingRealPaths(resolved, state) {
15365
+ return state.visited.includes(resolved + state.options.pathSeparator);
15366
+ }
15367
+
15368
+ var invokeCallback$1 = {};
15369
+
15370
+ Object.defineProperty(invokeCallback$1, "__esModule", { value: true });
15371
+ invokeCallback$1.build = undefined;
15372
+ const onlyCountsSync = (state) => {
15373
+ return state.counts;
15374
+ };
15375
+ const groupsSync = (state) => {
15376
+ return state.groups;
15377
+ };
15378
+ const defaultSync = (state) => {
15379
+ return state.paths;
15380
+ };
15381
+ const limitFilesSync = (state) => {
15382
+ return state.paths.slice(0, state.options.maxFiles);
15383
+ };
15384
+ const onlyCountsAsync = (state, error, callback) => {
15385
+ report(error, callback, state.counts, state.options.suppressErrors);
15386
+ return null;
15387
+ };
15388
+ const defaultAsync = (state, error, callback) => {
15389
+ report(error, callback, state.paths, state.options.suppressErrors);
15390
+ return null;
15391
+ };
15392
+ const limitFilesAsync = (state, error, callback) => {
15393
+ report(error, callback, state.paths.slice(0, state.options.maxFiles), state.options.suppressErrors);
15394
+ return null;
15395
+ };
15396
+ const groupsAsync = (state, error, callback) => {
15397
+ report(error, callback, state.groups, state.options.suppressErrors);
15398
+ return null;
15399
+ };
15400
+ function report(error, callback, output, suppressErrors) {
15401
+ if (error && !suppressErrors)
15402
+ callback(error, output);
15403
+ else
15404
+ callback(null, output);
15405
+ }
15406
+ function build$3(options, isSynchronous) {
15407
+ const { onlyCounts, group, maxFiles } = options;
15408
+ if (onlyCounts)
15409
+ return isSynchronous
15410
+ ? onlyCountsSync
15411
+ : onlyCountsAsync;
15412
+ else if (group)
15413
+ return isSynchronous
15414
+ ? groupsSync
15415
+ : groupsAsync;
15416
+ else if (maxFiles)
15417
+ return isSynchronous
15418
+ ? limitFilesSync
15419
+ : limitFilesAsync;
15420
+ else
15421
+ return isSynchronous
15422
+ ? defaultSync
15423
+ : defaultAsync;
15424
+ }
15425
+ invokeCallback$1.build = build$3;
15426
+
15427
+ var walkDirectory$1 = {};
15428
+
15429
+ var __importDefault = (walkDirectory$1.__importDefault) || function (mod) {
15430
+ return (mod && mod.__esModule) ? mod : { "default": mod };
15431
+ };
15432
+ Object.defineProperty(walkDirectory$1, "__esModule", { value: true });
15433
+ walkDirectory$1.build = undefined;
15434
+ const fs_1 = __importDefault(require$$0$3);
15435
+ const readdirOpts = { withFileTypes: true };
15436
+ const walkAsync = (state, crawlPath, directoryPath, currentDepth, callback) => {
15437
+ if (currentDepth < 0)
15438
+ return state.queue.dequeue(null, state);
15439
+ state.visited.push(crawlPath);
15440
+ state.counts.directories++;
15441
+ state.queue.enqueue();
15442
+ // Perf: Node >= 10 introduced withFileTypes that helps us
15443
+ // skip an extra fs.stat call.
15444
+ fs_1.default.readdir(crawlPath || ".", readdirOpts, (error, entries = []) => {
15445
+ callback(entries, directoryPath, currentDepth);
15446
+ state.queue.dequeue(state.options.suppressErrors ? null : error, state);
15447
+ });
15448
+ };
15449
+ const walkSync = (state, crawlPath, directoryPath, currentDepth, callback) => {
15450
+ if (currentDepth < 0)
15451
+ return;
15452
+ state.visited.push(crawlPath);
15453
+ state.counts.directories++;
15454
+ let entries = [];
15455
+ try {
15456
+ entries = fs_1.default.readdirSync(crawlPath || ".", readdirOpts);
15457
+ }
15458
+ catch (e) {
15459
+ if (!state.options.suppressErrors)
15460
+ throw e;
15461
+ }
15462
+ callback(entries, directoryPath, currentDepth);
15463
+ };
15464
+ function build$2(isSynchronous) {
15465
+ return isSynchronous ? walkSync : walkAsync;
15466
+ }
15467
+ walkDirectory$1.build = build$2;
15468
+
15469
+ var queue = {};
15470
+
15471
+ Object.defineProperty(queue, "__esModule", { value: true });
15472
+ queue.Queue = undefined;
15473
+ /**
15474
+ * This is a custom stateless queue to track concurrent async fs calls.
15475
+ * It increments a counter whenever a call is queued and decrements it
15476
+ * as soon as it completes. When the counter hits 0, it calls onQueueEmpty.
15477
+ */
15478
+ class Queue {
15479
+ onQueueEmpty;
15480
+ count = 0;
15481
+ constructor(onQueueEmpty) {
15482
+ this.onQueueEmpty = onQueueEmpty;
15483
+ }
15484
+ enqueue() {
15485
+ this.count++;
15486
+ }
15487
+ dequeue(error, output) {
15488
+ if (--this.count <= 0 || error)
15489
+ this.onQueueEmpty(error, output);
15490
+ }
15491
+ }
15492
+ queue.Queue = Queue;
15493
+
15494
+ var counter = {};
15495
+
15496
+ Object.defineProperty(counter, "__esModule", { value: true });
15497
+ counter.Counter = undefined;
15498
+ class Counter {
15499
+ _files = 0;
15500
+ _directories = 0;
15501
+ set files(num) {
15502
+ this._files = num;
15503
+ }
15504
+ get files() {
15505
+ return this._files;
15506
+ }
15507
+ set directories(num) {
15508
+ this._directories = num;
15509
+ }
15510
+ get directories() {
15511
+ return this._directories;
15512
+ }
15513
+ /**
15514
+ * @deprecated use `directories` instead
15515
+ */
15516
+ /* c8 ignore next 3 */
15517
+ get dirs() {
15518
+ return this._directories;
15519
+ }
15520
+ }
15521
+ counter.Counter = Counter;
15522
+
15523
+ var __createBinding = (walker.__createBinding) || (Object.create ? (function(o, m, k, k2) {
15524
+ if (k2 === undefined) k2 = k;
15525
+ var desc = Object.getOwnPropertyDescriptor(m, k);
15526
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
15527
+ desc = { enumerable: true, get: function() { return m[k]; } };
15528
+ }
15529
+ Object.defineProperty(o, k2, desc);
15530
+ }) : (function(o, m, k, k2) {
15531
+ if (k2 === undefined) k2 = k;
15532
+ o[k2] = m[k];
15533
+ }));
15534
+ var __setModuleDefault = (walker.__setModuleDefault) || (Object.create ? (function(o, v) {
15535
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15536
+ }) : function(o, v) {
15537
+ o["default"] = v;
15538
+ });
15539
+ var __importStar = (walker.__importStar) || function (mod) {
15540
+ if (mod && mod.__esModule) return mod;
15541
+ var result = {};
15542
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
15543
+ __setModuleDefault(result, mod);
15544
+ return result;
15545
+ };
15546
+ Object.defineProperty(walker, "__esModule", { value: true });
15547
+ walker.Walker = undefined;
15548
+ const path_1$1 = require$$0$2;
15549
+ const utils_1 = utils$8;
15550
+ const joinPath = __importStar(joinPath$2);
15551
+ const pushDirectory = __importStar(pushDirectory$2);
15552
+ const pushFile = __importStar(pushFile$2);
15553
+ const getArray = __importStar(getArray$2);
15554
+ const groupFiles = __importStar(groupFiles$2);
15555
+ const resolveSymlink = __importStar(resolveSymlink$1);
15556
+ const invokeCallback = __importStar(invokeCallback$1);
15557
+ const walkDirectory = __importStar(walkDirectory$1);
15558
+ const queue_1 = queue;
15559
+ const counter_1 = counter;
15560
+ class Walker {
15561
+ root;
15562
+ isSynchronous;
15563
+ state;
15564
+ joinPath;
15565
+ pushDirectory;
15566
+ pushFile;
15567
+ getArray;
15568
+ groupFiles;
15569
+ resolveSymlink;
15570
+ walkDirectory;
15571
+ callbackInvoker;
15572
+ constructor(root, options, callback) {
15573
+ this.isSynchronous = !callback;
15574
+ this.callbackInvoker = invokeCallback.build(options, this.isSynchronous);
15575
+ this.root = (0, utils_1.normalizePath)(root, options);
15576
+ this.state = {
15577
+ root: this.root.slice(0, -1),
15578
+ // Perf: we explicitly tell the compiler to optimize for String arrays
15579
+ paths: [""].slice(0, 0),
15580
+ groups: [],
15581
+ counts: new counter_1.Counter(),
15582
+ options,
15583
+ queue: new queue_1.Queue((error, state) => this.callbackInvoker(state, error, callback)),
15584
+ symlinks: new Map(),
15585
+ visited: [""].slice(0, 0),
15586
+ };
15587
+ /*
15588
+ * Perf: We conditionally change functions according to options. This gives a slight
15589
+ * performance boost. Since these functions are so small, they are automatically inlined
15590
+ * by the javascript engine so there's no function call overhead (in most cases).
15591
+ */
15592
+ this.joinPath = joinPath.build(this.root, options);
15593
+ this.pushDirectory = pushDirectory.build(this.root, options);
15594
+ this.pushFile = pushFile.build(options);
15595
+ this.getArray = getArray.build(options);
15596
+ this.groupFiles = groupFiles.build(options);
15597
+ this.resolveSymlink = resolveSymlink.build(options, this.isSynchronous);
15598
+ this.walkDirectory = walkDirectory.build(this.isSynchronous);
15599
+ }
15600
+ start() {
15601
+ this.walkDirectory(this.state, this.root, this.root, this.state.options.maxDepth, this.walk);
15602
+ return this.isSynchronous ? this.callbackInvoker(this.state, null) : null;
15603
+ }
15604
+ walk = (entries, directoryPath, depth) => {
15605
+ const { paths, options: { filters, resolveSymlinks, excludeSymlinks, exclude, maxFiles, signal, useRealPaths, pathSeparator, }, } = this.state;
15606
+ if ((signal && signal.aborted) || (maxFiles && paths.length > maxFiles))
15607
+ return;
15608
+ this.pushDirectory(directoryPath, paths, filters);
15609
+ const files = this.getArray(this.state.paths);
15610
+ for (let i = 0; i < entries.length; ++i) {
15611
+ const entry = entries[i];
15612
+ if (entry.isFile() ||
15613
+ (entry.isSymbolicLink() && !resolveSymlinks && !excludeSymlinks)) {
15614
+ const filename = this.joinPath(entry.name, directoryPath);
15615
+ this.pushFile(filename, files, this.state.counts, filters);
15616
+ }
15617
+ else if (entry.isDirectory()) {
15618
+ let path = joinPath.joinDirectoryPath(entry.name, directoryPath, this.state.options.pathSeparator);
15619
+ if (exclude && exclude(entry.name, path))
15620
+ continue;
15621
+ this.walkDirectory(this.state, path, path, depth - 1, this.walk);
15622
+ }
15623
+ else if (entry.isSymbolicLink() && this.resolveSymlink) {
15624
+ let path = joinPath.joinPathWithBasePath(entry.name, directoryPath);
15625
+ this.resolveSymlink(path, this.state, (stat, resolvedPath) => {
15626
+ if (stat.isDirectory()) {
15627
+ resolvedPath = (0, utils_1.normalizePath)(resolvedPath, this.state.options);
15628
+ if (exclude && exclude(entry.name, useRealPaths ? resolvedPath : path + pathSeparator))
15629
+ return;
15630
+ this.walkDirectory(this.state, resolvedPath, useRealPaths ? resolvedPath : path + pathSeparator, depth - 1, this.walk);
15631
+ }
15632
+ else {
15633
+ resolvedPath = useRealPaths ? resolvedPath : path;
15634
+ const filename = (0, path_1$1.basename)(resolvedPath);
15635
+ const directoryPath = (0, utils_1.normalizePath)((0, path_1$1.dirname)(resolvedPath), this.state.options);
15636
+ resolvedPath = this.joinPath(filename, directoryPath);
15637
+ this.pushFile(resolvedPath, files, this.state.counts, filters);
15638
+ }
15639
+ });
15640
+ }
15641
+ }
15642
+ this.groupFiles(this.state.groups, directoryPath, files);
15643
+ };
15644
+ }
15645
+ walker.Walker = Walker;
15646
+
15647
+ Object.defineProperty(async, "__esModule", { value: true });
15648
+ async.callback = async.promise = undefined;
15649
+ const walker_1$1 = walker;
15650
+ function promise(root, options) {
15651
+ return new Promise((resolve, reject) => {
15652
+ callback(root, options, (err, output) => {
15653
+ if (err)
15654
+ return reject(err);
15655
+ resolve(output);
15656
+ });
15657
+ });
15658
+ }
15659
+ async.promise = promise;
15660
+ function callback(root, options, callback) {
15661
+ let walker = new walker_1$1.Walker(root, options, callback);
15662
+ walker.start();
15663
+ }
15664
+ async.callback = callback;
15665
+
15666
+ var sync$2 = {};
15667
+
15668
+ Object.defineProperty(sync$2, "__esModule", { value: true });
15669
+ sync$2.sync = undefined;
15670
+ const walker_1 = walker;
15671
+ function sync$1(root, options) {
15672
+ const walker = new walker_1.Walker(root, options);
15673
+ return walker.start();
15674
+ }
15675
+ sync$2.sync = sync$1;
15676
+
15677
+ Object.defineProperty(apiBuilder, "__esModule", { value: true });
15678
+ apiBuilder.APIBuilder = undefined;
15679
+ const async_1 = async;
15680
+ const sync_1 = sync$2;
15681
+ class APIBuilder {
15682
+ root;
15683
+ options;
15684
+ constructor(root, options) {
15685
+ this.root = root;
15686
+ this.options = options;
15687
+ }
15688
+ withPromise() {
15689
+ return (0, async_1.promise)(this.root, this.options);
15690
+ }
15691
+ withCallback(cb) {
15692
+ (0, async_1.callback)(this.root, this.options, cb);
15693
+ }
15694
+ sync() {
15695
+ return (0, sync_1.sync)(this.root, this.options);
15696
+ }
15697
+ }
15698
+ apiBuilder.APIBuilder = APIBuilder;
15699
+
15700
+ Object.defineProperty(builder, "__esModule", { value: true });
15701
+ builder.Builder = undefined;
15702
+ const path_1 = require$$0$2;
15703
+ const api_builder_1 = apiBuilder;
15704
+ var pm = null;
15705
+ /* c8 ignore next 6 */
15706
+ try {
15707
+ require.resolve("picomatch");
15708
+ pm = picomatch_1$1;
15709
+ }
15710
+ catch (_e) {
15711
+ // do nothing
15712
+ }
15713
+ class Builder {
15714
+ globCache = {};
15715
+ options = {
15716
+ maxDepth: Infinity,
15717
+ suppressErrors: true,
15718
+ pathSeparator: path_1.sep,
15719
+ filters: [],
15720
+ };
15721
+ globFunction;
15722
+ constructor(options) {
15723
+ this.options = { ...this.options, ...options };
15724
+ this.globFunction = this.options.globFunction;
15725
+ }
15726
+ group() {
15727
+ this.options.group = true;
15728
+ return this;
15729
+ }
15730
+ withPathSeparator(separator) {
15731
+ this.options.pathSeparator = separator;
15732
+ return this;
15733
+ }
15734
+ withBasePath() {
15735
+ this.options.includeBasePath = true;
15736
+ return this;
15737
+ }
15738
+ withRelativePaths() {
15739
+ this.options.relativePaths = true;
15740
+ return this;
15741
+ }
15742
+ withDirs() {
15743
+ this.options.includeDirs = true;
15744
+ return this;
15745
+ }
15746
+ withMaxDepth(depth) {
15747
+ this.options.maxDepth = depth;
15748
+ return this;
15749
+ }
15750
+ withMaxFiles(limit) {
15751
+ this.options.maxFiles = limit;
15752
+ return this;
15753
+ }
15754
+ withFullPaths() {
15755
+ this.options.resolvePaths = true;
15756
+ this.options.includeBasePath = true;
15757
+ return this;
15758
+ }
15759
+ withErrors() {
15760
+ this.options.suppressErrors = false;
15761
+ return this;
15762
+ }
15763
+ withSymlinks({ resolvePaths = true } = {}) {
15764
+ this.options.resolveSymlinks = true;
15765
+ this.options.useRealPaths = resolvePaths;
15766
+ return this.withFullPaths();
15767
+ }
15768
+ withAbortSignal(signal) {
15769
+ this.options.signal = signal;
15770
+ return this;
15771
+ }
15772
+ normalize() {
15773
+ this.options.normalizePath = true;
15774
+ return this;
15775
+ }
15776
+ filter(predicate) {
15777
+ this.options.filters.push(predicate);
15778
+ return this;
15779
+ }
15780
+ onlyDirs() {
15781
+ this.options.excludeFiles = true;
15782
+ this.options.includeDirs = true;
15783
+ return this;
15784
+ }
15785
+ exclude(predicate) {
15786
+ this.options.exclude = predicate;
15787
+ return this;
15788
+ }
15789
+ onlyCounts() {
15790
+ this.options.onlyCounts = true;
15791
+ return this;
15792
+ }
15793
+ crawl(root) {
15794
+ return new api_builder_1.APIBuilder(root || ".", this.options);
15795
+ }
15796
+ withGlobFunction(fn) {
15797
+ // cast this since we don't have the new type params yet
15798
+ this.globFunction = fn;
15799
+ return this;
15800
+ }
15801
+ /**
15802
+ * @deprecated Pass options using the constructor instead:
15803
+ * ```ts
15804
+ * new fdir(options).crawl("/path/to/root");
15805
+ * ```
15806
+ * This method will be removed in v7.0
15807
+ */
15808
+ /* c8 ignore next 4 */
15809
+ crawlWithOptions(root, options) {
15810
+ this.options = { ...this.options, ...options };
15811
+ return new api_builder_1.APIBuilder(root || ".", this.options);
15812
+ }
15813
+ glob(...patterns) {
15814
+ if (this.globFunction) {
15815
+ return this.globWithOptions(patterns);
15816
+ }
15817
+ return this.globWithOptions(patterns, ...[{ dot: true }]);
15818
+ }
15819
+ globWithOptions(patterns, ...options) {
15820
+ const globFn = (this.globFunction || pm);
15821
+ /* c8 ignore next 5 */
15822
+ if (!globFn) {
15823
+ throw new Error('Please specify a glob function to use glob matching.');
15824
+ }
15825
+ var isMatch = this.globCache[patterns.join("\0")];
15826
+ if (!isMatch) {
15827
+ isMatch = globFn(patterns, ...options);
15828
+ this.globCache[patterns.join("\0")] = isMatch;
15829
+ }
15830
+ this.options.filters.push((path) => isMatch(path));
15831
+ return this;
15832
+ }
15833
+ }
15834
+ builder.Builder = Builder;
15835
+
15836
+ var types$1 = {};
15837
+
15838
+ Object.defineProperty(types$1, "__esModule", { value: true });
15839
+
15840
+ (function (exports) {
15841
+ var __createBinding = (dist.__createBinding) || (Object.create ? (function(o, m, k, k2) {
15842
+ if (k2 === undefined) k2 = k;
15843
+ var desc = Object.getOwnPropertyDescriptor(m, k);
15844
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
15845
+ desc = { enumerable: true, get: function() { return m[k]; } };
15846
+ }
15847
+ Object.defineProperty(o, k2, desc);
15848
+ }) : (function(o, m, k, k2) {
15849
+ if (k2 === undefined) k2 = k;
15850
+ o[k2] = m[k];
15851
+ }));
15852
+ var __exportStar = (dist.__exportStar) || function(m, exports) {
15853
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15854
+ };
15855
+ Object.defineProperty(exports, "__esModule", { value: true });
15856
+ exports.fdir = undefined;
15857
+ const builder_1 = builder;
15858
+ Object.defineProperty(exports, "fdir", { enumerable: true, get: function () { return builder_1.Builder; } });
15859
+ __exportStar(types$1, exports);
15860
+ } (dist));
15861
+
15109
15862
  // src/index.ts
15110
- var ESCAPED_WIN32_BACKSLASHES = /\\(?![()[\]{}!+@])/g;
15111
- function convertPosixPathToPattern(path2) {
15112
- return escapePosixPath(path2);
15863
+ function getPartialMatcher(patterns, options) {
15864
+ const patternsCount = patterns.length;
15865
+ const patternsParts = Array(patternsCount);
15866
+ const regexes = Array(patternsCount);
15867
+ for (let i = 0; i < patternsCount; i++) {
15868
+ const parts = splitPattern(patterns[i]);
15869
+ patternsParts[i] = parts;
15870
+ const partsCount = parts.length;
15871
+ const partRegexes = Array(partsCount);
15872
+ for (let j = 0; j < partsCount; j++) {
15873
+ partRegexes[j] = picomatch$5.makeRe(parts[j], options);
15874
+ }
15875
+ regexes[i] = partRegexes;
15876
+ }
15877
+ return (input) => {
15878
+ const inputParts = input.split("/");
15879
+ for (let i = 0; i < patterns.length; i++) {
15880
+ const patternParts = patternsParts[i];
15881
+ const regex = regexes[i];
15882
+ const inputPatternCount = inputParts.length;
15883
+ const minParts = Math.min(inputPatternCount, patternParts.length);
15884
+ let j = 0;
15885
+ while (j < minParts) {
15886
+ const part = patternParts[j];
15887
+ if (part.includes("/")) {
15888
+ return true;
15889
+ }
15890
+ const match = regex[j].test(inputParts[j]);
15891
+ if (!match) {
15892
+ break;
15893
+ }
15894
+ if (part === "**") {
15895
+ return true;
15896
+ }
15897
+ j++;
15898
+ }
15899
+ if (j === inputPatternCount) {
15900
+ return true;
15901
+ }
15902
+ }
15903
+ return false;
15904
+ };
15113
15905
  }
15114
- function convertWin32PathToPattern(path2) {
15115
- return escapeWin32Path(path2).replace(ESCAPED_WIN32_BACKSLASHES, "/");
15906
+ var splitPatternOptions = { parts: true };
15907
+ function splitPattern(path2) {
15908
+ var _a;
15909
+ const result = picomatch$5.scan(path2, splitPatternOptions);
15910
+ return ((_a = result.parts) == null ? undefined : _a.length) ? result.parts : [path2];
15116
15911
  }
15117
- process.platform === "win32" ? convertWin32PathToPattern : convertPosixPathToPattern;
15912
+ var isWin$2 = process.platform === "win32";
15118
15913
  var POSIX_UNESCAPED_GLOB_SYMBOLS = /(?<!\\)([()[\]{}*?|]|^!|[!+@](?=\()|\\(?![()[\]{}!*+?@|]))/g;
15119
15914
  var WIN32_UNESCAPED_GLOB_SYMBOLS = /(?<!\\)([()[\]{}]|^!|[!+@](?=\())/g;
15120
15915
  var escapePosixPath = (path2) => path2.replace(POSIX_UNESCAPED_GLOB_SYMBOLS, "\\$&");
15121
15916
  var escapeWin32Path = (path2) => path2.replace(WIN32_UNESCAPED_GLOB_SYMBOLS, "\\$&");
15122
- var escapePath = process.platform === "win32" ? escapeWin32Path : escapePosixPath;
15917
+ var escapePath = isWin$2 ? escapeWin32Path : escapePosixPath;
15123
15918
  function isDynamicPattern(pattern, options) {
15124
15919
  const scan = picomatch$5.scan(pattern);
15125
15920
  return scan.isGlob || scan.negated;
15126
15921
  }
15922
+ function log(...tasks) {
15923
+ console.log(`[tinyglobby ${(/* @__PURE__ */ new Date()).toLocaleTimeString("es")}]`, ...tasks);
15924
+ }
15127
15925
 
15128
15926
  // src/index.ts
15129
- function normalizePattern(pattern, expandDirectories, cwd, properties, isIgnore) {
15927
+ var PARENT_DIRECTORY = /^(\/?\.\.)+/;
15928
+ var ESCAPING_BACKSLASHES = /\\(?=[()[\]{}!*+?@|])/g;
15929
+ var BACKSLASHES = /\\/g;
15930
+ function normalizePattern(pattern, expandDirectories, cwd, props, isIgnore) {
15130
15931
  var _a;
15131
15932
  let result = pattern;
15132
15933
  if (pattern.endsWith("/")) {
@@ -15135,40 +15936,41 @@ function normalizePattern(pattern, expandDirectories, cwd, properties, isIgnore)
15135
15936
  if (!result.endsWith("*") && expandDirectories) {
15136
15937
  result += "/**";
15137
15938
  }
15138
- if (require$$0$2.isAbsolute(result.replace(/\\(?=[()[\]{}!*+?@|])/g, ""))) {
15139
- result = posix.relative(cwd, result);
15939
+ if (require$$0$2.isAbsolute(result.replace(ESCAPING_BACKSLASHES, ""))) {
15940
+ result = posix.relative(escapePath(cwd), result);
15140
15941
  } else {
15141
15942
  result = posix.normalize(result);
15142
15943
  }
15143
- const parentDirectoryMatch = /^(\/?\.\.)+/.exec(result);
15944
+ const parentDirectoryMatch = PARENT_DIRECTORY.exec(result);
15144
15945
  if (parentDirectoryMatch == null ? undefined : parentDirectoryMatch[0]) {
15145
15946
  const potentialRoot = posix.join(cwd, parentDirectoryMatch[0]);
15146
- if (properties.root.length > potentialRoot.length) {
15147
- properties.root = potentialRoot;
15148
- properties.depthOffset = -(parentDirectoryMatch[0].length + 1) / 3;
15947
+ if (props.root.length > potentialRoot.length) {
15948
+ props.root = potentialRoot;
15949
+ props.depthOffset = -(parentDirectoryMatch[0].length + 1) / 3;
15149
15950
  }
15150
- } else if (!isIgnore && properties.depthOffset >= 0) {
15151
- const current = result.split("/");
15152
- (_a = properties.commonPath) != null ? _a : properties.commonPath = current;
15951
+ } else if (!isIgnore && props.depthOffset >= 0) {
15952
+ const parts = splitPattern(result);
15953
+ (_a = props.commonPath) != null ? _a : props.commonPath = parts;
15153
15954
  const newCommonPath = [];
15154
- for (let i = 0; i < Math.min(properties.commonPath.length, current.length); i++) {
15155
- const part = current[i];
15156
- if (part === "**" && !current[i + 1]) {
15955
+ const length = Math.min(props.commonPath.length, parts.length);
15956
+ for (let i = 0; i < length; i++) {
15957
+ const part = parts[i];
15958
+ if (part === "**" && !parts[i + 1]) {
15157
15959
  newCommonPath.pop();
15158
15960
  break;
15159
15961
  }
15160
- if (part !== properties.commonPath[i] || isDynamicPattern(part) || i === current.length - 1) {
15962
+ if (part !== props.commonPath[i] || isDynamicPattern(part) || i === parts.length - 1) {
15161
15963
  break;
15162
15964
  }
15163
15965
  newCommonPath.push(part);
15164
15966
  }
15165
- properties.depthOffset = newCommonPath.length;
15166
- properties.commonPath = newCommonPath;
15167
- properties.root = newCommonPath.length > 0 ? `${cwd}/${newCommonPath.join("/")}` : cwd;
15967
+ props.depthOffset = newCommonPath.length;
15968
+ props.commonPath = newCommonPath;
15969
+ props.root = newCommonPath.length > 0 ? `${cwd}/${newCommonPath.join("/")}` : cwd;
15168
15970
  }
15169
15971
  return result;
15170
15972
  }
15171
- function processPatterns({ patterns, ignore = [], expandDirectories = true }, cwd, properties) {
15973
+ function processPatterns({ patterns, ignore = [], expandDirectories = true }, cwd, props) {
15172
15974
  if (typeof patterns === "string") {
15173
15975
  patterns = [patterns];
15174
15976
  } else if (!patterns) {
@@ -15180,24 +15982,27 @@ function processPatterns({ patterns, ignore = [], expandDirectories = true }, cw
15180
15982
  const matchPatterns = [];
15181
15983
  const ignorePatterns = [];
15182
15984
  for (const pattern of ignore) {
15183
- if (!pattern.startsWith("!") || pattern[1] === "(") {
15184
- const newPattern = normalizePattern(pattern, expandDirectories, cwd, properties, true);
15185
- ignorePatterns.push(newPattern);
15985
+ if (!pattern) {
15986
+ continue;
15987
+ }
15988
+ if (pattern[0] !== "!" || pattern[1] === "(") {
15989
+ ignorePatterns.push(normalizePattern(pattern, expandDirectories, cwd, props, true));
15186
15990
  }
15187
15991
  }
15188
15992
  for (const pattern of patterns) {
15189
- if (!pattern.startsWith("!") || pattern[1] === "(") {
15190
- const newPattern = normalizePattern(pattern, expandDirectories, cwd, properties, false);
15191
- matchPatterns.push(newPattern);
15993
+ if (!pattern) {
15994
+ continue;
15995
+ }
15996
+ if (pattern[0] !== "!" || pattern[1] === "(") {
15997
+ matchPatterns.push(normalizePattern(pattern, expandDirectories, cwd, props, false));
15192
15998
  } else if (pattern[1] !== "!" || pattern[2] === "(") {
15193
- const newPattern = normalizePattern(pattern.slice(1), expandDirectories, cwd, properties, true);
15194
- ignorePatterns.push(newPattern);
15999
+ ignorePatterns.push(normalizePattern(pattern.slice(1), expandDirectories, cwd, props, true));
15195
16000
  }
15196
16001
  }
15197
16002
  return { match: matchPatterns, ignore: ignorePatterns };
15198
16003
  }
15199
16004
  function getRelativePath(path2, cwd, root) {
15200
- return posix.relative(cwd, `${root}/${path2}`);
16005
+ return posix.relative(cwd, `${root}/${path2}`) || ".";
15201
16006
  }
15202
16007
  function processPath(path2, cwd, root, isDirectory, absolute) {
15203
16008
  const relativePath = absolute ? path2.slice(root.length + 1) || "." : path2;
@@ -15206,32 +16011,75 @@ function processPath(path2, cwd, root, isDirectory, absolute) {
15206
16011
  }
15207
16012
  return getRelativePath(relativePath, cwd, root);
15208
16013
  }
16014
+ function formatPaths(paths, cwd, root) {
16015
+ for (let i = paths.length - 1; i >= 0; i--) {
16016
+ const path2 = paths[i];
16017
+ paths[i] = getRelativePath(path2, cwd, root) + (!path2 || path2.endsWith("/") ? "/" : "");
16018
+ }
16019
+ return paths;
16020
+ }
15209
16021
  function crawl(options, cwd, sync) {
15210
- const properties = {
16022
+ if (process.env.TINYGLOBBY_DEBUG) {
16023
+ options.debug = true;
16024
+ }
16025
+ if (options.debug) {
16026
+ log("globbing with options:", options, "cwd:", cwd);
16027
+ }
16028
+ if (Array.isArray(options.patterns) && options.patterns.length === 0) {
16029
+ return sync ? [] : Promise.resolve([]);
16030
+ }
16031
+ const props = {
15211
16032
  root: cwd,
15212
16033
  commonPath: null,
15213
16034
  depthOffset: 0
15214
16035
  };
15215
- const processed = processPatterns(options, cwd, properties);
16036
+ const processed = processPatterns(options, cwd, props);
16037
+ const nocase = options.caseSensitiveMatch === false;
16038
+ if (options.debug) {
16039
+ log("internal processing patterns:", processed);
16040
+ }
15216
16041
  const matcher = picomatch$5(processed.match, {
15217
16042
  dot: options.dot,
15218
- nocase: options.caseSensitiveMatch === false,
16043
+ nocase,
15219
16044
  ignore: processed.ignore
15220
16045
  });
15221
- const exclude = picomatch$5(processed.ignore, {
16046
+ const ignore = picomatch$5(processed.ignore, {
16047
+ dot: options.dot,
16048
+ nocase
16049
+ });
16050
+ const partialMatcher = getPartialMatcher(processed.match, {
15222
16051
  dot: options.dot,
15223
- nocase: options.caseSensitiveMatch === false
16052
+ nocase
15224
16053
  });
15225
16054
  const fdirOptions = {
15226
16055
  // use relative paths in the matcher
15227
- filters: [(p, isDirectory) => matcher(processPath(p, cwd, properties.root, isDirectory, options.absolute))],
15228
- exclude: (_, p) => exclude(processPath(p, cwd, properties.root, true, true)),
16056
+ filters: [
16057
+ options.debug ? (p, isDirectory) => {
16058
+ const path2 = processPath(p, cwd, props.root, isDirectory, options.absolute);
16059
+ const matches = matcher(path2);
16060
+ if (matches) {
16061
+ log(`matched ${path2}`);
16062
+ }
16063
+ return matches;
16064
+ } : (p, isDirectory) => matcher(processPath(p, cwd, props.root, isDirectory, options.absolute))
16065
+ ],
16066
+ exclude: options.debug ? (_, p) => {
16067
+ const relativePath = processPath(p, cwd, props.root, true, true);
16068
+ const skipped = relativePath !== "." && !partialMatcher(relativePath) || ignore(relativePath);
16069
+ if (!skipped) {
16070
+ log(`crawling ${p}`);
16071
+ }
16072
+ return skipped;
16073
+ } : (_, p) => {
16074
+ const relativePath = processPath(p, cwd, props.root, true, true);
16075
+ return relativePath !== "." && !partialMatcher(relativePath) || ignore(relativePath);
16076
+ },
15229
16077
  pathSeparator: "/",
15230
16078
  relativePaths: true,
15231
16079
  resolveSymlinks: true
15232
16080
  };
15233
16081
  if (options.deep) {
15234
- fdirOptions.maxDepth = Math.round(options.deep - properties.depthOffset);
16082
+ fdirOptions.maxDepth = Math.round(options.deep - props.depthOffset);
15235
16083
  }
15236
16084
  if (options.absolute) {
15237
16085
  fdirOptions.relativePaths = false;
@@ -15248,19 +16096,23 @@ function crawl(options, cwd, sync) {
15248
16096
  } else if (options.onlyFiles === false) {
15249
16097
  fdirOptions.includeDirs = true;
15250
16098
  }
15251
- properties.root = properties.root.replace(/\\/g, "");
15252
- const api = new dist.fdir(fdirOptions).crawl(properties.root);
15253
- if (cwd === properties.root || options.absolute) {
16099
+ props.root = props.root.replace(BACKSLASHES, "");
16100
+ const root = props.root;
16101
+ if (options.debug) {
16102
+ log("internal properties:", props);
16103
+ }
16104
+ const api = new dist.fdir(fdirOptions).crawl(root);
16105
+ if (cwd === root || options.absolute) {
15254
16106
  return sync ? api.sync() : api.withPromise();
15255
16107
  }
15256
- return sync ? api.sync().map((p) => getRelativePath(p, cwd, properties.root) + (!p || p.endsWith("/") ? "/" : "")) : api.withPromise().then((paths) => paths.map((p) => getRelativePath(p, cwd, properties.root) + (!p || p.endsWith("/") ? "/" : "")));
16108
+ return sync ? formatPaths(api.sync(), cwd, root) : api.withPromise().then((paths) => formatPaths(paths, cwd, root));
15257
16109
  }
15258
16110
  async function glob(patternsOrOptions, options) {
15259
16111
  if (patternsOrOptions && (options == null ? undefined : options.patterns)) {
15260
16112
  throw new Error("Cannot pass patterns as both an argument and an option");
15261
16113
  }
15262
16114
  const opts = Array.isArray(patternsOrOptions) || typeof patternsOrOptions === "string" ? { ...options, patterns: patternsOrOptions } : patternsOrOptions;
15263
- const cwd = opts.cwd ? require$$0$2.resolve(opts.cwd).replace(/\\/g, "/") : process.cwd().replace(/\\/g, "/");
16115
+ const cwd = opts.cwd ? require$$0$2.resolve(opts.cwd).replace(BACKSLASHES, "/") : process.cwd().replace(BACKSLASHES, "/");
15264
16116
  return crawl(opts, cwd, false);
15265
16117
  }
15266
16118
  function globSync(patternsOrOptions, options) {
@@ -15268,7 +16120,7 @@ function globSync(patternsOrOptions, options) {
15268
16120
  throw new Error("Cannot pass patterns as both an argument and an option");
15269
16121
  }
15270
16122
  const opts = Array.isArray(patternsOrOptions) || typeof patternsOrOptions === "string" ? { ...options, patterns: patternsOrOptions } : patternsOrOptions;
15271
- const cwd = opts.cwd ? require$$0$2.resolve(opts.cwd).replace(/\\/g, "/") : process.cwd().replace(/\\/g, "/");
16123
+ const cwd = opts.cwd ? require$$0$2.resolve(opts.cwd).replace(BACKSLASHES, "/") : process.cwd().replace(BACKSLASHES, "/");
15272
16124
  return crawl(opts, cwd, true);
15273
16125
  }
15274
16126
 
@@ -16041,8 +16893,8 @@ function canExternalizeFile(filePath) {
16041
16893
  return !ext || ext === ".js" || ext === ".mjs" || ext === ".cjs";
16042
16894
  }
16043
16895
 
16044
- const normalizedClientEntry$1 = normalizePath$3(CLIENT_ENTRY);
16045
- const normalizedEnvEntry$1 = normalizePath$3(ENV_ENTRY);
16896
+ const normalizedClientEntry$1 = normalizePath$4(CLIENT_ENTRY);
16897
+ const normalizedEnvEntry$1 = normalizePath$4(ENV_ENTRY);
16046
16898
  const ERR_RESOLVE_PACKAGE_ENTRY_FAIL = "ERR_RESOLVE_PACKAGE_ENTRY_FAIL";
16047
16899
  const browserExternalId = "__vite-browser-external";
16048
16900
  const optionalPeerDepId = "__vite-optional-peer-dep";
@@ -16078,12 +16930,12 @@ function resolvePlugin(resolveOptions) {
16078
16930
  if (resolvedImports) {
16079
16931
  id = resolvedImports;
16080
16932
  if (resolveOpts.custom?.["vite:import-glob"]?.isSubImportsPattern) {
16081
- return normalizePath$3(path$d.join(root, id));
16933
+ return normalizePath$4(path$d.join(root, id));
16082
16934
  }
16083
16935
  }
16084
16936
  let res;
16085
16937
  if (asSrc && depsOptimizer?.isOptimizedDepUrl(id)) {
16086
- const optimizedPath = id.startsWith(FS_PREFIX) ? fsPathFromId(id) : normalizePath$3(path$d.resolve(root, id.slice(1)));
16938
+ const optimizedPath = id.startsWith(FS_PREFIX) ? fsPathFromId(id) : normalizePath$4(path$d.resolve(root, id.slice(1)));
16087
16939
  return optimizedPath;
16088
16940
  }
16089
16941
  if (asSrc && id.startsWith(FS_PREFIX)) {
@@ -16101,7 +16953,7 @@ function resolvePlugin(resolveOptions) {
16101
16953
  if (id[0] === "." || (preferRelative || importer?.endsWith(".html")) && startsWithWordCharRE.test(id)) {
16102
16954
  const basedir = importer ? path$d.dirname(importer) : process.cwd();
16103
16955
  const fsPath = path$d.resolve(basedir, id);
16104
- const normalizedFsPath = normalizePath$3(fsPath);
16956
+ const normalizedFsPath = normalizePath$4(fsPath);
16105
16957
  if (depsOptimizer?.isOptimizedDepFile(normalizedFsPath)) {
16106
16958
  if (!options.isBuild && !DEP_VERSION_RE.test(normalizedFsPath)) {
16107
16959
  const browserHash = optimizedDepInfoFromFile(
@@ -16475,7 +17327,7 @@ async function tryOptimizedResolve(depsOptimizer, id, importer, preserveSymlinks
16475
17327
  packageCache
16476
17328
  )?.dir;
16477
17329
  if (idPkgDir == null) break;
16478
- idPkgDir = normalizePath$3(idPkgDir);
17330
+ idPkgDir = normalizePath$4(idPkgDir);
16479
17331
  }
16480
17332
  if (optimizedData.src.startsWith(withTrailingSlash(idPkgDir))) {
16481
17333
  return depsOptimizer.getOptimizedDepId(optimizedData);
@@ -16709,7 +17561,7 @@ function getRealPath(resolved, preserveSymlinks) {
16709
17561
  if (!preserveSymlinks) {
16710
17562
  resolved = safeRealpathSync(resolved);
16711
17563
  }
16712
- return normalizePath$3(resolved);
17564
+ return normalizePath$4(resolved);
16713
17565
  }
16714
17566
  function isDirectory(path2) {
16715
17567
  const stat = tryStatSync(path2);
@@ -17944,7 +18796,7 @@ async function transformGlobImport(code, id, root, resolveId, restoreQueryExtens
17944
18796
  };
17945
18797
  }
17946
18798
  function globSafePath(path) {
17947
- return escapePath(normalizePath$3(path));
18799
+ return escapePath(normalizePath$4(path));
17948
18800
  }
17949
18801
  function lastNthChar(str, n) {
17950
18802
  return str.charAt(str.length - 1 - n);
@@ -17973,7 +18825,7 @@ async function toAbsoluteGlob(glob2, root, importer, resolveId) {
17973
18825
  if (glob2.startsWith("../")) return pre + posix$1.join(dir, glob2);
17974
18826
  if (glob2.startsWith("**")) return pre + glob2;
17975
18827
  const isSubImportsPattern = glob2[0] === "#" && glob2.includes("*");
17976
- const resolved = normalizePath$3(
18828
+ const resolved = normalizePath$4(
17977
18829
  await resolveId(glob2, importer, {
17978
18830
  custom: { "vite:import-glob": { isSubImportsPattern } }
17979
18831
  }) || glob2
@@ -18227,7 +19079,7 @@ function globEntries(pattern, environment) {
18227
19079
  const resolvedPatterns = arraify(pattern);
18228
19080
  if (resolvedPatterns.every((str) => !isDynamicPattern(str))) {
18229
19081
  return resolvedPatterns.map(
18230
- (p) => normalizePath$3(path$d.resolve(environment.config.root, p))
19082
+ (p) => normalizePath$4(path$d.resolve(environment.config.root, p))
18231
19083
  );
18232
19084
  }
18233
19085
  return glob(pattern, {
@@ -18253,7 +19105,7 @@ function esbuildScanPlugin(environment, depImports, missing, entries) {
18253
19105
  async function resolveId(id, importer) {
18254
19106
  return environment.pluginContainer.resolveId(
18255
19107
  id,
18256
- importer && normalizePath$3(importer),
19108
+ importer && normalizePath$4(importer),
18257
19109
  { scan: true }
18258
19110
  );
18259
19111
  }
@@ -18363,7 +19215,7 @@ function esbuildScanPlugin(environment, depImports, missing, entries) {
18363
19215
  loader: "js",
18364
19216
  // since it is transpiled
18365
19217
  contents: await doTransformGlobImport(contents, p, loader),
18366
- resolveDir: normalizePath$3(path$d.dirname(p)),
19218
+ resolveDir: normalizePath$4(path$d.dirname(p)),
18367
19219
  pluginData: {
18368
19220
  htmlType: { loader }
18369
19221
  }
@@ -18372,7 +19224,7 @@ function esbuildScanPlugin(environment, depImports, missing, entries) {
18372
19224
  scripts[key] = {
18373
19225
  loader,
18374
19226
  contents,
18375
- resolveDir: normalizePath$3(path$d.dirname(p)),
19227
+ resolveDir: normalizePath$4(path$d.dirname(p)),
18376
19228
  pluginData: {
18377
19229
  htmlType: { loader }
18378
19230
  }
@@ -18447,7 +19299,7 @@ function esbuildScanPlugin(environment, depImports, missing, entries) {
18447
19299
  return externalUnlessEntry({ path: id });
18448
19300
  }
18449
19301
  } else {
18450
- missing[id] = normalizePath$3(importer);
19302
+ missing[id] = normalizePath$4(importer);
18451
19303
  }
18452
19304
  }
18453
19305
  );
@@ -19134,7 +19986,7 @@ function depsFromOptimizedDepInfo(depsInfo) {
19134
19986
  return obj;
19135
19987
  }
19136
19988
  function getOptimizedDepPath(environment, id) {
19137
- return normalizePath$3(
19989
+ return normalizePath$4(
19138
19990
  path$d.resolve(getDepsCacheDir(environment), flattenId(id) + ".js")
19139
19991
  );
19140
19992
  }
@@ -19153,7 +20005,7 @@ function getTempSuffix() {
19153
20005
  );
19154
20006
  }
19155
20007
  function getDepsCacheDirPrefix(environment) {
19156
- return normalizePath$3(path$d.resolve(environment.config.cacheDir, "deps"));
20008
+ return normalizePath$4(path$d.resolve(environment.config.cacheDir, "deps"));
19157
20009
  }
19158
20010
  function createIsOptimizedDepFile(environment) {
19159
20011
  const depsCacheDirPrefix = getDepsCacheDirPrefix(environment);
@@ -19162,11 +20014,11 @@ function createIsOptimizedDepFile(environment) {
19162
20014
  function createIsOptimizedDepUrl(environment) {
19163
20015
  const { root } = environment.config;
19164
20016
  const depsCacheDir = getDepsCacheDirPrefix(environment);
19165
- const depsCacheDirRelative = normalizePath$3(path$d.relative(root, depsCacheDir));
20017
+ const depsCacheDirRelative = normalizePath$4(path$d.relative(root, depsCacheDir));
19166
20018
  const depsCacheDirPrefix = depsCacheDirRelative.startsWith("../") ? (
19167
20019
  // if the cache directory is outside root, the url prefix would be something
19168
20020
  // like '/@fs/absolute/path/to/node_modules/.vite'
19169
- `/@fs/${removeLeadingSlash(normalizePath$3(depsCacheDir))}`
20021
+ `/@fs/${removeLeadingSlash(normalizePath$4(depsCacheDir))}`
19170
20022
  ) : (
19171
20023
  // if the cache directory is inside root, the url prefix would be something
19172
20024
  // like '/node_modules/.vite'
@@ -19179,7 +20031,7 @@ function createIsOptimizedDepUrl(environment) {
19179
20031
  function parseDepsOptimizerMetadata(jsonMetadata, depsCacheDir) {
19180
20032
  const { hash, lockfileHash, configHash, browserHash, optimized, chunks } = JSON.parse(jsonMetadata, (key, value) => {
19181
20033
  if (key === "file" || key === "src") {
19182
- return normalizePath$3(path$d.resolve(depsCacheDir, value));
20034
+ return normalizePath$4(path$d.resolve(depsCacheDir, value));
19183
20035
  }
19184
20036
  return value;
19185
20037
  });
@@ -19240,7 +20092,7 @@ function stringifyDepsOptimizerMetadata(metadata, depsCacheDir) {
19240
20092
  },
19241
20093
  (key, value) => {
19242
20094
  if (key === "file" || key === "src") {
19243
- return normalizePath$3(path$d.relative(depsCacheDir, value));
20095
+ return normalizePath$4(path$d.relative(depsCacheDir, value));
19244
20096
  }
19245
20097
  return value;
19246
20098
  },
@@ -19250,7 +20102,7 @@ function stringifyDepsOptimizerMetadata(metadata, depsCacheDir) {
19250
20102
  function esbuildOutputFromId(outputs, id, cacheDirOutputPath) {
19251
20103
  const cwd = process.cwd();
19252
20104
  const flatId = flattenId(id) + ".js";
19253
- const normalizedOutputPath = normalizePath$3(
20105
+ const normalizedOutputPath = normalizePath$4(
19254
20106
  path$d.relative(cwd, path$d.join(cacheDirOutputPath, flatId))
19255
20107
  );
19256
20108
  const output = outputs[normalizedOutputPath];
@@ -19258,7 +20110,7 @@ function esbuildOutputFromId(outputs, id, cacheDirOutputPath) {
19258
20110
  return output;
19259
20111
  }
19260
20112
  for (const [key, value] of Object.entries(outputs)) {
19261
- if (normalizePath$3(path$d.relative(cwd, key)) === normalizedOutputPath) {
20113
+ if (normalizePath$4(path$d.relative(cwd, key)) === normalizedOutputPath) {
19262
20114
  return value;
19263
20115
  }
19264
20116
  }
@@ -19268,7 +20120,7 @@ async function extractExportsData(environment, filePath) {
19268
20120
  const { optimizeDeps: optimizeDeps2 } = environment.config;
19269
20121
  const esbuildOptions = optimizeDeps2.esbuildOptions ?? {};
19270
20122
  if (optimizeDeps2.extensions?.some((ext) => filePath.endsWith(ext))) {
19271
- const result = await build$b({
20123
+ const result = await build$j({
19272
20124
  ...esbuildOptions,
19273
20125
  entryPoints: [filePath],
19274
20126
  write: false,
@@ -20237,7 +21089,7 @@ function getEnvFilesForMode(mode, envDir) {
20237
21089
  `.env.${mode}`,
20238
21090
  /** mode local file */
20239
21091
  `.env.${mode}.local`
20240
- ].map((file) => normalizePath$3(path$d.join(envDir, file)));
21092
+ ].map((file) => normalizePath$4(path$d.join(envDir, file)));
20241
21093
  }
20242
21094
  function loadEnv(mode, envDir, prefixes = "VITE_") {
20243
21095
  if (mode === "local") {
@@ -30177,6 +31029,7 @@ var windows$1 = [
30177
31029
  'Code.exe',
30178
31030
  'Code - Insiders.exe',
30179
31031
  'VSCodium.exe',
31032
+ 'Cursor.exe',
30180
31033
  'atom.exe',
30181
31034
  'sublime_text.exe',
30182
31035
  'notepad++.exe',
@@ -30258,7 +31111,10 @@ var guess = function guessEditor (specifiedEditor) {
30258
31111
  } else if (process.platform === 'win32') {
30259
31112
  const output = childProcess$1
30260
31113
  .execSync(
30261
- 'powershell -NoProfile -Command "Get-CimInstance -Query \\"select executablepath from win32_process where executablepath is not null\\" | % { $_.ExecutablePath }"',
31114
+ 'powershell -NoProfile -Command "' +
31115
+ '[Console]::OutputEncoding=[Text.Encoding]::UTF8;' +
31116
+ 'Get-CimInstance -Query \\"select executablepath from win32_process where executablepath is not null\\" | % { $_.ExecutablePath }' +
31117
+ '"',
30262
31118
  {
30263
31119
  stdio: ['pipe', 'pipe', 'ignore']
30264
31120
  }
@@ -30429,6 +31285,11 @@ function isTerminalEditor (editor) {
30429
31285
 
30430
31286
  const positionRE = /:(\d+)(:(\d+))?$/;
30431
31287
  function parseFile (file) {
31288
+ // support `file://` protocol
31289
+ if (file.startsWith('file://')) {
31290
+ file = require$$0$5.fileURLToPath(file);
31291
+ }
31292
+
30432
31293
  const fileName = file.replace(positionRE, '');
30433
31294
  const match = file.match(positionRE);
30434
31295
  const lineNumber = match && match[1];
@@ -33030,7 +33891,7 @@ function getResolvedOutDirs(root, outDir, outputOptions) {
33030
33891
  function resolveEmptyOutDir(emptyOutDir, root, outDirs, logger) {
33031
33892
  if (emptyOutDir != null) return emptyOutDir;
33032
33893
  for (const outDir of outDirs) {
33033
- if (!normalizePath$3(outDir).startsWith(withTrailingSlash(root))) {
33894
+ if (!normalizePath$4(outDir).startsWith(withTrailingSlash(root))) {
33034
33895
  logger?.warn(
33035
33896
  colors$1.yellow(
33036
33897
  `
@@ -40960,7 +41821,7 @@ function sirv (dir, opts={}) {
40960
41821
  };
40961
41822
  }
40962
41823
 
40963
- const knownJavascriptExtensionRE = /\.[tj]sx?$/;
41824
+ const knownJavascriptExtensionRE = /\.(?:[tj]sx?|[cm][tj]s)$/;
40964
41825
  const sirvOptions = ({
40965
41826
  getHeaders
40966
41827
  }) => {
@@ -40997,7 +41858,7 @@ function servePublicMiddleware(server, publicFiles) {
40997
41858
  } catch {
40998
41859
  }
40999
41860
  }
41000
- return normalizePath$3(filePath);
41861
+ return normalizePath$4(filePath);
41001
41862
  };
41002
41863
  return function viteServePublicMiddleware(req, res, next) {
41003
41864
  if (publicFiles && !publicFiles.has(toFilePath(req.url)) || isImportRequest(req.url) || isInternalRequest(req.url) || // for `/public-file.js?url` to be transformed
@@ -41621,7 +42482,7 @@ function htmlInlineProxyPlugin(config) {
41621
42482
  if (proxyMatch) {
41622
42483
  const index = Number(proxyMatch[1]);
41623
42484
  const file = cleanUrl(id);
41624
- const url = file.replace(normalizePath$3(config.root), "");
42485
+ const url = file.replace(normalizePath$4(config.root), "");
41625
42486
  const result = htmlProxyMap.get(config).get(url)?.[index];
41626
42487
  if (result) {
41627
42488
  return { ...result, moduleSideEffects: true };
@@ -41780,8 +42641,8 @@ function buildHtmlPlugin(config) {
41780
42641
  name: "vite:build-html",
41781
42642
  async transform(html, id) {
41782
42643
  if (id.endsWith(".html")) {
41783
- id = normalizePath$3(id);
41784
- const relativeUrlPath = normalizePath$3(path$d.relative(config.root, id));
42644
+ id = normalizePath$4(id);
42645
+ const relativeUrlPath = normalizePath$4(path$d.relative(config.root, id));
41785
42646
  const publicPath = `/${relativeUrlPath}`;
41786
42647
  const publicBase = getBaseInHTML(relativeUrlPath, config);
41787
42648
  const publicToRelative = (filename) => publicBase + filename;
@@ -41879,7 +42740,7 @@ import ${JSON.stringify(url)}`;
41879
42740
  } else if (node.childNodes.length) {
41880
42741
  const scriptNode = node.childNodes.pop();
41881
42742
  const contents = scriptNode.value;
41882
- const filePath = id.replace(normalizePath$3(config.root), "");
42743
+ const filePath = id.replace(normalizePath$4(config.root), "");
41883
42744
  addToHTMLProxyCache(config, filePath, inlineModuleIndex, {
41884
42745
  code: contents
41885
42746
  });
@@ -41915,8 +42776,8 @@ import "${id}?html-proxy&index=${inlineModuleIndex}.js"`;
41915
42776
  const processedEncodedUrl = await processSrcSet(
41916
42777
  attr.value,
41917
42778
  async ({ url }) => {
41918
- const decodedUrl = decodeURI(url);
41919
- if (!isExcludedUrl(decodedUrl)) {
42779
+ const decodedUrl = decodeURIIfPossible(url);
42780
+ if (decodedUrl !== undefined && !isExcludedUrl(decodedUrl)) {
41920
42781
  const result = await processAssetUrl(url);
41921
42782
  return result !== decodedUrl ? encodeURIPath(result) : url;
41922
42783
  }
@@ -41929,8 +42790,8 @@ import "${id}?html-proxy&index=${inlineModuleIndex}.js"`;
41929
42790
  })()
41930
42791
  );
41931
42792
  } else if (attr.type === "src") {
41932
- const url = decodeURI(attr.value);
41933
- if (checkPublicFile(url, config)) {
42793
+ const url = decodeURIIfPossible(attr.value);
42794
+ if (url === undefined) ; else if (checkPublicFile(url, config)) {
41934
42795
  overwriteAttrValue(
41935
42796
  s,
41936
42797
  attr.location,
@@ -41975,7 +42836,7 @@ import ${JSON.stringify(url)}`;
41975
42836
  if (inlineStyle) {
41976
42837
  inlineModuleIndex++;
41977
42838
  const code = inlineStyle.attr.value;
41978
- const filePath = id.replace(normalizePath$3(config.root), "");
42839
+ const filePath = id.replace(normalizePath$4(config.root), "");
41979
42840
  addToHTMLProxyCache(config, filePath, inlineModuleIndex, { code });
41980
42841
  js += `
41981
42842
  import "${id}?html-proxy&inline-css&style-attr&index=${inlineModuleIndex}.css"`;
@@ -41988,7 +42849,7 @@ import "${id}?html-proxy&inline-css&style-attr&index=${inlineModuleIndex}.css"`;
41988
42849
  }
41989
42850
  if (node.nodeName === "style" && node.childNodes.length) {
41990
42851
  const styleNode = node.childNodes.pop();
41991
- const filePath = id.replace(normalizePath$3(config.root), "");
42852
+ const filePath = id.replace(normalizePath$4(config.root), "");
41992
42853
  inlineModuleIndex++;
41993
42854
  addToHTMLProxyCache(config, filePath, inlineModuleIndex, {
41994
42855
  code: styleNode.value
@@ -42142,7 +43003,7 @@ ${js}`;
42142
43003
  (file) => toStyleSheetLinkTag(file, toOutputPath)
42143
43004
  );
42144
43005
  for (const [normalizedId, html] of processedHtml(this)) {
42145
- const relativeUrlPath = normalizePath$3(
43006
+ const relativeUrlPath = normalizePath$4(
42146
43007
  path$d.relative(config.root, normalizedId)
42147
43008
  );
42148
43009
  const assetsBase = getBaseInHTML(relativeUrlPath, config);
@@ -42165,7 +43026,7 @@ ${js}`;
42165
43026
  const isAsync = isAsyncScriptMap.get(config).get(normalizedId);
42166
43027
  let result = html;
42167
43028
  const chunk = Object.values(bundle).find(
42168
- (chunk2) => chunk2.type === "chunk" && chunk2.isEntry && chunk2.facadeModuleId && normalizePath$3(chunk2.facadeModuleId) === normalizedId
43029
+ (chunk2) => chunk2.type === "chunk" && chunk2.isEntry && chunk2.facadeModuleId && normalizePath$4(chunk2.facadeModuleId) === normalizedId
42169
43030
  );
42170
43031
  let canInlineEntry = false;
42171
43032
  if (chunk) {
@@ -42250,13 +43111,13 @@ ${js}`;
42250
43111
  getPublicAssetFilename(fileHash, config)
42251
43112
  );
42252
43113
  return encodeURIPath(
42253
- urlCanParse(publicAssetPath) ? publicAssetPath : normalizePath$3(publicAssetPath)
43114
+ urlCanParse(publicAssetPath) ? publicAssetPath : normalizePath$4(publicAssetPath)
42254
43115
  );
42255
43116
  });
42256
43117
  if (chunk && canInlineEntry) {
42257
43118
  inlineEntryChunk.add(chunk.fileName);
42258
43119
  }
42259
- const shortEmitName = normalizePath$3(
43120
+ const shortEmitName = normalizePath$4(
42260
43121
  path$d.relative(config.root, normalizedId)
42261
43122
  );
42262
43123
  this.emitFile({
@@ -42309,7 +43170,7 @@ function preImportMapHook(config) {
42309
43170
  const importMapAppendIndex = html.search(importMapAppendRE);
42310
43171
  if (importMapAppendIndex < 0) return;
42311
43172
  if (importMapAppendIndex < importMapIndex) {
42312
- const relativeHtml = normalizePath$3(
43173
+ const relativeHtml = normalizePath$4(
42313
43174
  path$d.relative(config.root, ctx.filename)
42314
43175
  );
42315
43176
  config.logger.warnOnce(
@@ -42379,7 +43240,7 @@ function htmlEnvHook(config) {
42379
43240
  return env[key];
42380
43241
  } else {
42381
43242
  if (envPrefix.some((prefix) => key.startsWith(prefix))) {
42382
- const relativeHtml = normalizePath$3(
43243
+ const relativeHtml = normalizePath$4(
42383
43244
  path$d.relative(config.root, ctx.filename)
42384
43245
  );
42385
43246
  config.logger.warn(
@@ -42653,9 +43514,17 @@ function serializeAttrs(attrs) {
42653
43514
  function incrementIndent(indent = "") {
42654
43515
  return `${indent}${indent[0] === " " ? " " : " "}`;
42655
43516
  }
43517
+ function decodeURIIfPossible(input) {
43518
+ try {
43519
+ return decodeURI(input);
43520
+ } catch {
43521
+ return;
43522
+ }
43523
+ }
42656
43524
 
42657
43525
  const debugCache = createDebugger("vite:cache");
42658
43526
  const knownIgnoreList = /* @__PURE__ */ new Set(["/", "/favicon.ico"]);
43527
+ const trailingQuerySeparatorsRE = /[?&]+$/;
42659
43528
  function cachedTransformMiddleware(server) {
42660
43529
  return function viteCachedTransformMiddleware(req, res, next) {
42661
43530
  const environment = server.environments.client;
@@ -42698,7 +43567,7 @@ function transformMiddleware(server) {
42698
43567
  if (isSourceMap) {
42699
43568
  const depsOptimizer = environment.depsOptimizer;
42700
43569
  if (depsOptimizer?.isOptimizedDepUrl(url)) {
42701
- const sourcemapPath = url.startsWith(FS_PREFIX) ? fsPathFromId(url) : normalizePath$3(path$d.resolve(server.config.root, url.slice(1)));
43570
+ const sourcemapPath = url.startsWith(FS_PREFIX) ? fsPathFromId(url) : normalizePath$4(path$d.resolve(server.config.root, url.slice(1)));
42702
43571
  try {
42703
43572
  const map = JSON.parse(
42704
43573
  await fsp.readFile(sourcemapPath, "utf-8")
@@ -42741,7 +43610,16 @@ function transformMiddleware(server) {
42741
43610
  if (publicDirInRoot && url.startsWith(publicPath)) {
42742
43611
  warnAboutExplicitPublicPathInUrl(url);
42743
43612
  }
42744
- if ((rawRE.test(url) || urlRE.test(url)) && !ensureServingAccess(url, server, res, next)) {
43613
+ const urlWithoutTrailingQuerySeparators = url.replace(
43614
+ trailingQuerySeparatorsRE,
43615
+ ""
43616
+ );
43617
+ if ((rawRE.test(urlWithoutTrailingQuerySeparators) || urlRE.test(urlWithoutTrailingQuerySeparators)) && !ensureServingAccess(
43618
+ urlWithoutTrailingQuerySeparators,
43619
+ server,
43620
+ res,
43621
+ next
43622
+ )) {
42745
43623
  return;
42746
43624
  }
42747
43625
  if (req.headers["sec-fetch-dest"] === "script" || isJSRequest(url) || isImportRequest(url) || isCSSRequest(url) || isHTMLProxy(url)) {
@@ -42873,7 +43751,7 @@ function getHtmlFilename(url, server) {
42873
43751
  return decodeURIComponent(fsPathFromId(url));
42874
43752
  } else {
42875
43753
  return decodeURIComponent(
42876
- normalizePath$3(path$d.join(server.config.root, url.slice(1)))
43754
+ normalizePath$4(path$d.join(server.config.root, url.slice(1)))
42877
43755
  );
42878
43756
  }
42879
43757
  }
@@ -42947,7 +43825,7 @@ const devHtmlHook = async (html, { path: htmlPath, filename, server, originalUrl
42947
43825
  const s = new MagicString(html);
42948
43826
  let inlineModuleIndex = -1;
42949
43827
  const proxyCacheUrl = decodeURI(
42950
- cleanUrl(proxyModulePath).replace(normalizePath$3(config.root), "")
43828
+ cleanUrl(proxyModulePath).replace(normalizePath$4(config.root), "")
42951
43829
  );
42952
43830
  const styleUrl = [];
42953
43831
  const inlineStyles = [];
@@ -44098,7 +44976,7 @@ async function _createServer(inlineConfig = {}, options) {
44098
44976
  }
44099
44977
  };
44100
44978
  const onFileAddUnlink = async (file, isUnlink) => {
44101
- file = normalizePath$3(file);
44979
+ file = normalizePath$4(file);
44102
44980
  reloadOnTsconfigChange(server, file);
44103
44981
  await pluginContainer.watchChange(file, {
44104
44982
  event: isUnlink ? "delete" : "create"
@@ -44125,7 +45003,7 @@ async function _createServer(inlineConfig = {}, options) {
44125
45003
  await onHMRUpdate(isUnlink ? "delete" : "create", file);
44126
45004
  };
44127
45005
  watcher.on("change", async (file) => {
44128
- file = normalizePath$3(file);
45006
+ file = normalizePath$4(file);
44129
45007
  reloadOnTsconfigChange(server, file);
44130
45008
  await pluginContainer.watchChange(file, { event: "update" });
44131
45009
  for (const environment of Object.values(server.environments)) {
@@ -44273,7 +45151,7 @@ function createServerCloseFn(server) {
44273
45151
  });
44274
45152
  }
44275
45153
  function resolvedAllowDir(root, dir) {
44276
- return normalizePath$3(path$d.resolve(root, dir));
45154
+ return normalizePath$4(path$d.resolve(root, dir));
44277
45155
  }
44278
45156
  const serverConfigDefaults = Object.freeze({
44279
45157
  port: DEFAULT_DEV_PORT,
@@ -44438,7 +45316,7 @@ var index = {
44438
45316
 
44439
45317
  const debugHmr = createDebugger("vite:hmr");
44440
45318
  const whitespaceRE = /\s/;
44441
- const normalizedClientDir = normalizePath$3(CLIENT_DIR);
45319
+ const normalizedClientDir = normalizePath$4(CLIENT_DIR);
44442
45320
  function getShortName(file, root) {
44443
45321
  return file.startsWith(withTrailingSlash(root)) ? path$d.posix.relative(root, file) : file;
44444
45322
  }
@@ -44612,7 +45490,7 @@ async function handleHMRUpdate(type, file, server) {
44612
45490
  debugHmr?.(`[config change] ${colors$1.dim(shortFile)}`);
44613
45491
  config.logger.info(
44614
45492
  colors$1.green(
44615
- `${normalizePath$3(
45493
+ `${normalizePath$4(
44616
45494
  path$d.relative(process.cwd(), file)
44617
45495
  )} changed, restarting server...`
44618
45496
  ),
@@ -44773,7 +45651,7 @@ async function handleHMRUpdate(type, file, server) {
44773
45651
  );
44774
45652
  environment.hot.send({
44775
45653
  type: "full-reload",
44776
- path: config.server.middlewareMode ? "*" : "/" + normalizePath$3(path$d.relative(config.root, file))
45654
+ path: config.server.middlewareMode ? "*" : "/" + normalizePath$4(path$d.relative(config.root, file))
44777
45655
  });
44778
45656
  } else {
44779
45657
  debugHmr?.(
@@ -45770,7 +46648,7 @@ function getAliasPatternMatcher(entries) {
45770
46648
  }
45771
46649
 
45772
46650
  const debug$2 = createDebugger("vite:import-analysis");
45773
- const clientDir = normalizePath$3(CLIENT_DIR);
46651
+ const clientDir = normalizePath$4(CLIENT_DIR);
45774
46652
  const skipRE = /\.(?:map|json)(?:$|\?)/;
45775
46653
  const canSkipImportAnalysis = (id) => skipRE.test(id) || isDirectCSSRequest(id);
45776
46654
  const optimizedDepChunkRE = /\/chunk-[A-Z\d]{8}\.js/;
@@ -45940,7 +46818,7 @@ function importAnalysisPlugin(config) {
45940
46818
  importerModule.isSelfAccepting = false;
45941
46819
  moduleGraph._hasResolveFailedErrorModules.add(importerModule);
45942
46820
  return this.error(
45943
- `Failed to resolve import "${url}" from "${normalizePath$3(
46821
+ `Failed to resolve import "${url}" from "${normalizePath$4(
45944
46822
  path$d.relative(process.cwd(), importerFile)
45945
46823
  )}". Does the file exist?`,
45946
46824
  pos
@@ -46431,8 +47309,8 @@ function __vite__injectQuery(url, queryToInject) {
46431
47309
  return `${pathname}?${queryToInject}${search ? `&` + search.slice(1) : ""}${hash || ""}`;
46432
47310
  }
46433
47311
 
46434
- const normalizedClientEntry = normalizePath$3(CLIENT_ENTRY);
46435
- const normalizedEnvEntry = normalizePath$3(ENV_ENTRY);
47312
+ const normalizedClientEntry = normalizePath$4(CLIENT_ENTRY);
47313
+ const normalizedEnvEntry = normalizePath$4(ENV_ENTRY);
46436
47314
  function clientInjectionsPlugin(config) {
46437
47315
  let injectConfigValues;
46438
47316
  const getDefineReplacer = perEnvironmentState((environment) => {
@@ -46586,7 +47464,7 @@ function err(e, pos) {
46586
47464
  }
46587
47465
  function findClosingParen(input, fromIndex) {
46588
47466
  let count = 1;
46589
- for (let i = fromIndex + 1; i < input.length; i++) {
47467
+ for (let i = fromIndex; i < input.length; i++) {
46590
47468
  if (input[i] === "(") count++;
46591
47469
  if (input[i] === ")") count--;
46592
47470
  if (count === 0) return i;
@@ -47094,10 +47972,10 @@ async function transformDynamicImport(importSource, importer, resolve, root) {
47094
47972
  if (!resolvedFileName) {
47095
47973
  return null;
47096
47974
  }
47097
- const relativeFileName = normalizePath$3(
47975
+ const relativeFileName = normalizePath$4(
47098
47976
  posix$1.relative(
47099
- posix$1.dirname(normalizePath$3(importer)),
47100
- normalizePath$3(resolvedFileName)
47977
+ posix$1.dirname(normalizePath$4(importer)),
47978
+ normalizePath$4(resolvedFileName)
47101
47979
  )
47102
47980
  );
47103
47981
  importSource = "`" + (relativeFileName[0] === "." ? "" : "./") + relativeFileName + "`";
@@ -47551,7 +48429,7 @@ class EnvironmentPluginContainer {
47551
48429
  }
47552
48430
  }
47553
48431
  if (id) {
47554
- partial.id = isExternalUrl(id) ? id : normalizePath$3(id);
48432
+ partial.id = isExternalUrl(id) ? id : normalizePath$4(id);
47555
48433
  return partial;
47556
48434
  } else {
47557
48435
  return null;
@@ -47833,7 +48711,7 @@ ${err2.stack || err2.message}
47833
48711
  if (!err.frame) {
47834
48712
  let code = this._activeCode;
47835
48713
  if (err.loc.file) {
47836
- err.id = normalizePath$3(err.loc.file);
48714
+ err.id = normalizePath$4(err.loc.file);
47837
48715
  try {
47838
48716
  code = fs__default.readFileSync(err.loc.file, "utf-8");
47839
48717
  } catch {
@@ -47866,7 +48744,7 @@ ${err2.stack || err2.message}
47866
48744
  if (!err.frame) {
47867
48745
  let code = err.pluginCode;
47868
48746
  if (err.loc.file) {
47869
- err.id = normalizePath$3(err.loc.file);
48747
+ err.id = normalizePath$4(err.loc.file);
47870
48748
  if (!code) {
47871
48749
  try {
47872
48750
  code = fs__default.readFileSync(err.loc.file, "utf-8");
@@ -48441,7 +49319,7 @@ function cssPostPlugin(config) {
48441
49319
  const relative = config.base === "./" || config.base === "";
48442
49320
  const cssAssetDirname = encodedPublicUrls || relative ? slash$1(getCssAssetDirname(cssAssetName)) : undefined;
48443
49321
  const toRelative = (filename) => {
48444
- const relativePath = normalizePath$3(
49322
+ const relativePath = normalizePath$4(
48445
49323
  path$d.relative(cssAssetDirname, filename)
48446
49324
  );
48447
49325
  return relativePath[0] === "." ? relativePath : "./" + relativePath;
@@ -48461,7 +49339,7 @@ function cssPostPlugin(config) {
48461
49339
  );
48462
49340
  });
48463
49341
  if (encodedPublicUrls) {
48464
- const relativePathToPublicFromCSS = normalizePath$3(
49342
+ const relativePathToPublicFromCSS = normalizePath$4(
48465
49343
  path$d.relative(cssAssetDirname, "")
48466
49344
  );
48467
49345
  chunkCSS2 = chunkCSS2.replace(publicAssetUrlRE, (_, hash) => {
@@ -48481,7 +49359,7 @@ function cssPostPlugin(config) {
48481
49359
  return chunkCSS2;
48482
49360
  };
48483
49361
  function ensureFileExt(name, ext) {
48484
- return normalizePath$3(
49362
+ return normalizePath$4(
48485
49363
  path$d.format({ ...path$d.parse(name), base: undefined, ext })
48486
49364
  );
48487
49365
  }
@@ -48860,10 +49738,10 @@ async function compileCSSPreprocessors(environment, id, lang, code, workerContro
48860
49738
  }
48861
49739
  let deps;
48862
49740
  if (preprocessResult.deps.length > 0) {
48863
- const normalizedFilename = normalizePath$3(opts.filename);
49741
+ const normalizedFilename = normalizePath$4(opts.filename);
48864
49742
  deps = new Set(
48865
49743
  [...preprocessResult.deps].filter(
48866
- (dep) => normalizePath$3(dep) !== normalizedFilename
49744
+ (dep) => normalizePath$4(dep) !== normalizedFilename
48867
49745
  )
48868
49746
  );
48869
49747
  }
@@ -48970,10 +49848,11 @@ async function compileCSS(environment, id, code, workerController, urlResolver)
48970
49848
  })
48971
49849
  );
48972
49850
  }
48973
- if (urlResolver && // if there's an @import, we need to add this plugin
48974
- // regradless of whether it contains url() or image-set(),
48975
- // because we don't know the content referenced by @import
48976
- (needInlineImport || hasUrl)) {
49851
+ if (urlResolver && // when a postcss plugin is used (including the internal postcss plugins),
49852
+ // we need to add this plugin regardless of whether
49853
+ // this file contains url() or image-set(),
49854
+ // because we don't know the content injected by those plugins
49855
+ (postcssPlugins.length > 0 || isModule || hasUrl)) {
48977
49856
  postcssPlugins.push(
48978
49857
  UrlRewritePostcssPlugin({
48979
49858
  resolver: urlResolver,
@@ -49042,7 +49921,7 @@ async function compileCSS(environment, id, code, workerController, urlResolver)
49042
49921
  });
49043
49922
  for (const message of postcssResult.messages) {
49044
49923
  if (message.type === "dependency") {
49045
- deps.add(normalizePath$3(message.file));
49924
+ deps.add(normalizePath$4(message.file));
49046
49925
  } else if (message.type === "dir-dependency") {
49047
49926
  const { dir, glob: globPattern = "**" } = message;
49048
49927
  const files = globSync(globPattern, {
@@ -49119,8 +49998,8 @@ function createCachedImport(imp) {
49119
49998
  return cached;
49120
49999
  };
49121
50000
  }
49122
- const importPostcssImport = createCachedImport(() => import('./dep-BUK8RJ2R.js').then(function (n) { return n.i; }));
49123
- const importPostcssModules = createCachedImport(() => import('./dep-DWzCYIjV.js').then(function (n) { return n.i; }));
50001
+ const importPostcssImport = createCachedImport(() => import('./dep-DmVEsGRf.js').then(function (n) { return n.i; }));
50002
+ const importPostcssModules = createCachedImport(() => import('./dep-DEFzlAOo.js').then(function (n) { return n.i; }));
49124
50003
  const importPostcss = createCachedImport(() => import('postcss'));
49125
50004
  const preprocessorWorkerControllerCache = /* @__PURE__ */ new WeakMap();
49126
50005
  let alwaysFakeWorkerWorkerControllerCache;
@@ -49143,7 +50022,7 @@ async function formatPostcssSourceMap(rawMap, file) {
49143
50022
  if (cleanSource[0] === "<" && cleanSource[cleanSource.length - 1] === ">") {
49144
50023
  return `\0${cleanSource}`;
49145
50024
  }
49146
- return normalizePath$3(path$d.resolve(inputFileDir, cleanSource));
50025
+ return normalizePath$4(path$d.resolve(inputFileDir, cleanSource));
49147
50026
  });
49148
50027
  return {
49149
50028
  file,
@@ -49795,7 +50674,7 @@ const scssProcessor = (maxWorkers) => {
49795
50674
  const map2 = result.map ? JSON.parse(result.map.toString()) : undefined;
49796
50675
  if (map2) {
49797
50676
  map2.sources = map2.sources.map(
49798
- (url) => url.startsWith("file://") ? normalizePath$3(fileURLToPath$1(url)) : url
50677
+ (url) => url.startsWith("file://") ? normalizePath$4(fileURLToPath$1(url)) : url
49799
50678
  );
49800
50679
  }
49801
50680
  return {
@@ -49844,7 +50723,7 @@ async function rebaseUrls(environment, file, rootFile, alias, variablePrefix, re
49844
50723
  }
49845
50724
  const absolute = await resolver(environment, url, file) || path$d.resolve(fileDir, url);
49846
50725
  const relative = path$d.relative(rootDir, absolute);
49847
- return normalizePath$3(relative);
50726
+ return normalizePath$4(relative);
49848
50727
  };
49849
50728
  if (hasImportCss) {
49850
50729
  rebased = await rewriteImportCss(content, rebaseFn);
@@ -50111,7 +50990,7 @@ const stylProcessor = (maxWorkers) => {
50111
50990
  function formatStylusSourceMap(mapBefore, root) {
50112
50991
  if (!mapBefore) return undefined;
50113
50992
  const map2 = { ...mapBefore };
50114
- const resolveFromRoot = (p) => normalizePath$3(path$d.resolve(root, p));
50993
+ const resolveFromRoot = (p) => normalizePath$4(path$d.resolve(root, p));
50115
50994
  if (map2.file) {
50116
50995
  map2.file = resolveFromRoot(map2.file);
50117
50996
  }
@@ -50866,6 +51745,7 @@ function buildImportAnalysisPlugin(config) {
50866
51745
  chunk.map
50867
51746
  ]);
50868
51747
  map.toUrl = () => genSourceMapUrl(map);
51748
+ const originalDebugId = chunk.map.debugId;
50869
51749
  chunk.map = map;
50870
51750
  if (buildSourcemap === "inline") {
50871
51751
  chunk.code = chunk.code.replace(
@@ -50875,6 +51755,9 @@ function buildImportAnalysisPlugin(config) {
50875
51755
  chunk.code += `
50876
51756
  //# sourceMappingURL=${genSourceMapUrl(map)}`;
50877
51757
  } else {
51758
+ if (originalDebugId) {
51759
+ map.debugId = originalDebugId;
51760
+ }
50878
51761
  const mapAsset = bundle[chunk.fileName + ".map"];
50879
51762
  if (mapAsset && mapAsset.type === "asset") {
50880
51763
  mapAsset.source = map.toString();
@@ -50905,7 +51788,7 @@ function ssrManifestPlugin() {
50905
51788
  const chunk = bundle[file];
50906
51789
  if (chunk.type === "chunk") {
50907
51790
  for (const id in chunk.modules) {
50908
- const normalizedId = normalizePath$3(relative$2(config.root, id));
51791
+ const normalizedId = normalizePath$4(relative$2(config.root, id));
50909
51792
  const mappedChunks = ssrManifest[normalizedId] ?? (ssrManifest[normalizedId] = []);
50910
51793
  if (!chunk.isEntry) {
50911
51794
  mappedChunks.push(joinUrlSegments(base, chunk.fileName));
@@ -50954,7 +51837,7 @@ function ssrManifestPlugin() {
50954
51837
  chunk2.imports.forEach(addDeps);
50955
51838
  }
50956
51839
  };
50957
- const normalizedFile = normalizePath$3(
51840
+ const normalizedFile = normalizePath$4(
50958
51841
  join$1(dirname$2(chunk.fileName), url.slice(1, -1))
50959
51842
  );
50960
51843
  addDeps(normalizedFile);
@@ -51782,8 +52665,8 @@ function toOutputFilePathWithoutRuntime(filename, type, hostId, hostType, config
51782
52665
  const toOutputFilePathInCss = toOutputFilePathWithoutRuntime;
51783
52666
  const toOutputFilePathInHtml = toOutputFilePathWithoutRuntime;
51784
52667
  function areSeparateFolders(a, b) {
51785
- const na = normalizePath$3(a);
51786
- const nb = normalizePath$3(b);
52668
+ const na = normalizePath$4(a);
52669
+ const nb = normalizePath$4(b);
51787
52670
  return na !== nb && !na.startsWith(withTrailingSlash(nb)) && !nb.startsWith(withTrailingSlash(na));
51788
52671
  }
51789
52672
  class BuildEnvironment extends BaseEnvironment {
@@ -52790,7 +53673,7 @@ class EnvironmentModuleGraph {
52790
53673
  // need to be represented in the module graph so that they can trigger
52791
53674
  // hmr in the importing css file.
52792
53675
  createFileOnlyEntry(file) {
52793
- file = normalizePath$3(file);
53676
+ file = normalizePath$4(file);
52794
53677
  let fileMappedModules = this.fileToModulesMap.get(file);
52795
53678
  if (!fileMappedModules) {
52796
53679
  fileMappedModules = /* @__PURE__ */ new Set();
@@ -52894,14 +53777,14 @@ async function warmupFile(server, environment, file) {
52894
53777
  function htmlFileToUrl(file, root) {
52895
53778
  const url = path$d.relative(root, file);
52896
53779
  if (url[0] === ".") return;
52897
- return "/" + normalizePath$3(url);
53780
+ return "/" + normalizePath$4(url);
52898
53781
  }
52899
53782
  function fileToUrl(file, root) {
52900
53783
  const url = path$d.relative(root, file);
52901
53784
  if (url[0] === ".") {
52902
- return path$d.posix.join(FS_PREFIX, normalizePath$3(file));
53785
+ return path$d.posix.join(FS_PREFIX, normalizePath$4(file));
52903
53786
  }
52904
- return "/" + normalizePath$3(url);
53787
+ return "/" + normalizePath$4(url);
52905
53788
  }
52906
53789
  async function mapFiles(files, root) {
52907
53790
  if (!files.length) return [];
@@ -53743,11 +54626,11 @@ function checkBadCharactersInPath(path2, logger) {
53743
54626
  const clientAlias = [
53744
54627
  {
53745
54628
  find: /^\/?@vite\/env/,
53746
- replacement: path$d.posix.join(FS_PREFIX, normalizePath$3(ENV_ENTRY))
54629
+ replacement: path$d.posix.join(FS_PREFIX, normalizePath$4(ENV_ENTRY))
53747
54630
  },
53748
54631
  {
53749
54632
  find: /^\/?@vite\/client/,
53750
- replacement: path$d.posix.join(FS_PREFIX, normalizePath$3(CLIENT_ENTRY))
54633
+ replacement: path$d.posix.join(FS_PREFIX, normalizePath$4(CLIENT_ENTRY))
53751
54634
  }
53752
54635
  ];
53753
54636
  function resolveEnvironmentResolveOptions(resolve, alias, preserveSymlinks, logger, consumer, isSsrTargetWebworkerEnvironment) {
@@ -53871,7 +54754,7 @@ async function resolveConfig(inlineConfig, command, defaultMode = "development",
53871
54754
  allowClearScreen: config.clearScreen,
53872
54755
  customLogger: config.customLogger
53873
54756
  });
53874
- const resolvedRoot = normalizePath$3(
54757
+ const resolvedRoot = normalizePath$4(
53875
54758
  config.root ? path$d.resolve(config.root) : process.cwd()
53876
54759
  );
53877
54760
  checkBadCharactersInPath(resolvedRoot, logger);
@@ -53990,7 +54873,7 @@ async function resolveConfig(inlineConfig, command, defaultMode = "development",
53990
54873
  patchedConfigSsr,
53991
54874
  resolvedDefaultResolve.preserveSymlinks
53992
54875
  );
53993
- const envDir = config.envDir ? normalizePath$3(path$d.resolve(resolvedRoot, config.envDir)) : resolvedRoot;
54876
+ const envDir = config.envDir ? normalizePath$4(path$d.resolve(resolvedRoot, config.envDir)) : resolvedRoot;
53994
54877
  const userEnv = inlineConfig.envFile !== false && loadEnv(mode, envDir, resolveEnvPrefix(config));
53995
54878
  const userNodeEnv = process.env.VITE_USER_NODE_ENV;
53996
54879
  if (!isNodeEnvSet && userNodeEnv) {
@@ -54006,12 +54889,12 @@ async function resolveConfig(inlineConfig, command, defaultMode = "development",
54006
54889
  const relativeBaseShortcut = config.base === "" || config.base === "./";
54007
54890
  const resolvedBase = relativeBaseShortcut ? !isBuild || config.build?.ssr ? "/" : "./" : resolveBaseUrl(config.base, isBuild, logger);
54008
54891
  const pkgDir = findNearestPackageData(resolvedRoot, packageCache)?.dir;
54009
- const cacheDir = normalizePath$3(
54892
+ const cacheDir = normalizePath$4(
54010
54893
  config.cacheDir ? path$d.resolve(resolvedRoot, config.cacheDir) : pkgDir ? path$d.join(pkgDir, `node_modules/.vite`) : path$d.join(resolvedRoot, `.vite`)
54011
54894
  );
54012
54895
  const assetsFilter = config.assetsInclude && (!Array.isArray(config.assetsInclude) || config.assetsInclude.length) ? createFilter(config.assetsInclude) : () => false;
54013
54896
  const { publicDir } = config;
54014
- const resolvedPublicDir = publicDir !== false && publicDir !== "" ? normalizePath$3(
54897
+ const resolvedPublicDir = publicDir !== false && publicDir !== "" ? normalizePath$4(
54015
54898
  path$d.resolve(
54016
54899
  resolvedRoot,
54017
54900
  typeof publicDir === "string" ? publicDir : configDefaults.publicDir
@@ -54074,9 +54957,9 @@ async function resolveConfig(inlineConfig, command, defaultMode = "development",
54074
54957
  const base = withTrailingSlash(resolvedBase);
54075
54958
  const preview = resolvePreviewOptions(config.preview, server);
54076
54959
  resolved = {
54077
- configFile: configFile ? normalizePath$3(configFile) : undefined,
54960
+ configFile: configFile ? normalizePath$4(configFile) : undefined,
54078
54961
  configFileDependencies: configFileDependencies.map(
54079
- (name) => normalizePath$3(path$d.resolve(name))
54962
+ (name) => normalizePath$4(path$d.resolve(name))
54080
54963
  ),
54081
54964
  inlineConfig,
54082
54965
  root: resolvedRoot,
@@ -54241,7 +55124,7 @@ assetFileNames isn't equal for every build.rollupOptions.output. A single patter
54241
55124
  `)
54242
55125
  );
54243
55126
  }
54244
- const resolvedBuildOutDir = normalizePath$3(
55127
+ const resolvedBuildOutDir = normalizePath$4(
54245
55128
  path$d.resolve(resolved.root, resolved.build.outDir)
54246
55129
  );
54247
55130
  if (isParentDirectory(resolvedBuildOutDir, resolved.root) || resolvedBuildOutDir === resolved.root) {
@@ -54325,7 +55208,7 @@ async function loadConfigFromFile(configEnv, configFile, configRoot = process.cw
54325
55208
  throw new Error(`config must export or return an object.`);
54326
55209
  }
54327
55210
  return {
54328
- path: normalizePath$3(resolvedPath),
55211
+ path: normalizePath$4(resolvedPath),
54329
55212
  config,
54330
55213
  dependencies
54331
55214
  };
@@ -54371,7 +55254,7 @@ async function bundleConfigFile(fileName, isESM) {
54371
55254
  const dirnameVarName = "__vite_injected_original_dirname";
54372
55255
  const filenameVarName = "__vite_injected_original_filename";
54373
55256
  const importMetaUrlVarName = "__vite_injected_original_import_meta_url";
54374
- const result = await build$b({
55257
+ const result = await build$j({
54375
55258
  absWorkingDir: process.cwd(),
54376
55259
  entryPoints: [fileName],
54377
55260
  write: false,
@@ -54593,4 +55476,4 @@ function optimizeDepsDisabledBackwardCompatibility(resolved, optimizeDeps, optim
54593
55476
  }
54594
55477
  }
54595
55478
 
54596
- export { normalizePath$3 as A, BuildEnvironment as B, mergeConfig as C, DevEnvironment as D, mergeAlias as E, createFilter as F, rollupVersion as G, send$1 as H, createLogger as I, searchForWorkspaceRoot as J, isFileServingAllowed as K, isFileLoadingAllowed as L, loadEnv as M, resolveEnvPrefix as N, colors$1 as O, getDefaultExportFromCjs as P, commonjsGlobal as Q, index$1 as R, index as S, build$1 as T, preview$1 as U, arraify as a, perEnvironmentState as b, createServer as c, defineConfig as d, preview as e, build as f, createBuilder as g, createIdResolver as h, isInNodeModules$1 as i, formatPostcssSourceMap as j, preprocessCSS as k, loadConfigFromFile as l, buildErrorMessage as m, createRunnableDevEnvironment as n, optimizeDeps as o, perEnvironmentPlugin as p, isRunnableDevEnvironment as q, resolveConfig as r, sortUserPlugins as s, transformWithEsbuild as t, runnerImport as u, fetchModule as v, createServerModuleRunner as w, createServerModuleRunnerTransport as x, createServerHotChannel as y, ssrTransform as z };
55479
+ export { normalizePath$4 as A, BuildEnvironment as B, mergeConfig as C, DevEnvironment as D, mergeAlias as E, createFilter as F, rollupVersion as G, send$1 as H, createLogger as I, searchForWorkspaceRoot as J, isFileServingAllowed as K, isFileLoadingAllowed as L, loadEnv as M, resolveEnvPrefix as N, colors$1 as O, getDefaultExportFromCjs as P, commonjsGlobal as Q, index$1 as R, index as S, build$1 as T, preview$1 as U, arraify as a, perEnvironmentState as b, createServer as c, defineConfig as d, preview as e, build as f, createBuilder as g, createIdResolver as h, isInNodeModules$1 as i, formatPostcssSourceMap as j, preprocessCSS as k, loadConfigFromFile as l, buildErrorMessage as m, createRunnableDevEnvironment as n, optimizeDeps as o, perEnvironmentPlugin as p, isRunnableDevEnvironment as q, resolveConfig as r, sortUserPlugins as s, transformWithEsbuild as t, runnerImport as u, fetchModule as v, createServerModuleRunner as w, createServerModuleRunnerTransport as x, createServerHotChannel as y, ssrTransform as z };