react-doctor 0.2.0-beta.5 → 0.2.0-beta.6

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/cli.js CHANGED
@@ -3,7 +3,7 @@ import { Command } from "commander";
3
3
  import fs, { accessSync, constants, existsSync, mkdirSync, mkdtempSync, readdirSync, statSync, writeFileSync } from "node:fs";
4
4
  import path, { join } from "node:path";
5
5
  import { spawn, spawnSync } from "node:child_process";
6
- import reactDoctorPlugin, { ALL_REACT_DOCTOR_RULE_KEYS, FRAMEWORK_SPECIFIC_RULE_KEYS, MOTION_LIBRARY_PACKAGES } from "oxlint-plugin-react-doctor";
6
+ import reactDoctorPlugin, { ALL_REACT_DOCTOR_RULE_KEYS, BUILTIN_A11Y_RULES, BUILTIN_REACT_RULES, FRAMEWORK_SPECIFIC_RULE_KEYS, MOTION_LIBRARY_PACKAGES, REACT_COMPILER_RULES, YOU_MIGHT_NOT_NEED_EFFECT_RULES } from "oxlint-plugin-react-doctor";
7
7
  import os, { tmpdir } from "node:os";
8
8
  import * as ts from "typescript";
9
9
  import { performance } from "node:perf_hooks";
@@ -12,6 +12,30 @@ import { randomUUID } from "node:crypto";
12
12
  import basePrompts from "prompts";
13
13
  import { fileURLToPath } from "node:url";
14
14
  import { SKILL_MANIFEST_FILE, detectInstalledSkillAgents, getSkillAgentConfig, getSkillAgentTypes, installSkillsFromSource } from "agent-install";
15
+ //#region \0rolldown/runtime.js
16
+ var __create$1 = Object.create;
17
+ var __defProp$1 = Object.defineProperty;
18
+ var __getOwnPropDesc$1 = Object.getOwnPropertyDescriptor;
19
+ var __getOwnPropNames$1 = Object.getOwnPropertyNames;
20
+ var __getProtoOf$1 = Object.getPrototypeOf;
21
+ var __hasOwnProp$1 = Object.prototype.hasOwnProperty;
22
+ var __commonJSMin$1 = (cb, mod) => () => (mod || (cb((mod = { exports: {} }).exports, mod), cb = null), mod.exports);
23
+ var __copyProps$1 = (to, from, except, desc) => {
24
+ if (from && typeof from === "object" || typeof from === "function") for (var keys = __getOwnPropNames$1(from), i = 0, n = keys.length, key; i < n; i++) {
25
+ key = keys[i];
26
+ if (!__hasOwnProp$1.call(to, key) && key !== except) __defProp$1(to, key, {
27
+ get: ((k) => from[k]).bind(null, key),
28
+ enumerable: !(desc = __getOwnPropDesc$1(from, key)) || desc.enumerable
29
+ });
30
+ }
31
+ return to;
32
+ };
33
+ var __toESM$1 = (mod, isNodeMode, target) => (target = mod != null ? __create$1(__getProtoOf$1(mod)) : {}, __copyProps$1(isNodeMode || !mod || !mod.__esModule ? __defProp$1(target, "default", {
34
+ value: mod,
35
+ enumerable: true
36
+ }) : target, mod));
37
+ var __require = /* @__PURE__ */ createRequire(import.meta.url);
38
+ //#endregion
15
39
  //#region ../types/dist/index.js
16
40
  const REACT_NATIVE_DEPENDENCY_NAMES = new Set([
17
41
  "react-native",
@@ -914,7 +938,1661 @@ const isTailwindAtLeast = (detected, required) => {
914
938
  return detected.minor >= required.minor;
915
939
  };
916
940
  //#endregion
941
+ //#region ../../node_modules/.pnpm/picomatch@2.3.1/node_modules/picomatch/lib/constants.js
942
+ var require_constants = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
943
+ const path$3 = __require("path");
944
+ const WIN_SLASH = "\\\\/";
945
+ const WIN_NO_SLASH = `[^${WIN_SLASH}]`;
946
+ /**
947
+ * Posix glob regex
948
+ */
949
+ const DOT_LITERAL = "\\.";
950
+ const PLUS_LITERAL = "\\+";
951
+ const QMARK_LITERAL = "\\?";
952
+ const SLASH_LITERAL = "\\/";
953
+ const ONE_CHAR = "(?=.)";
954
+ const QMARK = "[^/]";
955
+ const END_ANCHOR = `(?:${SLASH_LITERAL}|$)`;
956
+ const START_ANCHOR = `(?:^|${SLASH_LITERAL})`;
957
+ const DOTS_SLASH = `${DOT_LITERAL}{1,2}${END_ANCHOR}`;
958
+ const POSIX_CHARS = {
959
+ DOT_LITERAL,
960
+ PLUS_LITERAL,
961
+ QMARK_LITERAL,
962
+ SLASH_LITERAL,
963
+ ONE_CHAR,
964
+ QMARK,
965
+ END_ANCHOR,
966
+ DOTS_SLASH,
967
+ NO_DOT: `(?!${DOT_LITERAL})`,
968
+ NO_DOTS: `(?!${START_ANCHOR}${DOTS_SLASH})`,
969
+ NO_DOT_SLASH: `(?!${DOT_LITERAL}{0,1}${END_ANCHOR})`,
970
+ NO_DOTS_SLASH: `(?!${DOTS_SLASH})`,
971
+ QMARK_NO_DOT: `[^.${SLASH_LITERAL}]`,
972
+ STAR: `${QMARK}*?`,
973
+ START_ANCHOR
974
+ };
975
+ /**
976
+ * Windows glob regex
977
+ */
978
+ const WINDOWS_CHARS = {
979
+ ...POSIX_CHARS,
980
+ SLASH_LITERAL: `[${WIN_SLASH}]`,
981
+ QMARK: WIN_NO_SLASH,
982
+ STAR: `${WIN_NO_SLASH}*?`,
983
+ DOTS_SLASH: `${DOT_LITERAL}{1,2}(?:[${WIN_SLASH}]|$)`,
984
+ NO_DOT: `(?!${DOT_LITERAL})`,
985
+ NO_DOTS: `(?!(?:^|[${WIN_SLASH}])${DOT_LITERAL}{1,2}(?:[${WIN_SLASH}]|$))`,
986
+ NO_DOT_SLASH: `(?!${DOT_LITERAL}{0,1}(?:[${WIN_SLASH}]|$))`,
987
+ NO_DOTS_SLASH: `(?!${DOT_LITERAL}{1,2}(?:[${WIN_SLASH}]|$))`,
988
+ QMARK_NO_DOT: `[^.${WIN_SLASH}]`,
989
+ START_ANCHOR: `(?:^|[${WIN_SLASH}])`,
990
+ END_ANCHOR: `(?:[${WIN_SLASH}]|$)`
991
+ };
992
+ module.exports = {
993
+ MAX_LENGTH: 1024 * 64,
994
+ POSIX_REGEX_SOURCE: {
995
+ alnum: "a-zA-Z0-9",
996
+ alpha: "a-zA-Z",
997
+ ascii: "\\x00-\\x7F",
998
+ blank: " \\t",
999
+ cntrl: "\\x00-\\x1F\\x7F",
1000
+ digit: "0-9",
1001
+ graph: "\\x21-\\x7E",
1002
+ lower: "a-z",
1003
+ print: "\\x20-\\x7E ",
1004
+ punct: "\\-!\"#$%&'()\\*+,./:;<=>?@[\\]^_`{|}~",
1005
+ space: " \\t\\r\\n\\v\\f",
1006
+ upper: "A-Z",
1007
+ word: "A-Za-z0-9_",
1008
+ xdigit: "A-Fa-f0-9"
1009
+ },
1010
+ REGEX_BACKSLASH: /\\(?![*+?^${}(|)[\]])/g,
1011
+ REGEX_NON_SPECIAL_CHARS: /^[^@![\].,$*+?^{}()|\\/]+/,
1012
+ REGEX_SPECIAL_CHARS: /[-*+?.^${}(|)[\]]/,
1013
+ REGEX_SPECIAL_CHARS_BACKREF: /(\\?)((\W)(\3*))/g,
1014
+ REGEX_SPECIAL_CHARS_GLOBAL: /([-*+?.^${}(|)[\]])/g,
1015
+ REGEX_REMOVE_BACKSLASH: /(?:\[.*?[^\\]\]|\\(?=.))/g,
1016
+ REPLACEMENTS: {
1017
+ "***": "*",
1018
+ "**/**": "**",
1019
+ "**/**/**": "**"
1020
+ },
1021
+ CHAR_0: 48,
1022
+ CHAR_9: 57,
1023
+ CHAR_UPPERCASE_A: 65,
1024
+ CHAR_LOWERCASE_A: 97,
1025
+ CHAR_UPPERCASE_Z: 90,
1026
+ CHAR_LOWERCASE_Z: 122,
1027
+ CHAR_LEFT_PARENTHESES: 40,
1028
+ CHAR_RIGHT_PARENTHESES: 41,
1029
+ CHAR_ASTERISK: 42,
1030
+ CHAR_AMPERSAND: 38,
1031
+ CHAR_AT: 64,
1032
+ CHAR_BACKWARD_SLASH: 92,
1033
+ CHAR_CARRIAGE_RETURN: 13,
1034
+ CHAR_CIRCUMFLEX_ACCENT: 94,
1035
+ CHAR_COLON: 58,
1036
+ CHAR_COMMA: 44,
1037
+ CHAR_DOT: 46,
1038
+ CHAR_DOUBLE_QUOTE: 34,
1039
+ CHAR_EQUAL: 61,
1040
+ CHAR_EXCLAMATION_MARK: 33,
1041
+ CHAR_FORM_FEED: 12,
1042
+ CHAR_FORWARD_SLASH: 47,
1043
+ CHAR_GRAVE_ACCENT: 96,
1044
+ CHAR_HASH: 35,
1045
+ CHAR_HYPHEN_MINUS: 45,
1046
+ CHAR_LEFT_ANGLE_BRACKET: 60,
1047
+ CHAR_LEFT_CURLY_BRACE: 123,
1048
+ CHAR_LEFT_SQUARE_BRACKET: 91,
1049
+ CHAR_LINE_FEED: 10,
1050
+ CHAR_NO_BREAK_SPACE: 160,
1051
+ CHAR_PERCENT: 37,
1052
+ CHAR_PLUS: 43,
1053
+ CHAR_QUESTION_MARK: 63,
1054
+ CHAR_RIGHT_ANGLE_BRACKET: 62,
1055
+ CHAR_RIGHT_CURLY_BRACE: 125,
1056
+ CHAR_RIGHT_SQUARE_BRACKET: 93,
1057
+ CHAR_SEMICOLON: 59,
1058
+ CHAR_SINGLE_QUOTE: 39,
1059
+ CHAR_SPACE: 32,
1060
+ CHAR_TAB: 9,
1061
+ CHAR_UNDERSCORE: 95,
1062
+ CHAR_VERTICAL_LINE: 124,
1063
+ CHAR_ZERO_WIDTH_NOBREAK_SPACE: 65279,
1064
+ SEP: path$3.sep,
1065
+ /**
1066
+ * Create EXTGLOB_CHARS
1067
+ */
1068
+ extglobChars(chars) {
1069
+ return {
1070
+ "!": {
1071
+ type: "negate",
1072
+ open: "(?:(?!(?:",
1073
+ close: `))${chars.STAR})`
1074
+ },
1075
+ "?": {
1076
+ type: "qmark",
1077
+ open: "(?:",
1078
+ close: ")?"
1079
+ },
1080
+ "+": {
1081
+ type: "plus",
1082
+ open: "(?:",
1083
+ close: ")+"
1084
+ },
1085
+ "*": {
1086
+ type: "star",
1087
+ open: "(?:",
1088
+ close: ")*"
1089
+ },
1090
+ "@": {
1091
+ type: "at",
1092
+ open: "(?:",
1093
+ close: ")"
1094
+ }
1095
+ };
1096
+ },
1097
+ /**
1098
+ * Create GLOB_CHARS
1099
+ */
1100
+ globChars(win32) {
1101
+ return win32 === true ? WINDOWS_CHARS : POSIX_CHARS;
1102
+ }
1103
+ };
1104
+ }));
1105
+ //#endregion
1106
+ //#region ../../node_modules/.pnpm/picomatch@2.3.1/node_modules/picomatch/lib/utils.js
1107
+ var require_utils = /* @__PURE__ */ __commonJSMin$1(((exports) => {
1108
+ const path$2 = __require("path");
1109
+ const win32 = process.platform === "win32";
1110
+ const { REGEX_BACKSLASH, REGEX_REMOVE_BACKSLASH, REGEX_SPECIAL_CHARS, REGEX_SPECIAL_CHARS_GLOBAL } = require_constants();
1111
+ exports.isObject = (val) => val !== null && typeof val === "object" && !Array.isArray(val);
1112
+ exports.hasRegexChars = (str) => REGEX_SPECIAL_CHARS.test(str);
1113
+ exports.isRegexChar = (str) => str.length === 1 && exports.hasRegexChars(str);
1114
+ exports.escapeRegex = (str) => str.replace(REGEX_SPECIAL_CHARS_GLOBAL, "\\$1");
1115
+ exports.toPosixSlashes = (str) => str.replace(REGEX_BACKSLASH, "/");
1116
+ exports.removeBackslashes = (str) => {
1117
+ return str.replace(REGEX_REMOVE_BACKSLASH, (match) => {
1118
+ return match === "\\" ? "" : match;
1119
+ });
1120
+ };
1121
+ exports.supportsLookbehinds = () => {
1122
+ const segs = process.version.slice(1).split(".").map(Number);
1123
+ if (segs.length === 3 && segs[0] >= 9 || segs[0] === 8 && segs[1] >= 10) return true;
1124
+ return false;
1125
+ };
1126
+ exports.isWindows = (options) => {
1127
+ if (options && typeof options.windows === "boolean") return options.windows;
1128
+ return win32 === true || path$2.sep === "\\";
1129
+ };
1130
+ exports.escapeLast = (input, char, lastIdx) => {
1131
+ const idx = input.lastIndexOf(char, lastIdx);
1132
+ if (idx === -1) return input;
1133
+ if (input[idx - 1] === "\\") return exports.escapeLast(input, char, idx - 1);
1134
+ return `${input.slice(0, idx)}\\${input.slice(idx)}`;
1135
+ };
1136
+ exports.removePrefix = (input, state = {}) => {
1137
+ let output = input;
1138
+ if (output.startsWith("./")) {
1139
+ output = output.slice(2);
1140
+ state.prefix = "./";
1141
+ }
1142
+ return output;
1143
+ };
1144
+ exports.wrapOutput = (input, state = {}, options = {}) => {
1145
+ let output = `${options.contains ? "" : "^"}(?:${input})${options.contains ? "" : "$"}`;
1146
+ if (state.negated === true) output = `(?:^(?!${output}).*$)`;
1147
+ return output;
1148
+ };
1149
+ }));
1150
+ //#endregion
1151
+ //#region ../../node_modules/.pnpm/picomatch@2.3.1/node_modules/picomatch/lib/scan.js
1152
+ var require_scan = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
1153
+ const utils = require_utils();
1154
+ const { CHAR_ASTERISK, CHAR_AT, CHAR_BACKWARD_SLASH, CHAR_COMMA, CHAR_DOT, CHAR_EXCLAMATION_MARK, CHAR_FORWARD_SLASH, CHAR_LEFT_CURLY_BRACE, CHAR_LEFT_PARENTHESES, CHAR_LEFT_SQUARE_BRACKET, CHAR_PLUS, CHAR_QUESTION_MARK, CHAR_RIGHT_CURLY_BRACE, CHAR_RIGHT_PARENTHESES, CHAR_RIGHT_SQUARE_BRACKET } = require_constants();
1155
+ const isPathSeparator = (code) => {
1156
+ return code === CHAR_FORWARD_SLASH || code === CHAR_BACKWARD_SLASH;
1157
+ };
1158
+ const depth = (token) => {
1159
+ if (token.isPrefix !== true) token.depth = token.isGlobstar ? Infinity : 1;
1160
+ };
1161
+ /**
1162
+ * Quickly scans a glob pattern and returns an object with a handful of
1163
+ * useful properties, like `isGlob`, `path` (the leading non-glob, if it exists),
1164
+ * `glob` (the actual pattern), `negated` (true if the path starts with `!` but not
1165
+ * with `!(`) and `negatedExtglob` (true if the path starts with `!(`).
1166
+ *
1167
+ * ```js
1168
+ * const pm = require('picomatch');
1169
+ * console.log(pm.scan('foo/bar/*.js'));
1170
+ * { isGlob: true, input: 'foo/bar/*.js', base: 'foo/bar', glob: '*.js' }
1171
+ * ```
1172
+ * @param {String} `str`
1173
+ * @param {Object} `options`
1174
+ * @return {Object} Returns an object with tokens and regex source string.
1175
+ * @api public
1176
+ */
1177
+ const scan = (input, options) => {
1178
+ const opts = options || {};
1179
+ const length = input.length - 1;
1180
+ const scanToEnd = opts.parts === true || opts.scanToEnd === true;
1181
+ const slashes = [];
1182
+ const tokens = [];
1183
+ const parts = [];
1184
+ let str = input;
1185
+ let index = -1;
1186
+ let start = 0;
1187
+ let lastIndex = 0;
1188
+ let isBrace = false;
1189
+ let isBracket = false;
1190
+ let isGlob = false;
1191
+ let isExtglob = false;
1192
+ let isGlobstar = false;
1193
+ let braceEscaped = false;
1194
+ let backslashes = false;
1195
+ let negated = false;
1196
+ let negatedExtglob = false;
1197
+ let finished = false;
1198
+ let braces = 0;
1199
+ let prev;
1200
+ let code;
1201
+ let token = {
1202
+ value: "",
1203
+ depth: 0,
1204
+ isGlob: false
1205
+ };
1206
+ const eos = () => index >= length;
1207
+ const peek = () => str.charCodeAt(index + 1);
1208
+ const advance = () => {
1209
+ prev = code;
1210
+ return str.charCodeAt(++index);
1211
+ };
1212
+ while (index < length) {
1213
+ code = advance();
1214
+ let next;
1215
+ if (code === CHAR_BACKWARD_SLASH) {
1216
+ backslashes = token.backslashes = true;
1217
+ code = advance();
1218
+ if (code === CHAR_LEFT_CURLY_BRACE) braceEscaped = true;
1219
+ continue;
1220
+ }
1221
+ if (braceEscaped === true || code === CHAR_LEFT_CURLY_BRACE) {
1222
+ braces++;
1223
+ while (eos() !== true && (code = advance())) {
1224
+ if (code === CHAR_BACKWARD_SLASH) {
1225
+ backslashes = token.backslashes = true;
1226
+ advance();
1227
+ continue;
1228
+ }
1229
+ if (code === CHAR_LEFT_CURLY_BRACE) {
1230
+ braces++;
1231
+ continue;
1232
+ }
1233
+ if (braceEscaped !== true && code === CHAR_DOT && (code = advance()) === CHAR_DOT) {
1234
+ isBrace = token.isBrace = true;
1235
+ isGlob = token.isGlob = true;
1236
+ finished = true;
1237
+ if (scanToEnd === true) continue;
1238
+ break;
1239
+ }
1240
+ if (braceEscaped !== true && code === CHAR_COMMA) {
1241
+ isBrace = token.isBrace = true;
1242
+ isGlob = token.isGlob = true;
1243
+ finished = true;
1244
+ if (scanToEnd === true) continue;
1245
+ break;
1246
+ }
1247
+ if (code === CHAR_RIGHT_CURLY_BRACE) {
1248
+ braces--;
1249
+ if (braces === 0) {
1250
+ braceEscaped = false;
1251
+ isBrace = token.isBrace = true;
1252
+ finished = true;
1253
+ break;
1254
+ }
1255
+ }
1256
+ }
1257
+ if (scanToEnd === true) continue;
1258
+ break;
1259
+ }
1260
+ if (code === CHAR_FORWARD_SLASH) {
1261
+ slashes.push(index);
1262
+ tokens.push(token);
1263
+ token = {
1264
+ value: "",
1265
+ depth: 0,
1266
+ isGlob: false
1267
+ };
1268
+ if (finished === true) continue;
1269
+ if (prev === CHAR_DOT && index === start + 1) {
1270
+ start += 2;
1271
+ continue;
1272
+ }
1273
+ lastIndex = index + 1;
1274
+ continue;
1275
+ }
1276
+ if (opts.noext !== true) {
1277
+ if ((code === CHAR_PLUS || code === CHAR_AT || code === CHAR_ASTERISK || code === CHAR_QUESTION_MARK || code === CHAR_EXCLAMATION_MARK) === true && peek() === CHAR_LEFT_PARENTHESES) {
1278
+ isGlob = token.isGlob = true;
1279
+ isExtglob = token.isExtglob = true;
1280
+ finished = true;
1281
+ if (code === CHAR_EXCLAMATION_MARK && index === start) negatedExtglob = true;
1282
+ if (scanToEnd === true) {
1283
+ while (eos() !== true && (code = advance())) {
1284
+ if (code === CHAR_BACKWARD_SLASH) {
1285
+ backslashes = token.backslashes = true;
1286
+ code = advance();
1287
+ continue;
1288
+ }
1289
+ if (code === CHAR_RIGHT_PARENTHESES) {
1290
+ isGlob = token.isGlob = true;
1291
+ finished = true;
1292
+ break;
1293
+ }
1294
+ }
1295
+ continue;
1296
+ }
1297
+ break;
1298
+ }
1299
+ }
1300
+ if (code === CHAR_ASTERISK) {
1301
+ if (prev === CHAR_ASTERISK) isGlobstar = token.isGlobstar = true;
1302
+ isGlob = token.isGlob = true;
1303
+ finished = true;
1304
+ if (scanToEnd === true) continue;
1305
+ break;
1306
+ }
1307
+ if (code === CHAR_QUESTION_MARK) {
1308
+ isGlob = token.isGlob = true;
1309
+ finished = true;
1310
+ if (scanToEnd === true) continue;
1311
+ break;
1312
+ }
1313
+ if (code === CHAR_LEFT_SQUARE_BRACKET) {
1314
+ while (eos() !== true && (next = advance())) {
1315
+ if (next === CHAR_BACKWARD_SLASH) {
1316
+ backslashes = token.backslashes = true;
1317
+ advance();
1318
+ continue;
1319
+ }
1320
+ if (next === CHAR_RIGHT_SQUARE_BRACKET) {
1321
+ isBracket = token.isBracket = true;
1322
+ isGlob = token.isGlob = true;
1323
+ finished = true;
1324
+ break;
1325
+ }
1326
+ }
1327
+ if (scanToEnd === true) continue;
1328
+ break;
1329
+ }
1330
+ if (opts.nonegate !== true && code === CHAR_EXCLAMATION_MARK && index === start) {
1331
+ negated = token.negated = true;
1332
+ start++;
1333
+ continue;
1334
+ }
1335
+ if (opts.noparen !== true && code === CHAR_LEFT_PARENTHESES) {
1336
+ isGlob = token.isGlob = true;
1337
+ if (scanToEnd === true) {
1338
+ while (eos() !== true && (code = advance())) {
1339
+ if (code === CHAR_LEFT_PARENTHESES) {
1340
+ backslashes = token.backslashes = true;
1341
+ code = advance();
1342
+ continue;
1343
+ }
1344
+ if (code === CHAR_RIGHT_PARENTHESES) {
1345
+ finished = true;
1346
+ break;
1347
+ }
1348
+ }
1349
+ continue;
1350
+ }
1351
+ break;
1352
+ }
1353
+ if (isGlob === true) {
1354
+ finished = true;
1355
+ if (scanToEnd === true) continue;
1356
+ break;
1357
+ }
1358
+ }
1359
+ if (opts.noext === true) {
1360
+ isExtglob = false;
1361
+ isGlob = false;
1362
+ }
1363
+ let base = str;
1364
+ let prefix = "";
1365
+ let glob = "";
1366
+ if (start > 0) {
1367
+ prefix = str.slice(0, start);
1368
+ str = str.slice(start);
1369
+ lastIndex -= start;
1370
+ }
1371
+ if (base && isGlob === true && lastIndex > 0) {
1372
+ base = str.slice(0, lastIndex);
1373
+ glob = str.slice(lastIndex);
1374
+ } else if (isGlob === true) {
1375
+ base = "";
1376
+ glob = str;
1377
+ } else base = str;
1378
+ if (base && base !== "" && base !== "/" && base !== str) {
1379
+ if (isPathSeparator(base.charCodeAt(base.length - 1))) base = base.slice(0, -1);
1380
+ }
1381
+ if (opts.unescape === true) {
1382
+ if (glob) glob = utils.removeBackslashes(glob);
1383
+ if (base && backslashes === true) base = utils.removeBackslashes(base);
1384
+ }
1385
+ const state = {
1386
+ prefix,
1387
+ input,
1388
+ start,
1389
+ base,
1390
+ glob,
1391
+ isBrace,
1392
+ isBracket,
1393
+ isGlob,
1394
+ isExtglob,
1395
+ isGlobstar,
1396
+ negated,
1397
+ negatedExtglob
1398
+ };
1399
+ if (opts.tokens === true) {
1400
+ state.maxDepth = 0;
1401
+ if (!isPathSeparator(code)) tokens.push(token);
1402
+ state.tokens = tokens;
1403
+ }
1404
+ if (opts.parts === true || opts.tokens === true) {
1405
+ let prevIndex;
1406
+ for (let idx = 0; idx < slashes.length; idx++) {
1407
+ const n = prevIndex ? prevIndex + 1 : start;
1408
+ const i = slashes[idx];
1409
+ const value = input.slice(n, i);
1410
+ if (opts.tokens) {
1411
+ if (idx === 0 && start !== 0) {
1412
+ tokens[idx].isPrefix = true;
1413
+ tokens[idx].value = prefix;
1414
+ } else tokens[idx].value = value;
1415
+ depth(tokens[idx]);
1416
+ state.maxDepth += tokens[idx].depth;
1417
+ }
1418
+ if (idx !== 0 || value !== "") parts.push(value);
1419
+ prevIndex = i;
1420
+ }
1421
+ if (prevIndex && prevIndex + 1 < input.length) {
1422
+ const value = input.slice(prevIndex + 1);
1423
+ parts.push(value);
1424
+ if (opts.tokens) {
1425
+ tokens[tokens.length - 1].value = value;
1426
+ depth(tokens[tokens.length - 1]);
1427
+ state.maxDepth += tokens[tokens.length - 1].depth;
1428
+ }
1429
+ }
1430
+ state.slashes = slashes;
1431
+ state.parts = parts;
1432
+ }
1433
+ return state;
1434
+ };
1435
+ module.exports = scan;
1436
+ }));
1437
+ //#endregion
1438
+ //#region ../../node_modules/.pnpm/picomatch@2.3.1/node_modules/picomatch/lib/parse.js
1439
+ var require_parse = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
1440
+ const constants = require_constants();
1441
+ const utils = require_utils();
1442
+ /**
1443
+ * Constants
1444
+ */
1445
+ const { MAX_LENGTH, POSIX_REGEX_SOURCE, REGEX_NON_SPECIAL_CHARS, REGEX_SPECIAL_CHARS_BACKREF, REPLACEMENTS } = constants;
1446
+ /**
1447
+ * Helpers
1448
+ */
1449
+ const expandRange = (args, options) => {
1450
+ if (typeof options.expandRange === "function") return options.expandRange(...args, options);
1451
+ args.sort();
1452
+ const value = `[${args.join("-")}]`;
1453
+ try {
1454
+ new RegExp(value);
1455
+ } catch (ex) {
1456
+ return args.map((v) => utils.escapeRegex(v)).join("..");
1457
+ }
1458
+ return value;
1459
+ };
1460
+ /**
1461
+ * Create the message for a syntax error
1462
+ */
1463
+ const syntaxError = (type, char) => {
1464
+ return `Missing ${type}: "${char}" - use "\\\\${char}" to match literal characters`;
1465
+ };
1466
+ /**
1467
+ * Parse the given input string.
1468
+ * @param {String} input
1469
+ * @param {Object} options
1470
+ * @return {Object}
1471
+ */
1472
+ const parse = (input, options) => {
1473
+ if (typeof input !== "string") throw new TypeError("Expected a string");
1474
+ input = REPLACEMENTS[input] || input;
1475
+ const opts = { ...options };
1476
+ const max = typeof opts.maxLength === "number" ? Math.min(MAX_LENGTH, opts.maxLength) : MAX_LENGTH;
1477
+ let len = input.length;
1478
+ if (len > max) throw new SyntaxError(`Input length: ${len}, exceeds maximum allowed length: ${max}`);
1479
+ const bos = {
1480
+ type: "bos",
1481
+ value: "",
1482
+ output: opts.prepend || ""
1483
+ };
1484
+ const tokens = [bos];
1485
+ const capture = opts.capture ? "" : "?:";
1486
+ const win32 = utils.isWindows(options);
1487
+ const PLATFORM_CHARS = constants.globChars(win32);
1488
+ const EXTGLOB_CHARS = constants.extglobChars(PLATFORM_CHARS);
1489
+ const { DOT_LITERAL, PLUS_LITERAL, SLASH_LITERAL, ONE_CHAR, DOTS_SLASH, NO_DOT, NO_DOT_SLASH, NO_DOTS_SLASH, QMARK, QMARK_NO_DOT, STAR, START_ANCHOR } = PLATFORM_CHARS;
1490
+ const globstar = (opts) => {
1491
+ return `(${capture}(?:(?!${START_ANCHOR}${opts.dot ? DOTS_SLASH : DOT_LITERAL}).)*?)`;
1492
+ };
1493
+ const nodot = opts.dot ? "" : NO_DOT;
1494
+ const qmarkNoDot = opts.dot ? QMARK : QMARK_NO_DOT;
1495
+ let star = opts.bash === true ? globstar(opts) : STAR;
1496
+ if (opts.capture) star = `(${star})`;
1497
+ if (typeof opts.noext === "boolean") opts.noextglob = opts.noext;
1498
+ const state = {
1499
+ input,
1500
+ index: -1,
1501
+ start: 0,
1502
+ dot: opts.dot === true,
1503
+ consumed: "",
1504
+ output: "",
1505
+ prefix: "",
1506
+ backtrack: false,
1507
+ negated: false,
1508
+ brackets: 0,
1509
+ braces: 0,
1510
+ parens: 0,
1511
+ quotes: 0,
1512
+ globstar: false,
1513
+ tokens
1514
+ };
1515
+ input = utils.removePrefix(input, state);
1516
+ len = input.length;
1517
+ const extglobs = [];
1518
+ const braces = [];
1519
+ const stack = [];
1520
+ let prev = bos;
1521
+ let value;
1522
+ /**
1523
+ * Tokenizing helpers
1524
+ */
1525
+ const eos = () => state.index === len - 1;
1526
+ const peek = state.peek = (n = 1) => input[state.index + n];
1527
+ const advance = state.advance = () => input[++state.index] || "";
1528
+ const remaining = () => input.slice(state.index + 1);
1529
+ const consume = (value = "", num = 0) => {
1530
+ state.consumed += value;
1531
+ state.index += num;
1532
+ };
1533
+ const append = (token) => {
1534
+ state.output += token.output != null ? token.output : token.value;
1535
+ consume(token.value);
1536
+ };
1537
+ const negate = () => {
1538
+ let count = 1;
1539
+ while (peek() === "!" && (peek(2) !== "(" || peek(3) === "?")) {
1540
+ advance();
1541
+ state.start++;
1542
+ count++;
1543
+ }
1544
+ if (count % 2 === 0) return false;
1545
+ state.negated = true;
1546
+ state.start++;
1547
+ return true;
1548
+ };
1549
+ const increment = (type) => {
1550
+ state[type]++;
1551
+ stack.push(type);
1552
+ };
1553
+ const decrement = (type) => {
1554
+ state[type]--;
1555
+ stack.pop();
1556
+ };
1557
+ /**
1558
+ * Push tokens onto the tokens array. This helper speeds up
1559
+ * tokenizing by 1) helping us avoid backtracking as much as possible,
1560
+ * and 2) helping us avoid creating extra tokens when consecutive
1561
+ * characters are plain text. This improves performance and simplifies
1562
+ * lookbehinds.
1563
+ */
1564
+ const push = (tok) => {
1565
+ if (prev.type === "globstar") {
1566
+ const isBrace = state.braces > 0 && (tok.type === "comma" || tok.type === "brace");
1567
+ const isExtglob = tok.extglob === true || extglobs.length && (tok.type === "pipe" || tok.type === "paren");
1568
+ if (tok.type !== "slash" && tok.type !== "paren" && !isBrace && !isExtglob) {
1569
+ state.output = state.output.slice(0, -prev.output.length);
1570
+ prev.type = "star";
1571
+ prev.value = "*";
1572
+ prev.output = star;
1573
+ state.output += prev.output;
1574
+ }
1575
+ }
1576
+ if (extglobs.length && tok.type !== "paren") extglobs[extglobs.length - 1].inner += tok.value;
1577
+ if (tok.value || tok.output) append(tok);
1578
+ if (prev && prev.type === "text" && tok.type === "text") {
1579
+ prev.value += tok.value;
1580
+ prev.output = (prev.output || "") + tok.value;
1581
+ return;
1582
+ }
1583
+ tok.prev = prev;
1584
+ tokens.push(tok);
1585
+ prev = tok;
1586
+ };
1587
+ const extglobOpen = (type, value) => {
1588
+ const token = {
1589
+ ...EXTGLOB_CHARS[value],
1590
+ conditions: 1,
1591
+ inner: ""
1592
+ };
1593
+ token.prev = prev;
1594
+ token.parens = state.parens;
1595
+ token.output = state.output;
1596
+ const output = (opts.capture ? "(" : "") + token.open;
1597
+ increment("parens");
1598
+ push({
1599
+ type,
1600
+ value,
1601
+ output: state.output ? "" : ONE_CHAR
1602
+ });
1603
+ push({
1604
+ type: "paren",
1605
+ extglob: true,
1606
+ value: advance(),
1607
+ output
1608
+ });
1609
+ extglobs.push(token);
1610
+ };
1611
+ const extglobClose = (token) => {
1612
+ let output = token.close + (opts.capture ? ")" : "");
1613
+ let rest;
1614
+ if (token.type === "negate") {
1615
+ let extglobStar = star;
1616
+ if (token.inner && token.inner.length > 1 && token.inner.includes("/")) extglobStar = globstar(opts);
1617
+ if (extglobStar !== star || eos() || /^\)+$/.test(remaining())) output = token.close = `)$))${extglobStar}`;
1618
+ if (token.inner.includes("*") && (rest = remaining()) && /^\.[^\\/.]+$/.test(rest)) output = token.close = `)${parse(rest, {
1619
+ ...options,
1620
+ fastpaths: false
1621
+ }).output})${extglobStar})`;
1622
+ if (token.prev.type === "bos") state.negatedExtglob = true;
1623
+ }
1624
+ push({
1625
+ type: "paren",
1626
+ extglob: true,
1627
+ value,
1628
+ output
1629
+ });
1630
+ decrement("parens");
1631
+ };
1632
+ /**
1633
+ * Fast paths
1634
+ */
1635
+ if (opts.fastpaths !== false && !/(^[*!]|[/()[\]{}"])/.test(input)) {
1636
+ let backslashes = false;
1637
+ let output = input.replace(REGEX_SPECIAL_CHARS_BACKREF, (m, esc, chars, first, rest, index) => {
1638
+ if (first === "\\") {
1639
+ backslashes = true;
1640
+ return m;
1641
+ }
1642
+ if (first === "?") {
1643
+ if (esc) return esc + first + (rest ? QMARK.repeat(rest.length) : "");
1644
+ if (index === 0) return qmarkNoDot + (rest ? QMARK.repeat(rest.length) : "");
1645
+ return QMARK.repeat(chars.length);
1646
+ }
1647
+ if (first === ".") return DOT_LITERAL.repeat(chars.length);
1648
+ if (first === "*") {
1649
+ if (esc) return esc + first + (rest ? star : "");
1650
+ return star;
1651
+ }
1652
+ return esc ? m : `\\${m}`;
1653
+ });
1654
+ if (backslashes === true) if (opts.unescape === true) output = output.replace(/\\/g, "");
1655
+ else output = output.replace(/\\+/g, (m) => {
1656
+ return m.length % 2 === 0 ? "\\\\" : m ? "\\" : "";
1657
+ });
1658
+ if (output === input && opts.contains === true) {
1659
+ state.output = input;
1660
+ return state;
1661
+ }
1662
+ state.output = utils.wrapOutput(output, state, options);
1663
+ return state;
1664
+ }
1665
+ /**
1666
+ * Tokenize input until we reach end-of-string
1667
+ */
1668
+ while (!eos()) {
1669
+ value = advance();
1670
+ if (value === "\0") continue;
1671
+ /**
1672
+ * Escaped characters
1673
+ */
1674
+ if (value === "\\") {
1675
+ const next = peek();
1676
+ if (next === "/" && opts.bash !== true) continue;
1677
+ if (next === "." || next === ";") continue;
1678
+ if (!next) {
1679
+ value += "\\";
1680
+ push({
1681
+ type: "text",
1682
+ value
1683
+ });
1684
+ continue;
1685
+ }
1686
+ const match = /^\\+/.exec(remaining());
1687
+ let slashes = 0;
1688
+ if (match && match[0].length > 2) {
1689
+ slashes = match[0].length;
1690
+ state.index += slashes;
1691
+ if (slashes % 2 !== 0) value += "\\";
1692
+ }
1693
+ if (opts.unescape === true) value = advance();
1694
+ else value += advance();
1695
+ if (state.brackets === 0) {
1696
+ push({
1697
+ type: "text",
1698
+ value
1699
+ });
1700
+ continue;
1701
+ }
1702
+ }
1703
+ /**
1704
+ * If we're inside a regex character class, continue
1705
+ * until we reach the closing bracket.
1706
+ */
1707
+ if (state.brackets > 0 && (value !== "]" || prev.value === "[" || prev.value === "[^")) {
1708
+ if (opts.posix !== false && value === ":") {
1709
+ const inner = prev.value.slice(1);
1710
+ if (inner.includes("[")) {
1711
+ prev.posix = true;
1712
+ if (inner.includes(":")) {
1713
+ const idx = prev.value.lastIndexOf("[");
1714
+ const pre = prev.value.slice(0, idx);
1715
+ const posix = POSIX_REGEX_SOURCE[prev.value.slice(idx + 2)];
1716
+ if (posix) {
1717
+ prev.value = pre + posix;
1718
+ state.backtrack = true;
1719
+ advance();
1720
+ if (!bos.output && tokens.indexOf(prev) === 1) bos.output = ONE_CHAR;
1721
+ continue;
1722
+ }
1723
+ }
1724
+ }
1725
+ }
1726
+ if (value === "[" && peek() !== ":" || value === "-" && peek() === "]") value = `\\${value}`;
1727
+ if (value === "]" && (prev.value === "[" || prev.value === "[^")) value = `\\${value}`;
1728
+ if (opts.posix === true && value === "!" && prev.value === "[") value = "^";
1729
+ prev.value += value;
1730
+ append({ value });
1731
+ continue;
1732
+ }
1733
+ /**
1734
+ * If we're inside a quoted string, continue
1735
+ * until we reach the closing double quote.
1736
+ */
1737
+ if (state.quotes === 1 && value !== "\"") {
1738
+ value = utils.escapeRegex(value);
1739
+ prev.value += value;
1740
+ append({ value });
1741
+ continue;
1742
+ }
1743
+ /**
1744
+ * Double quotes
1745
+ */
1746
+ if (value === "\"") {
1747
+ state.quotes = state.quotes === 1 ? 0 : 1;
1748
+ if (opts.keepQuotes === true) push({
1749
+ type: "text",
1750
+ value
1751
+ });
1752
+ continue;
1753
+ }
1754
+ /**
1755
+ * Parentheses
1756
+ */
1757
+ if (value === "(") {
1758
+ increment("parens");
1759
+ push({
1760
+ type: "paren",
1761
+ value
1762
+ });
1763
+ continue;
1764
+ }
1765
+ if (value === ")") {
1766
+ if (state.parens === 0 && opts.strictBrackets === true) throw new SyntaxError(syntaxError("opening", "("));
1767
+ const extglob = extglobs[extglobs.length - 1];
1768
+ if (extglob && state.parens === extglob.parens + 1) {
1769
+ extglobClose(extglobs.pop());
1770
+ continue;
1771
+ }
1772
+ push({
1773
+ type: "paren",
1774
+ value,
1775
+ output: state.parens ? ")" : "\\)"
1776
+ });
1777
+ decrement("parens");
1778
+ continue;
1779
+ }
1780
+ /**
1781
+ * Square brackets
1782
+ */
1783
+ if (value === "[") {
1784
+ if (opts.nobracket === true || !remaining().includes("]")) {
1785
+ if (opts.nobracket !== true && opts.strictBrackets === true) throw new SyntaxError(syntaxError("closing", "]"));
1786
+ value = `\\${value}`;
1787
+ } else increment("brackets");
1788
+ push({
1789
+ type: "bracket",
1790
+ value
1791
+ });
1792
+ continue;
1793
+ }
1794
+ if (value === "]") {
1795
+ if (opts.nobracket === true || prev && prev.type === "bracket" && prev.value.length === 1) {
1796
+ push({
1797
+ type: "text",
1798
+ value,
1799
+ output: `\\${value}`
1800
+ });
1801
+ continue;
1802
+ }
1803
+ if (state.brackets === 0) {
1804
+ if (opts.strictBrackets === true) throw new SyntaxError(syntaxError("opening", "["));
1805
+ push({
1806
+ type: "text",
1807
+ value,
1808
+ output: `\\${value}`
1809
+ });
1810
+ continue;
1811
+ }
1812
+ decrement("brackets");
1813
+ const prevValue = prev.value.slice(1);
1814
+ if (prev.posix !== true && prevValue[0] === "^" && !prevValue.includes("/")) value = `/${value}`;
1815
+ prev.value += value;
1816
+ append({ value });
1817
+ if (opts.literalBrackets === false || utils.hasRegexChars(prevValue)) continue;
1818
+ const escaped = utils.escapeRegex(prev.value);
1819
+ state.output = state.output.slice(0, -prev.value.length);
1820
+ if (opts.literalBrackets === true) {
1821
+ state.output += escaped;
1822
+ prev.value = escaped;
1823
+ continue;
1824
+ }
1825
+ prev.value = `(${capture}${escaped}|${prev.value})`;
1826
+ state.output += prev.value;
1827
+ continue;
1828
+ }
1829
+ /**
1830
+ * Braces
1831
+ */
1832
+ if (value === "{" && opts.nobrace !== true) {
1833
+ increment("braces");
1834
+ const open = {
1835
+ type: "brace",
1836
+ value,
1837
+ output: "(",
1838
+ outputIndex: state.output.length,
1839
+ tokensIndex: state.tokens.length
1840
+ };
1841
+ braces.push(open);
1842
+ push(open);
1843
+ continue;
1844
+ }
1845
+ if (value === "}") {
1846
+ const brace = braces[braces.length - 1];
1847
+ if (opts.nobrace === true || !brace) {
1848
+ push({
1849
+ type: "text",
1850
+ value,
1851
+ output: value
1852
+ });
1853
+ continue;
1854
+ }
1855
+ let output = ")";
1856
+ if (brace.dots === true) {
1857
+ const arr = tokens.slice();
1858
+ const range = [];
1859
+ for (let i = arr.length - 1; i >= 0; i--) {
1860
+ tokens.pop();
1861
+ if (arr[i].type === "brace") break;
1862
+ if (arr[i].type !== "dots") range.unshift(arr[i].value);
1863
+ }
1864
+ output = expandRange(range, opts);
1865
+ state.backtrack = true;
1866
+ }
1867
+ if (brace.comma !== true && brace.dots !== true) {
1868
+ const out = state.output.slice(0, brace.outputIndex);
1869
+ const toks = state.tokens.slice(brace.tokensIndex);
1870
+ brace.value = brace.output = "\\{";
1871
+ value = output = "\\}";
1872
+ state.output = out;
1873
+ for (const t of toks) state.output += t.output || t.value;
1874
+ }
1875
+ push({
1876
+ type: "brace",
1877
+ value,
1878
+ output
1879
+ });
1880
+ decrement("braces");
1881
+ braces.pop();
1882
+ continue;
1883
+ }
1884
+ /**
1885
+ * Pipes
1886
+ */
1887
+ if (value === "|") {
1888
+ if (extglobs.length > 0) extglobs[extglobs.length - 1].conditions++;
1889
+ push({
1890
+ type: "text",
1891
+ value
1892
+ });
1893
+ continue;
1894
+ }
1895
+ /**
1896
+ * Commas
1897
+ */
1898
+ if (value === ",") {
1899
+ let output = value;
1900
+ const brace = braces[braces.length - 1];
1901
+ if (brace && stack[stack.length - 1] === "braces") {
1902
+ brace.comma = true;
1903
+ output = "|";
1904
+ }
1905
+ push({
1906
+ type: "comma",
1907
+ value,
1908
+ output
1909
+ });
1910
+ continue;
1911
+ }
1912
+ /**
1913
+ * Slashes
1914
+ */
1915
+ if (value === "/") {
1916
+ if (prev.type === "dot" && state.index === state.start + 1) {
1917
+ state.start = state.index + 1;
1918
+ state.consumed = "";
1919
+ state.output = "";
1920
+ tokens.pop();
1921
+ prev = bos;
1922
+ continue;
1923
+ }
1924
+ push({
1925
+ type: "slash",
1926
+ value,
1927
+ output: SLASH_LITERAL
1928
+ });
1929
+ continue;
1930
+ }
1931
+ /**
1932
+ * Dots
1933
+ */
1934
+ if (value === ".") {
1935
+ if (state.braces > 0 && prev.type === "dot") {
1936
+ if (prev.value === ".") prev.output = DOT_LITERAL;
1937
+ const brace = braces[braces.length - 1];
1938
+ prev.type = "dots";
1939
+ prev.output += value;
1940
+ prev.value += value;
1941
+ brace.dots = true;
1942
+ continue;
1943
+ }
1944
+ if (state.braces + state.parens === 0 && prev.type !== "bos" && prev.type !== "slash") {
1945
+ push({
1946
+ type: "text",
1947
+ value,
1948
+ output: DOT_LITERAL
1949
+ });
1950
+ continue;
1951
+ }
1952
+ push({
1953
+ type: "dot",
1954
+ value,
1955
+ output: DOT_LITERAL
1956
+ });
1957
+ continue;
1958
+ }
1959
+ /**
1960
+ * Question marks
1961
+ */
1962
+ if (value === "?") {
1963
+ if (!(prev && prev.value === "(") && opts.noextglob !== true && peek() === "(" && peek(2) !== "?") {
1964
+ extglobOpen("qmark", value);
1965
+ continue;
1966
+ }
1967
+ if (prev && prev.type === "paren") {
1968
+ const next = peek();
1969
+ let output = value;
1970
+ if (next === "<" && !utils.supportsLookbehinds()) throw new Error("Node.js v10 or higher is required for regex lookbehinds");
1971
+ if (prev.value === "(" && !/[!=<:]/.test(next) || next === "<" && !/<([!=]|\w+>)/.test(remaining())) output = `\\${value}`;
1972
+ push({
1973
+ type: "text",
1974
+ value,
1975
+ output
1976
+ });
1977
+ continue;
1978
+ }
1979
+ if (opts.dot !== true && (prev.type === "slash" || prev.type === "bos")) {
1980
+ push({
1981
+ type: "qmark",
1982
+ value,
1983
+ output: QMARK_NO_DOT
1984
+ });
1985
+ continue;
1986
+ }
1987
+ push({
1988
+ type: "qmark",
1989
+ value,
1990
+ output: QMARK
1991
+ });
1992
+ continue;
1993
+ }
1994
+ /**
1995
+ * Exclamation
1996
+ */
1997
+ if (value === "!") {
1998
+ if (opts.noextglob !== true && peek() === "(") {
1999
+ if (peek(2) !== "?" || !/[!=<:]/.test(peek(3))) {
2000
+ extglobOpen("negate", value);
2001
+ continue;
2002
+ }
2003
+ }
2004
+ if (opts.nonegate !== true && state.index === 0) {
2005
+ negate();
2006
+ continue;
2007
+ }
2008
+ }
2009
+ /**
2010
+ * Plus
2011
+ */
2012
+ if (value === "+") {
2013
+ if (opts.noextglob !== true && peek() === "(" && peek(2) !== "?") {
2014
+ extglobOpen("plus", value);
2015
+ continue;
2016
+ }
2017
+ if (prev && prev.value === "(" || opts.regex === false) {
2018
+ push({
2019
+ type: "plus",
2020
+ value,
2021
+ output: PLUS_LITERAL
2022
+ });
2023
+ continue;
2024
+ }
2025
+ if (prev && (prev.type === "bracket" || prev.type === "paren" || prev.type === "brace") || state.parens > 0) {
2026
+ push({
2027
+ type: "plus",
2028
+ value
2029
+ });
2030
+ continue;
2031
+ }
2032
+ push({
2033
+ type: "plus",
2034
+ value: PLUS_LITERAL
2035
+ });
2036
+ continue;
2037
+ }
2038
+ /**
2039
+ * Plain text
2040
+ */
2041
+ if (value === "@") {
2042
+ if (opts.noextglob !== true && peek() === "(" && peek(2) !== "?") {
2043
+ push({
2044
+ type: "at",
2045
+ extglob: true,
2046
+ value,
2047
+ output: ""
2048
+ });
2049
+ continue;
2050
+ }
2051
+ push({
2052
+ type: "text",
2053
+ value
2054
+ });
2055
+ continue;
2056
+ }
2057
+ /**
2058
+ * Plain text
2059
+ */
2060
+ if (value !== "*") {
2061
+ if (value === "$" || value === "^") value = `\\${value}`;
2062
+ const match = REGEX_NON_SPECIAL_CHARS.exec(remaining());
2063
+ if (match) {
2064
+ value += match[0];
2065
+ state.index += match[0].length;
2066
+ }
2067
+ push({
2068
+ type: "text",
2069
+ value
2070
+ });
2071
+ continue;
2072
+ }
2073
+ /**
2074
+ * Stars
2075
+ */
2076
+ if (prev && (prev.type === "globstar" || prev.star === true)) {
2077
+ prev.type = "star";
2078
+ prev.star = true;
2079
+ prev.value += value;
2080
+ prev.output = star;
2081
+ state.backtrack = true;
2082
+ state.globstar = true;
2083
+ consume(value);
2084
+ continue;
2085
+ }
2086
+ let rest = remaining();
2087
+ if (opts.noextglob !== true && /^\([^?]/.test(rest)) {
2088
+ extglobOpen("star", value);
2089
+ continue;
2090
+ }
2091
+ if (prev.type === "star") {
2092
+ if (opts.noglobstar === true) {
2093
+ consume(value);
2094
+ continue;
2095
+ }
2096
+ const prior = prev.prev;
2097
+ const before = prior.prev;
2098
+ const isStart = prior.type === "slash" || prior.type === "bos";
2099
+ const afterStar = before && (before.type === "star" || before.type === "globstar");
2100
+ if (opts.bash === true && (!isStart || rest[0] && rest[0] !== "/")) {
2101
+ push({
2102
+ type: "star",
2103
+ value,
2104
+ output: ""
2105
+ });
2106
+ continue;
2107
+ }
2108
+ const isBrace = state.braces > 0 && (prior.type === "comma" || prior.type === "brace");
2109
+ const isExtglob = extglobs.length && (prior.type === "pipe" || prior.type === "paren");
2110
+ if (!isStart && prior.type !== "paren" && !isBrace && !isExtglob) {
2111
+ push({
2112
+ type: "star",
2113
+ value,
2114
+ output: ""
2115
+ });
2116
+ continue;
2117
+ }
2118
+ while (rest.slice(0, 3) === "/**") {
2119
+ const after = input[state.index + 4];
2120
+ if (after && after !== "/") break;
2121
+ rest = rest.slice(3);
2122
+ consume("/**", 3);
2123
+ }
2124
+ if (prior.type === "bos" && eos()) {
2125
+ prev.type = "globstar";
2126
+ prev.value += value;
2127
+ prev.output = globstar(opts);
2128
+ state.output = prev.output;
2129
+ state.globstar = true;
2130
+ consume(value);
2131
+ continue;
2132
+ }
2133
+ if (prior.type === "slash" && prior.prev.type !== "bos" && !afterStar && eos()) {
2134
+ state.output = state.output.slice(0, -(prior.output + prev.output).length);
2135
+ prior.output = `(?:${prior.output}`;
2136
+ prev.type = "globstar";
2137
+ prev.output = globstar(opts) + (opts.strictSlashes ? ")" : "|$)");
2138
+ prev.value += value;
2139
+ state.globstar = true;
2140
+ state.output += prior.output + prev.output;
2141
+ consume(value);
2142
+ continue;
2143
+ }
2144
+ if (prior.type === "slash" && prior.prev.type !== "bos" && rest[0] === "/") {
2145
+ const end = rest[1] !== void 0 ? "|$" : "";
2146
+ state.output = state.output.slice(0, -(prior.output + prev.output).length);
2147
+ prior.output = `(?:${prior.output}`;
2148
+ prev.type = "globstar";
2149
+ prev.output = `${globstar(opts)}${SLASH_LITERAL}|${SLASH_LITERAL}${end})`;
2150
+ prev.value += value;
2151
+ state.output += prior.output + prev.output;
2152
+ state.globstar = true;
2153
+ consume(value + advance());
2154
+ push({
2155
+ type: "slash",
2156
+ value: "/",
2157
+ output: ""
2158
+ });
2159
+ continue;
2160
+ }
2161
+ if (prior.type === "bos" && rest[0] === "/") {
2162
+ prev.type = "globstar";
2163
+ prev.value += value;
2164
+ prev.output = `(?:^|${SLASH_LITERAL}|${globstar(opts)}${SLASH_LITERAL})`;
2165
+ state.output = prev.output;
2166
+ state.globstar = true;
2167
+ consume(value + advance());
2168
+ push({
2169
+ type: "slash",
2170
+ value: "/",
2171
+ output: ""
2172
+ });
2173
+ continue;
2174
+ }
2175
+ state.output = state.output.slice(0, -prev.output.length);
2176
+ prev.type = "globstar";
2177
+ prev.output = globstar(opts);
2178
+ prev.value += value;
2179
+ state.output += prev.output;
2180
+ state.globstar = true;
2181
+ consume(value);
2182
+ continue;
2183
+ }
2184
+ const token = {
2185
+ type: "star",
2186
+ value,
2187
+ output: star
2188
+ };
2189
+ if (opts.bash === true) {
2190
+ token.output = ".*?";
2191
+ if (prev.type === "bos" || prev.type === "slash") token.output = nodot + token.output;
2192
+ push(token);
2193
+ continue;
2194
+ }
2195
+ if (prev && (prev.type === "bracket" || prev.type === "paren") && opts.regex === true) {
2196
+ token.output = value;
2197
+ push(token);
2198
+ continue;
2199
+ }
2200
+ if (state.index === state.start || prev.type === "slash" || prev.type === "dot") {
2201
+ if (prev.type === "dot") {
2202
+ state.output += NO_DOT_SLASH;
2203
+ prev.output += NO_DOT_SLASH;
2204
+ } else if (opts.dot === true) {
2205
+ state.output += NO_DOTS_SLASH;
2206
+ prev.output += NO_DOTS_SLASH;
2207
+ } else {
2208
+ state.output += nodot;
2209
+ prev.output += nodot;
2210
+ }
2211
+ if (peek() !== "*") {
2212
+ state.output += ONE_CHAR;
2213
+ prev.output += ONE_CHAR;
2214
+ }
2215
+ }
2216
+ push(token);
2217
+ }
2218
+ while (state.brackets > 0) {
2219
+ if (opts.strictBrackets === true) throw new SyntaxError(syntaxError("closing", "]"));
2220
+ state.output = utils.escapeLast(state.output, "[");
2221
+ decrement("brackets");
2222
+ }
2223
+ while (state.parens > 0) {
2224
+ if (opts.strictBrackets === true) throw new SyntaxError(syntaxError("closing", ")"));
2225
+ state.output = utils.escapeLast(state.output, "(");
2226
+ decrement("parens");
2227
+ }
2228
+ while (state.braces > 0) {
2229
+ if (opts.strictBrackets === true) throw new SyntaxError(syntaxError("closing", "}"));
2230
+ state.output = utils.escapeLast(state.output, "{");
2231
+ decrement("braces");
2232
+ }
2233
+ if (opts.strictSlashes !== true && (prev.type === "star" || prev.type === "bracket")) push({
2234
+ type: "maybe_slash",
2235
+ value: "",
2236
+ output: `${SLASH_LITERAL}?`
2237
+ });
2238
+ if (state.backtrack === true) {
2239
+ state.output = "";
2240
+ for (const token of state.tokens) {
2241
+ state.output += token.output != null ? token.output : token.value;
2242
+ if (token.suffix) state.output += token.suffix;
2243
+ }
2244
+ }
2245
+ return state;
2246
+ };
2247
+ /**
2248
+ * Fast paths for creating regular expressions for common glob patterns.
2249
+ * This can significantly speed up processing and has very little downside
2250
+ * impact when none of the fast paths match.
2251
+ */
2252
+ parse.fastpaths = (input, options) => {
2253
+ const opts = { ...options };
2254
+ const max = typeof opts.maxLength === "number" ? Math.min(MAX_LENGTH, opts.maxLength) : MAX_LENGTH;
2255
+ const len = input.length;
2256
+ if (len > max) throw new SyntaxError(`Input length: ${len}, exceeds maximum allowed length: ${max}`);
2257
+ input = REPLACEMENTS[input] || input;
2258
+ const win32 = utils.isWindows(options);
2259
+ const { DOT_LITERAL, SLASH_LITERAL, ONE_CHAR, DOTS_SLASH, NO_DOT, NO_DOTS, NO_DOTS_SLASH, STAR, START_ANCHOR } = constants.globChars(win32);
2260
+ const nodot = opts.dot ? NO_DOTS : NO_DOT;
2261
+ const slashDot = opts.dot ? NO_DOTS_SLASH : NO_DOT;
2262
+ const capture = opts.capture ? "" : "?:";
2263
+ const state = {
2264
+ negated: false,
2265
+ prefix: ""
2266
+ };
2267
+ let star = opts.bash === true ? ".*?" : STAR;
2268
+ if (opts.capture) star = `(${star})`;
2269
+ const globstar = (opts) => {
2270
+ if (opts.noglobstar === true) return star;
2271
+ return `(${capture}(?:(?!${START_ANCHOR}${opts.dot ? DOTS_SLASH : DOT_LITERAL}).)*?)`;
2272
+ };
2273
+ const create = (str) => {
2274
+ switch (str) {
2275
+ case "*": return `${nodot}${ONE_CHAR}${star}`;
2276
+ case ".*": return `${DOT_LITERAL}${ONE_CHAR}${star}`;
2277
+ case "*.*": return `${nodot}${star}${DOT_LITERAL}${ONE_CHAR}${star}`;
2278
+ case "*/*": return `${nodot}${star}${SLASH_LITERAL}${ONE_CHAR}${slashDot}${star}`;
2279
+ case "**": return nodot + globstar(opts);
2280
+ case "**/*": return `(?:${nodot}${globstar(opts)}${SLASH_LITERAL})?${slashDot}${ONE_CHAR}${star}`;
2281
+ case "**/*.*": return `(?:${nodot}${globstar(opts)}${SLASH_LITERAL})?${slashDot}${star}${DOT_LITERAL}${ONE_CHAR}${star}`;
2282
+ case "**/.*": return `(?:${nodot}${globstar(opts)}${SLASH_LITERAL})?${DOT_LITERAL}${ONE_CHAR}${star}`;
2283
+ default: {
2284
+ const match = /^(.*?)\.(\w+)$/.exec(str);
2285
+ if (!match) return;
2286
+ const source = create(match[1]);
2287
+ if (!source) return;
2288
+ return source + DOT_LITERAL + match[2];
2289
+ }
2290
+ }
2291
+ };
2292
+ let source = create(utils.removePrefix(input, state));
2293
+ if (source && opts.strictSlashes !== true) source += `${SLASH_LITERAL}?`;
2294
+ return source;
2295
+ };
2296
+ module.exports = parse;
2297
+ }));
2298
+ //#endregion
2299
+ //#region ../../node_modules/.pnpm/picomatch@2.3.1/node_modules/picomatch/lib/picomatch.js
2300
+ var require_picomatch$1 = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
2301
+ const path$1 = __require("path");
2302
+ const scan = require_scan();
2303
+ const parse = require_parse();
2304
+ const utils = require_utils();
2305
+ const constants = require_constants();
2306
+ const isObject = (val) => val && typeof val === "object" && !Array.isArray(val);
2307
+ /**
2308
+ * Creates a matcher function from one or more glob patterns. The
2309
+ * returned function takes a string to match as its first argument,
2310
+ * and returns true if the string is a match. The returned matcher
2311
+ * function also takes a boolean as the second argument that, when true,
2312
+ * returns an object with additional information.
2313
+ *
2314
+ * ```js
2315
+ * const picomatch = require('picomatch');
2316
+ * // picomatch(glob[, options]);
2317
+ *
2318
+ * const isMatch = picomatch('*.!(*a)');
2319
+ * console.log(isMatch('a.a')); //=> false
2320
+ * console.log(isMatch('a.b')); //=> true
2321
+ * ```
2322
+ * @name picomatch
2323
+ * @param {String|Array} `globs` One or more glob patterns.
2324
+ * @param {Object=} `options`
2325
+ * @return {Function=} Returns a matcher function.
2326
+ * @api public
2327
+ */
2328
+ const picomatch = (glob, options, returnState = false) => {
2329
+ if (Array.isArray(glob)) {
2330
+ const fns = glob.map((input) => picomatch(input, options, returnState));
2331
+ const arrayMatcher = (str) => {
2332
+ for (const isMatch of fns) {
2333
+ const state = isMatch(str);
2334
+ if (state) return state;
2335
+ }
2336
+ return false;
2337
+ };
2338
+ return arrayMatcher;
2339
+ }
2340
+ const isState = isObject(glob) && glob.tokens && glob.input;
2341
+ if (glob === "" || typeof glob !== "string" && !isState) throw new TypeError("Expected pattern to be a non-empty string");
2342
+ const opts = options || {};
2343
+ const posix = utils.isWindows(options);
2344
+ const regex = isState ? picomatch.compileRe(glob, options) : picomatch.makeRe(glob, options, false, true);
2345
+ const state = regex.state;
2346
+ delete regex.state;
2347
+ let isIgnored = () => false;
2348
+ if (opts.ignore) {
2349
+ const ignoreOpts = {
2350
+ ...options,
2351
+ ignore: null,
2352
+ onMatch: null,
2353
+ onResult: null
2354
+ };
2355
+ isIgnored = picomatch(opts.ignore, ignoreOpts, returnState);
2356
+ }
2357
+ const matcher = (input, returnObject = false) => {
2358
+ const { isMatch, match, output } = picomatch.test(input, regex, options, {
2359
+ glob,
2360
+ posix
2361
+ });
2362
+ const result = {
2363
+ glob,
2364
+ state,
2365
+ regex,
2366
+ posix,
2367
+ input,
2368
+ output,
2369
+ match,
2370
+ isMatch
2371
+ };
2372
+ if (typeof opts.onResult === "function") opts.onResult(result);
2373
+ if (isMatch === false) {
2374
+ result.isMatch = false;
2375
+ return returnObject ? result : false;
2376
+ }
2377
+ if (isIgnored(input)) {
2378
+ if (typeof opts.onIgnore === "function") opts.onIgnore(result);
2379
+ result.isMatch = false;
2380
+ return returnObject ? result : false;
2381
+ }
2382
+ if (typeof opts.onMatch === "function") opts.onMatch(result);
2383
+ return returnObject ? result : true;
2384
+ };
2385
+ if (returnState) matcher.state = state;
2386
+ return matcher;
2387
+ };
2388
+ /**
2389
+ * Test `input` with the given `regex`. This is used by the main
2390
+ * `picomatch()` function to test the input string.
2391
+ *
2392
+ * ```js
2393
+ * const picomatch = require('picomatch');
2394
+ * // picomatch.test(input, regex[, options]);
2395
+ *
2396
+ * console.log(picomatch.test('foo/bar', /^(?:([^/]*?)\/([^/]*?))$/));
2397
+ * // { isMatch: true, match: [ 'foo/', 'foo', 'bar' ], output: 'foo/bar' }
2398
+ * ```
2399
+ * @param {String} `input` String to test.
2400
+ * @param {RegExp} `regex`
2401
+ * @return {Object} Returns an object with matching info.
2402
+ * @api public
2403
+ */
2404
+ picomatch.test = (input, regex, options, { glob, posix } = {}) => {
2405
+ if (typeof input !== "string") throw new TypeError("Expected input to be a string");
2406
+ if (input === "") return {
2407
+ isMatch: false,
2408
+ output: ""
2409
+ };
2410
+ const opts = options || {};
2411
+ const format = opts.format || (posix ? utils.toPosixSlashes : null);
2412
+ let match = input === glob;
2413
+ let output = match && format ? format(input) : input;
2414
+ if (match === false) {
2415
+ output = format ? format(input) : input;
2416
+ match = output === glob;
2417
+ }
2418
+ if (match === false || opts.capture === true) if (opts.matchBase === true || opts.basename === true) match = picomatch.matchBase(input, regex, options, posix);
2419
+ else match = regex.exec(output);
2420
+ return {
2421
+ isMatch: Boolean(match),
2422
+ match,
2423
+ output
2424
+ };
2425
+ };
2426
+ /**
2427
+ * Match the basename of a filepath.
2428
+ *
2429
+ * ```js
2430
+ * const picomatch = require('picomatch');
2431
+ * // picomatch.matchBase(input, glob[, options]);
2432
+ * console.log(picomatch.matchBase('foo/bar.js', '*.js'); // true
2433
+ * ```
2434
+ * @param {String} `input` String to test.
2435
+ * @param {RegExp|String} `glob` Glob pattern or regex created by [.makeRe](#makeRe).
2436
+ * @return {Boolean}
2437
+ * @api public
2438
+ */
2439
+ picomatch.matchBase = (input, glob, options, posix = utils.isWindows(options)) => {
2440
+ return (glob instanceof RegExp ? glob : picomatch.makeRe(glob, options)).test(path$1.basename(input));
2441
+ };
2442
+ /**
2443
+ * Returns true if **any** of the given glob `patterns` match the specified `string`.
2444
+ *
2445
+ * ```js
2446
+ * const picomatch = require('picomatch');
2447
+ * // picomatch.isMatch(string, patterns[, options]);
2448
+ *
2449
+ * console.log(picomatch.isMatch('a.a', ['b.*', '*.a'])); //=> true
2450
+ * console.log(picomatch.isMatch('a.a', 'b.*')); //=> false
2451
+ * ```
2452
+ * @param {String|Array} str The string to test.
2453
+ * @param {String|Array} patterns One or more glob patterns to use for matching.
2454
+ * @param {Object} [options] See available [options](#options).
2455
+ * @return {Boolean} Returns true if any patterns match `str`
2456
+ * @api public
2457
+ */
2458
+ picomatch.isMatch = (str, patterns, options) => picomatch(patterns, options)(str);
2459
+ /**
2460
+ * Parse a glob pattern to create the source string for a regular
2461
+ * expression.
2462
+ *
2463
+ * ```js
2464
+ * const picomatch = require('picomatch');
2465
+ * const result = picomatch.parse(pattern[, options]);
2466
+ * ```
2467
+ * @param {String} `pattern`
2468
+ * @param {Object} `options`
2469
+ * @return {Object} Returns an object with useful properties and output to be used as a regex source string.
2470
+ * @api public
2471
+ */
2472
+ picomatch.parse = (pattern, options) => {
2473
+ if (Array.isArray(pattern)) return pattern.map((p) => picomatch.parse(p, options));
2474
+ return parse(pattern, {
2475
+ ...options,
2476
+ fastpaths: false
2477
+ });
2478
+ };
2479
+ /**
2480
+ * Scan a glob pattern to separate the pattern into segments.
2481
+ *
2482
+ * ```js
2483
+ * const picomatch = require('picomatch');
2484
+ * // picomatch.scan(input[, options]);
2485
+ *
2486
+ * const result = picomatch.scan('!./foo/*.js');
2487
+ * console.log(result);
2488
+ * { prefix: '!./',
2489
+ * input: '!./foo/*.js',
2490
+ * start: 3,
2491
+ * base: 'foo',
2492
+ * glob: '*.js',
2493
+ * isBrace: false,
2494
+ * isBracket: false,
2495
+ * isGlob: true,
2496
+ * isExtglob: false,
2497
+ * isGlobstar: false,
2498
+ * negated: true }
2499
+ * ```
2500
+ * @param {String} `input` Glob pattern to scan.
2501
+ * @param {Object} `options`
2502
+ * @return {Object} Returns an object with
2503
+ * @api public
2504
+ */
2505
+ picomatch.scan = (input, options) => scan(input, options);
2506
+ /**
2507
+ * Compile a regular expression from the `state` object returned by the
2508
+ * [parse()](#parse) method.
2509
+ *
2510
+ * @param {Object} `state`
2511
+ * @param {Object} `options`
2512
+ * @param {Boolean} `returnOutput` Intended for implementors, this argument allows you to return the raw output from the parser.
2513
+ * @param {Boolean} `returnState` Adds the state to a `state` property on the returned regex. Useful for implementors and debugging.
2514
+ * @return {RegExp}
2515
+ * @api public
2516
+ */
2517
+ picomatch.compileRe = (state, options, returnOutput = false, returnState = false) => {
2518
+ if (returnOutput === true) return state.output;
2519
+ const opts = options || {};
2520
+ const prepend = opts.contains ? "" : "^";
2521
+ const append = opts.contains ? "" : "$";
2522
+ let source = `${prepend}(?:${state.output})${append}`;
2523
+ if (state && state.negated === true) source = `^(?!${source}).*$`;
2524
+ const regex = picomatch.toRegex(source, options);
2525
+ if (returnState === true) regex.state = state;
2526
+ return regex;
2527
+ };
2528
+ /**
2529
+ * Create a regular expression from a parsed glob pattern.
2530
+ *
2531
+ * ```js
2532
+ * const picomatch = require('picomatch');
2533
+ * const state = picomatch.parse('*.js');
2534
+ * // picomatch.compileRe(state[, options]);
2535
+ *
2536
+ * console.log(picomatch.compileRe(state));
2537
+ * //=> /^(?:(?!\.)(?=.)[^/]*?\.js)$/
2538
+ * ```
2539
+ * @param {String} `state` The object returned from the `.parse` method.
2540
+ * @param {Object} `options`
2541
+ * @param {Boolean} `returnOutput` Implementors may use this argument to return the compiled output, instead of a regular expression. This is not exposed on the options to prevent end-users from mutating the result.
2542
+ * @param {Boolean} `returnState` Implementors may use this argument to return the state from the parsed glob with the returned regular expression.
2543
+ * @return {RegExp} Returns a regex created from the given pattern.
2544
+ * @api public
2545
+ */
2546
+ picomatch.makeRe = (input, options = {}, returnOutput = false, returnState = false) => {
2547
+ if (!input || typeof input !== "string") throw new TypeError("Expected a non-empty string");
2548
+ let parsed = {
2549
+ negated: false,
2550
+ fastpaths: true
2551
+ };
2552
+ if (options.fastpaths !== false && (input[0] === "." || input[0] === "*")) parsed.output = parse.fastpaths(input, options);
2553
+ if (!parsed.output) parsed = parse(input, options);
2554
+ return picomatch.compileRe(parsed, options, returnOutput, returnState);
2555
+ };
2556
+ /**
2557
+ * Create a regular expression from the given regex source string.
2558
+ *
2559
+ * ```js
2560
+ * const picomatch = require('picomatch');
2561
+ * // picomatch.toRegex(source[, options]);
2562
+ *
2563
+ * const { output } = picomatch.parse('*.js');
2564
+ * console.log(picomatch.toRegex(output));
2565
+ * //=> /^(?:(?!\.)(?=.)[^/]*?\.js)$/
2566
+ * ```
2567
+ * @param {String} `source` Regular expression source string.
2568
+ * @param {Object} `options`
2569
+ * @return {RegExp}
2570
+ * @api public
2571
+ */
2572
+ picomatch.toRegex = (source, options) => {
2573
+ try {
2574
+ const opts = options || {};
2575
+ return new RegExp(source, opts.flags || (opts.nocase ? "i" : ""));
2576
+ } catch (err) {
2577
+ if (options && options.debug === true) throw err;
2578
+ return /$^/;
2579
+ }
2580
+ };
2581
+ /**
2582
+ * Picomatch constants.
2583
+ * @return {Object}
2584
+ */
2585
+ picomatch.constants = constants;
2586
+ /**
2587
+ * Expose "picomatch"
2588
+ */
2589
+ module.exports = picomatch;
2590
+ }));
2591
+ //#endregion
917
2592
  //#region ../core/dist/index.js
2593
+ var import_picomatch = /* @__PURE__ */ __toESM$1((/* @__PURE__ */ __commonJSMin$1(((exports, module) => {
2594
+ module.exports = require_picomatch$1();
2595
+ })))(), 1);
918
2596
  var __create = Object.create;
919
2597
  var __defProp = Object.defineProperty;
920
2598
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
@@ -936,30 +2614,59 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
936
2614
  value: mod,
937
2615
  enumerable: true
938
2616
  }) : target, mod));
939
- const REGEX_SPECIAL_CHARACTERS = /[.+^${}()|[\]\\]/g;
940
- const compileGlobPattern = (pattern) => {
941
- const normalizedPattern = pattern.replace(/\\/g, "/").replace(/^\//, "");
942
- let regexSource = "^";
943
- let characterIndex = 0;
944
- while (characterIndex < normalizedPattern.length) if (normalizedPattern[characterIndex] === "*" && normalizedPattern[characterIndex + 1] === "*") if (normalizedPattern[characterIndex + 2] === "/") {
945
- regexSource += "(?:.+/)?";
946
- characterIndex += 3;
947
- } else {
948
- regexSource += ".*";
949
- characterIndex += 2;
950
- }
951
- else if (normalizedPattern[characterIndex] === "*") {
952
- regexSource += "[^/]*";
953
- characterIndex++;
954
- } else if (normalizedPattern[characterIndex] === "?") {
955
- regexSource += "[^/]";
956
- characterIndex++;
957
- } else {
958
- regexSource += normalizedPattern[characterIndex].replace(REGEX_SPECIAL_CHARACTERS, "\\$&");
959
- characterIndex++;
2617
+ const JSX_FILE_PATTERN = /\.(tsx|jsx)$/;
2618
+ const MILLISECONDS_PER_SECOND = 1e3;
2619
+ const SCORE_API_URL = "https://www.react.doctor/api/score";
2620
+ const SHARE_BASE_URL = "https://www.react.doctor/share";
2621
+ const FETCH_TIMEOUT_MS = 1e4;
2622
+ const DEFAULT_BRANCH_CANDIDATES = ["main", "master"];
2623
+ const ADOPTABLE_LINT_CONFIG_FILENAMES = [".oxlintrc.json", ".eslintrc.json"];
2624
+ const OXLINT_NODE_REQUIREMENT = "^20.19.0 || >=22.12.0";
2625
+ const GIT_SHOW_MAX_BUFFER_BYTES = 10 * 1024 * 1024;
2626
+ const CANONICAL_GITHUB_URL = "https://github.com/millionco/react-doctor";
2627
+ const SKILL_NAME = "react-doctor";
2628
+ const OXLINT_OUTPUT_MAX_BYTES = 50 * 1024 * 1024;
2629
+ const MAX_GLOB_PATTERN_LENGTH_CHARS = 1024;
2630
+ var InvalidGlobPatternError = class extends Error {
2631
+ pattern;
2632
+ reason;
2633
+ constructor(pattern, reason) {
2634
+ super(`Invalid glob pattern ${JSON.stringify(pattern)}: ${reason}`);
2635
+ this.name = "InvalidGlobPatternError";
2636
+ this.pattern = pattern;
2637
+ this.reason = reason;
2638
+ }
2639
+ };
2640
+ const assertGlobPattern = (condition, pattern, reason) => {
2641
+ if (!condition) throw new InvalidGlobPatternError(pattern, reason);
2642
+ };
2643
+ const countGlobWildcards = (pattern) => (pattern.match(/[*?]/g) ?? []).length;
2644
+ const normalizeGlobPattern = (pattern) => pattern.replace(/\\/g, "/").replace(/^\//, "");
2645
+ const PICOMATCH_OPTIONS = {
2646
+ dot: true,
2647
+ strictSlashes: false,
2648
+ windows: false
2649
+ };
2650
+ const compileGlobPattern = (rawPattern) => {
2651
+ assertGlobPattern(typeof rawPattern === "string" && rawPattern.length > 0, String(rawPattern), "pattern must be a non-empty string.");
2652
+ assertGlobPattern(rawPattern.length <= MAX_GLOB_PATTERN_LENGTH_CHARS, rawPattern, `pattern length ${rawPattern.length} exceeds the maximum of ${MAX_GLOB_PATTERN_LENGTH_CHARS} characters.`);
2653
+ const wildcardCount = countGlobWildcards(rawPattern);
2654
+ assertGlobPattern(wildcardCount <= 24, rawPattern, `pattern uses ${wildcardCount} wildcards (\`*\` / \`?\`), exceeding the maximum of 24. This guards against catastrophic backtracking from pathological patterns; split the pattern into multiple smaller entries.`);
2655
+ try {
2656
+ return import_picomatch.default.makeRe(normalizeGlobPattern(rawPattern), PICOMATCH_OPTIONS);
2657
+ } catch (caughtError) {
2658
+ throw new InvalidGlobPatternError(rawPattern, caughtError instanceof Error ? caughtError.message : String(caughtError));
960
2659
  }
961
- regexSource += "$";
962
- return new RegExp(regexSource);
2660
+ };
2661
+ const compileGlobPatternsLenient = (patterns, onInvalid) => {
2662
+ const compiled = [];
2663
+ for (const pattern of patterns) try {
2664
+ compiled.push(compileGlobPattern(pattern));
2665
+ } catch (caughtError) {
2666
+ if (!(caughtError instanceof InvalidGlobPatternError)) throw caughtError;
2667
+ onInvalid(caughtError);
2668
+ }
2669
+ return compiled;
963
2670
  };
964
2671
  const toRelativePath = (filePath, rootDirectory) => {
965
2672
  const normalizedFilePath = filePath.replace(/\\/g, "/");
@@ -967,22 +2674,22 @@ const toRelativePath = (filePath, rootDirectory) => {
967
2674
  if (normalizedFilePath.startsWith(normalizedRoot)) return normalizedFilePath.slice(normalizedRoot.length);
968
2675
  return normalizedFilePath.replace(/^\.\//, "");
969
2676
  };
970
- const warnConfigField$1 = (message) => {
2677
+ const warnConfigIssue = (message) => {
971
2678
  process.stderr.write(`[react-doctor] ${message}\n`);
972
2679
  };
973
2680
  const isStringArray = (value) => Array.isArray(value) && value.every((entry) => typeof entry === "string");
974
2681
  const collectStringList = (value) => Array.isArray(value) ? value.filter((entry) => typeof entry === "string") : [];
975
2682
  const validateOverrideEntry = (entry, index) => {
976
2683
  if (!isPlainObject(entry)) {
977
- warnConfigField$1(`ignore.overrides[${index}] must be an object with { files, rules }; ignoring this entry.`);
2684
+ warnConfigIssue(`ignore.overrides[${index}] must be an object with { files, rules }; ignoring this entry.`);
978
2685
  return null;
979
2686
  }
980
2687
  if (!isStringArray(entry.files)) {
981
- warnConfigField$1(`ignore.overrides[${index}].files must be an array of strings; ignoring this entry.`);
2688
+ warnConfigIssue(`ignore.overrides[${index}].files must be an array of strings; ignoring this entry.`);
982
2689
  return null;
983
2690
  }
984
2691
  if (entry.rules !== void 0 && !isStringArray(entry.rules)) {
985
- warnConfigField$1(`ignore.overrides[${index}].rules must be an array of "plugin/rule" strings or omitted; treating as missing (override would suppress every rule for the matched files).`);
2692
+ warnConfigIssue(`ignore.overrides[${index}].rules must be an array of "plugin/rule" strings or omitted; treating as missing (override would suppress every rule for the matched files).`);
986
2693
  return { files: entry.files };
987
2694
  }
988
2695
  return entry.rules === void 0 ? { files: entry.files } : {
@@ -994,13 +2701,13 @@ const compileIgnoreOverrides = (userConfig) => {
994
2701
  const overrides = userConfig?.ignore?.overrides;
995
2702
  if (overrides === void 0) return [];
996
2703
  if (!Array.isArray(overrides)) {
997
- warnConfigField$1(`ignore.overrides must be an array of { files, rules } entries; ignoring.`);
2704
+ warnConfigIssue(`ignore.overrides must be an array of { files, rules } entries; ignoring.`);
998
2705
  return [];
999
2706
  }
1000
2707
  return overrides.flatMap((entry, index) => {
1001
2708
  const validated = validateOverrideEntry(entry, index);
1002
2709
  if (!validated) return [];
1003
- const filePatterns = collectStringList(validated.files).map(compileGlobPattern);
2710
+ const filePatterns = compileGlobPatternsLenient(collectStringList(validated.files), (error) => warnConfigIssue(`ignore.overrides[${index}]: ${error.message}`));
1004
2711
  if (filePatterns.length === 0) return [];
1005
2712
  return [{
1006
2713
  filePatterns,
@@ -1014,18 +2721,94 @@ const isDiagnosticIgnoredByOverrides = (diagnostic, rootDirectory, overrides) =>
1014
2721
  const ruleIdentifier = `${diagnostic.plugin}/${diagnostic.rule}`;
1015
2722
  return overrides.some((override) => override.filePatterns.some((pattern) => pattern.test(relativeFilePath)) && (override.ruleIds.size === 0 || override.ruleIds.has(ruleIdentifier)));
1016
2723
  };
1017
- const JSX_FILE_PATTERN = /\.(tsx|jsx)$/;
1018
- const MILLISECONDS_PER_SECOND = 1e3;
1019
- const SCORE_API_URL = "https://www.react.doctor/api/score";
1020
- const SHARE_BASE_URL = "https://www.react.doctor/share";
1021
- const FETCH_TIMEOUT_MS = 1e4;
1022
- const DEFAULT_BRANCH_CANDIDATES = ["main", "master"];
1023
- const ADOPTABLE_LINT_CONFIG_FILENAMES = [".oxlintrc.json", ".eslintrc.json"];
1024
- const OXLINT_NODE_REQUIREMENT = "^20.19.0 || >=22.12.0";
1025
- const GIT_SHOW_MAX_BUFFER_BYTES = 10 * 1024 * 1024;
1026
- const CANONICAL_GITHUB_URL = "https://github.com/millionco/react-doctor";
1027
- const SKILL_NAME = "react-doctor";
1028
- const OXLINT_OUTPUT_MAX_BYTES = 50 * 1024 * 1024;
2724
+ /**
2725
+ * Assembles the internal `RuleSeverityControls` shape from a user
2726
+ * config's top-level `rules` and `categories` fields — the
2727
+ * ESLint / oxlint-shaped severity surface.
2728
+ *
2729
+ * Returns `undefined` when neither field is present so the common
2730
+ * path (no severity config at all) stays allocation-free for
2731
+ * downstream consumers.
2732
+ */
2733
+ const buildRuleSeverityControls = (config) => {
2734
+ if (!config) return void 0;
2735
+ if (config.rules === void 0 && config.categories === void 0) return void 0;
2736
+ return {
2737
+ ...config.rules !== void 0 ? { rules: config.rules } : {},
2738
+ ...config.categories !== void 0 ? { categories: config.categories } : {}
2739
+ };
2740
+ };
2741
+ /**
2742
+ * Projects a diagnostic onto the three axes rule-targeted controls
2743
+ * reason about:
2744
+ *
2745
+ * - `ruleKey` — the fully-qualified `"<plugin>/<rule>"` form users
2746
+ * put in config files (consumed by top-level `rules` severity and
2747
+ * `surfaces.*.{include,exclude}Rules`).
2748
+ * - `category` — the diagnostic's category label (consumed by
2749
+ * top-level `categories` severity and
2750
+ * `surfaces.*.{include,exclude}Categories`).
2751
+ * - `tags` — behavioral tags from the rule registry (consumed by
2752
+ * `ignore.tags` and `surfaces.*.{include,exclude}Tags`). Empty
2753
+ * for non-`react-doctor` plugins.
2754
+ */
2755
+ const getDiagnosticRuleIdentity = (diagnostic) => ({
2756
+ ruleKey: `${diagnostic.plugin}/${diagnostic.rule}`,
2757
+ category: diagnostic.category,
2758
+ tags: diagnostic.plugin === "react-doctor" ? reactDoctorPlugin.rules[diagnostic.rule]?.tags ?? [] : []
2759
+ });
2760
+ /**
2761
+ * Resolves the user-configured severity override for a rule.
2762
+ * Per-rule overrides win over per-category overrides. Returns
2763
+ * `undefined` when neither channel matches — callers should fall
2764
+ * back to the rule's built-in severity.
2765
+ */
2766
+ const resolveRuleSeverityOverride = (input, controls) => {
2767
+ if (!controls) return void 0;
2768
+ return controls.rules?.[input.ruleKey] ?? (input.category !== void 0 ? controls.categories?.[input.category] : void 0);
2769
+ };
2770
+ const SEVERITY_FOR_OVERRIDE = {
2771
+ error: "error",
2772
+ warn: "warning"
2773
+ };
2774
+ const restampSeverity = (diagnostic, override) => {
2775
+ const targetSeverity = SEVERITY_FOR_OVERRIDE[override];
2776
+ if (diagnostic.severity === targetSeverity) return diagnostic;
2777
+ return {
2778
+ ...diagnostic,
2779
+ severity: targetSeverity
2780
+ };
2781
+ };
2782
+ /**
2783
+ * Applies the user's top-level `rules` / `categories` / `tags`
2784
+ * severity config to a post-lint diagnostic list:
2785
+ *
2786
+ * - `"off"` drops the diagnostic entirely. For react-doctor rules
2787
+ * this also happens at lint-registration time; this post-filter
2788
+ * covers external plugins (`react/*`, `jsx-a11y/*`, custom adopted
2789
+ * configs) whose severities the lint config can't reach.
2790
+ * - `"warn"` / `"error"` re-stamps `diagnostic.severity` so downstream
2791
+ * consumers — `--fail-on`, the score input, the CLI summary — see
2792
+ * the user-chosen severity rather than the rule's built-in one.
2793
+ *
2794
+ * Returns the input array by identity when no controls are configured
2795
+ * so the common path stays allocation-free.
2796
+ */
2797
+ const applySeverityControls = (diagnostics, config) => {
2798
+ const controls = buildRuleSeverityControls(config);
2799
+ if (!controls) return diagnostics;
2800
+ const adjusted = [];
2801
+ for (const diagnostic of diagnostics) {
2802
+ const { ruleKey, category } = getDiagnosticRuleIdentity(diagnostic);
2803
+ const override = resolveRuleSeverityOverride({
2804
+ ruleKey,
2805
+ category
2806
+ }, controls);
2807
+ if (override === "off") continue;
2808
+ adjusted.push(override === void 0 ? diagnostic : restampSeverity(diagnostic, override));
2809
+ }
2810
+ return adjusted;
2811
+ };
1029
2812
  const estimateArgsLength = (args) => args.reduce((total, argument) => total + argument.length + 1, 0);
1030
2813
  const batchIncludePaths = (baseArgs, includePaths) => {
1031
2814
  const baseArgsLength = estimateArgsLength(baseArgs);
@@ -1707,7 +3490,7 @@ const evaluateSuppression = (lines, diagnosticLineIndex, ruleId) => {
1707
3490
  const compileIgnoredFilePatterns = (userConfig) => {
1708
3491
  const files = userConfig?.ignore?.files;
1709
3492
  if (!Array.isArray(files)) return [];
1710
- return files.filter((entry) => typeof entry === "string").map(compileGlobPattern);
3493
+ return compileGlobPatternsLenient(files.filter((entry) => typeof entry === "string"), (error) => warnConfigIssue(`ignore.files: ${error.message}`));
1711
3494
  };
1712
3495
  const isFileIgnoredByPatterns = (filePath, rootDirectory, patterns) => {
1713
3496
  if (patterns.length === 0) return false;
@@ -1868,8 +3651,8 @@ const shouldAutoSuppress = (diagnostic) => {
1868
3651
  return false;
1869
3652
  };
1870
3653
  const mergeAndFilterDiagnostics = (mergedDiagnostics, directory, userConfig, readFileLinesSync, options = {}) => {
1871
- const autoFiltered = mergedDiagnostics.filter((diagnostic) => !shouldAutoSuppress(diagnostic));
1872
- const filtered = userConfig ? filterIgnoredDiagnostics(autoFiltered, userConfig, directory, readFileLinesSync) : autoFiltered;
3654
+ const severityAdjusted = applySeverityControls(mergedDiagnostics.filter((diagnostic) => !shouldAutoSuppress(diagnostic)), userConfig);
3655
+ const filtered = userConfig ? filterIgnoredDiagnostics(severityAdjusted, userConfig, directory, readFileLinesSync) : severityAdjusted;
1873
3656
  if (options.respectInlineDisables === false) return filtered;
1874
3657
  return filterInlineSuppressions(filtered, directory, readFileLinesSync);
1875
3658
  };
@@ -1924,43 +3707,32 @@ const DEFAULT_SURFACE_EXCLUDED_TAGS = {
1924
3707
  };
1925
3708
  const toStringSet = (values) => {
1926
3709
  if (!values || values.length === 0) return /* @__PURE__ */ new Set();
1927
- const collected = /* @__PURE__ */ new Set();
1928
- for (const value of values) if (typeof value === "string" && value.length > 0) collected.add(value);
1929
- return collected;
3710
+ return new Set(values.filter((value) => typeof value === "string" && value.length > 0));
1930
3711
  };
1931
3712
  const buildResolvedControls = (surface, userControls) => {
1932
- const baseExcludeTags = new Set(DEFAULT_SURFACE_EXCLUDED_TAGS[surface]);
1933
- const userIncludeTags = toStringSet(userControls?.includeTags);
1934
- for (const includedTag of userIncludeTags) baseExcludeTags.delete(includedTag);
1935
- const userExcludeTags = toStringSet(userControls?.excludeTags);
1936
- for (const excludedTag of userExcludeTags) baseExcludeTags.add(excludedTag);
3713
+ const excludeTags = new Set(DEFAULT_SURFACE_EXCLUDED_TAGS[surface]);
3714
+ const includeTags = toStringSet(userControls?.includeTags);
3715
+ for (const tag of includeTags) excludeTags.delete(tag);
3716
+ for (const tag of toStringSet(userControls?.excludeTags)) excludeTags.add(tag);
1937
3717
  return {
1938
- includeTags: userIncludeTags,
1939
- excludeTags: baseExcludeTags,
3718
+ includeTags,
3719
+ excludeTags,
1940
3720
  includeCategories: toStringSet(userControls?.includeCategories),
1941
3721
  excludeCategories: toStringSet(userControls?.excludeCategories),
1942
3722
  includeRuleKeys: toStringSet(userControls?.includeRules),
1943
3723
  excludeRuleKeys: toStringSet(userControls?.excludeRules)
1944
3724
  };
1945
3725
  };
1946
- const getRuleTags = (diagnostic) => {
1947
- if (diagnostic.plugin !== "react-doctor") return [];
1948
- return reactDoctorPlugin.rules[diagnostic.rule]?.tags ?? [];
1949
- };
1950
- const intersectsAny = (values, candidateSet) => {
1951
- for (const value of values) if (candidateSet.has(value)) return true;
1952
- return false;
1953
- };
3726
+ const intersects = (values, candidates) => values.some((value) => candidates.has(value));
1954
3727
  const isDiagnosticOnSurface = (diagnostic, surface, config) => {
1955
3728
  const resolved = buildResolvedControls(surface, config?.surfaces?.[surface]);
1956
- const ruleKey = `${diagnostic.plugin}/${diagnostic.rule}`;
1957
- const tags = getRuleTags(diagnostic);
3729
+ const { ruleKey, category, tags } = getDiagnosticRuleIdentity(diagnostic);
1958
3730
  if (resolved.includeRuleKeys.has(ruleKey)) return true;
1959
- if (resolved.includeCategories.has(diagnostic.category)) return true;
1960
- if (intersectsAny(tags, resolved.includeTags)) return true;
3731
+ if (resolved.includeCategories.has(category)) return true;
3732
+ if (intersects(tags, resolved.includeTags)) return true;
1961
3733
  if (resolved.excludeRuleKeys.has(ruleKey)) return false;
1962
- if (resolved.excludeCategories.has(diagnostic.category)) return false;
1963
- if (intersectsAny(tags, resolved.excludeTags)) return false;
3734
+ if (resolved.excludeCategories.has(category)) return false;
3735
+ if (intersects(tags, resolved.excludeTags)) return false;
1964
3736
  return true;
1965
3737
  };
1966
3738
  const filterDiagnosticsForSurface = (diagnostics, surface, config) => diagnostics.filter((diagnostic) => isDiagnosticOnSurface(diagnostic, surface, config));
@@ -2081,6 +3853,11 @@ const getDiffInfo = (directory, explicitBaseBranch) => {
2081
3853
  };
2082
3854
  const filterSourceFiles = (filePaths) => filePaths.filter((filePath) => SOURCE_FILE_PATTERN.test(filePath));
2083
3855
  const computeJsxIncludePaths = (includePaths) => includePaths.length > 0 ? includePaths.filter((filePath) => JSX_FILE_PATTERN.test(filePath)) : void 0;
3856
+ const VALID_RULE_SEVERITIES = [
3857
+ "error",
3858
+ "warn",
3859
+ "off"
3860
+ ];
2084
3861
  const BOOLEAN_FIELD_NAMES = [
2085
3862
  "lint",
2086
3863
  "verbose",
@@ -2091,18 +3868,27 @@ const BOOLEAN_FIELD_NAMES = [
2091
3868
  "offline"
2092
3869
  ];
2093
3870
  const STRING_FIELD_NAMES = ["rootDir"];
3871
+ const SURFACE_CONTROL_FIELD_NAMES = [
3872
+ "includeTags",
3873
+ "excludeTags",
3874
+ "includeCategories",
3875
+ "excludeCategories",
3876
+ "includeRules",
3877
+ "excludeRules"
3878
+ ];
3879
+ const SEVERITY_FIELD_NAMES = ["rules", "categories"];
2094
3880
  const warnConfigField = (message) => {
2095
3881
  process.stderr.write(`[react-doctor] ${message}\n`);
2096
3882
  };
3883
+ const isPlainObject$1 = (value) => typeof value === "object" && value !== null && !Array.isArray(value);
3884
+ const formatType = (value) => typeof value === "string" ? `"${value}"` : typeof value;
3885
+ const isRuleSeverity = (value) => typeof value === "string" && VALID_RULE_SEVERITIES.includes(value);
2097
3886
  const coerceMaybeBooleanString = (fieldName, value) => {
2098
- if (typeof value === "boolean" || value === void 0) return value;
2099
- if (value === "true") {
2100
- warnConfigField(`config field "${fieldName}" is the string "true"; treating as boolean true.`);
2101
- return true;
2102
- }
2103
- if (value === "false") {
2104
- warnConfigField(`config field "${fieldName}" is the string "false"; treating as boolean false.`);
2105
- return false;
3887
+ if (typeof value === "boolean") return value;
3888
+ if (value === "true" || value === "false") {
3889
+ const coerced = value === "true";
3890
+ warnConfigField(`config field "${fieldName}" is the string "${value}"; treating as boolean ${coerced}.`);
3891
+ return coerced;
2106
3892
  }
2107
3893
  warnConfigField(`config field "${fieldName}" must be a boolean (got ${typeof value}); ignoring this field.`);
2108
3894
  };
@@ -2110,47 +3896,32 @@ const validateString = (fieldName, value) => {
2110
3896
  if (typeof value === "string") return value;
2111
3897
  warnConfigField(`config field "${fieldName}" must be a string (got ${typeof value}); ignoring this field.`);
2112
3898
  };
2113
- const SURFACE_CONTROL_FIELD_NAMES = [
2114
- "includeTags",
2115
- "excludeTags",
2116
- "includeCategories",
2117
- "excludeCategories",
2118
- "includeRules",
2119
- "excludeRules"
2120
- ];
2121
3899
  const validateStringArrayField = (fieldName, value) => {
2122
- if (value === void 0) return void 0;
2123
3900
  if (!Array.isArray(value)) {
2124
3901
  warnConfigField(`config field "${fieldName}" must be an array of strings (got ${typeof value}); ignoring this field.`);
2125
3902
  return;
2126
3903
  }
2127
- const collected = [];
2128
- for (const entry of value) {
2129
- if (typeof entry !== "string") {
2130
- warnConfigField(`config field "${fieldName}" contains a non-string entry (${typeof entry}); ignoring the entry.`);
2131
- continue;
2132
- }
2133
- collected.push(entry);
2134
- }
2135
- return collected;
3904
+ return value.filter((entry) => {
3905
+ if (typeof entry === "string") return true;
3906
+ warnConfigField(`config field "${fieldName}" contains a non-string entry (${typeof entry}); ignoring the entry.`);
3907
+ return false;
3908
+ });
2136
3909
  };
2137
3910
  const validateSurfaceControls = (surface, rawControls) => {
2138
- if (rawControls === void 0) return void 0;
2139
- if (typeof rawControls !== "object" || rawControls === null || Array.isArray(rawControls)) {
3911
+ if (!isPlainObject$1(rawControls)) {
2140
3912
  warnConfigField(`config field "surfaces.${surface}" must be an object (got ${typeof rawControls}); ignoring this surface.`);
2141
3913
  return;
2142
3914
  }
2143
3915
  const validated = {};
2144
3916
  for (const fieldName of SURFACE_CONTROL_FIELD_NAMES) {
2145
- const value = rawControls[fieldName];
2146
- const validatedValue = validateStringArrayField(`surfaces.${surface}.${fieldName}`, value);
2147
- if (validatedValue !== void 0) validated[fieldName] = validatedValue;
3917
+ if (rawControls[fieldName] === void 0) continue;
3918
+ const result = validateStringArrayField(`surfaces.${surface}.${fieldName}`, rawControls[fieldName]);
3919
+ if (result !== void 0) validated[fieldName] = result;
2148
3920
  }
2149
3921
  return validated;
2150
3922
  };
2151
3923
  const validateSurfacesField = (rawSurfaces) => {
2152
- if (rawSurfaces === void 0) return void 0;
2153
- if (typeof rawSurfaces !== "object" || rawSurfaces === null || Array.isArray(rawSurfaces)) {
3924
+ if (!isPlainObject$1(rawSurfaces)) {
2154
3925
  warnConfigField(`config field "surfaces" must be an object (got ${typeof rawSurfaces}); ignoring this field.`);
2155
3926
  return;
2156
3927
  }
@@ -2165,27 +3936,38 @@ const validateSurfacesField = (rawSurfaces) => {
2165
3936
  }
2166
3937
  return validated;
2167
3938
  };
3939
+ const validateSeverityMap = (fieldName, rawMap) => {
3940
+ if (!isPlainObject$1(rawMap)) {
3941
+ warnConfigField(`config field "${fieldName}" must be an object (got ${typeof rawMap}); ignoring this field.`);
3942
+ return;
3943
+ }
3944
+ const validated = {};
3945
+ for (const [key, value] of Object.entries(rawMap)) {
3946
+ if (key.length === 0) {
3947
+ warnConfigField(`config field "${fieldName}" has an empty key; ignoring the entry.`);
3948
+ continue;
3949
+ }
3950
+ if (!isRuleSeverity(value)) {
3951
+ warnConfigField(`config field "${fieldName}.${key}" must be one of: ${VALID_RULE_SEVERITIES.join(", ")} (got ${formatType(value)}); ignoring the entry.`);
3952
+ continue;
3953
+ }
3954
+ validated[key] = value;
3955
+ }
3956
+ return validated;
3957
+ };
3958
+ const applyFieldValidator = (config, validated, fieldName, validator) => {
3959
+ const raw = config[fieldName];
3960
+ if (raw === void 0) return;
3961
+ const result = validator(raw);
3962
+ if (result === void 0) delete validated[fieldName];
3963
+ else validated[fieldName] = result;
3964
+ };
2168
3965
  const validateConfigTypes = (config) => {
2169
3966
  const validated = { ...config };
2170
- for (const fieldName of BOOLEAN_FIELD_NAMES) {
2171
- const original = config[fieldName];
2172
- if (original === void 0) continue;
2173
- const coerced = coerceMaybeBooleanString(fieldName, original);
2174
- if (coerced === void 0) delete validated[fieldName];
2175
- else validated[fieldName] = coerced;
2176
- }
2177
- for (const fieldName of STRING_FIELD_NAMES) {
2178
- const original = config[fieldName];
2179
- if (original === void 0) continue;
2180
- const validatedString = validateString(fieldName, original);
2181
- if (validatedString === void 0) delete validated[fieldName];
2182
- else validated[fieldName] = validatedString;
2183
- }
2184
- if (config.surfaces !== void 0) {
2185
- const validatedSurfaces = validateSurfacesField(config.surfaces);
2186
- if (validatedSurfaces === void 0) delete validated.surfaces;
2187
- else validated.surfaces = validatedSurfaces;
2188
- }
3967
+ for (const fieldName of BOOLEAN_FIELD_NAMES) applyFieldValidator(config, validated, fieldName, (value) => coerceMaybeBooleanString(fieldName, value));
3968
+ for (const fieldName of STRING_FIELD_NAMES) applyFieldValidator(config, validated, fieldName, (value) => validateString(fieldName, value));
3969
+ applyFieldValidator(config, validated, "surfaces", validateSurfacesField);
3970
+ for (const fieldName of SEVERITY_FIELD_NAMES) applyFieldValidator(config, validated, fieldName, (value) => validateSeverityMap(fieldName, value));
2189
3971
  return validated;
2190
3972
  };
2191
3973
  const CONFIG_FILENAME = "react-doctor.config.json";
@@ -2569,69 +4351,11 @@ const filterRulesToAvailable = (rules, pluginNamespace, availableRuleNames) => {
2569
4351
  }
2570
4352
  return filtered;
2571
4353
  };
2572
- const REACT_COMPILER_RULES = {
2573
- "react-hooks-js/set-state-in-render": "error",
2574
- "react-hooks-js/immutability": "error",
2575
- "react-hooks-js/refs": "error",
2576
- "react-hooks-js/purity": "error",
2577
- "react-hooks-js/hooks": "error",
2578
- "react-hooks-js/set-state-in-effect": "error",
2579
- "react-hooks-js/globals": "error",
2580
- "react-hooks-js/error-boundaries": "error",
2581
- "react-hooks-js/preserve-manual-memoization": "error",
2582
- "react-hooks-js/unsupported-syntax": "error",
2583
- "react-hooks-js/component-hook-factories": "error",
2584
- "react-hooks-js/static-components": "error",
2585
- "react-hooks-js/use-memo": "error",
2586
- "react-hooks-js/void-use-memo": "error",
2587
- "react-hooks-js/incompatible-library": "error",
2588
- "react-hooks-js/todo": "error"
2589
- };
2590
- const YOU_MIGHT_NOT_NEED_EFFECT_RULES = {
2591
- "effect/no-derived-state": "warn",
2592
- "effect/no-chain-state-updates": "warn",
2593
- "effect/no-event-handler": "warn",
2594
- "effect/no-adjust-state-on-prop-change": "warn",
2595
- "effect/no-reset-all-state-on-prop-change": "warn",
2596
- "effect/no-pass-live-state-to-parent": "warn",
2597
- "effect/no-pass-data-to-parent": "warn",
2598
- "effect/no-initialize-state": "warn"
2599
- };
2600
- const BUILTIN_REACT_RULES = {
2601
- "react/rules-of-hooks": "error",
2602
- "react/no-direct-mutation-state": "error",
2603
- "react/jsx-no-duplicate-props": "error",
2604
- "react/jsx-key": "error",
2605
- "react/no-children-prop": "warn",
2606
- "react/no-danger": "warn",
2607
- "react/jsx-no-script-url": "error",
2608
- "react/no-render-return-value": "warn",
2609
- "react/no-string-refs": "warn",
2610
- "react/no-is-mounted": "warn",
2611
- "react/require-render-return": "error",
2612
- "react/no-unknown-property": "warn"
2613
- };
2614
- const BUILTIN_A11Y_RULES = {
2615
- "jsx-a11y/alt-text": "error",
2616
- "jsx-a11y/anchor-is-valid": "warn",
2617
- "jsx-a11y/click-events-have-key-events": "warn",
2618
- "jsx-a11y/no-static-element-interactions": "warn",
2619
- "jsx-a11y/role-has-required-aria-props": "error",
2620
- "jsx-a11y/no-autofocus": "warn",
2621
- "jsx-a11y/heading-has-content": "warn",
2622
- "jsx-a11y/html-has-lang": "warn",
2623
- "jsx-a11y/no-redundant-roles": "warn",
2624
- "jsx-a11y/scope": "warn",
2625
- "jsx-a11y/tabindex-no-positive": "warn",
2626
- "jsx-a11y/label-has-associated-control": "warn",
2627
- "jsx-a11y/no-distracting-elements": "error",
2628
- "jsx-a11y/iframe-has-title": "warn"
2629
- };
2630
4354
  const resolveSettingsRootDirectory = (rootDirectory) => {
2631
4355
  if (!fs.existsSync(rootDirectory)) return rootDirectory;
2632
4356
  return fs.realpathSync(rootDirectory);
2633
4357
  };
2634
- const createOxlintConfig = ({ pluginPath, project, customRulesOnly = false, extendsPaths = [], ignoredTags = /* @__PURE__ */ new Set(), serverAuthFunctionNames }) => {
4358
+ const createOxlintConfig = ({ pluginPath, project, customRulesOnly = false, extendsPaths = [], ignoredTags = /* @__PURE__ */ new Set(), serverAuthFunctionNames, severityControls }) => {
2635
4359
  const reactHooksJsPlugin = resolveReactHooksJsPlugin(project.hasReactCompiler, customRulesOnly);
2636
4360
  const reactCompilerRules = reactHooksJsPlugin ? filterRulesToAvailable(REACT_COMPILER_RULES, "react-hooks-js", reactHooksJsPlugin.availableRuleNames) : {};
2637
4361
  const youMightNotNeedEffectPlugin = resolveYouMightNotNeedEffectPlugin(customRulesOnly);
@@ -2645,7 +4369,12 @@ const createOxlintConfig = ({ pluginPath, project, customRulesOnly = false, exte
2645
4369
  const fullKey = `react-doctor/${ruleId}`;
2646
4370
  if (rule.framework !== "global" && !rule.requires) continue;
2647
4371
  if (!shouldEnableRule(rule.requires, rule.tags, capabilities, ignoredTags)) continue;
2648
- enabledReactDoctorRules[fullKey] = rule.severity;
4372
+ const severity = resolveRuleSeverityOverride({
4373
+ ruleKey: fullKey,
4374
+ category: rule.category
4375
+ }, severityControls) ?? rule.severity;
4376
+ if (severity === "off") continue;
4377
+ enabledReactDoctorRules[fullKey] = severity;
2649
4378
  }
2650
4379
  return {
2651
4380
  ...extendsPaths.length > 0 ? { extends: extendsPaths } : {},
@@ -3179,6 +4908,7 @@ const validateRuleRegistration = () => {
3179
4908
  const runOxlint = async (options) => {
3180
4909
  const { rootDirectory, project, includePaths, nodeBinaryPath = process.execPath, customRulesOnly = false, respectInlineDisables = true, adoptExistingLintConfig = true, ignoredTags = /* @__PURE__ */ new Set(), userConfig, onPartialFailure } = options;
3181
4910
  const serverAuthFunctionNames = Array.isArray(userConfig?.serverAuthFunctionNames) ? userConfig.serverAuthFunctionNames.filter((entry) => typeof entry === "string" && entry.length > 0) : void 0;
4911
+ const severityControls = buildRuleSeverityControls(userConfig);
3182
4912
  validateRuleRegistration();
3183
4913
  if (includePaths !== void 0 && includePaths.length === 0) return [];
3184
4914
  const configDirectory = fs.mkdtempSync(path.join(os.tmpdir(), "react-doctor-oxlintrc-"));
@@ -3191,7 +4921,8 @@ const runOxlint = async (options) => {
3191
4921
  customRulesOnly,
3192
4922
  extendsPaths,
3193
4923
  ignoredTags,
3194
- serverAuthFunctionNames
4924
+ serverAuthFunctionNames,
4925
+ severityControls
3195
4926
  });
3196
4927
  const restoreDisableDirectives = respectInlineDisables ? () => {} : neutralizeDisableDirectives(rootDirectory, includePaths);
3197
4928
  try {
@@ -3259,7 +4990,8 @@ const runOxlint = async (options) => {
3259
4990
  customRulesOnly,
3260
4991
  extendsPaths: [],
3261
4992
  ignoredTags,
3262
- serverAuthFunctionNames
4993
+ serverAuthFunctionNames,
4994
+ severityControls
3263
4995
  }));
3264
4996
  return await spawnLintBatches();
3265
4997
  }
@@ -3688,7 +5420,7 @@ const shouldSelectAllChoices = (choiceStates) => {
3688
5420
  };
3689
5421
  //#endregion
3690
5422
  //#region src/cli/utils/prompts.ts
3691
- const require = createRequire(import.meta.url);
5423
+ const require$1 = createRequire(import.meta.url);
3692
5424
  const PROMPTS_MULTISELECT_MODULE_PATH = "prompts/lib/elements/multiselect";
3693
5425
  let didPatchMultiselectToggleAll = false;
3694
5426
  let didPatchMultiselectSubmit = false;
@@ -3701,7 +5433,7 @@ const onCancel = () => {
3701
5433
  const patchMultiselectToggleAll = () => {
3702
5434
  if (didPatchMultiselectToggleAll) return;
3703
5435
  didPatchMultiselectToggleAll = true;
3704
- const multiselectPromptConstructor = require(PROMPTS_MULTISELECT_MODULE_PATH);
5436
+ const multiselectPromptConstructor = require$1(PROMPTS_MULTISELECT_MODULE_PATH);
3705
5437
  multiselectPromptConstructor.prototype.toggleAll = function() {
3706
5438
  const isCurrentChoiceDisabled = Boolean(this.value[this.cursor]?.disabled);
3707
5439
  if (this.maxChoices !== void 0 || isCurrentChoiceDisabled) {
@@ -3719,7 +5451,7 @@ const patchMultiselectToggleAll = () => {
3719
5451
  const patchMultiselectSubmit = () => {
3720
5452
  if (didPatchMultiselectSubmit) return;
3721
5453
  didPatchMultiselectSubmit = true;
3722
- const multiselectPromptConstructor = require(PROMPTS_MULTISELECT_MODULE_PATH);
5454
+ const multiselectPromptConstructor = require$1(PROMPTS_MULTISELECT_MODULE_PATH);
3723
5455
  const originalSubmit = multiselectPromptConstructor.prototype.submit;
3724
5456
  multiselectPromptConstructor.prototype.submit = function() {
3725
5457
  if (shouldAutoSelectCurrentChoice(this.value, this.cursor)) this.value[this.cursor].selected = true;
@@ -4019,7 +5751,7 @@ const CI_ENVIRONMENT_VARIABLES = [
4019
5751
  const isCiEnvironment = () => CI_ENVIRONMENT_VARIABLES.some((envVariable) => Boolean(process.env[envVariable])) || process.env.CI === "true";
4020
5752
  //#endregion
4021
5753
  //#region src/cli/utils/version.ts
4022
- const VERSION = "0.2.0-beta.5";
5754
+ const VERSION = "0.2.0-beta.6";
4023
5755
  //#endregion
4024
5756
  //#region src/cli/utils/json-mode.ts
4025
5757
  let context = null;