rsbuild-plugin-biome 0.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js ADDED
@@ -0,0 +1,3246 @@
1
+ import { existsSync } from "node:fs";
2
+ import node_path, { relative, sep } from "node:path";
3
+ import promises from "node:fs/promises";
4
+ import node_process from "node:process";
5
+ import { builtinModules } from "node:module";
6
+ import node_util, { stripVTControlCharacters } from "node:util";
7
+ import node_os from "node:os";
8
+ import node_tty from "node:tty";
9
+ import { createRequire as __rspack_createRequire } from "node:module";
10
+ const __rspack_createRequire_require = __rspack_createRequire(import.meta.url);
11
+ import * as __rspack_external_node_fs_5ea92f0c from "node:fs";
12
+ import * as __rspack_external_node_os_74b4b876 from "node:os";
13
+ var __webpack_modules__ = {};
14
+ var __webpack_module_cache__ = {};
15
+ function __webpack_require__(moduleId) {
16
+ var cachedModule = __webpack_module_cache__[moduleId];
17
+ if (void 0 !== cachedModule) return cachedModule.exports;
18
+ var module = __webpack_module_cache__[moduleId] = {
19
+ exports: {}
20
+ };
21
+ __webpack_modules__[moduleId](module, module.exports, __webpack_require__);
22
+ return module.exports;
23
+ }
24
+ __webpack_require__.m = __webpack_modules__;
25
+ (()=>{
26
+ __webpack_require__.add = function(modules) {
27
+ Object.assign(__webpack_require__.m, modules);
28
+ };
29
+ })();
30
+ __webpack_require__.add({
31
+ "../../node_modules/cross-spawn/index.js" (module, __unused_rspack_exports, __webpack_require__) {
32
+ const cp = __webpack_require__("child_process");
33
+ const parse = __webpack_require__("../../node_modules/cross-spawn/lib/parse.js");
34
+ const enoent = __webpack_require__("../../node_modules/cross-spawn/lib/enoent.js");
35
+ function spawn(command, args, options) {
36
+ const parsed = parse(command, args, options);
37
+ const spawned = cp.spawn(parsed.command, parsed.args, parsed.options);
38
+ enoent.hookChildProcess(spawned, parsed);
39
+ return spawned;
40
+ }
41
+ function spawnSync(command, args, options) {
42
+ const parsed = parse(command, args, options);
43
+ const result = cp.spawnSync(parsed.command, parsed.args, parsed.options);
44
+ result.error = result.error || enoent.verifyENOENTSync(result.status, parsed);
45
+ return result;
46
+ }
47
+ module.exports = spawn;
48
+ module.exports.spawn = spawn;
49
+ module.exports.sync = spawnSync;
50
+ module.exports._parse = parse;
51
+ module.exports._enoent = enoent;
52
+ },
53
+ "../../node_modules/cross-spawn/lib/enoent.js" (module) {
54
+ const isWin = 'win32' === process.platform;
55
+ function notFoundError(original, syscall) {
56
+ return Object.assign(new Error(`${syscall} ${original.command} ENOENT`), {
57
+ code: 'ENOENT',
58
+ errno: 'ENOENT',
59
+ syscall: `${syscall} ${original.command}`,
60
+ path: original.command,
61
+ spawnargs: original.args
62
+ });
63
+ }
64
+ function hookChildProcess(cp, parsed) {
65
+ if (!isWin) return;
66
+ const originalEmit = cp.emit;
67
+ cp.emit = function(name, arg1) {
68
+ if ('exit' === name) {
69
+ const err = verifyENOENT(arg1, parsed);
70
+ if (err) return originalEmit.call(cp, 'error', err);
71
+ }
72
+ return originalEmit.apply(cp, arguments);
73
+ };
74
+ }
75
+ function verifyENOENT(status, parsed) {
76
+ if (isWin && 1 === status && !parsed.file) return notFoundError(parsed.original, 'spawn');
77
+ return null;
78
+ }
79
+ function verifyENOENTSync(status, parsed) {
80
+ if (isWin && 1 === status && !parsed.file) return notFoundError(parsed.original, 'spawnSync');
81
+ return null;
82
+ }
83
+ module.exports = {
84
+ hookChildProcess,
85
+ verifyENOENT,
86
+ verifyENOENTSync,
87
+ notFoundError
88
+ };
89
+ },
90
+ "../../node_modules/cross-spawn/lib/parse.js" (module, __unused_rspack_exports, __webpack_require__) {
91
+ const path = __webpack_require__("path");
92
+ const resolveCommand = __webpack_require__("../../node_modules/cross-spawn/lib/util/resolveCommand.js");
93
+ const escape = __webpack_require__("../../node_modules/cross-spawn/lib/util/escape.js");
94
+ const readShebang = __webpack_require__("../../node_modules/cross-spawn/lib/util/readShebang.js");
95
+ const isWin = 'win32' === process.platform;
96
+ const isExecutableRegExp = /\.(?:com|exe)$/i;
97
+ const isCmdShimRegExp = /node_modules[\\/].bin[\\/][^\\/]+\.cmd$/i;
98
+ function detectShebang(parsed) {
99
+ parsed.file = resolveCommand(parsed);
100
+ const shebang = parsed.file && readShebang(parsed.file);
101
+ if (shebang) {
102
+ parsed.args.unshift(parsed.file);
103
+ parsed.command = shebang;
104
+ return resolveCommand(parsed);
105
+ }
106
+ return parsed.file;
107
+ }
108
+ function parseNonShell(parsed) {
109
+ if (!isWin) return parsed;
110
+ const commandFile = detectShebang(parsed);
111
+ const needsShell = !isExecutableRegExp.test(commandFile);
112
+ if (parsed.options.forceShell || needsShell) {
113
+ const needsDoubleEscapeMetaChars = isCmdShimRegExp.test(commandFile);
114
+ parsed.command = path.normalize(parsed.command);
115
+ parsed.command = escape.command(parsed.command);
116
+ parsed.args = parsed.args.map((arg)=>escape.argument(arg, needsDoubleEscapeMetaChars));
117
+ const shellCommand = [
118
+ parsed.command
119
+ ].concat(parsed.args).join(' ');
120
+ parsed.args = [
121
+ '/d',
122
+ '/s',
123
+ '/c',
124
+ `"${shellCommand}"`
125
+ ];
126
+ parsed.command = process.env.comspec || 'cmd.exe';
127
+ parsed.options.windowsVerbatimArguments = true;
128
+ }
129
+ return parsed;
130
+ }
131
+ function parse(command, args, options) {
132
+ if (args && !Array.isArray(args)) {
133
+ options = args;
134
+ args = null;
135
+ }
136
+ args = args ? args.slice(0) : [];
137
+ options = Object.assign({}, options);
138
+ const parsed = {
139
+ command,
140
+ args,
141
+ options,
142
+ file: void 0,
143
+ original: {
144
+ command,
145
+ args
146
+ }
147
+ };
148
+ return options.shell ? parsed : parseNonShell(parsed);
149
+ }
150
+ module.exports = parse;
151
+ },
152
+ "../../node_modules/cross-spawn/lib/util/escape.js" (module) {
153
+ const metaCharsRegExp = /([()\][%!^"`<>&|;, *?])/g;
154
+ function escapeCommand(arg) {
155
+ arg = arg.replace(metaCharsRegExp, '^$1');
156
+ return arg;
157
+ }
158
+ function escapeArgument(arg, doubleEscapeMetaChars) {
159
+ arg = `${arg}`;
160
+ arg = arg.replace(/(?=(\\+?)?)\1"/g, '$1$1\\"');
161
+ arg = arg.replace(/(?=(\\+?)?)\1$/, '$1$1');
162
+ arg = `"${arg}"`;
163
+ arg = arg.replace(metaCharsRegExp, '^$1');
164
+ if (doubleEscapeMetaChars) arg = arg.replace(metaCharsRegExp, '^$1');
165
+ return arg;
166
+ }
167
+ module.exports.command = escapeCommand;
168
+ module.exports.argument = escapeArgument;
169
+ },
170
+ "../../node_modules/cross-spawn/lib/util/readShebang.js" (module, __unused_rspack_exports, __webpack_require__) {
171
+ const fs = __webpack_require__("fs");
172
+ const shebangCommand = __webpack_require__("../../node_modules/shebang-command/index.js");
173
+ function readShebang(command) {
174
+ const size = 150;
175
+ const buffer = Buffer.alloc(size);
176
+ let fd;
177
+ try {
178
+ fd = fs.openSync(command, 'r');
179
+ fs.readSync(fd, buffer, 0, size, 0);
180
+ fs.closeSync(fd);
181
+ } catch (e) {}
182
+ return shebangCommand(buffer.toString());
183
+ }
184
+ module.exports = readShebang;
185
+ },
186
+ "../../node_modules/cross-spawn/lib/util/resolveCommand.js" (module, __unused_rspack_exports, __webpack_require__) {
187
+ const path = __webpack_require__("path");
188
+ const which = __webpack_require__("../../node_modules/which/which.js");
189
+ const getPathKey = __webpack_require__("../../node_modules/path-key/index.js");
190
+ function resolveCommandAttempt(parsed, withoutPathExt) {
191
+ const env = parsed.options.env || process.env;
192
+ const cwd = process.cwd();
193
+ const hasCustomCwd = null != parsed.options.cwd;
194
+ const shouldSwitchCwd = hasCustomCwd && void 0 !== process.chdir && !process.chdir.disabled;
195
+ if (shouldSwitchCwd) try {
196
+ process.chdir(parsed.options.cwd);
197
+ } catch (err) {}
198
+ let resolved;
199
+ try {
200
+ resolved = which.sync(parsed.command, {
201
+ path: env[getPathKey({
202
+ env
203
+ })],
204
+ pathExt: withoutPathExt ? path.delimiter : void 0
205
+ });
206
+ } catch (e) {} finally{
207
+ if (shouldSwitchCwd) process.chdir(cwd);
208
+ }
209
+ if (resolved) resolved = path.resolve(hasCustomCwd ? parsed.options.cwd : '', resolved);
210
+ return resolved;
211
+ }
212
+ function resolveCommand(parsed) {
213
+ return resolveCommandAttempt(parsed) || resolveCommandAttempt(parsed, true);
214
+ }
215
+ module.exports = resolveCommand;
216
+ },
217
+ "../../node_modules/isexe/index.js" (module, __unused_rspack_exports, __webpack_require__) {
218
+ __webpack_require__("fs");
219
+ var core;
220
+ core = 'win32' === process.platform || global.TESTING_WINDOWS ? __webpack_require__("../../node_modules/isexe/windows.js") : __webpack_require__("../../node_modules/isexe/mode.js");
221
+ module.exports = isexe;
222
+ isexe.sync = sync;
223
+ function isexe(path, options, cb) {
224
+ if ('function' == typeof options) {
225
+ cb = options;
226
+ options = {};
227
+ }
228
+ if (!cb) {
229
+ if ('function' != typeof Promise) throw new TypeError('callback not provided');
230
+ return new Promise(function(resolve, reject) {
231
+ isexe(path, options || {}, function(er, is) {
232
+ if (er) reject(er);
233
+ else resolve(is);
234
+ });
235
+ });
236
+ }
237
+ core(path, options || {}, function(er, is) {
238
+ if (er) {
239
+ if ('EACCES' === er.code || options && options.ignoreErrors) {
240
+ er = null;
241
+ is = false;
242
+ }
243
+ }
244
+ cb(er, is);
245
+ });
246
+ }
247
+ function sync(path, options) {
248
+ try {
249
+ return core.sync(path, options || {});
250
+ } catch (er) {
251
+ if (options && options.ignoreErrors || 'EACCES' === er.code) return false;
252
+ throw er;
253
+ }
254
+ }
255
+ },
256
+ "../../node_modules/isexe/mode.js" (module, __unused_rspack_exports, __webpack_require__) {
257
+ module.exports = isexe;
258
+ isexe.sync = sync;
259
+ var fs = __webpack_require__("fs");
260
+ function isexe(path, options, cb) {
261
+ fs.stat(path, function(er, stat) {
262
+ cb(er, er ? false : checkStat(stat, options));
263
+ });
264
+ }
265
+ function sync(path, options) {
266
+ return checkStat(fs.statSync(path), options);
267
+ }
268
+ function checkStat(stat, options) {
269
+ return stat.isFile() && checkMode(stat, options);
270
+ }
271
+ function checkMode(stat, options) {
272
+ var mod = stat.mode;
273
+ var uid = stat.uid;
274
+ var gid = stat.gid;
275
+ var myUid = void 0 !== options.uid ? options.uid : process.getuid && process.getuid();
276
+ var myGid = void 0 !== options.gid ? options.gid : process.getgid && process.getgid();
277
+ var u = parseInt('100', 8);
278
+ var g = parseInt('010', 8);
279
+ var o = parseInt('001', 8);
280
+ var ug = u | g;
281
+ var ret = mod & o || mod & g && gid === myGid || mod & u && uid === myUid || mod & ug && 0 === myUid;
282
+ return ret;
283
+ }
284
+ },
285
+ "../../node_modules/isexe/windows.js" (module, __unused_rspack_exports, __webpack_require__) {
286
+ module.exports = isexe;
287
+ isexe.sync = sync;
288
+ var fs = __webpack_require__("fs");
289
+ function checkPathExt(path, options) {
290
+ var pathext = void 0 !== options.pathExt ? options.pathExt : process.env.PATHEXT;
291
+ if (!pathext) return true;
292
+ pathext = pathext.split(';');
293
+ if (-1 !== pathext.indexOf('')) return true;
294
+ for(var i = 0; i < pathext.length; i++){
295
+ var p = pathext[i].toLowerCase();
296
+ if (p && path.substr(-p.length).toLowerCase() === p) return true;
297
+ }
298
+ return false;
299
+ }
300
+ function checkStat(stat, path, options) {
301
+ if (!stat.isSymbolicLink() && !stat.isFile()) return false;
302
+ return checkPathExt(path, options);
303
+ }
304
+ function isexe(path, options, cb) {
305
+ fs.stat(path, function(er, stat) {
306
+ cb(er, er ? false : checkStat(stat, path, options));
307
+ });
308
+ }
309
+ function sync(path, options) {
310
+ return checkStat(fs.statSync(path), path, options);
311
+ }
312
+ },
313
+ "../../node_modules/js-tokens/index.js" (__unused_rspack_module, exports) {
314
+ Object.defineProperty(exports, "__esModule", {
315
+ value: true
316
+ });
317
+ exports["default"] = /((['"])(?:(?!\2|\\).|\\(?:\r\n|[\s\S]))*(\2)?|`(?:[^`\\$]|\\[\s\S]|\$(?!\{)|\$\{(?:[^{}]|\{[^}]*\}?)*\}?)*(`)?)|(\/\/.*)|(\/\*(?:[^*]|\*(?!\/))*(\*\/)?)|(\/(?!\*)(?:\[(?:(?![\]\\]).|\\.)*\]|(?![\/\]\\]).|\\.)+\/(?:(?!\s*(?:\b|[\u0080-\uFFFF$\\'"~({]|[+\-!](?!=)|\.?\d))|[gmiyus]{1,6}\b(?![\u0080-\uFFFF$\\]|\s*(?:[+\-*%&|^<>!=?({]|\/(?![\/*])))))|(0[xX][\da-fA-F]+|0[oO][0-7]+|0[bB][01]+|(?:\d*\.\d+|\d+\.?)(?:[eE][+-]?\d+)?)|((?!\d)(?:(?!\s)[$\w\u0080-\uFFFF]|\\u[\da-fA-F]{4}|\\u\{[\da-fA-F]+\})+)|(--|\+\+|&&|\|\||=>|\.{3}|(?:[+\-\/%&|^]|\*{1,2}|<{1,2}|>{1,3}|!=?|={1,2})=?|[?~.,:;[\](){}])|(\s+)|(^$|[\s\S])/g;
318
+ exports.matchToToken = function(match) {
319
+ var token = {
320
+ type: "invalid",
321
+ value: match[0],
322
+ closed: void 0
323
+ };
324
+ if (match[1]) token.type = "string", token.closed = !!(match[3] || match[4]);
325
+ else if (match[5]) token.type = "comment";
326
+ else if (match[6]) token.type = "comment", token.closed = !!match[7];
327
+ else if (match[8]) token.type = "regex";
328
+ else if (match[9]) token.type = "number";
329
+ else if (match[10]) token.type = "name";
330
+ else if (match[11]) token.type = "punctuator";
331
+ else if (match[12]) token.type = "whitespace";
332
+ return token;
333
+ };
334
+ },
335
+ "../../node_modules/path-key/index.js" (module) {
336
+ const pathKey = (options = {})=>{
337
+ const environment = options.env || process.env;
338
+ const platform = options.platform || process.platform;
339
+ if ('win32' !== platform) return 'PATH';
340
+ return Object.keys(environment).reverse().find((key)=>'PATH' === key.toUpperCase()) || 'Path';
341
+ };
342
+ module.exports = pathKey;
343
+ module.exports["default"] = pathKey;
344
+ },
345
+ "../../node_modules/picocolors/picocolors.js" (module) {
346
+ let p = process || {}, argv = p.argv || [], env = p.env || {};
347
+ 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);
348
+ let formatter = (open, close, replace = open)=>(input)=>{
349
+ let string = "" + input, index = string.indexOf(close, open.length);
350
+ return ~index ? open + replaceClose(string, close, replace, index) + close : open + string + close;
351
+ };
352
+ let replaceClose = (string, close, replace, index)=>{
353
+ let result = "", cursor = 0;
354
+ do {
355
+ result += string.substring(cursor, index) + replace;
356
+ cursor = index + close.length;
357
+ index = string.indexOf(close, cursor);
358
+ }while (~index);
359
+ return result + string.substring(cursor);
360
+ };
361
+ let createColors = (enabled = isColorSupported)=>{
362
+ let f = enabled ? formatter : ()=>String;
363
+ return {
364
+ isColorSupported: enabled,
365
+ reset: f("\x1b[0m", "\x1b[0m"),
366
+ bold: f("\x1b[1m", "\x1b[22m", "\x1b[22m\x1b[1m"),
367
+ dim: f("\x1b[2m", "\x1b[22m", "\x1b[22m\x1b[2m"),
368
+ italic: f("\x1b[3m", "\x1b[23m"),
369
+ underline: f("\x1b[4m", "\x1b[24m"),
370
+ inverse: f("\x1b[7m", "\x1b[27m"),
371
+ hidden: f("\x1b[8m", "\x1b[28m"),
372
+ strikethrough: f("\x1b[9m", "\x1b[29m"),
373
+ black: f("\x1b[30m", "\x1b[39m"),
374
+ red: f("\x1b[31m", "\x1b[39m"),
375
+ green: f("\x1b[32m", "\x1b[39m"),
376
+ yellow: f("\x1b[33m", "\x1b[39m"),
377
+ blue: f("\x1b[34m", "\x1b[39m"),
378
+ magenta: f("\x1b[35m", "\x1b[39m"),
379
+ cyan: f("\x1b[36m", "\x1b[39m"),
380
+ white: f("\x1b[37m", "\x1b[39m"),
381
+ gray: f("\x1b[90m", "\x1b[39m"),
382
+ bgBlack: f("\x1b[40m", "\x1b[49m"),
383
+ bgRed: f("\x1b[41m", "\x1b[49m"),
384
+ bgGreen: f("\x1b[42m", "\x1b[49m"),
385
+ bgYellow: f("\x1b[43m", "\x1b[49m"),
386
+ bgBlue: f("\x1b[44m", "\x1b[49m"),
387
+ bgMagenta: f("\x1b[45m", "\x1b[49m"),
388
+ bgCyan: f("\x1b[46m", "\x1b[49m"),
389
+ bgWhite: f("\x1b[47m", "\x1b[49m"),
390
+ blackBright: f("\x1b[90m", "\x1b[39m"),
391
+ redBright: f("\x1b[91m", "\x1b[39m"),
392
+ greenBright: f("\x1b[92m", "\x1b[39m"),
393
+ yellowBright: f("\x1b[93m", "\x1b[39m"),
394
+ blueBright: f("\x1b[94m", "\x1b[39m"),
395
+ magentaBright: f("\x1b[95m", "\x1b[39m"),
396
+ cyanBright: f("\x1b[96m", "\x1b[39m"),
397
+ whiteBright: f("\x1b[97m", "\x1b[39m"),
398
+ bgBlackBright: f("\x1b[100m", "\x1b[49m"),
399
+ bgRedBright: f("\x1b[101m", "\x1b[49m"),
400
+ bgGreenBright: f("\x1b[102m", "\x1b[49m"),
401
+ bgYellowBright: f("\x1b[103m", "\x1b[49m"),
402
+ bgBlueBright: f("\x1b[104m", "\x1b[49m"),
403
+ bgMagentaBright: f("\x1b[105m", "\x1b[49m"),
404
+ bgCyanBright: f("\x1b[106m", "\x1b[49m"),
405
+ bgWhiteBright: f("\x1b[107m", "\x1b[49m")
406
+ };
407
+ };
408
+ module.exports = createColors();
409
+ module.exports.createColors = createColors;
410
+ },
411
+ "../../node_modules/shebang-command/index.js" (module, __unused_rspack_exports, __webpack_require__) {
412
+ const shebangRegex = __webpack_require__("../../node_modules/shebang-regex/index.js");
413
+ module.exports = (string = '')=>{
414
+ const match = string.match(shebangRegex);
415
+ if (!match) return null;
416
+ const [path, argument] = match[0].replace(/#! ?/, '').split(' ');
417
+ const binary = path.split('/').pop();
418
+ if ('env' === binary) return argument;
419
+ return argument ? `${binary} ${argument}` : binary;
420
+ };
421
+ },
422
+ "../../node_modules/shebang-regex/index.js" (module) {
423
+ module.exports = /^#!(.*)/;
424
+ },
425
+ "../../node_modules/which/which.js" (module, __unused_rspack_exports, __webpack_require__) {
426
+ const isWindows = 'win32' === process.platform || 'cygwin' === process.env.OSTYPE || 'msys' === process.env.OSTYPE;
427
+ const path = __webpack_require__("path");
428
+ const COLON = isWindows ? ';' : ':';
429
+ const isexe = __webpack_require__("../../node_modules/isexe/index.js");
430
+ const getNotFoundError = (cmd)=>Object.assign(new Error(`not found: ${cmd}`), {
431
+ code: 'ENOENT'
432
+ });
433
+ const getPathInfo = (cmd, opt)=>{
434
+ const colon = opt.colon || COLON;
435
+ const pathEnv = cmd.match(/\//) || isWindows && cmd.match(/\\/) ? [
436
+ ''
437
+ ] : [
438
+ ...isWindows ? [
439
+ process.cwd()
440
+ ] : [],
441
+ ...(opt.path || process.env.PATH || '').split(colon)
442
+ ];
443
+ const pathExtExe = isWindows ? opt.pathExt || process.env.PATHEXT || '.EXE;.CMD;.BAT;.COM' : '';
444
+ const pathExt = isWindows ? pathExtExe.split(colon) : [
445
+ ''
446
+ ];
447
+ if (isWindows) {
448
+ if (-1 !== cmd.indexOf('.') && '' !== pathExt[0]) pathExt.unshift('');
449
+ }
450
+ return {
451
+ pathEnv,
452
+ pathExt,
453
+ pathExtExe
454
+ };
455
+ };
456
+ const which = (cmd, opt, cb)=>{
457
+ if ('function' == typeof opt) {
458
+ cb = opt;
459
+ opt = {};
460
+ }
461
+ if (!opt) opt = {};
462
+ const { pathEnv, pathExt, pathExtExe } = getPathInfo(cmd, opt);
463
+ const found = [];
464
+ const step = (i)=>new Promise((resolve, reject)=>{
465
+ if (i === pathEnv.length) return opt.all && found.length ? resolve(found) : reject(getNotFoundError(cmd));
466
+ const ppRaw = pathEnv[i];
467
+ const pathPart = /^".*"$/.test(ppRaw) ? ppRaw.slice(1, -1) : ppRaw;
468
+ const pCmd = path.join(pathPart, cmd);
469
+ const p = !pathPart && /^\.[\\\/]/.test(cmd) ? cmd.slice(0, 2) + pCmd : pCmd;
470
+ resolve(subStep(p, i, 0));
471
+ });
472
+ const subStep = (p, i, ii)=>new Promise((resolve, reject)=>{
473
+ if (ii === pathExt.length) return resolve(step(i + 1));
474
+ const ext = pathExt[ii];
475
+ isexe(p + ext, {
476
+ pathExt: pathExtExe
477
+ }, (er, is)=>{
478
+ if (!er && is) if (!opt.all) return resolve(p + ext);
479
+ else found.push(p + ext);
480
+ return resolve(subStep(p, i, ii + 1));
481
+ });
482
+ });
483
+ return cb ? step(0).then((res)=>cb(null, res), cb) : step(0);
484
+ };
485
+ const whichSync = (cmd, opt)=>{
486
+ opt = opt || {};
487
+ const { pathEnv, pathExt, pathExtExe } = getPathInfo(cmd, opt);
488
+ const found = [];
489
+ for(let i = 0; i < pathEnv.length; i++){
490
+ const ppRaw = pathEnv[i];
491
+ const pathPart = /^".*"$/.test(ppRaw) ? ppRaw.slice(1, -1) : ppRaw;
492
+ const pCmd = path.join(pathPart, cmd);
493
+ const p = !pathPart && /^\.[\\\/]/.test(cmd) ? cmd.slice(0, 2) + pCmd : pCmd;
494
+ for(let j = 0; j < pathExt.length; j++){
495
+ const cur = p + pathExt[j];
496
+ try {
497
+ const is = isexe.sync(cur, {
498
+ pathExt: pathExtExe
499
+ });
500
+ if (is) if (!opt.all) return cur;
501
+ else found.push(cur);
502
+ } catch (ex) {}
503
+ }
504
+ }
505
+ if (opt.all && found.length) return found;
506
+ if (opt.nothrow) return null;
507
+ throw getNotFoundError(cmd);
508
+ };
509
+ module.exports = which;
510
+ which.sync = whichSync;
511
+ },
512
+ child_process (module) {
513
+ module.exports = __rspack_createRequire_require("child_process");
514
+ },
515
+ fs (module) {
516
+ module.exports = __rspack_createRequire_require("fs");
517
+ },
518
+ path (module) {
519
+ module.exports = __rspack_createRequire_require("path");
520
+ },
521
+ "../../node_modules/@babel/code-frame/lib/index.js" (__unused_rspack_module, exports, __webpack_require__) {
522
+ var picocolors = __webpack_require__("../../node_modules/picocolors/picocolors.js");
523
+ var jsTokens = __webpack_require__("../../node_modules/js-tokens/index.js");
524
+ var helperValidatorIdentifier = __webpack_require__("../../node_modules/@babel/helper-validator-identifier/lib/index.js");
525
+ function isColorSupported() {
526
+ return "object" == typeof process && ("0" === process.env.FORCE_COLOR || "false" === process.env.FORCE_COLOR) ? false : picocolors.isColorSupported;
527
+ }
528
+ const compose = (f, g)=>(v)=>f(g(v));
529
+ function buildDefs(colors) {
530
+ return {
531
+ keyword: colors.cyan,
532
+ capitalized: colors.yellow,
533
+ jsxIdentifier: colors.yellow,
534
+ punctuator: colors.yellow,
535
+ number: colors.magenta,
536
+ string: colors.green,
537
+ regex: colors.magenta,
538
+ comment: colors.gray,
539
+ invalid: compose(compose(colors.white, colors.bgRed), colors.bold),
540
+ gutter: colors.gray,
541
+ marker: compose(colors.red, colors.bold),
542
+ message: compose(colors.red, colors.bold),
543
+ reset: colors.reset
544
+ };
545
+ }
546
+ const defsOn = buildDefs(picocolors.createColors(true));
547
+ const defsOff = buildDefs(picocolors.createColors(false));
548
+ function getDefs(enabled) {
549
+ return enabled ? defsOn : defsOff;
550
+ }
551
+ const sometimesKeywords = new Set([
552
+ "as",
553
+ "async",
554
+ "from",
555
+ "get",
556
+ "of",
557
+ "set"
558
+ ]);
559
+ const NEWLINE$1 = /\r\n|[\n\r\u2028\u2029]/;
560
+ const BRACKET = /^[()[\]{}]$/;
561
+ let tokenize;
562
+ const JSX_TAG = /^[a-z][\w-]*$/i;
563
+ const getTokenType = function(token, offset, text) {
564
+ if ("name" === token.type) {
565
+ const tokenValue = token.value;
566
+ if (helperValidatorIdentifier.isKeyword(tokenValue) || helperValidatorIdentifier.isStrictReservedWord(tokenValue, true) || sometimesKeywords.has(tokenValue)) return "keyword";
567
+ if (JSX_TAG.test(tokenValue) && ("<" === text[offset - 1] || "</" === text.slice(offset - 2, offset))) return "jsxIdentifier";
568
+ const firstChar = String.fromCodePoint(tokenValue.codePointAt(0));
569
+ if (firstChar !== firstChar.toLowerCase()) return "capitalized";
570
+ }
571
+ if ("punctuator" === token.type && BRACKET.test(token.value)) return "bracket";
572
+ if ("invalid" === token.type && ("@" === token.value || "#" === token.value)) return "punctuator";
573
+ return token.type;
574
+ };
575
+ tokenize = function*(text) {
576
+ let match;
577
+ while(match = jsTokens.default.exec(text)){
578
+ const token = jsTokens.matchToToken(match);
579
+ yield {
580
+ type: getTokenType(token, match.index, text),
581
+ value: token.value
582
+ };
583
+ }
584
+ };
585
+ function highlight(text) {
586
+ if ("" === text) return "";
587
+ const defs = getDefs(true);
588
+ let highlighted = "";
589
+ for (const { type, value } of tokenize(text))if (type in defs) highlighted += value.split(NEWLINE$1).map((str)=>defs[type](str)).join("\n");
590
+ else highlighted += value;
591
+ return highlighted;
592
+ }
593
+ const NEWLINE = /\r\n|[\n\r\u2028\u2029]/;
594
+ function getMarkerLines(loc, source, opts, startLineBaseZero) {
595
+ const startLoc = Object.assign({
596
+ column: 0,
597
+ line: -1
598
+ }, loc.start);
599
+ const endLoc = Object.assign({}, startLoc, loc.end);
600
+ const { linesAbove = 2, linesBelow = 3 } = opts || {};
601
+ const startLine = startLoc.line - startLineBaseZero;
602
+ const startColumn = startLoc.column;
603
+ const endLine = endLoc.line - startLineBaseZero;
604
+ const endColumn = endLoc.column;
605
+ let start = Math.max(startLine - (linesAbove + 1), 0);
606
+ let end = Math.min(source.length, endLine + linesBelow);
607
+ if (-1 === startLine) start = 0;
608
+ if (-1 === endLine) end = source.length;
609
+ const lineDiff = endLine - startLine;
610
+ const markerLines = {};
611
+ if (lineDiff) for(let i = 0; i <= lineDiff; i++){
612
+ const lineNumber = i + startLine;
613
+ if (startColumn) if (0 === i) {
614
+ const sourceLength = source[lineNumber - 1].length;
615
+ markerLines[lineNumber] = [
616
+ startColumn,
617
+ sourceLength - startColumn + 1
618
+ ];
619
+ } else if (i === lineDiff) markerLines[lineNumber] = [
620
+ 0,
621
+ endColumn
622
+ ];
623
+ else {
624
+ const sourceLength = source[lineNumber - i].length;
625
+ markerLines[lineNumber] = [
626
+ 0,
627
+ sourceLength
628
+ ];
629
+ }
630
+ else markerLines[lineNumber] = true;
631
+ }
632
+ else if (startColumn === endColumn) if (startColumn) markerLines[startLine] = [
633
+ startColumn,
634
+ 0
635
+ ];
636
+ else markerLines[startLine] = true;
637
+ else markerLines[startLine] = [
638
+ startColumn,
639
+ endColumn - startColumn
640
+ ];
641
+ return {
642
+ start,
643
+ end,
644
+ markerLines
645
+ };
646
+ }
647
+ function codeFrameColumns(rawLines, loc, opts = {}) {
648
+ const shouldHighlight = opts.forceColor || isColorSupported() && opts.highlightCode;
649
+ const startLineBaseZero = (opts.startLine || 1) - 1;
650
+ const defs = getDefs(shouldHighlight);
651
+ const lines = rawLines.split(NEWLINE);
652
+ const { start, end, markerLines } = getMarkerLines(loc, lines, opts, startLineBaseZero);
653
+ const hasColumns = loc.start && "number" == typeof loc.start.column;
654
+ const numberMaxWidth = String(end + startLineBaseZero).length;
655
+ const highlightedLines = shouldHighlight ? highlight(rawLines) : rawLines;
656
+ let frame = highlightedLines.split(NEWLINE, end).slice(start, end).map((line, index)=>{
657
+ const number = start + 1 + index;
658
+ const paddedNumber = ` ${number + startLineBaseZero}`.slice(-numberMaxWidth);
659
+ const gutter = ` ${paddedNumber} |`;
660
+ const hasMarker = markerLines[number];
661
+ const lastMarkerLine = !markerLines[number + 1];
662
+ if (!hasMarker) return ` ${defs.gutter(gutter)}${line.length > 0 ? ` ${line}` : ""}`;
663
+ {
664
+ let markerLine = "";
665
+ if (Array.isArray(hasMarker)) {
666
+ const markerSpacing = line.slice(0, Math.max(hasMarker[0] - 1, 0)).replace(/[^\t]/g, " ");
667
+ const numberOfMarkers = hasMarker[1] || 1;
668
+ markerLine = [
669
+ "\n ",
670
+ defs.gutter(gutter.replace(/\d/g, " ")),
671
+ " ",
672
+ markerSpacing,
673
+ defs.marker("^").repeat(numberOfMarkers)
674
+ ].join("");
675
+ if (lastMarkerLine && opts.message) markerLine += " " + defs.message(opts.message);
676
+ }
677
+ return [
678
+ defs.marker(">"),
679
+ defs.gutter(gutter),
680
+ line.length > 0 ? ` ${line}` : "",
681
+ markerLine
682
+ ].join("");
683
+ }
684
+ }).join("\n");
685
+ if (opts.message && !hasColumns) frame = `${" ".repeat(numberMaxWidth + 1)}${opts.message}\n${frame}`;
686
+ if (shouldHighlight) return defs.reset(frame);
687
+ return frame;
688
+ }
689
+ exports.gl = codeFrameColumns;
690
+ },
691
+ "../../node_modules/@babel/helper-validator-identifier/lib/identifier.js" (__unused_rspack_module, exports) {
692
+ Object.defineProperty(exports, "__esModule", {
693
+ value: true
694
+ });
695
+ exports.isIdentifierChar = isIdentifierChar;
696
+ exports.isIdentifierName = isIdentifierName;
697
+ exports.isIdentifierStart = isIdentifierStart;
698
+ let nonASCIIidentifierStartChars = "\xaa\xb5\xba\xc0-\xd6\xd8-\xf6\xf8-\u02c1\u02c6-\u02d1\u02e0-\u02e4\u02ec\u02ee\u0370-\u0374\u0376\u0377\u037a-\u037d\u037f\u0386\u0388-\u038a\u038c\u038e-\u03a1\u03a3-\u03f5\u03f7-\u0481\u048a-\u052f\u0531-\u0556\u0559\u0560-\u0588\u05d0-\u05ea\u05ef-\u05f2\u0620-\u064a\u066e\u066f\u0671-\u06d3\u06d5\u06e5\u06e6\u06ee\u06ef\u06fa-\u06fc\u06ff\u0710\u0712-\u072f\u074d-\u07a5\u07b1\u07ca-\u07ea\u07f4\u07f5\u07fa\u0800-\u0815\u081a\u0824\u0828\u0840-\u0858\u0860-\u086a\u0870-\u0887\u0889-\u088f\u08a0-\u08c9\u0904-\u0939\u093d\u0950\u0958-\u0961\u0971-\u0980\u0985-\u098c\u098f\u0990\u0993-\u09a8\u09aa-\u09b0\u09b2\u09b6-\u09b9\u09bd\u09ce\u09dc\u09dd\u09df-\u09e1\u09f0\u09f1\u09fc\u0a05-\u0a0a\u0a0f\u0a10\u0a13-\u0a28\u0a2a-\u0a30\u0a32\u0a33\u0a35\u0a36\u0a38\u0a39\u0a59-\u0a5c\u0a5e\u0a72-\u0a74\u0a85-\u0a8d\u0a8f-\u0a91\u0a93-\u0aa8\u0aaa-\u0ab0\u0ab2\u0ab3\u0ab5-\u0ab9\u0abd\u0ad0\u0ae0\u0ae1\u0af9\u0b05-\u0b0c\u0b0f\u0b10\u0b13-\u0b28\u0b2a-\u0b30\u0b32\u0b33\u0b35-\u0b39\u0b3d\u0b5c\u0b5d\u0b5f-\u0b61\u0b71\u0b83\u0b85-\u0b8a\u0b8e-\u0b90\u0b92-\u0b95\u0b99\u0b9a\u0b9c\u0b9e\u0b9f\u0ba3\u0ba4\u0ba8-\u0baa\u0bae-\u0bb9\u0bd0\u0c05-\u0c0c\u0c0e-\u0c10\u0c12-\u0c28\u0c2a-\u0c39\u0c3d\u0c58-\u0c5a\u0c5c\u0c5d\u0c60\u0c61\u0c80\u0c85-\u0c8c\u0c8e-\u0c90\u0c92-\u0ca8\u0caa-\u0cb3\u0cb5-\u0cb9\u0cbd\u0cdc-\u0cde\u0ce0\u0ce1\u0cf1\u0cf2\u0d04-\u0d0c\u0d0e-\u0d10\u0d12-\u0d3a\u0d3d\u0d4e\u0d54-\u0d56\u0d5f-\u0d61\u0d7a-\u0d7f\u0d85-\u0d96\u0d9a-\u0db1\u0db3-\u0dbb\u0dbd\u0dc0-\u0dc6\u0e01-\u0e30\u0e32\u0e33\u0e40-\u0e46\u0e81\u0e82\u0e84\u0e86-\u0e8a\u0e8c-\u0ea3\u0ea5\u0ea7-\u0eb0\u0eb2\u0eb3\u0ebd\u0ec0-\u0ec4\u0ec6\u0edc-\u0edf\u0f00\u0f40-\u0f47\u0f49-\u0f6c\u0f88-\u0f8c\u1000-\u102a\u103f\u1050-\u1055\u105a-\u105d\u1061\u1065\u1066\u106e-\u1070\u1075-\u1081\u108e\u10a0-\u10c5\u10c7\u10cd\u10d0-\u10fa\u10fc-\u1248\u124a-\u124d\u1250-\u1256\u1258\u125a-\u125d\u1260-\u1288\u128a-\u128d\u1290-\u12b0\u12b2-\u12b5\u12b8-\u12be\u12c0\u12c2-\u12c5\u12c8-\u12d6\u12d8-\u1310\u1312-\u1315\u1318-\u135a\u1380-\u138f\u13a0-\u13f5\u13f8-\u13fd\u1401-\u166c\u166f-\u167f\u1681-\u169a\u16a0-\u16ea\u16ee-\u16f8\u1700-\u1711\u171f-\u1731\u1740-\u1751\u1760-\u176c\u176e-\u1770\u1780-\u17b3\u17d7\u17dc\u1820-\u1878\u1880-\u18a8\u18aa\u18b0-\u18f5\u1900-\u191e\u1950-\u196d\u1970-\u1974\u1980-\u19ab\u19b0-\u19c9\u1a00-\u1a16\u1a20-\u1a54\u1aa7\u1b05-\u1b33\u1b45-\u1b4c\u1b83-\u1ba0\u1bae\u1baf\u1bba-\u1be5\u1c00-\u1c23\u1c4d-\u1c4f\u1c5a-\u1c7d\u1c80-\u1c8a\u1c90-\u1cba\u1cbd-\u1cbf\u1ce9-\u1cec\u1cee-\u1cf3\u1cf5\u1cf6\u1cfa\u1d00-\u1dbf\u1e00-\u1f15\u1f18-\u1f1d\u1f20-\u1f45\u1f48-\u1f4d\u1f50-\u1f57\u1f59\u1f5b\u1f5d\u1f5f-\u1f7d\u1f80-\u1fb4\u1fb6-\u1fbc\u1fbe\u1fc2-\u1fc4\u1fc6-\u1fcc\u1fd0-\u1fd3\u1fd6-\u1fdb\u1fe0-\u1fec\u1ff2-\u1ff4\u1ff6-\u1ffc\u2071\u207f\u2090-\u209c\u2102\u2107\u210a-\u2113\u2115\u2118-\u211d\u2124\u2126\u2128\u212a-\u2139\u213c-\u213f\u2145-\u2149\u214e\u2160-\u2188\u2c00-\u2ce4\u2ceb-\u2cee\u2cf2\u2cf3\u2d00-\u2d25\u2d27\u2d2d\u2d30-\u2d67\u2d6f\u2d80-\u2d96\u2da0-\u2da6\u2da8-\u2dae\u2db0-\u2db6\u2db8-\u2dbe\u2dc0-\u2dc6\u2dc8-\u2dce\u2dd0-\u2dd6\u2dd8-\u2dde\u3005-\u3007\u3021-\u3029\u3031-\u3035\u3038-\u303c\u3041-\u3096\u309b-\u309f\u30a1-\u30fa\u30fc-\u30ff\u3105-\u312f\u3131-\u318e\u31a0-\u31bf\u31f0-\u31ff\u3400-\u4dbf\u4e00-\ua48c\ua4d0-\ua4fd\ua500-\ua60c\ua610-\ua61f\ua62a\ua62b\ua640-\ua66e\ua67f-\ua69d\ua6a0-\ua6ef\ua717-\ua71f\ua722-\ua788\ua78b-\ua7dc\ua7f1-\ua801\ua803-\ua805\ua807-\ua80a\ua80c-\ua822\ua840-\ua873\ua882-\ua8b3\ua8f2-\ua8f7\ua8fb\ua8fd\ua8fe\ua90a-\ua925\ua930-\ua946\ua960-\ua97c\ua984-\ua9b2\ua9cf\ua9e0-\ua9e4\ua9e6-\ua9ef\ua9fa-\ua9fe\uaa00-\uaa28\uaa40-\uaa42\uaa44-\uaa4b\uaa60-\uaa76\uaa7a\uaa7e-\uaaaf\uaab1\uaab5\uaab6\uaab9-\uaabd\uaac0\uaac2\uaadb-\uaadd\uaae0-\uaaea\uaaf2-\uaaf4\uab01-\uab06\uab09-\uab0e\uab11-\uab16\uab20-\uab26\uab28-\uab2e\uab30-\uab5a\uab5c-\uab69\uab70-\uabe2\uac00-\ud7a3\ud7b0-\ud7c6\ud7cb-\ud7fb\uf900-\ufa6d\ufa70-\ufad9\ufb00-\ufb06\ufb13-\ufb17\ufb1d\ufb1f-\ufb28\ufb2a-\ufb36\ufb38-\ufb3c\ufb3e\ufb40\ufb41\ufb43\ufb44\ufb46-\ufbb1\ufbd3-\ufd3d\ufd50-\ufd8f\ufd92-\ufdc7\ufdf0-\ufdfb\ufe70-\ufe74\ufe76-\ufefc\uff21-\uff3a\uff41-\uff5a\uff66-\uffbe\uffc2-\uffc7\uffca-\uffcf\uffd2-\uffd7\uffda-\uffdc";
699
+ let nonASCIIidentifierChars = "\xb7\u0300-\u036f\u0387\u0483-\u0487\u0591-\u05bd\u05bf\u05c1\u05c2\u05c4\u05c5\u05c7\u0610-\u061a\u064b-\u0669\u0670\u06d6-\u06dc\u06df-\u06e4\u06e7\u06e8\u06ea-\u06ed\u06f0-\u06f9\u0711\u0730-\u074a\u07a6-\u07b0\u07c0-\u07c9\u07eb-\u07f3\u07fd\u0816-\u0819\u081b-\u0823\u0825-\u0827\u0829-\u082d\u0859-\u085b\u0897-\u089f\u08ca-\u08e1\u08e3-\u0903\u093a-\u093c\u093e-\u094f\u0951-\u0957\u0962\u0963\u0966-\u096f\u0981-\u0983\u09bc\u09be-\u09c4\u09c7\u09c8\u09cb-\u09cd\u09d7\u09e2\u09e3\u09e6-\u09ef\u09fe\u0a01-\u0a03\u0a3c\u0a3e-\u0a42\u0a47\u0a48\u0a4b-\u0a4d\u0a51\u0a66-\u0a71\u0a75\u0a81-\u0a83\u0abc\u0abe-\u0ac5\u0ac7-\u0ac9\u0acb-\u0acd\u0ae2\u0ae3\u0ae6-\u0aef\u0afa-\u0aff\u0b01-\u0b03\u0b3c\u0b3e-\u0b44\u0b47\u0b48\u0b4b-\u0b4d\u0b55-\u0b57\u0b62\u0b63\u0b66-\u0b6f\u0b82\u0bbe-\u0bc2\u0bc6-\u0bc8\u0bca-\u0bcd\u0bd7\u0be6-\u0bef\u0c00-\u0c04\u0c3c\u0c3e-\u0c44\u0c46-\u0c48\u0c4a-\u0c4d\u0c55\u0c56\u0c62\u0c63\u0c66-\u0c6f\u0c81-\u0c83\u0cbc\u0cbe-\u0cc4\u0cc6-\u0cc8\u0cca-\u0ccd\u0cd5\u0cd6\u0ce2\u0ce3\u0ce6-\u0cef\u0cf3\u0d00-\u0d03\u0d3b\u0d3c\u0d3e-\u0d44\u0d46-\u0d48\u0d4a-\u0d4d\u0d57\u0d62\u0d63\u0d66-\u0d6f\u0d81-\u0d83\u0dca\u0dcf-\u0dd4\u0dd6\u0dd8-\u0ddf\u0de6-\u0def\u0df2\u0df3\u0e31\u0e34-\u0e3a\u0e47-\u0e4e\u0e50-\u0e59\u0eb1\u0eb4-\u0ebc\u0ec8-\u0ece\u0ed0-\u0ed9\u0f18\u0f19\u0f20-\u0f29\u0f35\u0f37\u0f39\u0f3e\u0f3f\u0f71-\u0f84\u0f86\u0f87\u0f8d-\u0f97\u0f99-\u0fbc\u0fc6\u102b-\u103e\u1040-\u1049\u1056-\u1059\u105e-\u1060\u1062-\u1064\u1067-\u106d\u1071-\u1074\u1082-\u108d\u108f-\u109d\u135d-\u135f\u1369-\u1371\u1712-\u1715\u1732-\u1734\u1752\u1753\u1772\u1773\u17b4-\u17d3\u17dd\u17e0-\u17e9\u180b-\u180d\u180f-\u1819\u18a9\u1920-\u192b\u1930-\u193b\u1946-\u194f\u19d0-\u19da\u1a17-\u1a1b\u1a55-\u1a5e\u1a60-\u1a7c\u1a7f-\u1a89\u1a90-\u1a99\u1ab0-\u1abd\u1abf-\u1add\u1ae0-\u1aeb\u1b00-\u1b04\u1b34-\u1b44\u1b50-\u1b59\u1b6b-\u1b73\u1b80-\u1b82\u1ba1-\u1bad\u1bb0-\u1bb9\u1be6-\u1bf3\u1c24-\u1c37\u1c40-\u1c49\u1c50-\u1c59\u1cd0-\u1cd2\u1cd4-\u1ce8\u1ced\u1cf4\u1cf7-\u1cf9\u1dc0-\u1dff\u200c\u200d\u203f\u2040\u2054\u20d0-\u20dc\u20e1\u20e5-\u20f0\u2cef-\u2cf1\u2d7f\u2de0-\u2dff\u302a-\u302f\u3099\u309a\u30fb\ua620-\ua629\ua66f\ua674-\ua67d\ua69e\ua69f\ua6f0\ua6f1\ua802\ua806\ua80b\ua823-\ua827\ua82c\ua880\ua881\ua8b4-\ua8c5\ua8d0-\ua8d9\ua8e0-\ua8f1\ua8ff-\ua909\ua926-\ua92d\ua947-\ua953\ua980-\ua983\ua9b3-\ua9c0\ua9d0-\ua9d9\ua9e5\ua9f0-\ua9f9\uaa29-\uaa36\uaa43\uaa4c\uaa4d\uaa50-\uaa59\uaa7b-\uaa7d\uaab0\uaab2-\uaab4\uaab7\uaab8\uaabe\uaabf\uaac1\uaaeb-\uaaef\uaaf5\uaaf6\uabe3-\uabea\uabec\uabed\uabf0-\uabf9\ufb1e\ufe00-\ufe0f\ufe20-\ufe2f\ufe33\ufe34\ufe4d-\ufe4f\uff10-\uff19\uff3f\uff65";
700
+ const nonASCIIidentifierStart = new RegExp("[" + nonASCIIidentifierStartChars + "]");
701
+ const nonASCIIidentifier = new RegExp("[" + nonASCIIidentifierStartChars + nonASCIIidentifierChars + "]");
702
+ nonASCIIidentifierStartChars = nonASCIIidentifierChars = null;
703
+ const astralIdentifierStartCodes = [
704
+ 0,
705
+ 11,
706
+ 2,
707
+ 25,
708
+ 2,
709
+ 18,
710
+ 2,
711
+ 1,
712
+ 2,
713
+ 14,
714
+ 3,
715
+ 13,
716
+ 35,
717
+ 122,
718
+ 70,
719
+ 52,
720
+ 268,
721
+ 28,
722
+ 4,
723
+ 48,
724
+ 48,
725
+ 31,
726
+ 14,
727
+ 29,
728
+ 6,
729
+ 37,
730
+ 11,
731
+ 29,
732
+ 3,
733
+ 35,
734
+ 5,
735
+ 7,
736
+ 2,
737
+ 4,
738
+ 43,
739
+ 157,
740
+ 19,
741
+ 35,
742
+ 5,
743
+ 35,
744
+ 5,
745
+ 39,
746
+ 9,
747
+ 51,
748
+ 13,
749
+ 10,
750
+ 2,
751
+ 14,
752
+ 2,
753
+ 6,
754
+ 2,
755
+ 1,
756
+ 2,
757
+ 10,
758
+ 2,
759
+ 14,
760
+ 2,
761
+ 6,
762
+ 2,
763
+ 1,
764
+ 4,
765
+ 51,
766
+ 13,
767
+ 310,
768
+ 10,
769
+ 21,
770
+ 11,
771
+ 7,
772
+ 25,
773
+ 5,
774
+ 2,
775
+ 41,
776
+ 2,
777
+ 8,
778
+ 70,
779
+ 5,
780
+ 3,
781
+ 0,
782
+ 2,
783
+ 43,
784
+ 2,
785
+ 1,
786
+ 4,
787
+ 0,
788
+ 3,
789
+ 22,
790
+ 11,
791
+ 22,
792
+ 10,
793
+ 30,
794
+ 66,
795
+ 18,
796
+ 2,
797
+ 1,
798
+ 11,
799
+ 21,
800
+ 11,
801
+ 25,
802
+ 7,
803
+ 25,
804
+ 39,
805
+ 55,
806
+ 7,
807
+ 1,
808
+ 65,
809
+ 0,
810
+ 16,
811
+ 3,
812
+ 2,
813
+ 2,
814
+ 2,
815
+ 28,
816
+ 43,
817
+ 28,
818
+ 4,
819
+ 28,
820
+ 36,
821
+ 7,
822
+ 2,
823
+ 27,
824
+ 28,
825
+ 53,
826
+ 11,
827
+ 21,
828
+ 11,
829
+ 18,
830
+ 14,
831
+ 17,
832
+ 111,
833
+ 72,
834
+ 56,
835
+ 50,
836
+ 14,
837
+ 50,
838
+ 14,
839
+ 35,
840
+ 39,
841
+ 27,
842
+ 10,
843
+ 22,
844
+ 251,
845
+ 41,
846
+ 7,
847
+ 1,
848
+ 17,
849
+ 5,
850
+ 57,
851
+ 28,
852
+ 11,
853
+ 0,
854
+ 9,
855
+ 21,
856
+ 43,
857
+ 17,
858
+ 47,
859
+ 20,
860
+ 28,
861
+ 22,
862
+ 13,
863
+ 52,
864
+ 58,
865
+ 1,
866
+ 3,
867
+ 0,
868
+ 14,
869
+ 44,
870
+ 33,
871
+ 24,
872
+ 27,
873
+ 35,
874
+ 30,
875
+ 0,
876
+ 3,
877
+ 0,
878
+ 9,
879
+ 34,
880
+ 4,
881
+ 0,
882
+ 13,
883
+ 47,
884
+ 15,
885
+ 3,
886
+ 22,
887
+ 0,
888
+ 2,
889
+ 0,
890
+ 36,
891
+ 17,
892
+ 2,
893
+ 24,
894
+ 20,
895
+ 1,
896
+ 64,
897
+ 6,
898
+ 2,
899
+ 0,
900
+ 2,
901
+ 3,
902
+ 2,
903
+ 14,
904
+ 2,
905
+ 9,
906
+ 8,
907
+ 46,
908
+ 39,
909
+ 7,
910
+ 3,
911
+ 1,
912
+ 3,
913
+ 21,
914
+ 2,
915
+ 6,
916
+ 2,
917
+ 1,
918
+ 2,
919
+ 4,
920
+ 4,
921
+ 0,
922
+ 19,
923
+ 0,
924
+ 13,
925
+ 4,
926
+ 31,
927
+ 9,
928
+ 2,
929
+ 0,
930
+ 3,
931
+ 0,
932
+ 2,
933
+ 37,
934
+ 2,
935
+ 0,
936
+ 26,
937
+ 0,
938
+ 2,
939
+ 0,
940
+ 45,
941
+ 52,
942
+ 19,
943
+ 3,
944
+ 21,
945
+ 2,
946
+ 31,
947
+ 47,
948
+ 21,
949
+ 1,
950
+ 2,
951
+ 0,
952
+ 185,
953
+ 46,
954
+ 42,
955
+ 3,
956
+ 37,
957
+ 47,
958
+ 21,
959
+ 0,
960
+ 60,
961
+ 42,
962
+ 14,
963
+ 0,
964
+ 72,
965
+ 26,
966
+ 38,
967
+ 6,
968
+ 186,
969
+ 43,
970
+ 117,
971
+ 63,
972
+ 32,
973
+ 7,
974
+ 3,
975
+ 0,
976
+ 3,
977
+ 7,
978
+ 2,
979
+ 1,
980
+ 2,
981
+ 23,
982
+ 16,
983
+ 0,
984
+ 2,
985
+ 0,
986
+ 95,
987
+ 7,
988
+ 3,
989
+ 38,
990
+ 17,
991
+ 0,
992
+ 2,
993
+ 0,
994
+ 29,
995
+ 0,
996
+ 11,
997
+ 39,
998
+ 8,
999
+ 0,
1000
+ 22,
1001
+ 0,
1002
+ 12,
1003
+ 45,
1004
+ 20,
1005
+ 0,
1006
+ 19,
1007
+ 72,
1008
+ 200,
1009
+ 32,
1010
+ 32,
1011
+ 8,
1012
+ 2,
1013
+ 36,
1014
+ 18,
1015
+ 0,
1016
+ 50,
1017
+ 29,
1018
+ 113,
1019
+ 6,
1020
+ 2,
1021
+ 1,
1022
+ 2,
1023
+ 37,
1024
+ 22,
1025
+ 0,
1026
+ 26,
1027
+ 5,
1028
+ 2,
1029
+ 1,
1030
+ 2,
1031
+ 31,
1032
+ 15,
1033
+ 0,
1034
+ 24,
1035
+ 43,
1036
+ 261,
1037
+ 18,
1038
+ 16,
1039
+ 0,
1040
+ 2,
1041
+ 12,
1042
+ 2,
1043
+ 33,
1044
+ 125,
1045
+ 0,
1046
+ 80,
1047
+ 921,
1048
+ 103,
1049
+ 110,
1050
+ 18,
1051
+ 195,
1052
+ 2637,
1053
+ 96,
1054
+ 16,
1055
+ 1071,
1056
+ 18,
1057
+ 5,
1058
+ 26,
1059
+ 3994,
1060
+ 6,
1061
+ 582,
1062
+ 6842,
1063
+ 29,
1064
+ 1763,
1065
+ 568,
1066
+ 8,
1067
+ 30,
1068
+ 18,
1069
+ 78,
1070
+ 18,
1071
+ 29,
1072
+ 19,
1073
+ 47,
1074
+ 17,
1075
+ 3,
1076
+ 32,
1077
+ 20,
1078
+ 6,
1079
+ 18,
1080
+ 433,
1081
+ 44,
1082
+ 212,
1083
+ 63,
1084
+ 33,
1085
+ 24,
1086
+ 3,
1087
+ 24,
1088
+ 45,
1089
+ 74,
1090
+ 6,
1091
+ 0,
1092
+ 67,
1093
+ 12,
1094
+ 65,
1095
+ 1,
1096
+ 2,
1097
+ 0,
1098
+ 15,
1099
+ 4,
1100
+ 10,
1101
+ 7381,
1102
+ 42,
1103
+ 31,
1104
+ 98,
1105
+ 114,
1106
+ 8702,
1107
+ 3,
1108
+ 2,
1109
+ 6,
1110
+ 2,
1111
+ 1,
1112
+ 2,
1113
+ 290,
1114
+ 16,
1115
+ 0,
1116
+ 30,
1117
+ 2,
1118
+ 3,
1119
+ 0,
1120
+ 15,
1121
+ 3,
1122
+ 9,
1123
+ 395,
1124
+ 2309,
1125
+ 106,
1126
+ 6,
1127
+ 12,
1128
+ 4,
1129
+ 8,
1130
+ 8,
1131
+ 9,
1132
+ 5991,
1133
+ 84,
1134
+ 2,
1135
+ 70,
1136
+ 2,
1137
+ 1,
1138
+ 3,
1139
+ 0,
1140
+ 3,
1141
+ 1,
1142
+ 3,
1143
+ 3,
1144
+ 2,
1145
+ 11,
1146
+ 2,
1147
+ 0,
1148
+ 2,
1149
+ 6,
1150
+ 2,
1151
+ 64,
1152
+ 2,
1153
+ 3,
1154
+ 3,
1155
+ 7,
1156
+ 2,
1157
+ 6,
1158
+ 2,
1159
+ 27,
1160
+ 2,
1161
+ 3,
1162
+ 2,
1163
+ 4,
1164
+ 2,
1165
+ 0,
1166
+ 4,
1167
+ 6,
1168
+ 2,
1169
+ 339,
1170
+ 3,
1171
+ 24,
1172
+ 2,
1173
+ 24,
1174
+ 2,
1175
+ 30,
1176
+ 2,
1177
+ 24,
1178
+ 2,
1179
+ 30,
1180
+ 2,
1181
+ 24,
1182
+ 2,
1183
+ 30,
1184
+ 2,
1185
+ 24,
1186
+ 2,
1187
+ 30,
1188
+ 2,
1189
+ 24,
1190
+ 2,
1191
+ 7,
1192
+ 1845,
1193
+ 30,
1194
+ 7,
1195
+ 5,
1196
+ 262,
1197
+ 61,
1198
+ 147,
1199
+ 44,
1200
+ 11,
1201
+ 6,
1202
+ 17,
1203
+ 0,
1204
+ 322,
1205
+ 29,
1206
+ 19,
1207
+ 43,
1208
+ 485,
1209
+ 27,
1210
+ 229,
1211
+ 29,
1212
+ 3,
1213
+ 0,
1214
+ 208,
1215
+ 30,
1216
+ 2,
1217
+ 2,
1218
+ 2,
1219
+ 1,
1220
+ 2,
1221
+ 6,
1222
+ 3,
1223
+ 4,
1224
+ 10,
1225
+ 1,
1226
+ 225,
1227
+ 6,
1228
+ 2,
1229
+ 3,
1230
+ 2,
1231
+ 1,
1232
+ 2,
1233
+ 14,
1234
+ 2,
1235
+ 196,
1236
+ 60,
1237
+ 67,
1238
+ 8,
1239
+ 0,
1240
+ 1205,
1241
+ 3,
1242
+ 2,
1243
+ 26,
1244
+ 2,
1245
+ 1,
1246
+ 2,
1247
+ 0,
1248
+ 3,
1249
+ 0,
1250
+ 2,
1251
+ 9,
1252
+ 2,
1253
+ 3,
1254
+ 2,
1255
+ 0,
1256
+ 2,
1257
+ 0,
1258
+ 7,
1259
+ 0,
1260
+ 5,
1261
+ 0,
1262
+ 2,
1263
+ 0,
1264
+ 2,
1265
+ 0,
1266
+ 2,
1267
+ 2,
1268
+ 2,
1269
+ 1,
1270
+ 2,
1271
+ 0,
1272
+ 3,
1273
+ 0,
1274
+ 2,
1275
+ 0,
1276
+ 2,
1277
+ 0,
1278
+ 2,
1279
+ 0,
1280
+ 2,
1281
+ 0,
1282
+ 2,
1283
+ 1,
1284
+ 2,
1285
+ 0,
1286
+ 3,
1287
+ 3,
1288
+ 2,
1289
+ 6,
1290
+ 2,
1291
+ 3,
1292
+ 2,
1293
+ 3,
1294
+ 2,
1295
+ 0,
1296
+ 2,
1297
+ 9,
1298
+ 2,
1299
+ 16,
1300
+ 6,
1301
+ 2,
1302
+ 2,
1303
+ 4,
1304
+ 2,
1305
+ 16,
1306
+ 4421,
1307
+ 42719,
1308
+ 33,
1309
+ 4381,
1310
+ 3,
1311
+ 5773,
1312
+ 3,
1313
+ 7472,
1314
+ 16,
1315
+ 621,
1316
+ 2467,
1317
+ 541,
1318
+ 1507,
1319
+ 4938,
1320
+ 6,
1321
+ 8489
1322
+ ];
1323
+ const astralIdentifierCodes = [
1324
+ 509,
1325
+ 0,
1326
+ 227,
1327
+ 0,
1328
+ 150,
1329
+ 4,
1330
+ 294,
1331
+ 9,
1332
+ 1368,
1333
+ 2,
1334
+ 2,
1335
+ 1,
1336
+ 6,
1337
+ 3,
1338
+ 41,
1339
+ 2,
1340
+ 5,
1341
+ 0,
1342
+ 166,
1343
+ 1,
1344
+ 574,
1345
+ 3,
1346
+ 9,
1347
+ 9,
1348
+ 7,
1349
+ 9,
1350
+ 32,
1351
+ 4,
1352
+ 318,
1353
+ 1,
1354
+ 78,
1355
+ 5,
1356
+ 71,
1357
+ 10,
1358
+ 50,
1359
+ 3,
1360
+ 123,
1361
+ 2,
1362
+ 54,
1363
+ 14,
1364
+ 32,
1365
+ 10,
1366
+ 3,
1367
+ 1,
1368
+ 11,
1369
+ 3,
1370
+ 46,
1371
+ 10,
1372
+ 8,
1373
+ 0,
1374
+ 46,
1375
+ 9,
1376
+ 7,
1377
+ 2,
1378
+ 37,
1379
+ 13,
1380
+ 2,
1381
+ 9,
1382
+ 6,
1383
+ 1,
1384
+ 45,
1385
+ 0,
1386
+ 13,
1387
+ 2,
1388
+ 49,
1389
+ 13,
1390
+ 9,
1391
+ 3,
1392
+ 2,
1393
+ 11,
1394
+ 83,
1395
+ 11,
1396
+ 7,
1397
+ 0,
1398
+ 3,
1399
+ 0,
1400
+ 158,
1401
+ 11,
1402
+ 6,
1403
+ 9,
1404
+ 7,
1405
+ 3,
1406
+ 56,
1407
+ 1,
1408
+ 2,
1409
+ 6,
1410
+ 3,
1411
+ 1,
1412
+ 3,
1413
+ 2,
1414
+ 10,
1415
+ 0,
1416
+ 11,
1417
+ 1,
1418
+ 3,
1419
+ 6,
1420
+ 4,
1421
+ 4,
1422
+ 68,
1423
+ 8,
1424
+ 2,
1425
+ 0,
1426
+ 3,
1427
+ 0,
1428
+ 2,
1429
+ 3,
1430
+ 2,
1431
+ 4,
1432
+ 2,
1433
+ 0,
1434
+ 15,
1435
+ 1,
1436
+ 83,
1437
+ 17,
1438
+ 10,
1439
+ 9,
1440
+ 5,
1441
+ 0,
1442
+ 82,
1443
+ 19,
1444
+ 13,
1445
+ 9,
1446
+ 214,
1447
+ 6,
1448
+ 3,
1449
+ 8,
1450
+ 28,
1451
+ 1,
1452
+ 83,
1453
+ 16,
1454
+ 16,
1455
+ 9,
1456
+ 82,
1457
+ 12,
1458
+ 9,
1459
+ 9,
1460
+ 7,
1461
+ 19,
1462
+ 58,
1463
+ 14,
1464
+ 5,
1465
+ 9,
1466
+ 243,
1467
+ 14,
1468
+ 166,
1469
+ 9,
1470
+ 71,
1471
+ 5,
1472
+ 2,
1473
+ 1,
1474
+ 3,
1475
+ 3,
1476
+ 2,
1477
+ 0,
1478
+ 2,
1479
+ 1,
1480
+ 13,
1481
+ 9,
1482
+ 120,
1483
+ 6,
1484
+ 3,
1485
+ 6,
1486
+ 4,
1487
+ 0,
1488
+ 29,
1489
+ 9,
1490
+ 41,
1491
+ 6,
1492
+ 2,
1493
+ 3,
1494
+ 9,
1495
+ 0,
1496
+ 10,
1497
+ 10,
1498
+ 47,
1499
+ 15,
1500
+ 199,
1501
+ 7,
1502
+ 137,
1503
+ 9,
1504
+ 54,
1505
+ 7,
1506
+ 2,
1507
+ 7,
1508
+ 17,
1509
+ 9,
1510
+ 57,
1511
+ 21,
1512
+ 2,
1513
+ 13,
1514
+ 123,
1515
+ 5,
1516
+ 4,
1517
+ 0,
1518
+ 2,
1519
+ 1,
1520
+ 2,
1521
+ 6,
1522
+ 2,
1523
+ 0,
1524
+ 9,
1525
+ 9,
1526
+ 49,
1527
+ 4,
1528
+ 2,
1529
+ 1,
1530
+ 2,
1531
+ 4,
1532
+ 9,
1533
+ 9,
1534
+ 55,
1535
+ 9,
1536
+ 266,
1537
+ 3,
1538
+ 10,
1539
+ 1,
1540
+ 2,
1541
+ 0,
1542
+ 49,
1543
+ 6,
1544
+ 4,
1545
+ 4,
1546
+ 14,
1547
+ 10,
1548
+ 5350,
1549
+ 0,
1550
+ 7,
1551
+ 14,
1552
+ 11465,
1553
+ 27,
1554
+ 2343,
1555
+ 9,
1556
+ 87,
1557
+ 9,
1558
+ 39,
1559
+ 4,
1560
+ 60,
1561
+ 6,
1562
+ 26,
1563
+ 9,
1564
+ 535,
1565
+ 9,
1566
+ 470,
1567
+ 0,
1568
+ 2,
1569
+ 54,
1570
+ 8,
1571
+ 3,
1572
+ 82,
1573
+ 0,
1574
+ 12,
1575
+ 1,
1576
+ 19628,
1577
+ 1,
1578
+ 4178,
1579
+ 9,
1580
+ 519,
1581
+ 45,
1582
+ 3,
1583
+ 22,
1584
+ 543,
1585
+ 4,
1586
+ 4,
1587
+ 5,
1588
+ 9,
1589
+ 7,
1590
+ 3,
1591
+ 6,
1592
+ 31,
1593
+ 3,
1594
+ 149,
1595
+ 2,
1596
+ 1418,
1597
+ 49,
1598
+ 513,
1599
+ 54,
1600
+ 5,
1601
+ 49,
1602
+ 9,
1603
+ 0,
1604
+ 15,
1605
+ 0,
1606
+ 23,
1607
+ 4,
1608
+ 2,
1609
+ 14,
1610
+ 1361,
1611
+ 6,
1612
+ 2,
1613
+ 16,
1614
+ 3,
1615
+ 6,
1616
+ 2,
1617
+ 1,
1618
+ 2,
1619
+ 4,
1620
+ 101,
1621
+ 0,
1622
+ 161,
1623
+ 6,
1624
+ 10,
1625
+ 9,
1626
+ 357,
1627
+ 0,
1628
+ 62,
1629
+ 13,
1630
+ 499,
1631
+ 13,
1632
+ 245,
1633
+ 1,
1634
+ 2,
1635
+ 9,
1636
+ 233,
1637
+ 0,
1638
+ 3,
1639
+ 0,
1640
+ 8,
1641
+ 1,
1642
+ 6,
1643
+ 0,
1644
+ 475,
1645
+ 6,
1646
+ 110,
1647
+ 6,
1648
+ 6,
1649
+ 9,
1650
+ 4759,
1651
+ 9,
1652
+ 787719,
1653
+ 239
1654
+ ];
1655
+ function isInAstralSet(code, set) {
1656
+ let pos = 0x10000;
1657
+ for(let i = 0, length = set.length; i < length; i += 2){
1658
+ pos += set[i];
1659
+ if (pos > code) break;
1660
+ pos += set[i + 1];
1661
+ if (pos >= code) return true;
1662
+ }
1663
+ return false;
1664
+ }
1665
+ function isIdentifierStart(code) {
1666
+ if (code < 65) return 36 === code;
1667
+ if (code <= 90) return true;
1668
+ if (code < 97) return 95 === code;
1669
+ if (code <= 122) return true;
1670
+ if (code <= 0xffff) return code >= 0xaa && nonASCIIidentifierStart.test(String.fromCharCode(code));
1671
+ return isInAstralSet(code, astralIdentifierStartCodes);
1672
+ }
1673
+ function isIdentifierChar(code) {
1674
+ if (code < 48) return 36 === code;
1675
+ if (code < 58) return true;
1676
+ if (code < 65) return false;
1677
+ if (code <= 90) return true;
1678
+ if (code < 97) return 95 === code;
1679
+ if (code <= 122) return true;
1680
+ if (code <= 0xffff) return code >= 0xaa && nonASCIIidentifier.test(String.fromCharCode(code));
1681
+ return isInAstralSet(code, astralIdentifierStartCodes) || isInAstralSet(code, astralIdentifierCodes);
1682
+ }
1683
+ function isIdentifierName(name) {
1684
+ let isFirst = true;
1685
+ for(let i = 0; i < name.length; i++){
1686
+ let cp = name.charCodeAt(i);
1687
+ if ((0xfc00 & cp) === 0xd800 && i + 1 < name.length) {
1688
+ const trail = name.charCodeAt(++i);
1689
+ if ((0xfc00 & trail) === 0xdc00) cp = 0x10000 + ((0x3ff & cp) << 10) + (0x3ff & trail);
1690
+ }
1691
+ if (isFirst) {
1692
+ isFirst = false;
1693
+ if (!isIdentifierStart(cp)) return false;
1694
+ } else if (!isIdentifierChar(cp)) return false;
1695
+ }
1696
+ return !isFirst;
1697
+ }
1698
+ },
1699
+ "../../node_modules/@babel/helper-validator-identifier/lib/index.js" (__unused_rspack_module, exports, __webpack_require__) {
1700
+ Object.defineProperty(exports, "__esModule", {
1701
+ value: true
1702
+ });
1703
+ Object.defineProperty(exports, "isIdentifierChar", {
1704
+ enumerable: true,
1705
+ get: function() {
1706
+ return _identifier.isIdentifierChar;
1707
+ }
1708
+ });
1709
+ Object.defineProperty(exports, "isIdentifierName", {
1710
+ enumerable: true,
1711
+ get: function() {
1712
+ return _identifier.isIdentifierName;
1713
+ }
1714
+ });
1715
+ Object.defineProperty(exports, "isIdentifierStart", {
1716
+ enumerable: true,
1717
+ get: function() {
1718
+ return _identifier.isIdentifierStart;
1719
+ }
1720
+ });
1721
+ Object.defineProperty(exports, "isKeyword", {
1722
+ enumerable: true,
1723
+ get: function() {
1724
+ return _keyword.isKeyword;
1725
+ }
1726
+ });
1727
+ Object.defineProperty(exports, "isReservedWord", {
1728
+ enumerable: true,
1729
+ get: function() {
1730
+ return _keyword.isReservedWord;
1731
+ }
1732
+ });
1733
+ Object.defineProperty(exports, "isStrictBindOnlyReservedWord", {
1734
+ enumerable: true,
1735
+ get: function() {
1736
+ return _keyword.isStrictBindOnlyReservedWord;
1737
+ }
1738
+ });
1739
+ Object.defineProperty(exports, "isStrictBindReservedWord", {
1740
+ enumerable: true,
1741
+ get: function() {
1742
+ return _keyword.isStrictBindReservedWord;
1743
+ }
1744
+ });
1745
+ Object.defineProperty(exports, "isStrictReservedWord", {
1746
+ enumerable: true,
1747
+ get: function() {
1748
+ return _keyword.isStrictReservedWord;
1749
+ }
1750
+ });
1751
+ var _identifier = __webpack_require__("../../node_modules/@babel/helper-validator-identifier/lib/identifier.js");
1752
+ var _keyword = __webpack_require__("../../node_modules/@babel/helper-validator-identifier/lib/keyword.js");
1753
+ },
1754
+ "../../node_modules/@babel/helper-validator-identifier/lib/keyword.js" (__unused_rspack_module, exports) {
1755
+ Object.defineProperty(exports, "__esModule", {
1756
+ value: true
1757
+ });
1758
+ exports.isKeyword = isKeyword;
1759
+ exports.isReservedWord = isReservedWord;
1760
+ exports.isStrictBindOnlyReservedWord = isStrictBindOnlyReservedWord;
1761
+ exports.isStrictBindReservedWord = isStrictBindReservedWord;
1762
+ exports.isStrictReservedWord = isStrictReservedWord;
1763
+ const reservedWords = {
1764
+ keyword: [
1765
+ "break",
1766
+ "case",
1767
+ "catch",
1768
+ "continue",
1769
+ "debugger",
1770
+ "default",
1771
+ "do",
1772
+ "else",
1773
+ "finally",
1774
+ "for",
1775
+ "function",
1776
+ "if",
1777
+ "return",
1778
+ "switch",
1779
+ "throw",
1780
+ "try",
1781
+ "var",
1782
+ "const",
1783
+ "while",
1784
+ "with",
1785
+ "new",
1786
+ "this",
1787
+ "super",
1788
+ "class",
1789
+ "extends",
1790
+ "export",
1791
+ "import",
1792
+ "null",
1793
+ "true",
1794
+ "false",
1795
+ "in",
1796
+ "instanceof",
1797
+ "typeof",
1798
+ "void",
1799
+ "delete"
1800
+ ],
1801
+ strict: [
1802
+ "implements",
1803
+ "interface",
1804
+ "let",
1805
+ "package",
1806
+ "private",
1807
+ "protected",
1808
+ "public",
1809
+ "static",
1810
+ "yield"
1811
+ ],
1812
+ strictBind: [
1813
+ "eval",
1814
+ "arguments"
1815
+ ]
1816
+ };
1817
+ const keywords = new Set(reservedWords.keyword);
1818
+ const reservedWordsStrictSet = new Set(reservedWords.strict);
1819
+ const reservedWordsStrictBindSet = new Set(reservedWords.strictBind);
1820
+ function isReservedWord(word, inModule) {
1821
+ return inModule && "await" === word || "enum" === word;
1822
+ }
1823
+ function isStrictReservedWord(word, inModule) {
1824
+ return isReservedWord(word, inModule) || reservedWordsStrictSet.has(word);
1825
+ }
1826
+ function isStrictBindOnlyReservedWord(word) {
1827
+ return reservedWordsStrictBindSet.has(word);
1828
+ }
1829
+ function isStrictBindReservedWord(word, inModule) {
1830
+ return isStrictReservedWord(word, inModule) || isStrictBindOnlyReservedWord(word);
1831
+ }
1832
+ function isKeyword(word) {
1833
+ return keywords.has(word);
1834
+ }
1835
+ }
1836
+ });
1837
+ function dashDashArg(agent, agentCommand) {
1838
+ return (args)=>{
1839
+ if (args.length > 1) return [
1840
+ agent,
1841
+ agentCommand,
1842
+ args[0],
1843
+ "--",
1844
+ ...args.slice(1)
1845
+ ];
1846
+ return [
1847
+ agent,
1848
+ agentCommand,
1849
+ args[0]
1850
+ ];
1851
+ };
1852
+ }
1853
+ function denoExecute() {
1854
+ return (args)=>[
1855
+ "deno",
1856
+ "run",
1857
+ `npm:${args[0]}`,
1858
+ ...args.slice(1)
1859
+ ];
1860
+ }
1861
+ const npm = {
1862
+ agent: [
1863
+ "npm",
1864
+ 0
1865
+ ],
1866
+ run: dashDashArg("npm", "run"),
1867
+ install: [
1868
+ "npm",
1869
+ "i",
1870
+ 0
1871
+ ],
1872
+ frozen: [
1873
+ "npm",
1874
+ "ci",
1875
+ 0
1876
+ ],
1877
+ global: [
1878
+ "npm",
1879
+ "i",
1880
+ "-g",
1881
+ 0
1882
+ ],
1883
+ add: [
1884
+ "npm",
1885
+ "i",
1886
+ 0
1887
+ ],
1888
+ upgrade: [
1889
+ "npm",
1890
+ "update",
1891
+ 0
1892
+ ],
1893
+ "upgrade-interactive": null,
1894
+ dedupe: [
1895
+ "npm",
1896
+ "dedupe",
1897
+ 0
1898
+ ],
1899
+ execute: [
1900
+ "npx",
1901
+ 0
1902
+ ],
1903
+ "execute-local": [
1904
+ "npx",
1905
+ 0
1906
+ ],
1907
+ uninstall: [
1908
+ "npm",
1909
+ "uninstall",
1910
+ 0
1911
+ ],
1912
+ global_uninstall: [
1913
+ "npm",
1914
+ "uninstall",
1915
+ "-g",
1916
+ 0
1917
+ ]
1918
+ };
1919
+ const yarn = {
1920
+ agent: [
1921
+ "yarn",
1922
+ 0
1923
+ ],
1924
+ run: [
1925
+ "yarn",
1926
+ "run",
1927
+ 0
1928
+ ],
1929
+ install: [
1930
+ "yarn",
1931
+ "install",
1932
+ 0
1933
+ ],
1934
+ frozen: [
1935
+ "yarn",
1936
+ "install",
1937
+ "--frozen-lockfile",
1938
+ 0
1939
+ ],
1940
+ global: [
1941
+ "yarn",
1942
+ "global",
1943
+ "add",
1944
+ 0
1945
+ ],
1946
+ add: [
1947
+ "yarn",
1948
+ "add",
1949
+ 0
1950
+ ],
1951
+ upgrade: [
1952
+ "yarn",
1953
+ "upgrade",
1954
+ 0
1955
+ ],
1956
+ "upgrade-interactive": [
1957
+ "yarn",
1958
+ "upgrade-interactive",
1959
+ 0
1960
+ ],
1961
+ dedupe: null,
1962
+ execute: [
1963
+ "npx",
1964
+ 0
1965
+ ],
1966
+ "execute-local": dashDashArg("yarn", "exec"),
1967
+ uninstall: [
1968
+ "yarn",
1969
+ "remove",
1970
+ 0
1971
+ ],
1972
+ global_uninstall: [
1973
+ "yarn",
1974
+ "global",
1975
+ "remove",
1976
+ 0
1977
+ ]
1978
+ };
1979
+ const yarnBerry = {
1980
+ ...yarn,
1981
+ frozen: [
1982
+ "yarn",
1983
+ "install",
1984
+ "--immutable",
1985
+ 0
1986
+ ],
1987
+ upgrade: [
1988
+ "yarn",
1989
+ "up",
1990
+ 0
1991
+ ],
1992
+ "upgrade-interactive": [
1993
+ "yarn",
1994
+ "up",
1995
+ "-i",
1996
+ 0
1997
+ ],
1998
+ dedupe: [
1999
+ "yarn",
2000
+ "dedupe",
2001
+ 0
2002
+ ],
2003
+ execute: [
2004
+ "yarn",
2005
+ "dlx",
2006
+ 0
2007
+ ],
2008
+ "execute-local": [
2009
+ "yarn",
2010
+ "exec",
2011
+ 0
2012
+ ],
2013
+ global: [
2014
+ "npm",
2015
+ "i",
2016
+ "-g",
2017
+ 0
2018
+ ],
2019
+ global_uninstall: [
2020
+ "npm",
2021
+ "uninstall",
2022
+ "-g",
2023
+ 0
2024
+ ]
2025
+ };
2026
+ const pnpm = {
2027
+ agent: [
2028
+ "pnpm",
2029
+ 0
2030
+ ],
2031
+ run: [
2032
+ "pnpm",
2033
+ "run",
2034
+ 0
2035
+ ],
2036
+ install: [
2037
+ "pnpm",
2038
+ "i",
2039
+ 0
2040
+ ],
2041
+ frozen: [
2042
+ "pnpm",
2043
+ "i",
2044
+ "--frozen-lockfile",
2045
+ 0
2046
+ ],
2047
+ global: [
2048
+ "pnpm",
2049
+ "add",
2050
+ "-g",
2051
+ 0
2052
+ ],
2053
+ add: [
2054
+ "pnpm",
2055
+ "add",
2056
+ 0
2057
+ ],
2058
+ upgrade: [
2059
+ "pnpm",
2060
+ "update",
2061
+ 0
2062
+ ],
2063
+ "upgrade-interactive": [
2064
+ "pnpm",
2065
+ "update",
2066
+ "-i",
2067
+ 0
2068
+ ],
2069
+ dedupe: [
2070
+ "pnpm",
2071
+ "dedupe",
2072
+ 0
2073
+ ],
2074
+ execute: [
2075
+ "pnpm",
2076
+ "dlx",
2077
+ 0
2078
+ ],
2079
+ "execute-local": [
2080
+ "pnpm",
2081
+ "exec",
2082
+ 0
2083
+ ],
2084
+ uninstall: [
2085
+ "pnpm",
2086
+ "remove",
2087
+ 0
2088
+ ],
2089
+ global_uninstall: [
2090
+ "pnpm",
2091
+ "remove",
2092
+ "--global",
2093
+ 0
2094
+ ]
2095
+ };
2096
+ const bun = {
2097
+ agent: [
2098
+ "bun",
2099
+ 0
2100
+ ],
2101
+ run: [
2102
+ "bun",
2103
+ "run",
2104
+ 0
2105
+ ],
2106
+ install: [
2107
+ "bun",
2108
+ "install",
2109
+ 0
2110
+ ],
2111
+ frozen: [
2112
+ "bun",
2113
+ "install",
2114
+ "--frozen-lockfile",
2115
+ 0
2116
+ ],
2117
+ global: [
2118
+ "bun",
2119
+ "add",
2120
+ "-g",
2121
+ 0
2122
+ ],
2123
+ add: [
2124
+ "bun",
2125
+ "add",
2126
+ 0
2127
+ ],
2128
+ upgrade: [
2129
+ "bun",
2130
+ "update",
2131
+ 0
2132
+ ],
2133
+ "upgrade-interactive": [
2134
+ "bun",
2135
+ "update",
2136
+ "-i",
2137
+ 0
2138
+ ],
2139
+ dedupe: null,
2140
+ execute: [
2141
+ "bun",
2142
+ "x",
2143
+ 0
2144
+ ],
2145
+ "execute-local": [
2146
+ "bun",
2147
+ "x",
2148
+ 0
2149
+ ],
2150
+ uninstall: [
2151
+ "bun",
2152
+ "remove",
2153
+ 0
2154
+ ],
2155
+ global_uninstall: [
2156
+ "bun",
2157
+ "remove",
2158
+ "-g",
2159
+ 0
2160
+ ]
2161
+ };
2162
+ const deno = {
2163
+ agent: [
2164
+ "deno",
2165
+ 0
2166
+ ],
2167
+ run: [
2168
+ "deno",
2169
+ "task",
2170
+ 0
2171
+ ],
2172
+ install: [
2173
+ "deno",
2174
+ "install",
2175
+ 0
2176
+ ],
2177
+ frozen: [
2178
+ "deno",
2179
+ "install",
2180
+ "--frozen",
2181
+ 0
2182
+ ],
2183
+ global: [
2184
+ "deno",
2185
+ "install",
2186
+ "-g",
2187
+ 0
2188
+ ],
2189
+ add: [
2190
+ "deno",
2191
+ "add",
2192
+ 0
2193
+ ],
2194
+ upgrade: [
2195
+ "deno",
2196
+ "outdated",
2197
+ "--update",
2198
+ 0
2199
+ ],
2200
+ "upgrade-interactive": [
2201
+ "deno",
2202
+ "outdated",
2203
+ "--update",
2204
+ 0
2205
+ ],
2206
+ dedupe: null,
2207
+ execute: denoExecute(),
2208
+ "execute-local": [
2209
+ "deno",
2210
+ "task",
2211
+ "--eval",
2212
+ 0
2213
+ ],
2214
+ uninstall: [
2215
+ "deno",
2216
+ "remove",
2217
+ 0
2218
+ ],
2219
+ global_uninstall: [
2220
+ "deno",
2221
+ "uninstall",
2222
+ "-g",
2223
+ 0
2224
+ ]
2225
+ };
2226
+ const COMMANDS = {
2227
+ npm: npm,
2228
+ yarn: yarn,
2229
+ "yarn@berry": yarnBerry,
2230
+ pnpm: pnpm,
2231
+ "pnpm@6": {
2232
+ ...pnpm,
2233
+ run: dashDashArg("pnpm", "run")
2234
+ },
2235
+ bun: bun,
2236
+ deno: deno
2237
+ };
2238
+ function resolveCommand(agent, command, args) {
2239
+ const value = COMMANDS[agent][command];
2240
+ return constructCommand(value, args);
2241
+ }
2242
+ function constructCommand(value, args) {
2243
+ if (null == value) return null;
2244
+ const list = "function" == typeof value ? value(args) : value.flatMap((v)=>{
2245
+ if ("number" == typeof v) return args;
2246
+ return [
2247
+ v
2248
+ ];
2249
+ });
2250
+ return {
2251
+ command: list[0],
2252
+ args: list.slice(1)
2253
+ };
2254
+ }
2255
+ const constants_AGENTS = [
2256
+ "npm",
2257
+ "yarn",
2258
+ "yarn@berry",
2259
+ "pnpm",
2260
+ "pnpm@6",
2261
+ "bun",
2262
+ "deno"
2263
+ ];
2264
+ const LOCKS = {
2265
+ "bun.lock": "bun",
2266
+ "bun.lockb": "bun",
2267
+ "deno.lock": "deno",
2268
+ "pnpm-lock.yaml": "pnpm",
2269
+ "pnpm-workspace.yaml": "pnpm",
2270
+ "yarn.lock": "yarn",
2271
+ "package-lock.json": "npm",
2272
+ "npm-shrinkwrap.json": "npm"
2273
+ };
2274
+ const INSTALL_METADATA = {
2275
+ "node_modules/.deno/": "deno",
2276
+ "node_modules/.pnpm/": "pnpm",
2277
+ "node_modules/.yarn-state.yml": "yarn",
2278
+ "node_modules/.yarn_integrity": "yarn",
2279
+ "node_modules/.package-lock.json": "npm",
2280
+ ".pnp.cjs": "yarn",
2281
+ ".pnp.js": "yarn",
2282
+ "bun.lock": "bun",
2283
+ "bun.lockb": "bun"
2284
+ };
2285
+ async function pathExists(path2, type) {
2286
+ try {
2287
+ const stat = await promises.stat(path2);
2288
+ return "file" === type ? stat.isFile() : stat.isDirectory();
2289
+ } catch {
2290
+ return false;
2291
+ }
2292
+ }
2293
+ function* lookup(cwd = node_process.cwd()) {
2294
+ let directory = node_path.resolve(cwd);
2295
+ const { root } = node_path.parse(directory);
2296
+ while(directory && directory !== root){
2297
+ yield directory;
2298
+ directory = node_path.dirname(directory);
2299
+ }
2300
+ }
2301
+ async function parsePackageJson(filepath, options) {
2302
+ if (!filepath || !await pathExists(filepath, "file")) return null;
2303
+ return await handlePackageManager(filepath, options);
2304
+ }
2305
+ async function detect(options = {}) {
2306
+ const { cwd, strategies = [
2307
+ "lockfile",
2308
+ "packageManager-field",
2309
+ "devEngines-field"
2310
+ ] } = options;
2311
+ let stopDir;
2312
+ if ("string" == typeof options.stopDir) {
2313
+ const resolved = node_path.resolve(options.stopDir);
2314
+ stopDir = (dir)=>dir === resolved;
2315
+ } else stopDir = options.stopDir;
2316
+ for (const directory of lookup(cwd)){
2317
+ for (const strategy of strategies)switch(strategy){
2318
+ case "lockfile":
2319
+ for (const lock of Object.keys(LOCKS))if (await pathExists(node_path.join(directory, lock), "file")) {
2320
+ const name = LOCKS[lock];
2321
+ const result = await parsePackageJson(node_path.join(directory, "package.json"), options);
2322
+ if (result) return result;
2323
+ return {
2324
+ name,
2325
+ agent: name
2326
+ };
2327
+ }
2328
+ break;
2329
+ case "packageManager-field":
2330
+ case "devEngines-field":
2331
+ {
2332
+ const result = await parsePackageJson(node_path.join(directory, "package.json"), options);
2333
+ if (result) return result;
2334
+ break;
2335
+ }
2336
+ case "install-metadata":
2337
+ for (const metadata of Object.keys(INSTALL_METADATA)){
2338
+ const fileOrDir = metadata.endsWith("/") ? "dir" : "file";
2339
+ if (await pathExists(node_path.join(directory, metadata), fileOrDir)) {
2340
+ const name = INSTALL_METADATA[metadata];
2341
+ const agent = "yarn" === name ? isMetadataYarnClassic(metadata) ? "yarn" : "yarn@berry" : name;
2342
+ return {
2343
+ name,
2344
+ agent
2345
+ };
2346
+ }
2347
+ }
2348
+ break;
2349
+ }
2350
+ if (stopDir?.(directory)) break;
2351
+ }
2352
+ return null;
2353
+ }
2354
+ function getNameAndVer(pkg) {
2355
+ const handelVer = (version)=>version?.match(/\d+(\.\d+){0,2}/)?.[0] ?? version;
2356
+ if ("string" == typeof pkg.packageManager) {
2357
+ const [name, ver] = pkg.packageManager.replace(/^\^/, "").split("@");
2358
+ return {
2359
+ name,
2360
+ ver: handelVer(ver)
2361
+ };
2362
+ }
2363
+ if ("string" == typeof pkg.devEngines?.packageManager?.name) return {
2364
+ name: pkg.devEngines.packageManager.name,
2365
+ ver: handelVer(pkg.devEngines.packageManager.version)
2366
+ };
2367
+ }
2368
+ async function handlePackageManager(filepath, options) {
2369
+ try {
2370
+ const content = await promises.readFile(filepath, "utf8");
2371
+ const pkg = options.packageJsonParser ? await options.packageJsonParser(content, filepath) : JSON.parse(content);
2372
+ let agent;
2373
+ const nameAndVer = getNameAndVer(pkg);
2374
+ if (nameAndVer) {
2375
+ const name = nameAndVer.name;
2376
+ const ver = nameAndVer.ver;
2377
+ let version = ver;
2378
+ if ("yarn" === name && ver && Number.parseInt(ver) > 1) {
2379
+ agent = "yarn@berry";
2380
+ version = "berry";
2381
+ return {
2382
+ name,
2383
+ agent,
2384
+ version
2385
+ };
2386
+ }
2387
+ if ("pnpm" === name && ver && Number.parseInt(ver) < 7) {
2388
+ agent = "pnpm@6";
2389
+ return {
2390
+ name,
2391
+ agent,
2392
+ version
2393
+ };
2394
+ }
2395
+ if (!constants_AGENTS.includes(name)) return options.onUnknown?.(pkg.packageManager) ?? null;
2396
+ agent = name;
2397
+ return {
2398
+ name,
2399
+ agent,
2400
+ version
2401
+ };
2402
+ }
2403
+ } catch {}
2404
+ return null;
2405
+ }
2406
+ function isMetadataYarnClassic(metadataPath) {
2407
+ return metadataPath.endsWith(".yarn_integrity");
2408
+ }
2409
+ function checkNodeVersion() {
2410
+ const { versions } = process;
2411
+ if ("styleText" in node_util || !versions.node || versions.bun || versions.deno) return;
2412
+ throw new Error(`Unsupported Node.js version: "${process.versions.node || 'unknown'}". Expected Node.js >= 20.`);
2413
+ }
2414
+ checkNodeVersion();
2415
+ const createStyler = (style)=>(text)=>node_util.styleText(style, String(text));
2416
+ const color = {
2417
+ dim: createStyler('dim'),
2418
+ red: createStyler('red'),
2419
+ bold: createStyler('bold'),
2420
+ blue: createStyler('blue'),
2421
+ cyan: createStyler('cyan'),
2422
+ gray: createStyler('gray'),
2423
+ black: createStyler('black'),
2424
+ green: createStyler('green'),
2425
+ white: createStyler('white'),
2426
+ reset: createStyler('reset'),
2427
+ yellow: createStyler('yellow'),
2428
+ magenta: createStyler('magenta'),
2429
+ underline: createStyler('underline'),
2430
+ strikethrough: createStyler('strikethrough')
2431
+ };
2432
+ function hasFlag(flag, argv = globalThis.Deno ? globalThis.Deno.args : node_process.argv) {
2433
+ const prefix = flag.startsWith('-') ? '' : 1 === flag.length ? '-' : '--';
2434
+ const position = argv.indexOf(prefix + flag);
2435
+ const terminatorPosition = argv.indexOf('--');
2436
+ return -1 !== position && (-1 === terminatorPosition || position < terminatorPosition);
2437
+ }
2438
+ const { env: env } = node_process;
2439
+ let flagForceColor;
2440
+ if (hasFlag('no-color') || hasFlag('no-colors') || hasFlag('color=false') || hasFlag('color=never')) flagForceColor = 0;
2441
+ else if (hasFlag('color') || hasFlag('colors') || hasFlag('color=true') || hasFlag('color=always')) flagForceColor = 1;
2442
+ function envForceColor() {
2443
+ if (!('FORCE_COLOR' in env)) return;
2444
+ if ('true' === env.FORCE_COLOR) return 1;
2445
+ if ('false' === env.FORCE_COLOR) return 0;
2446
+ if (0 === env.FORCE_COLOR.length) return 1;
2447
+ const level = Math.min(Number.parseInt(env.FORCE_COLOR, 10), 3);
2448
+ if (![
2449
+ 0,
2450
+ 1,
2451
+ 2,
2452
+ 3
2453
+ ].includes(level)) return;
2454
+ return level;
2455
+ }
2456
+ function translateLevel(level) {
2457
+ if (0 === level) return false;
2458
+ return {
2459
+ level,
2460
+ hasBasic: true,
2461
+ has256: level >= 2,
2462
+ has16m: level >= 3
2463
+ };
2464
+ }
2465
+ function _supportsColor(haveStream, { streamIsTTY, sniffFlags = true } = {}) {
2466
+ const noFlagForceColor = envForceColor();
2467
+ if (void 0 !== noFlagForceColor) flagForceColor = noFlagForceColor;
2468
+ const forceColor = sniffFlags ? flagForceColor : noFlagForceColor;
2469
+ if (0 === forceColor) return 0;
2470
+ if (sniffFlags) {
2471
+ if (hasFlag('color=16m') || hasFlag('color=full') || hasFlag('color=truecolor')) return 3;
2472
+ if (hasFlag('color=256')) return 2;
2473
+ }
2474
+ if ('TF_BUILD' in env && 'AGENT_NAME' in env) return 1;
2475
+ if (haveStream && !streamIsTTY && void 0 === forceColor) return 0;
2476
+ const min = forceColor || 0;
2477
+ if ('dumb' === env.TERM) return min;
2478
+ if ('win32' === node_process.platform) {
2479
+ const osRelease = node_os.release().split('.');
2480
+ if (Number(osRelease[0]) >= 10 && Number(osRelease[2]) >= 10586) return Number(osRelease[2]) >= 14931 ? 3 : 2;
2481
+ return 1;
2482
+ }
2483
+ if ('CI' in env) {
2484
+ if ([
2485
+ 'GITHUB_ACTIONS',
2486
+ 'GITEA_ACTIONS',
2487
+ 'CIRCLECI'
2488
+ ].some((key)=>key in env)) return 3;
2489
+ if ([
2490
+ 'TRAVIS',
2491
+ 'APPVEYOR',
2492
+ 'GITLAB_CI',
2493
+ 'BUILDKITE',
2494
+ 'DRONE'
2495
+ ].some((sign)=>sign in env) || 'codeship' === env.CI_NAME) return 1;
2496
+ return min;
2497
+ }
2498
+ if ('TEAMCITY_VERSION' in env) return /^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(env.TEAMCITY_VERSION) ? 1 : 0;
2499
+ if ('truecolor' === env.COLORTERM) return 3;
2500
+ if ('xterm-kitty' === env.TERM) return 3;
2501
+ if ('xterm-ghostty' === env.TERM) return 3;
2502
+ if ('wezterm' === env.TERM) return 3;
2503
+ if ('TERM_PROGRAM' in env) {
2504
+ const version = Number.parseInt((env.TERM_PROGRAM_VERSION || '').split('.')[0], 10);
2505
+ switch(env.TERM_PROGRAM){
2506
+ case 'iTerm.app':
2507
+ return version >= 3 ? 3 : 2;
2508
+ case 'Apple_Terminal':
2509
+ return 2;
2510
+ }
2511
+ }
2512
+ if (/-256(color)?$/i.test(env.TERM)) return 2;
2513
+ if (/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(env.TERM)) return 1;
2514
+ if ('COLORTERM' in env) return 1;
2515
+ return min;
2516
+ }
2517
+ function createSupportsColor(stream, options = {}) {
2518
+ const level = _supportsColor(stream, {
2519
+ streamIsTTY: stream && stream.isTTY,
2520
+ ...options
2521
+ });
2522
+ return translateLevel(level);
2523
+ }
2524
+ const supportsColor = {
2525
+ stdout: createSupportsColor({
2526
+ isTTY: node_tty.isatty(1)
2527
+ }),
2528
+ stderr: createSupportsColor({
2529
+ isTTY: node_tty.isatty(2)
2530
+ })
2531
+ };
2532
+ const supports_color = supportsColor;
2533
+ const colorLevel = supports_color.stdout ? supports_color.stdout.level : 0;
2534
+ const errorStackRegExp = /at [^\r\n]{0,200}:\d+:\d+[\s\)]*$/;
2535
+ const anonymousErrorStackRegExp = /at [^\r\n]{0,200}\(<anonymous>\)$/;
2536
+ const indexErrorStackRegExp = /at [^\r\n]{0,200}\(index\s\d+\)$/;
2537
+ const isErrorStackMessage = (message)=>errorStackRegExp.test(message) || anonymousErrorStackRegExp.test(message) || indexErrorStackRegExp.test(message);
2538
+ const startColor = [
2539
+ 189,
2540
+ 255,
2541
+ 243
2542
+ ];
2543
+ const endColor = [
2544
+ 74,
2545
+ 194,
2546
+ 154
2547
+ ];
2548
+ const isWord = (char)=>!/[\s\n]/.test(char);
2549
+ const gradient = (message)=>{
2550
+ if (colorLevel < 3) return 2 === colorLevel ? color.cyan(message) : message;
2551
+ const chars = [
2552
+ ...message
2553
+ ];
2554
+ const steps = chars.filter(isWord).length;
2555
+ let r = startColor[0];
2556
+ let g = startColor[1];
2557
+ let b = startColor[2];
2558
+ const rStep = (endColor[0] - r) / steps;
2559
+ const gStep = (endColor[1] - g) / steps;
2560
+ const bStep = (endColor[2] - b) / steps;
2561
+ let output = '';
2562
+ for (const char of chars){
2563
+ if (isWord(char)) {
2564
+ r += rStep;
2565
+ g += gStep;
2566
+ b += bStep;
2567
+ }
2568
+ output += `\x1b[38;2;${Math.round(r)};${Math.round(g)};${Math.round(b)}m${char}\x1b[39m`;
2569
+ }
2570
+ return color.bold(output);
2571
+ };
2572
+ const LOG_LEVEL = {
2573
+ silent: -1,
2574
+ error: 0,
2575
+ warn: 1,
2576
+ info: 2,
2577
+ log: 2,
2578
+ verbose: 3
2579
+ };
2580
+ const LOG_TYPES = {
2581
+ error: {
2582
+ label: 'error',
2583
+ level: 'error',
2584
+ color: color.red
2585
+ },
2586
+ warn: {
2587
+ label: 'warn',
2588
+ level: 'warn',
2589
+ color: color.yellow
2590
+ },
2591
+ info: {
2592
+ label: 'info',
2593
+ level: 'info',
2594
+ color: color.cyan
2595
+ },
2596
+ start: {
2597
+ label: 'start',
2598
+ level: 'info',
2599
+ color: color.cyan
2600
+ },
2601
+ ready: {
2602
+ label: 'ready',
2603
+ level: 'info',
2604
+ color: color.green
2605
+ },
2606
+ success: {
2607
+ label: 'success',
2608
+ level: 'info',
2609
+ color: color.green
2610
+ },
2611
+ log: {
2612
+ level: 'info'
2613
+ },
2614
+ debug: {
2615
+ label: 'debug',
2616
+ level: 'verbose',
2617
+ color: color.magenta
2618
+ }
2619
+ };
2620
+ const normalizeErrorMessage = (err)=>{
2621
+ if (err.stack) {
2622
+ const [rawName, ...rest] = err.stack.split('\n');
2623
+ const name = rawName.startsWith('Error: ') ? rawName.slice(7) : rawName;
2624
+ return `${name}\n${color.gray(rest.join('\n'))}`;
2625
+ }
2626
+ return err.message;
2627
+ };
2628
+ const createLogger = (options = {})=>{
2629
+ const { level = 'info', prefix, console: console1 = globalThis.console } = options;
2630
+ let maxLevel = level;
2631
+ const log = (type, message, ...args)=>{
2632
+ const logType = LOG_TYPES[type];
2633
+ const { level } = logType;
2634
+ if (LOG_LEVEL[level] > LOG_LEVEL[maxLevel]) return;
2635
+ if (null == message) return console1.log();
2636
+ let label = '';
2637
+ let text = '';
2638
+ if ('label' in logType) {
2639
+ label = (logType.label || '').padEnd(7);
2640
+ label = color.bold(logType.color ? logType.color(label) : label);
2641
+ }
2642
+ if (message instanceof Error) {
2643
+ text += normalizeErrorMessage(message);
2644
+ const { cause } = message;
2645
+ if (cause) {
2646
+ text += color.yellow('\n [cause]: ');
2647
+ text += cause instanceof Error ? normalizeErrorMessage(cause) : String(cause);
2648
+ }
2649
+ } else if ('error' === level && 'string' == typeof message) {
2650
+ const lines = message.split('\n');
2651
+ text = lines.map((line)=>isErrorStackMessage(line) ? color.gray(line) : line).join('\n');
2652
+ } else text = `${message}`;
2653
+ if (prefix) text = `${prefix} ${text}`;
2654
+ const method = 'error' === level || 'warn' === level ? level : 'log';
2655
+ console1[method](label.length ? `${label} ${text}` : text, ...args);
2656
+ };
2657
+ const logger = {
2658
+ greet: (message)=>log('log', gradient(message))
2659
+ };
2660
+ Object.keys(LOG_TYPES).forEach((key)=>{
2661
+ logger[key] = (...args)=>log(key, ...args);
2662
+ });
2663
+ Object.defineProperty(logger, 'level', {
2664
+ get: ()=>maxLevel,
2665
+ set (val) {
2666
+ maxLevel = val;
2667
+ }
2668
+ });
2669
+ Object.defineProperty(logger, 'options', {
2670
+ get: ()=>({
2671
+ ...options
2672
+ })
2673
+ });
2674
+ logger.override = (customLogger)=>{
2675
+ Object.assign(logger, customLogger);
2676
+ };
2677
+ return logger;
2678
+ };
2679
+ createLogger();
2680
+ const cross_spawn = __webpack_require__("../../node_modules/cross-spawn/index.js");
2681
+ const lib = __webpack_require__("../../node_modules/@babel/code-frame/lib/index.js");
2682
+ const LAZY_COMPILATION_IDENTIFIER = 'lazy-compilation-proxy';
2683
+ const isVerbose = (targetLogger)=>'verbose' === targetLogger.level;
2684
+ const removeLoaderChainDelimiter = (moduleId, logger)=>{
2685
+ if (isVerbose(logger)) return moduleId;
2686
+ const LOADER_CHAIN_SEPARATOR = '!=!';
2687
+ return moduleId.split(LOADER_CHAIN_SEPARATOR)[0];
2688
+ };
2689
+ const formatFileName = (fileName, stats, root)=>{
2690
+ if (!fileName) return '';
2691
+ const DATA_URI_PREFIX = "data:text/javascript,";
2692
+ if (fileName.startsWith(DATA_URI_PREFIX)) {
2693
+ let snippet = fileName.replace(DATA_URI_PREFIX, '');
2694
+ if (snippet.length > 30) snippet = `${snippet.slice(0, 30)}...`;
2695
+ return `File: ${color.cyan('data-uri virtual module')} ${color.dim(`(${snippet})`)}\n`;
2696
+ }
2697
+ const prefix = root + sep;
2698
+ if (fileName.startsWith(prefix)) fileName = fileName.replace(prefix, `.${sep}`);
2699
+ if (/:\d+:\d+/.test(fileName)) return `File: ${color.cyan(fileName)}\n`;
2700
+ if (stats.loc) return `File: ${color.cyan(`${fileName}:${stats.loc}`)}\n`;
2701
+ return `File: ${color.cyan(`${fileName}:1:1`)}\n`;
2702
+ };
2703
+ function resolveFileName(stats, logger) {
2704
+ const file = stats.file || stats.moduleName;
2705
+ if (file) return removeLoaderChainDelimiter(file, logger);
2706
+ if (stats.moduleIdentifier) {
2707
+ const regex = /(?:!|^)([^!]+)$/;
2708
+ const matched = stats.moduleIdentifier.match(regex);
2709
+ if (matched) {
2710
+ const fileName = matched.pop();
2711
+ if (fileName) return removeLoaderChainDelimiter(fileName, logger);
2712
+ }
2713
+ }
2714
+ return '';
2715
+ }
2716
+ function formatModuleTrace(stats, errorFile, level, logger) {
2717
+ if (!stats.moduleTrace) return;
2718
+ const moduleNames = stats.moduleTrace.map((trace)=>trace.originName && removeLoaderChainDelimiter(trace.originName, logger)).filter((trace)=>trace && !trace.startsWith(LAZY_COMPILATION_IDENTIFIER));
2719
+ if (!moduleNames.length) return;
2720
+ if (errorFile) {
2721
+ const formatted = removeLoaderChainDelimiter(errorFile, logger);
2722
+ if (moduleNames[0] !== formatted) moduleNames.unshift(formatted);
2723
+ }
2724
+ let trace = moduleNames.slice().reverse();
2725
+ const MAX = 4;
2726
+ if (trace.length > MAX && !isVerbose(logger)) {
2727
+ const HEAD = 2;
2728
+ const TAIL = 2;
2729
+ trace = [
2730
+ ...trace.slice(0, HEAD),
2731
+ `… (${trace.length - HEAD - TAIL} hidden)`,
2732
+ ...trace.slice(trace.length - TAIL)
2733
+ ];
2734
+ }
2735
+ return color.dim(`Import traces (entry → ${level}):\n ${trace.join('\n ')} ${color.bold(color.red('×'))}`);
2736
+ }
2737
+ function hintUnknownFiles(message) {
2738
+ const hint = 'You may need an appropriate loader to handle this file type.';
2739
+ if (-1 === message.indexOf(hint)) return message;
2740
+ const createPluginHint = (packageName, keyword)=>`To enable support for ${keyword}, use "${color.yellow(`@rsbuild/plugin-${packageName}`)}" ${color.dim(`(https://npmjs.com/package/@rsbuild/plugin-${packageName})`)}.\n`;
2741
+ const recommendPlugins = [
2742
+ {
2743
+ test: /File: .+\.s(c|a)ss/,
2744
+ hint: createPluginHint('sass', 'Sass')
2745
+ },
2746
+ {
2747
+ test: /File: .+\.less/,
2748
+ hint: createPluginHint('less', 'Less')
2749
+ },
2750
+ {
2751
+ test: /File: .+\.styl(us)?/,
2752
+ hint: createPluginHint('stylus', 'Stylus')
2753
+ },
2754
+ {
2755
+ test: /File: .+\.vue?/,
2756
+ hint: createPluginHint('vue', 'Vue')
2757
+ },
2758
+ {
2759
+ test: /File: .+\.svelte?/,
2760
+ hint: createPluginHint('svelte', 'Svelte')
2761
+ },
2762
+ {
2763
+ test: /File: .+\.mdx/,
2764
+ hint: createPluginHint('mdx', 'MDX')
2765
+ },
2766
+ {
2767
+ test: /File: .+\.toml/,
2768
+ hint: createPluginHint('toml', 'TOML')
2769
+ },
2770
+ {
2771
+ test: /File: .+\.yaml/,
2772
+ hint: createPluginHint('yaml', 'YAML')
2773
+ }
2774
+ ];
2775
+ for (const plugin of recommendPlugins)if (plugin.test.test(message)) return message.replace(hint, plugin.hint);
2776
+ return message;
2777
+ }
2778
+ const hintAssetsConflict = (message)=>{
2779
+ const hint = 'Multiple assets emit different content to the same filename';
2780
+ if (-1 === message.indexOf(hint)) return message;
2781
+ const extraMessage = `You may need to adjust ${color.yellow('output.filename')} configuration to prevent name conflicts. (See ${color.yellow('https://rsbuild.rs/config/output/filename')})`;
2782
+ return `${message}\n${extraMessage}`;
2783
+ };
2784
+ const hintNodePolyfill = (message)=>{
2785
+ const getTips = (moduleName)=>{
2786
+ const tips = [
2787
+ `Error: "${moduleName}" is a built-in Node.js module and cannot be imported in client-side code.\n`,
2788
+ 'Solution: Check if you need to import Node.js module.',
2789
+ ' - If not needed, remove the import.',
2790
+ ` - If needed, use "${color.yellow('@rsbuild/plugin-node-polyfill')}" to polyfill it. (See ${color.yellow('https://npmjs.com/package/@rsbuild/plugin-node-polyfill')})`
2791
+ ];
2792
+ return `${message}\n\n${color.red(tips.join('\n'))}`;
2793
+ };
2794
+ const isNodeProtocolError = message.includes('need an additional plugin to handle "node:" URIs');
2795
+ if (isNodeProtocolError) return getTips('node:*');
2796
+ if (!message.includes("Can't resolve")) return message;
2797
+ const matchArray = stripVTControlCharacters(message).match(/Can't resolve '(\w+)'/);
2798
+ if (!matchArray) return message;
2799
+ const moduleName = matchArray[1];
2800
+ if (moduleName && builtinModules.includes(moduleName)) return getTips(moduleName);
2801
+ return message;
2802
+ };
2803
+ function format_formatStatsError(stats, root, level = 'error', logger) {
2804
+ const fileName = resolveFileName(stats, logger);
2805
+ let message = `${formatFileName(fileName, stats, root)}${stats.message}`;
2806
+ const verbose = isVerbose(logger);
2807
+ if (verbose) {
2808
+ if (stats.details) message += `\nDetails: ${stats.details}\n`;
2809
+ if (stats.stack) message += `\n${stats.stack}`;
2810
+ }
2811
+ if ('error' === level || isVerbose(logger)) {
2812
+ const moduleTrace = formatModuleTrace(stats, fileName, level, logger);
2813
+ if (moduleTrace) message += moduleTrace;
2814
+ }
2815
+ const innerError = '-- inner error --';
2816
+ if (!verbose && message.includes(innerError)) message = message.split(innerError)[0];
2817
+ message = hintUnknownFiles(message);
2818
+ message = hintNodePolyfill(message);
2819
+ message = hintAssetsConflict(message);
2820
+ let lines = message.split('\n');
2821
+ lines = lines.filter((line, index, arr)=>0 === index || '' !== line.trim() || line.trim() !== arr[index - 1].trim());
2822
+ message = lines.join('\n');
2823
+ return message.trim();
2824
+ }
2825
+ const styles = {
2826
+ 1: 'font-weight:bold',
2827
+ 2: 'opacity:0.5',
2828
+ 3: 'font-style:italic',
2829
+ 4: 'text-decoration:underline;text-underline-offset:3px',
2830
+ 8: 'display:none',
2831
+ 9: 'text-decoration:line-through',
2832
+ 30: 'color:#000',
2833
+ 31: 'color:#fb6a6a',
2834
+ 32: 'color:#6ef790',
2835
+ 33: 'color:#eff986',
2836
+ 34: 'color:#6eb2f7',
2837
+ 35: 'color:#f76ebe',
2838
+ 36: 'color:#6eecf7',
2839
+ 37: 'color:#f0f0f0',
2840
+ 90: 'color:#888'
2841
+ };
2842
+ for(let i = 91; i <= 97; i++)styles[i] = styles[i - 60];
2843
+ const closeCode = [
2844
+ 0,
2845
+ 21,
2846
+ 22,
2847
+ 23,
2848
+ 24,
2849
+ 27,
2850
+ 28,
2851
+ 29,
2852
+ 39,
2853
+ 49
2854
+ ];
2855
+ function ansiHTML(text) {
2856
+ const ansiCodes = [];
2857
+ let ret = text.replace(/\x1B\[([0-9;]+)m/g, (_match, sequences)=>{
2858
+ let style = '';
2859
+ for (const seq of sequences.split(';'))if (styles[seq]) style += `${styles[seq]};`;
2860
+ if (style) {
2861
+ ansiCodes.push(sequences);
2862
+ return `<span style="${style}">`;
2863
+ }
2864
+ if (closeCode.includes(Number(sequences)) && ansiCodes.length > 0) {
2865
+ ansiCodes.pop();
2866
+ return '</span>';
2867
+ }
2868
+ return '';
2869
+ });
2870
+ if (ansiCodes.length > 0) ret += Array(ansiCodes.length + 1).join('</span>');
2871
+ return ret;
2872
+ }
2873
+ const NODE_MODULES_REGEX = /[\\/]node_modules[\\/]/;
2874
+ function toRelativePath(base, filepath) {
2875
+ const relativePath = relative(base, filepath);
2876
+ if ('' === relativePath) return `.${sep}`;
2877
+ if (!relativePath.startsWith('.')) return `.${sep}${relativePath}`;
2878
+ return relativePath;
2879
+ }
2880
+ function escapeHtml(text) {
2881
+ if (!text) return '';
2882
+ return text.replace(/&/g, '&amp;').replace(/</g, '&lt;').replace(/>/g, '&gt;').replace(/"/g, '&quot;').replace(/'/g, '&#39;');
2883
+ }
2884
+ function formatDisplayPath(filePath, isAbsolute, root) {
2885
+ if (NODE_MODULES_REGEX.test(filePath)) for (const needle of [
2886
+ '/node_modules/',
2887
+ '\\node_modules\\'
2888
+ ]){
2889
+ const index = filePath.lastIndexOf(needle);
2890
+ if (-1 !== index) return filePath.slice(index + 1);
2891
+ }
2892
+ if (root && isAbsolute) return toRelativePath(root, filePath);
2893
+ return filePath;
2894
+ }
2895
+ function convertLinksInHtml(text, root) {
2896
+ const PATH_RE = /(?:\.\.?[/\\]|(file:\/\/\/)?[a-zA-Z]:\\|(file:\/\/)?\/|[A-Za-z0-9._-]+[/\\])[^\s:]*:\d+:\d+/g;
2897
+ const URL_RE = /(https?:\/\/(?:[\w-]+\.)+[a-z0-9](?:[\w-.~:/?#[\]@!$&'*+,;=])*)/gi;
2898
+ const NODE_INTERNAL_RE = /node:internal[/\\]/;
2899
+ const RSPACK_RUNTIME_RE = /webpack\/runtime\//;
2900
+ const FILE_URI_WINDOWS_RE = /^file:\/\/\/([A-Za-z]:)/;
2901
+ const FILE_URI_UNIX_RE = /^file:\/\//;
2902
+ const stripFileUri = (file)=>{
2903
+ if (!file.startsWith('file://')) return file;
2904
+ const windows = file.replace(FILE_URI_WINDOWS_RE, '$1');
2905
+ if (windows !== file) return windows;
2906
+ return file.replace(FILE_URI_UNIX_RE, '');
2907
+ };
2908
+ const lines = text.split('\n');
2909
+ const replacedLines = lines.map((line)=>{
2910
+ if (NODE_INTERNAL_RE.test(line) || RSPACK_RUNTIME_RE.test(line)) return line;
2911
+ let replacedLine = line.replace(PATH_RE, (file)=>{
2912
+ file = stripFileUri(file);
2913
+ const hasClosingSpan = file.includes('</span>') && !file.includes('<span');
2914
+ const filePath = hasClosingSpan ? file.replace('</span>', '') : file;
2915
+ const suffix = hasClosingSpan ? '</span>' : '';
2916
+ const isAbsolute = node_path.isAbsolute(filePath);
2917
+ const absolutePath = root && !isAbsolute ? node_path.join(root, filePath) : filePath;
2918
+ const displayPath = formatDisplayPath(filePath, isAbsolute, root);
2919
+ return `<a class="file-link" data-file="${absolutePath}">${displayPath}</a>${suffix}`;
2920
+ });
2921
+ replacedLine = replacedLine.replace(URL_RE, (url)=>`<a class="url-link" href="${url}" target="_blank" rel="noopener noreferrer">${url}</a>`);
2922
+ return replacedLine;
2923
+ });
2924
+ return replacedLines.join('\n');
2925
+ }
2926
+ function renderErrorToHtml(error, root) {
2927
+ return convertLinksInHtml(ansiHTML(escapeHtml(error)), root);
2928
+ }
2929
+ function getServerMessageErrors(errors, context) {
2930
+ const { rootPath, logger, overlay } = context;
2931
+ const formattedErrors = errors.map((item)=>format_formatStatsError(item, rootPath, 'error', logger));
2932
+ let overlayErrors = formattedErrors;
2933
+ if (overlay && 'object' == typeof overlay && 'function' == typeof overlay.errors) {
2934
+ const { errors: filter } = overlay;
2935
+ overlayErrors = formattedErrors.filter((error)=>filter(new Error(error)));
2936
+ }
2937
+ const html = overlayErrors.map((error)=>renderErrorToHtml(error, rootPath)).join('\n\n').trim();
2938
+ return {
2939
+ type: 'errors',
2940
+ data: {
2941
+ text: formattedErrors,
2942
+ html
2943
+ }
2944
+ };
2945
+ }
2946
+ const DEBOUNCE_MS = 500;
2947
+ const resolveAbsolutePath = (p)=>node_path.isAbsolute(p) ? p : node_path.join(process.cwd(), p);
2948
+ const dist_env = process.env;
2949
+ const runChild = ({ cmd, args, cwd, logger, shouldFail, buffered, formatter, executeName })=>new Promise((resolve, reject)=>{
2950
+ const bufferedOutput = [];
2951
+ const child = (0, cross_spawn.spawn)(cmd, args, {
2952
+ cwd,
2953
+ env: {
2954
+ ...dist_env,
2955
+ FORCE_COLOR: '1'
2956
+ },
2957
+ shell: false,
2958
+ stdio: 'pipe'
2959
+ });
2960
+ const emit = (data, log)=>{
2961
+ const trimmed = data.toString().trimEnd();
2962
+ if (!trimmed) return;
2963
+ if (buffered) bufferedOutput.push(trimmed);
2964
+ else log(trimmed);
2965
+ };
2966
+ child.stdout?.on('data', (d)=>emit(d, (s)=>logger?.info(s)));
2967
+ child.stderr?.on('data', (d)=>emit(d, (s)=>logger?.error(s)));
2968
+ child.on('error', (error)=>{
2969
+ if (buffered) return void resolve({
2970
+ status: 'fallback'
2971
+ });
2972
+ logger?.error(`${executeName} Error: ${error.message}`);
2973
+ reject(error);
2974
+ });
2975
+ child.on('exit', (code)=>{
2976
+ const output = bufferedOutput.join('\n');
2977
+ if (0 === code) {
2978
+ if (!buffered) logger?.info(`${executeName} successfully finished.`);
2979
+ const errors = formatter(output);
2980
+ resolve({
2981
+ status: 'lint-errors',
2982
+ errors
2983
+ });
2984
+ } else if (1 === code) {
2985
+ const errors = formatter(output);
2986
+ if (errors.length > 0) resolve({
2987
+ status: 'lint-errors',
2988
+ errors
2989
+ });
2990
+ else {
2991
+ if (buffered) {
2992
+ const errors = bufferedOutput.flatMap((line)=>formatter(line));
2993
+ resolve({
2994
+ status: 'lint-errors',
2995
+ errors
2996
+ });
2997
+ }
2998
+ if (shouldFail) reject(new Error(`${executeName} found lint errors.`));
2999
+ else resolve({
3000
+ status: 'lint-errors',
3001
+ errors: []
3002
+ });
3003
+ }
3004
+ } else if (buffered) resolve({
3005
+ status: 'fallback'
3006
+ });
3007
+ else {
3008
+ logger?.error(`${executeName} exited with unexpected code: ${code}`);
3009
+ resolve({
3010
+ status: 'ok'
3011
+ });
3012
+ }
3013
+ });
3014
+ });
3015
+ const runLintOnce = async (options, logger, pmPromise)=>{
3016
+ const { path = '', lintPath = '', executeName, args = [], shouldFail = false, formatter } = options;
3017
+ const cwd = resolveAbsolutePath(path);
3018
+ const pm = await pmPromise;
3019
+ if (!pm) throw new Error('Could not detect package manager');
3020
+ const tryRun = async (useExecuteLocal)=>{
3021
+ const resolved = lintPath ? {
3022
+ args,
3023
+ command: resolveAbsolutePath(lintPath)
3024
+ } : resolveCommand(pm.agent, useExecuteLocal ? 'execute-local' : 'execute', [
3025
+ executeName,
3026
+ ...args
3027
+ ]);
3028
+ if (!resolved) {
3029
+ if (useExecuteLocal && !lintPath) return tryRun(false);
3030
+ throw new Error(`${executeName} Could not resolve ${executeName} command for ${pm.agent}`);
3031
+ }
3032
+ const result = await runChild({
3033
+ args: resolved.args,
3034
+ buffered: useExecuteLocal && !lintPath,
3035
+ cmd: resolved.command,
3036
+ cwd,
3037
+ logger,
3038
+ shouldFail,
3039
+ formatter,
3040
+ executeName
3041
+ });
3042
+ if ('fallback' === result.status) return tryRun(false);
3043
+ return result;
3044
+ };
3045
+ return tryRun(true);
3046
+ };
3047
+ const lintPlugin = (options)=>({
3048
+ setup (api) {
3049
+ const executeName = options.executeName;
3050
+ let timeoutId;
3051
+ let pmPromise;
3052
+ const logger = api.logger;
3053
+ let send;
3054
+ let lastCompilation = null;
3055
+ const lintResults = {
3056
+ error: [],
3057
+ warning: []
3058
+ };
3059
+ let overlay = true;
3060
+ const getPm = ()=>{
3061
+ if (!pmPromise) pmPromise = detect();
3062
+ return pmPromise;
3063
+ };
3064
+ const sendErrorToOverlay = (errors)=>{
3065
+ if (0 === errors.length) return;
3066
+ try {
3067
+ if (!send || 'function' != typeof send) return void logger?.warn('sockWrite not available, cannot send errors to overlay');
3068
+ const lastResult = (lastCompilation?.errors ?? []).filter((item)=>!item.message.trimStart().startsWith(`× [${executeName}]`));
3069
+ const issues = [
3070
+ ...lastResult.map((item)=>({
3071
+ ...item,
3072
+ loc: item.loc ? 'name' in item.loc ? item.loc : `${item.loc.start.line}:${item.loc.start.column}` : void 0
3073
+ })),
3074
+ ...errors.map((e)=>formateCodeFrame(e)).map((item)=>({
3075
+ ...item,
3076
+ loc: item.loc ? `${item.loc.start.line}:${item.loc.start.column}` : void 0
3077
+ }))
3078
+ ];
3079
+ send('errors', getServerMessageErrors(issues, {
3080
+ rootPath: api.context.rootPath,
3081
+ logger: logger,
3082
+ overlay
3083
+ }).data);
3084
+ logger?.info(`Sent ${errors.length} lint errors to overlay`);
3085
+ } catch (e) {
3086
+ logger?.error(`Failed to send error to overlay: ${e}`);
3087
+ }
3088
+ };
3089
+ const clearOverlay = ()=>{
3090
+ try {
3091
+ if (!send || 'function' != typeof send) return;
3092
+ send('errors', {
3093
+ html: '',
3094
+ text: []
3095
+ });
3096
+ } catch (e) {
3097
+ logger?.error(`${executeName} Failed to clear overlay: ${e}`);
3098
+ }
3099
+ };
3100
+ let runId = 0;
3101
+ const runLint = async ()=>{
3102
+ try {
3103
+ const currentRun = ++runId;
3104
+ const result = await runLintOnce(options, logger, getPm());
3105
+ if (currentRun !== runId) return;
3106
+ if ('lint-errors' === result.status) {
3107
+ lintResults.error = result.errors;
3108
+ sendErrorToOverlay(lintResults.error);
3109
+ } else clearOverlay();
3110
+ } catch (error) {
3111
+ logger?.error(`${executeName} Error executing ${executeName}: ${error}`);
3112
+ }
3113
+ };
3114
+ const debouncedRun = ()=>{
3115
+ if (timeoutId) clearTimeout(timeoutId);
3116
+ timeoutId = setTimeout(()=>runLint(), DEBOUNCE_MS);
3117
+ };
3118
+ const formateCodeFrame = (item)=>{
3119
+ const source = item.file && __rspack_external_node_fs_5ea92f0c.existsSync(item.file) && __rspack_external_node_fs_5ea92f0c.readFileSync(item.file, 'utf-8');
3120
+ let frame = '';
3121
+ if (source && item.loc) frame = (0, lib.gl)(source, item.loc, {
3122
+ highlightCode: true
3123
+ }).split('\n').map((line)=>` ${line}`).join(__rspack_external_node_os_74b4b876.EOL);
3124
+ return {
3125
+ ...item,
3126
+ message: `[${executeName}] [${item.code}] ${item.message} ${item.help} \n${frame}`
3127
+ };
3128
+ };
3129
+ api.modifyRspackConfig((config)=>{
3130
+ config.plugins = config.plugins ?? [];
3131
+ config.plugins.push({
3132
+ apply (compiler) {
3133
+ compiler.hooks.thisCompilation.tap(`${executeName}-plugin`, (compilation)=>{
3134
+ try {
3135
+ compilation.errors.push(...lintResults.error.map((item)=>formateCodeFrame(item)));
3136
+ compilation.warnings.push(...lintResults.warning.map((w)=>formateCodeFrame(w)));
3137
+ lastCompilation = compilation;
3138
+ } catch (e) {
3139
+ console.error(e);
3140
+ }
3141
+ });
3142
+ }
3143
+ });
3144
+ });
3145
+ api.modifyRsbuildConfig((config)=>{
3146
+ config.server = config.server ?? {};
3147
+ config.plugins = config.plugins ?? [];
3148
+ overlay = config.dev?.client?.overlay ?? true;
3149
+ const setup = config.server.setup ?? [];
3150
+ const _setup = (context)=>{
3151
+ if ('dev' === context.action) {
3152
+ const devServer = context.server;
3153
+ send = devServer.sockWrite;
3154
+ devServer.httpServer?.on('upgrade', (req)=>{
3155
+ if (req.url?.includes(config.dev?.client?.path)) setTimeout(()=>{
3156
+ sendErrorToOverlay(lintResults.error);
3157
+ }, 500);
3158
+ });
3159
+ }
3160
+ };
3161
+ if (Array.isArray(setup)) config.server.setup = [
3162
+ _setup,
3163
+ ...setup
3164
+ ];
3165
+ else config.server.setup = (context)=>{
3166
+ _setup(context);
3167
+ return setup(context);
3168
+ };
3169
+ });
3170
+ api.onAfterDevCompile(()=>{
3171
+ debouncedRun();
3172
+ });
3173
+ api.onAfterStartDevServer(async ()=>{
3174
+ const { lintOnStart = true } = options;
3175
+ if (lintOnStart) await runLint();
3176
+ });
3177
+ },
3178
+ name: 'lint-plugin'
3179
+ });
3180
+ const src = lintPlugin;
3181
+ const dist = src;
3182
+ const parse = (output)=>{
3183
+ try {
3184
+ const out = JSON.parse(output);
3185
+ if (out.diagnostics) if (Array.isArray(out.diagnostics)) return out.diagnostics;
3186
+ else return [
3187
+ out.diagnostics
3188
+ ];
3189
+ return [];
3190
+ } catch (e) {
3191
+ return [];
3192
+ }
3193
+ };
3194
+ const src_formatter = (output)=>{
3195
+ const issues = parse(output);
3196
+ return issues.map((item)=>({
3197
+ ...item,
3198
+ severity: 'error',
3199
+ name: '',
3200
+ message: item.message,
3201
+ file: item.location.path,
3202
+ loc: item.location.range,
3203
+ code: item.code.url,
3204
+ help: (item.suggestions || [])?.map((s)=>s.text).join('\n')
3205
+ }));
3206
+ };
3207
+ const src_resolveAbsolutePath = (p)=>node_path.isAbsolute(p) ? p : node_path.join(process.cwd(), p);
3208
+ const buildArgs = (options)=>{
3209
+ const { configFile = '', colors, useServer, verbose, maxDiagnostics, skipParseErrors, noErrorsOnUnmatched, errorOnWarnings, diagnosticLevel } = options;
3210
+ const args = [
3211
+ 'lint'
3212
+ ];
3213
+ if (colors) args.push("--colors", `${colors}`);
3214
+ if (useServer) args.push("--use-server", `${useServer}`);
3215
+ if (verbose) args.push("--verbose", `${verbose}`);
3216
+ if (maxDiagnostics) args.push("--max-diagnostics", `${maxDiagnostics}`);
3217
+ if (skipParseErrors) args.push("--skip-parse-errors", `${skipParseErrors}`);
3218
+ if (noErrorsOnUnmatched) args.push("--no-errors-on-unmatched", `${noErrorsOnUnmatched}`);
3219
+ if (errorOnWarnings) args.push("--error-on-warnings", `${errorOnWarnings}`);
3220
+ if (diagnosticLevel) args.push("--diagnostic-level", diagnosticLevel);
3221
+ if (configFile) {
3222
+ const configFilePath = src_resolveAbsolutePath(configFile);
3223
+ if (existsSync(configFilePath)) args.push('-config-path', configFilePath);
3224
+ }
3225
+ return args;
3226
+ };
3227
+ const linterPlugin = (options = {})=>({
3228
+ setup (api) {
3229
+ dist({
3230
+ path: options.path,
3231
+ shouldFail: options.failOnError || options.failOnWarning,
3232
+ args: [
3233
+ ...buildArgs(options),
3234
+ '--reporter',
3235
+ 'rdjson'
3236
+ ],
3237
+ lintPath: options.linterPath,
3238
+ executeName: 'biome',
3239
+ formatter: src_formatter
3240
+ }).setup(api);
3241
+ },
3242
+ name: 'biome-plugin'
3243
+ });
3244
+ const src_0 = linterPlugin;
3245
+ export default src_0;
3246
+ export { linterPlugin };