@rstest/core 0.6.1 → 0.6.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE.md +0 -14
- package/dist/0~171.js +4 -6
- package/dist/0~204.js +67 -77
- package/dist/0~263.js +1423 -0
- package/dist/0~350.js +30 -373
- package/dist/0~365.js +92 -0
- package/dist/0~463.js +331 -0
- package/dist/0~470.js +382 -0
- package/dist/0~535.js +10 -0
- package/dist/0~607.js +119 -0
- package/dist/0~610.js +10 -0
- package/dist/0~673.js +10 -0
- package/dist/0~691.js +74 -82
- package/dist/0~711.js +30 -373
- package/dist/0~763.js +10 -0
- package/dist/0~764.js +13284 -0
- package/dist/0~814.js +900 -0
- package/dist/0~830.js +1130 -0
- package/dist/0~836.js +13 -21
- package/dist/0~971.js +130 -136
- package/dist/597.js +174 -0
- package/dist/603.js +41 -0
- package/dist/808.js +167 -0
- package/dist/857.js +3252 -0
- package/dist/index.js +2394 -5972
- package/dist/runtime.js +60 -0
- package/dist/worker.js +155 -1389
- package/dist-types/index.d.ts +24 -3
- package/dist-types/worker.d.ts +8 -2
- package/package.json +2 -2
- package/dist/0~33.js +0 -425
- package/dist/0~414.js +0 -16
- package/dist/0~493.js +0 -126
- package/dist/0~603.js +0 -50
- package/dist/0~628.js +0 -1090
- package/dist/0~655.js +0 -11533
- package/dist/0~85.js +0 -1819
- package/dist/0~873.js +0 -1220
- package/dist/0~928.js +0 -1432
- package/dist/0~967.js +0 -99
- /package/dist/{0~928.js.LICENSE.txt → 0~263.js.LICENSE.txt} +0 -0
- /package/dist/{0~655.js.LICENSE.txt → 0~764.js.LICENSE.txt} +0 -0
package/dist/857.js
ADDED
|
@@ -0,0 +1,3252 @@
|
|
|
1
|
+
import 'module';
|
|
2
|
+
/*#__PURE__*/ import.meta.url;
|
|
3
|
+
import * as __WEBPACK_EXTERNAL_MODULE_node_fs_5ea92f0c__ from "node:fs";
|
|
4
|
+
import * as __WEBPACK_EXTERNAL_MODULE_node_os_74b4b876__ from "node:os";
|
|
5
|
+
import * as __WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__ from "node:path";
|
|
6
|
+
import * as __WEBPACK_EXTERNAL_MODULE_node_tty_c64aab7e__ from "node:tty";
|
|
7
|
+
import * as __WEBPACK_EXTERNAL_MODULE_node_util_1b29d436__ from "node:util";
|
|
8
|
+
import { __webpack_require__ } from "./runtime.js";
|
|
9
|
+
import node_process from "node:process";
|
|
10
|
+
import { fileURLToPath } from "url";
|
|
11
|
+
import { createRequire } from "module";
|
|
12
|
+
import promises, { lstat, readdir, realpath, stat as promises_stat, writeFile } from "node:fs/promises";
|
|
13
|
+
import { createRequire as external_node_module_createRequire, isBuiltin } from "node:module";
|
|
14
|
+
__webpack_require__.add({
|
|
15
|
+
"../../node_modules/.pnpm/picocolors@1.1.1/node_modules/picocolors/picocolors.js": function(module) {
|
|
16
|
+
let p = process || {}, argv = p.argv || [], env = p.env || {};
|
|
17
|
+
let isColorSupported = !(!!env.NO_COLOR || argv.includes("--no-color")) && (!!env.FORCE_COLOR || argv.includes("--color") || "win32" === p.platform || (p.stdout || {}).isTTY && "dumb" !== env.TERM || !!env.CI);
|
|
18
|
+
let formatter = (open, close, replace = open)=>(input)=>{
|
|
19
|
+
let string = "" + input, index = string.indexOf(close, open.length);
|
|
20
|
+
return ~index ? open + replaceClose(string, close, replace, index) + close : open + string + close;
|
|
21
|
+
};
|
|
22
|
+
let replaceClose = (string, close, replace, index)=>{
|
|
23
|
+
let result = "", cursor = 0;
|
|
24
|
+
do {
|
|
25
|
+
result += string.substring(cursor, index) + replace;
|
|
26
|
+
cursor = index + close.length;
|
|
27
|
+
index = string.indexOf(close, cursor);
|
|
28
|
+
}while (~index);
|
|
29
|
+
return result + string.substring(cursor);
|
|
30
|
+
};
|
|
31
|
+
let createColors = (enabled = isColorSupported)=>{
|
|
32
|
+
let f = enabled ? formatter : ()=>String;
|
|
33
|
+
return {
|
|
34
|
+
isColorSupported: enabled,
|
|
35
|
+
reset: f("\x1b[0m", "\x1b[0m"),
|
|
36
|
+
bold: f("\x1b[1m", "\x1b[22m", "\x1b[22m\x1b[1m"),
|
|
37
|
+
dim: f("\x1b[2m", "\x1b[22m", "\x1b[22m\x1b[2m"),
|
|
38
|
+
italic: f("\x1b[3m", "\x1b[23m"),
|
|
39
|
+
underline: f("\x1b[4m", "\x1b[24m"),
|
|
40
|
+
inverse: f("\x1b[7m", "\x1b[27m"),
|
|
41
|
+
hidden: f("\x1b[8m", "\x1b[28m"),
|
|
42
|
+
strikethrough: f("\x1b[9m", "\x1b[29m"),
|
|
43
|
+
black: f("\x1b[30m", "\x1b[39m"),
|
|
44
|
+
red: f("\x1b[31m", "\x1b[39m"),
|
|
45
|
+
green: f("\x1b[32m", "\x1b[39m"),
|
|
46
|
+
yellow: f("\x1b[33m", "\x1b[39m"),
|
|
47
|
+
blue: f("\x1b[34m", "\x1b[39m"),
|
|
48
|
+
magenta: f("\x1b[35m", "\x1b[39m"),
|
|
49
|
+
cyan: f("\x1b[36m", "\x1b[39m"),
|
|
50
|
+
white: f("\x1b[37m", "\x1b[39m"),
|
|
51
|
+
gray: f("\x1b[90m", "\x1b[39m"),
|
|
52
|
+
bgBlack: f("\x1b[40m", "\x1b[49m"),
|
|
53
|
+
bgRed: f("\x1b[41m", "\x1b[49m"),
|
|
54
|
+
bgGreen: f("\x1b[42m", "\x1b[49m"),
|
|
55
|
+
bgYellow: f("\x1b[43m", "\x1b[49m"),
|
|
56
|
+
bgBlue: f("\x1b[44m", "\x1b[49m"),
|
|
57
|
+
bgMagenta: f("\x1b[45m", "\x1b[49m"),
|
|
58
|
+
bgCyan: f("\x1b[46m", "\x1b[49m"),
|
|
59
|
+
bgWhite: f("\x1b[47m", "\x1b[49m"),
|
|
60
|
+
blackBright: f("\x1b[90m", "\x1b[39m"),
|
|
61
|
+
redBright: f("\x1b[91m", "\x1b[39m"),
|
|
62
|
+
greenBright: f("\x1b[92m", "\x1b[39m"),
|
|
63
|
+
yellowBright: f("\x1b[93m", "\x1b[39m"),
|
|
64
|
+
blueBright: f("\x1b[94m", "\x1b[39m"),
|
|
65
|
+
magentaBright: f("\x1b[95m", "\x1b[39m"),
|
|
66
|
+
cyanBright: f("\x1b[96m", "\x1b[39m"),
|
|
67
|
+
whiteBright: f("\x1b[97m", "\x1b[39m"),
|
|
68
|
+
bgBlackBright: f("\x1b[100m", "\x1b[49m"),
|
|
69
|
+
bgRedBright: f("\x1b[101m", "\x1b[49m"),
|
|
70
|
+
bgGreenBright: f("\x1b[102m", "\x1b[49m"),
|
|
71
|
+
bgYellowBright: f("\x1b[103m", "\x1b[49m"),
|
|
72
|
+
bgBlueBright: f("\x1b[104m", "\x1b[49m"),
|
|
73
|
+
bgMagentaBright: f("\x1b[105m", "\x1b[49m"),
|
|
74
|
+
bgCyanBright: f("\x1b[106m", "\x1b[49m"),
|
|
75
|
+
bgWhiteBright: f("\x1b[107m", "\x1b[49m")
|
|
76
|
+
};
|
|
77
|
+
};
|
|
78
|
+
module.exports = createColors();
|
|
79
|
+
module.exports.createColors = createColors;
|
|
80
|
+
},
|
|
81
|
+
"../../node_modules/.pnpm/picomatch@4.0.3/node_modules/picomatch/index.js": function(module, __unused_webpack_exports, __webpack_require__) {
|
|
82
|
+
const pico = __webpack_require__("../../node_modules/.pnpm/picomatch@4.0.3/node_modules/picomatch/lib/picomatch.js");
|
|
83
|
+
const utils = __webpack_require__("../../node_modules/.pnpm/picomatch@4.0.3/node_modules/picomatch/lib/utils.js");
|
|
84
|
+
function picomatch(glob, options, returnState = false) {
|
|
85
|
+
if (options && (null === options.windows || void 0 === options.windows)) options = {
|
|
86
|
+
...options,
|
|
87
|
+
windows: utils.isWindows()
|
|
88
|
+
};
|
|
89
|
+
return pico(glob, options, returnState);
|
|
90
|
+
}
|
|
91
|
+
Object.assign(picomatch, pico);
|
|
92
|
+
module.exports = picomatch;
|
|
93
|
+
},
|
|
94
|
+
"../../node_modules/.pnpm/picomatch@4.0.3/node_modules/picomatch/lib/constants.js": function(module) {
|
|
95
|
+
const WIN_SLASH = '\\\\/';
|
|
96
|
+
const WIN_NO_SLASH = `[^${WIN_SLASH}]`;
|
|
97
|
+
const DOT_LITERAL = '\\.';
|
|
98
|
+
const PLUS_LITERAL = '\\+';
|
|
99
|
+
const QMARK_LITERAL = '\\?';
|
|
100
|
+
const SLASH_LITERAL = '\\/';
|
|
101
|
+
const ONE_CHAR = '(?=.)';
|
|
102
|
+
const QMARK = '[^/]';
|
|
103
|
+
const END_ANCHOR = `(?:${SLASH_LITERAL}|$)`;
|
|
104
|
+
const START_ANCHOR = `(?:^|${SLASH_LITERAL})`;
|
|
105
|
+
const DOTS_SLASH = `${DOT_LITERAL}{1,2}${END_ANCHOR}`;
|
|
106
|
+
const NO_DOT = `(?!${DOT_LITERAL})`;
|
|
107
|
+
const NO_DOTS = `(?!${START_ANCHOR}${DOTS_SLASH})`;
|
|
108
|
+
const NO_DOT_SLASH = `(?!${DOT_LITERAL}{0,1}${END_ANCHOR})`;
|
|
109
|
+
const NO_DOTS_SLASH = `(?!${DOTS_SLASH})`;
|
|
110
|
+
const QMARK_NO_DOT = `[^.${SLASH_LITERAL}]`;
|
|
111
|
+
const STAR = `${QMARK}*?`;
|
|
112
|
+
const SEP = '/';
|
|
113
|
+
const POSIX_CHARS = {
|
|
114
|
+
DOT_LITERAL,
|
|
115
|
+
PLUS_LITERAL,
|
|
116
|
+
QMARK_LITERAL,
|
|
117
|
+
SLASH_LITERAL,
|
|
118
|
+
ONE_CHAR,
|
|
119
|
+
QMARK,
|
|
120
|
+
END_ANCHOR,
|
|
121
|
+
DOTS_SLASH,
|
|
122
|
+
NO_DOT,
|
|
123
|
+
NO_DOTS,
|
|
124
|
+
NO_DOT_SLASH,
|
|
125
|
+
NO_DOTS_SLASH,
|
|
126
|
+
QMARK_NO_DOT,
|
|
127
|
+
STAR,
|
|
128
|
+
START_ANCHOR,
|
|
129
|
+
SEP
|
|
130
|
+
};
|
|
131
|
+
const WINDOWS_CHARS = {
|
|
132
|
+
...POSIX_CHARS,
|
|
133
|
+
SLASH_LITERAL: `[${WIN_SLASH}]`,
|
|
134
|
+
QMARK: WIN_NO_SLASH,
|
|
135
|
+
STAR: `${WIN_NO_SLASH}*?`,
|
|
136
|
+
DOTS_SLASH: `${DOT_LITERAL}{1,2}(?:[${WIN_SLASH}]|$)`,
|
|
137
|
+
NO_DOT: `(?!${DOT_LITERAL})`,
|
|
138
|
+
NO_DOTS: `(?!(?:^|[${WIN_SLASH}])${DOT_LITERAL}{1,2}(?:[${WIN_SLASH}]|$))`,
|
|
139
|
+
NO_DOT_SLASH: `(?!${DOT_LITERAL}{0,1}(?:[${WIN_SLASH}]|$))`,
|
|
140
|
+
NO_DOTS_SLASH: `(?!${DOT_LITERAL}{1,2}(?:[${WIN_SLASH}]|$))`,
|
|
141
|
+
QMARK_NO_DOT: `[^.${WIN_SLASH}]`,
|
|
142
|
+
START_ANCHOR: `(?:^|[${WIN_SLASH}])`,
|
|
143
|
+
END_ANCHOR: `(?:[${WIN_SLASH}]|$)`,
|
|
144
|
+
SEP: '\\'
|
|
145
|
+
};
|
|
146
|
+
const POSIX_REGEX_SOURCE = {
|
|
147
|
+
alnum: 'a-zA-Z0-9',
|
|
148
|
+
alpha: 'a-zA-Z',
|
|
149
|
+
ascii: '\\x00-\\x7F',
|
|
150
|
+
blank: ' \\t',
|
|
151
|
+
cntrl: '\\x00-\\x1F\\x7F',
|
|
152
|
+
digit: '0-9',
|
|
153
|
+
graph: '\\x21-\\x7E',
|
|
154
|
+
lower: 'a-z',
|
|
155
|
+
print: '\\x20-\\x7E ',
|
|
156
|
+
punct: '\\-!"#$%&\'()\\*+,./:;<=>?@[\\]^_`{|}~',
|
|
157
|
+
space: ' \\t\\r\\n\\v\\f',
|
|
158
|
+
upper: 'A-Z',
|
|
159
|
+
word: 'A-Za-z0-9_',
|
|
160
|
+
xdigit: 'A-Fa-f0-9'
|
|
161
|
+
};
|
|
162
|
+
module.exports = {
|
|
163
|
+
MAX_LENGTH: 65536,
|
|
164
|
+
POSIX_REGEX_SOURCE,
|
|
165
|
+
REGEX_BACKSLASH: /\\(?![*+?^${}(|)[\]])/g,
|
|
166
|
+
REGEX_NON_SPECIAL_CHARS: /^[^@![\].,$*+?^{}()|\\/]+/,
|
|
167
|
+
REGEX_SPECIAL_CHARS: /[-*+?.^${}(|)[\]]/,
|
|
168
|
+
REGEX_SPECIAL_CHARS_BACKREF: /(\\?)((\W)(\3*))/g,
|
|
169
|
+
REGEX_SPECIAL_CHARS_GLOBAL: /([-*+?.^${}(|)[\]])/g,
|
|
170
|
+
REGEX_REMOVE_BACKSLASH: /(?:\[.*?[^\\]\]|\\(?=.))/g,
|
|
171
|
+
REPLACEMENTS: {
|
|
172
|
+
__proto__: null,
|
|
173
|
+
'***': '*',
|
|
174
|
+
'**/**': '**',
|
|
175
|
+
'**/**/**': '**'
|
|
176
|
+
},
|
|
177
|
+
CHAR_0: 48,
|
|
178
|
+
CHAR_9: 57,
|
|
179
|
+
CHAR_UPPERCASE_A: 65,
|
|
180
|
+
CHAR_LOWERCASE_A: 97,
|
|
181
|
+
CHAR_UPPERCASE_Z: 90,
|
|
182
|
+
CHAR_LOWERCASE_Z: 122,
|
|
183
|
+
CHAR_LEFT_PARENTHESES: 40,
|
|
184
|
+
CHAR_RIGHT_PARENTHESES: 41,
|
|
185
|
+
CHAR_ASTERISK: 42,
|
|
186
|
+
CHAR_AMPERSAND: 38,
|
|
187
|
+
CHAR_AT: 64,
|
|
188
|
+
CHAR_BACKWARD_SLASH: 92,
|
|
189
|
+
CHAR_CARRIAGE_RETURN: 13,
|
|
190
|
+
CHAR_CIRCUMFLEX_ACCENT: 94,
|
|
191
|
+
CHAR_COLON: 58,
|
|
192
|
+
CHAR_COMMA: 44,
|
|
193
|
+
CHAR_DOT: 46,
|
|
194
|
+
CHAR_DOUBLE_QUOTE: 34,
|
|
195
|
+
CHAR_EQUAL: 61,
|
|
196
|
+
CHAR_EXCLAMATION_MARK: 33,
|
|
197
|
+
CHAR_FORM_FEED: 12,
|
|
198
|
+
CHAR_FORWARD_SLASH: 47,
|
|
199
|
+
CHAR_GRAVE_ACCENT: 96,
|
|
200
|
+
CHAR_HASH: 35,
|
|
201
|
+
CHAR_HYPHEN_MINUS: 45,
|
|
202
|
+
CHAR_LEFT_ANGLE_BRACKET: 60,
|
|
203
|
+
CHAR_LEFT_CURLY_BRACE: 123,
|
|
204
|
+
CHAR_LEFT_SQUARE_BRACKET: 91,
|
|
205
|
+
CHAR_LINE_FEED: 10,
|
|
206
|
+
CHAR_NO_BREAK_SPACE: 160,
|
|
207
|
+
CHAR_PERCENT: 37,
|
|
208
|
+
CHAR_PLUS: 43,
|
|
209
|
+
CHAR_QUESTION_MARK: 63,
|
|
210
|
+
CHAR_RIGHT_ANGLE_BRACKET: 62,
|
|
211
|
+
CHAR_RIGHT_CURLY_BRACE: 125,
|
|
212
|
+
CHAR_RIGHT_SQUARE_BRACKET: 93,
|
|
213
|
+
CHAR_SEMICOLON: 59,
|
|
214
|
+
CHAR_SINGLE_QUOTE: 39,
|
|
215
|
+
CHAR_SPACE: 32,
|
|
216
|
+
CHAR_TAB: 9,
|
|
217
|
+
CHAR_UNDERSCORE: 95,
|
|
218
|
+
CHAR_VERTICAL_LINE: 124,
|
|
219
|
+
CHAR_ZERO_WIDTH_NOBREAK_SPACE: 65279,
|
|
220
|
+
extglobChars (chars) {
|
|
221
|
+
return {
|
|
222
|
+
'!': {
|
|
223
|
+
type: 'negate',
|
|
224
|
+
open: '(?:(?!(?:',
|
|
225
|
+
close: `))${chars.STAR})`
|
|
226
|
+
},
|
|
227
|
+
'?': {
|
|
228
|
+
type: 'qmark',
|
|
229
|
+
open: '(?:',
|
|
230
|
+
close: ')?'
|
|
231
|
+
},
|
|
232
|
+
'+': {
|
|
233
|
+
type: 'plus',
|
|
234
|
+
open: '(?:',
|
|
235
|
+
close: ')+'
|
|
236
|
+
},
|
|
237
|
+
'*': {
|
|
238
|
+
type: 'star',
|
|
239
|
+
open: '(?:',
|
|
240
|
+
close: ')*'
|
|
241
|
+
},
|
|
242
|
+
'@': {
|
|
243
|
+
type: 'at',
|
|
244
|
+
open: '(?:',
|
|
245
|
+
close: ')'
|
|
246
|
+
}
|
|
247
|
+
};
|
|
248
|
+
},
|
|
249
|
+
globChars (win32) {
|
|
250
|
+
return true === win32 ? WINDOWS_CHARS : POSIX_CHARS;
|
|
251
|
+
}
|
|
252
|
+
};
|
|
253
|
+
},
|
|
254
|
+
"../../node_modules/.pnpm/picomatch@4.0.3/node_modules/picomatch/lib/parse.js": function(module, __unused_webpack_exports, __webpack_require__) {
|
|
255
|
+
const constants = __webpack_require__("../../node_modules/.pnpm/picomatch@4.0.3/node_modules/picomatch/lib/constants.js");
|
|
256
|
+
const utils = __webpack_require__("../../node_modules/.pnpm/picomatch@4.0.3/node_modules/picomatch/lib/utils.js");
|
|
257
|
+
const { MAX_LENGTH, POSIX_REGEX_SOURCE, REGEX_NON_SPECIAL_CHARS, REGEX_SPECIAL_CHARS_BACKREF, REPLACEMENTS } = constants;
|
|
258
|
+
const expandRange = (args, options)=>{
|
|
259
|
+
if ('function' == typeof options.expandRange) return options.expandRange(...args, options);
|
|
260
|
+
args.sort();
|
|
261
|
+
const value = `[${args.join('-')}]`;
|
|
262
|
+
try {
|
|
263
|
+
new RegExp(value);
|
|
264
|
+
} catch (ex) {
|
|
265
|
+
return args.map((v)=>utils.escapeRegex(v)).join('..');
|
|
266
|
+
}
|
|
267
|
+
return value;
|
|
268
|
+
};
|
|
269
|
+
const syntaxError = (type, char)=>`Missing ${type}: "${char}" - use "\\\\${char}" to match literal characters`;
|
|
270
|
+
const parse = (input, options)=>{
|
|
271
|
+
if ('string' != typeof input) throw new TypeError('Expected a string');
|
|
272
|
+
input = REPLACEMENTS[input] || input;
|
|
273
|
+
const opts = {
|
|
274
|
+
...options
|
|
275
|
+
};
|
|
276
|
+
const max = 'number' == typeof opts.maxLength ? Math.min(MAX_LENGTH, opts.maxLength) : MAX_LENGTH;
|
|
277
|
+
let len = input.length;
|
|
278
|
+
if (len > max) throw new SyntaxError(`Input length: ${len}, exceeds maximum allowed length: ${max}`);
|
|
279
|
+
const bos = {
|
|
280
|
+
type: 'bos',
|
|
281
|
+
value: '',
|
|
282
|
+
output: opts.prepend || ''
|
|
283
|
+
};
|
|
284
|
+
const tokens = [
|
|
285
|
+
bos
|
|
286
|
+
];
|
|
287
|
+
const capture = opts.capture ? '' : '?:';
|
|
288
|
+
const PLATFORM_CHARS = constants.globChars(opts.windows);
|
|
289
|
+
const EXTGLOB_CHARS = constants.extglobChars(PLATFORM_CHARS);
|
|
290
|
+
const { DOT_LITERAL, PLUS_LITERAL, SLASH_LITERAL, ONE_CHAR, DOTS_SLASH, NO_DOT, NO_DOT_SLASH, NO_DOTS_SLASH, QMARK, QMARK_NO_DOT, STAR, START_ANCHOR } = PLATFORM_CHARS;
|
|
291
|
+
const globstar = (opts)=>`(${capture}(?:(?!${START_ANCHOR}${opts.dot ? DOTS_SLASH : DOT_LITERAL}).)*?)`;
|
|
292
|
+
const nodot = opts.dot ? '' : NO_DOT;
|
|
293
|
+
const qmarkNoDot = opts.dot ? QMARK : QMARK_NO_DOT;
|
|
294
|
+
let star = true === opts.bash ? globstar(opts) : STAR;
|
|
295
|
+
if (opts.capture) star = `(${star})`;
|
|
296
|
+
if ('boolean' == typeof opts.noext) opts.noextglob = opts.noext;
|
|
297
|
+
const state = {
|
|
298
|
+
input,
|
|
299
|
+
index: -1,
|
|
300
|
+
start: 0,
|
|
301
|
+
dot: true === opts.dot,
|
|
302
|
+
consumed: '',
|
|
303
|
+
output: '',
|
|
304
|
+
prefix: '',
|
|
305
|
+
backtrack: false,
|
|
306
|
+
negated: false,
|
|
307
|
+
brackets: 0,
|
|
308
|
+
braces: 0,
|
|
309
|
+
parens: 0,
|
|
310
|
+
quotes: 0,
|
|
311
|
+
globstar: false,
|
|
312
|
+
tokens
|
|
313
|
+
};
|
|
314
|
+
input = utils.removePrefix(input, state);
|
|
315
|
+
len = input.length;
|
|
316
|
+
const extglobs = [];
|
|
317
|
+
const braces = [];
|
|
318
|
+
const stack = [];
|
|
319
|
+
let prev = bos;
|
|
320
|
+
let value;
|
|
321
|
+
const eos = ()=>state.index === len - 1;
|
|
322
|
+
const peek = state.peek = (n = 1)=>input[state.index + n];
|
|
323
|
+
const advance = state.advance = ()=>input[++state.index] || '';
|
|
324
|
+
const remaining = ()=>input.slice(state.index + 1);
|
|
325
|
+
const consume = (value = '', num = 0)=>{
|
|
326
|
+
state.consumed += value;
|
|
327
|
+
state.index += num;
|
|
328
|
+
};
|
|
329
|
+
const append = (token)=>{
|
|
330
|
+
state.output += null != token.output ? token.output : token.value;
|
|
331
|
+
consume(token.value);
|
|
332
|
+
};
|
|
333
|
+
const negate = ()=>{
|
|
334
|
+
let count = 1;
|
|
335
|
+
while('!' === peek() && ('(' !== peek(2) || '?' === peek(3))){
|
|
336
|
+
advance();
|
|
337
|
+
state.start++;
|
|
338
|
+
count++;
|
|
339
|
+
}
|
|
340
|
+
if (count % 2 === 0) return false;
|
|
341
|
+
state.negated = true;
|
|
342
|
+
state.start++;
|
|
343
|
+
return true;
|
|
344
|
+
};
|
|
345
|
+
const increment = (type)=>{
|
|
346
|
+
state[type]++;
|
|
347
|
+
stack.push(type);
|
|
348
|
+
};
|
|
349
|
+
const decrement = (type)=>{
|
|
350
|
+
state[type]--;
|
|
351
|
+
stack.pop();
|
|
352
|
+
};
|
|
353
|
+
const push = (tok)=>{
|
|
354
|
+
if ('globstar' === prev.type) {
|
|
355
|
+
const isBrace = state.braces > 0 && ('comma' === tok.type || 'brace' === tok.type);
|
|
356
|
+
const isExtglob = true === tok.extglob || extglobs.length && ('pipe' === tok.type || 'paren' === tok.type);
|
|
357
|
+
if ('slash' !== tok.type && 'paren' !== tok.type && !isBrace && !isExtglob) {
|
|
358
|
+
state.output = state.output.slice(0, -prev.output.length);
|
|
359
|
+
prev.type = 'star';
|
|
360
|
+
prev.value = '*';
|
|
361
|
+
prev.output = star;
|
|
362
|
+
state.output += prev.output;
|
|
363
|
+
}
|
|
364
|
+
}
|
|
365
|
+
if (extglobs.length && 'paren' !== tok.type) extglobs[extglobs.length - 1].inner += tok.value;
|
|
366
|
+
if (tok.value || tok.output) append(tok);
|
|
367
|
+
if (prev && 'text' === prev.type && 'text' === tok.type) {
|
|
368
|
+
prev.output = (prev.output || prev.value) + tok.value;
|
|
369
|
+
prev.value += tok.value;
|
|
370
|
+
return;
|
|
371
|
+
}
|
|
372
|
+
tok.prev = prev;
|
|
373
|
+
tokens.push(tok);
|
|
374
|
+
prev = tok;
|
|
375
|
+
};
|
|
376
|
+
const extglobOpen = (type, value)=>{
|
|
377
|
+
const token = {
|
|
378
|
+
...EXTGLOB_CHARS[value],
|
|
379
|
+
conditions: 1,
|
|
380
|
+
inner: ''
|
|
381
|
+
};
|
|
382
|
+
token.prev = prev;
|
|
383
|
+
token.parens = state.parens;
|
|
384
|
+
token.output = state.output;
|
|
385
|
+
const output = (opts.capture ? '(' : '') + token.open;
|
|
386
|
+
increment('parens');
|
|
387
|
+
push({
|
|
388
|
+
type,
|
|
389
|
+
value,
|
|
390
|
+
output: state.output ? '' : ONE_CHAR
|
|
391
|
+
});
|
|
392
|
+
push({
|
|
393
|
+
type: 'paren',
|
|
394
|
+
extglob: true,
|
|
395
|
+
value: advance(),
|
|
396
|
+
output
|
|
397
|
+
});
|
|
398
|
+
extglobs.push(token);
|
|
399
|
+
};
|
|
400
|
+
const extglobClose = (token)=>{
|
|
401
|
+
let output = token.close + (opts.capture ? ')' : '');
|
|
402
|
+
let rest;
|
|
403
|
+
if ('negate' === token.type) {
|
|
404
|
+
let extglobStar = star;
|
|
405
|
+
if (token.inner && token.inner.length > 1 && token.inner.includes('/')) extglobStar = globstar(opts);
|
|
406
|
+
if (extglobStar !== star || eos() || /^\)+$/.test(remaining())) output = token.close = `)$))${extglobStar}`;
|
|
407
|
+
if (token.inner.includes('*') && (rest = remaining()) && /^\.[^\\/.]+$/.test(rest)) {
|
|
408
|
+
const expression = parse(rest, {
|
|
409
|
+
...options,
|
|
410
|
+
fastpaths: false
|
|
411
|
+
}).output;
|
|
412
|
+
output = token.close = `)${expression})${extglobStar})`;
|
|
413
|
+
}
|
|
414
|
+
if ('bos' === token.prev.type) state.negatedExtglob = true;
|
|
415
|
+
}
|
|
416
|
+
push({
|
|
417
|
+
type: 'paren',
|
|
418
|
+
extglob: true,
|
|
419
|
+
value,
|
|
420
|
+
output
|
|
421
|
+
});
|
|
422
|
+
decrement('parens');
|
|
423
|
+
};
|
|
424
|
+
if (false !== opts.fastpaths && !/(^[*!]|[/()[\]{}"])/.test(input)) {
|
|
425
|
+
let backslashes = false;
|
|
426
|
+
let output = input.replace(REGEX_SPECIAL_CHARS_BACKREF, (m, esc, chars, first, rest, index)=>{
|
|
427
|
+
if ('\\' === first) {
|
|
428
|
+
backslashes = true;
|
|
429
|
+
return m;
|
|
430
|
+
}
|
|
431
|
+
if ('?' === first) {
|
|
432
|
+
if (esc) return esc + first + (rest ? QMARK.repeat(rest.length) : '');
|
|
433
|
+
if (0 === index) return qmarkNoDot + (rest ? QMARK.repeat(rest.length) : '');
|
|
434
|
+
return QMARK.repeat(chars.length);
|
|
435
|
+
}
|
|
436
|
+
if ('.' === first) return DOT_LITERAL.repeat(chars.length);
|
|
437
|
+
if ('*' === first) {
|
|
438
|
+
if (esc) return esc + first + (rest ? star : '');
|
|
439
|
+
return star;
|
|
440
|
+
}
|
|
441
|
+
return esc ? m : `\\${m}`;
|
|
442
|
+
});
|
|
443
|
+
if (true === backslashes) output = true === opts.unescape ? output.replace(/\\/g, '') : output.replace(/\\+/g, (m)=>m.length % 2 === 0 ? '\\\\' : m ? '\\' : '');
|
|
444
|
+
if (output === input && true === opts.contains) {
|
|
445
|
+
state.output = input;
|
|
446
|
+
return state;
|
|
447
|
+
}
|
|
448
|
+
state.output = utils.wrapOutput(output, state, options);
|
|
449
|
+
return state;
|
|
450
|
+
}
|
|
451
|
+
while(!eos()){
|
|
452
|
+
value = advance();
|
|
453
|
+
if ('\u0000' === value) continue;
|
|
454
|
+
if ('\\' === value) {
|
|
455
|
+
const next = peek();
|
|
456
|
+
if ('/' === next && true !== opts.bash) continue;
|
|
457
|
+
if ('.' === next || ';' === next) continue;
|
|
458
|
+
if (!next) {
|
|
459
|
+
value += '\\';
|
|
460
|
+
push({
|
|
461
|
+
type: 'text',
|
|
462
|
+
value
|
|
463
|
+
});
|
|
464
|
+
continue;
|
|
465
|
+
}
|
|
466
|
+
const match = /^\\+/.exec(remaining());
|
|
467
|
+
let slashes = 0;
|
|
468
|
+
if (match && match[0].length > 2) {
|
|
469
|
+
slashes = match[0].length;
|
|
470
|
+
state.index += slashes;
|
|
471
|
+
if (slashes % 2 !== 0) value += '\\';
|
|
472
|
+
}
|
|
473
|
+
if (true === opts.unescape) value = advance();
|
|
474
|
+
else value += advance();
|
|
475
|
+
if (0 === state.brackets) {
|
|
476
|
+
push({
|
|
477
|
+
type: 'text',
|
|
478
|
+
value
|
|
479
|
+
});
|
|
480
|
+
continue;
|
|
481
|
+
}
|
|
482
|
+
}
|
|
483
|
+
if (state.brackets > 0 && (']' !== value || '[' === prev.value || '[^' === prev.value)) {
|
|
484
|
+
if (false !== opts.posix && ':' === value) {
|
|
485
|
+
const inner = prev.value.slice(1);
|
|
486
|
+
if (inner.includes('[')) {
|
|
487
|
+
prev.posix = true;
|
|
488
|
+
if (inner.includes(':')) {
|
|
489
|
+
const idx = prev.value.lastIndexOf('[');
|
|
490
|
+
const pre = prev.value.slice(0, idx);
|
|
491
|
+
const rest = prev.value.slice(idx + 2);
|
|
492
|
+
const posix = POSIX_REGEX_SOURCE[rest];
|
|
493
|
+
if (posix) {
|
|
494
|
+
prev.value = pre + posix;
|
|
495
|
+
state.backtrack = true;
|
|
496
|
+
advance();
|
|
497
|
+
if (!bos.output && 1 === tokens.indexOf(prev)) bos.output = ONE_CHAR;
|
|
498
|
+
continue;
|
|
499
|
+
}
|
|
500
|
+
}
|
|
501
|
+
}
|
|
502
|
+
}
|
|
503
|
+
if ('[' === value && ':' !== peek() || '-' === value && ']' === peek()) value = `\\${value}`;
|
|
504
|
+
if (']' === value && ('[' === prev.value || '[^' === prev.value)) value = `\\${value}`;
|
|
505
|
+
if (true === opts.posix && '!' === value && '[' === prev.value) value = '^';
|
|
506
|
+
prev.value += value;
|
|
507
|
+
append({
|
|
508
|
+
value
|
|
509
|
+
});
|
|
510
|
+
continue;
|
|
511
|
+
}
|
|
512
|
+
if (1 === state.quotes && '"' !== value) {
|
|
513
|
+
value = utils.escapeRegex(value);
|
|
514
|
+
prev.value += value;
|
|
515
|
+
append({
|
|
516
|
+
value
|
|
517
|
+
});
|
|
518
|
+
continue;
|
|
519
|
+
}
|
|
520
|
+
if ('"' === value) {
|
|
521
|
+
state.quotes = 1 === state.quotes ? 0 : 1;
|
|
522
|
+
if (true === opts.keepQuotes) push({
|
|
523
|
+
type: 'text',
|
|
524
|
+
value
|
|
525
|
+
});
|
|
526
|
+
continue;
|
|
527
|
+
}
|
|
528
|
+
if ('(' === value) {
|
|
529
|
+
increment('parens');
|
|
530
|
+
push({
|
|
531
|
+
type: 'paren',
|
|
532
|
+
value
|
|
533
|
+
});
|
|
534
|
+
continue;
|
|
535
|
+
}
|
|
536
|
+
if (')' === value) {
|
|
537
|
+
if (0 === state.parens && true === opts.strictBrackets) throw new SyntaxError(syntaxError('opening', '('));
|
|
538
|
+
const extglob = extglobs[extglobs.length - 1];
|
|
539
|
+
if (extglob && state.parens === extglob.parens + 1) {
|
|
540
|
+
extglobClose(extglobs.pop());
|
|
541
|
+
continue;
|
|
542
|
+
}
|
|
543
|
+
push({
|
|
544
|
+
type: 'paren',
|
|
545
|
+
value,
|
|
546
|
+
output: state.parens ? ')' : '\\)'
|
|
547
|
+
});
|
|
548
|
+
decrement('parens');
|
|
549
|
+
continue;
|
|
550
|
+
}
|
|
551
|
+
if ('[' === value) {
|
|
552
|
+
if (true !== opts.nobracket && remaining().includes(']')) increment('brackets');
|
|
553
|
+
else {
|
|
554
|
+
if (true !== opts.nobracket && true === opts.strictBrackets) throw new SyntaxError(syntaxError('closing', ']'));
|
|
555
|
+
value = `\\${value}`;
|
|
556
|
+
}
|
|
557
|
+
push({
|
|
558
|
+
type: 'bracket',
|
|
559
|
+
value
|
|
560
|
+
});
|
|
561
|
+
continue;
|
|
562
|
+
}
|
|
563
|
+
if (']' === value) {
|
|
564
|
+
if (true === opts.nobracket || prev && 'bracket' === prev.type && 1 === prev.value.length) {
|
|
565
|
+
push({
|
|
566
|
+
type: 'text',
|
|
567
|
+
value,
|
|
568
|
+
output: `\\${value}`
|
|
569
|
+
});
|
|
570
|
+
continue;
|
|
571
|
+
}
|
|
572
|
+
if (0 === state.brackets) {
|
|
573
|
+
if (true === opts.strictBrackets) throw new SyntaxError(syntaxError('opening', '['));
|
|
574
|
+
push({
|
|
575
|
+
type: 'text',
|
|
576
|
+
value,
|
|
577
|
+
output: `\\${value}`
|
|
578
|
+
});
|
|
579
|
+
continue;
|
|
580
|
+
}
|
|
581
|
+
decrement('brackets');
|
|
582
|
+
const prevValue = prev.value.slice(1);
|
|
583
|
+
if (true !== prev.posix && '^' === prevValue[0] && !prevValue.includes('/')) value = `/${value}`;
|
|
584
|
+
prev.value += value;
|
|
585
|
+
append({
|
|
586
|
+
value
|
|
587
|
+
});
|
|
588
|
+
if (false === opts.literalBrackets || utils.hasRegexChars(prevValue)) continue;
|
|
589
|
+
const escaped = utils.escapeRegex(prev.value);
|
|
590
|
+
state.output = state.output.slice(0, -prev.value.length);
|
|
591
|
+
if (true === opts.literalBrackets) {
|
|
592
|
+
state.output += escaped;
|
|
593
|
+
prev.value = escaped;
|
|
594
|
+
continue;
|
|
595
|
+
}
|
|
596
|
+
prev.value = `(${capture}${escaped}|${prev.value})`;
|
|
597
|
+
state.output += prev.value;
|
|
598
|
+
continue;
|
|
599
|
+
}
|
|
600
|
+
if ('{' === value && true !== opts.nobrace) {
|
|
601
|
+
increment('braces');
|
|
602
|
+
const open = {
|
|
603
|
+
type: 'brace',
|
|
604
|
+
value,
|
|
605
|
+
output: '(',
|
|
606
|
+
outputIndex: state.output.length,
|
|
607
|
+
tokensIndex: state.tokens.length
|
|
608
|
+
};
|
|
609
|
+
braces.push(open);
|
|
610
|
+
push(open);
|
|
611
|
+
continue;
|
|
612
|
+
}
|
|
613
|
+
if ('}' === value) {
|
|
614
|
+
const brace = braces[braces.length - 1];
|
|
615
|
+
if (true === opts.nobrace || !brace) {
|
|
616
|
+
push({
|
|
617
|
+
type: 'text',
|
|
618
|
+
value,
|
|
619
|
+
output: value
|
|
620
|
+
});
|
|
621
|
+
continue;
|
|
622
|
+
}
|
|
623
|
+
let output = ')';
|
|
624
|
+
if (true === brace.dots) {
|
|
625
|
+
const arr = tokens.slice();
|
|
626
|
+
const range = [];
|
|
627
|
+
for(let i = arr.length - 1; i >= 0; i--){
|
|
628
|
+
tokens.pop();
|
|
629
|
+
if ('brace' === arr[i].type) break;
|
|
630
|
+
if ('dots' !== arr[i].type) range.unshift(arr[i].value);
|
|
631
|
+
}
|
|
632
|
+
output = expandRange(range, opts);
|
|
633
|
+
state.backtrack = true;
|
|
634
|
+
}
|
|
635
|
+
if (true !== brace.comma && true !== brace.dots) {
|
|
636
|
+
const out = state.output.slice(0, brace.outputIndex);
|
|
637
|
+
const toks = state.tokens.slice(brace.tokensIndex);
|
|
638
|
+
brace.value = brace.output = '\\{';
|
|
639
|
+
value = output = '\\}';
|
|
640
|
+
state.output = out;
|
|
641
|
+
for (const t of toks)state.output += t.output || t.value;
|
|
642
|
+
}
|
|
643
|
+
push({
|
|
644
|
+
type: 'brace',
|
|
645
|
+
value,
|
|
646
|
+
output
|
|
647
|
+
});
|
|
648
|
+
decrement('braces');
|
|
649
|
+
braces.pop();
|
|
650
|
+
continue;
|
|
651
|
+
}
|
|
652
|
+
if ('|' === value) {
|
|
653
|
+
if (extglobs.length > 0) extglobs[extglobs.length - 1].conditions++;
|
|
654
|
+
push({
|
|
655
|
+
type: 'text',
|
|
656
|
+
value
|
|
657
|
+
});
|
|
658
|
+
continue;
|
|
659
|
+
}
|
|
660
|
+
if (',' === value) {
|
|
661
|
+
let output = value;
|
|
662
|
+
const brace = braces[braces.length - 1];
|
|
663
|
+
if (brace && 'braces' === stack[stack.length - 1]) {
|
|
664
|
+
brace.comma = true;
|
|
665
|
+
output = '|';
|
|
666
|
+
}
|
|
667
|
+
push({
|
|
668
|
+
type: 'comma',
|
|
669
|
+
value,
|
|
670
|
+
output
|
|
671
|
+
});
|
|
672
|
+
continue;
|
|
673
|
+
}
|
|
674
|
+
if ('/' === value) {
|
|
675
|
+
if ('dot' === prev.type && state.index === state.start + 1) {
|
|
676
|
+
state.start = state.index + 1;
|
|
677
|
+
state.consumed = '';
|
|
678
|
+
state.output = '';
|
|
679
|
+
tokens.pop();
|
|
680
|
+
prev = bos;
|
|
681
|
+
continue;
|
|
682
|
+
}
|
|
683
|
+
push({
|
|
684
|
+
type: 'slash',
|
|
685
|
+
value,
|
|
686
|
+
output: SLASH_LITERAL
|
|
687
|
+
});
|
|
688
|
+
continue;
|
|
689
|
+
}
|
|
690
|
+
if ('.' === value) {
|
|
691
|
+
if (state.braces > 0 && 'dot' === prev.type) {
|
|
692
|
+
if ('.' === prev.value) prev.output = DOT_LITERAL;
|
|
693
|
+
const brace = braces[braces.length - 1];
|
|
694
|
+
prev.type = 'dots';
|
|
695
|
+
prev.output += value;
|
|
696
|
+
prev.value += value;
|
|
697
|
+
brace.dots = true;
|
|
698
|
+
continue;
|
|
699
|
+
}
|
|
700
|
+
if (state.braces + state.parens === 0 && 'bos' !== prev.type && 'slash' !== prev.type) {
|
|
701
|
+
push({
|
|
702
|
+
type: 'text',
|
|
703
|
+
value,
|
|
704
|
+
output: DOT_LITERAL
|
|
705
|
+
});
|
|
706
|
+
continue;
|
|
707
|
+
}
|
|
708
|
+
push({
|
|
709
|
+
type: 'dot',
|
|
710
|
+
value,
|
|
711
|
+
output: DOT_LITERAL
|
|
712
|
+
});
|
|
713
|
+
continue;
|
|
714
|
+
}
|
|
715
|
+
if ('?' === value) {
|
|
716
|
+
const isGroup = prev && '(' === prev.value;
|
|
717
|
+
if (!isGroup && true !== opts.noextglob && '(' === peek() && '?' !== peek(2)) {
|
|
718
|
+
extglobOpen('qmark', value);
|
|
719
|
+
continue;
|
|
720
|
+
}
|
|
721
|
+
if (prev && 'paren' === prev.type) {
|
|
722
|
+
const next = peek();
|
|
723
|
+
let output = value;
|
|
724
|
+
if ('(' === prev.value && !/[!=<:]/.test(next) || '<' === next && !/<([!=]|\w+>)/.test(remaining())) output = `\\${value}`;
|
|
725
|
+
push({
|
|
726
|
+
type: 'text',
|
|
727
|
+
value,
|
|
728
|
+
output
|
|
729
|
+
});
|
|
730
|
+
continue;
|
|
731
|
+
}
|
|
732
|
+
if (true !== opts.dot && ('slash' === prev.type || 'bos' === prev.type)) {
|
|
733
|
+
push({
|
|
734
|
+
type: 'qmark',
|
|
735
|
+
value,
|
|
736
|
+
output: QMARK_NO_DOT
|
|
737
|
+
});
|
|
738
|
+
continue;
|
|
739
|
+
}
|
|
740
|
+
push({
|
|
741
|
+
type: 'qmark',
|
|
742
|
+
value,
|
|
743
|
+
output: QMARK
|
|
744
|
+
});
|
|
745
|
+
continue;
|
|
746
|
+
}
|
|
747
|
+
if ('!' === value) {
|
|
748
|
+
if (true !== opts.noextglob && '(' === peek()) {
|
|
749
|
+
if ('?' !== peek(2) || !/[!=<:]/.test(peek(3))) {
|
|
750
|
+
extglobOpen('negate', value);
|
|
751
|
+
continue;
|
|
752
|
+
}
|
|
753
|
+
}
|
|
754
|
+
if (true !== opts.nonegate && 0 === state.index) {
|
|
755
|
+
negate();
|
|
756
|
+
continue;
|
|
757
|
+
}
|
|
758
|
+
}
|
|
759
|
+
if ('+' === value) {
|
|
760
|
+
if (true !== opts.noextglob && '(' === peek() && '?' !== peek(2)) {
|
|
761
|
+
extglobOpen('plus', value);
|
|
762
|
+
continue;
|
|
763
|
+
}
|
|
764
|
+
if (prev && '(' === prev.value || false === opts.regex) {
|
|
765
|
+
push({
|
|
766
|
+
type: 'plus',
|
|
767
|
+
value,
|
|
768
|
+
output: PLUS_LITERAL
|
|
769
|
+
});
|
|
770
|
+
continue;
|
|
771
|
+
}
|
|
772
|
+
if (prev && ('bracket' === prev.type || 'paren' === prev.type || 'brace' === prev.type) || state.parens > 0) {
|
|
773
|
+
push({
|
|
774
|
+
type: 'plus',
|
|
775
|
+
value
|
|
776
|
+
});
|
|
777
|
+
continue;
|
|
778
|
+
}
|
|
779
|
+
push({
|
|
780
|
+
type: 'plus',
|
|
781
|
+
value: PLUS_LITERAL
|
|
782
|
+
});
|
|
783
|
+
continue;
|
|
784
|
+
}
|
|
785
|
+
if ('@' === value) {
|
|
786
|
+
if (true !== opts.noextglob && '(' === peek() && '?' !== peek(2)) {
|
|
787
|
+
push({
|
|
788
|
+
type: 'at',
|
|
789
|
+
extglob: true,
|
|
790
|
+
value,
|
|
791
|
+
output: ''
|
|
792
|
+
});
|
|
793
|
+
continue;
|
|
794
|
+
}
|
|
795
|
+
push({
|
|
796
|
+
type: 'text',
|
|
797
|
+
value
|
|
798
|
+
});
|
|
799
|
+
continue;
|
|
800
|
+
}
|
|
801
|
+
if ('*' !== value) {
|
|
802
|
+
if ('$' === value || '^' === value) value = `\\${value}`;
|
|
803
|
+
const match = REGEX_NON_SPECIAL_CHARS.exec(remaining());
|
|
804
|
+
if (match) {
|
|
805
|
+
value += match[0];
|
|
806
|
+
state.index += match[0].length;
|
|
807
|
+
}
|
|
808
|
+
push({
|
|
809
|
+
type: 'text',
|
|
810
|
+
value
|
|
811
|
+
});
|
|
812
|
+
continue;
|
|
813
|
+
}
|
|
814
|
+
if (prev && ('globstar' === prev.type || true === prev.star)) {
|
|
815
|
+
prev.type = 'star';
|
|
816
|
+
prev.star = true;
|
|
817
|
+
prev.value += value;
|
|
818
|
+
prev.output = star;
|
|
819
|
+
state.backtrack = true;
|
|
820
|
+
state.globstar = true;
|
|
821
|
+
consume(value);
|
|
822
|
+
continue;
|
|
823
|
+
}
|
|
824
|
+
let rest = remaining();
|
|
825
|
+
if (true !== opts.noextglob && /^\([^?]/.test(rest)) {
|
|
826
|
+
extglobOpen('star', value);
|
|
827
|
+
continue;
|
|
828
|
+
}
|
|
829
|
+
if ('star' === prev.type) {
|
|
830
|
+
if (true === opts.noglobstar) {
|
|
831
|
+
consume(value);
|
|
832
|
+
continue;
|
|
833
|
+
}
|
|
834
|
+
const prior = prev.prev;
|
|
835
|
+
const before = prior.prev;
|
|
836
|
+
const isStart = 'slash' === prior.type || 'bos' === prior.type;
|
|
837
|
+
const afterStar = before && ('star' === before.type || 'globstar' === before.type);
|
|
838
|
+
if (true === opts.bash && (!isStart || rest[0] && '/' !== rest[0])) {
|
|
839
|
+
push({
|
|
840
|
+
type: 'star',
|
|
841
|
+
value,
|
|
842
|
+
output: ''
|
|
843
|
+
});
|
|
844
|
+
continue;
|
|
845
|
+
}
|
|
846
|
+
const isBrace = state.braces > 0 && ('comma' === prior.type || 'brace' === prior.type);
|
|
847
|
+
const isExtglob = extglobs.length && ('pipe' === prior.type || 'paren' === prior.type);
|
|
848
|
+
if (!isStart && 'paren' !== prior.type && !isBrace && !isExtglob) {
|
|
849
|
+
push({
|
|
850
|
+
type: 'star',
|
|
851
|
+
value,
|
|
852
|
+
output: ''
|
|
853
|
+
});
|
|
854
|
+
continue;
|
|
855
|
+
}
|
|
856
|
+
while('/**' === rest.slice(0, 3)){
|
|
857
|
+
const after = input[state.index + 4];
|
|
858
|
+
if (after && '/' !== after) break;
|
|
859
|
+
rest = rest.slice(3);
|
|
860
|
+
consume('/**', 3);
|
|
861
|
+
}
|
|
862
|
+
if ('bos' === prior.type && eos()) {
|
|
863
|
+
prev.type = 'globstar';
|
|
864
|
+
prev.value += value;
|
|
865
|
+
prev.output = globstar(opts);
|
|
866
|
+
state.output = prev.output;
|
|
867
|
+
state.globstar = true;
|
|
868
|
+
consume(value);
|
|
869
|
+
continue;
|
|
870
|
+
}
|
|
871
|
+
if ('slash' === prior.type && 'bos' !== prior.prev.type && !afterStar && eos()) {
|
|
872
|
+
state.output = state.output.slice(0, -(prior.output + prev.output).length);
|
|
873
|
+
prior.output = `(?:${prior.output}`;
|
|
874
|
+
prev.type = 'globstar';
|
|
875
|
+
prev.output = globstar(opts) + (opts.strictSlashes ? ')' : '|$)');
|
|
876
|
+
prev.value += value;
|
|
877
|
+
state.globstar = true;
|
|
878
|
+
state.output += prior.output + prev.output;
|
|
879
|
+
consume(value);
|
|
880
|
+
continue;
|
|
881
|
+
}
|
|
882
|
+
if ('slash' === prior.type && 'bos' !== prior.prev.type && '/' === rest[0]) {
|
|
883
|
+
const end = void 0 !== rest[1] ? '|$' : '';
|
|
884
|
+
state.output = state.output.slice(0, -(prior.output + prev.output).length);
|
|
885
|
+
prior.output = `(?:${prior.output}`;
|
|
886
|
+
prev.type = 'globstar';
|
|
887
|
+
prev.output = `${globstar(opts)}${SLASH_LITERAL}|${SLASH_LITERAL}${end})`;
|
|
888
|
+
prev.value += value;
|
|
889
|
+
state.output += prior.output + prev.output;
|
|
890
|
+
state.globstar = true;
|
|
891
|
+
consume(value + advance());
|
|
892
|
+
push({
|
|
893
|
+
type: 'slash',
|
|
894
|
+
value: '/',
|
|
895
|
+
output: ''
|
|
896
|
+
});
|
|
897
|
+
continue;
|
|
898
|
+
}
|
|
899
|
+
if ('bos' === prior.type && '/' === rest[0]) {
|
|
900
|
+
prev.type = 'globstar';
|
|
901
|
+
prev.value += value;
|
|
902
|
+
prev.output = `(?:^|${SLASH_LITERAL}|${globstar(opts)}${SLASH_LITERAL})`;
|
|
903
|
+
state.output = prev.output;
|
|
904
|
+
state.globstar = true;
|
|
905
|
+
consume(value + advance());
|
|
906
|
+
push({
|
|
907
|
+
type: 'slash',
|
|
908
|
+
value: '/',
|
|
909
|
+
output: ''
|
|
910
|
+
});
|
|
911
|
+
continue;
|
|
912
|
+
}
|
|
913
|
+
state.output = state.output.slice(0, -prev.output.length);
|
|
914
|
+
prev.type = 'globstar';
|
|
915
|
+
prev.output = globstar(opts);
|
|
916
|
+
prev.value += value;
|
|
917
|
+
state.output += prev.output;
|
|
918
|
+
state.globstar = true;
|
|
919
|
+
consume(value);
|
|
920
|
+
continue;
|
|
921
|
+
}
|
|
922
|
+
const token = {
|
|
923
|
+
type: 'star',
|
|
924
|
+
value,
|
|
925
|
+
output: star
|
|
926
|
+
};
|
|
927
|
+
if (true === opts.bash) {
|
|
928
|
+
token.output = '.*?';
|
|
929
|
+
if ('bos' === prev.type || 'slash' === prev.type) token.output = nodot + token.output;
|
|
930
|
+
push(token);
|
|
931
|
+
continue;
|
|
932
|
+
}
|
|
933
|
+
if (prev && ('bracket' === prev.type || 'paren' === prev.type) && true === opts.regex) {
|
|
934
|
+
token.output = value;
|
|
935
|
+
push(token);
|
|
936
|
+
continue;
|
|
937
|
+
}
|
|
938
|
+
if (state.index === state.start || 'slash' === prev.type || 'dot' === prev.type) {
|
|
939
|
+
if ('dot' === prev.type) {
|
|
940
|
+
state.output += NO_DOT_SLASH;
|
|
941
|
+
prev.output += NO_DOT_SLASH;
|
|
942
|
+
} else if (true === opts.dot) {
|
|
943
|
+
state.output += NO_DOTS_SLASH;
|
|
944
|
+
prev.output += NO_DOTS_SLASH;
|
|
945
|
+
} else {
|
|
946
|
+
state.output += nodot;
|
|
947
|
+
prev.output += nodot;
|
|
948
|
+
}
|
|
949
|
+
if ('*' !== peek()) {
|
|
950
|
+
state.output += ONE_CHAR;
|
|
951
|
+
prev.output += ONE_CHAR;
|
|
952
|
+
}
|
|
953
|
+
}
|
|
954
|
+
push(token);
|
|
955
|
+
}
|
|
956
|
+
while(state.brackets > 0){
|
|
957
|
+
if (true === opts.strictBrackets) throw new SyntaxError(syntaxError('closing', ']'));
|
|
958
|
+
state.output = utils.escapeLast(state.output, '[');
|
|
959
|
+
decrement('brackets');
|
|
960
|
+
}
|
|
961
|
+
while(state.parens > 0){
|
|
962
|
+
if (true === opts.strictBrackets) throw new SyntaxError(syntaxError('closing', ')'));
|
|
963
|
+
state.output = utils.escapeLast(state.output, '(');
|
|
964
|
+
decrement('parens');
|
|
965
|
+
}
|
|
966
|
+
while(state.braces > 0){
|
|
967
|
+
if (true === opts.strictBrackets) throw new SyntaxError(syntaxError('closing', '}'));
|
|
968
|
+
state.output = utils.escapeLast(state.output, '{');
|
|
969
|
+
decrement('braces');
|
|
970
|
+
}
|
|
971
|
+
if (true !== opts.strictSlashes && ('star' === prev.type || 'bracket' === prev.type)) push({
|
|
972
|
+
type: 'maybe_slash',
|
|
973
|
+
value: '',
|
|
974
|
+
output: `${SLASH_LITERAL}?`
|
|
975
|
+
});
|
|
976
|
+
if (true === state.backtrack) {
|
|
977
|
+
state.output = '';
|
|
978
|
+
for (const token of state.tokens){
|
|
979
|
+
state.output += null != token.output ? token.output : token.value;
|
|
980
|
+
if (token.suffix) state.output += token.suffix;
|
|
981
|
+
}
|
|
982
|
+
}
|
|
983
|
+
return state;
|
|
984
|
+
};
|
|
985
|
+
parse.fastpaths = (input, options)=>{
|
|
986
|
+
const opts = {
|
|
987
|
+
...options
|
|
988
|
+
};
|
|
989
|
+
const max = 'number' == typeof opts.maxLength ? Math.min(MAX_LENGTH, opts.maxLength) : MAX_LENGTH;
|
|
990
|
+
const len = input.length;
|
|
991
|
+
if (len > max) throw new SyntaxError(`Input length: ${len}, exceeds maximum allowed length: ${max}`);
|
|
992
|
+
input = REPLACEMENTS[input] || input;
|
|
993
|
+
const { DOT_LITERAL, SLASH_LITERAL, ONE_CHAR, DOTS_SLASH, NO_DOT, NO_DOTS, NO_DOTS_SLASH, STAR, START_ANCHOR } = constants.globChars(opts.windows);
|
|
994
|
+
const nodot = opts.dot ? NO_DOTS : NO_DOT;
|
|
995
|
+
const slashDot = opts.dot ? NO_DOTS_SLASH : NO_DOT;
|
|
996
|
+
const capture = opts.capture ? '' : '?:';
|
|
997
|
+
const state = {
|
|
998
|
+
negated: false,
|
|
999
|
+
prefix: ''
|
|
1000
|
+
};
|
|
1001
|
+
let star = true === opts.bash ? '.*?' : STAR;
|
|
1002
|
+
if (opts.capture) star = `(${star})`;
|
|
1003
|
+
const globstar = (opts)=>{
|
|
1004
|
+
if (true === opts.noglobstar) return star;
|
|
1005
|
+
return `(${capture}(?:(?!${START_ANCHOR}${opts.dot ? DOTS_SLASH : DOT_LITERAL}).)*?)`;
|
|
1006
|
+
};
|
|
1007
|
+
const create = (str)=>{
|
|
1008
|
+
switch(str){
|
|
1009
|
+
case '*':
|
|
1010
|
+
return `${nodot}${ONE_CHAR}${star}`;
|
|
1011
|
+
case '.*':
|
|
1012
|
+
return `${DOT_LITERAL}${ONE_CHAR}${star}`;
|
|
1013
|
+
case '*.*':
|
|
1014
|
+
return `${nodot}${star}${DOT_LITERAL}${ONE_CHAR}${star}`;
|
|
1015
|
+
case '*/*':
|
|
1016
|
+
return `${nodot}${star}${SLASH_LITERAL}${ONE_CHAR}${slashDot}${star}`;
|
|
1017
|
+
case '**':
|
|
1018
|
+
return nodot + globstar(opts);
|
|
1019
|
+
case '**/*':
|
|
1020
|
+
return `(?:${nodot}${globstar(opts)}${SLASH_LITERAL})?${slashDot}${ONE_CHAR}${star}`;
|
|
1021
|
+
case '**/*.*':
|
|
1022
|
+
return `(?:${nodot}${globstar(opts)}${SLASH_LITERAL})?${slashDot}${star}${DOT_LITERAL}${ONE_CHAR}${star}`;
|
|
1023
|
+
case '**/.*':
|
|
1024
|
+
return `(?:${nodot}${globstar(opts)}${SLASH_LITERAL})?${DOT_LITERAL}${ONE_CHAR}${star}`;
|
|
1025
|
+
default:
|
|
1026
|
+
{
|
|
1027
|
+
const match = /^(.*?)\.(\w+)$/.exec(str);
|
|
1028
|
+
if (!match) return;
|
|
1029
|
+
const source = create(match[1]);
|
|
1030
|
+
if (!source) return;
|
|
1031
|
+
return source + DOT_LITERAL + match[2];
|
|
1032
|
+
}
|
|
1033
|
+
}
|
|
1034
|
+
};
|
|
1035
|
+
const output = utils.removePrefix(input, state);
|
|
1036
|
+
let source = create(output);
|
|
1037
|
+
if (source && true !== opts.strictSlashes) source += `${SLASH_LITERAL}?`;
|
|
1038
|
+
return source;
|
|
1039
|
+
};
|
|
1040
|
+
module.exports = parse;
|
|
1041
|
+
},
|
|
1042
|
+
"../../node_modules/.pnpm/picomatch@4.0.3/node_modules/picomatch/lib/picomatch.js": function(module, __unused_webpack_exports, __webpack_require__) {
|
|
1043
|
+
const scan = __webpack_require__("../../node_modules/.pnpm/picomatch@4.0.3/node_modules/picomatch/lib/scan.js");
|
|
1044
|
+
const parse = __webpack_require__("../../node_modules/.pnpm/picomatch@4.0.3/node_modules/picomatch/lib/parse.js");
|
|
1045
|
+
const utils = __webpack_require__("../../node_modules/.pnpm/picomatch@4.0.3/node_modules/picomatch/lib/utils.js");
|
|
1046
|
+
const constants = __webpack_require__("../../node_modules/.pnpm/picomatch@4.0.3/node_modules/picomatch/lib/constants.js");
|
|
1047
|
+
const isObject = (val)=>val && 'object' == typeof val && !Array.isArray(val);
|
|
1048
|
+
const picomatch = (glob, options, returnState = false)=>{
|
|
1049
|
+
if (Array.isArray(glob)) {
|
|
1050
|
+
const fns = glob.map((input)=>picomatch(input, options, returnState));
|
|
1051
|
+
const arrayMatcher = (str)=>{
|
|
1052
|
+
for (const isMatch of fns){
|
|
1053
|
+
const state = isMatch(str);
|
|
1054
|
+
if (state) return state;
|
|
1055
|
+
}
|
|
1056
|
+
return false;
|
|
1057
|
+
};
|
|
1058
|
+
return arrayMatcher;
|
|
1059
|
+
}
|
|
1060
|
+
const isState = isObject(glob) && glob.tokens && glob.input;
|
|
1061
|
+
if ('' === glob || 'string' != typeof glob && !isState) throw new TypeError('Expected pattern to be a non-empty string');
|
|
1062
|
+
const opts = options || {};
|
|
1063
|
+
const posix = opts.windows;
|
|
1064
|
+
const regex = isState ? picomatch.compileRe(glob, options) : picomatch.makeRe(glob, options, false, true);
|
|
1065
|
+
const state = regex.state;
|
|
1066
|
+
delete regex.state;
|
|
1067
|
+
let isIgnored = ()=>false;
|
|
1068
|
+
if (opts.ignore) {
|
|
1069
|
+
const ignoreOpts = {
|
|
1070
|
+
...options,
|
|
1071
|
+
ignore: null,
|
|
1072
|
+
onMatch: null,
|
|
1073
|
+
onResult: null
|
|
1074
|
+
};
|
|
1075
|
+
isIgnored = picomatch(opts.ignore, ignoreOpts, returnState);
|
|
1076
|
+
}
|
|
1077
|
+
const matcher = (input, returnObject = false)=>{
|
|
1078
|
+
const { isMatch, match, output } = picomatch.test(input, regex, options, {
|
|
1079
|
+
glob,
|
|
1080
|
+
posix
|
|
1081
|
+
});
|
|
1082
|
+
const result = {
|
|
1083
|
+
glob,
|
|
1084
|
+
state,
|
|
1085
|
+
regex,
|
|
1086
|
+
posix,
|
|
1087
|
+
input,
|
|
1088
|
+
output,
|
|
1089
|
+
match,
|
|
1090
|
+
isMatch
|
|
1091
|
+
};
|
|
1092
|
+
if ('function' == typeof opts.onResult) opts.onResult(result);
|
|
1093
|
+
if (false === isMatch) {
|
|
1094
|
+
result.isMatch = false;
|
|
1095
|
+
return returnObject ? result : false;
|
|
1096
|
+
}
|
|
1097
|
+
if (isIgnored(input)) {
|
|
1098
|
+
if ('function' == typeof opts.onIgnore) opts.onIgnore(result);
|
|
1099
|
+
result.isMatch = false;
|
|
1100
|
+
return returnObject ? result : false;
|
|
1101
|
+
}
|
|
1102
|
+
if ('function' == typeof opts.onMatch) opts.onMatch(result);
|
|
1103
|
+
return returnObject ? result : true;
|
|
1104
|
+
};
|
|
1105
|
+
if (returnState) matcher.state = state;
|
|
1106
|
+
return matcher;
|
|
1107
|
+
};
|
|
1108
|
+
picomatch.test = (input, regex, options, { glob, posix } = {})=>{
|
|
1109
|
+
if ('string' != typeof input) throw new TypeError('Expected input to be a string');
|
|
1110
|
+
if ('' === input) return {
|
|
1111
|
+
isMatch: false,
|
|
1112
|
+
output: ''
|
|
1113
|
+
};
|
|
1114
|
+
const opts = options || {};
|
|
1115
|
+
const format = opts.format || (posix ? utils.toPosixSlashes : null);
|
|
1116
|
+
let match = input === glob;
|
|
1117
|
+
let output = match && format ? format(input) : input;
|
|
1118
|
+
if (false === match) {
|
|
1119
|
+
output = format ? format(input) : input;
|
|
1120
|
+
match = output === glob;
|
|
1121
|
+
}
|
|
1122
|
+
if (false === match || true === opts.capture) match = true === opts.matchBase || true === opts.basename ? picomatch.matchBase(input, regex, options, posix) : regex.exec(output);
|
|
1123
|
+
return {
|
|
1124
|
+
isMatch: Boolean(match),
|
|
1125
|
+
match,
|
|
1126
|
+
output
|
|
1127
|
+
};
|
|
1128
|
+
};
|
|
1129
|
+
picomatch.matchBase = (input, glob, options)=>{
|
|
1130
|
+
const regex = glob instanceof RegExp ? glob : picomatch.makeRe(glob, options);
|
|
1131
|
+
return regex.test(utils.basename(input));
|
|
1132
|
+
};
|
|
1133
|
+
picomatch.isMatch = (str, patterns, options)=>picomatch(patterns, options)(str);
|
|
1134
|
+
picomatch.parse = (pattern, options)=>{
|
|
1135
|
+
if (Array.isArray(pattern)) return pattern.map((p)=>picomatch.parse(p, options));
|
|
1136
|
+
return parse(pattern, {
|
|
1137
|
+
...options,
|
|
1138
|
+
fastpaths: false
|
|
1139
|
+
});
|
|
1140
|
+
};
|
|
1141
|
+
picomatch.scan = (input, options)=>scan(input, options);
|
|
1142
|
+
picomatch.compileRe = (state, options, returnOutput = false, returnState = false)=>{
|
|
1143
|
+
if (true === returnOutput) return state.output;
|
|
1144
|
+
const opts = options || {};
|
|
1145
|
+
const prepend = opts.contains ? '' : '^';
|
|
1146
|
+
const append = opts.contains ? '' : '$';
|
|
1147
|
+
let source = `${prepend}(?:${state.output})${append}`;
|
|
1148
|
+
if (state && true === state.negated) source = `^(?!${source}).*$`;
|
|
1149
|
+
const regex = picomatch.toRegex(source, options);
|
|
1150
|
+
if (true === returnState) regex.state = state;
|
|
1151
|
+
return regex;
|
|
1152
|
+
};
|
|
1153
|
+
picomatch.makeRe = (input, options = {}, returnOutput = false, returnState = false)=>{
|
|
1154
|
+
if (!input || 'string' != typeof input) throw new TypeError('Expected a non-empty string');
|
|
1155
|
+
let parsed = {
|
|
1156
|
+
negated: false,
|
|
1157
|
+
fastpaths: true
|
|
1158
|
+
};
|
|
1159
|
+
if (false !== options.fastpaths && ('.' === input[0] || '*' === input[0])) parsed.output = parse.fastpaths(input, options);
|
|
1160
|
+
if (!parsed.output) parsed = parse(input, options);
|
|
1161
|
+
return picomatch.compileRe(parsed, options, returnOutput, returnState);
|
|
1162
|
+
};
|
|
1163
|
+
picomatch.toRegex = (source, options)=>{
|
|
1164
|
+
try {
|
|
1165
|
+
const opts = options || {};
|
|
1166
|
+
return new RegExp(source, opts.flags || (opts.nocase ? 'i' : ''));
|
|
1167
|
+
} catch (err) {
|
|
1168
|
+
if (options && true === options.debug) throw err;
|
|
1169
|
+
return /$^/;
|
|
1170
|
+
}
|
|
1171
|
+
};
|
|
1172
|
+
picomatch.constants = constants;
|
|
1173
|
+
module.exports = picomatch;
|
|
1174
|
+
},
|
|
1175
|
+
"../../node_modules/.pnpm/picomatch@4.0.3/node_modules/picomatch/lib/scan.js": function(module, __unused_webpack_exports, __webpack_require__) {
|
|
1176
|
+
const utils = __webpack_require__("../../node_modules/.pnpm/picomatch@4.0.3/node_modules/picomatch/lib/utils.js");
|
|
1177
|
+
const { CHAR_ASTERISK, CHAR_AT, CHAR_BACKWARD_SLASH, CHAR_COMMA, CHAR_DOT, CHAR_EXCLAMATION_MARK, CHAR_FORWARD_SLASH, CHAR_LEFT_CURLY_BRACE, CHAR_LEFT_PARENTHESES, CHAR_LEFT_SQUARE_BRACKET, CHAR_PLUS, CHAR_QUESTION_MARK, CHAR_RIGHT_CURLY_BRACE, CHAR_RIGHT_PARENTHESES, CHAR_RIGHT_SQUARE_BRACKET } = __webpack_require__("../../node_modules/.pnpm/picomatch@4.0.3/node_modules/picomatch/lib/constants.js");
|
|
1178
|
+
const isPathSeparator = (code)=>code === CHAR_FORWARD_SLASH || code === CHAR_BACKWARD_SLASH;
|
|
1179
|
+
const depth = (token)=>{
|
|
1180
|
+
if (true !== token.isPrefix) token.depth = token.isGlobstar ? 1 / 0 : 1;
|
|
1181
|
+
};
|
|
1182
|
+
const scan = (input, options)=>{
|
|
1183
|
+
const opts = options || {};
|
|
1184
|
+
const length = input.length - 1;
|
|
1185
|
+
const scanToEnd = true === opts.parts || true === opts.scanToEnd;
|
|
1186
|
+
const slashes = [];
|
|
1187
|
+
const tokens = [];
|
|
1188
|
+
const parts = [];
|
|
1189
|
+
let str = input;
|
|
1190
|
+
let index = -1;
|
|
1191
|
+
let start = 0;
|
|
1192
|
+
let lastIndex = 0;
|
|
1193
|
+
let isBrace = false;
|
|
1194
|
+
let isBracket = false;
|
|
1195
|
+
let isGlob = false;
|
|
1196
|
+
let isExtglob = false;
|
|
1197
|
+
let isGlobstar = false;
|
|
1198
|
+
let braceEscaped = false;
|
|
1199
|
+
let backslashes = false;
|
|
1200
|
+
let negated = false;
|
|
1201
|
+
let negatedExtglob = false;
|
|
1202
|
+
let finished = false;
|
|
1203
|
+
let braces = 0;
|
|
1204
|
+
let prev;
|
|
1205
|
+
let code;
|
|
1206
|
+
let token = {
|
|
1207
|
+
value: '',
|
|
1208
|
+
depth: 0,
|
|
1209
|
+
isGlob: false
|
|
1210
|
+
};
|
|
1211
|
+
const eos = ()=>index >= length;
|
|
1212
|
+
const peek = ()=>str.charCodeAt(index + 1);
|
|
1213
|
+
const advance = ()=>{
|
|
1214
|
+
prev = code;
|
|
1215
|
+
return str.charCodeAt(++index);
|
|
1216
|
+
};
|
|
1217
|
+
while(index < length){
|
|
1218
|
+
code = advance();
|
|
1219
|
+
let next;
|
|
1220
|
+
if (code === CHAR_BACKWARD_SLASH) {
|
|
1221
|
+
backslashes = token.backslashes = true;
|
|
1222
|
+
code = advance();
|
|
1223
|
+
if (code === CHAR_LEFT_CURLY_BRACE) braceEscaped = true;
|
|
1224
|
+
continue;
|
|
1225
|
+
}
|
|
1226
|
+
if (true === braceEscaped || code === CHAR_LEFT_CURLY_BRACE) {
|
|
1227
|
+
braces++;
|
|
1228
|
+
while(true !== eos() && (code = advance())){
|
|
1229
|
+
if (code === CHAR_BACKWARD_SLASH) {
|
|
1230
|
+
backslashes = token.backslashes = true;
|
|
1231
|
+
advance();
|
|
1232
|
+
continue;
|
|
1233
|
+
}
|
|
1234
|
+
if (code === CHAR_LEFT_CURLY_BRACE) {
|
|
1235
|
+
braces++;
|
|
1236
|
+
continue;
|
|
1237
|
+
}
|
|
1238
|
+
if (true !== braceEscaped && code === CHAR_DOT && (code = advance()) === CHAR_DOT) {
|
|
1239
|
+
isBrace = token.isBrace = true;
|
|
1240
|
+
isGlob = token.isGlob = true;
|
|
1241
|
+
finished = true;
|
|
1242
|
+
if (true === scanToEnd) continue;
|
|
1243
|
+
break;
|
|
1244
|
+
}
|
|
1245
|
+
if (true !== braceEscaped && code === CHAR_COMMA) {
|
|
1246
|
+
isBrace = token.isBrace = true;
|
|
1247
|
+
isGlob = token.isGlob = true;
|
|
1248
|
+
finished = true;
|
|
1249
|
+
if (true === scanToEnd) continue;
|
|
1250
|
+
break;
|
|
1251
|
+
}
|
|
1252
|
+
if (code === CHAR_RIGHT_CURLY_BRACE) {
|
|
1253
|
+
braces--;
|
|
1254
|
+
if (0 === braces) {
|
|
1255
|
+
braceEscaped = false;
|
|
1256
|
+
isBrace = token.isBrace = true;
|
|
1257
|
+
finished = true;
|
|
1258
|
+
break;
|
|
1259
|
+
}
|
|
1260
|
+
}
|
|
1261
|
+
}
|
|
1262
|
+
if (true === scanToEnd) continue;
|
|
1263
|
+
break;
|
|
1264
|
+
}
|
|
1265
|
+
if (code === CHAR_FORWARD_SLASH) {
|
|
1266
|
+
slashes.push(index);
|
|
1267
|
+
tokens.push(token);
|
|
1268
|
+
token = {
|
|
1269
|
+
value: '',
|
|
1270
|
+
depth: 0,
|
|
1271
|
+
isGlob: false
|
|
1272
|
+
};
|
|
1273
|
+
if (true === finished) continue;
|
|
1274
|
+
if (prev === CHAR_DOT && index === start + 1) {
|
|
1275
|
+
start += 2;
|
|
1276
|
+
continue;
|
|
1277
|
+
}
|
|
1278
|
+
lastIndex = index + 1;
|
|
1279
|
+
continue;
|
|
1280
|
+
}
|
|
1281
|
+
if (true !== opts.noext) {
|
|
1282
|
+
const isExtglobChar = code === CHAR_PLUS || code === CHAR_AT || code === CHAR_ASTERISK || code === CHAR_QUESTION_MARK || code === CHAR_EXCLAMATION_MARK;
|
|
1283
|
+
if (true === isExtglobChar && peek() === CHAR_LEFT_PARENTHESES) {
|
|
1284
|
+
isGlob = token.isGlob = true;
|
|
1285
|
+
isExtglob = token.isExtglob = true;
|
|
1286
|
+
finished = true;
|
|
1287
|
+
if (code === CHAR_EXCLAMATION_MARK && index === start) negatedExtglob = true;
|
|
1288
|
+
if (true === scanToEnd) {
|
|
1289
|
+
while(true !== eos() && (code = advance())){
|
|
1290
|
+
if (code === CHAR_BACKWARD_SLASH) {
|
|
1291
|
+
backslashes = token.backslashes = true;
|
|
1292
|
+
code = advance();
|
|
1293
|
+
continue;
|
|
1294
|
+
}
|
|
1295
|
+
if (code === CHAR_RIGHT_PARENTHESES) {
|
|
1296
|
+
isGlob = token.isGlob = true;
|
|
1297
|
+
finished = true;
|
|
1298
|
+
break;
|
|
1299
|
+
}
|
|
1300
|
+
}
|
|
1301
|
+
continue;
|
|
1302
|
+
}
|
|
1303
|
+
break;
|
|
1304
|
+
}
|
|
1305
|
+
}
|
|
1306
|
+
if (code === CHAR_ASTERISK) {
|
|
1307
|
+
if (prev === CHAR_ASTERISK) isGlobstar = token.isGlobstar = true;
|
|
1308
|
+
isGlob = token.isGlob = true;
|
|
1309
|
+
finished = true;
|
|
1310
|
+
if (true === scanToEnd) continue;
|
|
1311
|
+
break;
|
|
1312
|
+
}
|
|
1313
|
+
if (code === CHAR_QUESTION_MARK) {
|
|
1314
|
+
isGlob = token.isGlob = true;
|
|
1315
|
+
finished = true;
|
|
1316
|
+
if (true === scanToEnd) continue;
|
|
1317
|
+
break;
|
|
1318
|
+
}
|
|
1319
|
+
if (code === CHAR_LEFT_SQUARE_BRACKET) {
|
|
1320
|
+
while(true !== eos() && (next = advance())){
|
|
1321
|
+
if (next === CHAR_BACKWARD_SLASH) {
|
|
1322
|
+
backslashes = token.backslashes = true;
|
|
1323
|
+
advance();
|
|
1324
|
+
continue;
|
|
1325
|
+
}
|
|
1326
|
+
if (next === CHAR_RIGHT_SQUARE_BRACKET) {
|
|
1327
|
+
isBracket = token.isBracket = true;
|
|
1328
|
+
isGlob = token.isGlob = true;
|
|
1329
|
+
finished = true;
|
|
1330
|
+
break;
|
|
1331
|
+
}
|
|
1332
|
+
}
|
|
1333
|
+
if (true === scanToEnd) continue;
|
|
1334
|
+
break;
|
|
1335
|
+
}
|
|
1336
|
+
if (true !== opts.nonegate && code === CHAR_EXCLAMATION_MARK && index === start) {
|
|
1337
|
+
negated = token.negated = true;
|
|
1338
|
+
start++;
|
|
1339
|
+
continue;
|
|
1340
|
+
}
|
|
1341
|
+
if (true !== opts.noparen && code === CHAR_LEFT_PARENTHESES) {
|
|
1342
|
+
isGlob = token.isGlob = true;
|
|
1343
|
+
if (true === scanToEnd) {
|
|
1344
|
+
while(true !== eos() && (code = advance())){
|
|
1345
|
+
if (code === CHAR_LEFT_PARENTHESES) {
|
|
1346
|
+
backslashes = token.backslashes = true;
|
|
1347
|
+
code = advance();
|
|
1348
|
+
continue;
|
|
1349
|
+
}
|
|
1350
|
+
if (code === CHAR_RIGHT_PARENTHESES) {
|
|
1351
|
+
finished = true;
|
|
1352
|
+
break;
|
|
1353
|
+
}
|
|
1354
|
+
}
|
|
1355
|
+
continue;
|
|
1356
|
+
}
|
|
1357
|
+
break;
|
|
1358
|
+
}
|
|
1359
|
+
if (true === isGlob) {
|
|
1360
|
+
finished = true;
|
|
1361
|
+
if (true === scanToEnd) continue;
|
|
1362
|
+
break;
|
|
1363
|
+
}
|
|
1364
|
+
}
|
|
1365
|
+
if (true === opts.noext) {
|
|
1366
|
+
isExtglob = false;
|
|
1367
|
+
isGlob = false;
|
|
1368
|
+
}
|
|
1369
|
+
let base = str;
|
|
1370
|
+
let prefix = '';
|
|
1371
|
+
let glob = '';
|
|
1372
|
+
if (start > 0) {
|
|
1373
|
+
prefix = str.slice(0, start);
|
|
1374
|
+
str = str.slice(start);
|
|
1375
|
+
lastIndex -= start;
|
|
1376
|
+
}
|
|
1377
|
+
if (base && true === isGlob && lastIndex > 0) {
|
|
1378
|
+
base = str.slice(0, lastIndex);
|
|
1379
|
+
glob = str.slice(lastIndex);
|
|
1380
|
+
} else if (true === isGlob) {
|
|
1381
|
+
base = '';
|
|
1382
|
+
glob = str;
|
|
1383
|
+
} else base = str;
|
|
1384
|
+
if (base && '' !== base && '/' !== base && base !== str) {
|
|
1385
|
+
if (isPathSeparator(base.charCodeAt(base.length - 1))) base = base.slice(0, -1);
|
|
1386
|
+
}
|
|
1387
|
+
if (true === opts.unescape) {
|
|
1388
|
+
if (glob) glob = utils.removeBackslashes(glob);
|
|
1389
|
+
if (base && true === backslashes) base = utils.removeBackslashes(base);
|
|
1390
|
+
}
|
|
1391
|
+
const state = {
|
|
1392
|
+
prefix,
|
|
1393
|
+
input,
|
|
1394
|
+
start,
|
|
1395
|
+
base,
|
|
1396
|
+
glob,
|
|
1397
|
+
isBrace,
|
|
1398
|
+
isBracket,
|
|
1399
|
+
isGlob,
|
|
1400
|
+
isExtglob,
|
|
1401
|
+
isGlobstar,
|
|
1402
|
+
negated,
|
|
1403
|
+
negatedExtglob
|
|
1404
|
+
};
|
|
1405
|
+
if (true === opts.tokens) {
|
|
1406
|
+
state.maxDepth = 0;
|
|
1407
|
+
if (!isPathSeparator(code)) tokens.push(token);
|
|
1408
|
+
state.tokens = tokens;
|
|
1409
|
+
}
|
|
1410
|
+
if (true === opts.parts || true === opts.tokens) {
|
|
1411
|
+
let prevIndex;
|
|
1412
|
+
for(let idx = 0; idx < slashes.length; idx++){
|
|
1413
|
+
const n = prevIndex ? prevIndex + 1 : start;
|
|
1414
|
+
const i = slashes[idx];
|
|
1415
|
+
const value = input.slice(n, i);
|
|
1416
|
+
if (opts.tokens) {
|
|
1417
|
+
if (0 === idx && 0 !== start) {
|
|
1418
|
+
tokens[idx].isPrefix = true;
|
|
1419
|
+
tokens[idx].value = prefix;
|
|
1420
|
+
} else tokens[idx].value = value;
|
|
1421
|
+
depth(tokens[idx]);
|
|
1422
|
+
state.maxDepth += tokens[idx].depth;
|
|
1423
|
+
}
|
|
1424
|
+
if (0 !== idx || '' !== value) parts.push(value);
|
|
1425
|
+
prevIndex = i;
|
|
1426
|
+
}
|
|
1427
|
+
if (prevIndex && prevIndex + 1 < input.length) {
|
|
1428
|
+
const value = input.slice(prevIndex + 1);
|
|
1429
|
+
parts.push(value);
|
|
1430
|
+
if (opts.tokens) {
|
|
1431
|
+
tokens[tokens.length - 1].value = value;
|
|
1432
|
+
depth(tokens[tokens.length - 1]);
|
|
1433
|
+
state.maxDepth += tokens[tokens.length - 1].depth;
|
|
1434
|
+
}
|
|
1435
|
+
}
|
|
1436
|
+
state.slashes = slashes;
|
|
1437
|
+
state.parts = parts;
|
|
1438
|
+
}
|
|
1439
|
+
return state;
|
|
1440
|
+
};
|
|
1441
|
+
module.exports = scan;
|
|
1442
|
+
},
|
|
1443
|
+
"../../node_modules/.pnpm/picomatch@4.0.3/node_modules/picomatch/lib/utils.js": function(__unused_webpack_module, exports, __webpack_require__) {
|
|
1444
|
+
const { REGEX_BACKSLASH, REGEX_REMOVE_BACKSLASH, REGEX_SPECIAL_CHARS, REGEX_SPECIAL_CHARS_GLOBAL } = __webpack_require__("../../node_modules/.pnpm/picomatch@4.0.3/node_modules/picomatch/lib/constants.js");
|
|
1445
|
+
exports.isObject = (val)=>null !== val && 'object' == typeof val && !Array.isArray(val);
|
|
1446
|
+
exports.hasRegexChars = (str)=>REGEX_SPECIAL_CHARS.test(str);
|
|
1447
|
+
exports.isRegexChar = (str)=>1 === str.length && exports.hasRegexChars(str);
|
|
1448
|
+
exports.escapeRegex = (str)=>str.replace(REGEX_SPECIAL_CHARS_GLOBAL, '\\$1');
|
|
1449
|
+
exports.toPosixSlashes = (str)=>str.replace(REGEX_BACKSLASH, '/');
|
|
1450
|
+
exports.isWindows = ()=>{
|
|
1451
|
+
if ('undefined' != typeof navigator && navigator.platform) {
|
|
1452
|
+
const platform = navigator.platform.toLowerCase();
|
|
1453
|
+
return 'win32' === platform || 'windows' === platform;
|
|
1454
|
+
}
|
|
1455
|
+
if ('undefined' != typeof process && process.platform) return 'win32' === process.platform;
|
|
1456
|
+
return false;
|
|
1457
|
+
};
|
|
1458
|
+
exports.removeBackslashes = (str)=>str.replace(REGEX_REMOVE_BACKSLASH, (match)=>'\\' === match ? '' : match);
|
|
1459
|
+
exports.escapeLast = (input, char, lastIdx)=>{
|
|
1460
|
+
const idx = input.lastIndexOf(char, lastIdx);
|
|
1461
|
+
if (-1 === idx) return input;
|
|
1462
|
+
if ('\\' === input[idx - 1]) return exports.escapeLast(input, char, idx - 1);
|
|
1463
|
+
return `${input.slice(0, idx)}\\${input.slice(idx)}`;
|
|
1464
|
+
};
|
|
1465
|
+
exports.removePrefix = (input, state = {})=>{
|
|
1466
|
+
let output = input;
|
|
1467
|
+
if (output.startsWith('./')) {
|
|
1468
|
+
output = output.slice(2);
|
|
1469
|
+
state.prefix = './';
|
|
1470
|
+
}
|
|
1471
|
+
return output;
|
|
1472
|
+
};
|
|
1473
|
+
exports.wrapOutput = (input, state = {}, options = {})=>{
|
|
1474
|
+
const prepend = options.contains ? '' : '^';
|
|
1475
|
+
const append = options.contains ? '' : '$';
|
|
1476
|
+
let output = `${prepend}(?:${input})${append}`;
|
|
1477
|
+
if (true === state.negated) output = `(?:^(?!${output}).*$)`;
|
|
1478
|
+
return output;
|
|
1479
|
+
};
|
|
1480
|
+
exports.basename = (path, { windows } = {})=>{
|
|
1481
|
+
const segs = path.split(windows ? /[\\/]/ : '/');
|
|
1482
|
+
const last = segs[segs.length - 1];
|
|
1483
|
+
if ('' === last) return segs[segs.length - 2];
|
|
1484
|
+
return last;
|
|
1485
|
+
};
|
|
1486
|
+
},
|
|
1487
|
+
"node:fs": function(module) {
|
|
1488
|
+
module.exports = __WEBPACK_EXTERNAL_MODULE_node_fs_5ea92f0c__;
|
|
1489
|
+
},
|
|
1490
|
+
"node:os": function(module) {
|
|
1491
|
+
module.exports = __WEBPACK_EXTERNAL_MODULE_node_os_74b4b876__;
|
|
1492
|
+
},
|
|
1493
|
+
"node:path": function(module) {
|
|
1494
|
+
module.exports = __WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__;
|
|
1495
|
+
},
|
|
1496
|
+
"node:tty": function(module) {
|
|
1497
|
+
module.exports = __WEBPACK_EXTERNAL_MODULE_node_tty_c64aab7e__;
|
|
1498
|
+
},
|
|
1499
|
+
"node:util": function(module) {
|
|
1500
|
+
module.exports = __WEBPACK_EXTERNAL_MODULE_node_util_1b29d436__;
|
|
1501
|
+
}
|
|
1502
|
+
});
|
|
1503
|
+
const external_node_os_ = __webpack_require__("node:os");
|
|
1504
|
+
const external_node_tty_ = __webpack_require__("node:tty");
|
|
1505
|
+
function hasFlag(flag, argv = globalThis.Deno ? globalThis.Deno.args : node_process.argv) {
|
|
1506
|
+
const prefix = flag.startsWith('-') ? '' : 1 === flag.length ? '-' : '--';
|
|
1507
|
+
const position = argv.indexOf(prefix + flag);
|
|
1508
|
+
const terminatorPosition = argv.indexOf('--');
|
|
1509
|
+
return -1 !== position && (-1 === terminatorPosition || position < terminatorPosition);
|
|
1510
|
+
}
|
|
1511
|
+
const { env: env } = node_process;
|
|
1512
|
+
let flagForceColor;
|
|
1513
|
+
if (hasFlag('no-color') || hasFlag('no-colors') || hasFlag('color=false') || hasFlag('color=never')) flagForceColor = 0;
|
|
1514
|
+
else if (hasFlag('color') || hasFlag('colors') || hasFlag('color=true') || hasFlag('color=always')) flagForceColor = 1;
|
|
1515
|
+
function envForceColor() {
|
|
1516
|
+
if (!('FORCE_COLOR' in env)) return;
|
|
1517
|
+
if ('true' === env.FORCE_COLOR) return 1;
|
|
1518
|
+
if ('false' === env.FORCE_COLOR) return 0;
|
|
1519
|
+
if (0 === env.FORCE_COLOR.length) return 1;
|
|
1520
|
+
const level = Math.min(Number.parseInt(env.FORCE_COLOR, 10), 3);
|
|
1521
|
+
if (![
|
|
1522
|
+
0,
|
|
1523
|
+
1,
|
|
1524
|
+
2,
|
|
1525
|
+
3
|
|
1526
|
+
].includes(level)) return;
|
|
1527
|
+
return level;
|
|
1528
|
+
}
|
|
1529
|
+
function translateLevel(level) {
|
|
1530
|
+
if (0 === level) return false;
|
|
1531
|
+
return {
|
|
1532
|
+
level,
|
|
1533
|
+
hasBasic: true,
|
|
1534
|
+
has256: level >= 2,
|
|
1535
|
+
has16m: level >= 3
|
|
1536
|
+
};
|
|
1537
|
+
}
|
|
1538
|
+
function _supportsColor(haveStream, { streamIsTTY, sniffFlags = true } = {}) {
|
|
1539
|
+
const noFlagForceColor = envForceColor();
|
|
1540
|
+
if (void 0 !== noFlagForceColor) flagForceColor = noFlagForceColor;
|
|
1541
|
+
const forceColor = sniffFlags ? flagForceColor : noFlagForceColor;
|
|
1542
|
+
if (0 === forceColor) return 0;
|
|
1543
|
+
if (sniffFlags) {
|
|
1544
|
+
if (hasFlag('color=16m') || hasFlag('color=full') || hasFlag('color=truecolor')) return 3;
|
|
1545
|
+
if (hasFlag('color=256')) return 2;
|
|
1546
|
+
}
|
|
1547
|
+
if ('TF_BUILD' in env && 'AGENT_NAME' in env) return 1;
|
|
1548
|
+
if (haveStream && !streamIsTTY && void 0 === forceColor) return 0;
|
|
1549
|
+
const min = forceColor || 0;
|
|
1550
|
+
if ('dumb' === env.TERM) return min;
|
|
1551
|
+
if ('win32' === node_process.platform) {
|
|
1552
|
+
const osRelease = external_node_os_["default"].release().split('.');
|
|
1553
|
+
if (Number(osRelease[0]) >= 10 && Number(osRelease[2]) >= 10586) return Number(osRelease[2]) >= 14931 ? 3 : 2;
|
|
1554
|
+
return 1;
|
|
1555
|
+
}
|
|
1556
|
+
if ('CI' in env) {
|
|
1557
|
+
if ([
|
|
1558
|
+
'GITHUB_ACTIONS',
|
|
1559
|
+
'GITEA_ACTIONS',
|
|
1560
|
+
'CIRCLECI'
|
|
1561
|
+
].some((key)=>key in env)) return 3;
|
|
1562
|
+
if ([
|
|
1563
|
+
'TRAVIS',
|
|
1564
|
+
'APPVEYOR',
|
|
1565
|
+
'GITLAB_CI',
|
|
1566
|
+
'BUILDKITE',
|
|
1567
|
+
'DRONE'
|
|
1568
|
+
].some((sign)=>sign in env) || 'codeship' === env.CI_NAME) return 1;
|
|
1569
|
+
return min;
|
|
1570
|
+
}
|
|
1571
|
+
if ('TEAMCITY_VERSION' in env) return /^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(env.TEAMCITY_VERSION) ? 1 : 0;
|
|
1572
|
+
if ('truecolor' === env.COLORTERM) return 3;
|
|
1573
|
+
if ('xterm-kitty' === env.TERM) return 3;
|
|
1574
|
+
if ('xterm-ghostty' === env.TERM) return 3;
|
|
1575
|
+
if ('wezterm' === env.TERM) return 3;
|
|
1576
|
+
if ('TERM_PROGRAM' in env) {
|
|
1577
|
+
const version = Number.parseInt((env.TERM_PROGRAM_VERSION || '').split('.')[0], 10);
|
|
1578
|
+
switch(env.TERM_PROGRAM){
|
|
1579
|
+
case 'iTerm.app':
|
|
1580
|
+
return version >= 3 ? 3 : 2;
|
|
1581
|
+
case 'Apple_Terminal':
|
|
1582
|
+
return 2;
|
|
1583
|
+
}
|
|
1584
|
+
}
|
|
1585
|
+
if (/-256(color)?$/i.test(env.TERM)) return 2;
|
|
1586
|
+
if (/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(env.TERM)) return 1;
|
|
1587
|
+
if ('COLORTERM' in env) return 1;
|
|
1588
|
+
return min;
|
|
1589
|
+
}
|
|
1590
|
+
function createSupportsColor(stream, options = {}) {
|
|
1591
|
+
const level = _supportsColor(stream, {
|
|
1592
|
+
streamIsTTY: stream && stream.isTTY,
|
|
1593
|
+
...options
|
|
1594
|
+
});
|
|
1595
|
+
return translateLevel(level);
|
|
1596
|
+
}
|
|
1597
|
+
const supportsColor = {
|
|
1598
|
+
stdout: createSupportsColor({
|
|
1599
|
+
isTTY: external_node_tty_["default"].isatty(1)
|
|
1600
|
+
}),
|
|
1601
|
+
stderr: createSupportsColor({
|
|
1602
|
+
isTTY: external_node_tty_["default"].isatty(2)
|
|
1603
|
+
})
|
|
1604
|
+
};
|
|
1605
|
+
const supports_color = supportsColor;
|
|
1606
|
+
const colorLevel = supports_color.stdout ? supports_color.stdout.level : 0;
|
|
1607
|
+
let errorStackRegExp = /at\s.*:\d+:\d+[\s\)]*$/;
|
|
1608
|
+
let anonymousErrorStackRegExp = /at\s.*\(<anonymous>\)$/;
|
|
1609
|
+
let isErrorStackMessage = (message)=>errorStackRegExp.test(message) || anonymousErrorStackRegExp.test(message);
|
|
1610
|
+
let formatter = (open, close, replace = open)=>colorLevel >= 2 ? (input)=>{
|
|
1611
|
+
let string = '' + input;
|
|
1612
|
+
let index = string.indexOf(close, open.length);
|
|
1613
|
+
return ~index ? open + replaceClose(string, close, replace, index) + close : open + string + close;
|
|
1614
|
+
} : String;
|
|
1615
|
+
let replaceClose = (string, close, replace, index)=>{
|
|
1616
|
+
let start = string.substring(0, index) + replace;
|
|
1617
|
+
let end = string.substring(index + close.length);
|
|
1618
|
+
let nextIndex = end.indexOf(close);
|
|
1619
|
+
return ~nextIndex ? start + replaceClose(end, close, replace, nextIndex) : start + end;
|
|
1620
|
+
};
|
|
1621
|
+
const bold = formatter('\x1b[1m', '\x1b[22m', '\x1b[22m\x1b[1m');
|
|
1622
|
+
const red = formatter('\x1b[31m', '\x1b[39m');
|
|
1623
|
+
const green = formatter('\x1b[32m', '\x1b[39m');
|
|
1624
|
+
const yellow = formatter('\x1b[33m', '\x1b[39m');
|
|
1625
|
+
const magenta = formatter('\x1b[35m', '\x1b[39m');
|
|
1626
|
+
const cyan = formatter('\x1b[36m', '\x1b[39m');
|
|
1627
|
+
const gray = formatter('\x1b[90m', '\x1b[39m');
|
|
1628
|
+
let startColor = [
|
|
1629
|
+
189,
|
|
1630
|
+
255,
|
|
1631
|
+
243
|
|
1632
|
+
];
|
|
1633
|
+
let endColor = [
|
|
1634
|
+
74,
|
|
1635
|
+
194,
|
|
1636
|
+
154
|
|
1637
|
+
];
|
|
1638
|
+
let isWord = (char)=>!/[\s\n]/.test(char);
|
|
1639
|
+
let gradient = (message)=>{
|
|
1640
|
+
if (colorLevel < 3) return 2 === colorLevel ? bold(cyan(message)) : message;
|
|
1641
|
+
let chars = [
|
|
1642
|
+
...message
|
|
1643
|
+
];
|
|
1644
|
+
let steps = chars.filter(isWord).length;
|
|
1645
|
+
let r = startColor[0];
|
|
1646
|
+
let g = startColor[1];
|
|
1647
|
+
let b = startColor[2];
|
|
1648
|
+
let rStep = (endColor[0] - r) / steps;
|
|
1649
|
+
let gStep = (endColor[1] - g) / steps;
|
|
1650
|
+
let bStep = (endColor[2] - b) / steps;
|
|
1651
|
+
let output = '';
|
|
1652
|
+
for (let char of chars){
|
|
1653
|
+
if (isWord(char)) {
|
|
1654
|
+
r += rStep;
|
|
1655
|
+
g += gStep;
|
|
1656
|
+
b += bStep;
|
|
1657
|
+
}
|
|
1658
|
+
output += `\x1b[38;2;${Math.round(r)};${Math.round(g)};${Math.round(b)}m${char}\x1b[39m`;
|
|
1659
|
+
}
|
|
1660
|
+
return bold(output);
|
|
1661
|
+
};
|
|
1662
|
+
let LOG_LEVEL = {
|
|
1663
|
+
silent: -1,
|
|
1664
|
+
error: 0,
|
|
1665
|
+
warn: 1,
|
|
1666
|
+
info: 2,
|
|
1667
|
+
log: 2,
|
|
1668
|
+
verbose: 3
|
|
1669
|
+
};
|
|
1670
|
+
let LOG_TYPES = {
|
|
1671
|
+
error: {
|
|
1672
|
+
label: 'error',
|
|
1673
|
+
level: 'error',
|
|
1674
|
+
color: red
|
|
1675
|
+
},
|
|
1676
|
+
warn: {
|
|
1677
|
+
label: 'warn',
|
|
1678
|
+
level: 'warn',
|
|
1679
|
+
color: yellow
|
|
1680
|
+
},
|
|
1681
|
+
info: {
|
|
1682
|
+
label: 'info',
|
|
1683
|
+
level: 'info',
|
|
1684
|
+
color: cyan
|
|
1685
|
+
},
|
|
1686
|
+
start: {
|
|
1687
|
+
label: 'start',
|
|
1688
|
+
level: 'info',
|
|
1689
|
+
color: cyan
|
|
1690
|
+
},
|
|
1691
|
+
ready: {
|
|
1692
|
+
label: 'ready',
|
|
1693
|
+
level: 'info',
|
|
1694
|
+
color: green
|
|
1695
|
+
},
|
|
1696
|
+
success: {
|
|
1697
|
+
label: 'success',
|
|
1698
|
+
level: 'info',
|
|
1699
|
+
color: green
|
|
1700
|
+
},
|
|
1701
|
+
log: {
|
|
1702
|
+
level: 'info'
|
|
1703
|
+
},
|
|
1704
|
+
debug: {
|
|
1705
|
+
label: 'debug',
|
|
1706
|
+
level: 'verbose',
|
|
1707
|
+
color: magenta
|
|
1708
|
+
}
|
|
1709
|
+
};
|
|
1710
|
+
const normalizeErrorMessage = (err)=>{
|
|
1711
|
+
if (err.stack) {
|
|
1712
|
+
let [name, ...rest] = err.stack.split('\n');
|
|
1713
|
+
if (name.startsWith('Error: ')) name = name.slice(7);
|
|
1714
|
+
return `${name}\n${gray(rest.join('\n'))}`;
|
|
1715
|
+
}
|
|
1716
|
+
return err.message;
|
|
1717
|
+
};
|
|
1718
|
+
let createLogger = (options = {})=>{
|
|
1719
|
+
let maxLevel = options.level || 'info';
|
|
1720
|
+
let log = (type, message, ...args)=>{
|
|
1721
|
+
if (LOG_LEVEL[LOG_TYPES[type].level] > LOG_LEVEL[maxLevel]) return;
|
|
1722
|
+
if (null == message) return console.log();
|
|
1723
|
+
let logType = LOG_TYPES[type];
|
|
1724
|
+
let label = '';
|
|
1725
|
+
let text = '';
|
|
1726
|
+
if ('label' in logType) {
|
|
1727
|
+
label = (logType.label || '').padEnd(7);
|
|
1728
|
+
label = bold(logType.color ? logType.color(label) : label);
|
|
1729
|
+
}
|
|
1730
|
+
if (message instanceof Error) {
|
|
1731
|
+
text += normalizeErrorMessage(message);
|
|
1732
|
+
const { cause } = message;
|
|
1733
|
+
if (cause) {
|
|
1734
|
+
text += yellow('\n [cause]: ');
|
|
1735
|
+
text += cause instanceof Error ? normalizeErrorMessage(cause) : String(cause);
|
|
1736
|
+
}
|
|
1737
|
+
} else if ('error' === logType.level && 'string' == typeof message) {
|
|
1738
|
+
let lines = message.split('\n');
|
|
1739
|
+
text = lines.map((line)=>isErrorStackMessage(line) ? gray(line) : line).join('\n');
|
|
1740
|
+
} else text = `${message}`;
|
|
1741
|
+
console.log(label.length ? `${label} ${text}` : text, ...args);
|
|
1742
|
+
};
|
|
1743
|
+
let logger = {
|
|
1744
|
+
greet: (message)=>log('log', gradient(message))
|
|
1745
|
+
};
|
|
1746
|
+
Object.keys(LOG_TYPES).forEach((key)=>{
|
|
1747
|
+
logger[key] = (...args)=>log(key, ...args);
|
|
1748
|
+
});
|
|
1749
|
+
Object.defineProperty(logger, 'level', {
|
|
1750
|
+
get: ()=>maxLevel,
|
|
1751
|
+
set (val) {
|
|
1752
|
+
maxLevel = val;
|
|
1753
|
+
}
|
|
1754
|
+
});
|
|
1755
|
+
logger.override = (customLogger)=>{
|
|
1756
|
+
Object.assign(logger, customLogger);
|
|
1757
|
+
};
|
|
1758
|
+
return logger;
|
|
1759
|
+
};
|
|
1760
|
+
let src_logger = createLogger();
|
|
1761
|
+
const picocolors = __webpack_require__("../../node_modules/.pnpm/picocolors@1.1.1/node_modules/picocolors/picocolors.js");
|
|
1762
|
+
var picocolors_default = /*#__PURE__*/ __webpack_require__.n(picocolors);
|
|
1763
|
+
const isDebug = ()=>{
|
|
1764
|
+
if (!process.env.DEBUG) return false;
|
|
1765
|
+
const values = process.env.DEBUG.toLocaleLowerCase().split(',');
|
|
1766
|
+
return [
|
|
1767
|
+
'rstest',
|
|
1768
|
+
'rsbuild',
|
|
1769
|
+
'builder',
|
|
1770
|
+
'*'
|
|
1771
|
+
].some((key)=>values.includes(key));
|
|
1772
|
+
};
|
|
1773
|
+
if (isDebug()) src_logger.level = 'verbose';
|
|
1774
|
+
function getTime() {
|
|
1775
|
+
const now = new Date();
|
|
1776
|
+
const hours = String(now.getHours()).padStart(2, '0');
|
|
1777
|
+
const minutes = String(now.getMinutes()).padStart(2, '0');
|
|
1778
|
+
const seconds = String(now.getSeconds()).padStart(2, '0');
|
|
1779
|
+
return `${hours}:${minutes}:${seconds}`;
|
|
1780
|
+
}
|
|
1781
|
+
src_logger.override({
|
|
1782
|
+
debug: (message, ...args)=>{
|
|
1783
|
+
if ('verbose' !== src_logger.level) return;
|
|
1784
|
+
const time = picocolors_default().gray(getTime());
|
|
1785
|
+
console.log(` ${picocolors_default().magenta('rstest')} ${time} ${message}`, ...args);
|
|
1786
|
+
}
|
|
1787
|
+
});
|
|
1788
|
+
const clearScreen = (force = false)=>{
|
|
1789
|
+
if (!isDebug() || force) console.log('\x1Bc');
|
|
1790
|
+
};
|
|
1791
|
+
let _lazyMatch = ()=>{
|
|
1792
|
+
var __lib__ = (()=>{
|
|
1793
|
+
var m = Object.defineProperty, V = Object.getOwnPropertyDescriptor, G = Object.getOwnPropertyNames, T = Object.prototype.hasOwnProperty, q = (r, e)=>{
|
|
1794
|
+
for(var n in e)m(r, n, {
|
|
1795
|
+
get: e[n],
|
|
1796
|
+
enumerable: true
|
|
1797
|
+
});
|
|
1798
|
+
}, H = (r, e, n, a)=>{
|
|
1799
|
+
if (e && "object" == typeof e || "function" == typeof e) for (let t of G(e))T.call(r, t) || t === n || m(r, t, {
|
|
1800
|
+
get: ()=>e[t],
|
|
1801
|
+
enumerable: !(a = V(e, t)) || a.enumerable
|
|
1802
|
+
});
|
|
1803
|
+
return r;
|
|
1804
|
+
}, J = (r)=>H(m({}, "__esModule", {
|
|
1805
|
+
value: true
|
|
1806
|
+
}), r), w = {};
|
|
1807
|
+
q(w, {
|
|
1808
|
+
default: ()=>re
|
|
1809
|
+
});
|
|
1810
|
+
var A = (r)=>Array.isArray(r), d = (r)=>"function" == typeof r, Q = (r)=>0 === r.length, W = (r)=>"number" == typeof r, K = (r)=>"object" == typeof r && null !== r, X = (r)=>r instanceof RegExp, b = (r)=>"string" == typeof r, h = (r)=>void 0 === r, Y = (r)=>{
|
|
1811
|
+
const e = new Map;
|
|
1812
|
+
return (n)=>{
|
|
1813
|
+
const a = e.get(n);
|
|
1814
|
+
if (a) return a;
|
|
1815
|
+
const t = r(n);
|
|
1816
|
+
return e.set(n, t), t;
|
|
1817
|
+
};
|
|
1818
|
+
}, rr = (r, e, n = {})=>{
|
|
1819
|
+
const a = {
|
|
1820
|
+
cache: {},
|
|
1821
|
+
input: r,
|
|
1822
|
+
index: 0,
|
|
1823
|
+
indexMax: 0,
|
|
1824
|
+
options: n,
|
|
1825
|
+
output: []
|
|
1826
|
+
};
|
|
1827
|
+
if (v(e)(a) && a.index === r.length) return a.output;
|
|
1828
|
+
throw new Error(`Failed to parse at index ${a.indexMax}`);
|
|
1829
|
+
}, i = (r, e)=>A(r) ? er(r, e) : b(r) ? ar(r, e) : nr(r, e), er = (r, e)=>{
|
|
1830
|
+
const n = {};
|
|
1831
|
+
for (const a of r){
|
|
1832
|
+
if (1 !== a.length) throw new Error(`Invalid character: "${a}"`);
|
|
1833
|
+
const t = a.charCodeAt(0);
|
|
1834
|
+
n[t] = true;
|
|
1835
|
+
}
|
|
1836
|
+
return (a)=>{
|
|
1837
|
+
const t = a.index, o = a.input;
|
|
1838
|
+
for(; a.index < o.length && o.charCodeAt(a.index) in n;)a.index += 1;
|
|
1839
|
+
const u = a.index;
|
|
1840
|
+
if (u > t) {
|
|
1841
|
+
if (!h(e) && !a.options.silent) {
|
|
1842
|
+
const s = a.input.slice(t, u), c = d(e) ? e(s, o, String(t)) : e;
|
|
1843
|
+
h(c) || a.output.push(c);
|
|
1844
|
+
}
|
|
1845
|
+
a.indexMax = Math.max(a.indexMax, a.index);
|
|
1846
|
+
}
|
|
1847
|
+
return true;
|
|
1848
|
+
};
|
|
1849
|
+
}, nr = (r, e)=>{
|
|
1850
|
+
const n = r.source, a = r.flags.replace(/y|$/, "y"), t = new RegExp(n, a);
|
|
1851
|
+
return g((o)=>{
|
|
1852
|
+
t.lastIndex = o.index;
|
|
1853
|
+
const u = t.exec(o.input);
|
|
1854
|
+
if (!u) return false;
|
|
1855
|
+
if (!h(e) && !o.options.silent) {
|
|
1856
|
+
const s = d(e) ? e(...u, o.input, String(o.index)) : e;
|
|
1857
|
+
h(s) || o.output.push(s);
|
|
1858
|
+
}
|
|
1859
|
+
return o.index += u[0].length, o.indexMax = Math.max(o.indexMax, o.index), true;
|
|
1860
|
+
});
|
|
1861
|
+
}, ar = (r, e)=>(n)=>{
|
|
1862
|
+
if (!n.input.startsWith(r, n.index)) return false;
|
|
1863
|
+
if (!h(e) && !n.options.silent) {
|
|
1864
|
+
const t = d(e) ? e(r, n.input, String(n.index)) : e;
|
|
1865
|
+
h(t) || n.output.push(t);
|
|
1866
|
+
}
|
|
1867
|
+
return n.index += r.length, n.indexMax = Math.max(n.indexMax, n.index), true;
|
|
1868
|
+
}, C = (r, e, n, a)=>{
|
|
1869
|
+
const t = v(r);
|
|
1870
|
+
return g(_(M((o)=>{
|
|
1871
|
+
let u = 0;
|
|
1872
|
+
for(; u < n;){
|
|
1873
|
+
const s = o.index;
|
|
1874
|
+
if (!t(o) || (u += 1, o.index === s)) break;
|
|
1875
|
+
}
|
|
1876
|
+
return u >= e;
|
|
1877
|
+
})));
|
|
1878
|
+
}, tr = (r, e)=>C(r, 0, 1), f = (r, e)=>C(r, 0, 1 / 0), x = (r, e)=>{
|
|
1879
|
+
const n = r.map(v);
|
|
1880
|
+
return g(_(M((a)=>{
|
|
1881
|
+
for(let t = 0, o = n.length; t < o; t++)if (!n[t](a)) return false;
|
|
1882
|
+
return true;
|
|
1883
|
+
})));
|
|
1884
|
+
}, l = (r, e)=>{
|
|
1885
|
+
const n = r.map(v);
|
|
1886
|
+
return g(_((a)=>{
|
|
1887
|
+
for(let t = 0, o = n.length; t < o; t++)if (n[t](a)) return true;
|
|
1888
|
+
return false;
|
|
1889
|
+
}));
|
|
1890
|
+
}, M = (r, e = false)=>{
|
|
1891
|
+
const n = v(r);
|
|
1892
|
+
return (a)=>{
|
|
1893
|
+
const t = a.index, o = a.output.length, u = n(a);
|
|
1894
|
+
return (!u || e) && (a.index = t, a.output.length !== o && (a.output.length = o)), u;
|
|
1895
|
+
};
|
|
1896
|
+
}, _ = (r, e)=>{
|
|
1897
|
+
const n = v(r);
|
|
1898
|
+
return n;
|
|
1899
|
+
}, g = (()=>{
|
|
1900
|
+
let r = 0;
|
|
1901
|
+
return (e)=>{
|
|
1902
|
+
const n = v(e), a = r += 1;
|
|
1903
|
+
return (t)=>{
|
|
1904
|
+
var o;
|
|
1905
|
+
if (false === t.options.memoization) return n(t);
|
|
1906
|
+
const u = t.index, s = (o = t.cache)[a] || (o[a] = new Map), c = s.get(u);
|
|
1907
|
+
if (false === c) return false;
|
|
1908
|
+
if (W(c)) return t.index = c, true;
|
|
1909
|
+
if (c) return t.index = c.index, c.output?.length && t.output.push(...c.output), true;
|
|
1910
|
+
{
|
|
1911
|
+
const Z = t.output.length;
|
|
1912
|
+
if (!n(t)) return s.set(u, false), false;
|
|
1913
|
+
{
|
|
1914
|
+
const D = t.index, U = t.output.length;
|
|
1915
|
+
if (U > Z) {
|
|
1916
|
+
const ee = t.output.slice(Z, U);
|
|
1917
|
+
s.set(u, {
|
|
1918
|
+
index: D,
|
|
1919
|
+
output: ee
|
|
1920
|
+
});
|
|
1921
|
+
} else s.set(u, D);
|
|
1922
|
+
return true;
|
|
1923
|
+
}
|
|
1924
|
+
}
|
|
1925
|
+
};
|
|
1926
|
+
};
|
|
1927
|
+
})(), E = (r)=>{
|
|
1928
|
+
let e;
|
|
1929
|
+
return (n)=>(e || (e = v(r())), e(n));
|
|
1930
|
+
}, v = Y((r)=>{
|
|
1931
|
+
if (d(r)) return Q(r) ? E(r) : r;
|
|
1932
|
+
if (b(r) || X(r)) return i(r);
|
|
1933
|
+
if (A(r)) return x(r);
|
|
1934
|
+
if (K(r)) return l(Object.values(r));
|
|
1935
|
+
throw new Error("Invalid rule");
|
|
1936
|
+
}), P = "abcdefghijklmnopqrstuvwxyz", ir = (r)=>{
|
|
1937
|
+
let e = "";
|
|
1938
|
+
for(; r > 0;){
|
|
1939
|
+
const n = (r - 1) % 26;
|
|
1940
|
+
e = P[n] + e, r = Math.floor((r - 1) / 26);
|
|
1941
|
+
}
|
|
1942
|
+
return e;
|
|
1943
|
+
}, O = (r)=>{
|
|
1944
|
+
let e = 0;
|
|
1945
|
+
for(let n = 0, a = r.length; n < a; n++)e = 26 * e + P.indexOf(r[n]) + 1;
|
|
1946
|
+
return e;
|
|
1947
|
+
}, S = (r, e)=>{
|
|
1948
|
+
if (e < r) return S(e, r);
|
|
1949
|
+
const n = [];
|
|
1950
|
+
for(; r <= e;)n.push(r++);
|
|
1951
|
+
return n;
|
|
1952
|
+
}, or = (r, e, n)=>S(r, e).map((a)=>String(a).padStart(n, "0")), R = (r, e)=>S(O(r), O(e)).map(ir), p = (r)=>r, z = (r)=>ur((e)=>rr(e, r, {
|
|
1953
|
+
memoization: false
|
|
1954
|
+
}).join("")), ur = (r)=>{
|
|
1955
|
+
const e = {};
|
|
1956
|
+
return (n)=>e[n] ?? (e[n] = r(n));
|
|
1957
|
+
}, sr = i(/^\*\*\/\*$/, ".*"), cr = i(/^\*\*\/(\*)?([ a-zA-Z0-9._-]+)$/, (r, e, n)=>`.*${e ? "" : "(?:^|/)"}${n.replaceAll(".", "\\.")}`), lr = i(/^\*\*\/(\*)?([ a-zA-Z0-9._-]*)\{([ a-zA-Z0-9._-]+(?:,[ a-zA-Z0-9._-]+)*)\}$/, (r, e, n, a)=>`.*${e ? "" : "(?:^|/)"}${n.replaceAll(".", "\\.")}(?:${a.replaceAll(",", "|").replaceAll(".", "\\.")})`), y = i(/\\./, p), pr = i(/[$.*+?^(){}[\]\|]/, (r)=>`\\${r}`), vr = i(/./, p), hr = i(/^(?:!!)*!(.*)$/, (r, e)=>`(?!^${L(e)}$).*?`), dr = i(/^(!!)+/, ""), fr = l([
|
|
1958
|
+
hr,
|
|
1959
|
+
dr
|
|
1960
|
+
]), xr = i(/\/(\*\*\/)+/, "(?:/.+/|/)"), gr = i(/^(\*\*\/)+/, "(?:^|.*/)"), mr = i(/\/(\*\*)$/, "(?:/.*|$)"), _r = i(/\*\*/, ".*"), j = l([
|
|
1961
|
+
xr,
|
|
1962
|
+
gr,
|
|
1963
|
+
mr,
|
|
1964
|
+
_r
|
|
1965
|
+
]), Sr = i(/\*\/(?!\*\*\/)/, "[^/]*/"), yr = i(/\*/, "[^/]*"), N = l([
|
|
1966
|
+
Sr,
|
|
1967
|
+
yr
|
|
1968
|
+
]), k = i("?", "[^/]"), $r = i("[", p), wr = i("]", p), Ar = i(/[!^]/, "^/"), br = i(/[a-z]-[a-z]|[0-9]-[0-9]/i, p), Cr = i(/[$.*+?^(){}[\|]/, (r)=>`\\${r}`), Mr = i(/[^\]]/, p), Er = l([
|
|
1969
|
+
y,
|
|
1970
|
+
Cr,
|
|
1971
|
+
br,
|
|
1972
|
+
Mr
|
|
1973
|
+
]), B = x([
|
|
1974
|
+
$r,
|
|
1975
|
+
tr(Ar),
|
|
1976
|
+
f(Er),
|
|
1977
|
+
wr
|
|
1978
|
+
]), Pr = i("{", "(?:"), Or = i("}", ")"), Rr = i(/(\d+)\.\.(\d+)/, (r, e, n)=>or(+e, +n, Math.min(e.length, n.length)).join("|")), zr = i(/([a-z]+)\.\.([a-z]+)/, (r, e, n)=>R(e, n).join("|")), jr = i(/([A-Z]+)\.\.([A-Z]+)/, (r, e, n)=>R(e.toLowerCase(), n.toLowerCase()).join("|").toUpperCase()), Nr = l([
|
|
1979
|
+
Rr,
|
|
1980
|
+
zr,
|
|
1981
|
+
jr
|
|
1982
|
+
]), I = x([
|
|
1983
|
+
Pr,
|
|
1984
|
+
Nr,
|
|
1985
|
+
Or
|
|
1986
|
+
]), kr = i("{", "(?:"), Br = i("}", ")"), Ir = i(",", "|"), Fr = i(/[$.*+?^(){[\]\|]/, (r)=>`\\${r}`), Lr = i(/[^}]/, p), Zr = E(()=>F), Dr = l([
|
|
1987
|
+
j,
|
|
1988
|
+
N,
|
|
1989
|
+
k,
|
|
1990
|
+
B,
|
|
1991
|
+
I,
|
|
1992
|
+
Zr,
|
|
1993
|
+
y,
|
|
1994
|
+
Fr,
|
|
1995
|
+
Ir,
|
|
1996
|
+
Lr
|
|
1997
|
+
]), F = x([
|
|
1998
|
+
kr,
|
|
1999
|
+
f(Dr),
|
|
2000
|
+
Br
|
|
2001
|
+
]), Ur = f(l([
|
|
2002
|
+
sr,
|
|
2003
|
+
cr,
|
|
2004
|
+
lr,
|
|
2005
|
+
fr,
|
|
2006
|
+
j,
|
|
2007
|
+
N,
|
|
2008
|
+
k,
|
|
2009
|
+
B,
|
|
2010
|
+
I,
|
|
2011
|
+
F,
|
|
2012
|
+
y,
|
|
2013
|
+
pr,
|
|
2014
|
+
vr
|
|
2015
|
+
])), Vr = Ur, Gr = z(Vr), L = Gr, Tr = i(/\\./, p), qr = i(/./, p), Hr = i(/\*\*\*+/, "*"), Jr = i(/([^/{[(!])\*\*/, (r, e)=>`${e}*`), Qr = i(/(^|.)\*\*(?=[^*/)\]}])/, (r, e)=>`${e}*`), Wr = f(l([
|
|
2016
|
+
Tr,
|
|
2017
|
+
Hr,
|
|
2018
|
+
Jr,
|
|
2019
|
+
Qr,
|
|
2020
|
+
qr
|
|
2021
|
+
])), Kr = Wr, Xr = z(Kr), Yr = Xr, $ = (r, e)=>{
|
|
2022
|
+
const n = Array.isArray(r) ? r : [
|
|
2023
|
+
r
|
|
2024
|
+
];
|
|
2025
|
+
if (!n.length) return false;
|
|
2026
|
+
const a = n.map($.compile), t = n.every((s)=>/(\/(?:\*\*)?|\[\/\])$/.test(s)), o = e.replace(/[\\\/]+/g, "/").replace(/\/$/, t ? "/" : "");
|
|
2027
|
+
return a.some((s)=>s.test(o));
|
|
2028
|
+
};
|
|
2029
|
+
$.compile = (r)=>new RegExp(`^${L(Yr(r))}$`, "s");
|
|
2030
|
+
var re = $;
|
|
2031
|
+
return J(w);
|
|
2032
|
+
})();
|
|
2033
|
+
return __lib__.default || __lib__;
|
|
2034
|
+
};
|
|
2035
|
+
let _match;
|
|
2036
|
+
const zeptomatch = (path, pattern)=>{
|
|
2037
|
+
if (!_match) {
|
|
2038
|
+
_match = _lazyMatch();
|
|
2039
|
+
_lazyMatch = null;
|
|
2040
|
+
}
|
|
2041
|
+
return _match(path, pattern);
|
|
2042
|
+
};
|
|
2043
|
+
const _DRIVE_LETTER_START_RE = /^[A-Za-z]:\//;
|
|
2044
|
+
function normalizeWindowsPath(input = "") {
|
|
2045
|
+
if (!input) return input;
|
|
2046
|
+
return input.replace(/\\/g, "/").replace(_DRIVE_LETTER_START_RE, (r)=>r.toUpperCase());
|
|
2047
|
+
}
|
|
2048
|
+
const _UNC_REGEX = /^[/\\]{2}/;
|
|
2049
|
+
const _IS_ABSOLUTE_RE = /^[/\\](?![/\\])|^[/\\]{2}(?!\.)|^[A-Za-z]:[/\\]/;
|
|
2050
|
+
const _DRIVE_LETTER_RE = /^[A-Za-z]:$/;
|
|
2051
|
+
const _ROOT_FOLDER_RE = /^\/([A-Za-z]:)?$/;
|
|
2052
|
+
const _EXTNAME_RE = /.(\.[^./]+|\.)$/;
|
|
2053
|
+
const _PATH_ROOT_RE = /^[/\\]|^[a-zA-Z]:[/\\]/;
|
|
2054
|
+
const sep = "/";
|
|
2055
|
+
const normalize = function(path) {
|
|
2056
|
+
if (0 === path.length) return ".";
|
|
2057
|
+
path = normalizeWindowsPath(path);
|
|
2058
|
+
const isUNCPath = path.match(_UNC_REGEX);
|
|
2059
|
+
const isPathAbsolute = isAbsolute(path);
|
|
2060
|
+
const trailingSeparator = "/" === path[path.length - 1];
|
|
2061
|
+
path = normalizeString(path, !isPathAbsolute);
|
|
2062
|
+
if (0 === path.length) {
|
|
2063
|
+
if (isPathAbsolute) return "/";
|
|
2064
|
+
return trailingSeparator ? "./" : ".";
|
|
2065
|
+
}
|
|
2066
|
+
if (trailingSeparator) path += "/";
|
|
2067
|
+
if (_DRIVE_LETTER_RE.test(path)) path += "/";
|
|
2068
|
+
if (isUNCPath) {
|
|
2069
|
+
if (!isPathAbsolute) return `//./${path}`;
|
|
2070
|
+
return `//${path}`;
|
|
2071
|
+
}
|
|
2072
|
+
return isPathAbsolute && !isAbsolute(path) ? `/${path}` : path;
|
|
2073
|
+
};
|
|
2074
|
+
const join = function(...segments) {
|
|
2075
|
+
let path = "";
|
|
2076
|
+
for (const seg of segments)if (seg) if (path.length > 0) {
|
|
2077
|
+
const pathTrailing = "/" === path[path.length - 1];
|
|
2078
|
+
const segLeading = "/" === seg[0];
|
|
2079
|
+
const both = pathTrailing && segLeading;
|
|
2080
|
+
if (both) path += seg.slice(1);
|
|
2081
|
+
else path += pathTrailing || segLeading ? seg : `/${seg}`;
|
|
2082
|
+
} else path += seg;
|
|
2083
|
+
return normalize(path);
|
|
2084
|
+
};
|
|
2085
|
+
function pathe_M_eThtNZ_cwd() {
|
|
2086
|
+
if ("undefined" != typeof process && "function" == typeof process.cwd) return process.cwd().replace(/\\/g, "/");
|
|
2087
|
+
return "/";
|
|
2088
|
+
}
|
|
2089
|
+
const resolve = function(...arguments_) {
|
|
2090
|
+
arguments_ = arguments_.map((argument)=>normalizeWindowsPath(argument));
|
|
2091
|
+
let resolvedPath = "";
|
|
2092
|
+
let resolvedAbsolute = false;
|
|
2093
|
+
for(let index = arguments_.length - 1; index >= -1 && !resolvedAbsolute; index--){
|
|
2094
|
+
const path = index >= 0 ? arguments_[index] : pathe_M_eThtNZ_cwd();
|
|
2095
|
+
if (path && 0 !== path.length) {
|
|
2096
|
+
resolvedPath = `${path}/${resolvedPath}`;
|
|
2097
|
+
resolvedAbsolute = isAbsolute(path);
|
|
2098
|
+
}
|
|
2099
|
+
}
|
|
2100
|
+
resolvedPath = normalizeString(resolvedPath, !resolvedAbsolute);
|
|
2101
|
+
if (resolvedAbsolute && !isAbsolute(resolvedPath)) return `/${resolvedPath}`;
|
|
2102
|
+
return resolvedPath.length > 0 ? resolvedPath : ".";
|
|
2103
|
+
};
|
|
2104
|
+
function normalizeString(path, allowAboveRoot) {
|
|
2105
|
+
let res = "";
|
|
2106
|
+
let lastSegmentLength = 0;
|
|
2107
|
+
let lastSlash = -1;
|
|
2108
|
+
let dots = 0;
|
|
2109
|
+
let char = null;
|
|
2110
|
+
for(let index = 0; index <= path.length; ++index){
|
|
2111
|
+
if (index < path.length) char = path[index];
|
|
2112
|
+
else if ("/" === char) break;
|
|
2113
|
+
else char = "/";
|
|
2114
|
+
if ("/" === char) {
|
|
2115
|
+
if (lastSlash === index - 1 || 1 === dots) ;
|
|
2116
|
+
else if (2 === dots) {
|
|
2117
|
+
if (res.length < 2 || 2 !== lastSegmentLength || "." !== res[res.length - 1] || "." !== res[res.length - 2]) {
|
|
2118
|
+
if (res.length > 2) {
|
|
2119
|
+
const lastSlashIndex = res.lastIndexOf("/");
|
|
2120
|
+
if (-1 === lastSlashIndex) {
|
|
2121
|
+
res = "";
|
|
2122
|
+
lastSegmentLength = 0;
|
|
2123
|
+
} else {
|
|
2124
|
+
res = res.slice(0, lastSlashIndex);
|
|
2125
|
+
lastSegmentLength = res.length - 1 - res.lastIndexOf("/");
|
|
2126
|
+
}
|
|
2127
|
+
lastSlash = index;
|
|
2128
|
+
dots = 0;
|
|
2129
|
+
continue;
|
|
2130
|
+
} else if (res.length > 0) {
|
|
2131
|
+
res = "";
|
|
2132
|
+
lastSegmentLength = 0;
|
|
2133
|
+
lastSlash = index;
|
|
2134
|
+
dots = 0;
|
|
2135
|
+
continue;
|
|
2136
|
+
}
|
|
2137
|
+
}
|
|
2138
|
+
if (allowAboveRoot) {
|
|
2139
|
+
res += res.length > 0 ? "/.." : "..";
|
|
2140
|
+
lastSegmentLength = 2;
|
|
2141
|
+
}
|
|
2142
|
+
} else {
|
|
2143
|
+
if (res.length > 0) res += `/${path.slice(lastSlash + 1, index)}`;
|
|
2144
|
+
else res = path.slice(lastSlash + 1, index);
|
|
2145
|
+
lastSegmentLength = index - lastSlash - 1;
|
|
2146
|
+
}
|
|
2147
|
+
lastSlash = index;
|
|
2148
|
+
dots = 0;
|
|
2149
|
+
} else if ("." === char && -1 !== dots) ++dots;
|
|
2150
|
+
else dots = -1;
|
|
2151
|
+
}
|
|
2152
|
+
return res;
|
|
2153
|
+
}
|
|
2154
|
+
const isAbsolute = function(p) {
|
|
2155
|
+
return _IS_ABSOLUTE_RE.test(p);
|
|
2156
|
+
};
|
|
2157
|
+
const toNamespacedPath = function(p) {
|
|
2158
|
+
return normalizeWindowsPath(p);
|
|
2159
|
+
};
|
|
2160
|
+
const extname = function(p) {
|
|
2161
|
+
if (".." === p) return "";
|
|
2162
|
+
const match = _EXTNAME_RE.exec(normalizeWindowsPath(p));
|
|
2163
|
+
return match && match[1] || "";
|
|
2164
|
+
};
|
|
2165
|
+
const pathe_M_eThtNZ_relative = function(from, to) {
|
|
2166
|
+
const _from = resolve(from).replace(_ROOT_FOLDER_RE, "$1").split("/");
|
|
2167
|
+
const _to = resolve(to).replace(_ROOT_FOLDER_RE, "$1").split("/");
|
|
2168
|
+
if (":" === _to[0][1] && ":" === _from[0][1] && _from[0] !== _to[0]) return _to.join("/");
|
|
2169
|
+
const _fromCopy = [
|
|
2170
|
+
..._from
|
|
2171
|
+
];
|
|
2172
|
+
for (const segment of _fromCopy){
|
|
2173
|
+
if (_to[0] !== segment) break;
|
|
2174
|
+
_from.shift();
|
|
2175
|
+
_to.shift();
|
|
2176
|
+
}
|
|
2177
|
+
return [
|
|
2178
|
+
..._from.map(()=>".."),
|
|
2179
|
+
..._to
|
|
2180
|
+
].join("/");
|
|
2181
|
+
};
|
|
2182
|
+
const dirname = function(p) {
|
|
2183
|
+
const segments = normalizeWindowsPath(p).replace(/\/$/, "").split("/").slice(0, -1);
|
|
2184
|
+
if (1 === segments.length && _DRIVE_LETTER_RE.test(segments[0])) segments[0] += "/";
|
|
2185
|
+
return segments.join("/") || (isAbsolute(p) ? "/" : ".");
|
|
2186
|
+
};
|
|
2187
|
+
const pathe_M_eThtNZ_format = function(p) {
|
|
2188
|
+
const ext = p.ext ? p.ext.startsWith(".") ? p.ext : `.${p.ext}` : "";
|
|
2189
|
+
const segments = [
|
|
2190
|
+
p.root,
|
|
2191
|
+
p.dir,
|
|
2192
|
+
p.base ?? (p.name ?? "") + ext
|
|
2193
|
+
].filter(Boolean);
|
|
2194
|
+
return normalizeWindowsPath(p.root ? resolve(...segments) : segments.join("/"));
|
|
2195
|
+
};
|
|
2196
|
+
const basename = function(p, extension) {
|
|
2197
|
+
const segments = normalizeWindowsPath(p).split("/");
|
|
2198
|
+
let lastSegment = "";
|
|
2199
|
+
for(let i = segments.length - 1; i >= 0; i--){
|
|
2200
|
+
const val = segments[i];
|
|
2201
|
+
if (val) {
|
|
2202
|
+
lastSegment = val;
|
|
2203
|
+
break;
|
|
2204
|
+
}
|
|
2205
|
+
}
|
|
2206
|
+
return extension && lastSegment.endsWith(extension) ? lastSegment.slice(0, -extension.length) : lastSegment;
|
|
2207
|
+
};
|
|
2208
|
+
const parse = function(p) {
|
|
2209
|
+
const root = _PATH_ROOT_RE.exec(p)?.[0]?.replace(/\\/g, "/") || "";
|
|
2210
|
+
const base = basename(p);
|
|
2211
|
+
const extension = extname(base);
|
|
2212
|
+
return {
|
|
2213
|
+
root,
|
|
2214
|
+
dir: dirname(p),
|
|
2215
|
+
base,
|
|
2216
|
+
ext: extension,
|
|
2217
|
+
name: base.slice(0, base.length - extension.length)
|
|
2218
|
+
};
|
|
2219
|
+
};
|
|
2220
|
+
const matchesGlob = (path, pattern)=>zeptomatch(pattern, normalize(path));
|
|
2221
|
+
const _path = {
|
|
2222
|
+
__proto__: null,
|
|
2223
|
+
basename: basename,
|
|
2224
|
+
dirname: dirname,
|
|
2225
|
+
extname: extname,
|
|
2226
|
+
format: pathe_M_eThtNZ_format,
|
|
2227
|
+
isAbsolute: isAbsolute,
|
|
2228
|
+
join: join,
|
|
2229
|
+
matchesGlob: matchesGlob,
|
|
2230
|
+
normalize: normalize,
|
|
2231
|
+
normalizeString: normalizeString,
|
|
2232
|
+
parse: parse,
|
|
2233
|
+
relative: pathe_M_eThtNZ_relative,
|
|
2234
|
+
resolve: resolve,
|
|
2235
|
+
sep: sep,
|
|
2236
|
+
toNamespacedPath: toNamespacedPath
|
|
2237
|
+
};
|
|
2238
|
+
const formatRootStr = (rootStr, root)=>rootStr.replace('<rootDir>', normalize(root));
|
|
2239
|
+
function getAbsolutePath(base, filepath) {
|
|
2240
|
+
return isAbsolute(filepath) ? filepath : join(base, filepath);
|
|
2241
|
+
}
|
|
2242
|
+
const parsePosix = (filePath)=>{
|
|
2243
|
+
const { dir, base } = parse(filePath);
|
|
2244
|
+
return {
|
|
2245
|
+
dir: dir.split("/").join('/'),
|
|
2246
|
+
base
|
|
2247
|
+
};
|
|
2248
|
+
};
|
|
2249
|
+
const isObject = (obj)=>'[object Object]' === Object.prototype.toString.call(obj);
|
|
2250
|
+
const castArray = (arr)=>{
|
|
2251
|
+
if (void 0 === arr) return [];
|
|
2252
|
+
return Array.isArray(arr) ? arr : [
|
|
2253
|
+
arr
|
|
2254
|
+
];
|
|
2255
|
+
};
|
|
2256
|
+
const isPlainObject = (obj)=>null !== obj && 'object' == typeof obj && Object.getPrototypeOf(obj) === Object.prototype;
|
|
2257
|
+
function formatError(error) {
|
|
2258
|
+
if ('string' == typeof error || error instanceof Error) return error;
|
|
2259
|
+
if (isPlainObject(error) && error.message) {
|
|
2260
|
+
const e = new Error(error.name || 'unknown error');
|
|
2261
|
+
e.message = error.message;
|
|
2262
|
+
e.stack = error.stack;
|
|
2263
|
+
return e;
|
|
2264
|
+
}
|
|
2265
|
+
return String(error);
|
|
2266
|
+
}
|
|
2267
|
+
const prettyTime = (milliseconds)=>{
|
|
2268
|
+
if (milliseconds < 1000) return `${Math.round(milliseconds)}ms`;
|
|
2269
|
+
const seconds = milliseconds / 1000;
|
|
2270
|
+
const getSecond = (seconds, needDigits)=>{
|
|
2271
|
+
if (!needDigits || seconds === Math.ceil(seconds)) return `${Math.round(seconds).toString()}s`;
|
|
2272
|
+
const digits = seconds < 10 ? seconds >= 0.01 ? 2 : 3 : 1;
|
|
2273
|
+
return `${seconds.toFixed(digits)}s`;
|
|
2274
|
+
};
|
|
2275
|
+
const minutes = Math.floor(seconds / 60);
|
|
2276
|
+
const secondsRemainder = seconds % 60;
|
|
2277
|
+
let time = '';
|
|
2278
|
+
if (minutes > 0) time += `${minutes}m`;
|
|
2279
|
+
if (secondsRemainder > 0) {
|
|
2280
|
+
if (minutes > 0) time += ' ';
|
|
2281
|
+
time += getSecond(secondsRemainder, !minutes);
|
|
2282
|
+
}
|
|
2283
|
+
return time;
|
|
2284
|
+
};
|
|
2285
|
+
const getTaskNames = (test)=>(test.parentNames || []).concat(test.name).filter(Boolean);
|
|
2286
|
+
const getTaskNameWithPrefix = (test, delimiter = ">")=>getTaskNames(test).join(` ${delimiter} `);
|
|
2287
|
+
const REGEXP_FLAG_PREFIX = 'RSTEST_REGEXP:';
|
|
2288
|
+
const wrapRegex = (value)=>`${REGEXP_FLAG_PREFIX}${value.toString()}`;
|
|
2289
|
+
const unwrapRegex = (value)=>{
|
|
2290
|
+
if (value.startsWith(REGEXP_FLAG_PREFIX)) {
|
|
2291
|
+
const regexStr = value.slice(REGEXP_FLAG_PREFIX.length);
|
|
2292
|
+
const matches = regexStr.match(/^\/(.+)\/([gimuy]*)$/);
|
|
2293
|
+
if (matches) {
|
|
2294
|
+
const [, pattern, flags] = matches;
|
|
2295
|
+
return new RegExp(pattern, flags);
|
|
2296
|
+
}
|
|
2297
|
+
}
|
|
2298
|
+
return value;
|
|
2299
|
+
};
|
|
2300
|
+
const serializableConfig = (normalizedConfig)=>{
|
|
2301
|
+
const { testNamePattern } = normalizedConfig;
|
|
2302
|
+
return {
|
|
2303
|
+
...normalizedConfig,
|
|
2304
|
+
testNamePattern: testNamePattern && 'string' != typeof testNamePattern ? wrapRegex(testNamePattern) : testNamePattern
|
|
2305
|
+
};
|
|
2306
|
+
};
|
|
2307
|
+
const undoSerializableConfig = (normalizedConfig)=>{
|
|
2308
|
+
const { testNamePattern } = normalizedConfig;
|
|
2309
|
+
return {
|
|
2310
|
+
...normalizedConfig,
|
|
2311
|
+
testNamePattern: testNamePattern && 'string' == typeof testNamePattern ? unwrapRegex(testNamePattern) : testNamePattern
|
|
2312
|
+
};
|
|
2313
|
+
};
|
|
2314
|
+
const getNodeVersion = ()=>{
|
|
2315
|
+
if ('string' == typeof process.versions?.node) {
|
|
2316
|
+
const [major = 0, minor = 0, patch = 0] = process.versions.node.split('.').map(Number);
|
|
2317
|
+
return {
|
|
2318
|
+
major,
|
|
2319
|
+
minor,
|
|
2320
|
+
patch
|
|
2321
|
+
};
|
|
2322
|
+
}
|
|
2323
|
+
return {
|
|
2324
|
+
major: 0,
|
|
2325
|
+
minor: 0,
|
|
2326
|
+
patch: 0
|
|
2327
|
+
};
|
|
2328
|
+
};
|
|
2329
|
+
const needFlagExperimentalDetectModule = ()=>{
|
|
2330
|
+
const { major, minor } = getNodeVersion();
|
|
2331
|
+
if (20 === major && minor >= 10) return true;
|
|
2332
|
+
if (22 === major && minor < 7) return true;
|
|
2333
|
+
return false;
|
|
2334
|
+
};
|
|
2335
|
+
const ADDITIONAL_NODE_BUILTINS = [
|
|
2336
|
+
/^node:/,
|
|
2337
|
+
'pnpapi'
|
|
2338
|
+
];
|
|
2339
|
+
const isTTY = (type = 'stdout')=>('stdin' === type ? process.stdin.isTTY : process.stdout.isTTY) && !process.env.CI;
|
|
2340
|
+
const external_node_path_ = __webpack_require__("node:path");
|
|
2341
|
+
const external_node_fs_ = __webpack_require__("node:fs");
|
|
2342
|
+
var __require = /* @__PURE__ */ createRequire(import.meta.url);
|
|
2343
|
+
function cleanPath(path) {
|
|
2344
|
+
let normalized = (0, external_node_path_.normalize)(path);
|
|
2345
|
+
if (normalized.length > 1 && normalized[normalized.length - 1] === external_node_path_.sep) normalized = normalized.substring(0, normalized.length - 1);
|
|
2346
|
+
return normalized;
|
|
2347
|
+
}
|
|
2348
|
+
const SLASHES_REGEX = /[\\/]/g;
|
|
2349
|
+
function convertSlashes(path, separator) {
|
|
2350
|
+
return path.replace(SLASHES_REGEX, separator);
|
|
2351
|
+
}
|
|
2352
|
+
const WINDOWS_ROOT_DIR_REGEX = /^[a-z]:[\\/]$/i;
|
|
2353
|
+
function isRootDirectory(path) {
|
|
2354
|
+
return "/" === path || WINDOWS_ROOT_DIR_REGEX.test(path);
|
|
2355
|
+
}
|
|
2356
|
+
function normalizePath(path, options) {
|
|
2357
|
+
const { resolvePaths, normalizePath: normalizePath$1, pathSeparator } = options;
|
|
2358
|
+
const pathNeedsCleaning = "win32" === process.platform && path.includes("/") || path.startsWith(".");
|
|
2359
|
+
if (resolvePaths) path = (0, external_node_path_.resolve)(path);
|
|
2360
|
+
if (normalizePath$1 || pathNeedsCleaning) path = cleanPath(path);
|
|
2361
|
+
if ("." === path) return "";
|
|
2362
|
+
const needsSeperator = path[path.length - 1] !== pathSeparator;
|
|
2363
|
+
return convertSlashes(needsSeperator ? path + pathSeparator : path, pathSeparator);
|
|
2364
|
+
}
|
|
2365
|
+
function joinPathWithBasePath(filename, directoryPath) {
|
|
2366
|
+
return directoryPath + filename;
|
|
2367
|
+
}
|
|
2368
|
+
function joinPathWithRelativePath(root, options) {
|
|
2369
|
+
return function(filename, directoryPath) {
|
|
2370
|
+
const sameRoot = directoryPath.startsWith(root);
|
|
2371
|
+
if (sameRoot) return directoryPath.slice(root.length) + filename;
|
|
2372
|
+
return convertSlashes((0, external_node_path_.relative)(root, directoryPath), options.pathSeparator) + options.pathSeparator + filename;
|
|
2373
|
+
};
|
|
2374
|
+
}
|
|
2375
|
+
function joinPath(filename) {
|
|
2376
|
+
return filename;
|
|
2377
|
+
}
|
|
2378
|
+
function joinDirectoryPath(filename, directoryPath, separator) {
|
|
2379
|
+
return directoryPath + filename + separator;
|
|
2380
|
+
}
|
|
2381
|
+
function build$7(root, options) {
|
|
2382
|
+
const { relativePaths, includeBasePath } = options;
|
|
2383
|
+
return relativePaths && root ? joinPathWithRelativePath(root, options) : includeBasePath ? joinPathWithBasePath : joinPath;
|
|
2384
|
+
}
|
|
2385
|
+
function pushDirectoryWithRelativePath(root) {
|
|
2386
|
+
return function(directoryPath, paths) {
|
|
2387
|
+
paths.push(directoryPath.substring(root.length) || ".");
|
|
2388
|
+
};
|
|
2389
|
+
}
|
|
2390
|
+
function pushDirectoryFilterWithRelativePath(root) {
|
|
2391
|
+
return function(directoryPath, paths, filters) {
|
|
2392
|
+
const relativePath = directoryPath.substring(root.length) || ".";
|
|
2393
|
+
if (filters.every((filter)=>filter(relativePath, true))) paths.push(relativePath);
|
|
2394
|
+
};
|
|
2395
|
+
}
|
|
2396
|
+
const pushDirectory = (directoryPath, paths)=>{
|
|
2397
|
+
paths.push(directoryPath || ".");
|
|
2398
|
+
};
|
|
2399
|
+
const pushDirectoryFilter = (directoryPath, paths, filters)=>{
|
|
2400
|
+
const path = directoryPath || ".";
|
|
2401
|
+
if (filters.every((filter)=>filter(path, true))) paths.push(path);
|
|
2402
|
+
};
|
|
2403
|
+
const empty$2 = ()=>{};
|
|
2404
|
+
function build$6(root, options) {
|
|
2405
|
+
const { includeDirs, filters, relativePaths } = options;
|
|
2406
|
+
if (!includeDirs) return empty$2;
|
|
2407
|
+
if (relativePaths) return filters && filters.length ? pushDirectoryFilterWithRelativePath(root) : pushDirectoryWithRelativePath(root);
|
|
2408
|
+
return filters && filters.length ? pushDirectoryFilter : pushDirectory;
|
|
2409
|
+
}
|
|
2410
|
+
const pushFileFilterAndCount = (filename, _paths, counts, filters)=>{
|
|
2411
|
+
if (filters.every((filter)=>filter(filename, false))) counts.files++;
|
|
2412
|
+
};
|
|
2413
|
+
const pushFileFilter = (filename, paths, _counts, filters)=>{
|
|
2414
|
+
if (filters.every((filter)=>filter(filename, false))) paths.push(filename);
|
|
2415
|
+
};
|
|
2416
|
+
const pushFileCount = (_filename, _paths, counts, _filters)=>{
|
|
2417
|
+
counts.files++;
|
|
2418
|
+
};
|
|
2419
|
+
const pushFile = (filename, paths)=>{
|
|
2420
|
+
paths.push(filename);
|
|
2421
|
+
};
|
|
2422
|
+
const empty$1 = ()=>{};
|
|
2423
|
+
function build$5(options) {
|
|
2424
|
+
const { excludeFiles, filters, onlyCounts } = options;
|
|
2425
|
+
if (excludeFiles) return empty$1;
|
|
2426
|
+
if (filters && filters.length) return onlyCounts ? pushFileFilterAndCount : pushFileFilter;
|
|
2427
|
+
if (onlyCounts) return pushFileCount;
|
|
2428
|
+
return pushFile;
|
|
2429
|
+
}
|
|
2430
|
+
const getArray = (paths)=>paths;
|
|
2431
|
+
const getArrayGroup = ()=>[
|
|
2432
|
+
""
|
|
2433
|
+
].slice(0, 0);
|
|
2434
|
+
function build$4(options) {
|
|
2435
|
+
return options.group ? getArrayGroup : getArray;
|
|
2436
|
+
}
|
|
2437
|
+
const groupFiles = (groups, directory, files)=>{
|
|
2438
|
+
groups.push({
|
|
2439
|
+
directory,
|
|
2440
|
+
files,
|
|
2441
|
+
dir: directory
|
|
2442
|
+
});
|
|
2443
|
+
};
|
|
2444
|
+
const empty = ()=>{};
|
|
2445
|
+
function build$3(options) {
|
|
2446
|
+
return options.group ? groupFiles : empty;
|
|
2447
|
+
}
|
|
2448
|
+
const resolveSymlinksAsync = function(path, state, callback$1) {
|
|
2449
|
+
const { queue, fs, options: { suppressErrors } } = state;
|
|
2450
|
+
queue.enqueue();
|
|
2451
|
+
fs.realpath(path, (error, resolvedPath)=>{
|
|
2452
|
+
if (error) return queue.dequeue(suppressErrors ? null : error, state);
|
|
2453
|
+
fs.stat(resolvedPath, (error$1, stat)=>{
|
|
2454
|
+
if (error$1) return queue.dequeue(suppressErrors ? null : error$1, state);
|
|
2455
|
+
if (stat.isDirectory() && isRecursive(path, resolvedPath, state)) return queue.dequeue(null, state);
|
|
2456
|
+
callback$1(stat, resolvedPath);
|
|
2457
|
+
queue.dequeue(null, state);
|
|
2458
|
+
});
|
|
2459
|
+
});
|
|
2460
|
+
};
|
|
2461
|
+
const resolveSymlinks = function(path, state, callback$1) {
|
|
2462
|
+
const { queue, fs, options: { suppressErrors } } = state;
|
|
2463
|
+
queue.enqueue();
|
|
2464
|
+
try {
|
|
2465
|
+
const resolvedPath = fs.realpathSync(path);
|
|
2466
|
+
const stat = fs.statSync(resolvedPath);
|
|
2467
|
+
if (stat.isDirectory() && isRecursive(path, resolvedPath, state)) return;
|
|
2468
|
+
callback$1(stat, resolvedPath);
|
|
2469
|
+
} catch (e) {
|
|
2470
|
+
if (!suppressErrors) throw e;
|
|
2471
|
+
}
|
|
2472
|
+
};
|
|
2473
|
+
function build$2(options, isSynchronous) {
|
|
2474
|
+
if (!options.resolveSymlinks || options.excludeSymlinks) return null;
|
|
2475
|
+
return isSynchronous ? resolveSymlinks : resolveSymlinksAsync;
|
|
2476
|
+
}
|
|
2477
|
+
function isRecursive(path, resolved, state) {
|
|
2478
|
+
if (state.options.useRealPaths) return isRecursiveUsingRealPaths(resolved, state);
|
|
2479
|
+
let parent = (0, external_node_path_.dirname)(path);
|
|
2480
|
+
let depth = 1;
|
|
2481
|
+
while(parent !== state.root && depth < 2){
|
|
2482
|
+
const resolvedPath = state.symlinks.get(parent);
|
|
2483
|
+
const isSameRoot = !!resolvedPath && (resolvedPath === resolved || resolvedPath.startsWith(resolved) || resolved.startsWith(resolvedPath));
|
|
2484
|
+
if (isSameRoot) depth++;
|
|
2485
|
+
else parent = (0, external_node_path_.dirname)(parent);
|
|
2486
|
+
}
|
|
2487
|
+
state.symlinks.set(path, resolved);
|
|
2488
|
+
return depth > 1;
|
|
2489
|
+
}
|
|
2490
|
+
function isRecursiveUsingRealPaths(resolved, state) {
|
|
2491
|
+
return state.visited.includes(resolved + state.options.pathSeparator);
|
|
2492
|
+
}
|
|
2493
|
+
const onlyCountsSync = (state)=>state.counts;
|
|
2494
|
+
const groupsSync = (state)=>state.groups;
|
|
2495
|
+
const defaultSync = (state)=>state.paths;
|
|
2496
|
+
const limitFilesSync = (state)=>state.paths.slice(0, state.options.maxFiles);
|
|
2497
|
+
const onlyCountsAsync = (state, error, callback$1)=>{
|
|
2498
|
+
report(error, callback$1, state.counts, state.options.suppressErrors);
|
|
2499
|
+
return null;
|
|
2500
|
+
};
|
|
2501
|
+
const defaultAsync = (state, error, callback$1)=>{
|
|
2502
|
+
report(error, callback$1, state.paths, state.options.suppressErrors);
|
|
2503
|
+
return null;
|
|
2504
|
+
};
|
|
2505
|
+
const limitFilesAsync = (state, error, callback$1)=>{
|
|
2506
|
+
report(error, callback$1, state.paths.slice(0, state.options.maxFiles), state.options.suppressErrors);
|
|
2507
|
+
return null;
|
|
2508
|
+
};
|
|
2509
|
+
const groupsAsync = (state, error, callback$1)=>{
|
|
2510
|
+
report(error, callback$1, state.groups, state.options.suppressErrors);
|
|
2511
|
+
return null;
|
|
2512
|
+
};
|
|
2513
|
+
function report(error, callback$1, output, suppressErrors) {
|
|
2514
|
+
callback$1(error && !suppressErrors ? error : null, output);
|
|
2515
|
+
}
|
|
2516
|
+
function build$1(options, isSynchronous) {
|
|
2517
|
+
const { onlyCounts, group, maxFiles } = options;
|
|
2518
|
+
if (onlyCounts) return isSynchronous ? onlyCountsSync : onlyCountsAsync;
|
|
2519
|
+
if (group) return isSynchronous ? groupsSync : groupsAsync;
|
|
2520
|
+
if (maxFiles) return isSynchronous ? limitFilesSync : limitFilesAsync;
|
|
2521
|
+
return isSynchronous ? defaultSync : defaultAsync;
|
|
2522
|
+
}
|
|
2523
|
+
const readdirOpts = {
|
|
2524
|
+
withFileTypes: true
|
|
2525
|
+
};
|
|
2526
|
+
const walkAsync = (state, crawlPath, directoryPath, currentDepth, callback$1)=>{
|
|
2527
|
+
state.queue.enqueue();
|
|
2528
|
+
if (currentDepth < 0) return state.queue.dequeue(null, state);
|
|
2529
|
+
const { fs } = state;
|
|
2530
|
+
state.visited.push(crawlPath);
|
|
2531
|
+
state.counts.directories++;
|
|
2532
|
+
fs.readdir(crawlPath || ".", readdirOpts, (error, entries = [])=>{
|
|
2533
|
+
callback$1(entries, directoryPath, currentDepth);
|
|
2534
|
+
state.queue.dequeue(state.options.suppressErrors ? null : error, state);
|
|
2535
|
+
});
|
|
2536
|
+
};
|
|
2537
|
+
const walkSync = (state, crawlPath, directoryPath, currentDepth, callback$1)=>{
|
|
2538
|
+
const { fs } = state;
|
|
2539
|
+
if (currentDepth < 0) return;
|
|
2540
|
+
state.visited.push(crawlPath);
|
|
2541
|
+
state.counts.directories++;
|
|
2542
|
+
let entries = [];
|
|
2543
|
+
try {
|
|
2544
|
+
entries = fs.readdirSync(crawlPath || ".", readdirOpts);
|
|
2545
|
+
} catch (e) {
|
|
2546
|
+
if (!state.options.suppressErrors) throw e;
|
|
2547
|
+
}
|
|
2548
|
+
callback$1(entries, directoryPath, currentDepth);
|
|
2549
|
+
};
|
|
2550
|
+
function build(isSynchronous) {
|
|
2551
|
+
return isSynchronous ? walkSync : walkAsync;
|
|
2552
|
+
}
|
|
2553
|
+
var Queue = class {
|
|
2554
|
+
count = 0;
|
|
2555
|
+
constructor(onQueueEmpty){
|
|
2556
|
+
this.onQueueEmpty = onQueueEmpty;
|
|
2557
|
+
}
|
|
2558
|
+
enqueue() {
|
|
2559
|
+
this.count++;
|
|
2560
|
+
return this.count;
|
|
2561
|
+
}
|
|
2562
|
+
dequeue(error, output) {
|
|
2563
|
+
if (this.onQueueEmpty && (--this.count <= 0 || error)) {
|
|
2564
|
+
this.onQueueEmpty(error, output);
|
|
2565
|
+
if (error) {
|
|
2566
|
+
output.controller.abort();
|
|
2567
|
+
this.onQueueEmpty = void 0;
|
|
2568
|
+
}
|
|
2569
|
+
}
|
|
2570
|
+
}
|
|
2571
|
+
};
|
|
2572
|
+
var Counter = class {
|
|
2573
|
+
_files = 0;
|
|
2574
|
+
_directories = 0;
|
|
2575
|
+
set files(num) {
|
|
2576
|
+
this._files = num;
|
|
2577
|
+
}
|
|
2578
|
+
get files() {
|
|
2579
|
+
return this._files;
|
|
2580
|
+
}
|
|
2581
|
+
set directories(num) {
|
|
2582
|
+
this._directories = num;
|
|
2583
|
+
}
|
|
2584
|
+
get directories() {
|
|
2585
|
+
return this._directories;
|
|
2586
|
+
}
|
|
2587
|
+
get dirs() {
|
|
2588
|
+
return this._directories;
|
|
2589
|
+
}
|
|
2590
|
+
};
|
|
2591
|
+
var Aborter = class {
|
|
2592
|
+
aborted = false;
|
|
2593
|
+
abort() {
|
|
2594
|
+
this.aborted = true;
|
|
2595
|
+
}
|
|
2596
|
+
};
|
|
2597
|
+
var Walker = class {
|
|
2598
|
+
root;
|
|
2599
|
+
isSynchronous;
|
|
2600
|
+
state;
|
|
2601
|
+
joinPath;
|
|
2602
|
+
pushDirectory;
|
|
2603
|
+
pushFile;
|
|
2604
|
+
getArray;
|
|
2605
|
+
groupFiles;
|
|
2606
|
+
resolveSymlink;
|
|
2607
|
+
walkDirectory;
|
|
2608
|
+
callbackInvoker;
|
|
2609
|
+
constructor(root, options, callback$1){
|
|
2610
|
+
this.isSynchronous = !callback$1;
|
|
2611
|
+
this.callbackInvoker = build$1(options, this.isSynchronous);
|
|
2612
|
+
this.root = normalizePath(root, options);
|
|
2613
|
+
this.state = {
|
|
2614
|
+
root: isRootDirectory(this.root) ? this.root : this.root.slice(0, -1),
|
|
2615
|
+
paths: [
|
|
2616
|
+
""
|
|
2617
|
+
].slice(0, 0),
|
|
2618
|
+
groups: [],
|
|
2619
|
+
counts: new Counter(),
|
|
2620
|
+
options,
|
|
2621
|
+
queue: new Queue((error, state)=>this.callbackInvoker(state, error, callback$1)),
|
|
2622
|
+
symlinks: /* @__PURE__ */ new Map(),
|
|
2623
|
+
visited: [
|
|
2624
|
+
""
|
|
2625
|
+
].slice(0, 0),
|
|
2626
|
+
controller: new Aborter(),
|
|
2627
|
+
fs: options.fs || external_node_fs_
|
|
2628
|
+
};
|
|
2629
|
+
this.joinPath = build$7(this.root, options);
|
|
2630
|
+
this.pushDirectory = build$6(this.root, options);
|
|
2631
|
+
this.pushFile = build$5(options);
|
|
2632
|
+
this.getArray = build$4(options);
|
|
2633
|
+
this.groupFiles = build$3(options);
|
|
2634
|
+
this.resolveSymlink = build$2(options, this.isSynchronous);
|
|
2635
|
+
this.walkDirectory = build(this.isSynchronous);
|
|
2636
|
+
}
|
|
2637
|
+
start() {
|
|
2638
|
+
this.pushDirectory(this.root, this.state.paths, this.state.options.filters);
|
|
2639
|
+
this.walkDirectory(this.state, this.root, this.root, this.state.options.maxDepth, this.walk);
|
|
2640
|
+
return this.isSynchronous ? this.callbackInvoker(this.state, null) : null;
|
|
2641
|
+
}
|
|
2642
|
+
walk = (entries, directoryPath, depth)=>{
|
|
2643
|
+
const { paths, options: { filters, resolveSymlinks: resolveSymlinks$1, excludeSymlinks, exclude, maxFiles, signal, useRealPaths, pathSeparator }, controller } = this.state;
|
|
2644
|
+
if (controller.aborted || signal && signal.aborted || maxFiles && paths.length > maxFiles) return;
|
|
2645
|
+
const files = this.getArray(this.state.paths);
|
|
2646
|
+
for(let i = 0; i < entries.length; ++i){
|
|
2647
|
+
const entry = entries[i];
|
|
2648
|
+
if (entry.isFile() || entry.isSymbolicLink() && !resolveSymlinks$1 && !excludeSymlinks) {
|
|
2649
|
+
const filename = this.joinPath(entry.name, directoryPath);
|
|
2650
|
+
this.pushFile(filename, files, this.state.counts, filters);
|
|
2651
|
+
} else if (entry.isDirectory()) {
|
|
2652
|
+
let path = joinDirectoryPath(entry.name, directoryPath, this.state.options.pathSeparator);
|
|
2653
|
+
if (exclude && exclude(entry.name, path)) continue;
|
|
2654
|
+
this.pushDirectory(path, paths, filters);
|
|
2655
|
+
this.walkDirectory(this.state, path, path, depth - 1, this.walk);
|
|
2656
|
+
} else if (this.resolveSymlink && entry.isSymbolicLink()) {
|
|
2657
|
+
let path = joinPathWithBasePath(entry.name, directoryPath);
|
|
2658
|
+
this.resolveSymlink(path, this.state, (stat, resolvedPath)=>{
|
|
2659
|
+
if (stat.isDirectory()) {
|
|
2660
|
+
resolvedPath = normalizePath(resolvedPath, this.state.options);
|
|
2661
|
+
if (exclude && exclude(entry.name, useRealPaths ? resolvedPath : path + pathSeparator)) return;
|
|
2662
|
+
this.walkDirectory(this.state, resolvedPath, useRealPaths ? resolvedPath : path + pathSeparator, depth - 1, this.walk);
|
|
2663
|
+
} else {
|
|
2664
|
+
resolvedPath = useRealPaths ? resolvedPath : path;
|
|
2665
|
+
const filename = (0, external_node_path_.basename)(resolvedPath);
|
|
2666
|
+
const directoryPath$1 = normalizePath((0, external_node_path_.dirname)(resolvedPath), this.state.options);
|
|
2667
|
+
resolvedPath = this.joinPath(filename, directoryPath$1);
|
|
2668
|
+
this.pushFile(resolvedPath, files, this.state.counts, filters);
|
|
2669
|
+
}
|
|
2670
|
+
});
|
|
2671
|
+
}
|
|
2672
|
+
}
|
|
2673
|
+
this.groupFiles(this.state.groups, directoryPath, files);
|
|
2674
|
+
};
|
|
2675
|
+
};
|
|
2676
|
+
function promise(root, options) {
|
|
2677
|
+
return new Promise((resolve$1, reject)=>{
|
|
2678
|
+
callback(root, options, (err, output)=>{
|
|
2679
|
+
if (err) return reject(err);
|
|
2680
|
+
resolve$1(output);
|
|
2681
|
+
});
|
|
2682
|
+
});
|
|
2683
|
+
}
|
|
2684
|
+
function callback(root, options, callback$1) {
|
|
2685
|
+
let walker = new Walker(root, options, callback$1);
|
|
2686
|
+
walker.start();
|
|
2687
|
+
}
|
|
2688
|
+
function sync(root, options) {
|
|
2689
|
+
const walker = new Walker(root, options);
|
|
2690
|
+
return walker.start();
|
|
2691
|
+
}
|
|
2692
|
+
var APIBuilder = class {
|
|
2693
|
+
constructor(root, options){
|
|
2694
|
+
this.root = root;
|
|
2695
|
+
this.options = options;
|
|
2696
|
+
}
|
|
2697
|
+
withPromise() {
|
|
2698
|
+
return promise(this.root, this.options);
|
|
2699
|
+
}
|
|
2700
|
+
withCallback(cb) {
|
|
2701
|
+
callback(this.root, this.options, cb);
|
|
2702
|
+
}
|
|
2703
|
+
sync() {
|
|
2704
|
+
return sync(this.root, this.options);
|
|
2705
|
+
}
|
|
2706
|
+
};
|
|
2707
|
+
let pm = null;
|
|
2708
|
+
try {
|
|
2709
|
+
__require.resolve("picomatch");
|
|
2710
|
+
pm = __require("picomatch");
|
|
2711
|
+
} catch {}
|
|
2712
|
+
var Builder = class {
|
|
2713
|
+
globCache = {};
|
|
2714
|
+
options = {
|
|
2715
|
+
maxDepth: 1 / 0,
|
|
2716
|
+
suppressErrors: true,
|
|
2717
|
+
pathSeparator: external_node_path_.sep,
|
|
2718
|
+
filters: []
|
|
2719
|
+
};
|
|
2720
|
+
globFunction;
|
|
2721
|
+
constructor(options){
|
|
2722
|
+
this.options = {
|
|
2723
|
+
...this.options,
|
|
2724
|
+
...options
|
|
2725
|
+
};
|
|
2726
|
+
this.globFunction = this.options.globFunction;
|
|
2727
|
+
}
|
|
2728
|
+
group() {
|
|
2729
|
+
this.options.group = true;
|
|
2730
|
+
return this;
|
|
2731
|
+
}
|
|
2732
|
+
withPathSeparator(separator) {
|
|
2733
|
+
this.options.pathSeparator = separator;
|
|
2734
|
+
return this;
|
|
2735
|
+
}
|
|
2736
|
+
withBasePath() {
|
|
2737
|
+
this.options.includeBasePath = true;
|
|
2738
|
+
return this;
|
|
2739
|
+
}
|
|
2740
|
+
withRelativePaths() {
|
|
2741
|
+
this.options.relativePaths = true;
|
|
2742
|
+
return this;
|
|
2743
|
+
}
|
|
2744
|
+
withDirs() {
|
|
2745
|
+
this.options.includeDirs = true;
|
|
2746
|
+
return this;
|
|
2747
|
+
}
|
|
2748
|
+
withMaxDepth(depth) {
|
|
2749
|
+
this.options.maxDepth = depth;
|
|
2750
|
+
return this;
|
|
2751
|
+
}
|
|
2752
|
+
withMaxFiles(limit) {
|
|
2753
|
+
this.options.maxFiles = limit;
|
|
2754
|
+
return this;
|
|
2755
|
+
}
|
|
2756
|
+
withFullPaths() {
|
|
2757
|
+
this.options.resolvePaths = true;
|
|
2758
|
+
this.options.includeBasePath = true;
|
|
2759
|
+
return this;
|
|
2760
|
+
}
|
|
2761
|
+
withErrors() {
|
|
2762
|
+
this.options.suppressErrors = false;
|
|
2763
|
+
return this;
|
|
2764
|
+
}
|
|
2765
|
+
withSymlinks({ resolvePaths = true } = {}) {
|
|
2766
|
+
this.options.resolveSymlinks = true;
|
|
2767
|
+
this.options.useRealPaths = resolvePaths;
|
|
2768
|
+
return this.withFullPaths();
|
|
2769
|
+
}
|
|
2770
|
+
withAbortSignal(signal) {
|
|
2771
|
+
this.options.signal = signal;
|
|
2772
|
+
return this;
|
|
2773
|
+
}
|
|
2774
|
+
normalize() {
|
|
2775
|
+
this.options.normalizePath = true;
|
|
2776
|
+
return this;
|
|
2777
|
+
}
|
|
2778
|
+
filter(predicate) {
|
|
2779
|
+
this.options.filters.push(predicate);
|
|
2780
|
+
return this;
|
|
2781
|
+
}
|
|
2782
|
+
onlyDirs() {
|
|
2783
|
+
this.options.excludeFiles = true;
|
|
2784
|
+
this.options.includeDirs = true;
|
|
2785
|
+
return this;
|
|
2786
|
+
}
|
|
2787
|
+
exclude(predicate) {
|
|
2788
|
+
this.options.exclude = predicate;
|
|
2789
|
+
return this;
|
|
2790
|
+
}
|
|
2791
|
+
onlyCounts() {
|
|
2792
|
+
this.options.onlyCounts = true;
|
|
2793
|
+
return this;
|
|
2794
|
+
}
|
|
2795
|
+
crawl(root) {
|
|
2796
|
+
return new APIBuilder(root || ".", this.options);
|
|
2797
|
+
}
|
|
2798
|
+
withGlobFunction(fn) {
|
|
2799
|
+
this.globFunction = fn;
|
|
2800
|
+
return this;
|
|
2801
|
+
}
|
|
2802
|
+
crawlWithOptions(root, options) {
|
|
2803
|
+
this.options = {
|
|
2804
|
+
...this.options,
|
|
2805
|
+
...options
|
|
2806
|
+
};
|
|
2807
|
+
return new APIBuilder(root || ".", this.options);
|
|
2808
|
+
}
|
|
2809
|
+
glob(...patterns) {
|
|
2810
|
+
if (this.globFunction) return this.globWithOptions(patterns);
|
|
2811
|
+
return this.globWithOptions(patterns, {
|
|
2812
|
+
dot: true
|
|
2813
|
+
});
|
|
2814
|
+
}
|
|
2815
|
+
globWithOptions(patterns, ...options) {
|
|
2816
|
+
const globFn = this.globFunction || pm;
|
|
2817
|
+
if (!globFn) throw new Error("Please specify a glob function to use glob matching.");
|
|
2818
|
+
var isMatch = this.globCache[patterns.join("\0")];
|
|
2819
|
+
if (!isMatch) {
|
|
2820
|
+
isMatch = globFn(patterns, ...options);
|
|
2821
|
+
this.globCache[patterns.join("\0")] = isMatch;
|
|
2822
|
+
}
|
|
2823
|
+
this.options.filters.push((path)=>isMatch(path));
|
|
2824
|
+
return this;
|
|
2825
|
+
}
|
|
2826
|
+
};
|
|
2827
|
+
const isReadonlyArray = Array.isArray;
|
|
2828
|
+
const isWin = "win32" === process.platform;
|
|
2829
|
+
const ONLY_PARENT_DIRECTORIES = /^(\/?\.\.)+$/;
|
|
2830
|
+
function getPartialMatcher(patterns, options = {}) {
|
|
2831
|
+
const patternsCount = patterns.length;
|
|
2832
|
+
const patternsParts = Array(patternsCount);
|
|
2833
|
+
const matchers = Array(patternsCount);
|
|
2834
|
+
const globstarEnabled = !options.noglobstar;
|
|
2835
|
+
for(let i = 0; i < patternsCount; i++){
|
|
2836
|
+
const parts = splitPattern(patterns[i]);
|
|
2837
|
+
patternsParts[i] = parts;
|
|
2838
|
+
const partsCount = parts.length;
|
|
2839
|
+
const partMatchers = Array(partsCount);
|
|
2840
|
+
for(let j = 0; j < partsCount; j++)partMatchers[j] = picomatch(parts[j], options);
|
|
2841
|
+
matchers[i] = partMatchers;
|
|
2842
|
+
}
|
|
2843
|
+
return (input)=>{
|
|
2844
|
+
const inputParts = input.split("/");
|
|
2845
|
+
if (".." === inputParts[0] && ONLY_PARENT_DIRECTORIES.test(input)) return true;
|
|
2846
|
+
for(let i = 0; i < patterns.length; i++){
|
|
2847
|
+
const patternParts = patternsParts[i];
|
|
2848
|
+
const matcher = matchers[i];
|
|
2849
|
+
const inputPatternCount = inputParts.length;
|
|
2850
|
+
const minParts = Math.min(inputPatternCount, patternParts.length);
|
|
2851
|
+
let j = 0;
|
|
2852
|
+
while(j < minParts){
|
|
2853
|
+
const part = patternParts[j];
|
|
2854
|
+
if (part.includes("/")) return true;
|
|
2855
|
+
const match = matcher[j](inputParts[j]);
|
|
2856
|
+
if (!match) break;
|
|
2857
|
+
if (globstarEnabled && "**" === part) return true;
|
|
2858
|
+
j++;
|
|
2859
|
+
}
|
|
2860
|
+
if (j === inputPatternCount) return true;
|
|
2861
|
+
}
|
|
2862
|
+
return false;
|
|
2863
|
+
};
|
|
2864
|
+
}
|
|
2865
|
+
const WIN32_ROOT_DIR = /^[A-Z]:\/$/i;
|
|
2866
|
+
const isRoot = isWin ? (p)=>WIN32_ROOT_DIR.test(p) : (p)=>"/" === p;
|
|
2867
|
+
function buildFormat(cwd, root, absolute) {
|
|
2868
|
+
if (cwd === root || root.startsWith(`${cwd}/`)) {
|
|
2869
|
+
if (absolute) {
|
|
2870
|
+
const start = isRoot(cwd) ? cwd.length : cwd.length + 1;
|
|
2871
|
+
return (p, isDir)=>p.slice(start, isDir ? -1 : void 0) || ".";
|
|
2872
|
+
}
|
|
2873
|
+
const prefix = root.slice(cwd.length + 1);
|
|
2874
|
+
if (prefix) return (p, isDir)=>{
|
|
2875
|
+
if ("." === p) return prefix;
|
|
2876
|
+
const result = `${prefix}/${p}`;
|
|
2877
|
+
return isDir ? result.slice(0, -1) : result;
|
|
2878
|
+
};
|
|
2879
|
+
return (p, isDir)=>isDir && "." !== p ? p.slice(0, -1) : p;
|
|
2880
|
+
}
|
|
2881
|
+
if (absolute) return (p)=>external_node_path_.posix.relative(cwd, p) || ".";
|
|
2882
|
+
return (p)=>external_node_path_.posix.relative(cwd, `${root}/${p}`) || ".";
|
|
2883
|
+
}
|
|
2884
|
+
function buildRelative(cwd, root) {
|
|
2885
|
+
if (root.startsWith(`${cwd}/`)) {
|
|
2886
|
+
const prefix = root.slice(cwd.length + 1);
|
|
2887
|
+
return (p)=>`${prefix}/${p}`;
|
|
2888
|
+
}
|
|
2889
|
+
return (p)=>{
|
|
2890
|
+
const result = external_node_path_.posix.relative(cwd, `${root}/${p}`);
|
|
2891
|
+
if (p.endsWith("/") && "" !== result) return `${result}/`;
|
|
2892
|
+
return result || ".";
|
|
2893
|
+
};
|
|
2894
|
+
}
|
|
2895
|
+
const splitPatternOptions = {
|
|
2896
|
+
parts: true
|
|
2897
|
+
};
|
|
2898
|
+
function splitPattern(path$1) {
|
|
2899
|
+
var _result$parts;
|
|
2900
|
+
const result = picomatch.scan(path$1, splitPatternOptions);
|
|
2901
|
+
return (null == (_result$parts = result.parts) ? void 0 : _result$parts.length) ? result.parts : [
|
|
2902
|
+
path$1
|
|
2903
|
+
];
|
|
2904
|
+
}
|
|
2905
|
+
const POSIX_UNESCAPED_GLOB_SYMBOLS = /(?<!\\)([()[\]{}*?|]|^!|[!+@](?=\()|\\(?![()[\]{}!*+?@|]))/g;
|
|
2906
|
+
const WIN32_UNESCAPED_GLOB_SYMBOLS = /(?<!\\)([()[\]{}]|^!|[!+@](?=\())/g;
|
|
2907
|
+
const escapePosixPath = (path$1)=>path$1.replace(POSIX_UNESCAPED_GLOB_SYMBOLS, "\\$&");
|
|
2908
|
+
const escapeWin32Path = (path$1)=>path$1.replace(WIN32_UNESCAPED_GLOB_SYMBOLS, "\\$&");
|
|
2909
|
+
const escapePath = isWin ? escapeWin32Path : escapePosixPath;
|
|
2910
|
+
function isDynamicPattern(pattern, options) {
|
|
2911
|
+
if ((null == options ? void 0 : options.caseSensitiveMatch) === false) return true;
|
|
2912
|
+
const scan = picomatch.scan(pattern);
|
|
2913
|
+
return scan.isGlob || scan.negated;
|
|
2914
|
+
}
|
|
2915
|
+
function dist_log(...tasks) {
|
|
2916
|
+
console.log(`[tinyglobby ${/* @__PURE__ */ new Date().toLocaleTimeString("es")}]`, ...tasks);
|
|
2917
|
+
}
|
|
2918
|
+
const PARENT_DIRECTORY = /^(\/?\.\.)+/;
|
|
2919
|
+
const ESCAPING_BACKSLASHES = /\\(?=[()[\]{}!*+?@|])/g;
|
|
2920
|
+
const BACKSLASHES = /\\/g;
|
|
2921
|
+
function normalizePattern(pattern, expandDirectories, cwd, props, isIgnore) {
|
|
2922
|
+
let result = pattern;
|
|
2923
|
+
if (pattern.endsWith("/")) result = pattern.slice(0, -1);
|
|
2924
|
+
if (!result.endsWith("*") && expandDirectories) result += "/**";
|
|
2925
|
+
const escapedCwd = escapePath(cwd);
|
|
2926
|
+
result = external_node_path_["default"].isAbsolute(result.replace(ESCAPING_BACKSLASHES, "")) ? external_node_path_.posix.relative(escapedCwd, result) : external_node_path_.posix.normalize(result);
|
|
2927
|
+
const parentDirectoryMatch = PARENT_DIRECTORY.exec(result);
|
|
2928
|
+
const parts = splitPattern(result);
|
|
2929
|
+
if (null == parentDirectoryMatch ? void 0 : parentDirectoryMatch[0]) {
|
|
2930
|
+
const n = (parentDirectoryMatch[0].length + 1) / 3;
|
|
2931
|
+
let i = 0;
|
|
2932
|
+
const cwdParts = escapedCwd.split("/");
|
|
2933
|
+
while(i < n && parts[i + n] === cwdParts[cwdParts.length + i - n]){
|
|
2934
|
+
result = result.slice(0, (n - i - 1) * 3) + result.slice((n - i) * 3 + parts[i + n].length + 1) || ".";
|
|
2935
|
+
i++;
|
|
2936
|
+
}
|
|
2937
|
+
const potentialRoot = external_node_path_.posix.join(cwd, parentDirectoryMatch[0].slice(3 * i));
|
|
2938
|
+
if (!potentialRoot.startsWith(".") && props.root.length > potentialRoot.length) {
|
|
2939
|
+
props.root = potentialRoot;
|
|
2940
|
+
props.depthOffset = -n + i;
|
|
2941
|
+
}
|
|
2942
|
+
}
|
|
2943
|
+
if (!isIgnore && props.depthOffset >= 0) {
|
|
2944
|
+
null != props.commonPath || (props.commonPath = parts);
|
|
2945
|
+
const newCommonPath = [];
|
|
2946
|
+
const length = Math.min(props.commonPath.length, parts.length);
|
|
2947
|
+
for(let i = 0; i < length; i++){
|
|
2948
|
+
const part = parts[i];
|
|
2949
|
+
if ("**" === part && !parts[i + 1]) {
|
|
2950
|
+
newCommonPath.pop();
|
|
2951
|
+
break;
|
|
2952
|
+
}
|
|
2953
|
+
if (part !== props.commonPath[i] || isDynamicPattern(part) || i === parts.length - 1) break;
|
|
2954
|
+
newCommonPath.push(part);
|
|
2955
|
+
}
|
|
2956
|
+
props.depthOffset = newCommonPath.length;
|
|
2957
|
+
props.commonPath = newCommonPath;
|
|
2958
|
+
props.root = newCommonPath.length > 0 ? external_node_path_.posix.join(cwd, ...newCommonPath) : cwd;
|
|
2959
|
+
}
|
|
2960
|
+
return result;
|
|
2961
|
+
}
|
|
2962
|
+
function processPatterns({ patterns = [
|
|
2963
|
+
"**/*"
|
|
2964
|
+
], ignore = [], expandDirectories = true }, cwd, props) {
|
|
2965
|
+
if ("string" == typeof patterns) patterns = [
|
|
2966
|
+
patterns
|
|
2967
|
+
];
|
|
2968
|
+
if ("string" == typeof ignore) ignore = [
|
|
2969
|
+
ignore
|
|
2970
|
+
];
|
|
2971
|
+
const matchPatterns = [];
|
|
2972
|
+
const ignorePatterns = [];
|
|
2973
|
+
for (const pattern of ignore)if (pattern) {
|
|
2974
|
+
if ("!" !== pattern[0] || "(" === pattern[1]) ignorePatterns.push(normalizePattern(pattern, expandDirectories, cwd, props, true));
|
|
2975
|
+
}
|
|
2976
|
+
for (const pattern of patterns)if (pattern) {
|
|
2977
|
+
if ("!" !== pattern[0] || "(" === pattern[1]) matchPatterns.push(normalizePattern(pattern, expandDirectories, cwd, props, false));
|
|
2978
|
+
else if ("!" !== pattern[1] || "(" === pattern[2]) ignorePatterns.push(normalizePattern(pattern.slice(1), expandDirectories, cwd, props, true));
|
|
2979
|
+
}
|
|
2980
|
+
return {
|
|
2981
|
+
match: matchPatterns,
|
|
2982
|
+
ignore: ignorePatterns
|
|
2983
|
+
};
|
|
2984
|
+
}
|
|
2985
|
+
function formatPaths(paths, relative) {
|
|
2986
|
+
for(let i = paths.length - 1; i >= 0; i--){
|
|
2987
|
+
const path$1 = paths[i];
|
|
2988
|
+
paths[i] = relative(path$1);
|
|
2989
|
+
}
|
|
2990
|
+
return paths;
|
|
2991
|
+
}
|
|
2992
|
+
function normalizeCwd(cwd) {
|
|
2993
|
+
if (!cwd) return process.cwd().replace(BACKSLASHES, "/");
|
|
2994
|
+
if (cwd instanceof URL) return fileURLToPath(cwd).replace(BACKSLASHES, "/");
|
|
2995
|
+
return external_node_path_["default"].resolve(cwd).replace(BACKSLASHES, "/");
|
|
2996
|
+
}
|
|
2997
|
+
function getCrawler(patterns, inputOptions = {}) {
|
|
2998
|
+
const options = process.env.TINYGLOBBY_DEBUG ? {
|
|
2999
|
+
...inputOptions,
|
|
3000
|
+
debug: true
|
|
3001
|
+
} : inputOptions;
|
|
3002
|
+
const cwd = normalizeCwd(options.cwd);
|
|
3003
|
+
if (options.debug) dist_log("globbing with:", {
|
|
3004
|
+
patterns,
|
|
3005
|
+
options,
|
|
3006
|
+
cwd
|
|
3007
|
+
});
|
|
3008
|
+
if (Array.isArray(patterns) && 0 === patterns.length) return [
|
|
3009
|
+
{
|
|
3010
|
+
sync: ()=>[],
|
|
3011
|
+
withPromise: async ()=>[]
|
|
3012
|
+
},
|
|
3013
|
+
false
|
|
3014
|
+
];
|
|
3015
|
+
const props = {
|
|
3016
|
+
root: cwd,
|
|
3017
|
+
commonPath: null,
|
|
3018
|
+
depthOffset: 0
|
|
3019
|
+
};
|
|
3020
|
+
const processed = processPatterns({
|
|
3021
|
+
...options,
|
|
3022
|
+
patterns
|
|
3023
|
+
}, cwd, props);
|
|
3024
|
+
if (options.debug) dist_log("internal processing patterns:", processed);
|
|
3025
|
+
const matchOptions = {
|
|
3026
|
+
dot: options.dot,
|
|
3027
|
+
nobrace: false === options.braceExpansion,
|
|
3028
|
+
nocase: false === options.caseSensitiveMatch,
|
|
3029
|
+
noextglob: false === options.extglob,
|
|
3030
|
+
noglobstar: false === options.globstar,
|
|
3031
|
+
posix: true
|
|
3032
|
+
};
|
|
3033
|
+
const matcher = picomatch(processed.match, {
|
|
3034
|
+
...matchOptions,
|
|
3035
|
+
ignore: processed.ignore
|
|
3036
|
+
});
|
|
3037
|
+
const ignore = picomatch(processed.ignore, matchOptions);
|
|
3038
|
+
const partialMatcher = getPartialMatcher(processed.match, matchOptions);
|
|
3039
|
+
const format = buildFormat(cwd, props.root, options.absolute);
|
|
3040
|
+
const formatExclude = options.absolute ? format : buildFormat(cwd, props.root, true);
|
|
3041
|
+
const fdirOptions = {
|
|
3042
|
+
filters: [
|
|
3043
|
+
options.debug ? (p, isDirectory)=>{
|
|
3044
|
+
const path$1 = format(p, isDirectory);
|
|
3045
|
+
const matches = matcher(path$1);
|
|
3046
|
+
if (matches) dist_log(`matched ${path$1}`);
|
|
3047
|
+
return matches;
|
|
3048
|
+
} : (p, isDirectory)=>matcher(format(p, isDirectory))
|
|
3049
|
+
],
|
|
3050
|
+
exclude: options.debug ? (_, p)=>{
|
|
3051
|
+
const relativePath = formatExclude(p, true);
|
|
3052
|
+
const skipped = "." !== relativePath && !partialMatcher(relativePath) || ignore(relativePath);
|
|
3053
|
+
skipped ? dist_log(`skipped ${p}`) : dist_log(`crawling ${p}`);
|
|
3054
|
+
return skipped;
|
|
3055
|
+
} : (_, p)=>{
|
|
3056
|
+
const relativePath = formatExclude(p, true);
|
|
3057
|
+
return "." !== relativePath && !partialMatcher(relativePath) || ignore(relativePath);
|
|
3058
|
+
},
|
|
3059
|
+
fs: options.fs ? {
|
|
3060
|
+
readdir: options.fs.readdir || external_node_fs_["default"].readdir,
|
|
3061
|
+
readdirSync: options.fs.readdirSync || external_node_fs_["default"].readdirSync,
|
|
3062
|
+
realpath: options.fs.realpath || external_node_fs_["default"].realpath,
|
|
3063
|
+
realpathSync: options.fs.realpathSync || external_node_fs_["default"].realpathSync,
|
|
3064
|
+
stat: options.fs.stat || external_node_fs_["default"].stat,
|
|
3065
|
+
statSync: options.fs.statSync || external_node_fs_["default"].statSync
|
|
3066
|
+
} : void 0,
|
|
3067
|
+
pathSeparator: "/",
|
|
3068
|
+
relativePaths: true,
|
|
3069
|
+
resolveSymlinks: true,
|
|
3070
|
+
signal: options.signal
|
|
3071
|
+
};
|
|
3072
|
+
if (void 0 !== options.deep) fdirOptions.maxDepth = Math.round(options.deep - props.depthOffset);
|
|
3073
|
+
if (options.absolute) {
|
|
3074
|
+
fdirOptions.relativePaths = false;
|
|
3075
|
+
fdirOptions.resolvePaths = true;
|
|
3076
|
+
fdirOptions.includeBasePath = true;
|
|
3077
|
+
}
|
|
3078
|
+
if (false === options.followSymbolicLinks) {
|
|
3079
|
+
fdirOptions.resolveSymlinks = false;
|
|
3080
|
+
fdirOptions.excludeSymlinks = true;
|
|
3081
|
+
}
|
|
3082
|
+
if (options.onlyDirectories) {
|
|
3083
|
+
fdirOptions.excludeFiles = true;
|
|
3084
|
+
fdirOptions.includeDirs = true;
|
|
3085
|
+
} else if (false === options.onlyFiles) fdirOptions.includeDirs = true;
|
|
3086
|
+
props.root = props.root.replace(BACKSLASHES, "");
|
|
3087
|
+
const root = props.root;
|
|
3088
|
+
if (options.debug) dist_log("internal properties:", props);
|
|
3089
|
+
const relative = cwd !== root && !options.absolute && buildRelative(cwd, props.root);
|
|
3090
|
+
return [
|
|
3091
|
+
new Builder(fdirOptions).crawl(root),
|
|
3092
|
+
relative
|
|
3093
|
+
];
|
|
3094
|
+
}
|
|
3095
|
+
async function glob(patternsOrOptions, options) {
|
|
3096
|
+
if (patternsOrOptions && (null == options ? void 0 : options.patterns)) throw new Error("Cannot pass patterns as both an argument and an option");
|
|
3097
|
+
const isModern = isReadonlyArray(patternsOrOptions) || "string" == typeof patternsOrOptions;
|
|
3098
|
+
const opts = isModern ? options : patternsOrOptions;
|
|
3099
|
+
const patterns = isModern ? patternsOrOptions : patternsOrOptions.patterns;
|
|
3100
|
+
const [crawler, relative] = getCrawler(patterns, opts);
|
|
3101
|
+
if (!relative) return crawler.withPromise();
|
|
3102
|
+
return formatPaths(await crawler.withPromise(), relative);
|
|
3103
|
+
}
|
|
3104
|
+
const DEFAULT_CONFIG_NAME = 'rstest.config';
|
|
3105
|
+
const ROOT_SUITE_NAME = 'Rstest:_internal_root_suite';
|
|
3106
|
+
const TEMP_RSTEST_OUTPUT_DIR = 'dist/.rstest-temp';
|
|
3107
|
+
const TEMP_RSTEST_OUTPUT_DIR_GLOB = '**/dist/.rstest-temp';
|
|
3108
|
+
const DEFAULT_CONFIG_EXTENSIONS = [
|
|
3109
|
+
'.js',
|
|
3110
|
+
'.ts',
|
|
3111
|
+
'.mjs',
|
|
3112
|
+
'.mts',
|
|
3113
|
+
'.cjs',
|
|
3114
|
+
'.cts'
|
|
3115
|
+
];
|
|
3116
|
+
const globalApis = [
|
|
3117
|
+
'test',
|
|
3118
|
+
'describe',
|
|
3119
|
+
'it',
|
|
3120
|
+
'expect',
|
|
3121
|
+
'afterAll',
|
|
3122
|
+
'afterEach',
|
|
3123
|
+
'beforeAll',
|
|
3124
|
+
'beforeEach',
|
|
3125
|
+
'rstest',
|
|
3126
|
+
'rs',
|
|
3127
|
+
'assert',
|
|
3128
|
+
'onTestFinished',
|
|
3129
|
+
'onTestFailed'
|
|
3130
|
+
];
|
|
3131
|
+
const TS_CONFIG_FILE = 'tsconfig.json';
|
|
3132
|
+
const dist_delimiter = /* @__PURE__ */ (()=>globalThis.process?.platform === "win32" ? ";" : ":")();
|
|
3133
|
+
const _platforms = {
|
|
3134
|
+
posix: void 0,
|
|
3135
|
+
win32: void 0
|
|
3136
|
+
};
|
|
3137
|
+
const mix = (del = dist_delimiter)=>new Proxy(_path, {
|
|
3138
|
+
get (_, prop) {
|
|
3139
|
+
if ("delimiter" === prop) return del;
|
|
3140
|
+
if ("posix" === prop) return posix;
|
|
3141
|
+
if ("win32" === prop) return win32;
|
|
3142
|
+
return _platforms[prop] || _path[prop];
|
|
3143
|
+
}
|
|
3144
|
+
});
|
|
3145
|
+
const posix = /* @__PURE__ */ mix(":");
|
|
3146
|
+
const win32 = /* @__PURE__ */ mix(";");
|
|
3147
|
+
const filterFiles = (testFiles, filters, dir)=>{
|
|
3148
|
+
if (!filters.length) return testFiles;
|
|
3149
|
+
const fileFilters = 'win32' === process.platform ? filters.map((f)=>f.split(posix.sep).join('/')) : filters;
|
|
3150
|
+
return testFiles.filter((t)=>{
|
|
3151
|
+
const testFile = posix.relative(dir, t).toLocaleLowerCase();
|
|
3152
|
+
return fileFilters.some((f)=>{
|
|
3153
|
+
if (posix.isAbsolute(f) && t.startsWith(f)) return true;
|
|
3154
|
+
const relativePath = f.endsWith('/') ? posix.join(posix.relative(dir, f), '/') : posix.relative(dir, f);
|
|
3155
|
+
return testFile.includes(f.toLocaleLowerCase()) || testFile.includes(relativePath.toLocaleLowerCase());
|
|
3156
|
+
});
|
|
3157
|
+
});
|
|
3158
|
+
};
|
|
3159
|
+
const filterProjects = (projects, options)=>{
|
|
3160
|
+
if (options.project) {
|
|
3161
|
+
const regexes = castArray(options.project).map((pattern)=>{
|
|
3162
|
+
const isNeg = pattern.startsWith('!');
|
|
3163
|
+
const escaped = (isNeg ? pattern.slice(1) : pattern).split('*').map((part)=>part.replace(/[.+?^${}()|[\]\\]/g, '\\$&')).join('.*');
|
|
3164
|
+
return new RegExp(isNeg ? `^(?!${escaped})` : `^${escaped}$`);
|
|
3165
|
+
});
|
|
3166
|
+
return projects.filter((proj)=>regexes.some((re)=>re.test(proj.config.name)));
|
|
3167
|
+
}
|
|
3168
|
+
return projects;
|
|
3169
|
+
};
|
|
3170
|
+
const hasInSourceTestCode = (code)=>code.includes('import.meta.rstest');
|
|
3171
|
+
const formatTestEntryName = (name)=>name.replace(/\.*[/\\]/g, '_').replace(/\./g, '~');
|
|
3172
|
+
const getTestEntries = async ({ include, exclude, rootPath, projectRoot, fileFilters, includeSource })=>{
|
|
3173
|
+
const testFiles = await glob(include, {
|
|
3174
|
+
cwd: projectRoot,
|
|
3175
|
+
absolute: true,
|
|
3176
|
+
ignore: exclude,
|
|
3177
|
+
dot: true,
|
|
3178
|
+
expandDirectories: false
|
|
3179
|
+
});
|
|
3180
|
+
if (includeSource?.length) {
|
|
3181
|
+
const sourceFiles = await glob(includeSource, {
|
|
3182
|
+
cwd: projectRoot,
|
|
3183
|
+
absolute: true,
|
|
3184
|
+
ignore: exclude,
|
|
3185
|
+
dot: true,
|
|
3186
|
+
expandDirectories: false
|
|
3187
|
+
});
|
|
3188
|
+
await Promise.all(sourceFiles.map(async (file)=>{
|
|
3189
|
+
try {
|
|
3190
|
+
const code = await promises.readFile(file, 'utf-8');
|
|
3191
|
+
if (hasInSourceTestCode(code)) testFiles.push(file);
|
|
3192
|
+
} catch {
|
|
3193
|
+
return;
|
|
3194
|
+
}
|
|
3195
|
+
}));
|
|
3196
|
+
}
|
|
3197
|
+
return Object.fromEntries(filterFiles(testFiles, fileFilters, rootPath).map((entry)=>{
|
|
3198
|
+
const relativePath = posix.relative(rootPath, entry);
|
|
3199
|
+
return [
|
|
3200
|
+
formatTestEntryName(relativePath),
|
|
3201
|
+
entry
|
|
3202
|
+
];
|
|
3203
|
+
}));
|
|
3204
|
+
};
|
|
3205
|
+
const tryResolve = (request, rootPath)=>{
|
|
3206
|
+
try {
|
|
3207
|
+
const require = external_node_module_createRequire(rootPath);
|
|
3208
|
+
return require.resolve(request, {
|
|
3209
|
+
paths: [
|
|
3210
|
+
rootPath
|
|
3211
|
+
]
|
|
3212
|
+
});
|
|
3213
|
+
} catch (_err) {
|
|
3214
|
+
return;
|
|
3215
|
+
}
|
|
3216
|
+
};
|
|
3217
|
+
const getSetupFiles = (setups, rootPath)=>{
|
|
3218
|
+
if (!setups.length) return {};
|
|
3219
|
+
return Object.fromEntries(setups.map((setupFile)=>{
|
|
3220
|
+
const setupFilePath = getAbsolutePath(rootPath, setupFile);
|
|
3221
|
+
try {
|
|
3222
|
+
if (!(0, external_node_fs_.existsSync)(setupFilePath)) {
|
|
3223
|
+
let errorMessage = `Setup file ${picocolors_default().red(setupFile)} not found`;
|
|
3224
|
+
if (setupFilePath !== setupFile) errorMessage += picocolors_default().gray(` (resolved path: ${setupFilePath})`);
|
|
3225
|
+
throw errorMessage;
|
|
3226
|
+
}
|
|
3227
|
+
const relativePath = posix.relative(rootPath, setupFilePath);
|
|
3228
|
+
return [
|
|
3229
|
+
formatTestEntryName(relativePath),
|
|
3230
|
+
setupFilePath
|
|
3231
|
+
];
|
|
3232
|
+
} catch (err) {
|
|
3233
|
+
const resolvedPath = tryResolve(setupFile, rootPath);
|
|
3234
|
+
if (resolvedPath) return [
|
|
3235
|
+
formatTestEntryName(setupFile),
|
|
3236
|
+
resolvedPath
|
|
3237
|
+
];
|
|
3238
|
+
throw err;
|
|
3239
|
+
}
|
|
3240
|
+
}));
|
|
3241
|
+
};
|
|
3242
|
+
const prettyTestPath = (testPath)=>{
|
|
3243
|
+
const { dir, base } = parsePosix(testPath);
|
|
3244
|
+
return `${'.' !== dir ? picocolors_default().gray(`${dir}/`) : ''}${picocolors_default().cyan(base)}`;
|
|
3245
|
+
};
|
|
3246
|
+
const formatTestPath = (root, testFilePath)=>{
|
|
3247
|
+
let testPath = testFilePath;
|
|
3248
|
+
if (posix.isAbsolute(testPath) && testPath.includes(root)) testPath = posix.relative(root, testPath);
|
|
3249
|
+
return prettyTestPath(testPath);
|
|
3250
|
+
};
|
|
3251
|
+
const picomatch = __webpack_require__("../../node_modules/.pnpm/picomatch@4.0.3/node_modules/picomatch/index.js");
|
|
3252
|
+
export { ADDITIONAL_NODE_BUILTINS, DEFAULT_CONFIG_EXTENSIONS, DEFAULT_CONFIG_NAME, ROOT_SUITE_NAME, TEMP_RSTEST_OUTPUT_DIR, TEMP_RSTEST_OUTPUT_DIR_GLOB, TS_CONFIG_FILE, basename, castArray, clearScreen, dirname, external_node_module_createRequire, filterProjects, formatError, formatRootStr, formatTestPath, getAbsolutePath, getSetupFiles, getTaskNameWithPrefix, getTestEntries, glob, globalApis, isAbsolute, isBuiltin, isDebug, isDynamicPattern, isObject, isTTY, join, lstat, needFlagExperimentalDetectModule, node_process, normalize, pathe_M_eThtNZ_relative, posix, prettyTestPath, prettyTime, promises_stat, readdir, realpath, resolve, serializableConfig, src_logger, undoSerializableConfig, writeFile };
|