react-doctor 0.9.2-dev.b31fd85 → 0.9.2-dev.bf470d5

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 CHANGED
@@ -1,8 +1,8 @@
1
1
 
2
- !function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="41e39010-e2d7-5e6b-9bba-626bf64affe5")}catch(e){}}();
2
+ !function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="61d9689f-8ba5-5ca3-a0c2-09557d3f7028")}catch(e){}}();
3
3
  import { i as __toESM$1, r as __require, t as __commonJSMin$1 } from "./chunk-ChKA3wi6.js";
4
4
  import { createRequire } from "node:module";
5
- import reactDoctorPlugin, { ALL_REACT_DOCTOR_RULE_KEYS, CROSS_FILE_DEPENDENCY_COLLECTORS, CROSS_FILE_RULE_IDS, FRAMEWORK_SPECIFIC_RULE_KEYS, FRAMEWORK_TOKENS, MOTION_LIBRARY_PACKAGES, REACT_COMPILER_RULES, REACT_DOCTOR_RULES, classifySecurityScanFile, collectCrossFileDependencyProbes, resetManifestCaches, shouldReadSecurityScanContent } from "oxlint-plugin-react-doctor";
5
+ import { ALL_REACT_DOCTOR_RULE_KEYS, CROSS_FILE_DEPENDENCY_COLLECTORS, CROSS_FILE_RULE_IDS, FRAMEWORK_SPECIFIC_RULE_KEYS, FRAMEWORK_TOKENS, MOTION_LIBRARY_PACKAGES, REACT_COMPILER_RULES, REACT_DOCTOR_RULES, REACT_DOCTOR_RULE_REGISTRY, REACT_DOCTOR_SCAN_RULES, classifySecurityScanFile, collectCrossFileDependencyProbes, resetManifestCaches, shouldReadSecurityScanContent } from "oxlint-plugin-react-doctor/core";
6
6
  import * as Crypto from "node:crypto";
7
7
  import crypto, { createHash } from "node:crypto";
8
8
  import * as NFS from "node:fs";
@@ -13,13 +13,14 @@ import * as NodeChildProcess from "node:child_process";
13
13
  import { execFileSync, spawn, spawnSync } from "node:child_process";
14
14
  import { ResolverFactory } from "oxc-resolver";
15
15
  import ts from "typescript";
16
+ import * as NodeUrl from "node:url";
17
+ import { fileURLToPath } from "node:url";
16
18
  import * as OS from "node:os";
17
19
  import os from "node:os";
18
20
  import { parseJSON5 } from "confbox";
19
- import * as NodeUrl from "node:url";
20
- import { fileURLToPath } from "node:url";
21
21
  import { createJiti } from "jiti";
22
22
  import { ANALYZED_MANIFEST_FILENAMES, DEFAULT_EXTENSIONS } from "deslop-js/analyzed-inputs";
23
+ import { convertToTSX } from "@astrojs/compiler/sync";
23
24
  import { gzipSync } from "node:zlib";
24
25
  //#region ../../node_modules/.pnpm/effect@4.0.0-beta.70/node_modules/effect/dist/Pipeable.js
25
26
  /**
@@ -10262,7 +10263,7 @@ const Number$4 = globalThis.Number;
10262
10263
  * @category constructors
10263
10264
  * @since 2.0.0
10264
10265
  */
10265
- const parse = (s) => {
10266
+ const parse$1 = (s) => {
10266
10267
  if (s === "NaN") return some(NaN);
10267
10268
  if (s === "Infinity") return some(Infinity);
10268
10269
  if (s === "-Infinity") return some(-Infinity);
@@ -14304,12 +14305,12 @@ TaggedError("EncodingError");
14304
14305
  //#endregion
14305
14306
  //#region ../../node_modules/.pnpm/effect@4.0.0-beta.70/node_modules/effect/dist/internal/schema/annotations.js
14306
14307
  /** @internal */
14307
- function resolve(ast) {
14308
+ function resolve$1(ast) {
14308
14309
  return ast.checks ? ast.checks[ast.checks.length - 1].annotations : ast.annotations;
14309
14310
  }
14310
14311
  /** @internal */
14311
14312
  function resolveAt(key) {
14312
- return (ast) => resolve(ast)?.[key];
14313
+ return (ast) => resolve$1(ast)?.[key];
14313
14314
  }
14314
14315
  /** @internal */
14315
14316
  const resolveIdentifier = /* @__PURE__ */ resolveAt("identifier");
@@ -18061,7 +18062,7 @@ function asSync(parser) {
18061
18062
  }
18062
18063
  const recur$1 = /* @__PURE__ */ memoize((ast) => {
18063
18064
  let parser;
18064
- const astOptions = resolve(ast)?.["parseOptions"];
18065
+ const astOptions = resolve$1(ast)?.["parseOptions"];
18065
18066
  if (!ast.context && !ast.encoding && !ast.checks) return (ou, options) => {
18066
18067
  parser ??= ast.getParser(recur$1);
18067
18068
  if (astOptions) options = {
@@ -57666,7 +57667,7 @@ var UrlParamsError = class extends TaggedError("UrlParamsError") {};
57666
57667
  * @category converting
57667
57668
  * @since 4.0.0
57668
57669
  */
57669
- const makeUrl = (url, params, hash) => {
57670
+ const makeUrl$1 = (url, params, hash) => {
57670
57671
  try {
57671
57672
  const urlInstance = new URL(url, baseUrl());
57672
57673
  for (let i = 0; i < params.params.length; i++) {
@@ -58300,7 +58301,7 @@ const Proto$2 = {
58300
58301
  const make$10 = (f) => makeWith$1((effect) => flatMap$2(effect, (request) => withFiber((fiber) => {
58301
58302
  const scopedController = scopedRequests.get(request);
58302
58303
  const controller = scopedController ?? new AbortController();
58303
- const urlResult = makeUrl(request.url, request.urlParams, getOrUndefined(request.hash));
58304
+ const urlResult = makeUrl$1(request.url, request.urlParams, getOrUndefined(request.hash));
58304
58305
  if (isFailure(urlResult)) return fail$4(new HttpClientError({ reason: new InvalidUrlError({
58305
58306
  request,
58306
58307
  cause: urlResult.failure
@@ -58739,7 +58740,7 @@ const layer$7 = (loggers, options) => effect(CurrentLoggers, withFiber$1(fnUntra
58739
58740
  * @since 4.0.0
58740
58741
  */
58741
58742
  const policy = /* @__PURE__ */ forever$1.pipe(passthrough$2, /* @__PURE__ */ addDelay((error) => {
58742
- if (isHttpClientError(error) && error.reason._tag === "StatusCodeError" && error.reason.response.status === 429) return succeed$2(seconds(fromUndefinedOr(error.reason.response.headers["retry-after"]).pipe(flatMap$5(parse), getOrElse$1(() => 5))));
58743
+ if (isHttpClientError(error) && error.reason._tag === "StatusCodeError" && error.reason.response.status === 429) return succeed$2(seconds(fromUndefinedOr(error.reason.response.headers["retry-after"]).pipe(flatMap$5(parse$1), getOrElse$1(() => 5))));
58743
58744
  return succeed$2(seconds(1));
58744
58745
  }));
58745
58746
  /**
@@ -61381,6 +61382,428 @@ const layer = /* @__PURE__ */ succeed$3(Path$1)({
61381
61382
  toFileUrl
61382
61383
  });
61383
61384
  //#endregion
61385
+ //#region ../../node_modules/.pnpm/@jridgewell+sourcemap-codec@1.5.5/node_modules/@jridgewell/sourcemap-codec/dist/sourcemap-codec.mjs
61386
+ var comma = ",".charCodeAt(0);
61387
+ ";".charCodeAt(0);
61388
+ var chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
61389
+ var intToChar = new Uint8Array(64);
61390
+ var charToInt = new Uint8Array(128);
61391
+ for (let i = 0; i < chars.length; i++) {
61392
+ const c = chars.charCodeAt(i);
61393
+ intToChar[i] = c;
61394
+ charToInt[c] = i;
61395
+ }
61396
+ function decodeInteger(reader, relative) {
61397
+ let value = 0;
61398
+ let shift = 0;
61399
+ let integer = 0;
61400
+ do {
61401
+ integer = charToInt[reader.next()];
61402
+ value |= (integer & 31) << shift;
61403
+ shift += 5;
61404
+ } while (integer & 32);
61405
+ const shouldNegate = value & 1;
61406
+ value >>>= 1;
61407
+ if (shouldNegate) value = -2147483648 | -value;
61408
+ return relative + value;
61409
+ }
61410
+ function hasMoreVlq(reader, max) {
61411
+ if (reader.pos >= max) return false;
61412
+ return reader.peek() !== comma;
61413
+ }
61414
+ var StringReader = class {
61415
+ constructor(buffer) {
61416
+ this.pos = 0;
61417
+ this.buffer = buffer;
61418
+ }
61419
+ next() {
61420
+ return this.buffer.charCodeAt(this.pos++);
61421
+ }
61422
+ peek() {
61423
+ return this.buffer.charCodeAt(this.pos);
61424
+ }
61425
+ indexOf(char) {
61426
+ const { buffer, pos } = this;
61427
+ const idx = buffer.indexOf(char, pos);
61428
+ return idx === -1 ? buffer.length : idx;
61429
+ }
61430
+ };
61431
+ function decode(mappings) {
61432
+ const { length } = mappings;
61433
+ const reader = new StringReader(mappings);
61434
+ const decoded = [];
61435
+ let genColumn = 0;
61436
+ let sourcesIndex = 0;
61437
+ let sourceLine = 0;
61438
+ let sourceColumn = 0;
61439
+ let namesIndex = 0;
61440
+ do {
61441
+ const semi = reader.indexOf(";");
61442
+ const line = [];
61443
+ let sorted = true;
61444
+ let lastCol = 0;
61445
+ genColumn = 0;
61446
+ while (reader.pos < semi) {
61447
+ let seg;
61448
+ genColumn = decodeInteger(reader, genColumn);
61449
+ if (genColumn < lastCol) sorted = false;
61450
+ lastCol = genColumn;
61451
+ if (hasMoreVlq(reader, semi)) {
61452
+ sourcesIndex = decodeInteger(reader, sourcesIndex);
61453
+ sourceLine = decodeInteger(reader, sourceLine);
61454
+ sourceColumn = decodeInteger(reader, sourceColumn);
61455
+ if (hasMoreVlq(reader, semi)) {
61456
+ namesIndex = decodeInteger(reader, namesIndex);
61457
+ seg = [
61458
+ genColumn,
61459
+ sourcesIndex,
61460
+ sourceLine,
61461
+ sourceColumn,
61462
+ namesIndex
61463
+ ];
61464
+ } else seg = [
61465
+ genColumn,
61466
+ sourcesIndex,
61467
+ sourceLine,
61468
+ sourceColumn
61469
+ ];
61470
+ } else seg = [genColumn];
61471
+ line.push(seg);
61472
+ reader.pos++;
61473
+ }
61474
+ if (!sorted) sort(line);
61475
+ decoded.push(line);
61476
+ reader.pos = semi + 1;
61477
+ } while (reader.pos <= length);
61478
+ return decoded;
61479
+ }
61480
+ function sort(line) {
61481
+ line.sort(sortComparator$1);
61482
+ }
61483
+ function sortComparator$1(a, b) {
61484
+ return a[0] - b[0];
61485
+ }
61486
+ //#endregion
61487
+ //#region ../../node_modules/.pnpm/@jridgewell+resolve-uri@3.1.2/node_modules/@jridgewell/resolve-uri/dist/resolve-uri.mjs
61488
+ const schemeRegex = /^[\w+.-]+:\/\//;
61489
+ /**
61490
+ * Matches the parts of a URL:
61491
+ * 1. Scheme, including ":", guaranteed.
61492
+ * 2. User/password, including "@", optional.
61493
+ * 3. Host, guaranteed.
61494
+ * 4. Port, including ":", optional.
61495
+ * 5. Path, including "/", optional.
61496
+ * 6. Query, including "?", optional.
61497
+ * 7. Hash, including "#", optional.
61498
+ */
61499
+ const urlRegex = /^([\w+.-]+:)\/\/([^@/#?]*@)?([^:/#?]*)(:\d+)?(\/[^#?]*)?(\?[^#]*)?(#.*)?/;
61500
+ /**
61501
+ * File URLs are weird. They dont' need the regular `//` in the scheme, they may or may not start
61502
+ * with a leading `/`, they can have a domain (but only if they don't start with a Windows drive).
61503
+ *
61504
+ * 1. Host, optional.
61505
+ * 2. Path, which may include "/", guaranteed.
61506
+ * 3. Query, including "?", optional.
61507
+ * 4. Hash, including "#", optional.
61508
+ */
61509
+ const fileRegex = /^file:(?:\/\/((?![a-z]:)[^/#?]*)?)?(\/?[^#?]*)(\?[^#]*)?(#.*)?/i;
61510
+ function isAbsoluteUrl(input) {
61511
+ return schemeRegex.test(input);
61512
+ }
61513
+ function isSchemeRelativeUrl(input) {
61514
+ return input.startsWith("//");
61515
+ }
61516
+ function isAbsolutePath(input) {
61517
+ return input.startsWith("/");
61518
+ }
61519
+ function isFileUrl(input) {
61520
+ return input.startsWith("file:");
61521
+ }
61522
+ function isRelative(input) {
61523
+ return /^[.?#]/.test(input);
61524
+ }
61525
+ function parseAbsoluteUrl(input) {
61526
+ const match = urlRegex.exec(input);
61527
+ return makeUrl(match[1], match[2] || "", match[3], match[4] || "", match[5] || "/", match[6] || "", match[7] || "");
61528
+ }
61529
+ function parseFileUrl(input) {
61530
+ const match = fileRegex.exec(input);
61531
+ const path = match[2];
61532
+ return makeUrl("file:", "", match[1] || "", "", isAbsolutePath(path) ? path : "/" + path, match[3] || "", match[4] || "");
61533
+ }
61534
+ function makeUrl(scheme, user, host, port, path, query, hash) {
61535
+ return {
61536
+ scheme,
61537
+ user,
61538
+ host,
61539
+ port,
61540
+ path,
61541
+ query,
61542
+ hash,
61543
+ type: 7
61544
+ };
61545
+ }
61546
+ function parseUrl(input) {
61547
+ if (isSchemeRelativeUrl(input)) {
61548
+ const url = parseAbsoluteUrl("http:" + input);
61549
+ url.scheme = "";
61550
+ url.type = 6;
61551
+ return url;
61552
+ }
61553
+ if (isAbsolutePath(input)) {
61554
+ const url = parseAbsoluteUrl("http://foo.com" + input);
61555
+ url.scheme = "";
61556
+ url.host = "";
61557
+ url.type = 5;
61558
+ return url;
61559
+ }
61560
+ if (isFileUrl(input)) return parseFileUrl(input);
61561
+ if (isAbsoluteUrl(input)) return parseAbsoluteUrl(input);
61562
+ const url = parseAbsoluteUrl("http://foo.com/" + input);
61563
+ url.scheme = "";
61564
+ url.host = "";
61565
+ url.type = input ? input.startsWith("?") ? 3 : input.startsWith("#") ? 2 : 4 : 1;
61566
+ return url;
61567
+ }
61568
+ function stripPathFilename(path) {
61569
+ if (path.endsWith("/..")) return path;
61570
+ const index = path.lastIndexOf("/");
61571
+ return path.slice(0, index + 1);
61572
+ }
61573
+ function mergePaths(url, base) {
61574
+ normalizePath(base, base.type);
61575
+ if (url.path === "/") url.path = base.path;
61576
+ else url.path = stripPathFilename(base.path) + url.path;
61577
+ }
61578
+ /**
61579
+ * The path can have empty directories "//", unneeded parents "foo/..", or current directory
61580
+ * "foo/.". We need to normalize to a standard representation.
61581
+ */
61582
+ function normalizePath(url, type) {
61583
+ const rel = type <= 4;
61584
+ const pieces = url.path.split("/");
61585
+ let pointer = 1;
61586
+ let positive = 0;
61587
+ let addTrailingSlash = false;
61588
+ for (let i = 1; i < pieces.length; i++) {
61589
+ const piece = pieces[i];
61590
+ if (!piece) {
61591
+ addTrailingSlash = true;
61592
+ continue;
61593
+ }
61594
+ addTrailingSlash = false;
61595
+ if (piece === ".") continue;
61596
+ if (piece === "..") {
61597
+ if (positive) {
61598
+ addTrailingSlash = true;
61599
+ positive--;
61600
+ pointer--;
61601
+ } else if (rel) pieces[pointer++] = piece;
61602
+ continue;
61603
+ }
61604
+ pieces[pointer++] = piece;
61605
+ positive++;
61606
+ }
61607
+ let path = "";
61608
+ for (let i = 1; i < pointer; i++) path += "/" + pieces[i];
61609
+ if (!path || addTrailingSlash && !path.endsWith("/..")) path += "/";
61610
+ url.path = path;
61611
+ }
61612
+ /**
61613
+ * Attempts to resolve `input` URL/path relative to `base`.
61614
+ */
61615
+ function resolve(input, base) {
61616
+ if (!input && !base) return "";
61617
+ const url = parseUrl(input);
61618
+ let inputType = url.type;
61619
+ if (base && inputType !== 7) {
61620
+ const baseUrl = parseUrl(base);
61621
+ const baseType = baseUrl.type;
61622
+ switch (inputType) {
61623
+ case 1: url.hash = baseUrl.hash;
61624
+ case 2: url.query = baseUrl.query;
61625
+ case 3:
61626
+ case 4: mergePaths(url, baseUrl);
61627
+ case 5:
61628
+ url.user = baseUrl.user;
61629
+ url.host = baseUrl.host;
61630
+ url.port = baseUrl.port;
61631
+ case 6: url.scheme = baseUrl.scheme;
61632
+ }
61633
+ if (baseType > inputType) inputType = baseType;
61634
+ }
61635
+ normalizePath(url, inputType);
61636
+ const queryHash = url.query + url.hash;
61637
+ switch (inputType) {
61638
+ case 2:
61639
+ case 3: return queryHash;
61640
+ case 4: {
61641
+ const path = url.path.slice(1);
61642
+ if (!path) return queryHash || ".";
61643
+ if (isRelative(base || input) && !isRelative(path)) return "./" + path + queryHash;
61644
+ return path + queryHash;
61645
+ }
61646
+ case 5: return url.path + queryHash;
61647
+ default: return url.scheme + "//" + url.user + url.host + url.port + url.path + queryHash;
61648
+ }
61649
+ }
61650
+ //#endregion
61651
+ //#region ../../node_modules/.pnpm/@jridgewell+trace-mapping@0.3.31/node_modules/@jridgewell/trace-mapping/dist/trace-mapping.mjs
61652
+ function stripFilename(path) {
61653
+ if (!path) return "";
61654
+ const index = path.lastIndexOf("/");
61655
+ return path.slice(0, index + 1);
61656
+ }
61657
+ function resolver(mapUrl, sourceRoot) {
61658
+ const from = stripFilename(mapUrl);
61659
+ const prefix = sourceRoot ? sourceRoot + "/" : "";
61660
+ return (source) => resolve(prefix + (source || ""), from);
61661
+ }
61662
+ var COLUMN = 0;
61663
+ var SOURCES_INDEX = 1;
61664
+ var SOURCE_LINE = 2;
61665
+ var SOURCE_COLUMN = 3;
61666
+ var NAMES_INDEX = 4;
61667
+ function maybeSort(mappings, owned) {
61668
+ const unsortedIndex = nextUnsortedSegmentLine(mappings, 0);
61669
+ if (unsortedIndex === mappings.length) return mappings;
61670
+ if (!owned) mappings = mappings.slice();
61671
+ for (let i = unsortedIndex; i < mappings.length; i = nextUnsortedSegmentLine(mappings, i + 1)) mappings[i] = sortSegments(mappings[i], owned);
61672
+ return mappings;
61673
+ }
61674
+ function nextUnsortedSegmentLine(mappings, start) {
61675
+ for (let i = start; i < mappings.length; i++) if (!isSorted(mappings[i])) return i;
61676
+ return mappings.length;
61677
+ }
61678
+ function isSorted(line) {
61679
+ for (let j = 1; j < line.length; j++) if (line[j][COLUMN] < line[j - 1][COLUMN]) return false;
61680
+ return true;
61681
+ }
61682
+ function sortSegments(line, owned) {
61683
+ if (!owned) line = line.slice();
61684
+ return line.sort(sortComparator);
61685
+ }
61686
+ function sortComparator(a, b) {
61687
+ return a[COLUMN] - b[COLUMN];
61688
+ }
61689
+ var found = false;
61690
+ function binarySearch(haystack, needle, low, high) {
61691
+ while (low <= high) {
61692
+ const mid = low + (high - low >> 1);
61693
+ const cmp = haystack[mid][COLUMN] - needle;
61694
+ if (cmp === 0) {
61695
+ found = true;
61696
+ return mid;
61697
+ }
61698
+ if (cmp < 0) low = mid + 1;
61699
+ else high = mid - 1;
61700
+ }
61701
+ found = false;
61702
+ return low - 1;
61703
+ }
61704
+ function upperBound(haystack, needle, index) {
61705
+ for (let i = index + 1; i < haystack.length; index = i++) if (haystack[i][COLUMN] !== needle) break;
61706
+ return index;
61707
+ }
61708
+ function lowerBound(haystack, needle, index) {
61709
+ for (let i = index - 1; i >= 0; index = i--) if (haystack[i][COLUMN] !== needle) break;
61710
+ return index;
61711
+ }
61712
+ function memoizedState() {
61713
+ return {
61714
+ lastKey: -1,
61715
+ lastNeedle: -1,
61716
+ lastIndex: -1
61717
+ };
61718
+ }
61719
+ function memoizedBinarySearch(haystack, needle, state, key) {
61720
+ const { lastKey, lastNeedle, lastIndex } = state;
61721
+ let low = 0;
61722
+ let high = haystack.length - 1;
61723
+ if (key === lastKey) {
61724
+ if (needle === lastNeedle) {
61725
+ found = lastIndex !== -1 && haystack[lastIndex][COLUMN] === needle;
61726
+ return lastIndex;
61727
+ }
61728
+ if (needle >= lastNeedle) low = lastIndex === -1 ? 0 : lastIndex;
61729
+ else high = lastIndex;
61730
+ }
61731
+ state.lastKey = key;
61732
+ state.lastNeedle = needle;
61733
+ return state.lastIndex = binarySearch(haystack, needle, low, high);
61734
+ }
61735
+ function parse(map) {
61736
+ return typeof map === "string" ? JSON.parse(map) : map;
61737
+ }
61738
+ var LINE_GTR_ZERO = "`line` must be greater than 0 (lines start at line 1)";
61739
+ var COL_GTR_EQ_ZERO = "`column` must be greater than or equal to 0 (columns start at column 0)";
61740
+ var TraceMap = class {
61741
+ constructor(map, mapUrl) {
61742
+ const isString = typeof map === "string";
61743
+ if (!isString && map._decodedMemo) return map;
61744
+ const parsed = parse(map);
61745
+ const { version, file, names, sourceRoot, sources, sourcesContent } = parsed;
61746
+ this.version = version;
61747
+ this.file = file;
61748
+ this.names = names || [];
61749
+ this.sourceRoot = sourceRoot;
61750
+ this.sources = sources;
61751
+ this.sourcesContent = sourcesContent;
61752
+ this.ignoreList = parsed.ignoreList || parsed.x_google_ignoreList || void 0;
61753
+ const resolve = resolver(mapUrl, sourceRoot);
61754
+ this.resolvedSources = sources.map(resolve);
61755
+ const { mappings } = parsed;
61756
+ if (typeof mappings === "string") {
61757
+ this._encoded = mappings;
61758
+ this._decoded = void 0;
61759
+ } else if (Array.isArray(mappings)) {
61760
+ this._encoded = void 0;
61761
+ this._decoded = maybeSort(mappings, isString);
61762
+ } else if (parsed.sections) throw new Error(`TraceMap passed sectioned source map, please use FlattenMap export instead`);
61763
+ else throw new Error(`invalid source map: ${JSON.stringify(parsed)}`);
61764
+ this._decodedMemo = memoizedState();
61765
+ this._bySources = void 0;
61766
+ this._bySourceMemos = void 0;
61767
+ }
61768
+ };
61769
+ function cast(map) {
61770
+ return map;
61771
+ }
61772
+ function decodedMappings(map) {
61773
+ var _a;
61774
+ return (_a = cast(map))._decoded || (_a._decoded = decode(cast(map)._encoded));
61775
+ }
61776
+ function originalPositionFor(map, needle) {
61777
+ let { line, column, bias } = needle;
61778
+ line--;
61779
+ if (line < 0) throw new Error(LINE_GTR_ZERO);
61780
+ if (column < 0) throw new Error(COL_GTR_EQ_ZERO);
61781
+ const decoded = decodedMappings(map);
61782
+ if (line >= decoded.length) return OMapping(null, null, null, null);
61783
+ const segments = decoded[line];
61784
+ const index = traceSegmentInternal(segments, cast(map)._decodedMemo, line, column, bias || 1);
61785
+ if (index === -1) return OMapping(null, null, null, null);
61786
+ const segment = segments[index];
61787
+ if (segment.length === 1) return OMapping(null, null, null, null);
61788
+ const { names, resolvedSources } = map;
61789
+ return OMapping(resolvedSources[segment[SOURCES_INDEX]], segment[SOURCE_LINE] + 1, segment[SOURCE_COLUMN], segment.length === 5 ? names[segment[NAMES_INDEX]] : null);
61790
+ }
61791
+ function OMapping(source, line, column, name) {
61792
+ return {
61793
+ source,
61794
+ line,
61795
+ column,
61796
+ name
61797
+ };
61798
+ }
61799
+ function traceSegmentInternal(segments, memo, line, column, bias) {
61800
+ let index = memoizedBinarySearch(segments, column, memo, line);
61801
+ if (found) index = (bias === -1 ? upperBound : lowerBound)(segments, column, index);
61802
+ else if (bias === -1) index++;
61803
+ if (index === -1 || index === segments.length) return -1;
61804
+ return index;
61805
+ }
61806
+ //#endregion
61384
61807
  //#region ../core/dist/index.js
61385
61808
  var __create = Object.create;
61386
61809
  var __defProp = Object.defineProperty;
@@ -61450,7 +61873,7 @@ var AmbiguousProjectError = class extends Error {
61450
61873
  };
61451
61874
  const isProjectDiscoveryError = (value) => value instanceof ProjectNotFoundError || value instanceof NoReactDependencyError || value instanceof PackageJsonNotFoundError || value instanceof NotADirectoryError || value instanceof AmbiguousProjectError;
61452
61875
  const HTML_FILE_PATTERN = /\.html$/i;
61453
- const SOURCE_FILE_PATTERN = /\.(?:tsx?|jsx?|mts|mjs|[hH][tT][mM][lL])$/;
61876
+ const SOURCE_FILE_PATTERN = /\.(?:astro|tsx?|jsx?|mts|mjs|[hH][tT][mM][lL])$/;
61454
61877
  const GENERATED_BUNDLE_FILE_PATTERN = /\.(iife|umd|global|min)\.m?js$/i;
61455
61878
  const GENERATED_SOURCE_DIRECTORY_PATTERN = /(?:^|\/)__generated__\//;
61456
61879
  const MINIFIED_SNIFF_BYTES = 65536;
@@ -62178,6 +62601,7 @@ const FRAMEWORK_PACKAGES = {
62178
62601
  "@tanstack/react-start": "tanstack-start",
62179
62602
  "@remix-run/react": "remix",
62180
62603
  gatsby: "gatsby",
62604
+ astro: "astro",
62181
62605
  vite: "vite",
62182
62606
  "react-scripts": "cra",
62183
62607
  expo: "expo",
@@ -62399,10 +62823,16 @@ const getTopLevelBinding = (sourceFile, bindingName) => {
62399
62823
  }
62400
62824
  return null;
62401
62825
  };
62402
- const getFunctionLocalBindings = (functionNode, argumentsList) => {
62826
+ const getFunctionLocalBindings = (functionNode, argumentsList, argumentAnalysis, functionAnalysis) => {
62403
62827
  const localBindings = /* @__PURE__ */ new Map();
62404
62828
  functionNode.parameters.forEach((parameter, parameterIndex) => {
62405
- if (ts.isIdentifier(parameter.name)) localBindings.set(parameter.name.text, argumentsList[parameterIndex] ?? parameter.initializer ?? null);
62829
+ if (ts.isIdentifier(parameter.name)) {
62830
+ const argument = argumentsList[parameterIndex];
62831
+ localBindings.set(parameter.name.text, {
62832
+ expression: argument ?? parameter.initializer ?? null,
62833
+ analysis: argument ? argumentAnalysis : functionAnalysis
62834
+ });
62835
+ }
62406
62836
  });
62407
62837
  return localBindings;
62408
62838
  };
@@ -62538,8 +62968,8 @@ const getStaticConfigValueState = (expression, analysis, visitedExpressions = /*
62538
62968
  };
62539
62969
  if (ts.isIdentifier(unwrappedExpression)) {
62540
62970
  if (analysis.localBindings.has(unwrappedExpression.text)) {
62541
- const localInitializer = analysis.localBindings.get(unwrappedExpression.text);
62542
- return localInitializer ? getStaticConfigValueState(localInitializer, analysis, nextVisitedExpressions) : null;
62971
+ const localReference = analysis.localBindings.get(unwrappedExpression.text);
62972
+ return localReference?.expression ? getStaticConfigValueState(localReference.expression, localReference.analysis, nextVisitedExpressions) : null;
62543
62973
  }
62544
62974
  const topLevelBinding = getTopLevelBinding(analysis.sourceFile, unwrappedExpression.text);
62545
62975
  return topLevelBinding && ts.isExpression(topLevelBinding) ? getStaticConfigValueState(topLevelBinding, analysis, nextVisitedExpressions) : null;
@@ -62581,8 +63011,8 @@ const getReactCompilerFlagState = (expression, analysis, visitedExpressions = /*
62581
63011
  const assignedBinding = getAssignedPropertyInitializer(unwrappedExpression, "reactCompiler");
62582
63012
  if (assignedBinding.wasFound && assignedBinding.initializer) return { isEnabled: !isStaticallyDisabledConfigExpression(assignedBinding.initializer, analysis) };
62583
63013
  if (analysis.localBindings.has(unwrappedExpression.text)) {
62584
- const localInitializer = analysis.localBindings.get(unwrappedExpression.text);
62585
- return localInitializer ? getReactCompilerFlagState(localInitializer, analysis, nextVisitedExpressions) : null;
63014
+ const localReference = analysis.localBindings.get(unwrappedExpression.text);
63015
+ return localReference?.expression ? getReactCompilerFlagState(localReference.expression, localReference.analysis, nextVisitedExpressions) : null;
62586
63016
  }
62587
63017
  const topLevelBinding = getTopLevelBinding(analysis.sourceFile, unwrappedExpression.text);
62588
63018
  return topLevelBinding && ts.isExpression(topLevelBinding) ? getReactCompilerFlagState(topLevelBinding, analysis, nextVisitedExpressions) : null;
@@ -62605,8 +63035,8 @@ const getSelectedObjectProperty = (expression, propertyName, analysis, visitedEx
62605
63035
  visitedExpressions.add(resolvedExpression);
62606
63036
  if (ts.isIdentifier(resolvedExpression)) {
62607
63037
  if (analysis.localBindings.has(resolvedExpression.text)) {
62608
- const localInitializer = analysis.localBindings.get(resolvedExpression.text);
62609
- return localInitializer ? getSelectedObjectProperty(localInitializer, propertyName, analysis, visitedExpressions) : null;
63038
+ const localReference = analysis.localBindings.get(resolvedExpression.text);
63039
+ return localReference?.expression ? getSelectedObjectProperty(localReference.expression, propertyName, localReference.analysis, visitedExpressions) : null;
62610
63040
  }
62611
63041
  const scopedBinding = getScopedConfigBinding(resolvedExpression);
62612
63042
  if (scopedBinding.wasFound) return scopedBinding.initializer ? getSelectedObjectProperty(scopedBinding.initializer, propertyName, analysis, visitedExpressions) : null;
@@ -62615,9 +63045,18 @@ const getSelectedObjectProperty = (expression, propertyName, analysis, visitedEx
62615
63045
  }
62616
63046
  if (!ts.isObjectLiteralExpression(resolvedExpression)) return null;
62617
63047
  for (const property of [...resolvedExpression.properties].reverse()) {
62618
- if (ts.isPropertyAssignment(property) && getStaticPropertyName$2(property.name) === propertyName) return property.initializer;
62619
- if (ts.isMethodDeclaration(property) && getStaticPropertyName$2(property.name) === propertyName) return property;
62620
- if (ts.isShorthandPropertyAssignment(property) && property.name.text === propertyName) return property.name;
63048
+ if (ts.isPropertyAssignment(property) && getStaticPropertyName$2(property.name) === propertyName) return {
63049
+ node: property.initializer,
63050
+ analysis
63051
+ };
63052
+ if (ts.isMethodDeclaration(property) && getStaticPropertyName$2(property.name) === propertyName) return {
63053
+ node: property,
63054
+ analysis
63055
+ };
63056
+ if (ts.isShorthandPropertyAssignment(property) && property.name.text === propertyName) return {
63057
+ node: property.name,
63058
+ analysis
63059
+ };
62621
63060
  if (ts.isSpreadAssignment(property)) {
62622
63061
  const spreadProperty = getSelectedObjectProperty(property.expression, propertyName, analysis, visitedExpressions);
62623
63062
  if (spreadProperty) return spreadProperty;
@@ -62630,8 +63069,8 @@ const configExpressionMayDefineProperty = (expression, propertyName, analysis) =
62630
63069
  while (ts.isParenthesizedExpression(resolvedExpression) || ts.isAsExpression(resolvedExpression) || ts.isTypeAssertionExpression(resolvedExpression) || ts.isSatisfiesExpression(resolvedExpression) || ts.isNonNullExpression(resolvedExpression)) resolvedExpression = resolvedExpression.expression;
62631
63070
  if (ts.isIdentifier(resolvedExpression)) {
62632
63071
  if (analysis.localBindings.has(resolvedExpression.text)) {
62633
- const localInitializer = analysis.localBindings.get(resolvedExpression.text);
62634
- return localInitializer ? configExpressionMayDefineProperty(localInitializer, propertyName, analysis) : true;
63072
+ const localReference = analysis.localBindings.get(resolvedExpression.text);
63073
+ return localReference?.expression ? configExpressionMayDefineProperty(localReference.expression, propertyName, localReference.analysis) : true;
62635
63074
  }
62636
63075
  const scopedBinding = getScopedConfigBinding(resolvedExpression);
62637
63076
  if (scopedBinding.wasFound) return scopedBinding.initializer ? configExpressionMayDefineProperty(scopedBinding.initializer, propertyName, analysis) : true;
@@ -62715,15 +63154,15 @@ const getReExportedConfigModules = (sourceFile, exportName) => {
62715
63154
  }
62716
63155
  return bindings;
62717
63156
  };
62718
- const analyzeConfigModuleExport = (filePath, exportName, allowCompilerTransform, importDepth, visitedModules, argumentsList = []) => {
63157
+ const analyzeConfigModuleExport = (filePath, exportName, allowCompilerTransform, importDepth, visitedModules, argumentsList = [], argumentAnalysis) => {
62719
63158
  if (!isFile(filePath) || importDepth > 4) return false;
62720
63159
  const moduleVisitKey = `${filePath}:${exportName}:${allowCompilerTransform}`;
62721
63160
  if (visitedModules.has(moduleVisitKey)) return false;
62722
63161
  const nextVisitedModules = new Set(visitedModules);
62723
63162
  nextVisitedModules.add(moduleVisitKey);
62724
- return analyzeConfigSourceFileExport(parseConfigSourceFile(filePath, NFS.readFileSync(filePath, "utf-8")), filePath, exportName, allowCompilerTransform, importDepth, nextVisitedModules, argumentsList);
63163
+ return analyzeConfigSourceFileExport(parseConfigSourceFile(filePath, NFS.readFileSync(filePath, "utf-8")), filePath, exportName, allowCompilerTransform, importDepth, nextVisitedModules, argumentsList, argumentAnalysis);
62725
63164
  };
62726
- const analyzeConfigSourceFileExport = (sourceFile, filePath, exportName, allowCompilerTransform, importDepth, visitedModules, argumentsList = []) => {
63165
+ const analyzeConfigSourceFileExport = (sourceFile, filePath, exportName, allowCompilerTransform, importDepth, visitedModules, argumentsList = [], argumentAnalysis) => {
62727
63166
  const analysis = {
62728
63167
  filePath,
62729
63168
  sourceFile,
@@ -62733,14 +63172,27 @@ const analyzeConfigSourceFileExport = (sourceFile, filePath, exportName, allowCo
62733
63172
  localBindings: /* @__PURE__ */ new Map(),
62734
63173
  activeFunctions: /* @__PURE__ */ new Set()
62735
63174
  };
63175
+ const resolvedArgumentAnalysis = argumentAnalysis ?? analysis;
62736
63176
  const exportedConfigNodes = getExportedConfigNodes(sourceFile, exportName);
62737
- return exportedConfigNodes.some((node) => ts.isArrowFunction(node) || ts.isFunctionExpression(node) || ts.isFunctionDeclaration(node) ? analyzeConfigFunction(node, analysis, allowCompilerTransform, argumentsList) : analyzeConfigNode(node, analysis, allowCompilerTransform)) || getReExportedConfigModules(sourceFile, exportName).some((binding) => {
63177
+ return exportedConfigNodes.some((node) => {
63178
+ if (ts.isArrowFunction(node) || ts.isFunctionExpression(node) || ts.isFunctionDeclaration(node)) return analyzeConfigFunction(node, analysis, allowCompilerTransform, argumentsList, resolvedArgumentAnalysis);
63179
+ if (argumentsList.length > 0 && ts.isIdentifier(node)) {
63180
+ const topLevelBinding = getTopLevelBinding(sourceFile, node.text);
63181
+ if (topLevelBinding && ts.isFunctionLike(topLevelBinding)) return analyzeConfigFunction(topLevelBinding, analysis, allowCompilerTransform, argumentsList, resolvedArgumentAnalysis);
63182
+ const importBinding = getImportBinding(sourceFile, node.text);
63183
+ if (importBinding) {
63184
+ const importedFilePath = resolveImportedConfigFile(filePath, importBinding.moduleSpecifier);
63185
+ return Boolean(importedFilePath && analyzeConfigModuleExport(importedFilePath, importBinding.exportName, allowCompilerTransform, importDepth + 1, visitedModules, argumentsList, resolvedArgumentAnalysis));
63186
+ }
63187
+ }
63188
+ return analyzeConfigNode(node, analysis, allowCompilerTransform);
63189
+ }) || getReExportedConfigModules(sourceFile, exportName).some((binding) => {
62738
63190
  if (exportedConfigNodes.length > 0 && binding.isNamespace) return false;
62739
63191
  const importedFilePath = resolveImportedConfigFile(filePath, binding.moduleSpecifier);
62740
- return Boolean(importedFilePath && analyzeConfigModuleExport(importedFilePath, binding.exportName, allowCompilerTransform, importDepth + 1, visitedModules, argumentsList));
63192
+ return Boolean(importedFilePath && analyzeConfigModuleExport(importedFilePath, binding.exportName, allowCompilerTransform, importDepth + 1, visitedModules, argumentsList, resolvedArgumentAnalysis));
62741
63193
  });
62742
63194
  };
62743
- const analyzeConfigFunction = (functionNode, analysis, allowCompilerTransform, argumentsList = []) => {
63195
+ const analyzeConfigFunction = (functionNode, analysis, allowCompilerTransform, argumentsList = [], argumentAnalysis = analysis) => {
62744
63196
  if (!functionNode.body) return false;
62745
63197
  if (analysis.activeFunctions.has(functionNode.pos)) return false;
62746
63198
  const activeFunctions = new Set(analysis.activeFunctions);
@@ -62748,7 +63200,7 @@ const analyzeConfigFunction = (functionNode, analysis, allowCompilerTransform, a
62748
63200
  const functionAnalysis = {
62749
63201
  ...analysis,
62750
63202
  visitedNodes: /* @__PURE__ */ new Set(),
62751
- localBindings: getFunctionLocalBindings(functionNode, argumentsList),
63203
+ localBindings: getFunctionLocalBindings(functionNode, argumentsList, argumentAnalysis, analysis),
62752
63204
  activeFunctions
62753
63205
  };
62754
63206
  if (!ts.isBlock(functionNode.body)) return analyzeConfigNode(functionNode.body, functionAnalysis, allowCompilerTransform);
@@ -62767,7 +63219,7 @@ const analyzeConfigFunction = (functionNode, analysis, allowCompilerTransform, a
62767
63219
  const analyzeImportedConfig = ({ analysis, moduleSpecifier, exportName, allowCompilerTransform, argumentsList }) => {
62768
63220
  const importedFilePath = resolveImportedConfigFile(analysis.filePath, moduleSpecifier);
62769
63221
  if (!importedFilePath) return null;
62770
- return analyzeConfigModuleExport(importedFilePath, exportName, allowCompilerTransform, analysis.importDepth + 1, analysis.visitedModules, argumentsList);
63222
+ return analyzeConfigModuleExport(importedFilePath, exportName, allowCompilerTransform, analysis.importDepth + 1, analysis.visitedModules, argumentsList, analysis);
62771
63223
  };
62772
63224
  const analyzeConfigIdentifier = (identifier, analysis, allowCompilerTransform, isCompilerTransformCollection, excludedPropertyNames) => {
62773
63225
  const assignedReactCompiler = getAssignedPropertyInitializer(identifier, "reactCompiler");
@@ -62781,8 +63233,8 @@ const analyzeConfigIdentifier = (identifier, analysis, allowCompilerTransform, i
62781
63233
  if (assignedPlugins.wasFound) overriddenPropertyNames.add("plugins");
62782
63234
  if (assignedPresets.wasFound) overriddenPropertyNames.add("presets");
62783
63235
  if (analysis.localBindings.has(identifier.text)) {
62784
- const localInitializer = analysis.localBindings.get(identifier.text);
62785
- return Boolean(localInitializer && analyzeConfigNode(localInitializer, analysis, allowCompilerTransform, isCompilerTransformCollection, overriddenPropertyNames));
63236
+ const localReference = analysis.localBindings.get(identifier.text);
63237
+ return Boolean(localReference?.expression && analyzeConfigNode(localReference.expression, localReference.analysis, allowCompilerTransform, isCompilerTransformCollection, overriddenPropertyNames));
62786
63238
  }
62787
63239
  const scopedBinding = getScopedConfigBinding(identifier);
62788
63240
  if (scopedBinding.wasFound) return Boolean(scopedBinding.initializer && analyzeConfigNode(scopedBinding.initializer, analysis, allowCompilerTransform, isCompilerTransformCollection, overriddenPropertyNames));
@@ -62848,7 +63300,7 @@ const analyzeConfigCallTarget = (callExpression, analysis, allowCompilerTransfor
62848
63300
  }
62849
63301
  const selectedProperty = getSelectedObjectProperty(target.expression, propertyName, analysis);
62850
63302
  if (selectedProperty === null) return null;
62851
- return ts.isFunctionLike(selectedProperty) ? analyzeConfigFunction(selectedProperty, analysis, allowCompilerTransform, callExpression.arguments) : analyzeConfigNode(selectedProperty, analysis, allowCompilerTransform);
63303
+ return ts.isFunctionLike(selectedProperty.node) ? analyzeConfigFunction(selectedProperty.node, selectedProperty.analysis, allowCompilerTransform, callExpression.arguments, analysis) : analyzeConfigNode(selectedProperty.node, selectedProperty.analysis, allowCompilerTransform);
62852
63304
  };
62853
63305
  const analyzeConfigNode = (node, analysis, allowCompilerTransform, isCompilerTransformCollection = false, excludedPropertyNames) => {
62854
63306
  const excludedPropertiesVisitKey = excludedPropertyNames ? [...excludedPropertyNames].sort().join(",") : "";
@@ -62948,7 +63400,7 @@ const analyzeConfigNode = (node, analysis, allowCompilerTransform, isCompilerTra
62948
63400
  if (ts.isIdentifier(node.expression)) {
62949
63401
  if (analysis.localBindings.has(node.expression.text) || getScopedConfigBinding(node.expression).wasFound) {
62950
63402
  const selectedProperty = getSelectedObjectProperty(node.expression, node.name.text, analysis);
62951
- return Boolean(selectedProperty && analyzeConfigNode(selectedProperty, analysis, allowCompilerTransform));
63403
+ return Boolean(selectedProperty && analyzeConfigNode(selectedProperty.node, selectedProperty.analysis, allowCompilerTransform));
62952
63404
  }
62953
63405
  const importBinding = getImportBinding(analysis.sourceFile, node.expression.text);
62954
63406
  if (importBinding?.isNamespace) {
@@ -62962,7 +63414,7 @@ const analyzeConfigNode = (node, analysis, allowCompilerTransform, isCompilerTra
62962
63414
  return false;
62963
63415
  }
62964
63416
  const selectedProperty = getSelectedObjectProperty(node.expression, node.name.text, analysis);
62965
- if (selectedProperty) return analyzeConfigNode(selectedProperty, analysis, allowCompilerTransform);
63417
+ if (selectedProperty) return analyzeConfigNode(selectedProperty.node, selectedProperty.analysis, allowCompilerTransform);
62966
63418
  return false;
62967
63419
  }
62968
63420
  return analyzeConfigNode(node.expression, analysis, allowCompilerTransform);
@@ -62971,7 +63423,7 @@ const analyzeConfigNode = (node, analysis, allowCompilerTransform, isCompilerTra
62971
63423
  if (ts.isIdentifier(node.expression)) {
62972
63424
  if (analysis.localBindings.has(node.expression.text) || getScopedConfigBinding(node.expression).wasFound) {
62973
63425
  const selectedProperty = getSelectedObjectProperty(node.expression, node.argumentExpression.text, analysis);
62974
- return Boolean(selectedProperty && analyzeConfigNode(selectedProperty, analysis, allowCompilerTransform));
63426
+ return Boolean(selectedProperty && analyzeConfigNode(selectedProperty.node, selectedProperty.analysis, allowCompilerTransform));
62975
63427
  }
62976
63428
  const importBinding = getImportBinding(analysis.sourceFile, node.expression.text);
62977
63429
  if (importBinding?.isNamespace) {
@@ -62984,7 +63436,7 @@ const analyzeConfigNode = (node, analysis, allowCompilerTransform, isCompilerTra
62984
63436
  }));
62985
63437
  }
62986
63438
  const selectedProperty = getSelectedObjectProperty(node.expression, node.argumentExpression.text, analysis);
62987
- if (selectedProperty) return analyzeConfigNode(selectedProperty, analysis, allowCompilerTransform);
63439
+ if (selectedProperty) return analyzeConfigNode(selectedProperty.node, selectedProperty.analysis, allowCompilerTransform);
62988
63440
  return false;
62989
63441
  }
62990
63442
  return analyzeConfigNode(node.expression, analysis, allowCompilerTransform);
@@ -65221,7 +65673,7 @@ const evaluateSuppression = (lines, diagnosticLineIndex, ruleId) => {
65221
65673
  const getDiagnosticRuleIdentity = (diagnostic) => ({
65222
65674
  ruleKey: `${diagnostic.plugin}/${diagnostic.rule}`,
65223
65675
  category: diagnostic.category,
65224
- tags: diagnostic.plugin === "react-doctor" ? reactDoctorPlugin.rules[diagnostic.rule]?.tags ?? [] : []
65676
+ tags: diagnostic.plugin === "react-doctor" ? REACT_DOCTOR_RULE_REGISTRY[diagnostic.rule]?.tags ?? [] : []
65225
65677
  });
65226
65678
  const compileIgnoredFilePatterns = (userConfig) => {
65227
65679
  const files = userConfig?.ignore?.files;
@@ -65361,6 +65813,7 @@ const classifyPackageRole = (filename) => {
65361
65813
  * Resolves the absolute path to read for a diagnostic's `filePath`,
65362
65814
  * accounting for the various shapes oxlint emits:
65363
65815
  *
65816
+ * - `file://` URL — decode to an absolute filesystem path.
65364
65817
  * - Absolute POSIX (`/abs/path/file.tsx`) — pass through.
65365
65818
  * - Absolute Windows (`C:/...` or `C:\...`) — pass through.
65366
65819
  * - `./relative` or bare relative — join against `rootDirectory`.
@@ -65370,6 +65823,7 @@ const classifyPackageRole = (filename) => {
65370
65823
  * use one canonical resolution path.
65371
65824
  */
65372
65825
  const resolveCandidateReadPath = (rootDirectory, filePath) => {
65826
+ if (filePath.startsWith("file://")) return fileURLToPath(filePath);
65373
65827
  const normalizedFile = filePath.replace(/\\/g, "/");
65374
65828
  if (normalizedFile.startsWith("/") || /^[a-zA-Z]:\//.test(normalizedFile) || /^[a-zA-Z]:\\/.test(filePath)) return filePath;
65375
65829
  return `${rootDirectory.replace(/\\/g, "/").replace(/\/$/, "")}/${normalizedFile.replace(/^\.\//, "")}`;
@@ -65571,7 +66025,7 @@ const buildDiagnosticPipeline = (input) => {
65571
66025
  };
65572
66026
  const shouldAutoSuppress = (diagnostic) => {
65573
66027
  if (diagnostic.plugin !== "react-doctor") return false;
65574
- const rule = reactDoctorPlugin.rules[diagnostic.rule];
66028
+ const rule = REACT_DOCTOR_RULE_REGISTRY[diagnostic.rule];
65575
66029
  if (!rule?.tags?.includes("test-noise")) return false;
65576
66030
  if (rule.tags.includes("migration-hint")) return false;
65577
66031
  return getFileContext(diagnostic.filePath) !== "production";
@@ -66003,6 +66457,7 @@ var OxlintConcurrency = class extends Reference("react-doctor/OxlintConcurrency"
66003
66457
  if (Number.isInteger(parsed) && parsed > 0) return resolveScanConcurrency(parsed);
66004
66458
  return resolveAutoScanConcurrency();
66005
66459
  } }) {};
66460
+ var OxlintSpawnSlots = class extends Reference("react-doctor/OxlintSpawnSlots", { defaultValue: () => null }) {};
66006
66461
  /**
66007
66462
  * Three-state control for overlapping the dead-code pass with the lint pass —
66008
66463
  * forking dead-code as a child fiber that runs DURING lint instead of strictly
@@ -68325,8 +68780,8 @@ const getCapabilities = (project) => {
68325
68780
  const cached = capabilitiesByProject.get(project);
68326
68781
  if (cached !== void 0) return cached;
68327
68782
  const capabilities = new Set(buildCapabilities(project));
68328
- const packageJson = readPackageJson(Path.join(project.rootDirectory, "package.json"));
68329
- const targetBlankOpenerProtection = detectTargetBlankOpenerProtection(project.rootDirectory, packageJson);
68783
+ const capabilityRootDirectory = isFile(Path.join(project.rootDirectory, "package.json")) ? project.rootDirectory : findNearestAncestorPackageJson(project.rootDirectory) ?? project.rootDirectory;
68784
+ const targetBlankOpenerProtection = detectTargetBlankOpenerProtection(capabilityRootDirectory, readPackageJson(Path.join(capabilityRootDirectory, "package.json")));
68330
68785
  if (targetBlankOpenerProtection !== void 0) capabilities.add("target-blank-needs-explicit-protection");
68331
68786
  if (targetBlankOpenerProtection === "noreferrer") capabilities.add("target-blank-needs-noreferrer");
68332
68787
  capabilitiesByProject.set(project, capabilities);
@@ -68356,7 +68811,7 @@ const createSecurityScanSession = (rootDirectory, options) => {
68356
68811
  const capabilities = options.project ? getCapabilities(options.project) : /* @__PURE__ */ new Set();
68357
68812
  const ignoredTags = options.ignoredTags ?? /* @__PURE__ */ new Set();
68358
68813
  const includedTags = options.includedTags ?? /* @__PURE__ */ new Set();
68359
- const enabledScanRules = REACT_DOCTOR_RULES.flatMap((entry) => {
68814
+ const enabledScanRules = REACT_DOCTOR_SCAN_RULES.flatMap((entry) => {
68360
68815
  const rule = entry.rule;
68361
68816
  const scan = rule.scan;
68362
68817
  if (typeof scan !== "function") return [];
@@ -68801,47 +69256,55 @@ const resolveDeadCodeConcurrency = (facts = readSystemFacts()) => {
68801
69256
  const memoryBoundedWorkers = Math.floor(availableMemoryBytes / DEAD_CODE_WORKER_MEM_BUDGET_BYTES);
68802
69257
  return Math.max(1, Math.min(facts.availableCores, memoryBoundedWorkers));
68803
69258
  };
68804
- let availableSlots = -1;
68805
- const waiters = [];
68806
- const releaseSlot = () => {
68807
- const nextWaiter = waiters.shift();
68808
- if (nextWaiter !== void 0) nextWaiter();
68809
- else availableSlots += 1;
69259
+ const createWorkerSlots = (input) => {
69260
+ let availableSlotCount = input.slotCount;
69261
+ const waiters = [];
69262
+ const releaseSlot = () => {
69263
+ const nextWaiter = waiters.shift();
69264
+ if (nextWaiter === void 0) {
69265
+ availableSlotCount += 1;
69266
+ return;
69267
+ }
69268
+ nextWaiter.abortSignal?.removeEventListener("abort", nextWaiter.onAbort);
69269
+ nextWaiter.resolve();
69270
+ };
69271
+ const acquireSlot = async (abortSignal) => {
69272
+ if (abortSignal?.aborted) throw input.createAbortError();
69273
+ if (availableSlotCount > 0) {
69274
+ availableSlotCount -= 1;
69275
+ return;
69276
+ }
69277
+ await new Promise((resolve, reject) => {
69278
+ const onAbort = () => {
69279
+ const waiterIndex = waiters.indexOf(waiter);
69280
+ if (waiterIndex !== -1) waiters.splice(waiterIndex, 1);
69281
+ reject(input.createAbortError());
69282
+ };
69283
+ const waiter = {
69284
+ resolve,
69285
+ abortSignal,
69286
+ onAbort
69287
+ };
69288
+ waiters.push(waiter);
69289
+ abortSignal?.addEventListener("abort", onAbort, { once: true });
69290
+ });
69291
+ };
69292
+ return { run: async (task, abortSignal) => {
69293
+ await acquireSlot(abortSignal);
69294
+ try {
69295
+ return await task();
69296
+ } finally {
69297
+ releaseSlot();
69298
+ }
69299
+ } };
68810
69300
  };
68811
- /**
68812
- * Runs `task` once a dead-code worker slot is free, releasing the slot when the
68813
- * task settles (success or failure). With a high cap (roomy machine) every
68814
- * caller proceeds immediately; with a low cap (constrained runner) callers
68815
- * queue and run as slots free.
68816
- *
68817
- * `abortSignal` short-circuits the WAIT: if it's already aborted, or fires while
68818
- * this caller is queued, the call rejects without acquiring a slot or running
68819
- * `task` — so a cancelled scan (e.g. lint failed) doesn't sit in the queue and
68820
- * then spawn a child only to tear it down. A queued caller that aborts removes
68821
- * its own waiter so a later release never hands a slot to a dead request.
68822
- */
69301
+ let deadCodeWorkerSlots = null;
68823
69302
  const withDeadCodeWorkerSlot = async (task, abortSignal) => {
68824
- if (abortSignal?.aborted) throw new Error("Dead-code worker aborted.");
68825
- if (availableSlots < 0) availableSlots = resolveDeadCodeConcurrency();
68826
- if (availableSlots > 0) availableSlots -= 1;
68827
- else await new Promise((resolve, reject) => {
68828
- const waiter = () => {
68829
- abortSignal?.removeEventListener("abort", onAbort);
68830
- resolve();
68831
- };
68832
- const onAbort = () => {
68833
- const queuedIndex = waiters.indexOf(waiter);
68834
- if (queuedIndex !== -1) waiters.splice(queuedIndex, 1);
68835
- reject(/* @__PURE__ */ new Error("Dead-code worker aborted."));
68836
- };
68837
- waiters.push(waiter);
68838
- abortSignal?.addEventListener("abort", onAbort, { once: true });
69303
+ deadCodeWorkerSlots ??= createWorkerSlots({
69304
+ slotCount: resolveDeadCodeConcurrency(),
69305
+ createAbortError: () => /* @__PURE__ */ new Error("Dead-code worker aborted.")
68839
69306
  });
68840
- try {
68841
- return await task();
68842
- } finally {
68843
- releaseSlot();
68844
- }
69307
+ return deadCodeWorkerSlots.run(task, abortSignal);
68845
69308
  };
68846
69309
  const projectCacheSubdir = (projectDirectory) => crypto.createHash("sha256").update(projectDirectory).digest("hex").slice(0, 16);
68847
69310
  const resolveReactDoctorCacheDir = (projectDirectory) => {
@@ -69634,7 +70097,10 @@ var Git = class Git extends Service()("react-doctor/Git") {
69634
70097
  if (argvLengthChars > spawnArgsLengthCap) return yield* foldSpawnFailure(`spawn ENAMETOOLONG (${argvLengthChars} argv chars exceed ${spawnArgsLengthCap})`);
69635
70098
  const handle = yield* spawner.spawn(make$1(input.command, [...input.args], {
69636
70099
  cwd: input.directory,
69637
- env: input.env,
70100
+ env: input.command === "git" ? {
70101
+ ...input.env,
70102
+ GIT_DIR: void 0
70103
+ } : input.env,
69638
70104
  extendEnv: true
69639
70105
  }));
69640
70106
  const maxStdoutBytes = input.maxStdoutBytes;
@@ -69907,7 +70373,7 @@ var Git = class Git extends Service()("react-doctor/Git") {
69907
70373
  "--diff-filter=ACMR",
69908
70374
  "--relative"
69909
70375
  ]).pipe(map$3((result) => {
69910
- if (result.status !== 0) return [];
70376
+ if (result.status !== 0) return null;
69911
70377
  return splitNullSeparated(result.stdout);
69912
70378
  })),
69913
70379
  showStagedContent: (directory, relativePath, options) => runCommand({
@@ -70365,12 +70831,12 @@ const createOxlintConfig = ({ pluginPath, project, customRulesOnly = false, exte
70365
70831
  const settingsRootDirectory = resolveSettingsRootDirectory(project.rootDirectory);
70366
70832
  const enabledReactDoctorRules = {};
70367
70833
  for (const registryEntry of REACT_DOCTOR_RULES) {
70368
- const rule = reactDoctorPlugin.rules[registryEntry.id];
70834
+ const rule = REACT_DOCTOR_RULE_REGISTRY[registryEntry.id];
70369
70835
  if (!rule) continue;
70370
70836
  if (ruleSelection === "cacheable" && CROSS_FILE_RULE_IDS.has(registryEntry.id)) continue;
70371
70837
  if (ruleSelection === "sidecar" && !CROSS_FILE_RULE_IDS.has(registryEntry.id)) continue;
70372
70838
  if (ruleSelection === "sidecar" && sidecarRuleIdFilter !== void 0 && !sidecarRuleIdFilter.has(registryEntry.id)) continue;
70373
- if (rule.scan !== void 0) continue;
70839
+ if (rule.isScanRule) continue;
70374
70840
  if (customRulesOnly && registryEntry.originallyExternal) continue;
70375
70841
  if (rule.framework !== "global" && !rule.requires) continue;
70376
70842
  if (!shouldEnableRule(rule.requires, rule.tags, capabilities, ignoredTags, rule.disabledWhen, includedTags)) continue;
@@ -70995,6 +71461,50 @@ const columnOfUtf8Offset = (sourceBuffer, utf8Offset) => {
70995
71461
  while (lineStartOffset > 0 && sourceBuffer[lineStartOffset - 1] !== 10) lineStartOffset--;
70996
71462
  return sourceBuffer.subarray(lineStartOffset, boundedOffset).toString("utf8").length + 1;
70997
71463
  };
71464
+ const utf8OffsetFromSourcePosition = (sourceBuffer, lineNumber, zeroBasedColumn) => {
71465
+ if (lineNumber < 1 || zeroBasedColumn < 0) return null;
71466
+ const sourceLines = sourceBuffer.toString("utf8").split("\n");
71467
+ const sourceLine = sourceLines[lineNumber - 1];
71468
+ if (sourceLine === void 0 || zeroBasedColumn > sourceLine.length) return null;
71469
+ const precedingLines = sourceLines.slice(0, lineNumber - 1).join("\n");
71470
+ return (lineNumber === 1 ? 0 : Buffer.byteLength(precedingLines) + Buffer.byteLength("\n")) + Buffer.byteLength(sourceLine.slice(0, zeroBasedColumn));
71471
+ };
71472
+ const mapPreparedSourceSpan = (span, preparedSourceMap) => {
71473
+ const generatedLine = lineOfUtf8Offset(preparedSourceMap.generatedBuffer, span.offset);
71474
+ const generatedColumn = columnOfUtf8Offset(preparedSourceMap.generatedBuffer, span.offset) - 1;
71475
+ const originalStart = originalPositionFor(preparedSourceMap.traceMap, {
71476
+ line: generatedLine,
71477
+ column: generatedColumn
71478
+ });
71479
+ if (originalStart.source === null || originalStart.line === null || originalStart.column === null) return null;
71480
+ const originalOffset = utf8OffsetFromSourcePosition(preparedSourceMap.sourceBuffer, originalStart.line, originalStart.column);
71481
+ if (originalOffset === null) return null;
71482
+ const generatedSpan = preparedSourceMap.generatedBuffer.subarray(span.offset, span.offset + span.length);
71483
+ return {
71484
+ offset: originalOffset,
71485
+ length: preparedSourceMap.sourceBuffer.subarray(originalOffset, originalOffset + generatedSpan.length).equals(generatedSpan) ? generatedSpan.length : 0,
71486
+ line: originalStart.line,
71487
+ column: originalStart.column + 1
71488
+ };
71489
+ };
71490
+ const mapPreparedSourceLabels = (labels, preparedSourceMap) => {
71491
+ const primaryLabel = labels[0];
71492
+ if (primaryLabel === void 0) return null;
71493
+ const primarySpan = mapPreparedSourceSpan(primaryLabel.span, preparedSourceMap);
71494
+ if (primarySpan === null) return null;
71495
+ const mappedLabels = [{
71496
+ ...primaryLabel,
71497
+ span: primarySpan
71498
+ }];
71499
+ for (const relatedLabel of labels.slice(1)) {
71500
+ const relatedSpan = mapPreparedSourceSpan(relatedLabel.span, preparedSourceMap);
71501
+ if (relatedSpan !== null) mappedLabels.push({
71502
+ ...relatedLabel,
71503
+ span: relatedSpan
71504
+ });
71505
+ }
71506
+ return mappedLabels;
71507
+ };
70998
71508
  const REDACTED_PLACEHOLDER = "<redacted>";
70999
71509
  const KEEP_PREFIX = `$1${REDACTED_PLACEHOLDER}`;
71000
71510
  const KNOWN_SECRET_RULES = [
@@ -71637,7 +72147,7 @@ const PLUGIN_CATEGORY_MAP = {
71637
72147
  };
71638
72148
  const lookupOwnString = (record, key) => Object.hasOwn(record, key) ? record[key] : void 0;
71639
72149
  const getRuleRecommendation = (ruleName, project) => {
71640
- const rule = reactDoctorPlugin.rules[ruleName];
72150
+ const rule = REACT_DOCTOR_RULE_REGISTRY[ruleName];
71641
72151
  if (!rule) return void 0;
71642
72152
  if (rule.recommendationFor) {
71643
72153
  const capabilities = getCapabilities(project);
@@ -71646,8 +72156,8 @@ const getRuleRecommendation = (ruleName, project) => {
71646
72156
  }
71647
72157
  return rule.recommendation;
71648
72158
  };
71649
- const getRuleCategory = (ruleName) => reactDoctorPlugin.rules[ruleName]?.category;
71650
- const getRuleTitle = (ruleName) => reactDoctorPlugin.rules[ruleName]?.title;
72159
+ const getRuleCategory = (ruleName) => REACT_DOCTOR_RULE_REGISTRY[ruleName]?.category;
72160
+ const getRuleTitle = (ruleName) => REACT_DOCTOR_RULE_REGISTRY[ruleName]?.title;
71651
72161
  const resolveDiagnosticTitle = (plugin, rule) => {
71652
72162
  if (plugin !== "react-hooks-js") return getRuleTitle(rule);
71653
72163
  if (rule === "error-boundaries") return REACT_ERROR_BOUNDARY_TITLE;
@@ -71702,7 +72212,7 @@ const resolveDiagnosticCategory = (plugin, rule) => {
71702
72212
  if (plugin === "react-hooks-js" && rule === "error-boundaries") return "Bugs";
71703
72213
  return getRuleCategory(rule) ?? lookupOwnString(PLUGIN_CATEGORY_MAP, plugin) ?? "Bugs";
71704
72214
  };
71705
- const resolveMatchByOccurrence = (rule, category) => OCCURRENCE_MATCHED_CATEGORIES.has(category) || Boolean(reactDoctorPlugin.rules[rule]?.matchByOccurrence);
72215
+ const resolveMatchByOccurrence = (rule, category) => OCCURRENCE_MATCHED_CATEGORIES.has(category) || Boolean(REACT_DOCTOR_RULE_REGISTRY[rule]?.matchByOccurrence);
71706
72216
  /**
71707
72217
  * Maps oxlint's non-primary labels (`labels[1..]`) into related source
71708
72218
  * locations. Editors surface these as a diagnostic's
@@ -71739,7 +72249,7 @@ const isOxlintOutput = (value) => isRecord(value) && Array.isArray(value.diagnos
71739
72249
  * to the first `{`. Raises `OxlintOutputUnparseable` when the
71740
72250
  * stdout isn't valid JSON or doesn't carry a `diagnostics` array.
71741
72251
  */
71742
- const parseOxlintOutput = (stdout, project, rootDirectory, sourcePathByLintPath) => {
72252
+ const parseOxlintOutput = (stdout, project, rootDirectory, sourcePathByLintPath, sourceMapByLintPath) => {
71743
72253
  if (!stdout) return [];
71744
72254
  const jsonStart = stdout.indexOf("{");
71745
72255
  const sanitizedStdout = jsonStart > 0 ? stdout.slice(jsonStart) : stdout;
@@ -71757,6 +72267,7 @@ const parseOxlintOutput = (stdout, project, rootDirectory, sourcePathByLintPath)
71757
72267
  const sourceLinesCache = /* @__PURE__ */ new Map();
71758
72268
  const resolveAbsolutePath = (filename) => Path.isAbsolute(filename) ? filename : Path.resolve(rootDirectory || ".", filename);
71759
72269
  const resolveMappedSourceFilename = (filename) => sourcePathByLintPath?.get(Path.normalize(resolveAbsolutePath(filename)));
72270
+ const resolvePreparedSourceMap = (filename) => sourceMapByLintPath?.get(Path.normalize(resolveAbsolutePath(filename)));
71760
72271
  const resolveSourceFilename = (filename) => resolveMappedSourceFilename(filename) ?? filename;
71761
72272
  const readSourceBuffer = (filename) => {
71762
72273
  const absolutePath = resolveAbsolutePath(resolveSourceFilename(filename));
@@ -71788,7 +72299,19 @@ const parseOxlintOutput = (stdout, project, rootDirectory, sourcePathByLintPath)
71788
72299
  minifiedFileCache.set(absolutePath, minified);
71789
72300
  return minified;
71790
72301
  };
71791
- return suppressMemoizationInBailedOutFunctions(parsed.diagnostics.filter((diagnostic) => isMappableOxlintDiagnostic(diagnostic) && isLintableSourceFile(resolveSourceFilename(diagnostic.filename)) && !(TYPESCRIPT_DECLARATION_FILE_PATTERN.test(diagnostic.filename) && OXLINT_IGNORED_DECLARATION_DIAGNOSTIC_CODES.has(diagnostic.code)) && !isMinifiedDiagnosticFile(diagnostic.filename) && !shouldSuppressLocalUseHookDiagnostic(diagnostic, rootDirectory) && !shouldSuppressCompilerFindingInWorklet(diagnostic, project, rootDirectory)).map((diagnostic) => {
72302
+ return suppressMemoizationInBailedOutFunctions(parsed.diagnostics.flatMap((diagnostic) => {
72303
+ const preparedSourceMap = resolvePreparedSourceMap(diagnostic.filename);
72304
+ if (preparedSourceMap === void 0) return [diagnostic];
72305
+ const { plugin, rule } = parseRuleCode(diagnostic.code);
72306
+ if (plugin !== "react-doctor" || !REACT_DOCTOR_RULE_REGISTRY[rule]?.tags?.includes("design")) return [];
72307
+ const labels = mapPreparedSourceLabels(diagnostic.labels, preparedSourceMap);
72308
+ const sourceFilename = resolveMappedSourceFilename(diagnostic.filename);
72309
+ return labels === null || sourceFilename === void 0 ? [] : [{
72310
+ ...diagnostic,
72311
+ filename: sourceFilename,
72312
+ labels
72313
+ }];
72314
+ }).filter((diagnostic) => isMappableOxlintDiagnostic(diagnostic) && isLintableSourceFile(resolveSourceFilename(diagnostic.filename)) && !(TYPESCRIPT_DECLARATION_FILE_PATTERN.test(diagnostic.filename) && OXLINT_IGNORED_DECLARATION_DIAGNOSTIC_CODES.has(diagnostic.code)) && !isMinifiedDiagnosticFile(diagnostic.filename) && !shouldSuppressLocalUseHookDiagnostic(diagnostic, rootDirectory) && !shouldSuppressCompilerFindingInWorklet(diagnostic, project, rootDirectory)).map((diagnostic) => {
71792
72315
  const { plugin, rule } = parseRuleCode(diagnostic.code);
71793
72316
  const primaryLabel = diagnostic.labels[0];
71794
72317
  const cleaned = cleanDiagnosticMessage(diagnostic.message, diagnostic.help, plugin, rule, project);
@@ -71866,11 +72389,12 @@ const SANITIZED_ENV = buildOxlintChildEnv(process.env);
71866
72389
  * The first three are splittable (the caller's binary-split retry
71867
72390
  * shrinks the batch and re-spawns); the fourth isn't.
71868
72391
  */
71869
- const spawnOxlint = (args, rootDirectory, nodeBinaryPath, spawnTimeoutMs = OXLINT_SPAWN_TIMEOUT_MS, outputMaxBytes = OXLINT_OUTPUT_MAX_BYTES, abortSignal) => new Promise((resolve, reject) => {
72392
+ const spawnOxlint = (args, rootDirectory, nodeBinaryPath, spawnTimeoutMs = OXLINT_SPAWN_TIMEOUT_MS, outputMaxBytes = OXLINT_OUTPUT_MAX_BYTES, abortSignal, onSpawn) => new Promise((resolve, reject) => {
71870
72393
  if (abortSignal?.aborted) {
71871
72394
  reject(new ReactDoctorError({ reason: new OxlintSpawnFailed({ cause: "lint phase aborted" }) }));
71872
72395
  return;
71873
72396
  }
72397
+ onSpawn?.();
71874
72398
  const child = spawn(nodeBinaryPath, buildProfiledNodeArguments({
71875
72399
  argumentsList: args,
71876
72400
  cpuProfileDirectory: SANITIZED_ENV.REACT_DOCTOR_CPU_PROFILE_DIR,
@@ -72006,7 +72530,7 @@ const isParallelismRelatedSpawnError = (error) => {
72006
72530
  * loop with a slimmer config in that case.
72007
72531
  */
72008
72532
  const spawnLintBatches = async (input) => {
72009
- const { baseArgs, fileBatches, rootDirectory, nodeBinaryPath, project, sourcePathByLintPath, onPartialFailure, onFileProgress, spawnTimeoutMs, outputMaxBytes, splitTotalBudgetMs = OXLINT_SPLIT_TOTAL_BUDGET_MS, splitMaxDepth = 8, signal, deadlineEpochMs } = input;
72533
+ const { baseArgs, fileBatches, rootDirectory, nodeBinaryPath, project, sourcePathByLintPath, sourceMapByLintPath, onPartialFailure, onFileProgress, spawnTimeoutMs, outputMaxBytes, splitTotalBudgetMs = OXLINT_SPLIT_TOTAL_BUDGET_MS, splitMaxDepth = 8, signal, deadlineEpochMs } = input;
72010
72534
  const resolveSourcePath = (filePath) => {
72011
72535
  const absoluteFilePath = Path.isAbsolute(filePath) ? filePath : Path.resolve(rootDirectory, filePath);
72012
72536
  return sourcePathByLintPath?.get(Path.normalize(absoluteFilePath)) ?? filePath;
@@ -72030,7 +72554,21 @@ const spawnLintBatches = async (input) => {
72030
72554
  }
72031
72555
  const batchArgs = [...baseArgs, ...batch];
72032
72556
  try {
72033
- return parseOxlintOutput(await spawnOxlint(batchArgs, rootDirectory, nodeBinaryPath, spawnTimeoutMs, outputMaxBytes, signal), project, rootDirectory, sourcePathByLintPath);
72557
+ const spawnBatch = () => {
72558
+ if (isPastDeadline()) {
72559
+ deadlineSkippedFiles.push(...batch);
72560
+ batchState.deadlineSkippedFileCount += batch.length;
72561
+ return Promise.resolve(null);
72562
+ }
72563
+ return spawnOxlint(batchArgs, rootDirectory, nodeBinaryPath, spawnTimeoutMs, outputMaxBytes, signal, () => {
72564
+ if (batchState.didStart) return;
72565
+ batchState.didStart = true;
72566
+ startedFileCount += batchState.initialFileCount;
72567
+ });
72568
+ };
72569
+ const stdout = input.spawnSlots === void 0 ? await spawnBatch() : await input.spawnSlots.run(spawnBatch, signal);
72570
+ if (stdout === null) return [];
72571
+ return parseOxlintOutput(stdout, project, rootDirectory, sourcePathByLintPath, sourceMapByLintPath);
72034
72572
  } catch (error) {
72035
72573
  if (!isSplittableReactDoctorError(error)) throw error;
72036
72574
  if (isPastDeadline()) {
@@ -72074,14 +72612,15 @@ const spawnLintBatches = async (input) => {
72074
72612
  deadlineSkippedFiles.push(...batch);
72075
72613
  return [];
72076
72614
  }
72077
- startedFileCount += batch.length;
72078
72615
  const batchState = {
72079
72616
  deadlineMs: null,
72080
- deadlineSkippedFileCount: 0
72617
+ deadlineSkippedFileCount: 0,
72618
+ didStart: false,
72619
+ initialFileCount: batch.length
72081
72620
  };
72082
72621
  const batchDiagnostics = await spawnLintBatch(batch, 0, batchState);
72083
72622
  scannedFileCount += batch.length - batchState.deadlineSkippedFileCount;
72084
- if (passOnFileProgress) {
72623
+ if (passOnFileProgress && batchState.didStart) {
72085
72624
  displayedFileCount = Math.min(Math.max(displayedFileCount, scannedFileCount), totalFileCount);
72086
72625
  passOnFileProgress(displayedFileCount, totalFileCount);
72087
72626
  }
@@ -72165,8 +72704,8 @@ const validateRuleRegistration = () => {
72165
72704
  for (const fullKey of ALL_REACT_DOCTOR_RULE_KEYS) {
72166
72705
  const ruleName = fullKey.replace(/^react-doctor\//, "");
72167
72706
  if (!getRuleCategory(ruleName)) missingCategory.push(fullKey);
72168
- if (!reactDoctorPlugin.rules[ruleName]?.recommendation) missingHelp.push(fullKey);
72169
- if (FRAMEWORK_SPECIFIC_RULE_KEYS.has(fullKey) && !reactDoctorPlugin.rules[ruleName]?.requires) missingMetadata.push(fullKey);
72707
+ if (!REACT_DOCTOR_RULE_REGISTRY[ruleName]?.recommendation) missingHelp.push(fullKey);
72708
+ if (FRAMEWORK_SPECIFIC_RULE_KEYS.has(fullKey) && !REACT_DOCTOR_RULE_REGISTRY[ruleName]?.requires) missingMetadata.push(fullKey);
72170
72709
  }
72171
72710
  if (missingCategory.length === 0 && missingHelp.length === 0 && missingMetadata.length === 0) return;
72172
72711
  const detail = [
@@ -72469,20 +73008,47 @@ const prepareHtmlScriptSource = (sourceBuffer) => {
72469
73008
  lintBuffer: maskedBuffer ?? sourceBuffer
72470
73009
  };
72471
73010
  };
72472
- const prepareHtmlLintSources = (rootDirectory, temporaryDirectory, candidateFiles) => {
73011
+ const ASTRO_FILE_PATTERN = /\.astro$/;
73012
+ const prepareLintSources = (rootDirectory, temporaryDirectory, candidateFiles) => {
72473
73013
  const lintFiles = [];
72474
73014
  const sourcePathByLintPath = /* @__PURE__ */ new Map();
73015
+ const sourceMapByLintPath = /* @__PURE__ */ new Map();
72475
73016
  const sizeByLintPath = /* @__PURE__ */ new Map();
72476
73017
  const htmlSourcesDirectory = Path.join(temporaryDirectory, "html-sources");
73018
+ const astroSourcesDirectory = Path.join(temporaryDirectory, "astro-sources");
72477
73019
  let htmlFileIndex = 0;
73020
+ let astroFileIndex = 0;
72478
73021
  let hasThreeModuleImport = false;
72479
73022
  for (const candidateFile of candidateFiles) {
72480
- if (!HTML_FILE_PATTERN.test(candidateFile)) {
73023
+ if (!HTML_FILE_PATTERN.test(candidateFile) && !ASTRO_FILE_PATTERN.test(candidateFile)) {
72481
73024
  lintFiles.push(candidateFile);
72482
73025
  continue;
72483
73026
  }
72484
73027
  const absoluteSourcePath = Path.isAbsolute(candidateFile) ? candidateFile : Path.resolve(rootDirectory, candidateFile);
72485
73028
  const sourceBuffer = NFS.readFileSync(absoluteSourcePath);
73029
+ if (ASTRO_FILE_PATTERN.test(candidateFile)) {
73030
+ const compilerSourcePath = absoluteSourcePath.replaceAll("\\", "/");
73031
+ const convertedSource = convertToTSX(sourceBuffer.toString("utf8"), {
73032
+ filename: compilerSourcePath,
73033
+ sourcemap: "external",
73034
+ includeScripts: true
73035
+ });
73036
+ if (astroFileIndex === 0) NFS.mkdirSync(astroSourcesDirectory, { recursive: true });
73037
+ const lintPath = Path.join(astroSourcesDirectory, `${astroFileIndex}.tsx`);
73038
+ const generatedBuffer = Buffer.from(convertedSource.code);
73039
+ NFS.writeFileSync(lintPath, generatedBuffer);
73040
+ lintFiles.push(candidateFile);
73041
+ lintFiles.push(lintPath);
73042
+ sourcePathByLintPath.set(Path.resolve(lintPath), candidateFile);
73043
+ sourceMapByLintPath.set(Path.resolve(lintPath), {
73044
+ traceMap: new TraceMap(JSON.stringify(convertedSource.map)),
73045
+ generatedBuffer,
73046
+ sourceBuffer
73047
+ });
73048
+ sizeByLintPath.set(lintPath, sourceBuffer.length);
73049
+ astroFileIndex++;
73050
+ continue;
73051
+ }
72486
73052
  const { executableScriptBodies, lintBuffer } = prepareHtmlScriptSource(sourceBuffer);
72487
73053
  if (htmlFileIndex === 0) NFS.mkdirSync(htmlSourcesDirectory, { recursive: true });
72488
73054
  const lintPath = Path.join(htmlSourcesDirectory, `${htmlFileIndex}.astro`);
@@ -72496,6 +73062,7 @@ const prepareHtmlLintSources = (rootDirectory, temporaryDirectory, candidateFile
72496
73062
  return {
72497
73063
  lintFiles,
72498
73064
  sourcePathByLintPath,
73065
+ sourceMapByLintPath,
72499
73066
  sizeByLintPath,
72500
73067
  hasThreeModuleImport
72501
73068
  };
@@ -72714,10 +73281,10 @@ const runOxlint = async (options) => {
72714
73281
  rootDirectory,
72715
73282
  candidateFiles
72716
73283
  });
72717
- const preparedHtmlSources = prepareHtmlLintSources(rootDirectory, configDirectory, candidateFiles);
72718
- const lintFiles = preparedHtmlSources.lintFiles;
72719
- const hasHtmlFiles = preparedHtmlSources.sourcePathByLintPath.size > 0;
72720
- const lintProject = !project.hasThree && preparedHtmlSources.hasThreeModuleImport ? {
73284
+ const preparedLintSources = prepareLintSources(rootDirectory, configDirectory, candidateFiles);
73285
+ const lintFiles = preparedLintSources.lintFiles;
73286
+ const hasPreparedFiles = preparedLintSources.sourcePathByLintPath.size > 0;
73287
+ const lintProject = !project.hasThree && preparedLintSources.hasThreeModuleImport ? {
72721
73288
  ...project,
72722
73289
  hasThree: true
72723
73290
  } : project;
@@ -72739,7 +73306,7 @@ const runOxlint = async (options) => {
72739
73306
  sidecarRuleIdFilter: overrides.sidecarRuleIdFilter
72740
73307
  });
72741
73308
  const sizeByFile = sizedScanFiles !== null && lintBatchOrdering === "cost" ? new Map(sizedScanFiles.map((entry) => [entry.path, entry.sizeBytes])) : null;
72742
- if (sizeByFile !== null) for (const [lintPath, sizeBytes] of preparedHtmlSources.sizeByLintPath) sizeByFile.set(lintPath, sizeBytes);
73309
+ if (sizeByFile !== null) for (const [lintPath, sizeBytes] of preparedLintSources.sizeByLintPath) sizeByFile.set(lintPath, sizeBytes);
72743
73310
  const buildFileBatches = (passBaseArgs, passFiles) => sizeByFile !== null ? planLintBatches({
72744
73311
  baseArgs: passBaseArgs,
72745
73312
  files: passFiles,
@@ -72769,7 +73336,8 @@ const runOxlint = async (options) => {
72769
73336
  rootDirectory,
72770
73337
  nodeBinaryPath,
72771
73338
  project: lintProject,
72772
- sourcePathByLintPath: preparedHtmlSources.sourcePathByLintPath,
73339
+ sourcePathByLintPath: preparedLintSources.sourcePathByLintPath,
73340
+ sourceMapByLintPath: preparedLintSources.sourceMapByLintPath,
72773
73341
  onPartialFailure: reportPartialFailure,
72774
73342
  onAnalyzedFiles: (filePaths) => {
72775
73343
  analyzedFiles = filePaths;
@@ -72778,6 +73346,7 @@ const runOxlint = async (options) => {
72778
73346
  spawnTimeoutMs,
72779
73347
  outputMaxBytes,
72780
73348
  concurrency: options.concurrency,
73349
+ spawnSlots: options.spawnSlots,
72781
73350
  signal: options.signal,
72782
73351
  deadlineEpochMs: options.deadlineEpochMs
72783
73352
  });
@@ -72804,7 +73373,7 @@ const runOxlint = async (options) => {
72804
73373
  };
72805
73374
  }
72806
73375
  };
72807
- if (perFileLintCacheEnabled && !project.hasReactCompiler && project.hasReactCompilerLintPlugin !== true && extendsPaths.length === 0 && userPlugins.length === 0 && !hasHtmlFiles) {
73376
+ if (perFileLintCacheEnabled && !project.hasReactCompiler && project.hasReactCompilerLintPlugin !== true && extendsPaths.length === 0 && userPlugins.length === 0 && !hasPreparedFiles) {
72808
73377
  const rulesetHash = computeRulesetHash({
72809
73378
  config: buildConfig({
72810
73379
  extendsPaths: [],
@@ -72970,7 +73539,8 @@ const runOxlint = async (options) => {
72970
73539
  rootDirectory,
72971
73540
  nodeBinaryPath,
72972
73541
  project: lintProject,
72973
- sourcePathByLintPath: preparedHtmlSources.sourcePathByLintPath,
73542
+ sourcePathByLintPath: preparedLintSources.sourcePathByLintPath,
73543
+ sourceMapByLintPath: preparedLintSources.sourceMapByLintPath,
72974
73544
  onPartialFailure,
72975
73545
  onAnalyzedFiles: (filePaths) => {
72976
73546
  analyzedFiles = filePaths;
@@ -72979,6 +73549,7 @@ const runOxlint = async (options) => {
72979
73549
  spawnTimeoutMs,
72980
73550
  outputMaxBytes,
72981
73551
  concurrency: options.concurrency,
73552
+ spawnSlots: options.spawnSlots,
72982
73553
  signal: options.signal,
72983
73554
  deadlineEpochMs: options.deadlineEpochMs
72984
73555
  });
@@ -73073,6 +73644,7 @@ var Linter = class Linter extends Service()("react-doctor/Linter") {
73073
73644
  const spawnTimeoutMs = yield* OxlintSpawnTimeoutMs;
73074
73645
  const outputMaxBytes = yield* OxlintOutputMaxBytes;
73075
73646
  const concurrency = yield* OxlintConcurrency;
73647
+ const spawnSlots = yield* OxlintSpawnSlots;
73076
73648
  const lintBatchOrdering = yield* LintBatchOrdering;
73077
73649
  const perFileLintCacheEnabled = yield* PerFileLintCacheEnabled;
73078
73650
  const sidecarLintCacheEnabled = yield* SidecarLintCacheEnabled;
@@ -73102,6 +73674,7 @@ var Linter = class Linter extends Service()("react-doctor/Linter") {
73102
73674
  onSidecarStats: input.onSidecarStats,
73103
73675
  spawnTimeoutMs,
73104
73676
  outputMaxBytes,
73677
+ spawnSlots: spawnSlots ?? void 0,
73105
73678
  concurrency,
73106
73679
  signal,
73107
73680
  lintBatchOrdering,
@@ -74319,10 +74892,14 @@ const materializeSourceTree = (input) => gen(function* () {
74319
74892
  materializedFiles.push(relativePath);
74320
74893
  }
74321
74894
  yield* sync(() => {
74322
- for (const configFilename of STAGED_FILES_PROJECT_CONFIG_FILENAMES) {
74323
- const sourcePath = path.join(input.directory, configFilename);
74324
- const targetPath = path.join(resolvedTempDirectory, configFilename);
74325
- if (fs.existsSync(sourcePath) && !fs.existsSync(targetPath)) fs.cpSync(sourcePath, targetPath);
74895
+ for (const subdirectory of ["", ...input.configSubdirectories ?? []]) for (const configFilename of STAGED_FILES_PROJECT_CONFIG_FILENAMES) {
74896
+ const sourcePath = path.join(input.directory, subdirectory, configFilename);
74897
+ const targetPath = path.resolve(resolvedTempDirectory, subdirectory, configFilename);
74898
+ if (!isPathInsideDirectory(targetPath, resolvedTempDirectory)) continue;
74899
+ if (fs.existsSync(sourcePath) && !fs.existsSync(targetPath)) {
74900
+ fs.mkdirSync(path.dirname(targetPath), { recursive: true });
74901
+ fs.cpSync(sourcePath, targetPath);
74902
+ }
74326
74903
  }
74327
74904
  });
74328
74905
  return {
@@ -74343,15 +74920,17 @@ const materializeSourceTree = (input) => gen(function* () {
74343
74920
  static layerNode = effect(StagedFiles, gen(function* () {
74344
74921
  const git = yield* Git;
74345
74922
  return StagedFiles.of({
74346
- discoverSourceFiles: (directory) => git.stagedFilePaths(directory).pipe(map$3((entries) => entries.filter(isLintableSourceFile)), withSpan("StagedFiles.discoverSourceFiles")),
74347
- materialize: ({ directory, stagedFiles, tempDirectory }) => materializeSourceTree({
74923
+ discoverSourceFiles: (directory) => git.stagedFilePaths(directory).pipe(map$3((entries) => entries === null ? null : entries.filter(isLintableSourceFile)), withSpan("StagedFiles.discoverSourceFiles")),
74924
+ materialize: ({ directory, stagedFiles, tempDirectory, configSubdirectories }) => materializeSourceTree({
74348
74925
  directory,
74349
74926
  files: stagedFiles,
74350
74927
  tempDirectory,
74928
+ configSubdirectories,
74351
74929
  readContent: (relativePath) => git.showStagedContent(directory, relativePath, { maxBufferBytes: GIT_SHOW_MAX_BUFFER_BYTES })
74352
74930
  }).pipe(map$3((tree) => ({
74353
74931
  tempDirectory: tree.tempDirectory,
74354
74932
  stagedFiles: tree.materializedFiles,
74933
+ unmaterializedFiles: tree.unmaterializedFiles,
74355
74934
  cleanup: tree.cleanup
74356
74935
  })), withSpan("StagedFiles.materialize"))
74357
74936
  });
@@ -74366,6 +74945,7 @@ const materializeSourceTree = (input) => gen(function* () {
74366
74945
  materialize: ({ tempDirectory }) => succeed$2({
74367
74946
  tempDirectory,
74368
74947
  stagedFiles: snapshot.materializedFiles ?? snapshot.sourceFiles ?? [],
74948
+ unmaterializedFiles: [],
74369
74949
  cleanup: () => {}
74370
74950
  })
74371
74951
  }));
@@ -74622,6 +75202,11 @@ const filterSourceFiles = (filePaths) => filePaths.filter(isLintableSourceFile);
74622
75202
  * other `clear*` helpers.
74623
75203
  */
74624
75204
  const clearAutoSuppressionCaches = () => {};
75205
+ const createLintPhaseAbortError = () => new ReactDoctorError({ reason: new OxlintSpawnFailed({ cause: "lint phase aborted" }) });
75206
+ const createOxlintSpawnSlots = (concurrency) => createWorkerSlots({
75207
+ slotCount: resolveScanConcurrency(concurrency),
75208
+ createAbortError: createLintPhaseAbortError
75209
+ });
74625
75210
  /**
74626
75211
  * Identity helper for authoring a typed `doctor.config.{ts,js,mjs,cjs}`.
74627
75212
  * Gives editor autocomplete and type-checking for the config object without
@@ -74742,7 +75327,7 @@ const buildDiagnoseLayer = (input) => {
74742
75327
  resolvedDirectory: input.configOverrideTarget.resolvedDirectory,
74743
75328
  configSourceDirectory: input.configOverrideTarget.configSourceDirectory
74744
75329
  });
74745
- return mergeAll$1(Project.layerNode, configLayer, input.shouldRunDeadCode ? DeadCode.layerNode : DeadCode.layerOf([]), Files.layerNode, Git.layerNode, input.shouldRunLint ? Linter.layerOxlint : Linter.layerOf([]), LintPartialFailures.layerLive, Progress.layerNoop, Reporter.layerNoop, Score.layerHttp, input.config?.supplyChain?.enabled !== false ? SupplyChain.layerNode : SupplyChain.layerOf([]));
75330
+ return mergeAll$1(Project.layerNode, configLayer, input.shouldRunDeadCode ? DeadCode.layerNode : DeadCode.layerOf([]), Files.layerNode, Git.layerNode, input.shouldRunLint ? Linter.layerOxlint : Linter.layerOf([]), LintPartialFailures.layerLive, succeed$3(OxlintConcurrency, input.oxlintConcurrency), succeed$3(OxlintSpawnSlots, input.oxlintSpawnSlots), Progress.layerNoop, Reporter.layerNoop, Score.layerHttp, input.config?.supplyChain?.enabled !== false ? SupplyChain.layerNode : SupplyChain.layerOf([]));
74746
75331
  };
74747
75332
  const buildInspectProgram = (scanTarget, options, configOverride) => {
74748
75333
  const effectiveConfig = configOverride ?? scanTarget.userConfig;
@@ -74783,10 +75368,14 @@ const diagnoseDirectory = async (directory, options) => {
74783
75368
  const program = buildInspectProgram(scanTarget, options);
74784
75369
  const shouldRunLint = resolveShouldRunLint(options, scanTarget.userConfig);
74785
75370
  const shouldRunDeadCode = resolveShouldRunDeadCode(options, scanTarget.userConfig);
75371
+ const oxlintConcurrency = runSync(OxlintConcurrency);
75372
+ const oxlintSpawnSlots = createOxlintSpawnSlots(oxlintConcurrency);
74786
75373
  return outputToDiagnoseResult(await runPromise(restoreLegacyThrow(program.pipe(provide(buildDiagnoseLayer({
74787
75374
  config: scanTarget.userConfig,
74788
75375
  shouldRunLint,
74789
- shouldRunDeadCode
75376
+ shouldRunDeadCode,
75377
+ oxlintConcurrency,
75378
+ oxlintSpawnSlots
74790
75379
  })), provide(layerOtlp)))), globalThis.performance.now() - startTime);
74791
75380
  };
74792
75381
  const findWorstScore = (projectResults) => {
@@ -74801,7 +75390,7 @@ const findWorstScore = (projectResults) => {
74801
75390
  }
74802
75391
  return worstResult;
74803
75392
  };
74804
- const diagnoseProject = async (projectDefinition, baseOptions, batchConfig) => {
75393
+ const diagnoseProject = async (projectDefinition, baseOptions, batchConfig, oxlintConcurrency, oxlintSpawnSlots) => {
74805
75394
  const startTime = globalThis.performance.now();
74806
75395
  try {
74807
75396
  const scanTarget = await resolveScanTarget(projectDefinition.directory);
@@ -74820,6 +75409,8 @@ const diagnoseProject = async (projectDefinition, baseOptions, batchConfig) => {
74820
75409
  config: effectiveConfig,
74821
75410
  shouldRunLint,
74822
75411
  shouldRunDeadCode,
75412
+ oxlintConcurrency,
75413
+ oxlintSpawnSlots,
74823
75414
  configOverrideTarget: {
74824
75415
  resolvedDirectory: scanTarget.resolvedDirectory,
74825
75416
  configSourceDirectory: didOverridePlugins ? null : scanTarget.configSourceDirectory
@@ -74827,7 +75418,9 @@ const diagnoseProject = async (projectDefinition, baseOptions, batchConfig) => {
74827
75418
  } : {
74828
75419
  config: effectiveConfig,
74829
75420
  shouldRunLint,
74830
- shouldRunDeadCode
75421
+ shouldRunDeadCode,
75422
+ oxlintConcurrency,
75423
+ oxlintSpawnSlots
74831
75424
  });
74832
75425
  return {
74833
75426
  ok: true,
@@ -74846,7 +75439,9 @@ const diagnoseProjectBatch = async (input) => {
74846
75439
  warnIfAiTrainingEnvironment();
74847
75440
  const startTime = globalThis.performance.now();
74848
75441
  const { projects, concurrency, config: batchConfig, ...baseOptions } = input;
74849
- const projectResults = await mapWithConcurrency(projects, concurrency ?? 4, (projectDefinition) => diagnoseProject(projectDefinition, baseOptions, batchConfig));
75442
+ const oxlintConcurrency = runSync(OxlintConcurrency);
75443
+ const oxlintSpawnSlots = createOxlintSpawnSlots(oxlintConcurrency);
75444
+ const projectResults = await mapWithConcurrency(projects, concurrency ?? 4, (projectDefinition) => diagnoseProject(projectDefinition, baseOptions, batchConfig, oxlintConcurrency, oxlintSpawnSlots));
74850
75445
  const succeededProjects = projectResults.filter((projectResult) => projectResult.ok);
74851
75446
  return {
74852
75447
  projects: projectResults,
@@ -74892,4 +75487,4 @@ const toJsonReport = (result, options) => buildJsonReport({
74892
75487
  export { AmbiguousProjectError, NoReactDependencyError, NotADirectoryError, PackageJsonNotFoundError, ProjectNotFoundError, ReactDoctorError, buildJsonReport, buildJsonReportError, clearCaches, defineConfig, diagnose, filterSourceFiles, getDiffInfo, hasReactRuntime, isProjectDiscoveryError, isReactDoctorError, summarizeDiagnostics, toJsonReport };
74893
75488
 
74894
75489
  //# sourceMappingURL=index.js.map
74895
- //# debugId=41e39010-e2d7-5e6b-9bba-626bf64affe5
75490
+ //# debugId=61d9689f-8ba5-5ca3-a0c2-09557d3f7028