vite 6.1.0-beta.2 → 6.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/node/chunks/{dep-B-U7Afbv.js → dep-B42HB7IL.js} +1 -1
- package/dist/node/chunks/{dep-C64BF_qg.js → dep-CJRd4GTw.js} +1 -1
- package/dist/node/chunks/{dep-De0zV__s.js → dep-Cg8OuIew.js} +1618 -683
- package/dist/node/cli.js +11 -8
- package/dist/node/index.d.ts +4 -2
- package/dist/node/index.js +3 -3
- package/package.json +15 -15
@@ -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$
|
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$
|
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$
|
391
|
+
} (utils$e));
|
392
392
|
|
393
|
-
const utils$
|
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$
|
710
|
+
if (glob) glob = utils$d.removeBackslashes(glob);
|
711
711
|
|
712
712
|
if (base && backslashes === true) {
|
713
|
-
base = utils$
|
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$
|
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$
|
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$
|
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$
|
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$
|
1298
|
+
if (opts.literalBrackets === false || utils$c.hasRegexChars(prevValue)) {
|
1299
1299
|
continue;
|
1300
1300
|
}
|
1301
1301
|
|
1302
|
-
const escaped = utils$
|
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$
|
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$
|
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$
|
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$
|
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$
|
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$
|
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$
|
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$
|
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$
|
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$
|
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$
|
2619
|
+
return normalizePath$7(id);
|
2620
2620
|
}
|
2621
2621
|
// resolve('') is valid and will default to process.cwd()
|
2622
|
-
const basePath = normalizePath$
|
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$
|
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$
|
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$
|
2843
|
+
var utils$9 = {};
|
2844
2844
|
|
2845
|
-
Object.defineProperty(utils$
|
2846
|
-
utils$
|
2847
|
-
const path_1$
|
2848
|
-
function cleanPath(path) {
|
2849
|
-
let normalized = (0, path_1$
|
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$
|
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$
|
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$
|
2862
|
-
function normalizePath$
|
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$
|
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$
|
2875
|
+
utils$9.normalizePath = normalizePath$6;
|
2876
2876
|
|
2877
|
-
var joinPath$
|
2877
|
+
var joinPath$5 = {};
|
2878
2878
|
|
2879
|
-
Object.defineProperty(joinPath$
|
2880
|
-
joinPath$
|
2881
|
-
const path_1$
|
2882
|
-
const utils_1$
|
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$
|
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$
|
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$
|
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$
|
2905
|
-
function build$
|
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$
|
2910
|
+
? joinPathWithBasePath$1
|
2911
|
+
: joinPath$4;
|
2912
2912
|
}
|
2913
|
-
joinPath$
|
2913
|
+
joinPath$5.build = build$i;
|
2914
2914
|
|
2915
|
-
var pushDirectory$
|
2915
|
+
var pushDirectory$5 = {};
|
2916
2916
|
|
2917
|
-
Object.defineProperty(pushDirectory$
|
2918
|
-
pushDirectory$
|
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$
|
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$
|
2942
|
-
function build$
|
2941
|
+
const empty$5 = () => { };
|
2942
|
+
function build$h(root, options) {
|
2943
2943
|
const { includeDirs, filters, relativePaths } = options;
|
2944
2944
|
if (!includeDirs)
|
2945
|
-
return empty$
|
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$
|
2948
|
+
? pushDirectoryFilterWithRelativePath$1(root)
|
2949
|
+
: pushDirectoryWithRelativePath$1(root);
|
2950
|
+
return filters && filters.length ? pushDirectoryFilter$1 : pushDirectory$4;
|
2951
2951
|
}
|
2952
|
-
pushDirectory$
|
2952
|
+
pushDirectory$5.build = build$h;
|
2953
2953
|
|
2954
|
-
var pushFile$
|
2954
|
+
var pushFile$5 = {};
|
2955
2955
|
|
2956
|
-
Object.defineProperty(pushFile$
|
2957
|
-
pushFile$
|
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$
|
2969
|
+
const pushFile$4 = (filename, paths) => {
|
2970
2970
|
paths.push(filename);
|
2971
2971
|
};
|
2972
|
-
const empty$
|
2973
|
-
function build$
|
2972
|
+
const empty$4 = () => { };
|
2973
|
+
function build$g(options) {
|
2974
2974
|
const { excludeFiles, filters, onlyCounts } = options;
|
2975
2975
|
if (excludeFiles)
|
2976
|
-
return empty$
|
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$
|
2984
|
+
return pushFile$4;
|
2985
2985
|
}
|
2986
2986
|
}
|
2987
|
-
pushFile$
|
2987
|
+
pushFile$5.build = build$g;
|
2988
2988
|
|
2989
|
-
var getArray$
|
2989
|
+
var getArray$5 = {};
|
2990
2990
|
|
2991
|
-
Object.defineProperty(getArray$
|
2992
|
-
getArray$
|
2993
|
-
const getArray$
|
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$
|
3000
|
-
return options.group ? getArrayGroup : getArray$
|
2999
|
+
function build$f(options) {
|
3000
|
+
return options.group ? getArrayGroup$1 : getArray$4;
|
3001
3001
|
}
|
3002
|
-
getArray$
|
3002
|
+
getArray$5.build = build$f;
|
3003
3003
|
|
3004
|
-
var groupFiles$
|
3004
|
+
var groupFiles$5 = {};
|
3005
3005
|
|
3006
|
-
Object.defineProperty(groupFiles$
|
3007
|
-
groupFiles$
|
3008
|
-
const groupFiles$
|
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$
|
3013
|
-
return options.group ? groupFiles$
|
3011
|
+
const empty$3 = () => { };
|
3012
|
+
function build$e(options) {
|
3013
|
+
return options.group ? groupFiles$4 : empty$3;
|
3014
3014
|
}
|
3015
|
-
groupFiles$
|
3015
|
+
groupFiles$5.build = build$e;
|
3016
3016
|
|
3017
|
-
var resolveSymlink$
|
3017
|
+
var resolveSymlink$3 = {};
|
3018
3018
|
|
3019
|
-
var __importDefault$
|
3019
|
+
var __importDefault$3 = (resolveSymlink$3.__importDefault) || function (mod) {
|
3020
3020
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
3021
3021
|
};
|
3022
|
-
Object.defineProperty(resolveSymlink$
|
3023
|
-
resolveSymlink$
|
3024
|
-
const fs_1$
|
3025
|
-
const path_1$
|
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$
|
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$
|
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$
|
3047
|
-
const stat = fs_1$
|
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$
|
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$
|
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$
|
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$
|
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$
|
3086
|
+
var invokeCallback$3 = {};
|
3087
3087
|
|
3088
|
-
Object.defineProperty(invokeCallback$
|
3089
|
-
invokeCallback$
|
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$
|
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$
|
3143
|
+
invokeCallback$3.build = build$c;
|
3144
3144
|
|
3145
|
-
var walkDirectory$
|
3145
|
+
var walkDirectory$3 = {};
|
3146
3146
|
|
3147
|
-
var __importDefault = (walkDirectory$
|
3147
|
+
var __importDefault$2 = (walkDirectory$3.__importDefault) || function (mod) {
|
3148
3148
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
3149
3149
|
};
|
3150
|
-
Object.defineProperty(walkDirectory$
|
3151
|
-
walkDirectory$
|
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$
|
3183
|
-
return isSynchronous ? walkSync : walkAsync;
|
3182
|
+
function build$b(isSynchronous) {
|
3183
|
+
return isSynchronous ? walkSync$1 : walkAsync$1;
|
3184
3184
|
}
|
3185
|
-
walkDirectory$
|
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$
|
3267
|
-
const utils_1 = utils$
|
3268
|
-
const joinPath = __importStar(joinPath$
|
3269
|
-
const pushDirectory = __importStar(pushDirectory$
|
3270
|
-
const pushFile = __importStar(pushFile$
|
3271
|
-
const getArray = __importStar(getArray$
|
3272
|
-
const groupFiles = __importStar(groupFiles$
|
3273
|
-
const resolveSymlink = __importStar(resolveSymlink$
|
3274
|
-
const invokeCallback = __importStar(invokeCallback$
|
3275
|
-
const walkDirectory = __importStar(walkDirectory$
|
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$
|
3353
|
-
const directoryPath = (0, utils_1.normalizePath)((0, path_1$
|
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$
|
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$
|
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$
|
3384
|
+
var sync$4 = {};
|
3385
3385
|
|
3386
|
-
Object.defineProperty(sync$
|
3387
|
-
sync$
|
3388
|
-
const walker_1 = walker;
|
3389
|
-
function sync$
|
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$
|
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$
|
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$
|
3554
|
+
var types$2 = {};
|
3555
3555
|
|
3556
|
-
Object.defineProperty(types$
|
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$
|
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$
|
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$
|
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$
|
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$
|
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$
|
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$
|
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$
|
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$
|
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$
|
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$
|
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$
|
10027
|
+
return dirent.isDirectory() ? recursiveReaddir(res) : normalizePath$4(res);
|
10028
10028
|
})
|
10029
10029
|
);
|
10030
10030
|
return files.flat(1);
|
@@ -10210,7 +10210,7 @@ async function resolveHostname(optionsHost) {
|
|
10210
10210
|
}
|
10211
10211
|
return { host, name };
|
10212
10212
|
}
|
10213
|
-
async function resolveServerUrls(server, options, config) {
|
10213
|
+
async function resolveServerUrls(server, options, httpsOptions, config) {
|
10214
10214
|
const address = server.address();
|
10215
10215
|
const isAddressInfo = (x) => x?.address;
|
10216
10216
|
if (!isAddressInfo(address)) {
|
@@ -10250,8 +10250,48 @@ async function resolveServerUrls(server, options, config) {
|
|
10250
10250
|
}
|
10251
10251
|
});
|
10252
10252
|
}
|
10253
|
+
const cert = httpsOptions?.cert && !Array.isArray(httpsOptions.cert) ? new crypto$2.X509Certificate(httpsOptions.cert) : undefined;
|
10254
|
+
const hostnameFromCert = cert?.subjectAltName ? extractHostnamesFromSubjectAltName(cert.subjectAltName) : [];
|
10255
|
+
if (hostnameFromCert.length > 0) {
|
10256
|
+
const existings = /* @__PURE__ */ new Set([...local, ...network]);
|
10257
|
+
local.push(
|
10258
|
+
...hostnameFromCert.map((hostname2) => `https://${hostname2}:${port}${base}`).filter((url) => !existings.has(url))
|
10259
|
+
);
|
10260
|
+
}
|
10253
10261
|
return { local, network };
|
10254
10262
|
}
|
10263
|
+
function extractHostnamesFromSubjectAltName(subjectAltName) {
|
10264
|
+
const hostnames = [];
|
10265
|
+
let remaining = subjectAltName;
|
10266
|
+
while (remaining) {
|
10267
|
+
const nameEndIndex = remaining.indexOf(":");
|
10268
|
+
const name = remaining.slice(0, nameEndIndex);
|
10269
|
+
remaining = remaining.slice(nameEndIndex + 1);
|
10270
|
+
if (!remaining) break;
|
10271
|
+
const isQuoted = remaining[0] === '"';
|
10272
|
+
let value;
|
10273
|
+
if (isQuoted) {
|
10274
|
+
const endQuoteIndex = remaining.indexOf('"', 1);
|
10275
|
+
value = JSON.parse(remaining.slice(0, endQuoteIndex + 1));
|
10276
|
+
remaining = remaining.slice(endQuoteIndex + 1);
|
10277
|
+
} else {
|
10278
|
+
const maybeEndIndex = remaining.indexOf(",");
|
10279
|
+
const endIndex = maybeEndIndex === -1 ? remaining.length : maybeEndIndex;
|
10280
|
+
value = remaining.slice(0, endIndex);
|
10281
|
+
remaining = remaining.slice(endIndex);
|
10282
|
+
}
|
10283
|
+
remaining = remaining.slice(
|
10284
|
+
/* for , */
|
10285
|
+
1
|
10286
|
+
).trimStart();
|
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)))) {
|
10290
|
+
hostnames.push(value.replace("*", "vite"));
|
10291
|
+
}
|
10292
|
+
}
|
10293
|
+
return hostnames;
|
10294
|
+
}
|
10255
10295
|
function arraify(target) {
|
10256
10296
|
return Array.isArray(target) ? target : [target];
|
10257
10297
|
}
|
@@ -10878,7 +10918,7 @@ function buildReporterPlugin(config) {
|
|
10878
10918
|
const sizePad = displaySize(biggestSize).length;
|
10879
10919
|
const mapPad = displaySize(biggestMap).length;
|
10880
10920
|
const compressPad = displaySize(biggestCompressSize).length;
|
10881
|
-
const relativeOutDir = normalizePath$
|
10921
|
+
const relativeOutDir = normalizePath$4(
|
10882
10922
|
path$d.relative(
|
10883
10923
|
config.root,
|
10884
10924
|
path$d.resolve(
|
@@ -11320,16 +11360,16 @@ function pattern2regex(resolvedPattern, allowJs) {
|
|
11320
11360
|
|
11321
11361
|
/**
|
11322
11362
|
* replace tokens like ${configDir}
|
11323
|
-
* @param {
|
11324
|
-
|
11325
|
-
|
11326
|
-
|
11327
|
-
|
11328
|
-
|
11329
|
-
|
11330
|
-
|
11331
|
-
|
11332
|
-
|
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
|
+
}
|
11333
11373
|
}
|
11334
11374
|
|
11335
11375
|
/**
|
@@ -11608,7 +11648,7 @@ async function parse$f(filename, options) {
|
|
11608
11648
|
result = await parseFile$1(tsconfigFile, cache, filename === tsconfigFile);
|
11609
11649
|
await Promise.all([parseExtends(result, cache), parseReferences(result, options)]);
|
11610
11650
|
}
|
11611
|
-
|
11651
|
+
replaceTokens(result);
|
11612
11652
|
resolve(resolveSolutionTSConfig(filename, result));
|
11613
11653
|
} catch (e) {
|
11614
11654
|
reject(e);
|
@@ -11714,6 +11754,7 @@ async function parseReferences(result, options) {
|
|
11714
11754
|
await Promise.all(referenced.map((ref) => parseExtends(ref, options?.cache)));
|
11715
11755
|
referenced.forEach((ref) => {
|
11716
11756
|
ref.solution = result;
|
11757
|
+
replaceTokens(ref);
|
11717
11758
|
});
|
11718
11759
|
result.referenced = referenced;
|
11719
11760
|
}
|
@@ -13072,6 +13113,7 @@ const mimes = {
|
|
13072
13113
|
"jsonml": "application/jsonml+json",
|
13073
13114
|
"jsx": "text/jsx",
|
13074
13115
|
"jt": "model/jt",
|
13116
|
+
"jxl": "image/jxl",
|
13075
13117
|
"jxr": "image/jxr",
|
13076
13118
|
"jxra": "image/jxra",
|
13077
13119
|
"jxrs": "image/jxrs",
|
@@ -13092,6 +13134,8 @@ const mimes = {
|
|
13092
13134
|
"m1v": "video/mpeg",
|
13093
13135
|
"m21": "application/mp21",
|
13094
13136
|
"m2a": "audio/mpeg",
|
13137
|
+
"m2t": "video/mp2t",
|
13138
|
+
"m2ts": "video/mp2t",
|
13095
13139
|
"m2v": "video/mpeg",
|
13096
13140
|
"m3a": "audio/mpeg",
|
13097
13141
|
"m4a": "audio/mp4",
|
@@ -13152,6 +13196,7 @@ const mimes = {
|
|
13152
13196
|
"msm": "application/octet-stream",
|
13153
13197
|
"msp": "application/octet-stream",
|
13154
13198
|
"mtl": "model/mtl",
|
13199
|
+
"mts": "video/mp2t",
|
13155
13200
|
"musd": "application/mmt-usd+xml",
|
13156
13201
|
"mxf": "application/mxf",
|
13157
13202
|
"mxmf": "audio/mobile-xmf",
|
@@ -13387,9 +13432,9 @@ function checkPublicFile(url, config) {
|
|
13387
13432
|
const fileName = cleanUrl(url);
|
13388
13433
|
const publicFiles = getPublicFiles(config);
|
13389
13434
|
if (publicFiles) {
|
13390
|
-
return publicFiles.has(fileName) ? normalizePath$
|
13435
|
+
return publicFiles.has(fileName) ? normalizePath$4(path$d.join(publicDir, fileName)) : undefined;
|
13391
13436
|
}
|
13392
|
-
const publicFile = normalizePath$
|
13437
|
+
const publicFile = normalizePath$4(path$d.join(publicDir, fileName));
|
13393
13438
|
if (!publicFile.startsWith(withTrailingSlash(publicDir))) {
|
13394
13439
|
return;
|
13395
13440
|
}
|
@@ -13408,7 +13453,6 @@ function registerCustomMime() {
|
|
13408
13453
|
mimes["cur"] = "image/x-icon";
|
13409
13454
|
mimes["flac"] = "audio/flac";
|
13410
13455
|
mimes["eot"] = "application/vnd.ms-fontobject";
|
13411
|
-
mimes["jxl"] = "image/jxl";
|
13412
13456
|
}
|
13413
13457
|
function renderAssetUrlInJS(pluginContext, chunk, opts, code) {
|
13414
13458
|
const { environment } = pluginContext;
|
@@ -13619,7 +13663,7 @@ async function fileToBuiltUrl(pluginContext, id, skipPublicCheck = false, forceI
|
|
13619
13663
|
if (shouldInline(environment, file, id, content, pluginContext, forceInline)) {
|
13620
13664
|
url = assetToDataURL(environment, file, content);
|
13621
13665
|
} else {
|
13622
|
-
const originalFileName = normalizePath$
|
13666
|
+
const originalFileName = normalizePath$4(
|
13623
13667
|
path$d.relative(environment.config.root, file)
|
13624
13668
|
);
|
13625
13669
|
const referenceId = pluginContext.emitFile({
|
@@ -13699,6 +13743,7 @@ function manifestPlugin() {
|
|
13699
13743
|
manifest: {},
|
13700
13744
|
outputCount: 0,
|
13701
13745
|
reset() {
|
13746
|
+
this.manifest = {};
|
13702
13747
|
this.outputCount = 0;
|
13703
13748
|
}
|
13704
13749
|
};
|
@@ -13816,7 +13861,7 @@ function manifestPlugin() {
|
|
13816
13861
|
}
|
13817
13862
|
function getChunkOriginalFileName(chunk, root, format) {
|
13818
13863
|
if (chunk.facadeModuleId) {
|
13819
|
-
let name = normalizePath$
|
13864
|
+
let name = normalizePath$4(path$d.relative(root, chunk.facadeModuleId));
|
13820
13865
|
if (format === "system" && !chunk.name.includes("-legacy")) {
|
13821
13866
|
const ext = path$d.extname(name);
|
13822
13867
|
const endPos = ext.length !== 0 ? -ext.length : undefined;
|
@@ -14829,265 +14874,1060 @@ async function load(plugin, options, file) {
|
|
14829
14874
|
}
|
14830
14875
|
}
|
14831
14876
|
|
14832
|
-
/**
|
14833
|
-
* Load Plugins
|
14834
|
-
*
|
14835
|
-
* @private
|
14836
|
-
* @method plugins
|
14837
|
-
*
|
14838
|
-
* @param {Object} config PostCSS Config Plugins
|
14839
|
-
*
|
14840
|
-
* @return {Promise<Array>} plugins PostCSS Plugins
|
14841
|
-
*/
|
14842
|
-
async function plugins(config, file) {
|
14843
|
-
let list = [];
|
14844
|
-
|
14845
|
-
if (Array.isArray(config.plugins)) {
|
14846
|
-
list = config.plugins.filter(Boolean);
|
14847
|
-
} else {
|
14848
|
-
list = Object.entries(config.plugins)
|
14849
|
-
.filter(([, options]) => {
|
14850
|
-
return options !== false
|
14851
|
-
})
|
14852
|
-
.map(([plugin, options]) => {
|
14853
|
-
return load(plugin, options, file)
|
14854
|
-
});
|
14855
|
-
list = await Promise.all(list);
|
14856
|
-
}
|
14857
|
-
|
14858
|
-
if (list.length && list.length > 0) {
|
14859
|
-
list.forEach((plugin, i) => {
|
14860
|
-
if (plugin.default) {
|
14861
|
-
plugin = plugin.default;
|
14862
|
-
}
|
14863
|
-
|
14864
|
-
if (plugin.postcss === true) {
|
14865
|
-
plugin = plugin();
|
14866
|
-
} else if (plugin.postcss) {
|
14867
|
-
plugin = plugin.postcss;
|
14868
|
-
}
|
14869
|
-
|
14870
|
-
if (
|
14871
|
-
!(
|
14872
|
-
(typeof plugin === 'object' && Array.isArray(plugin.plugins)) ||
|
14873
|
-
(typeof plugin === 'object' && plugin.postcssPlugin) ||
|
14874
|
-
typeof plugin === 'function'
|
14875
|
-
)
|
14876
|
-
) {
|
14877
|
-
throw new TypeError(
|
14878
|
-
`Invalid PostCSS Plugin found at: plugins[${i}]\n\n(@${file})`
|
14879
|
-
)
|
14880
|
-
}
|
14877
|
+
/**
|
14878
|
+
* Load Plugins
|
14879
|
+
*
|
14880
|
+
* @private
|
14881
|
+
* @method plugins
|
14882
|
+
*
|
14883
|
+
* @param {Object} config PostCSS Config Plugins
|
14884
|
+
*
|
14885
|
+
* @return {Promise<Array>} plugins PostCSS Plugins
|
14886
|
+
*/
|
14887
|
+
async function plugins(config, file) {
|
14888
|
+
let list = [];
|
14889
|
+
|
14890
|
+
if (Array.isArray(config.plugins)) {
|
14891
|
+
list = config.plugins.filter(Boolean);
|
14892
|
+
} else {
|
14893
|
+
list = Object.entries(config.plugins)
|
14894
|
+
.filter(([, options]) => {
|
14895
|
+
return options !== false
|
14896
|
+
})
|
14897
|
+
.map(([plugin, options]) => {
|
14898
|
+
return load(plugin, options, file)
|
14899
|
+
});
|
14900
|
+
list = await Promise.all(list);
|
14901
|
+
}
|
14902
|
+
|
14903
|
+
if (list.length && list.length > 0) {
|
14904
|
+
list.forEach((plugin, i) => {
|
14905
|
+
if (plugin.default) {
|
14906
|
+
plugin = plugin.default;
|
14907
|
+
}
|
14908
|
+
|
14909
|
+
if (plugin.postcss === true) {
|
14910
|
+
plugin = plugin();
|
14911
|
+
} else if (plugin.postcss) {
|
14912
|
+
plugin = plugin.postcss;
|
14913
|
+
}
|
14914
|
+
|
14915
|
+
if (
|
14916
|
+
!(
|
14917
|
+
(typeof plugin === 'object' && Array.isArray(plugin.plugins)) ||
|
14918
|
+
(typeof plugin === 'object' && plugin.postcssPlugin) ||
|
14919
|
+
typeof plugin === 'function'
|
14920
|
+
)
|
14921
|
+
) {
|
14922
|
+
throw new TypeError(
|
14923
|
+
`Invalid PostCSS Plugin found at: plugins[${i}]\n\n(@${file})`
|
14924
|
+
)
|
14925
|
+
}
|
14926
|
+
});
|
14927
|
+
}
|
14928
|
+
|
14929
|
+
return list
|
14930
|
+
}
|
14931
|
+
|
14932
|
+
var plugins_1 = plugins;
|
14933
|
+
|
14934
|
+
// @ts-check
|
14935
|
+
const { resolve } = path$d;
|
14936
|
+
|
14937
|
+
const config$1 = src$2;
|
14938
|
+
|
14939
|
+
const loadOptions = options_1;
|
14940
|
+
const loadPlugins = plugins_1;
|
14941
|
+
const req = req_1;
|
14942
|
+
|
14943
|
+
const interopRequireDefault = obj =>
|
14944
|
+
obj && obj.__esModule ? obj : { default: obj };
|
14945
|
+
|
14946
|
+
/**
|
14947
|
+
* Process the result from cosmiconfig
|
14948
|
+
*
|
14949
|
+
* @param {Object} ctx Config Context
|
14950
|
+
* @param {Object} result Cosmiconfig result
|
14951
|
+
*
|
14952
|
+
* @return {Promise<Object>} PostCSS Config
|
14953
|
+
*/
|
14954
|
+
async function processResult(ctx, result) {
|
14955
|
+
let file = result.filepath || '';
|
14956
|
+
let projectConfig = interopRequireDefault(result.config).default || {};
|
14957
|
+
|
14958
|
+
if (typeof projectConfig === 'function') {
|
14959
|
+
projectConfig = projectConfig(ctx);
|
14960
|
+
} else {
|
14961
|
+
projectConfig = Object.assign({}, projectConfig, ctx);
|
14962
|
+
}
|
14963
|
+
|
14964
|
+
if (!projectConfig.plugins) {
|
14965
|
+
projectConfig.plugins = [];
|
14966
|
+
}
|
14967
|
+
|
14968
|
+
let res = {
|
14969
|
+
file,
|
14970
|
+
options: await loadOptions(projectConfig, file),
|
14971
|
+
plugins: await loadPlugins(projectConfig, file)
|
14972
|
+
};
|
14973
|
+
delete projectConfig.plugins;
|
14974
|
+
return res
|
14975
|
+
}
|
14976
|
+
|
14977
|
+
/**
|
14978
|
+
* Builds the Config Context
|
14979
|
+
*
|
14980
|
+
* @param {Object} ctx Config Context
|
14981
|
+
*
|
14982
|
+
* @return {Object} Config Context
|
14983
|
+
*/
|
14984
|
+
function createContext(ctx) {
|
14985
|
+
/**
|
14986
|
+
* @type {Object}
|
14987
|
+
*
|
14988
|
+
* @prop {String} cwd=process.cwd() Config search start location
|
14989
|
+
* @prop {String} env=process.env.NODE_ENV Config Enviroment, will be set to `development` by `postcss-load-config` if `process.env.NODE_ENV` is `undefined`
|
14990
|
+
*/
|
14991
|
+
ctx = Object.assign(
|
14992
|
+
{
|
14993
|
+
cwd: process.cwd(),
|
14994
|
+
env: process.env.NODE_ENV
|
14995
|
+
},
|
14996
|
+
ctx
|
14997
|
+
);
|
14998
|
+
|
14999
|
+
if (!ctx.env) {
|
15000
|
+
process.env.NODE_ENV = 'development';
|
15001
|
+
}
|
15002
|
+
|
15003
|
+
return ctx
|
15004
|
+
}
|
15005
|
+
|
15006
|
+
async function loader(filepath) {
|
15007
|
+
return req(filepath)
|
15008
|
+
}
|
15009
|
+
|
15010
|
+
let yaml;
|
15011
|
+
async function yamlLoader(_, content) {
|
15012
|
+
if (!yaml) {
|
15013
|
+
try {
|
15014
|
+
yaml = await import('yaml');
|
15015
|
+
} catch (e) {
|
15016
|
+
/* c8 ignore start */
|
15017
|
+
throw new Error(
|
15018
|
+
`'yaml' is required for the YAML configuration files. Make sure it is installed\nError: ${e.message}`
|
15019
|
+
)
|
15020
|
+
}
|
15021
|
+
}
|
15022
|
+
return yaml.parse(content);
|
15023
|
+
}
|
15024
|
+
|
15025
|
+
/** @return {import('lilconfig').Options} */
|
15026
|
+
const withLoaders = (options = {}) => {
|
15027
|
+
let moduleName = 'postcss';
|
15028
|
+
|
15029
|
+
return {
|
15030
|
+
...options,
|
15031
|
+
loaders: {
|
15032
|
+
...options.loaders,
|
15033
|
+
'.cjs': loader,
|
15034
|
+
'.cts': loader,
|
15035
|
+
'.js': loader,
|
15036
|
+
'.mjs': loader,
|
15037
|
+
'.mts': loader,
|
15038
|
+
'.ts': loader,
|
15039
|
+
'.yaml': yamlLoader,
|
15040
|
+
'.yml': yamlLoader
|
15041
|
+
},
|
15042
|
+
searchPlaces: [
|
15043
|
+
...(options.searchPlaces || []),
|
15044
|
+
'package.json',
|
15045
|
+
`.${moduleName}rc`,
|
15046
|
+
`.${moduleName}rc.json`,
|
15047
|
+
`.${moduleName}rc.yaml`,
|
15048
|
+
`.${moduleName}rc.yml`,
|
15049
|
+
`.${moduleName}rc.ts`,
|
15050
|
+
`.${moduleName}rc.cts`,
|
15051
|
+
`.${moduleName}rc.mts`,
|
15052
|
+
`.${moduleName}rc.js`,
|
15053
|
+
`.${moduleName}rc.cjs`,
|
15054
|
+
`.${moduleName}rc.mjs`,
|
15055
|
+
`${moduleName}.config.ts`,
|
15056
|
+
`${moduleName}.config.cts`,
|
15057
|
+
`${moduleName}.config.mts`,
|
15058
|
+
`${moduleName}.config.js`,
|
15059
|
+
`${moduleName}.config.cjs`,
|
15060
|
+
`${moduleName}.config.mjs`
|
15061
|
+
]
|
15062
|
+
}
|
15063
|
+
};
|
15064
|
+
|
15065
|
+
/**
|
15066
|
+
* Load Config
|
15067
|
+
*
|
15068
|
+
* @method rc
|
15069
|
+
*
|
15070
|
+
* @param {Object} ctx Config Context
|
15071
|
+
* @param {String} path Config Path
|
15072
|
+
* @param {Object} options Config Options
|
15073
|
+
*
|
15074
|
+
* @return {Promise} config PostCSS Config
|
15075
|
+
*/
|
15076
|
+
function rc(ctx, path, options) {
|
15077
|
+
/**
|
15078
|
+
* @type {Object} The full Config Context
|
15079
|
+
*/
|
15080
|
+
ctx = createContext(ctx);
|
15081
|
+
|
15082
|
+
/**
|
15083
|
+
* @type {String} `process.cwd()`
|
15084
|
+
*/
|
15085
|
+
path = path ? resolve(path) : process.cwd();
|
15086
|
+
|
15087
|
+
return config$1
|
15088
|
+
.lilconfig('postcss', withLoaders(options))
|
15089
|
+
.search(path)
|
15090
|
+
.then(result => {
|
15091
|
+
if (!result) {
|
15092
|
+
throw new Error(`No PostCSS Config found in: ${path}`)
|
15093
|
+
}
|
15094
|
+
return processResult(ctx, result)
|
15095
|
+
})
|
15096
|
+
}
|
15097
|
+
|
15098
|
+
/**
|
15099
|
+
* Autoload Config for PostCSS
|
15100
|
+
*
|
15101
|
+
* @author Michael Ciniawsky @michael-ciniawsky <michael.ciniawsky@gmail.com>
|
15102
|
+
* @license MIT
|
15103
|
+
*
|
15104
|
+
* @module postcss-load-config
|
15105
|
+
* @version 2.1.0
|
15106
|
+
*
|
15107
|
+
* @requires comsiconfig
|
15108
|
+
* @requires ./options
|
15109
|
+
* @requires ./plugins
|
15110
|
+
*/
|
15111
|
+
var src$1 = rc;
|
15112
|
+
|
15113
|
+
var postcssrc = /*@__PURE__*/getDefaultExportFromCjs(src$1);
|
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
|
+
});
|
14881
15657
|
});
|
14882
|
-
}
|
14883
|
-
|
14884
|
-
return list
|
14885
15658
|
}
|
14886
|
-
|
14887
|
-
|
14888
|
-
|
14889
|
-
|
14890
|
-
const { resolve } = path$d;
|
14891
|
-
|
14892
|
-
const config$1 = src$2;
|
14893
|
-
|
14894
|
-
const loadOptions = options_1;
|
14895
|
-
const loadPlugins = plugins_1;
|
14896
|
-
const req = req_1;
|
14897
|
-
|
14898
|
-
const interopRequireDefault = obj =>
|
14899
|
-
obj && obj.__esModule ? obj : { default: obj };
|
14900
|
-
|
14901
|
-
/**
|
14902
|
-
* Process the result from cosmiconfig
|
14903
|
-
*
|
14904
|
-
* @param {Object} ctx Config Context
|
14905
|
-
* @param {Object} result Cosmiconfig result
|
14906
|
-
*
|
14907
|
-
* @return {Promise<Object>} PostCSS Config
|
14908
|
-
*/
|
14909
|
-
async function processResult(ctx, result) {
|
14910
|
-
let file = result.filepath || '';
|
14911
|
-
let projectConfig = interopRequireDefault(result.config).default || {};
|
14912
|
-
|
14913
|
-
if (typeof projectConfig === 'function') {
|
14914
|
-
projectConfig = projectConfig(ctx);
|
14915
|
-
} else {
|
14916
|
-
projectConfig = Object.assign({}, projectConfig, ctx);
|
14917
|
-
}
|
14918
|
-
|
14919
|
-
if (!projectConfig.plugins) {
|
14920
|
-
projectConfig.plugins = [];
|
14921
|
-
}
|
14922
|
-
|
14923
|
-
let res = {
|
14924
|
-
file,
|
14925
|
-
options: await loadOptions(projectConfig, file),
|
14926
|
-
plugins: await loadPlugins(projectConfig, file)
|
14927
|
-
};
|
14928
|
-
delete projectConfig.plugins;
|
14929
|
-
return res
|
15659
|
+
async.promise = promise;
|
15660
|
+
function callback(root, options, callback) {
|
15661
|
+
let walker = new walker_1$1.Walker(root, options, callback);
|
15662
|
+
walker.start();
|
14930
15663
|
}
|
15664
|
+
async.callback = callback;
|
14931
15665
|
|
14932
|
-
|
14933
|
-
* Builds the Config Context
|
14934
|
-
*
|
14935
|
-
* @param {Object} ctx Config Context
|
14936
|
-
*
|
14937
|
-
* @return {Object} Config Context
|
14938
|
-
*/
|
14939
|
-
function createContext(ctx) {
|
14940
|
-
/**
|
14941
|
-
* @type {Object}
|
14942
|
-
*
|
14943
|
-
* @prop {String} cwd=process.cwd() Config search start location
|
14944
|
-
* @prop {String} env=process.env.NODE_ENV Config Enviroment, will be set to `development` by `postcss-load-config` if `process.env.NODE_ENV` is `undefined`
|
14945
|
-
*/
|
14946
|
-
ctx = Object.assign(
|
14947
|
-
{
|
14948
|
-
cwd: process.cwd(),
|
14949
|
-
env: process.env.NODE_ENV
|
14950
|
-
},
|
14951
|
-
ctx
|
14952
|
-
);
|
14953
|
-
|
14954
|
-
if (!ctx.env) {
|
14955
|
-
process.env.NODE_ENV = 'development';
|
14956
|
-
}
|
15666
|
+
var sync$2 = {};
|
14957
15667
|
|
14958
|
-
|
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();
|
14959
15674
|
}
|
15675
|
+
sync$2.sync = sync$1;
|
14960
15676
|
|
14961
|
-
|
14962
|
-
|
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
|
+
}
|
14963
15697
|
}
|
15698
|
+
apiBuilder.APIBuilder = APIBuilder;
|
14964
15699
|
|
14965
|
-
|
14966
|
-
|
14967
|
-
|
14968
|
-
|
14969
|
-
|
14970
|
-
|
14971
|
-
|
14972
|
-
|
14973
|
-
|
14974
|
-
|
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;
|
14975
15832
|
}
|
14976
|
-
}
|
14977
|
-
return yaml.parse(content);
|
14978
15833
|
}
|
15834
|
+
builder.Builder = Builder;
|
14979
15835
|
|
14980
|
-
|
14981
|
-
const withLoaders = (options = {}) => {
|
14982
|
-
let moduleName = 'postcss';
|
14983
|
-
|
14984
|
-
return {
|
14985
|
-
...options,
|
14986
|
-
loaders: {
|
14987
|
-
...options.loaders,
|
14988
|
-
'.cjs': loader,
|
14989
|
-
'.cts': loader,
|
14990
|
-
'.js': loader,
|
14991
|
-
'.mjs': loader,
|
14992
|
-
'.mts': loader,
|
14993
|
-
'.ts': loader,
|
14994
|
-
'.yaml': yamlLoader,
|
14995
|
-
'.yml': yamlLoader
|
14996
|
-
},
|
14997
|
-
searchPlaces: [
|
14998
|
-
...(options.searchPlaces || []),
|
14999
|
-
'package.json',
|
15000
|
-
`.${moduleName}rc`,
|
15001
|
-
`.${moduleName}rc.json`,
|
15002
|
-
`.${moduleName}rc.yaml`,
|
15003
|
-
`.${moduleName}rc.yml`,
|
15004
|
-
`.${moduleName}rc.ts`,
|
15005
|
-
`.${moduleName}rc.cts`,
|
15006
|
-
`.${moduleName}rc.mts`,
|
15007
|
-
`.${moduleName}rc.js`,
|
15008
|
-
`.${moduleName}rc.cjs`,
|
15009
|
-
`.${moduleName}rc.mjs`,
|
15010
|
-
`${moduleName}.config.ts`,
|
15011
|
-
`${moduleName}.config.cts`,
|
15012
|
-
`${moduleName}.config.mts`,
|
15013
|
-
`${moduleName}.config.js`,
|
15014
|
-
`${moduleName}.config.cjs`,
|
15015
|
-
`${moduleName}.config.mjs`
|
15016
|
-
]
|
15017
|
-
}
|
15018
|
-
};
|
15019
|
-
|
15020
|
-
/**
|
15021
|
-
* Load Config
|
15022
|
-
*
|
15023
|
-
* @method rc
|
15024
|
-
*
|
15025
|
-
* @param {Object} ctx Config Context
|
15026
|
-
* @param {String} path Config Path
|
15027
|
-
* @param {Object} options Config Options
|
15028
|
-
*
|
15029
|
-
* @return {Promise} config PostCSS Config
|
15030
|
-
*/
|
15031
|
-
function rc(ctx, path, options) {
|
15032
|
-
/**
|
15033
|
-
* @type {Object} The full Config Context
|
15034
|
-
*/
|
15035
|
-
ctx = createContext(ctx);
|
15036
|
-
|
15037
|
-
/**
|
15038
|
-
* @type {String} `process.cwd()`
|
15039
|
-
*/
|
15040
|
-
path = path ? resolve(path) : process.cwd();
|
15041
|
-
|
15042
|
-
return config$1
|
15043
|
-
.lilconfig('postcss', withLoaders(options))
|
15044
|
-
.search(path)
|
15045
|
-
.then(result => {
|
15046
|
-
if (!result) {
|
15047
|
-
throw new Error(`No PostCSS Config found in: ${path}`)
|
15048
|
-
}
|
15049
|
-
return processResult(ctx, result)
|
15050
|
-
})
|
15051
|
-
}
|
15836
|
+
var types$1 = {};
|
15052
15837
|
|
15053
|
-
|
15054
|
-
* Autoload Config for PostCSS
|
15055
|
-
*
|
15056
|
-
* @author Michael Ciniawsky @michael-ciniawsky <michael.ciniawsky@gmail.com>
|
15057
|
-
* @license MIT
|
15058
|
-
*
|
15059
|
-
* @module postcss-load-config
|
15060
|
-
* @version 2.1.0
|
15061
|
-
*
|
15062
|
-
* @requires comsiconfig
|
15063
|
-
* @requires ./options
|
15064
|
-
* @requires ./plugins
|
15065
|
-
*/
|
15066
|
-
var src$1 = rc;
|
15838
|
+
Object.defineProperty(types$1, "__esModule", { value: true });
|
15067
15839
|
|
15068
|
-
|
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));
|
15069
15861
|
|
15070
15862
|
// src/index.ts
|
15071
|
-
|
15072
|
-
|
15073
|
-
|
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
|
+
};
|
15074
15905
|
}
|
15075
|
-
|
15076
|
-
|
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];
|
15077
15911
|
}
|
15078
|
-
process.platform === "win32"
|
15912
|
+
var isWin$2 = process.platform === "win32";
|
15079
15913
|
var POSIX_UNESCAPED_GLOB_SYMBOLS = /(?<!\\)([()[\]{}*?|]|^!|[!+@](?=\()|\\(?![()[\]{}!*+?@|]))/g;
|
15080
15914
|
var WIN32_UNESCAPED_GLOB_SYMBOLS = /(?<!\\)([()[\]{}]|^!|[!+@](?=\())/g;
|
15081
15915
|
var escapePosixPath = (path2) => path2.replace(POSIX_UNESCAPED_GLOB_SYMBOLS, "\\$&");
|
15082
15916
|
var escapeWin32Path = (path2) => path2.replace(WIN32_UNESCAPED_GLOB_SYMBOLS, "\\$&");
|
15083
|
-
var escapePath =
|
15917
|
+
var escapePath = isWin$2 ? escapeWin32Path : escapePosixPath;
|
15084
15918
|
function isDynamicPattern(pattern, options) {
|
15085
15919
|
const scan = picomatch$5.scan(pattern);
|
15086
15920
|
return scan.isGlob || scan.negated;
|
15087
15921
|
}
|
15922
|
+
function log(...tasks) {
|
15923
|
+
console.log(`[tinyglobby ${(/* @__PURE__ */ new Date()).toLocaleTimeString("es")}]`, ...tasks);
|
15924
|
+
}
|
15088
15925
|
|
15089
15926
|
// src/index.ts
|
15090
|
-
|
15927
|
+
var PARENT_DIRECTORY = /^(\/?\.\.)+/;
|
15928
|
+
var ESCAPING_BACKSLASHES = /\\(?=[()[\]{}!*+?@|])/g;
|
15929
|
+
var BACKSLASHES = /\\/g;
|
15930
|
+
function normalizePattern(pattern, expandDirectories, cwd, props, isIgnore) {
|
15091
15931
|
var _a;
|
15092
15932
|
let result = pattern;
|
15093
15933
|
if (pattern.endsWith("/")) {
|
@@ -15096,40 +15936,41 @@ function normalizePattern(pattern, expandDirectories, cwd, properties, isIgnore)
|
|
15096
15936
|
if (!result.endsWith("*") && expandDirectories) {
|
15097
15937
|
result += "/**";
|
15098
15938
|
}
|
15099
|
-
if (require$$0$2.isAbsolute(result.replace(
|
15100
|
-
result = posix.relative(cwd, result);
|
15939
|
+
if (require$$0$2.isAbsolute(result.replace(ESCAPING_BACKSLASHES, ""))) {
|
15940
|
+
result = posix.relative(escapePath(cwd), result);
|
15101
15941
|
} else {
|
15102
15942
|
result = posix.normalize(result);
|
15103
15943
|
}
|
15104
|
-
const parentDirectoryMatch =
|
15944
|
+
const parentDirectoryMatch = PARENT_DIRECTORY.exec(result);
|
15105
15945
|
if (parentDirectoryMatch == null ? undefined : parentDirectoryMatch[0]) {
|
15106
15946
|
const potentialRoot = posix.join(cwd, parentDirectoryMatch[0]);
|
15107
|
-
if (
|
15108
|
-
|
15109
|
-
|
15947
|
+
if (props.root.length > potentialRoot.length) {
|
15948
|
+
props.root = potentialRoot;
|
15949
|
+
props.depthOffset = -(parentDirectoryMatch[0].length + 1) / 3;
|
15110
15950
|
}
|
15111
|
-
} else if (!isIgnore &&
|
15112
|
-
const
|
15113
|
-
(_a =
|
15951
|
+
} else if (!isIgnore && props.depthOffset >= 0) {
|
15952
|
+
const parts = splitPattern(result);
|
15953
|
+
(_a = props.commonPath) != null ? _a : props.commonPath = parts;
|
15114
15954
|
const newCommonPath = [];
|
15115
|
-
|
15116
|
-
|
15117
|
-
|
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]) {
|
15118
15959
|
newCommonPath.pop();
|
15119
15960
|
break;
|
15120
15961
|
}
|
15121
|
-
if (part !==
|
15962
|
+
if (part !== props.commonPath[i] || isDynamicPattern(part) || i === parts.length - 1) {
|
15122
15963
|
break;
|
15123
15964
|
}
|
15124
15965
|
newCommonPath.push(part);
|
15125
15966
|
}
|
15126
|
-
|
15127
|
-
|
15128
|
-
|
15967
|
+
props.depthOffset = newCommonPath.length;
|
15968
|
+
props.commonPath = newCommonPath;
|
15969
|
+
props.root = newCommonPath.length > 0 ? `${cwd}/${newCommonPath.join("/")}` : cwd;
|
15129
15970
|
}
|
15130
15971
|
return result;
|
15131
15972
|
}
|
15132
|
-
function processPatterns({ patterns, ignore = [], expandDirectories = true }, cwd,
|
15973
|
+
function processPatterns({ patterns, ignore = [], expandDirectories = true }, cwd, props) {
|
15133
15974
|
if (typeof patterns === "string") {
|
15134
15975
|
patterns = [patterns];
|
15135
15976
|
} else if (!patterns) {
|
@@ -15141,24 +15982,27 @@ function processPatterns({ patterns, ignore = [], expandDirectories = true }, cw
|
|
15141
15982
|
const matchPatterns = [];
|
15142
15983
|
const ignorePatterns = [];
|
15143
15984
|
for (const pattern of ignore) {
|
15144
|
-
if (!pattern
|
15145
|
-
|
15146
|
-
|
15985
|
+
if (!pattern) {
|
15986
|
+
continue;
|
15987
|
+
}
|
15988
|
+
if (pattern[0] !== "!" || pattern[1] === "(") {
|
15989
|
+
ignorePatterns.push(normalizePattern(pattern, expandDirectories, cwd, props, true));
|
15147
15990
|
}
|
15148
15991
|
}
|
15149
15992
|
for (const pattern of patterns) {
|
15150
|
-
if (!pattern
|
15151
|
-
|
15152
|
-
|
15993
|
+
if (!pattern) {
|
15994
|
+
continue;
|
15995
|
+
}
|
15996
|
+
if (pattern[0] !== "!" || pattern[1] === "(") {
|
15997
|
+
matchPatterns.push(normalizePattern(pattern, expandDirectories, cwd, props, false));
|
15153
15998
|
} else if (pattern[1] !== "!" || pattern[2] === "(") {
|
15154
|
-
|
15155
|
-
ignorePatterns.push(newPattern);
|
15999
|
+
ignorePatterns.push(normalizePattern(pattern.slice(1), expandDirectories, cwd, props, true));
|
15156
16000
|
}
|
15157
16001
|
}
|
15158
16002
|
return { match: matchPatterns, ignore: ignorePatterns };
|
15159
16003
|
}
|
15160
16004
|
function getRelativePath(path2, cwd, root) {
|
15161
|
-
return posix.relative(cwd, `${root}/${path2}`);
|
16005
|
+
return posix.relative(cwd, `${root}/${path2}`) || ".";
|
15162
16006
|
}
|
15163
16007
|
function processPath(path2, cwd, root, isDirectory, absolute) {
|
15164
16008
|
const relativePath = absolute ? path2.slice(root.length + 1) || "." : path2;
|
@@ -15167,32 +16011,75 @@ function processPath(path2, cwd, root, isDirectory, absolute) {
|
|
15167
16011
|
}
|
15168
16012
|
return getRelativePath(relativePath, cwd, root);
|
15169
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
|
+
}
|
15170
16021
|
function crawl(options, cwd, sync) {
|
15171
|
-
|
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 = {
|
15172
16032
|
root: cwd,
|
15173
16033
|
commonPath: null,
|
15174
16034
|
depthOffset: 0
|
15175
16035
|
};
|
15176
|
-
const processed = processPatterns(options, cwd,
|
16036
|
+
const processed = processPatterns(options, cwd, props);
|
16037
|
+
const nocase = options.caseSensitiveMatch === false;
|
16038
|
+
if (options.debug) {
|
16039
|
+
log("internal processing patterns:", processed);
|
16040
|
+
}
|
15177
16041
|
const matcher = picomatch$5(processed.match, {
|
15178
16042
|
dot: options.dot,
|
15179
|
-
nocase
|
16043
|
+
nocase,
|
15180
16044
|
ignore: processed.ignore
|
15181
16045
|
});
|
15182
|
-
const
|
16046
|
+
const ignore = picomatch$5(processed.ignore, {
|
16047
|
+
dot: options.dot,
|
16048
|
+
nocase
|
16049
|
+
});
|
16050
|
+
const partialMatcher = getPartialMatcher(processed.match, {
|
15183
16051
|
dot: options.dot,
|
15184
|
-
nocase
|
16052
|
+
nocase
|
15185
16053
|
});
|
15186
16054
|
const fdirOptions = {
|
15187
16055
|
// use relative paths in the matcher
|
15188
|
-
filters: [
|
15189
|
-
|
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
|
+
},
|
15190
16077
|
pathSeparator: "/",
|
15191
16078
|
relativePaths: true,
|
15192
16079
|
resolveSymlinks: true
|
15193
16080
|
};
|
15194
16081
|
if (options.deep) {
|
15195
|
-
fdirOptions.maxDepth = Math.round(options.deep -
|
16082
|
+
fdirOptions.maxDepth = Math.round(options.deep - props.depthOffset);
|
15196
16083
|
}
|
15197
16084
|
if (options.absolute) {
|
15198
16085
|
fdirOptions.relativePaths = false;
|
@@ -15209,19 +16096,23 @@ function crawl(options, cwd, sync) {
|
|
15209
16096
|
} else if (options.onlyFiles === false) {
|
15210
16097
|
fdirOptions.includeDirs = true;
|
15211
16098
|
}
|
15212
|
-
|
15213
|
-
const
|
15214
|
-
if (
|
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) {
|
15215
16106
|
return sync ? api.sync() : api.withPromise();
|
15216
16107
|
}
|
15217
|
-
return sync ? api.sync()
|
16108
|
+
return sync ? formatPaths(api.sync(), cwd, root) : api.withPromise().then((paths) => formatPaths(paths, cwd, root));
|
15218
16109
|
}
|
15219
16110
|
async function glob(patternsOrOptions, options) {
|
15220
16111
|
if (patternsOrOptions && (options == null ? undefined : options.patterns)) {
|
15221
16112
|
throw new Error("Cannot pass patterns as both an argument and an option");
|
15222
16113
|
}
|
15223
16114
|
const opts = Array.isArray(patternsOrOptions) || typeof patternsOrOptions === "string" ? { ...options, patterns: patternsOrOptions } : patternsOrOptions;
|
15224
|
-
const cwd = opts.cwd ? require$$0$2.resolve(opts.cwd).replace(
|
16115
|
+
const cwd = opts.cwd ? require$$0$2.resolve(opts.cwd).replace(BACKSLASHES, "/") : process.cwd().replace(BACKSLASHES, "/");
|
15225
16116
|
return crawl(opts, cwd, false);
|
15226
16117
|
}
|
15227
16118
|
function globSync(patternsOrOptions, options) {
|
@@ -15229,7 +16120,7 @@ function globSync(patternsOrOptions, options) {
|
|
15229
16120
|
throw new Error("Cannot pass patterns as both an argument and an option");
|
15230
16121
|
}
|
15231
16122
|
const opts = Array.isArray(patternsOrOptions) || typeof patternsOrOptions === "string" ? { ...options, patterns: patternsOrOptions } : patternsOrOptions;
|
15232
|
-
const cwd = opts.cwd ? require$$0$2.resolve(opts.cwd).replace(
|
16123
|
+
const cwd = opts.cwd ? require$$0$2.resolve(opts.cwd).replace(BACKSLASHES, "/") : process.cwd().replace(BACKSLASHES, "/");
|
15233
16124
|
return crawl(opts, cwd, true);
|
15234
16125
|
}
|
15235
16126
|
|
@@ -16002,8 +16893,8 @@ function canExternalizeFile(filePath) {
|
|
16002
16893
|
return !ext || ext === ".js" || ext === ".mjs" || ext === ".cjs";
|
16003
16894
|
}
|
16004
16895
|
|
16005
|
-
const normalizedClientEntry$1 = normalizePath$
|
16006
|
-
const normalizedEnvEntry$1 = normalizePath$
|
16896
|
+
const normalizedClientEntry$1 = normalizePath$4(CLIENT_ENTRY);
|
16897
|
+
const normalizedEnvEntry$1 = normalizePath$4(ENV_ENTRY);
|
16007
16898
|
const ERR_RESOLVE_PACKAGE_ENTRY_FAIL = "ERR_RESOLVE_PACKAGE_ENTRY_FAIL";
|
16008
16899
|
const browserExternalId = "__vite-browser-external";
|
16009
16900
|
const optionalPeerDepId = "__vite-optional-peer-dep";
|
@@ -16039,12 +16930,12 @@ function resolvePlugin(resolveOptions) {
|
|
16039
16930
|
if (resolvedImports) {
|
16040
16931
|
id = resolvedImports;
|
16041
16932
|
if (resolveOpts.custom?.["vite:import-glob"]?.isSubImportsPattern) {
|
16042
|
-
return normalizePath$
|
16933
|
+
return normalizePath$4(path$d.join(root, id));
|
16043
16934
|
}
|
16044
16935
|
}
|
16045
16936
|
let res;
|
16046
16937
|
if (asSrc && depsOptimizer?.isOptimizedDepUrl(id)) {
|
16047
|
-
const optimizedPath = id.startsWith(FS_PREFIX) ? fsPathFromId(id) : normalizePath$
|
16938
|
+
const optimizedPath = id.startsWith(FS_PREFIX) ? fsPathFromId(id) : normalizePath$4(path$d.resolve(root, id.slice(1)));
|
16048
16939
|
return optimizedPath;
|
16049
16940
|
}
|
16050
16941
|
if (asSrc && id.startsWith(FS_PREFIX)) {
|
@@ -16062,7 +16953,7 @@ function resolvePlugin(resolveOptions) {
|
|
16062
16953
|
if (id[0] === "." || (preferRelative || importer?.endsWith(".html")) && startsWithWordCharRE.test(id)) {
|
16063
16954
|
const basedir = importer ? path$d.dirname(importer) : process.cwd();
|
16064
16955
|
const fsPath = path$d.resolve(basedir, id);
|
16065
|
-
const normalizedFsPath = normalizePath$
|
16956
|
+
const normalizedFsPath = normalizePath$4(fsPath);
|
16066
16957
|
if (depsOptimizer?.isOptimizedDepFile(normalizedFsPath)) {
|
16067
16958
|
if (!options.isBuild && !DEP_VERSION_RE.test(normalizedFsPath)) {
|
16068
16959
|
const browserHash = optimizedDepInfoFromFile(
|
@@ -16436,7 +17327,7 @@ async function tryOptimizedResolve(depsOptimizer, id, importer, preserveSymlinks
|
|
16436
17327
|
packageCache
|
16437
17328
|
)?.dir;
|
16438
17329
|
if (idPkgDir == null) break;
|
16439
|
-
idPkgDir = normalizePath$
|
17330
|
+
idPkgDir = normalizePath$4(idPkgDir);
|
16440
17331
|
}
|
16441
17332
|
if (optimizedData.src.startsWith(withTrailingSlash(idPkgDir))) {
|
16442
17333
|
return depsOptimizer.getOptimizedDepId(optimizedData);
|
@@ -16670,7 +17561,7 @@ function getRealPath(resolved, preserveSymlinks) {
|
|
16670
17561
|
if (!preserveSymlinks) {
|
16671
17562
|
resolved = safeRealpathSync(resolved);
|
16672
17563
|
}
|
16673
|
-
return normalizePath$
|
17564
|
+
return normalizePath$4(resolved);
|
16674
17565
|
}
|
16675
17566
|
function isDirectory(path2) {
|
16676
17567
|
const stat = tryStatSync(path2);
|
@@ -17905,7 +18796,7 @@ async function transformGlobImport(code, id, root, resolveId, restoreQueryExtens
|
|
17905
18796
|
};
|
17906
18797
|
}
|
17907
18798
|
function globSafePath(path) {
|
17908
|
-
return escapePath(normalizePath$
|
18799
|
+
return escapePath(normalizePath$4(path));
|
17909
18800
|
}
|
17910
18801
|
function lastNthChar(str, n) {
|
17911
18802
|
return str.charAt(str.length - 1 - n);
|
@@ -17934,7 +18825,7 @@ async function toAbsoluteGlob(glob2, root, importer, resolveId) {
|
|
17934
18825
|
if (glob2.startsWith("../")) return pre + posix$1.join(dir, glob2);
|
17935
18826
|
if (glob2.startsWith("**")) return pre + glob2;
|
17936
18827
|
const isSubImportsPattern = glob2[0] === "#" && glob2.includes("*");
|
17937
|
-
const resolved = normalizePath$
|
18828
|
+
const resolved = normalizePath$4(
|
17938
18829
|
await resolveId(glob2, importer, {
|
17939
18830
|
custom: { "vite:import-glob": { isSubImportsPattern } }
|
17940
18831
|
}) || glob2
|
@@ -17989,7 +18880,9 @@ class ScanEnvironment extends BaseEnvironment {
|
|
17989
18880
|
this._plugins = await resolveEnvironmentPlugins(this);
|
17990
18881
|
this._pluginContainer = await createEnvironmentPluginContainer(
|
17991
18882
|
this,
|
17992
|
-
this.plugins
|
18883
|
+
this.plugins,
|
18884
|
+
undefined,
|
18885
|
+
false
|
17993
18886
|
);
|
17994
18887
|
}
|
17995
18888
|
}
|
@@ -18186,7 +19079,7 @@ function globEntries(pattern, environment) {
|
|
18186
19079
|
const resolvedPatterns = arraify(pattern);
|
18187
19080
|
if (resolvedPatterns.every((str) => !isDynamicPattern(str))) {
|
18188
19081
|
return resolvedPatterns.map(
|
18189
|
-
(p) => normalizePath$
|
19082
|
+
(p) => normalizePath$4(path$d.resolve(environment.config.root, p))
|
18190
19083
|
);
|
18191
19084
|
}
|
18192
19085
|
return glob(pattern, {
|
@@ -18212,7 +19105,7 @@ function esbuildScanPlugin(environment, depImports, missing, entries) {
|
|
18212
19105
|
async function resolveId(id, importer) {
|
18213
19106
|
return environment.pluginContainer.resolveId(
|
18214
19107
|
id,
|
18215
|
-
importer && normalizePath$
|
19108
|
+
importer && normalizePath$4(importer),
|
18216
19109
|
{ scan: true }
|
18217
19110
|
);
|
18218
19111
|
}
|
@@ -18322,7 +19215,7 @@ function esbuildScanPlugin(environment, depImports, missing, entries) {
|
|
18322
19215
|
loader: "js",
|
18323
19216
|
// since it is transpiled
|
18324
19217
|
contents: await doTransformGlobImport(contents, p, loader),
|
18325
|
-
resolveDir: normalizePath$
|
19218
|
+
resolveDir: normalizePath$4(path$d.dirname(p)),
|
18326
19219
|
pluginData: {
|
18327
19220
|
htmlType: { loader }
|
18328
19221
|
}
|
@@ -18331,7 +19224,7 @@ function esbuildScanPlugin(environment, depImports, missing, entries) {
|
|
18331
19224
|
scripts[key] = {
|
18332
19225
|
loader,
|
18333
19226
|
contents,
|
18334
|
-
resolveDir: normalizePath$
|
19227
|
+
resolveDir: normalizePath$4(path$d.dirname(p)),
|
18335
19228
|
pluginData: {
|
18336
19229
|
htmlType: { loader }
|
18337
19230
|
}
|
@@ -18406,7 +19299,7 @@ function esbuildScanPlugin(environment, depImports, missing, entries) {
|
|
18406
19299
|
return externalUnlessEntry({ path: id });
|
18407
19300
|
}
|
18408
19301
|
} else {
|
18409
|
-
missing[id] = normalizePath$
|
19302
|
+
missing[id] = normalizePath$4(importer);
|
18410
19303
|
}
|
18411
19304
|
}
|
18412
19305
|
);
|
@@ -18625,6 +19518,11 @@ function isDepOptimizationDisabled(optimizeDeps2) {
|
|
18625
19518
|
}
|
18626
19519
|
async function optimizeDeps(config, force = config.optimizeDeps.force, asCommand = false) {
|
18627
19520
|
const log = asCommand ? config.logger.info : debug$c;
|
19521
|
+
config.logger.warn(
|
19522
|
+
colors$1.yellow(
|
19523
|
+
"manually calling optimizeDeps is deprecated. This is done automatically and does not need to be called manually."
|
19524
|
+
)
|
19525
|
+
);
|
18628
19526
|
const environment = new ScanEnvironment("client", config);
|
18629
19527
|
await environment.init();
|
18630
19528
|
const cachedMetadata = await loadCachedDepOptimizationMetadata(
|
@@ -19088,7 +19986,7 @@ function depsFromOptimizedDepInfo(depsInfo) {
|
|
19088
19986
|
return obj;
|
19089
19987
|
}
|
19090
19988
|
function getOptimizedDepPath(environment, id) {
|
19091
|
-
return normalizePath$
|
19989
|
+
return normalizePath$4(
|
19092
19990
|
path$d.resolve(getDepsCacheDir(environment), flattenId(id) + ".js")
|
19093
19991
|
);
|
19094
19992
|
}
|
@@ -19107,7 +20005,7 @@ function getTempSuffix() {
|
|
19107
20005
|
);
|
19108
20006
|
}
|
19109
20007
|
function getDepsCacheDirPrefix(environment) {
|
19110
|
-
return normalizePath$
|
20008
|
+
return normalizePath$4(path$d.resolve(environment.config.cacheDir, "deps"));
|
19111
20009
|
}
|
19112
20010
|
function createIsOptimizedDepFile(environment) {
|
19113
20011
|
const depsCacheDirPrefix = getDepsCacheDirPrefix(environment);
|
@@ -19116,11 +20014,11 @@ function createIsOptimizedDepFile(environment) {
|
|
19116
20014
|
function createIsOptimizedDepUrl(environment) {
|
19117
20015
|
const { root } = environment.config;
|
19118
20016
|
const depsCacheDir = getDepsCacheDirPrefix(environment);
|
19119
|
-
const depsCacheDirRelative = normalizePath$
|
20017
|
+
const depsCacheDirRelative = normalizePath$4(path$d.relative(root, depsCacheDir));
|
19120
20018
|
const depsCacheDirPrefix = depsCacheDirRelative.startsWith("../") ? (
|
19121
20019
|
// if the cache directory is outside root, the url prefix would be something
|
19122
20020
|
// like '/@fs/absolute/path/to/node_modules/.vite'
|
19123
|
-
`/@fs/${removeLeadingSlash(normalizePath$
|
20021
|
+
`/@fs/${removeLeadingSlash(normalizePath$4(depsCacheDir))}`
|
19124
20022
|
) : (
|
19125
20023
|
// if the cache directory is inside root, the url prefix would be something
|
19126
20024
|
// like '/node_modules/.vite'
|
@@ -19133,7 +20031,7 @@ function createIsOptimizedDepUrl(environment) {
|
|
19133
20031
|
function parseDepsOptimizerMetadata(jsonMetadata, depsCacheDir) {
|
19134
20032
|
const { hash, lockfileHash, configHash, browserHash, optimized, chunks } = JSON.parse(jsonMetadata, (key, value) => {
|
19135
20033
|
if (key === "file" || key === "src") {
|
19136
|
-
return normalizePath$
|
20034
|
+
return normalizePath$4(path$d.resolve(depsCacheDir, value));
|
19137
20035
|
}
|
19138
20036
|
return value;
|
19139
20037
|
});
|
@@ -19194,7 +20092,7 @@ function stringifyDepsOptimizerMetadata(metadata, depsCacheDir) {
|
|
19194
20092
|
},
|
19195
20093
|
(key, value) => {
|
19196
20094
|
if (key === "file" || key === "src") {
|
19197
|
-
return normalizePath$
|
20095
|
+
return normalizePath$4(path$d.relative(depsCacheDir, value));
|
19198
20096
|
}
|
19199
20097
|
return value;
|
19200
20098
|
},
|
@@ -19204,7 +20102,7 @@ function stringifyDepsOptimizerMetadata(metadata, depsCacheDir) {
|
|
19204
20102
|
function esbuildOutputFromId(outputs, id, cacheDirOutputPath) {
|
19205
20103
|
const cwd = process.cwd();
|
19206
20104
|
const flatId = flattenId(id) + ".js";
|
19207
|
-
const normalizedOutputPath = normalizePath$
|
20105
|
+
const normalizedOutputPath = normalizePath$4(
|
19208
20106
|
path$d.relative(cwd, path$d.join(cacheDirOutputPath, flatId))
|
19209
20107
|
);
|
19210
20108
|
const output = outputs[normalizedOutputPath];
|
@@ -19212,7 +20110,7 @@ function esbuildOutputFromId(outputs, id, cacheDirOutputPath) {
|
|
19212
20110
|
return output;
|
19213
20111
|
}
|
19214
20112
|
for (const [key, value] of Object.entries(outputs)) {
|
19215
|
-
if (normalizePath$
|
20113
|
+
if (normalizePath$4(path$d.relative(cwd, key)) === normalizedOutputPath) {
|
19216
20114
|
return value;
|
19217
20115
|
}
|
19218
20116
|
}
|
@@ -19222,7 +20120,7 @@ async function extractExportsData(environment, filePath) {
|
|
19222
20120
|
const { optimizeDeps: optimizeDeps2 } = environment.config;
|
19223
20121
|
const esbuildOptions = optimizeDeps2.esbuildOptions ?? {};
|
19224
20122
|
if (optimizeDeps2.extensions?.some((ext) => filePath.endsWith(ext))) {
|
19225
|
-
const result = await build$
|
20123
|
+
const result = await build$j({
|
19226
20124
|
...esbuildOptions,
|
19227
20125
|
entryPoints: [filePath],
|
19228
20126
|
write: false,
|
@@ -20191,7 +21089,7 @@ function getEnvFilesForMode(mode, envDir) {
|
|
20191
21089
|
`.env.${mode}`,
|
20192
21090
|
/** mode local file */
|
20193
21091
|
`.env.${mode}.local`
|
20194
|
-
].map((file) => normalizePath$
|
21092
|
+
].map((file) => normalizePath$4(path$d.join(envDir, file)));
|
20195
21093
|
}
|
20196
21094
|
function loadEnv(mode, envDir, prefixes = "VITE_") {
|
20197
21095
|
if (mode === "local") {
|
@@ -30131,6 +31029,7 @@ var windows$1 = [
|
|
30131
31029
|
'Code.exe',
|
30132
31030
|
'Code - Insiders.exe',
|
30133
31031
|
'VSCodium.exe',
|
31032
|
+
'Cursor.exe',
|
30134
31033
|
'atom.exe',
|
30135
31034
|
'sublime_text.exe',
|
30136
31035
|
'notepad++.exe',
|
@@ -30212,7 +31111,10 @@ var guess = function guessEditor (specifiedEditor) {
|
|
30212
31111
|
} else if (process.platform === 'win32') {
|
30213
31112
|
const output = childProcess$1
|
30214
31113
|
.execSync(
|
30215
|
-
'powershell -NoProfile -Command "
|
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
|
+
'"',
|
30216
31118
|
{
|
30217
31119
|
stdio: ['pipe', 'pipe', 'ignore']
|
30218
31120
|
}
|
@@ -30383,6 +31285,11 @@ function isTerminalEditor (editor) {
|
|
30383
31285
|
|
30384
31286
|
const positionRE = /:(\d+)(:(\d+))?$/;
|
30385
31287
|
function parseFile (file) {
|
31288
|
+
// support `file://` protocol
|
31289
|
+
if (file.startsWith('file://')) {
|
31290
|
+
file = require$$0$5.fileURLToPath(file);
|
31291
|
+
}
|
31292
|
+
|
30386
31293
|
const fileName = file.replace(positionRE, '');
|
30387
31294
|
const match = file.match(positionRE);
|
30388
31295
|
const lineNumber = match && match[1];
|
@@ -32984,7 +33891,7 @@ function getResolvedOutDirs(root, outDir, outputOptions) {
|
|
32984
33891
|
function resolveEmptyOutDir(emptyOutDir, root, outDirs, logger) {
|
32985
33892
|
if (emptyOutDir != null) return emptyOutDir;
|
32986
33893
|
for (const outDir of outDirs) {
|
32987
|
-
if (!normalizePath$
|
33894
|
+
if (!normalizePath$4(outDir).startsWith(withTrailingSlash(root))) {
|
32988
33895
|
logger?.warn(
|
32989
33896
|
colors$1.yellow(
|
32990
33897
|
`
|
@@ -40914,7 +41821,7 @@ function sirv (dir, opts={}) {
|
|
40914
41821
|
};
|
40915
41822
|
}
|
40916
41823
|
|
40917
|
-
const knownJavascriptExtensionRE = /\.[tj]sx
|
41824
|
+
const knownJavascriptExtensionRE = /\.(?:[tj]sx?|[cm][tj]s)$/;
|
40918
41825
|
const sirvOptions = ({
|
40919
41826
|
getHeaders
|
40920
41827
|
}) => {
|
@@ -40951,7 +41858,7 @@ function servePublicMiddleware(server, publicFiles) {
|
|
40951
41858
|
} catch {
|
40952
41859
|
}
|
40953
41860
|
}
|
40954
|
-
return normalizePath$
|
41861
|
+
return normalizePath$4(filePath);
|
40955
41862
|
};
|
40956
41863
|
return function viteServePublicMiddleware(req, res, next) {
|
40957
41864
|
if (publicFiles && !publicFiles.has(toFilePath(req.url)) || isImportRequest(req.url) || isInternalRequest(req.url) || // for `/public-file.js?url` to be transformed
|
@@ -41575,7 +42482,7 @@ function htmlInlineProxyPlugin(config) {
|
|
41575
42482
|
if (proxyMatch) {
|
41576
42483
|
const index = Number(proxyMatch[1]);
|
41577
42484
|
const file = cleanUrl(id);
|
41578
|
-
const url = file.replace(normalizePath$
|
42485
|
+
const url = file.replace(normalizePath$4(config.root), "");
|
41579
42486
|
const result = htmlProxyMap.get(config).get(url)?.[index];
|
41580
42487
|
if (result) {
|
41581
42488
|
return { ...result, moduleSideEffects: true };
|
@@ -41734,8 +42641,8 @@ function buildHtmlPlugin(config) {
|
|
41734
42641
|
name: "vite:build-html",
|
41735
42642
|
async transform(html, id) {
|
41736
42643
|
if (id.endsWith(".html")) {
|
41737
|
-
id = normalizePath$
|
41738
|
-
const relativeUrlPath = normalizePath$
|
42644
|
+
id = normalizePath$4(id);
|
42645
|
+
const relativeUrlPath = normalizePath$4(path$d.relative(config.root, id));
|
41739
42646
|
const publicPath = `/${relativeUrlPath}`;
|
41740
42647
|
const publicBase = getBaseInHTML(relativeUrlPath, config);
|
41741
42648
|
const publicToRelative = (filename) => publicBase + filename;
|
@@ -41833,7 +42740,7 @@ import ${JSON.stringify(url)}`;
|
|
41833
42740
|
} else if (node.childNodes.length) {
|
41834
42741
|
const scriptNode = node.childNodes.pop();
|
41835
42742
|
const contents = scriptNode.value;
|
41836
|
-
const filePath = id.replace(normalizePath$
|
42743
|
+
const filePath = id.replace(normalizePath$4(config.root), "");
|
41837
42744
|
addToHTMLProxyCache(config, filePath, inlineModuleIndex, {
|
41838
42745
|
code: contents
|
41839
42746
|
});
|
@@ -41869,8 +42776,8 @@ import "${id}?html-proxy&index=${inlineModuleIndex}.js"`;
|
|
41869
42776
|
const processedEncodedUrl = await processSrcSet(
|
41870
42777
|
attr.value,
|
41871
42778
|
async ({ url }) => {
|
41872
|
-
const decodedUrl =
|
41873
|
-
if (!isExcludedUrl(decodedUrl)) {
|
42779
|
+
const decodedUrl = decodeURIIfPossible(url);
|
42780
|
+
if (decodedUrl !== undefined && !isExcludedUrl(decodedUrl)) {
|
41874
42781
|
const result = await processAssetUrl(url);
|
41875
42782
|
return result !== decodedUrl ? encodeURIPath(result) : url;
|
41876
42783
|
}
|
@@ -41883,8 +42790,8 @@ import "${id}?html-proxy&index=${inlineModuleIndex}.js"`;
|
|
41883
42790
|
})()
|
41884
42791
|
);
|
41885
42792
|
} else if (attr.type === "src") {
|
41886
|
-
const url =
|
41887
|
-
if (checkPublicFile(url, config)) {
|
42793
|
+
const url = decodeURIIfPossible(attr.value);
|
42794
|
+
if (url === undefined) ; else if (checkPublicFile(url, config)) {
|
41888
42795
|
overwriteAttrValue(
|
41889
42796
|
s,
|
41890
42797
|
attr.location,
|
@@ -41929,7 +42836,7 @@ import ${JSON.stringify(url)}`;
|
|
41929
42836
|
if (inlineStyle) {
|
41930
42837
|
inlineModuleIndex++;
|
41931
42838
|
const code = inlineStyle.attr.value;
|
41932
|
-
const filePath = id.replace(normalizePath$
|
42839
|
+
const filePath = id.replace(normalizePath$4(config.root), "");
|
41933
42840
|
addToHTMLProxyCache(config, filePath, inlineModuleIndex, { code });
|
41934
42841
|
js += `
|
41935
42842
|
import "${id}?html-proxy&inline-css&style-attr&index=${inlineModuleIndex}.css"`;
|
@@ -41942,7 +42849,7 @@ import "${id}?html-proxy&inline-css&style-attr&index=${inlineModuleIndex}.css"`;
|
|
41942
42849
|
}
|
41943
42850
|
if (node.nodeName === "style" && node.childNodes.length) {
|
41944
42851
|
const styleNode = node.childNodes.pop();
|
41945
|
-
const filePath = id.replace(normalizePath$
|
42852
|
+
const filePath = id.replace(normalizePath$4(config.root), "");
|
41946
42853
|
inlineModuleIndex++;
|
41947
42854
|
addToHTMLProxyCache(config, filePath, inlineModuleIndex, {
|
41948
42855
|
code: styleNode.value
|
@@ -42096,7 +43003,7 @@ ${js}`;
|
|
42096
43003
|
(file) => toStyleSheetLinkTag(file, toOutputPath)
|
42097
43004
|
);
|
42098
43005
|
for (const [normalizedId, html] of processedHtml(this)) {
|
42099
|
-
const relativeUrlPath = normalizePath$
|
43006
|
+
const relativeUrlPath = normalizePath$4(
|
42100
43007
|
path$d.relative(config.root, normalizedId)
|
42101
43008
|
);
|
42102
43009
|
const assetsBase = getBaseInHTML(relativeUrlPath, config);
|
@@ -42119,7 +43026,7 @@ ${js}`;
|
|
42119
43026
|
const isAsync = isAsyncScriptMap.get(config).get(normalizedId);
|
42120
43027
|
let result = html;
|
42121
43028
|
const chunk = Object.values(bundle).find(
|
42122
|
-
(chunk2) => chunk2.type === "chunk" && chunk2.isEntry && chunk2.facadeModuleId && normalizePath$
|
43029
|
+
(chunk2) => chunk2.type === "chunk" && chunk2.isEntry && chunk2.facadeModuleId && normalizePath$4(chunk2.facadeModuleId) === normalizedId
|
42123
43030
|
);
|
42124
43031
|
let canInlineEntry = false;
|
42125
43032
|
if (chunk) {
|
@@ -42204,13 +43111,13 @@ ${js}`;
|
|
42204
43111
|
getPublicAssetFilename(fileHash, config)
|
42205
43112
|
);
|
42206
43113
|
return encodeURIPath(
|
42207
|
-
urlCanParse(publicAssetPath) ? publicAssetPath : normalizePath$
|
43114
|
+
urlCanParse(publicAssetPath) ? publicAssetPath : normalizePath$4(publicAssetPath)
|
42208
43115
|
);
|
42209
43116
|
});
|
42210
43117
|
if (chunk && canInlineEntry) {
|
42211
43118
|
inlineEntryChunk.add(chunk.fileName);
|
42212
43119
|
}
|
42213
|
-
const shortEmitName = normalizePath$
|
43120
|
+
const shortEmitName = normalizePath$4(
|
42214
43121
|
path$d.relative(config.root, normalizedId)
|
42215
43122
|
);
|
42216
43123
|
this.emitFile({
|
@@ -42263,7 +43170,7 @@ function preImportMapHook(config) {
|
|
42263
43170
|
const importMapAppendIndex = html.search(importMapAppendRE);
|
42264
43171
|
if (importMapAppendIndex < 0) return;
|
42265
43172
|
if (importMapAppendIndex < importMapIndex) {
|
42266
|
-
const relativeHtml = normalizePath$
|
43173
|
+
const relativeHtml = normalizePath$4(
|
42267
43174
|
path$d.relative(config.root, ctx.filename)
|
42268
43175
|
);
|
42269
43176
|
config.logger.warnOnce(
|
@@ -42333,7 +43240,7 @@ function htmlEnvHook(config) {
|
|
42333
43240
|
return env[key];
|
42334
43241
|
} else {
|
42335
43242
|
if (envPrefix.some((prefix) => key.startsWith(prefix))) {
|
42336
|
-
const relativeHtml = normalizePath$
|
43243
|
+
const relativeHtml = normalizePath$4(
|
42337
43244
|
path$d.relative(config.root, ctx.filename)
|
42338
43245
|
);
|
42339
43246
|
config.logger.warn(
|
@@ -42607,6 +43514,13 @@ function serializeAttrs(attrs) {
|
|
42607
43514
|
function incrementIndent(indent = "") {
|
42608
43515
|
return `${indent}${indent[0] === " " ? " " : " "}`;
|
42609
43516
|
}
|
43517
|
+
function decodeURIIfPossible(input) {
|
43518
|
+
try {
|
43519
|
+
return decodeURI(input);
|
43520
|
+
} catch {
|
43521
|
+
return;
|
43522
|
+
}
|
43523
|
+
}
|
42610
43524
|
|
42611
43525
|
const debugCache = createDebugger("vite:cache");
|
42612
43526
|
const knownIgnoreList = /* @__PURE__ */ new Set(["/", "/favicon.ico"]);
|
@@ -42652,7 +43566,7 @@ function transformMiddleware(server) {
|
|
42652
43566
|
if (isSourceMap) {
|
42653
43567
|
const depsOptimizer = environment.depsOptimizer;
|
42654
43568
|
if (depsOptimizer?.isOptimizedDepUrl(url)) {
|
42655
|
-
const sourcemapPath = url.startsWith(FS_PREFIX) ? fsPathFromId(url) : normalizePath$
|
43569
|
+
const sourcemapPath = url.startsWith(FS_PREFIX) ? fsPathFromId(url) : normalizePath$4(path$d.resolve(server.config.root, url.slice(1)));
|
42656
43570
|
try {
|
42657
43571
|
const map = JSON.parse(
|
42658
43572
|
await fsp.readFile(sourcemapPath, "utf-8")
|
@@ -42827,7 +43741,7 @@ function getHtmlFilename(url, server) {
|
|
42827
43741
|
return decodeURIComponent(fsPathFromId(url));
|
42828
43742
|
} else {
|
42829
43743
|
return decodeURIComponent(
|
42830
|
-
normalizePath$
|
43744
|
+
normalizePath$4(path$d.join(server.config.root, url.slice(1)))
|
42831
43745
|
);
|
42832
43746
|
}
|
42833
43747
|
}
|
@@ -42901,7 +43815,7 @@ const devHtmlHook = async (html, { path: htmlPath, filename, server, originalUrl
|
|
42901
43815
|
const s = new MagicString(html);
|
42902
43816
|
let inlineModuleIndex = -1;
|
42903
43817
|
const proxyCacheUrl = decodeURI(
|
42904
|
-
cleanUrl(proxyModulePath).replace(normalizePath$
|
43818
|
+
cleanUrl(proxyModulePath).replace(normalizePath$4(config.root), "")
|
42905
43819
|
);
|
42906
43820
|
const styleUrl = [];
|
42907
43821
|
const inlineStyles = [];
|
@@ -43945,6 +44859,7 @@ async function _createServer(inlineConfig = {}, options) {
|
|
43945
44859
|
server.resolvedUrls = await resolveServerUrls(
|
43946
44860
|
httpServer,
|
43947
44861
|
config.server,
|
44862
|
+
httpsOptions,
|
43948
44863
|
config
|
43949
44864
|
);
|
43950
44865
|
if (!isRestart && config.server.open) server.openBrowser();
|
@@ -44051,7 +44966,7 @@ async function _createServer(inlineConfig = {}, options) {
|
|
44051
44966
|
}
|
44052
44967
|
};
|
44053
44968
|
const onFileAddUnlink = async (file, isUnlink) => {
|
44054
|
-
file = normalizePath$
|
44969
|
+
file = normalizePath$4(file);
|
44055
44970
|
reloadOnTsconfigChange(server, file);
|
44056
44971
|
await pluginContainer.watchChange(file, {
|
44057
44972
|
event: isUnlink ? "delete" : "create"
|
@@ -44078,7 +44993,7 @@ async function _createServer(inlineConfig = {}, options) {
|
|
44078
44993
|
await onHMRUpdate(isUnlink ? "delete" : "create", file);
|
44079
44994
|
};
|
44080
44995
|
watcher.on("change", async (file) => {
|
44081
|
-
file = normalizePath$
|
44996
|
+
file = normalizePath$4(file);
|
44082
44997
|
reloadOnTsconfigChange(server, file);
|
44083
44998
|
await pluginContainer.watchChange(file, { event: "update" });
|
44084
44999
|
for (const environment of Object.values(server.environments)) {
|
@@ -44226,7 +45141,7 @@ function createServerCloseFn(server) {
|
|
44226
45141
|
});
|
44227
45142
|
}
|
44228
45143
|
function resolvedAllowDir(root, dir) {
|
44229
|
-
return normalizePath$
|
45144
|
+
return normalizePath$4(path$d.resolve(root, dir));
|
44230
45145
|
}
|
44231
45146
|
const serverConfigDefaults = Object.freeze({
|
44232
45147
|
port: DEFAULT_DEV_PORT,
|
@@ -44306,6 +45221,10 @@ function resolveServerOptions(root, raw, logger) {
|
|
44306
45221
|
)
|
44307
45222
|
);
|
44308
45223
|
}
|
45224
|
+
if (process.env.__VITE_ADDITIONAL_SERVER_ALLOWED_HOSTS && Array.isArray(server.allowedHosts)) {
|
45225
|
+
const additionalHost = process.env.__VITE_ADDITIONAL_SERVER_ALLOWED_HOSTS;
|
45226
|
+
server.allowedHosts = [...server.allowedHosts, additionalHost];
|
45227
|
+
}
|
44309
45228
|
return server;
|
44310
45229
|
}
|
44311
45230
|
async function restartServer(server) {
|
@@ -44387,7 +45306,7 @@ var index = {
|
|
44387
45306
|
|
44388
45307
|
const debugHmr = createDebugger("vite:hmr");
|
44389
45308
|
const whitespaceRE = /\s/;
|
44390
|
-
const normalizedClientDir = normalizePath$
|
45309
|
+
const normalizedClientDir = normalizePath$4(CLIENT_DIR);
|
44391
45310
|
function getShortName(file, root) {
|
44392
45311
|
return file.startsWith(withTrailingSlash(root)) ? path$d.posix.relative(root, file) : file;
|
44393
45312
|
}
|
@@ -44561,7 +45480,7 @@ async function handleHMRUpdate(type, file, server) {
|
|
44561
45480
|
debugHmr?.(`[config change] ${colors$1.dim(shortFile)}`);
|
44562
45481
|
config.logger.info(
|
44563
45482
|
colors$1.green(
|
44564
|
-
`${normalizePath$
|
45483
|
+
`${normalizePath$4(
|
44565
45484
|
path$d.relative(process.cwd(), file)
|
44566
45485
|
)} changed, restarting server...`
|
44567
45486
|
),
|
@@ -44722,7 +45641,7 @@ async function handleHMRUpdate(type, file, server) {
|
|
44722
45641
|
);
|
44723
45642
|
environment.hot.send({
|
44724
45643
|
type: "full-reload",
|
44725
|
-
path: config.server.middlewareMode ? "*" : "/" + normalizePath$
|
45644
|
+
path: config.server.middlewareMode ? "*" : "/" + normalizePath$4(path$d.relative(config.root, file))
|
44726
45645
|
});
|
44727
45646
|
} else {
|
44728
45647
|
debugHmr?.(
|
@@ -45719,7 +46638,7 @@ function getAliasPatternMatcher(entries) {
|
|
45719
46638
|
}
|
45720
46639
|
|
45721
46640
|
const debug$2 = createDebugger("vite:import-analysis");
|
45722
|
-
const clientDir = normalizePath$
|
46641
|
+
const clientDir = normalizePath$4(CLIENT_DIR);
|
45723
46642
|
const skipRE = /\.(?:map|json)(?:$|\?)/;
|
45724
46643
|
const canSkipImportAnalysis = (id) => skipRE.test(id) || isDirectCSSRequest(id);
|
45725
46644
|
const optimizedDepChunkRE = /\/chunk-[A-Z\d]{8}\.js/;
|
@@ -45889,7 +46808,7 @@ function importAnalysisPlugin(config) {
|
|
45889
46808
|
importerModule.isSelfAccepting = false;
|
45890
46809
|
moduleGraph._hasResolveFailedErrorModules.add(importerModule);
|
45891
46810
|
return this.error(
|
45892
|
-
`Failed to resolve import "${url}" from "${normalizePath$
|
46811
|
+
`Failed to resolve import "${url}" from "${normalizePath$4(
|
45893
46812
|
path$d.relative(process.cwd(), importerFile)
|
45894
46813
|
)}". Does the file exist?`,
|
45895
46814
|
pos
|
@@ -46380,8 +47299,8 @@ function __vite__injectQuery(url, queryToInject) {
|
|
46380
47299
|
return `${pathname}?${queryToInject}${search ? `&` + search.slice(1) : ""}${hash || ""}`;
|
46381
47300
|
}
|
46382
47301
|
|
46383
|
-
const normalizedClientEntry = normalizePath$
|
46384
|
-
const normalizedEnvEntry = normalizePath$
|
47302
|
+
const normalizedClientEntry = normalizePath$4(CLIENT_ENTRY);
|
47303
|
+
const normalizedEnvEntry = normalizePath$4(ENV_ENTRY);
|
46385
47304
|
function clientInjectionsPlugin(config) {
|
46386
47305
|
let injectConfigValues;
|
46387
47306
|
const getDefineReplacer = perEnvironmentState((environment) => {
|
@@ -46535,7 +47454,7 @@ function err(e, pos) {
|
|
46535
47454
|
}
|
46536
47455
|
function findClosingParen(input, fromIndex) {
|
46537
47456
|
let count = 1;
|
46538
|
-
for (let i = fromIndex
|
47457
|
+
for (let i = fromIndex; i < input.length; i++) {
|
46539
47458
|
if (input[i] === "(") count++;
|
46540
47459
|
if (input[i] === ")") count--;
|
46541
47460
|
if (count === 0) return i;
|
@@ -47043,10 +47962,10 @@ async function transformDynamicImport(importSource, importer, resolve, root) {
|
|
47043
47962
|
if (!resolvedFileName) {
|
47044
47963
|
return null;
|
47045
47964
|
}
|
47046
|
-
const relativeFileName = normalizePath$
|
47965
|
+
const relativeFileName = normalizePath$4(
|
47047
47966
|
posix$1.relative(
|
47048
|
-
posix$1.dirname(normalizePath$
|
47049
|
-
normalizePath$
|
47967
|
+
posix$1.dirname(normalizePath$4(importer)),
|
47968
|
+
normalizePath$4(resolvedFileName)
|
47050
47969
|
)
|
47051
47970
|
);
|
47052
47971
|
importSource = "`" + (relativeFileName[0] === "." ? "" : "./") + relativeFileName + "`";
|
@@ -47287,11 +48206,12 @@ function throwClosedServerError() {
|
|
47287
48206
|
err.code = ERR_CLOSED_SERVER;
|
47288
48207
|
throw err;
|
47289
48208
|
}
|
47290
|
-
async function createEnvironmentPluginContainer(environment, plugins, watcher) {
|
48209
|
+
async function createEnvironmentPluginContainer(environment, plugins, watcher, autoStart = true) {
|
47291
48210
|
const container = new EnvironmentPluginContainer(
|
47292
48211
|
environment,
|
47293
48212
|
plugins,
|
47294
|
-
watcher
|
48213
|
+
watcher,
|
48214
|
+
autoStart
|
47295
48215
|
);
|
47296
48216
|
await container.resolveRollupOptions();
|
47297
48217
|
return container;
|
@@ -47300,10 +48220,11 @@ class EnvironmentPluginContainer {
|
|
47300
48220
|
/**
|
47301
48221
|
* @internal use `createEnvironmentPluginContainer` instead
|
47302
48222
|
*/
|
47303
|
-
constructor(environment, plugins, watcher) {
|
48223
|
+
constructor(environment, plugins, watcher, autoStart = true) {
|
47304
48224
|
this.environment = environment;
|
47305
48225
|
this.plugins = plugins;
|
47306
48226
|
this.watcher = watcher;
|
48227
|
+
this._started = !autoStart;
|
47307
48228
|
this.minimalContext = new MinimalPluginContext(
|
47308
48229
|
{ rollupVersion, watchMode: true },
|
47309
48230
|
environment
|
@@ -47498,7 +48419,7 @@ class EnvironmentPluginContainer {
|
|
47498
48419
|
}
|
47499
48420
|
}
|
47500
48421
|
if (id) {
|
47501
|
-
partial.id = isExternalUrl(id) ? id : normalizePath$
|
48422
|
+
partial.id = isExternalUrl(id) ? id : normalizePath$4(id);
|
47502
48423
|
return partial;
|
47503
48424
|
} else {
|
47504
48425
|
return null;
|
@@ -47780,7 +48701,7 @@ ${err2.stack || err2.message}
|
|
47780
48701
|
if (!err.frame) {
|
47781
48702
|
let code = this._activeCode;
|
47782
48703
|
if (err.loc.file) {
|
47783
|
-
err.id = normalizePath$
|
48704
|
+
err.id = normalizePath$4(err.loc.file);
|
47784
48705
|
try {
|
47785
48706
|
code = fs__default.readFileSync(err.loc.file, "utf-8");
|
47786
48707
|
} catch {
|
@@ -47813,7 +48734,7 @@ ${err2.stack || err2.message}
|
|
47813
48734
|
if (!err.frame) {
|
47814
48735
|
let code = err.pluginCode;
|
47815
48736
|
if (err.loc.file) {
|
47816
|
-
err.id = normalizePath$
|
48737
|
+
err.id = normalizePath$4(err.loc.file);
|
47817
48738
|
if (!code) {
|
47818
48739
|
try {
|
47819
48740
|
code = fs__default.readFileSync(err.loc.file, "utf-8");
|
@@ -48048,7 +48969,9 @@ function createIdResolver(config, options) {
|
|
48048
48969
|
// Ignore sideEffects and other computations as we only need the id
|
48049
48970
|
idOnly: true
|
48050
48971
|
})
|
48051
|
-
]
|
48972
|
+
],
|
48973
|
+
undefined,
|
48974
|
+
false
|
48052
48975
|
);
|
48053
48976
|
pluginContainerMap.set(environment, pluginContainer);
|
48054
48977
|
}
|
@@ -48060,7 +48983,9 @@ function createIdResolver(config, options) {
|
|
48060
48983
|
if (!pluginContainer) {
|
48061
48984
|
pluginContainer = await createEnvironmentPluginContainer(
|
48062
48985
|
environment,
|
48063
|
-
[alias$1({ entries: environment.config.resolve.alias })]
|
48986
|
+
[alias$1({ entries: environment.config.resolve.alias })],
|
48987
|
+
undefined,
|
48988
|
+
false
|
48064
48989
|
);
|
48065
48990
|
aliasOnlyPluginContainerMap.set(environment, pluginContainer);
|
48066
48991
|
}
|
@@ -48384,7 +49309,7 @@ function cssPostPlugin(config) {
|
|
48384
49309
|
const relative = config.base === "./" || config.base === "";
|
48385
49310
|
const cssAssetDirname = encodedPublicUrls || relative ? slash$1(getCssAssetDirname(cssAssetName)) : undefined;
|
48386
49311
|
const toRelative = (filename) => {
|
48387
|
-
const relativePath = normalizePath$
|
49312
|
+
const relativePath = normalizePath$4(
|
48388
49313
|
path$d.relative(cssAssetDirname, filename)
|
48389
49314
|
);
|
48390
49315
|
return relativePath[0] === "." ? relativePath : "./" + relativePath;
|
@@ -48404,7 +49329,7 @@ function cssPostPlugin(config) {
|
|
48404
49329
|
);
|
48405
49330
|
});
|
48406
49331
|
if (encodedPublicUrls) {
|
48407
|
-
const relativePathToPublicFromCSS = normalizePath$
|
49332
|
+
const relativePathToPublicFromCSS = normalizePath$4(
|
48408
49333
|
path$d.relative(cssAssetDirname, "")
|
48409
49334
|
);
|
48410
49335
|
chunkCSS2 = chunkCSS2.replace(publicAssetUrlRE, (_, hash) => {
|
@@ -48424,7 +49349,7 @@ function cssPostPlugin(config) {
|
|
48424
49349
|
return chunkCSS2;
|
48425
49350
|
};
|
48426
49351
|
function ensureFileExt(name, ext) {
|
48427
|
-
return normalizePath$
|
49352
|
+
return normalizePath$4(
|
48428
49353
|
path$d.format({ ...path$d.parse(name), base: undefined, ext })
|
48429
49354
|
);
|
48430
49355
|
}
|
@@ -48803,10 +49728,10 @@ async function compileCSSPreprocessors(environment, id, lang, code, workerContro
|
|
48803
49728
|
}
|
48804
49729
|
let deps;
|
48805
49730
|
if (preprocessResult.deps.length > 0) {
|
48806
|
-
const normalizedFilename = normalizePath$
|
49731
|
+
const normalizedFilename = normalizePath$4(opts.filename);
|
48807
49732
|
deps = new Set(
|
48808
49733
|
[...preprocessResult.deps].filter(
|
48809
|
-
(dep) => normalizePath$
|
49734
|
+
(dep) => normalizePath$4(dep) !== normalizedFilename
|
48810
49735
|
)
|
48811
49736
|
);
|
48812
49737
|
}
|
@@ -48913,10 +49838,11 @@ async function compileCSS(environment, id, code, workerController, urlResolver)
|
|
48913
49838
|
})
|
48914
49839
|
);
|
48915
49840
|
}
|
48916
|
-
if (urlResolver && //
|
48917
|
-
//
|
48918
|
-
//
|
48919
|
-
|
49841
|
+
if (urlResolver && // when a postcss plugin is used (including the internal postcss plugins),
|
49842
|
+
// we need to add this plugin regardless of whether
|
49843
|
+
// this file contains url() or image-set(),
|
49844
|
+
// because we don't know the content injected by those plugins
|
49845
|
+
(postcssPlugins.length > 0 || isModule || hasUrl)) {
|
48920
49846
|
postcssPlugins.push(
|
48921
49847
|
UrlRewritePostcssPlugin({
|
48922
49848
|
resolver: urlResolver,
|
@@ -48985,7 +49911,7 @@ async function compileCSS(environment, id, code, workerController, urlResolver)
|
|
48985
49911
|
});
|
48986
49912
|
for (const message of postcssResult.messages) {
|
48987
49913
|
if (message.type === "dependency") {
|
48988
|
-
deps.add(normalizePath$
|
49914
|
+
deps.add(normalizePath$4(message.file));
|
48989
49915
|
} else if (message.type === "dir-dependency") {
|
48990
49916
|
const { dir, glob: globPattern = "**" } = message;
|
48991
49917
|
const files = globSync(globPattern, {
|
@@ -49062,8 +49988,8 @@ function createCachedImport(imp) {
|
|
49062
49988
|
return cached;
|
49063
49989
|
};
|
49064
49990
|
}
|
49065
|
-
const importPostcssImport = createCachedImport(() => import('./dep-
|
49066
|
-
const importPostcssModules = createCachedImport(() => import('./dep-
|
49991
|
+
const importPostcssImport = createCachedImport(() => import('./dep-CJRd4GTw.js').then(function (n) { return n.i; }));
|
49992
|
+
const importPostcssModules = createCachedImport(() => import('./dep-B42HB7IL.js').then(function (n) { return n.i; }));
|
49067
49993
|
const importPostcss = createCachedImport(() => import('postcss'));
|
49068
49994
|
const preprocessorWorkerControllerCache = /* @__PURE__ */ new WeakMap();
|
49069
49995
|
let alwaysFakeWorkerWorkerControllerCache;
|
@@ -49086,7 +50012,7 @@ async function formatPostcssSourceMap(rawMap, file) {
|
|
49086
50012
|
if (cleanSource[0] === "<" && cleanSource[cleanSource.length - 1] === ">") {
|
49087
50013
|
return `\0${cleanSource}`;
|
49088
50014
|
}
|
49089
|
-
return normalizePath$
|
50015
|
+
return normalizePath$4(path$d.resolve(inputFileDir, cleanSource));
|
49090
50016
|
});
|
49091
50017
|
return {
|
49092
50018
|
file,
|
@@ -49738,7 +50664,7 @@ const scssProcessor = (maxWorkers) => {
|
|
49738
50664
|
const map2 = result.map ? JSON.parse(result.map.toString()) : undefined;
|
49739
50665
|
if (map2) {
|
49740
50666
|
map2.sources = map2.sources.map(
|
49741
|
-
(url) => url.startsWith("file://") ? normalizePath$
|
50667
|
+
(url) => url.startsWith("file://") ? normalizePath$4(fileURLToPath$1(url)) : url
|
49742
50668
|
);
|
49743
50669
|
}
|
49744
50670
|
return {
|
@@ -49787,7 +50713,7 @@ async function rebaseUrls(environment, file, rootFile, alias, variablePrefix, re
|
|
49787
50713
|
}
|
49788
50714
|
const absolute = await resolver(environment, url, file) || path$d.resolve(fileDir, url);
|
49789
50715
|
const relative = path$d.relative(rootDir, absolute);
|
49790
|
-
return normalizePath$
|
50716
|
+
return normalizePath$4(relative);
|
49791
50717
|
};
|
49792
50718
|
if (hasImportCss) {
|
49793
50719
|
rebased = await rewriteImportCss(content, rebaseFn);
|
@@ -50054,7 +50980,7 @@ const stylProcessor = (maxWorkers) => {
|
|
50054
50980
|
function formatStylusSourceMap(mapBefore, root) {
|
50055
50981
|
if (!mapBefore) return undefined;
|
50056
50982
|
const map2 = { ...mapBefore };
|
50057
|
-
const resolveFromRoot = (p) => normalizePath$
|
50983
|
+
const resolveFromRoot = (p) => normalizePath$4(path$d.resolve(root, p));
|
50058
50984
|
if (map2.file) {
|
50059
50985
|
map2.file = resolveFromRoot(map2.file);
|
50060
50986
|
}
|
@@ -50809,6 +51735,7 @@ function buildImportAnalysisPlugin(config) {
|
|
50809
51735
|
chunk.map
|
50810
51736
|
]);
|
50811
51737
|
map.toUrl = () => genSourceMapUrl(map);
|
51738
|
+
const originalDebugId = chunk.map.debugId;
|
50812
51739
|
chunk.map = map;
|
50813
51740
|
if (buildSourcemap === "inline") {
|
50814
51741
|
chunk.code = chunk.code.replace(
|
@@ -50818,6 +51745,9 @@ function buildImportAnalysisPlugin(config) {
|
|
50818
51745
|
chunk.code += `
|
50819
51746
|
//# sourceMappingURL=${genSourceMapUrl(map)}`;
|
50820
51747
|
} else {
|
51748
|
+
if (originalDebugId) {
|
51749
|
+
map.debugId = originalDebugId;
|
51750
|
+
}
|
50821
51751
|
const mapAsset = bundle[chunk.fileName + ".map"];
|
50822
51752
|
if (mapAsset && mapAsset.type === "asset") {
|
50823
51753
|
mapAsset.source = map.toString();
|
@@ -50848,7 +51778,7 @@ function ssrManifestPlugin() {
|
|
50848
51778
|
const chunk = bundle[file];
|
50849
51779
|
if (chunk.type === "chunk") {
|
50850
51780
|
for (const id in chunk.modules) {
|
50851
|
-
const normalizedId = normalizePath$
|
51781
|
+
const normalizedId = normalizePath$4(relative$2(config.root, id));
|
50852
51782
|
const mappedChunks = ssrManifest[normalizedId] ?? (ssrManifest[normalizedId] = []);
|
50853
51783
|
if (!chunk.isEntry) {
|
50854
51784
|
mappedChunks.push(joinUrlSegments(base, chunk.fileName));
|
@@ -50897,7 +51827,7 @@ function ssrManifestPlugin() {
|
|
50897
51827
|
chunk2.imports.forEach(addDeps);
|
50898
51828
|
}
|
50899
51829
|
};
|
50900
|
-
const normalizedFile = normalizePath$
|
51830
|
+
const normalizedFile = normalizePath$4(
|
50901
51831
|
join$1(dirname$2(chunk.fileName), url.slice(1, -1))
|
50902
51832
|
);
|
50903
51833
|
addDeps(normalizedFile);
|
@@ -51725,8 +52655,8 @@ function toOutputFilePathWithoutRuntime(filename, type, hostId, hostType, config
|
|
51725
52655
|
const toOutputFilePathInCss = toOutputFilePathWithoutRuntime;
|
51726
52656
|
const toOutputFilePathInHtml = toOutputFilePathWithoutRuntime;
|
51727
52657
|
function areSeparateFolders(a, b) {
|
51728
|
-
const na = normalizePath$
|
51729
|
-
const nb = normalizePath$
|
52658
|
+
const na = normalizePath$4(a);
|
52659
|
+
const nb = normalizePath$4(b);
|
51730
52660
|
return na !== nb && !na.startsWith(withTrailingSlash(nb)) && !nb.startsWith(withTrailingSlash(na));
|
51731
52661
|
}
|
51732
52662
|
class BuildEnvironment extends BaseEnvironment {
|
@@ -52733,7 +53663,7 @@ class EnvironmentModuleGraph {
|
|
52733
53663
|
// need to be represented in the module graph so that they can trigger
|
52734
53664
|
// hmr in the importing css file.
|
52735
53665
|
createFileOnlyEntry(file) {
|
52736
|
-
file = normalizePath$
|
53666
|
+
file = normalizePath$4(file);
|
52737
53667
|
let fileMappedModules = this.fileToModulesMap.get(file);
|
52738
53668
|
if (!fileMappedModules) {
|
52739
53669
|
fileMappedModules = /* @__PURE__ */ new Set();
|
@@ -52837,14 +53767,14 @@ async function warmupFile(server, environment, file) {
|
|
52837
53767
|
function htmlFileToUrl(file, root) {
|
52838
53768
|
const url = path$d.relative(root, file);
|
52839
53769
|
if (url[0] === ".") return;
|
52840
|
-
return "/" + normalizePath$
|
53770
|
+
return "/" + normalizePath$4(url);
|
52841
53771
|
}
|
52842
53772
|
function fileToUrl(file, root) {
|
52843
53773
|
const url = path$d.relative(root, file);
|
52844
53774
|
if (url[0] === ".") {
|
52845
|
-
return path$d.posix.join(FS_PREFIX, normalizePath$
|
53775
|
+
return path$d.posix.join(FS_PREFIX, normalizePath$4(file));
|
52846
53776
|
}
|
52847
|
-
return "/" + normalizePath$
|
53777
|
+
return "/" + normalizePath$4(url);
|
52848
53778
|
}
|
52849
53779
|
async function mapFiles(files, root) {
|
52850
53780
|
if (!files.length) return [];
|
@@ -53291,12 +54221,9 @@ async function preview(inlineConfig = {}) {
|
|
53291
54221
|
`The directory "${clientOutDir}" does not exist. Did you build your project?`
|
53292
54222
|
);
|
53293
54223
|
}
|
54224
|
+
const httpsOptions = await resolveHttpsConfig(config.server.https);
|
53294
54225
|
const app = connect$1();
|
53295
|
-
const httpServer = await resolveHttpServer(
|
53296
|
-
config.preview,
|
53297
|
-
app,
|
53298
|
-
await resolveHttpsConfig(config.preview.https)
|
53299
|
-
);
|
54226
|
+
const httpServer = await resolveHttpServer(config.preview, app, httpsOptions);
|
53300
54227
|
setClientErrorHandler(httpServer, config.logger);
|
53301
54228
|
const options = config.preview;
|
53302
54229
|
const logger = config.logger;
|
@@ -53394,6 +54321,7 @@ async function preview(inlineConfig = {}) {
|
|
53394
54321
|
server.resolvedUrls = await resolveServerUrls(
|
53395
54322
|
httpServer,
|
53396
54323
|
config.preview,
|
54324
|
+
httpsOptions,
|
53397
54325
|
config
|
53398
54326
|
);
|
53399
54327
|
if (options.open) {
|
@@ -53688,11 +54616,11 @@ function checkBadCharactersInPath(path2, logger) {
|
|
53688
54616
|
const clientAlias = [
|
53689
54617
|
{
|
53690
54618
|
find: /^\/?@vite\/env/,
|
53691
|
-
replacement: path$d.posix.join(FS_PREFIX, normalizePath$
|
54619
|
+
replacement: path$d.posix.join(FS_PREFIX, normalizePath$4(ENV_ENTRY))
|
53692
54620
|
},
|
53693
54621
|
{
|
53694
54622
|
find: /^\/?@vite\/client/,
|
53695
|
-
replacement: path$d.posix.join(FS_PREFIX, normalizePath$
|
54623
|
+
replacement: path$d.posix.join(FS_PREFIX, normalizePath$4(CLIENT_ENTRY))
|
53696
54624
|
}
|
53697
54625
|
];
|
53698
54626
|
function resolveEnvironmentResolveOptions(resolve, alias, preserveSymlinks, logger, consumer, isSsrTargetWebworkerEnvironment) {
|
@@ -53816,7 +54744,7 @@ async function resolveConfig(inlineConfig, command, defaultMode = "development",
|
|
53816
54744
|
allowClearScreen: config.clearScreen,
|
53817
54745
|
customLogger: config.customLogger
|
53818
54746
|
});
|
53819
|
-
const resolvedRoot = normalizePath$
|
54747
|
+
const resolvedRoot = normalizePath$4(
|
53820
54748
|
config.root ? path$d.resolve(config.root) : process.cwd()
|
53821
54749
|
);
|
53822
54750
|
checkBadCharactersInPath(resolvedRoot, logger);
|
@@ -53935,7 +54863,7 @@ async function resolveConfig(inlineConfig, command, defaultMode = "development",
|
|
53935
54863
|
patchedConfigSsr,
|
53936
54864
|
resolvedDefaultResolve.preserveSymlinks
|
53937
54865
|
);
|
53938
|
-
const envDir = config.envDir ? normalizePath$
|
54866
|
+
const envDir = config.envDir ? normalizePath$4(path$d.resolve(resolvedRoot, config.envDir)) : resolvedRoot;
|
53939
54867
|
const userEnv = inlineConfig.envFile !== false && loadEnv(mode, envDir, resolveEnvPrefix(config));
|
53940
54868
|
const userNodeEnv = process.env.VITE_USER_NODE_ENV;
|
53941
54869
|
if (!isNodeEnvSet && userNodeEnv) {
|
@@ -53951,12 +54879,12 @@ async function resolveConfig(inlineConfig, command, defaultMode = "development",
|
|
53951
54879
|
const relativeBaseShortcut = config.base === "" || config.base === "./";
|
53952
54880
|
const resolvedBase = relativeBaseShortcut ? !isBuild || config.build?.ssr ? "/" : "./" : resolveBaseUrl(config.base, isBuild, logger);
|
53953
54881
|
const pkgDir = findNearestPackageData(resolvedRoot, packageCache)?.dir;
|
53954
|
-
const cacheDir = normalizePath$
|
54882
|
+
const cacheDir = normalizePath$4(
|
53955
54883
|
config.cacheDir ? path$d.resolve(resolvedRoot, config.cacheDir) : pkgDir ? path$d.join(pkgDir, `node_modules/.vite`) : path$d.join(resolvedRoot, `.vite`)
|
53956
54884
|
);
|
53957
54885
|
const assetsFilter = config.assetsInclude && (!Array.isArray(config.assetsInclude) || config.assetsInclude.length) ? createFilter(config.assetsInclude) : () => false;
|
53958
54886
|
const { publicDir } = config;
|
53959
|
-
const resolvedPublicDir = publicDir !== false && publicDir !== "" ? normalizePath$
|
54887
|
+
const resolvedPublicDir = publicDir !== false && publicDir !== "" ? normalizePath$4(
|
53960
54888
|
path$d.resolve(
|
53961
54889
|
resolvedRoot,
|
53962
54890
|
typeof publicDir === "string" ? publicDir : configDefaults.publicDir
|
@@ -54019,9 +54947,9 @@ async function resolveConfig(inlineConfig, command, defaultMode = "development",
|
|
54019
54947
|
const base = withTrailingSlash(resolvedBase);
|
54020
54948
|
const preview = resolvePreviewOptions(config.preview, server);
|
54021
54949
|
resolved = {
|
54022
|
-
configFile: configFile ? normalizePath$
|
54950
|
+
configFile: configFile ? normalizePath$4(configFile) : undefined,
|
54023
54951
|
configFileDependencies: configFileDependencies.map(
|
54024
|
-
(name) => normalizePath$
|
54952
|
+
(name) => normalizePath$4(path$d.resolve(name))
|
54025
54953
|
),
|
54026
54954
|
inlineConfig,
|
54027
54955
|
root: resolvedRoot,
|
@@ -54186,7 +55114,7 @@ assetFileNames isn't equal for every build.rollupOptions.output. A single patter
|
|
54186
55114
|
`)
|
54187
55115
|
);
|
54188
55116
|
}
|
54189
|
-
const resolvedBuildOutDir = normalizePath$
|
55117
|
+
const resolvedBuildOutDir = normalizePath$4(
|
54190
55118
|
path$d.resolve(resolved.root, resolved.build.outDir)
|
54191
55119
|
);
|
54192
55120
|
if (isParentDirectory(resolvedBuildOutDir, resolved.root) || resolvedBuildOutDir === resolved.root) {
|
@@ -54239,9 +55167,9 @@ function sortUserPlugins(plugins) {
|
|
54239
55167
|
return [prePlugins, normalPlugins, postPlugins];
|
54240
55168
|
}
|
54241
55169
|
async function loadConfigFromFile(configEnv, configFile, configRoot = process.cwd(), logLevel, customLogger, configLoader = "bundle") {
|
54242
|
-
if (configLoader !== "bundle" && configLoader !== "runner") {
|
55170
|
+
if (configLoader !== "bundle" && configLoader !== "runner" && configLoader !== "native") {
|
54243
55171
|
throw new Error(
|
54244
|
-
`Unsupported configLoader: ${configLoader}. Accepted values are 'bundle' and '
|
55172
|
+
`Unsupported configLoader: ${configLoader}. Accepted values are 'bundle', 'runner', and 'native'.`
|
54245
55173
|
);
|
54246
55174
|
}
|
54247
55175
|
const start = performance.now();
|
@@ -54262,7 +55190,7 @@ async function loadConfigFromFile(configEnv, configFile, configRoot = process.cw
|
|
54262
55190
|
return null;
|
54263
55191
|
}
|
54264
55192
|
try {
|
54265
|
-
const resolver = configLoader === "bundle" ? bundleAndLoadConfigFile :
|
55193
|
+
const resolver = configLoader === "bundle" ? bundleAndLoadConfigFile : configLoader === "runner" ? runnerImportConfigFile : nativeImportConfigFile;
|
54266
55194
|
const { configExport, dependencies } = await resolver(resolvedPath);
|
54267
55195
|
debug?.(`config file loaded in ${getTime()}`);
|
54268
55196
|
const config = await (typeof configExport === "function" ? configExport(configEnv) : configExport);
|
@@ -54270,7 +55198,7 @@ async function loadConfigFromFile(configEnv, configFile, configRoot = process.cw
|
|
54270
55198
|
throw new Error(`config must export or return an object.`);
|
54271
55199
|
}
|
54272
55200
|
return {
|
54273
|
-
path: normalizePath$
|
55201
|
+
path: normalizePath$4(resolvedPath),
|
54274
55202
|
config,
|
54275
55203
|
dependencies
|
54276
55204
|
};
|
@@ -54284,7 +55212,14 @@ async function loadConfigFromFile(configEnv, configFile, configRoot = process.cw
|
|
54284
55212
|
throw e;
|
54285
55213
|
}
|
54286
55214
|
}
|
54287
|
-
async function
|
55215
|
+
async function nativeImportConfigFile(resolvedPath) {
|
55216
|
+
const module = await import(pathToFileURL$1(resolvedPath).href + "?t=" + Date.now());
|
55217
|
+
return {
|
55218
|
+
configExport: module.default,
|
55219
|
+
dependencies: []
|
55220
|
+
};
|
55221
|
+
}
|
55222
|
+
async function runnerImportConfigFile(resolvedPath) {
|
54288
55223
|
const { module, dependencies } = await runnerImport(resolvedPath);
|
54289
55224
|
return {
|
54290
55225
|
configExport: module.default,
|
@@ -54309,7 +55244,7 @@ async function bundleConfigFile(fileName, isESM) {
|
|
54309
55244
|
const dirnameVarName = "__vite_injected_original_dirname";
|
54310
55245
|
const filenameVarName = "__vite_injected_original_filename";
|
54311
55246
|
const importMetaUrlVarName = "__vite_injected_original_import_meta_url";
|
54312
|
-
const result = await build$
|
55247
|
+
const result = await build$j({
|
54313
55248
|
absWorkingDir: process.cwd(),
|
54314
55249
|
entryPoints: [fileName],
|
54315
55250
|
write: false,
|
@@ -54531,4 +55466,4 @@ function optimizeDepsDisabledBackwardCompatibility(resolved, optimizeDeps, optim
|
|
54531
55466
|
}
|
54532
55467
|
}
|
54533
55468
|
|
54534
|
-
export { normalizePath$
|
55469
|
+
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 };
|