@rstest/core 0.7.2 → 0.7.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/0~130.js +2 -1
- package/dist/0~151.js +213 -77
- package/dist/0~173.js +69 -32
- package/dist/0~255.js +2 -2
- package/dist/0~403.js +8 -7
- package/dist/0~426.js +5 -3
- package/dist/0~583.js +3 -2
- package/dist/0~588.js +7 -5
- package/dist/0~62.js +1 -1
- package/dist/0~634.js +68 -22
- package/dist/0~809.js +1 -1
- package/dist/0~835.js +4 -3
- package/dist/{0~122.js → 0~89.js} +122 -20
- package/dist/0~919.js +6 -6
- package/dist/0~923.js +4 -3
- package/dist/131.js +87 -151
- package/dist/{946.js → 157.js} +15 -852
- package/dist/198.js +4 -0
- package/dist/{404.js → 216.js} +1 -2
- package/dist/278.js +765 -0
- package/dist/554.js +11 -6716
- package/dist/664.js +93 -0
- package/dist/672.js +91 -0
- package/dist/734.js +4 -3
- package/dist/913.js +6717 -0
- package/dist/globalSetupWorker.d.ts +9 -0
- package/dist/globalSetupWorker.js +115 -0
- package/dist/index.d.ts +266 -26
- package/dist/index.js +1 -1
- package/dist/mockRuntimeCode.js +1 -0
- package/dist/worker.d.ts +184 -28
- package/package.json +3 -2
- /package/dist/{554.js.LICENSE.txt → 913.js.LICENSE.txt} +0 -0
package/dist/278.js
ADDED
|
@@ -0,0 +1,765 @@
|
|
|
1
|
+
import 'module';
|
|
2
|
+
/*#__PURE__*/ import.meta.url;
|
|
3
|
+
import { __webpack_require__ } from "./rslib-runtime.js";
|
|
4
|
+
import node_process from "node:process";
|
|
5
|
+
import "./664.js";
|
|
6
|
+
const external_node_os_ = __webpack_require__("node:os");
|
|
7
|
+
const external_node_tty_ = __webpack_require__("node:tty");
|
|
8
|
+
function hasFlag(flag, argv = globalThis.Deno ? globalThis.Deno.args : node_process.argv) {
|
|
9
|
+
const prefix = flag.startsWith('-') ? '' : 1 === flag.length ? '-' : '--';
|
|
10
|
+
const position = argv.indexOf(prefix + flag);
|
|
11
|
+
const terminatorPosition = argv.indexOf('--');
|
|
12
|
+
return -1 !== position && (-1 === terminatorPosition || position < terminatorPosition);
|
|
13
|
+
}
|
|
14
|
+
const { env: env } = node_process;
|
|
15
|
+
let flagForceColor;
|
|
16
|
+
if (hasFlag('no-color') || hasFlag('no-colors') || hasFlag('color=false') || hasFlag('color=never')) flagForceColor = 0;
|
|
17
|
+
else if (hasFlag('color') || hasFlag('colors') || hasFlag('color=true') || hasFlag('color=always')) flagForceColor = 1;
|
|
18
|
+
function envForceColor() {
|
|
19
|
+
if (!('FORCE_COLOR' in env)) return;
|
|
20
|
+
if ('true' === env.FORCE_COLOR) return 1;
|
|
21
|
+
if ('false' === env.FORCE_COLOR) return 0;
|
|
22
|
+
if (0 === env.FORCE_COLOR.length) return 1;
|
|
23
|
+
const level = Math.min(Number.parseInt(env.FORCE_COLOR, 10), 3);
|
|
24
|
+
if (![
|
|
25
|
+
0,
|
|
26
|
+
1,
|
|
27
|
+
2,
|
|
28
|
+
3
|
|
29
|
+
].includes(level)) return;
|
|
30
|
+
return level;
|
|
31
|
+
}
|
|
32
|
+
function translateLevel(level) {
|
|
33
|
+
if (0 === level) return false;
|
|
34
|
+
return {
|
|
35
|
+
level,
|
|
36
|
+
hasBasic: true,
|
|
37
|
+
has256: level >= 2,
|
|
38
|
+
has16m: level >= 3
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
function _supportsColor(haveStream, { streamIsTTY, sniffFlags = true } = {}) {
|
|
42
|
+
const noFlagForceColor = envForceColor();
|
|
43
|
+
if (void 0 !== noFlagForceColor) flagForceColor = noFlagForceColor;
|
|
44
|
+
const forceColor = sniffFlags ? flagForceColor : noFlagForceColor;
|
|
45
|
+
if (0 === forceColor) return 0;
|
|
46
|
+
if (sniffFlags) {
|
|
47
|
+
if (hasFlag('color=16m') || hasFlag('color=full') || hasFlag('color=truecolor')) return 3;
|
|
48
|
+
if (hasFlag('color=256')) return 2;
|
|
49
|
+
}
|
|
50
|
+
if ('TF_BUILD' in env && 'AGENT_NAME' in env) return 1;
|
|
51
|
+
if (haveStream && !streamIsTTY && void 0 === forceColor) return 0;
|
|
52
|
+
const min = forceColor || 0;
|
|
53
|
+
if ('dumb' === env.TERM) return min;
|
|
54
|
+
if ('win32' === node_process.platform) {
|
|
55
|
+
const osRelease = external_node_os_["default"].release().split('.');
|
|
56
|
+
if (Number(osRelease[0]) >= 10 && Number(osRelease[2]) >= 10586) return Number(osRelease[2]) >= 14931 ? 3 : 2;
|
|
57
|
+
return 1;
|
|
58
|
+
}
|
|
59
|
+
if ('CI' in env) {
|
|
60
|
+
if ([
|
|
61
|
+
'GITHUB_ACTIONS',
|
|
62
|
+
'GITEA_ACTIONS',
|
|
63
|
+
'CIRCLECI'
|
|
64
|
+
].some((key)=>key in env)) return 3;
|
|
65
|
+
if ([
|
|
66
|
+
'TRAVIS',
|
|
67
|
+
'APPVEYOR',
|
|
68
|
+
'GITLAB_CI',
|
|
69
|
+
'BUILDKITE',
|
|
70
|
+
'DRONE'
|
|
71
|
+
].some((sign)=>sign in env) || 'codeship' === env.CI_NAME) return 1;
|
|
72
|
+
return min;
|
|
73
|
+
}
|
|
74
|
+
if ('TEAMCITY_VERSION' in env) return /^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(env.TEAMCITY_VERSION) ? 1 : 0;
|
|
75
|
+
if ('truecolor' === env.COLORTERM) return 3;
|
|
76
|
+
if ('xterm-kitty' === env.TERM) return 3;
|
|
77
|
+
if ('xterm-ghostty' === env.TERM) return 3;
|
|
78
|
+
if ('wezterm' === env.TERM) return 3;
|
|
79
|
+
if ('TERM_PROGRAM' in env) {
|
|
80
|
+
const version = Number.parseInt((env.TERM_PROGRAM_VERSION || '').split('.')[0], 10);
|
|
81
|
+
switch(env.TERM_PROGRAM){
|
|
82
|
+
case 'iTerm.app':
|
|
83
|
+
return version >= 3 ? 3 : 2;
|
|
84
|
+
case 'Apple_Terminal':
|
|
85
|
+
return 2;
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
if (/-256(color)?$/i.test(env.TERM)) return 2;
|
|
89
|
+
if (/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(env.TERM)) return 1;
|
|
90
|
+
if ('COLORTERM' in env) return 1;
|
|
91
|
+
return min;
|
|
92
|
+
}
|
|
93
|
+
function createSupportsColor(stream, options = {}) {
|
|
94
|
+
const level = _supportsColor(stream, {
|
|
95
|
+
streamIsTTY: stream && stream.isTTY,
|
|
96
|
+
...options
|
|
97
|
+
});
|
|
98
|
+
return translateLevel(level);
|
|
99
|
+
}
|
|
100
|
+
const supportsColor = {
|
|
101
|
+
stdout: createSupportsColor({
|
|
102
|
+
isTTY: external_node_tty_["default"].isatty(1)
|
|
103
|
+
}),
|
|
104
|
+
stderr: createSupportsColor({
|
|
105
|
+
isTTY: external_node_tty_["default"].isatty(2)
|
|
106
|
+
})
|
|
107
|
+
};
|
|
108
|
+
const supports_color = supportsColor;
|
|
109
|
+
const colorLevel = supports_color.stdout ? supports_color.stdout.level : 0;
|
|
110
|
+
let errorStackRegExp = /at [^\r\n]{0,200}:\d+:\d+[\s\)]*$/;
|
|
111
|
+
let anonymousErrorStackRegExp = /at [^\r\n]{0,200}\(<anonymous>\)$/;
|
|
112
|
+
let indexErrorStackRegExp = /at [^\r\n]{0,200}\(index\s\d+\)$/;
|
|
113
|
+
let isErrorStackMessage = (message)=>errorStackRegExp.test(message) || anonymousErrorStackRegExp.test(message) || indexErrorStackRegExp.test(message);
|
|
114
|
+
let formatter = (open, close, replace = open)=>colorLevel >= 2 ? (input)=>{
|
|
115
|
+
let string = '' + input;
|
|
116
|
+
let index = string.indexOf(close, open.length);
|
|
117
|
+
return ~index ? open + replaceClose(string, close, replace, index) + close : open + string + close;
|
|
118
|
+
} : String;
|
|
119
|
+
let replaceClose = (string, close, replace, index)=>{
|
|
120
|
+
let start = string.substring(0, index) + replace;
|
|
121
|
+
let end = string.substring(index + close.length);
|
|
122
|
+
let nextIndex = end.indexOf(close);
|
|
123
|
+
return ~nextIndex ? start + replaceClose(end, close, replace, nextIndex) : start + end;
|
|
124
|
+
};
|
|
125
|
+
const bold = formatter('\x1b[1m', '\x1b[22m', '\x1b[22m\x1b[1m');
|
|
126
|
+
const red = formatter('\x1b[31m', '\x1b[39m');
|
|
127
|
+
const green = formatter('\x1b[32m', '\x1b[39m');
|
|
128
|
+
const yellow = formatter('\x1b[33m', '\x1b[39m');
|
|
129
|
+
const magenta = formatter('\x1b[35m', '\x1b[39m');
|
|
130
|
+
const cyan = formatter('\x1b[36m', '\x1b[39m');
|
|
131
|
+
const gray = formatter('\x1b[90m', '\x1b[39m');
|
|
132
|
+
let startColor = [
|
|
133
|
+
189,
|
|
134
|
+
255,
|
|
135
|
+
243
|
|
136
|
+
];
|
|
137
|
+
let endColor = [
|
|
138
|
+
74,
|
|
139
|
+
194,
|
|
140
|
+
154
|
|
141
|
+
];
|
|
142
|
+
let isWord = (char)=>!/[\s\n]/.test(char);
|
|
143
|
+
let gradient = (message)=>{
|
|
144
|
+
if (colorLevel < 3) return 2 === colorLevel ? bold(cyan(message)) : message;
|
|
145
|
+
let chars = [
|
|
146
|
+
...message
|
|
147
|
+
];
|
|
148
|
+
let steps = chars.filter(isWord).length;
|
|
149
|
+
let r = startColor[0];
|
|
150
|
+
let g = startColor[1];
|
|
151
|
+
let b = startColor[2];
|
|
152
|
+
let rStep = (endColor[0] - r) / steps;
|
|
153
|
+
let gStep = (endColor[1] - g) / steps;
|
|
154
|
+
let bStep = (endColor[2] - b) / steps;
|
|
155
|
+
let output = '';
|
|
156
|
+
for (let char of chars){
|
|
157
|
+
if (isWord(char)) {
|
|
158
|
+
r += rStep;
|
|
159
|
+
g += gStep;
|
|
160
|
+
b += bStep;
|
|
161
|
+
}
|
|
162
|
+
output += `\x1b[38;2;${Math.round(r)};${Math.round(g)};${Math.round(b)}m${char}\x1b[39m`;
|
|
163
|
+
}
|
|
164
|
+
return bold(output);
|
|
165
|
+
};
|
|
166
|
+
let LOG_LEVEL = {
|
|
167
|
+
silent: -1,
|
|
168
|
+
error: 0,
|
|
169
|
+
warn: 1,
|
|
170
|
+
info: 2,
|
|
171
|
+
log: 2,
|
|
172
|
+
verbose: 3
|
|
173
|
+
};
|
|
174
|
+
let LOG_TYPES = {
|
|
175
|
+
error: {
|
|
176
|
+
label: 'error',
|
|
177
|
+
level: 'error',
|
|
178
|
+
color: red
|
|
179
|
+
},
|
|
180
|
+
warn: {
|
|
181
|
+
label: 'warn',
|
|
182
|
+
level: 'warn',
|
|
183
|
+
color: yellow
|
|
184
|
+
},
|
|
185
|
+
info: {
|
|
186
|
+
label: 'info',
|
|
187
|
+
level: 'info',
|
|
188
|
+
color: cyan
|
|
189
|
+
},
|
|
190
|
+
start: {
|
|
191
|
+
label: 'start',
|
|
192
|
+
level: 'info',
|
|
193
|
+
color: cyan
|
|
194
|
+
},
|
|
195
|
+
ready: {
|
|
196
|
+
label: 'ready',
|
|
197
|
+
level: 'info',
|
|
198
|
+
color: green
|
|
199
|
+
},
|
|
200
|
+
success: {
|
|
201
|
+
label: 'success',
|
|
202
|
+
level: 'info',
|
|
203
|
+
color: green
|
|
204
|
+
},
|
|
205
|
+
log: {
|
|
206
|
+
level: 'info'
|
|
207
|
+
},
|
|
208
|
+
debug: {
|
|
209
|
+
label: 'debug',
|
|
210
|
+
level: 'verbose',
|
|
211
|
+
color: magenta
|
|
212
|
+
}
|
|
213
|
+
};
|
|
214
|
+
const normalizeErrorMessage = (err)=>{
|
|
215
|
+
if (err.stack) {
|
|
216
|
+
let [name, ...rest] = err.stack.split('\n');
|
|
217
|
+
if (name.startsWith('Error: ')) name = name.slice(7);
|
|
218
|
+
return `${name}\n${gray(rest.join('\n'))}`;
|
|
219
|
+
}
|
|
220
|
+
return err.message;
|
|
221
|
+
};
|
|
222
|
+
let createLogger = (options = {})=>{
|
|
223
|
+
let maxLevel = options.level || 'info';
|
|
224
|
+
let log = (type, message, ...args)=>{
|
|
225
|
+
let logType = LOG_TYPES[type];
|
|
226
|
+
const { level } = logType;
|
|
227
|
+
if (LOG_LEVEL[level] > LOG_LEVEL[maxLevel]) return;
|
|
228
|
+
if (null == message) return console.log();
|
|
229
|
+
let label = '';
|
|
230
|
+
let text = '';
|
|
231
|
+
if ('label' in logType) {
|
|
232
|
+
label = (logType.label || '').padEnd(7);
|
|
233
|
+
label = bold(logType.color ? logType.color(label) : label);
|
|
234
|
+
}
|
|
235
|
+
if (message instanceof Error) {
|
|
236
|
+
text += normalizeErrorMessage(message);
|
|
237
|
+
const { cause } = message;
|
|
238
|
+
if (cause) {
|
|
239
|
+
text += yellow('\n [cause]: ');
|
|
240
|
+
text += cause instanceof Error ? normalizeErrorMessage(cause) : String(cause);
|
|
241
|
+
}
|
|
242
|
+
} else if ('error' === level && 'string' == typeof message) {
|
|
243
|
+
let lines = message.split('\n');
|
|
244
|
+
text = lines.map((line)=>isErrorStackMessage(line) ? gray(line) : line).join('\n');
|
|
245
|
+
} else text = `${message}`;
|
|
246
|
+
const method = 'error' === level || 'warn' === level ? level : 'log';
|
|
247
|
+
console[method](label.length ? `${label} ${text}` : text, ...args);
|
|
248
|
+
};
|
|
249
|
+
let logger = {
|
|
250
|
+
greet: (message)=>log('log', gradient(message))
|
|
251
|
+
};
|
|
252
|
+
Object.keys(LOG_TYPES).forEach((key)=>{
|
|
253
|
+
logger[key] = (...args)=>log(key, ...args);
|
|
254
|
+
});
|
|
255
|
+
Object.defineProperty(logger, 'level', {
|
|
256
|
+
get: ()=>maxLevel,
|
|
257
|
+
set (val) {
|
|
258
|
+
maxLevel = val;
|
|
259
|
+
}
|
|
260
|
+
});
|
|
261
|
+
logger.override = (customLogger)=>{
|
|
262
|
+
Object.assign(logger, customLogger);
|
|
263
|
+
};
|
|
264
|
+
return logger;
|
|
265
|
+
};
|
|
266
|
+
let src_logger = createLogger();
|
|
267
|
+
const picocolors = __webpack_require__("../../node_modules/.pnpm/picocolors@1.1.1/node_modules/picocolors/picocolors.js");
|
|
268
|
+
var picocolors_default = /*#__PURE__*/ __webpack_require__.n(picocolors);
|
|
269
|
+
const isDebug = ()=>{
|
|
270
|
+
if (!process.env.DEBUG) return false;
|
|
271
|
+
const values = process.env.DEBUG.toLocaleLowerCase().split(',');
|
|
272
|
+
return [
|
|
273
|
+
'rstest',
|
|
274
|
+
'rsbuild',
|
|
275
|
+
'builder',
|
|
276
|
+
'*'
|
|
277
|
+
].some((key)=>values.includes(key));
|
|
278
|
+
};
|
|
279
|
+
if (isDebug()) src_logger.level = 'verbose';
|
|
280
|
+
function getTime() {
|
|
281
|
+
const now = new Date();
|
|
282
|
+
const hours = String(now.getHours()).padStart(2, '0');
|
|
283
|
+
const minutes = String(now.getMinutes()).padStart(2, '0');
|
|
284
|
+
const seconds = String(now.getSeconds()).padStart(2, '0');
|
|
285
|
+
return `${hours}:${minutes}:${seconds}`;
|
|
286
|
+
}
|
|
287
|
+
src_logger.override({
|
|
288
|
+
debug: (message, ...args)=>{
|
|
289
|
+
if ('verbose' !== src_logger.level) return;
|
|
290
|
+
const time = picocolors_default().gray(getTime());
|
|
291
|
+
console.log(` ${picocolors_default().magenta('rstest')} ${time} ${message}`, ...args);
|
|
292
|
+
}
|
|
293
|
+
});
|
|
294
|
+
const clearScreen = (force = false)=>{
|
|
295
|
+
if (!isDebug() || force) console.log('\x1Bc');
|
|
296
|
+
};
|
|
297
|
+
const logger_logger = {
|
|
298
|
+
...src_logger,
|
|
299
|
+
stderr: (message, ...args)=>{
|
|
300
|
+
console.error(message, ...args);
|
|
301
|
+
}
|
|
302
|
+
};
|
|
303
|
+
let _lazyMatch = ()=>{
|
|
304
|
+
var __lib__ = (()=>{
|
|
305
|
+
var m = Object.defineProperty, V = Object.getOwnPropertyDescriptor, G = Object.getOwnPropertyNames, T = Object.prototype.hasOwnProperty, q = (r, e)=>{
|
|
306
|
+
for(var n in e)m(r, n, {
|
|
307
|
+
get: e[n],
|
|
308
|
+
enumerable: true
|
|
309
|
+
});
|
|
310
|
+
}, H = (r, e, n, a)=>{
|
|
311
|
+
if (e && "object" == typeof e || "function" == typeof e) for (let t of G(e))T.call(r, t) || t === n || m(r, t, {
|
|
312
|
+
get: ()=>e[t],
|
|
313
|
+
enumerable: !(a = V(e, t)) || a.enumerable
|
|
314
|
+
});
|
|
315
|
+
return r;
|
|
316
|
+
}, J = (r)=>H(m({}, "__esModule", {
|
|
317
|
+
value: true
|
|
318
|
+
}), r), w = {};
|
|
319
|
+
q(w, {
|
|
320
|
+
default: ()=>re
|
|
321
|
+
});
|
|
322
|
+
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)=>{
|
|
323
|
+
const e = new Map;
|
|
324
|
+
return (n)=>{
|
|
325
|
+
const a = e.get(n);
|
|
326
|
+
if (a) return a;
|
|
327
|
+
const t = r(n);
|
|
328
|
+
return e.set(n, t), t;
|
|
329
|
+
};
|
|
330
|
+
}, rr = (r, e, n = {})=>{
|
|
331
|
+
const a = {
|
|
332
|
+
cache: {},
|
|
333
|
+
input: r,
|
|
334
|
+
index: 0,
|
|
335
|
+
indexMax: 0,
|
|
336
|
+
options: n,
|
|
337
|
+
output: []
|
|
338
|
+
};
|
|
339
|
+
if (v(e)(a) && a.index === r.length) return a.output;
|
|
340
|
+
throw new Error(`Failed to parse at index ${a.indexMax}`);
|
|
341
|
+
}, i = (r, e)=>A(r) ? er(r, e) : b(r) ? ar(r, e) : nr(r, e), er = (r, e)=>{
|
|
342
|
+
const n = {};
|
|
343
|
+
for (const a of r){
|
|
344
|
+
if (1 !== a.length) throw new Error(`Invalid character: "${a}"`);
|
|
345
|
+
const t = a.charCodeAt(0);
|
|
346
|
+
n[t] = true;
|
|
347
|
+
}
|
|
348
|
+
return (a)=>{
|
|
349
|
+
const t = a.index, o = a.input;
|
|
350
|
+
for(; a.index < o.length && o.charCodeAt(a.index) in n;)a.index += 1;
|
|
351
|
+
const u = a.index;
|
|
352
|
+
if (u > t) {
|
|
353
|
+
if (!h(e) && !a.options.silent) {
|
|
354
|
+
const s = a.input.slice(t, u), c = d(e) ? e(s, o, String(t)) : e;
|
|
355
|
+
h(c) || a.output.push(c);
|
|
356
|
+
}
|
|
357
|
+
a.indexMax = Math.max(a.indexMax, a.index);
|
|
358
|
+
}
|
|
359
|
+
return true;
|
|
360
|
+
};
|
|
361
|
+
}, nr = (r, e)=>{
|
|
362
|
+
const n = r.source, a = r.flags.replace(/y|$/, "y"), t = new RegExp(n, a);
|
|
363
|
+
return g((o)=>{
|
|
364
|
+
t.lastIndex = o.index;
|
|
365
|
+
const u = t.exec(o.input);
|
|
366
|
+
if (!u) return false;
|
|
367
|
+
if (!h(e) && !o.options.silent) {
|
|
368
|
+
const s = d(e) ? e(...u, o.input, String(o.index)) : e;
|
|
369
|
+
h(s) || o.output.push(s);
|
|
370
|
+
}
|
|
371
|
+
return o.index += u[0].length, o.indexMax = Math.max(o.indexMax, o.index), true;
|
|
372
|
+
});
|
|
373
|
+
}, ar = (r, e)=>(n)=>{
|
|
374
|
+
if (!n.input.startsWith(r, n.index)) return false;
|
|
375
|
+
if (!h(e) && !n.options.silent) {
|
|
376
|
+
const t = d(e) ? e(r, n.input, String(n.index)) : e;
|
|
377
|
+
h(t) || n.output.push(t);
|
|
378
|
+
}
|
|
379
|
+
return n.index += r.length, n.indexMax = Math.max(n.indexMax, n.index), true;
|
|
380
|
+
}, C = (r, e, n, a)=>{
|
|
381
|
+
const t = v(r);
|
|
382
|
+
return g(_(M((o)=>{
|
|
383
|
+
let u = 0;
|
|
384
|
+
for(; u < n;){
|
|
385
|
+
const s = o.index;
|
|
386
|
+
if (!t(o) || (u += 1, o.index === s)) break;
|
|
387
|
+
}
|
|
388
|
+
return u >= e;
|
|
389
|
+
})));
|
|
390
|
+
}, tr = (r, e)=>C(r, 0, 1), f = (r, e)=>C(r, 0, 1 / 0), x = (r, e)=>{
|
|
391
|
+
const n = r.map(v);
|
|
392
|
+
return g(_(M((a)=>{
|
|
393
|
+
for(let t = 0, o = n.length; t < o; t++)if (!n[t](a)) return false;
|
|
394
|
+
return true;
|
|
395
|
+
})));
|
|
396
|
+
}, l = (r, e)=>{
|
|
397
|
+
const n = r.map(v);
|
|
398
|
+
return g(_((a)=>{
|
|
399
|
+
for(let t = 0, o = n.length; t < o; t++)if (n[t](a)) return true;
|
|
400
|
+
return false;
|
|
401
|
+
}));
|
|
402
|
+
}, M = (r, e = false)=>{
|
|
403
|
+
const n = v(r);
|
|
404
|
+
return (a)=>{
|
|
405
|
+
const t = a.index, o = a.output.length, u = n(a);
|
|
406
|
+
return (!u || e) && (a.index = t, a.output.length !== o && (a.output.length = o)), u;
|
|
407
|
+
};
|
|
408
|
+
}, _ = (r, e)=>{
|
|
409
|
+
const n = v(r);
|
|
410
|
+
return n;
|
|
411
|
+
}, g = (()=>{
|
|
412
|
+
let r = 0;
|
|
413
|
+
return (e)=>{
|
|
414
|
+
const n = v(e), a = r += 1;
|
|
415
|
+
return (t)=>{
|
|
416
|
+
var o;
|
|
417
|
+
if (false === t.options.memoization) return n(t);
|
|
418
|
+
const u = t.index, s = (o = t.cache)[a] || (o[a] = new Map), c = s.get(u);
|
|
419
|
+
if (false === c) return false;
|
|
420
|
+
if (W(c)) return t.index = c, true;
|
|
421
|
+
if (c) return t.index = c.index, c.output?.length && t.output.push(...c.output), true;
|
|
422
|
+
{
|
|
423
|
+
const Z = t.output.length;
|
|
424
|
+
if (!n(t)) return s.set(u, false), false;
|
|
425
|
+
{
|
|
426
|
+
const D = t.index, U = t.output.length;
|
|
427
|
+
if (U > Z) {
|
|
428
|
+
const ee = t.output.slice(Z, U);
|
|
429
|
+
s.set(u, {
|
|
430
|
+
index: D,
|
|
431
|
+
output: ee
|
|
432
|
+
});
|
|
433
|
+
} else s.set(u, D);
|
|
434
|
+
return true;
|
|
435
|
+
}
|
|
436
|
+
}
|
|
437
|
+
};
|
|
438
|
+
};
|
|
439
|
+
})(), E = (r)=>{
|
|
440
|
+
let e;
|
|
441
|
+
return (n)=>(e || (e = v(r())), e(n));
|
|
442
|
+
}, v = Y((r)=>{
|
|
443
|
+
if (d(r)) return Q(r) ? E(r) : r;
|
|
444
|
+
if (b(r) || X(r)) return i(r);
|
|
445
|
+
if (A(r)) return x(r);
|
|
446
|
+
if (K(r)) return l(Object.values(r));
|
|
447
|
+
throw new Error("Invalid rule");
|
|
448
|
+
}), P = "abcdefghijklmnopqrstuvwxyz", ir = (r)=>{
|
|
449
|
+
let e = "";
|
|
450
|
+
for(; r > 0;){
|
|
451
|
+
const n = (r - 1) % 26;
|
|
452
|
+
e = P[n] + e, r = Math.floor((r - 1) / 26);
|
|
453
|
+
}
|
|
454
|
+
return e;
|
|
455
|
+
}, O = (r)=>{
|
|
456
|
+
let e = 0;
|
|
457
|
+
for(let n = 0, a = r.length; n < a; n++)e = 26 * e + P.indexOf(r[n]) + 1;
|
|
458
|
+
return e;
|
|
459
|
+
}, S = (r, e)=>{
|
|
460
|
+
if (e < r) return S(e, r);
|
|
461
|
+
const n = [];
|
|
462
|
+
for(; r <= e;)n.push(r++);
|
|
463
|
+
return n;
|
|
464
|
+
}, 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, {
|
|
465
|
+
memoization: false
|
|
466
|
+
}).join("")), ur = (r)=>{
|
|
467
|
+
const e = {};
|
|
468
|
+
return (n)=>e[n] ?? (e[n] = r(n));
|
|
469
|
+
}, 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([
|
|
470
|
+
hr,
|
|
471
|
+
dr
|
|
472
|
+
]), xr = i(/\/(\*\*\/)+/, "(?:/.+/|/)"), gr = i(/^(\*\*\/)+/, "(?:^|.*/)"), mr = i(/\/(\*\*)$/, "(?:/.*|$)"), _r = i(/\*\*/, ".*"), j = l([
|
|
473
|
+
xr,
|
|
474
|
+
gr,
|
|
475
|
+
mr,
|
|
476
|
+
_r
|
|
477
|
+
]), Sr = i(/\*\/(?!\*\*\/)/, "[^/]*/"), yr = i(/\*/, "[^/]*"), N = l([
|
|
478
|
+
Sr,
|
|
479
|
+
yr
|
|
480
|
+
]), 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([
|
|
481
|
+
y,
|
|
482
|
+
Cr,
|
|
483
|
+
br,
|
|
484
|
+
Mr
|
|
485
|
+
]), B = x([
|
|
486
|
+
$r,
|
|
487
|
+
tr(Ar),
|
|
488
|
+
f(Er),
|
|
489
|
+
wr
|
|
490
|
+
]), 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([
|
|
491
|
+
Rr,
|
|
492
|
+
zr,
|
|
493
|
+
jr
|
|
494
|
+
]), I = x([
|
|
495
|
+
Pr,
|
|
496
|
+
Nr,
|
|
497
|
+
Or
|
|
498
|
+
]), kr = i("{", "(?:"), Br = i("}", ")"), Ir = i(",", "|"), Fr = i(/[$.*+?^(){[\]\|]/, (r)=>`\\${r}`), Lr = i(/[^}]/, p), Zr = E(()=>F), Dr = l([
|
|
499
|
+
j,
|
|
500
|
+
N,
|
|
501
|
+
k,
|
|
502
|
+
B,
|
|
503
|
+
I,
|
|
504
|
+
Zr,
|
|
505
|
+
y,
|
|
506
|
+
Fr,
|
|
507
|
+
Ir,
|
|
508
|
+
Lr
|
|
509
|
+
]), F = x([
|
|
510
|
+
kr,
|
|
511
|
+
f(Dr),
|
|
512
|
+
Br
|
|
513
|
+
]), Ur = f(l([
|
|
514
|
+
sr,
|
|
515
|
+
cr,
|
|
516
|
+
lr,
|
|
517
|
+
fr,
|
|
518
|
+
j,
|
|
519
|
+
N,
|
|
520
|
+
k,
|
|
521
|
+
B,
|
|
522
|
+
I,
|
|
523
|
+
F,
|
|
524
|
+
y,
|
|
525
|
+
pr,
|
|
526
|
+
vr
|
|
527
|
+
])), 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([
|
|
528
|
+
Tr,
|
|
529
|
+
Hr,
|
|
530
|
+
Jr,
|
|
531
|
+
Qr,
|
|
532
|
+
qr
|
|
533
|
+
])), Kr = Wr, Xr = z(Kr), Yr = Xr, $ = (r, e)=>{
|
|
534
|
+
const n = Array.isArray(r) ? r : [
|
|
535
|
+
r
|
|
536
|
+
];
|
|
537
|
+
if (!n.length) return false;
|
|
538
|
+
const a = n.map($.compile), t = n.every((s)=>/(\/(?:\*\*)?|\[\/\])$/.test(s)), o = e.replace(/[\\\/]+/g, "/").replace(/\/$/, t ? "/" : "");
|
|
539
|
+
return a.some((s)=>s.test(o));
|
|
540
|
+
};
|
|
541
|
+
$.compile = (r)=>new RegExp(`^${L(Yr(r))}$`, "s");
|
|
542
|
+
var re = $;
|
|
543
|
+
return J(w);
|
|
544
|
+
})();
|
|
545
|
+
return __lib__.default || __lib__;
|
|
546
|
+
};
|
|
547
|
+
let _match;
|
|
548
|
+
const zeptomatch = (path, pattern)=>{
|
|
549
|
+
if (!_match) {
|
|
550
|
+
_match = _lazyMatch();
|
|
551
|
+
_lazyMatch = null;
|
|
552
|
+
}
|
|
553
|
+
return _match(path, pattern);
|
|
554
|
+
};
|
|
555
|
+
const _DRIVE_LETTER_START_RE = /^[A-Za-z]:\//;
|
|
556
|
+
function normalizeWindowsPath(input = "") {
|
|
557
|
+
if (!input) return input;
|
|
558
|
+
return input.replace(/\\/g, "/").replace(_DRIVE_LETTER_START_RE, (r)=>r.toUpperCase());
|
|
559
|
+
}
|
|
560
|
+
const _UNC_REGEX = /^[/\\]{2}/;
|
|
561
|
+
const _IS_ABSOLUTE_RE = /^[/\\](?![/\\])|^[/\\]{2}(?!\.)|^[A-Za-z]:[/\\]/;
|
|
562
|
+
const _DRIVE_LETTER_RE = /^[A-Za-z]:$/;
|
|
563
|
+
const _ROOT_FOLDER_RE = /^\/([A-Za-z]:)?$/;
|
|
564
|
+
const _EXTNAME_RE = /.(\.[^./]+|\.)$/;
|
|
565
|
+
const _PATH_ROOT_RE = /^[/\\]|^[a-zA-Z]:[/\\]/;
|
|
566
|
+
const sep = "/";
|
|
567
|
+
const normalize = function(path) {
|
|
568
|
+
if (0 === path.length) return ".";
|
|
569
|
+
path = normalizeWindowsPath(path);
|
|
570
|
+
const isUNCPath = path.match(_UNC_REGEX);
|
|
571
|
+
const isPathAbsolute = isAbsolute(path);
|
|
572
|
+
const trailingSeparator = "/" === path[path.length - 1];
|
|
573
|
+
path = normalizeString(path, !isPathAbsolute);
|
|
574
|
+
if (0 === path.length) {
|
|
575
|
+
if (isPathAbsolute) return "/";
|
|
576
|
+
return trailingSeparator ? "./" : ".";
|
|
577
|
+
}
|
|
578
|
+
if (trailingSeparator) path += "/";
|
|
579
|
+
if (_DRIVE_LETTER_RE.test(path)) path += "/";
|
|
580
|
+
if (isUNCPath) {
|
|
581
|
+
if (!isPathAbsolute) return `//./${path}`;
|
|
582
|
+
return `//${path}`;
|
|
583
|
+
}
|
|
584
|
+
return isPathAbsolute && !isAbsolute(path) ? `/${path}` : path;
|
|
585
|
+
};
|
|
586
|
+
const join = function(...segments) {
|
|
587
|
+
let path = "";
|
|
588
|
+
for (const seg of segments)if (seg) if (path.length > 0) {
|
|
589
|
+
const pathTrailing = "/" === path[path.length - 1];
|
|
590
|
+
const segLeading = "/" === seg[0];
|
|
591
|
+
const both = pathTrailing && segLeading;
|
|
592
|
+
if (both) path += seg.slice(1);
|
|
593
|
+
else path += pathTrailing || segLeading ? seg : `/${seg}`;
|
|
594
|
+
} else path += seg;
|
|
595
|
+
return normalize(path);
|
|
596
|
+
};
|
|
597
|
+
function cwd() {
|
|
598
|
+
if ("undefined" != typeof process && "function" == typeof process.cwd) return process.cwd().replace(/\\/g, "/");
|
|
599
|
+
return "/";
|
|
600
|
+
}
|
|
601
|
+
const resolve = function(...arguments_) {
|
|
602
|
+
arguments_ = arguments_.map((argument)=>normalizeWindowsPath(argument));
|
|
603
|
+
let resolvedPath = "";
|
|
604
|
+
let resolvedAbsolute = false;
|
|
605
|
+
for(let index = arguments_.length - 1; index >= -1 && !resolvedAbsolute; index--){
|
|
606
|
+
const path = index >= 0 ? arguments_[index] : cwd();
|
|
607
|
+
if (path && 0 !== path.length) {
|
|
608
|
+
resolvedPath = `${path}/${resolvedPath}`;
|
|
609
|
+
resolvedAbsolute = isAbsolute(path);
|
|
610
|
+
}
|
|
611
|
+
}
|
|
612
|
+
resolvedPath = normalizeString(resolvedPath, !resolvedAbsolute);
|
|
613
|
+
if (resolvedAbsolute && !isAbsolute(resolvedPath)) return `/${resolvedPath}`;
|
|
614
|
+
return resolvedPath.length > 0 ? resolvedPath : ".";
|
|
615
|
+
};
|
|
616
|
+
function normalizeString(path, allowAboveRoot) {
|
|
617
|
+
let res = "";
|
|
618
|
+
let lastSegmentLength = 0;
|
|
619
|
+
let lastSlash = -1;
|
|
620
|
+
let dots = 0;
|
|
621
|
+
let char = null;
|
|
622
|
+
for(let index = 0; index <= path.length; ++index){
|
|
623
|
+
if (index < path.length) char = path[index];
|
|
624
|
+
else if ("/" === char) break;
|
|
625
|
+
else char = "/";
|
|
626
|
+
if ("/" === char) {
|
|
627
|
+
if (lastSlash === index - 1 || 1 === dots) ;
|
|
628
|
+
else if (2 === dots) {
|
|
629
|
+
if (res.length < 2 || 2 !== lastSegmentLength || "." !== res[res.length - 1] || "." !== res[res.length - 2]) {
|
|
630
|
+
if (res.length > 2) {
|
|
631
|
+
const lastSlashIndex = res.lastIndexOf("/");
|
|
632
|
+
if (-1 === lastSlashIndex) {
|
|
633
|
+
res = "";
|
|
634
|
+
lastSegmentLength = 0;
|
|
635
|
+
} else {
|
|
636
|
+
res = res.slice(0, lastSlashIndex);
|
|
637
|
+
lastSegmentLength = res.length - 1 - res.lastIndexOf("/");
|
|
638
|
+
}
|
|
639
|
+
lastSlash = index;
|
|
640
|
+
dots = 0;
|
|
641
|
+
continue;
|
|
642
|
+
} else if (res.length > 0) {
|
|
643
|
+
res = "";
|
|
644
|
+
lastSegmentLength = 0;
|
|
645
|
+
lastSlash = index;
|
|
646
|
+
dots = 0;
|
|
647
|
+
continue;
|
|
648
|
+
}
|
|
649
|
+
}
|
|
650
|
+
if (allowAboveRoot) {
|
|
651
|
+
res += res.length > 0 ? "/.." : "..";
|
|
652
|
+
lastSegmentLength = 2;
|
|
653
|
+
}
|
|
654
|
+
} else {
|
|
655
|
+
if (res.length > 0) res += `/${path.slice(lastSlash + 1, index)}`;
|
|
656
|
+
else res = path.slice(lastSlash + 1, index);
|
|
657
|
+
lastSegmentLength = index - lastSlash - 1;
|
|
658
|
+
}
|
|
659
|
+
lastSlash = index;
|
|
660
|
+
dots = 0;
|
|
661
|
+
} else if ("." === char && -1 !== dots) ++dots;
|
|
662
|
+
else dots = -1;
|
|
663
|
+
}
|
|
664
|
+
return res;
|
|
665
|
+
}
|
|
666
|
+
const isAbsolute = function(p) {
|
|
667
|
+
return _IS_ABSOLUTE_RE.test(p);
|
|
668
|
+
};
|
|
669
|
+
const toNamespacedPath = function(p) {
|
|
670
|
+
return normalizeWindowsPath(p);
|
|
671
|
+
};
|
|
672
|
+
const extname = function(p) {
|
|
673
|
+
if (".." === p) return "";
|
|
674
|
+
const match = _EXTNAME_RE.exec(normalizeWindowsPath(p));
|
|
675
|
+
return match && match[1] || "";
|
|
676
|
+
};
|
|
677
|
+
const relative = function(from, to) {
|
|
678
|
+
const _from = resolve(from).replace(_ROOT_FOLDER_RE, "$1").split("/");
|
|
679
|
+
const _to = resolve(to).replace(_ROOT_FOLDER_RE, "$1").split("/");
|
|
680
|
+
if (":" === _to[0][1] && ":" === _from[0][1] && _from[0] !== _to[0]) return _to.join("/");
|
|
681
|
+
const _fromCopy = [
|
|
682
|
+
..._from
|
|
683
|
+
];
|
|
684
|
+
for (const segment of _fromCopy){
|
|
685
|
+
if (_to[0] !== segment) break;
|
|
686
|
+
_from.shift();
|
|
687
|
+
_to.shift();
|
|
688
|
+
}
|
|
689
|
+
return [
|
|
690
|
+
..._from.map(()=>".."),
|
|
691
|
+
..._to
|
|
692
|
+
].join("/");
|
|
693
|
+
};
|
|
694
|
+
const dirname = function(p) {
|
|
695
|
+
const segments = normalizeWindowsPath(p).replace(/\/$/, "").split("/").slice(0, -1);
|
|
696
|
+
if (1 === segments.length && _DRIVE_LETTER_RE.test(segments[0])) segments[0] += "/";
|
|
697
|
+
return segments.join("/") || (isAbsolute(p) ? "/" : ".");
|
|
698
|
+
};
|
|
699
|
+
const format = function(p) {
|
|
700
|
+
const ext = p.ext ? p.ext.startsWith(".") ? p.ext : `.${p.ext}` : "";
|
|
701
|
+
const segments = [
|
|
702
|
+
p.root,
|
|
703
|
+
p.dir,
|
|
704
|
+
p.base ?? (p.name ?? "") + ext
|
|
705
|
+
].filter(Boolean);
|
|
706
|
+
return normalizeWindowsPath(p.root ? resolve(...segments) : segments.join("/"));
|
|
707
|
+
};
|
|
708
|
+
const basename = function(p, extension) {
|
|
709
|
+
const segments = normalizeWindowsPath(p).split("/");
|
|
710
|
+
let lastSegment = "";
|
|
711
|
+
for(let i = segments.length - 1; i >= 0; i--){
|
|
712
|
+
const val = segments[i];
|
|
713
|
+
if (val) {
|
|
714
|
+
lastSegment = val;
|
|
715
|
+
break;
|
|
716
|
+
}
|
|
717
|
+
}
|
|
718
|
+
return extension && lastSegment.endsWith(extension) ? lastSegment.slice(0, -extension.length) : lastSegment;
|
|
719
|
+
};
|
|
720
|
+
const parse = function(p) {
|
|
721
|
+
const root = _PATH_ROOT_RE.exec(p)?.[0]?.replace(/\\/g, "/") || "";
|
|
722
|
+
const base = basename(p);
|
|
723
|
+
const extension = extname(base);
|
|
724
|
+
return {
|
|
725
|
+
root,
|
|
726
|
+
dir: dirname(p),
|
|
727
|
+
base,
|
|
728
|
+
ext: extension,
|
|
729
|
+
name: base.slice(0, base.length - extension.length)
|
|
730
|
+
};
|
|
731
|
+
};
|
|
732
|
+
const matchesGlob = (path, pattern)=>zeptomatch(pattern, normalize(path));
|
|
733
|
+
const _path = {
|
|
734
|
+
__proto__: null,
|
|
735
|
+
basename: basename,
|
|
736
|
+
dirname: dirname,
|
|
737
|
+
extname: extname,
|
|
738
|
+
format: format,
|
|
739
|
+
isAbsolute: isAbsolute,
|
|
740
|
+
join: join,
|
|
741
|
+
matchesGlob: matchesGlob,
|
|
742
|
+
normalize: normalize,
|
|
743
|
+
normalizeString: normalizeString,
|
|
744
|
+
parse: parse,
|
|
745
|
+
relative: relative,
|
|
746
|
+
resolve: resolve,
|
|
747
|
+
sep: sep,
|
|
748
|
+
toNamespacedPath: toNamespacedPath
|
|
749
|
+
};
|
|
750
|
+
const delimiter = /* @__PURE__ */ (()=>globalThis.process?.platform === "win32" ? ";" : ":")();
|
|
751
|
+
const _platforms = {
|
|
752
|
+
posix: void 0,
|
|
753
|
+
win32: void 0
|
|
754
|
+
};
|
|
755
|
+
const mix = (del = delimiter)=>new Proxy(_path, {
|
|
756
|
+
get (_, prop) {
|
|
757
|
+
if ("delimiter" === prop) return del;
|
|
758
|
+
if ("posix" === prop) return posix;
|
|
759
|
+
if ("win32" === prop) return win32;
|
|
760
|
+
return _platforms[prop] || _path[prop];
|
|
761
|
+
}
|
|
762
|
+
});
|
|
763
|
+
const posix = /* @__PURE__ */ mix(":");
|
|
764
|
+
const win32 = /* @__PURE__ */ mix(";");
|
|
765
|
+
export { basename, clearScreen, dirname, isAbsolute, isDebug, join, logger_logger, node_process, normalize, parse, posix, relative, resolve };
|