react-doctor 0.9.1-dev.b1b62db → 0.9.2-dev.01ca0b3

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
@@ -1,5 +1,5 @@
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]="cf9aea89-a185-53f6-9e42-7af2cece64f2")}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]="bb982094-8280-5afe-b061-eb103665c55c")}catch(e){}}();
3
3
  import { createRequire } from "node:module";
4
4
  import * as NodeChildProcess from "node:child_process";
5
5
  import { execFile, execFileSync, spawn, spawnSync } from "node:child_process";
@@ -11,14 +11,16 @@ import process$1 from "node:process";
11
11
  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";
12
12
  import * as Crypto from "node:crypto";
13
13
  import crypto, { createHash, randomUUID } from "node:crypto";
14
+ import { ResolverFactory } from "oxc-resolver";
14
15
  import ts from "typescript";
16
+ import * as NodeUrl from "node:url";
17
+ import { fileURLToPath, pathToFileURL } from "node:url";
15
18
  import * as OS from "node:os";
16
19
  import os, { tmpdir } from "node:os";
17
20
  import { parseJSON5 } from "confbox";
18
- import * as NodeUrl from "node:url";
19
- import { fileURLToPath, pathToFileURL } from "node:url";
20
21
  import { createJiti } from "jiti";
21
22
  import { ANALYZED_MANIFEST_FILENAMES, DEFAULT_EXTENSIONS } from "deslop-js/analyzed-inputs";
23
+ import { convertToTSX } from "@astrojs/compiler/sync";
22
24
  import { gzipSync } from "node:zlib";
23
25
  import * as Sentry from "@sentry/node";
24
26
  import { performance as performance$1 } from "node:perf_hooks";
@@ -13341,7 +13343,7 @@ const Number$4 = globalThis.Number;
13341
13343
  * @category constructors
13342
13344
  * @since 2.0.0
13343
13345
  */
13344
- const parse = (s) => {
13346
+ const parse$1 = (s) => {
13345
13347
  if (s === "NaN") return some(NaN);
13346
13348
  if (s === "Infinity") return some(Infinity);
13347
13349
  if (s === "-Infinity") return some(-Infinity);
@@ -17404,12 +17406,12 @@ TaggedError("EncodingError");
17404
17406
  //#endregion
17405
17407
  //#region ../../node_modules/.pnpm/effect@4.0.0-beta.70/node_modules/effect/dist/internal/schema/annotations.js
17406
17408
  /** @internal */
17407
- function resolve(ast) {
17409
+ function resolve$1(ast) {
17408
17410
  return ast.checks ? ast.checks[ast.checks.length - 1].annotations : ast.annotations;
17409
17411
  }
17410
17412
  /** @internal */
17411
17413
  function resolveAt(key) {
17412
- return (ast) => resolve(ast)?.[key];
17414
+ return (ast) => resolve$1(ast)?.[key];
17413
17415
  }
17414
17416
  /** @internal */
17415
17417
  const resolveIdentifier = /* @__PURE__ */ resolveAt("identifier");
@@ -21161,7 +21163,7 @@ function asSync(parser) {
21161
21163
  }
21162
21164
  const recur$1 = /* @__PURE__ */ memoize((ast) => {
21163
21165
  let parser;
21164
- const astOptions = resolve(ast)?.["parseOptions"];
21166
+ const astOptions = resolve$1(ast)?.["parseOptions"];
21165
21167
  if (!ast.context && !ast.encoding && !ast.checks) return (ou, options) => {
21166
21168
  parser ??= ast.getParser(recur$1);
21167
21169
  if (astOptions) options = {
@@ -60766,7 +60768,7 @@ var UrlParamsError = class extends TaggedError("UrlParamsError") {};
60766
60768
  * @category converting
60767
60769
  * @since 4.0.0
60768
60770
  */
60769
- const makeUrl = (url, params, hash) => {
60771
+ const makeUrl$1 = (url, params, hash) => {
60770
60772
  try {
60771
60773
  const urlInstance = new URL(url, baseUrl());
60772
60774
  for (let i = 0; i < params.params.length; i++) {
@@ -61400,7 +61402,7 @@ const Proto$2 = {
61400
61402
  const make$10 = (f) => makeWith$1((effect) => flatMap$2(effect, (request) => withFiber((fiber) => {
61401
61403
  const scopedController = scopedRequests.get(request);
61402
61404
  const controller = scopedController ?? new AbortController();
61403
- const urlResult = makeUrl(request.url, request.urlParams, getOrUndefined(request.hash));
61405
+ const urlResult = makeUrl$1(request.url, request.urlParams, getOrUndefined(request.hash));
61404
61406
  if (isFailure(urlResult)) return fail$4(new HttpClientError({ reason: new InvalidUrlError({
61405
61407
  request,
61406
61408
  cause: urlResult.failure
@@ -61839,7 +61841,7 @@ const layer$8 = (loggers, options) => effect(CurrentLoggers, withFiber$1(fnUntra
61839
61841
  * @since 4.0.0
61840
61842
  */
61841
61843
  const policy = /* @__PURE__ */ forever$1.pipe(passthrough$2, /* @__PURE__ */ addDelay((error) => {
61842
- 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))));
61844
+ 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))));
61843
61845
  return succeed$2(seconds(1));
61844
61846
  }));
61845
61847
  /**
@@ -64548,6 +64550,428 @@ const layer$1 = /* @__PURE__ */ succeed$3(Path$1)({
64548
64550
  toFileUrl
64549
64551
  });
64550
64552
  //#endregion
64553
+ //#region ../../node_modules/.pnpm/@jridgewell+sourcemap-codec@1.5.5/node_modules/@jridgewell/sourcemap-codec/dist/sourcemap-codec.mjs
64554
+ var comma = ",".charCodeAt(0);
64555
+ ";".charCodeAt(0);
64556
+ var chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
64557
+ var intToChar = new Uint8Array(64);
64558
+ var charToInt = new Uint8Array(128);
64559
+ for (let i = 0; i < chars.length; i++) {
64560
+ const c = chars.charCodeAt(i);
64561
+ intToChar[i] = c;
64562
+ charToInt[c] = i;
64563
+ }
64564
+ function decodeInteger(reader, relative) {
64565
+ let value = 0;
64566
+ let shift = 0;
64567
+ let integer = 0;
64568
+ do {
64569
+ integer = charToInt[reader.next()];
64570
+ value |= (integer & 31) << shift;
64571
+ shift += 5;
64572
+ } while (integer & 32);
64573
+ const shouldNegate = value & 1;
64574
+ value >>>= 1;
64575
+ if (shouldNegate) value = -2147483648 | -value;
64576
+ return relative + value;
64577
+ }
64578
+ function hasMoreVlq(reader, max) {
64579
+ if (reader.pos >= max) return false;
64580
+ return reader.peek() !== comma;
64581
+ }
64582
+ var StringReader = class {
64583
+ constructor(buffer) {
64584
+ this.pos = 0;
64585
+ this.buffer = buffer;
64586
+ }
64587
+ next() {
64588
+ return this.buffer.charCodeAt(this.pos++);
64589
+ }
64590
+ peek() {
64591
+ return this.buffer.charCodeAt(this.pos);
64592
+ }
64593
+ indexOf(char) {
64594
+ const { buffer, pos } = this;
64595
+ const idx = buffer.indexOf(char, pos);
64596
+ return idx === -1 ? buffer.length : idx;
64597
+ }
64598
+ };
64599
+ function decode(mappings) {
64600
+ const { length } = mappings;
64601
+ const reader = new StringReader(mappings);
64602
+ const decoded = [];
64603
+ let genColumn = 0;
64604
+ let sourcesIndex = 0;
64605
+ let sourceLine = 0;
64606
+ let sourceColumn = 0;
64607
+ let namesIndex = 0;
64608
+ do {
64609
+ const semi = reader.indexOf(";");
64610
+ const line = [];
64611
+ let sorted = true;
64612
+ let lastCol = 0;
64613
+ genColumn = 0;
64614
+ while (reader.pos < semi) {
64615
+ let seg;
64616
+ genColumn = decodeInteger(reader, genColumn);
64617
+ if (genColumn < lastCol) sorted = false;
64618
+ lastCol = genColumn;
64619
+ if (hasMoreVlq(reader, semi)) {
64620
+ sourcesIndex = decodeInteger(reader, sourcesIndex);
64621
+ sourceLine = decodeInteger(reader, sourceLine);
64622
+ sourceColumn = decodeInteger(reader, sourceColumn);
64623
+ if (hasMoreVlq(reader, semi)) {
64624
+ namesIndex = decodeInteger(reader, namesIndex);
64625
+ seg = [
64626
+ genColumn,
64627
+ sourcesIndex,
64628
+ sourceLine,
64629
+ sourceColumn,
64630
+ namesIndex
64631
+ ];
64632
+ } else seg = [
64633
+ genColumn,
64634
+ sourcesIndex,
64635
+ sourceLine,
64636
+ sourceColumn
64637
+ ];
64638
+ } else seg = [genColumn];
64639
+ line.push(seg);
64640
+ reader.pos++;
64641
+ }
64642
+ if (!sorted) sort(line);
64643
+ decoded.push(line);
64644
+ reader.pos = semi + 1;
64645
+ } while (reader.pos <= length);
64646
+ return decoded;
64647
+ }
64648
+ function sort(line) {
64649
+ line.sort(sortComparator$1);
64650
+ }
64651
+ function sortComparator$1(a, b) {
64652
+ return a[0] - b[0];
64653
+ }
64654
+ //#endregion
64655
+ //#region ../../node_modules/.pnpm/@jridgewell+resolve-uri@3.1.2/node_modules/@jridgewell/resolve-uri/dist/resolve-uri.mjs
64656
+ const schemeRegex = /^[\w+.-]+:\/\//;
64657
+ /**
64658
+ * Matches the parts of a URL:
64659
+ * 1. Scheme, including ":", guaranteed.
64660
+ * 2. User/password, including "@", optional.
64661
+ * 3. Host, guaranteed.
64662
+ * 4. Port, including ":", optional.
64663
+ * 5. Path, including "/", optional.
64664
+ * 6. Query, including "?", optional.
64665
+ * 7. Hash, including "#", optional.
64666
+ */
64667
+ const urlRegex = /^([\w+.-]+:)\/\/([^@/#?]*@)?([^:/#?]*)(:\d+)?(\/[^#?]*)?(\?[^#]*)?(#.*)?/;
64668
+ /**
64669
+ * File URLs are weird. They dont' need the regular `//` in the scheme, they may or may not start
64670
+ * with a leading `/`, they can have a domain (but only if they don't start with a Windows drive).
64671
+ *
64672
+ * 1. Host, optional.
64673
+ * 2. Path, which may include "/", guaranteed.
64674
+ * 3. Query, including "?", optional.
64675
+ * 4. Hash, including "#", optional.
64676
+ */
64677
+ const fileRegex = /^file:(?:\/\/((?![a-z]:)[^/#?]*)?)?(\/?[^#?]*)(\?[^#]*)?(#.*)?/i;
64678
+ function isAbsoluteUrl(input) {
64679
+ return schemeRegex.test(input);
64680
+ }
64681
+ function isSchemeRelativeUrl(input) {
64682
+ return input.startsWith("//");
64683
+ }
64684
+ function isAbsolutePath(input) {
64685
+ return input.startsWith("/");
64686
+ }
64687
+ function isFileUrl(input) {
64688
+ return input.startsWith("file:");
64689
+ }
64690
+ function isRelative(input) {
64691
+ return /^[.?#]/.test(input);
64692
+ }
64693
+ function parseAbsoluteUrl(input) {
64694
+ const match = urlRegex.exec(input);
64695
+ return makeUrl(match[1], match[2] || "", match[3], match[4] || "", match[5] || "/", match[6] || "", match[7] || "");
64696
+ }
64697
+ function parseFileUrl(input) {
64698
+ const match = fileRegex.exec(input);
64699
+ const path = match[2];
64700
+ return makeUrl("file:", "", match[1] || "", "", isAbsolutePath(path) ? path : "/" + path, match[3] || "", match[4] || "");
64701
+ }
64702
+ function makeUrl(scheme, user, host, port, path, query, hash) {
64703
+ return {
64704
+ scheme,
64705
+ user,
64706
+ host,
64707
+ port,
64708
+ path,
64709
+ query,
64710
+ hash,
64711
+ type: 7
64712
+ };
64713
+ }
64714
+ function parseUrl(input) {
64715
+ if (isSchemeRelativeUrl(input)) {
64716
+ const url = parseAbsoluteUrl("http:" + input);
64717
+ url.scheme = "";
64718
+ url.type = 6;
64719
+ return url;
64720
+ }
64721
+ if (isAbsolutePath(input)) {
64722
+ const url = parseAbsoluteUrl("http://foo.com" + input);
64723
+ url.scheme = "";
64724
+ url.host = "";
64725
+ url.type = 5;
64726
+ return url;
64727
+ }
64728
+ if (isFileUrl(input)) return parseFileUrl(input);
64729
+ if (isAbsoluteUrl(input)) return parseAbsoluteUrl(input);
64730
+ const url = parseAbsoluteUrl("http://foo.com/" + input);
64731
+ url.scheme = "";
64732
+ url.host = "";
64733
+ url.type = input ? input.startsWith("?") ? 3 : input.startsWith("#") ? 2 : 4 : 1;
64734
+ return url;
64735
+ }
64736
+ function stripPathFilename(path) {
64737
+ if (path.endsWith("/..")) return path;
64738
+ const index = path.lastIndexOf("/");
64739
+ return path.slice(0, index + 1);
64740
+ }
64741
+ function mergePaths(url, base) {
64742
+ normalizePath(base, base.type);
64743
+ if (url.path === "/") url.path = base.path;
64744
+ else url.path = stripPathFilename(base.path) + url.path;
64745
+ }
64746
+ /**
64747
+ * The path can have empty directories "//", unneeded parents "foo/..", or current directory
64748
+ * "foo/.". We need to normalize to a standard representation.
64749
+ */
64750
+ function normalizePath(url, type) {
64751
+ const rel = type <= 4;
64752
+ const pieces = url.path.split("/");
64753
+ let pointer = 1;
64754
+ let positive = 0;
64755
+ let addTrailingSlash = false;
64756
+ for (let i = 1; i < pieces.length; i++) {
64757
+ const piece = pieces[i];
64758
+ if (!piece) {
64759
+ addTrailingSlash = true;
64760
+ continue;
64761
+ }
64762
+ addTrailingSlash = false;
64763
+ if (piece === ".") continue;
64764
+ if (piece === "..") {
64765
+ if (positive) {
64766
+ addTrailingSlash = true;
64767
+ positive--;
64768
+ pointer--;
64769
+ } else if (rel) pieces[pointer++] = piece;
64770
+ continue;
64771
+ }
64772
+ pieces[pointer++] = piece;
64773
+ positive++;
64774
+ }
64775
+ let path = "";
64776
+ for (let i = 1; i < pointer; i++) path += "/" + pieces[i];
64777
+ if (!path || addTrailingSlash && !path.endsWith("/..")) path += "/";
64778
+ url.path = path;
64779
+ }
64780
+ /**
64781
+ * Attempts to resolve `input` URL/path relative to `base`.
64782
+ */
64783
+ function resolve(input, base) {
64784
+ if (!input && !base) return "";
64785
+ const url = parseUrl(input);
64786
+ let inputType = url.type;
64787
+ if (base && inputType !== 7) {
64788
+ const baseUrl = parseUrl(base);
64789
+ const baseType = baseUrl.type;
64790
+ switch (inputType) {
64791
+ case 1: url.hash = baseUrl.hash;
64792
+ case 2: url.query = baseUrl.query;
64793
+ case 3:
64794
+ case 4: mergePaths(url, baseUrl);
64795
+ case 5:
64796
+ url.user = baseUrl.user;
64797
+ url.host = baseUrl.host;
64798
+ url.port = baseUrl.port;
64799
+ case 6: url.scheme = baseUrl.scheme;
64800
+ }
64801
+ if (baseType > inputType) inputType = baseType;
64802
+ }
64803
+ normalizePath(url, inputType);
64804
+ const queryHash = url.query + url.hash;
64805
+ switch (inputType) {
64806
+ case 2:
64807
+ case 3: return queryHash;
64808
+ case 4: {
64809
+ const path = url.path.slice(1);
64810
+ if (!path) return queryHash || ".";
64811
+ if (isRelative(base || input) && !isRelative(path)) return "./" + path + queryHash;
64812
+ return path + queryHash;
64813
+ }
64814
+ case 5: return url.path + queryHash;
64815
+ default: return url.scheme + "//" + url.user + url.host + url.port + url.path + queryHash;
64816
+ }
64817
+ }
64818
+ //#endregion
64819
+ //#region ../../node_modules/.pnpm/@jridgewell+trace-mapping@0.3.31/node_modules/@jridgewell/trace-mapping/dist/trace-mapping.mjs
64820
+ function stripFilename(path) {
64821
+ if (!path) return "";
64822
+ const index = path.lastIndexOf("/");
64823
+ return path.slice(0, index + 1);
64824
+ }
64825
+ function resolver(mapUrl, sourceRoot) {
64826
+ const from = stripFilename(mapUrl);
64827
+ const prefix = sourceRoot ? sourceRoot + "/" : "";
64828
+ return (source) => resolve(prefix + (source || ""), from);
64829
+ }
64830
+ var COLUMN = 0;
64831
+ var SOURCES_INDEX = 1;
64832
+ var SOURCE_LINE = 2;
64833
+ var SOURCE_COLUMN = 3;
64834
+ var NAMES_INDEX = 4;
64835
+ function maybeSort(mappings, owned) {
64836
+ const unsortedIndex = nextUnsortedSegmentLine(mappings, 0);
64837
+ if (unsortedIndex === mappings.length) return mappings;
64838
+ if (!owned) mappings = mappings.slice();
64839
+ for (let i = unsortedIndex; i < mappings.length; i = nextUnsortedSegmentLine(mappings, i + 1)) mappings[i] = sortSegments(mappings[i], owned);
64840
+ return mappings;
64841
+ }
64842
+ function nextUnsortedSegmentLine(mappings, start) {
64843
+ for (let i = start; i < mappings.length; i++) if (!isSorted(mappings[i])) return i;
64844
+ return mappings.length;
64845
+ }
64846
+ function isSorted(line) {
64847
+ for (let j = 1; j < line.length; j++) if (line[j][COLUMN] < line[j - 1][COLUMN]) return false;
64848
+ return true;
64849
+ }
64850
+ function sortSegments(line, owned) {
64851
+ if (!owned) line = line.slice();
64852
+ return line.sort(sortComparator);
64853
+ }
64854
+ function sortComparator(a, b) {
64855
+ return a[COLUMN] - b[COLUMN];
64856
+ }
64857
+ var found = false;
64858
+ function binarySearch(haystack, needle, low, high) {
64859
+ while (low <= high) {
64860
+ const mid = low + (high - low >> 1);
64861
+ const cmp = haystack[mid][COLUMN] - needle;
64862
+ if (cmp === 0) {
64863
+ found = true;
64864
+ return mid;
64865
+ }
64866
+ if (cmp < 0) low = mid + 1;
64867
+ else high = mid - 1;
64868
+ }
64869
+ found = false;
64870
+ return low - 1;
64871
+ }
64872
+ function upperBound(haystack, needle, index) {
64873
+ for (let i = index + 1; i < haystack.length; index = i++) if (haystack[i][COLUMN] !== needle) break;
64874
+ return index;
64875
+ }
64876
+ function lowerBound(haystack, needle, index) {
64877
+ for (let i = index - 1; i >= 0; index = i--) if (haystack[i][COLUMN] !== needle) break;
64878
+ return index;
64879
+ }
64880
+ function memoizedState() {
64881
+ return {
64882
+ lastKey: -1,
64883
+ lastNeedle: -1,
64884
+ lastIndex: -1
64885
+ };
64886
+ }
64887
+ function memoizedBinarySearch(haystack, needle, state, key) {
64888
+ const { lastKey, lastNeedle, lastIndex } = state;
64889
+ let low = 0;
64890
+ let high = haystack.length - 1;
64891
+ if (key === lastKey) {
64892
+ if (needle === lastNeedle) {
64893
+ found = lastIndex !== -1 && haystack[lastIndex][COLUMN] === needle;
64894
+ return lastIndex;
64895
+ }
64896
+ if (needle >= lastNeedle) low = lastIndex === -1 ? 0 : lastIndex;
64897
+ else high = lastIndex;
64898
+ }
64899
+ state.lastKey = key;
64900
+ state.lastNeedle = needle;
64901
+ return state.lastIndex = binarySearch(haystack, needle, low, high);
64902
+ }
64903
+ function parse(map) {
64904
+ return typeof map === "string" ? JSON.parse(map) : map;
64905
+ }
64906
+ var LINE_GTR_ZERO = "`line` must be greater than 0 (lines start at line 1)";
64907
+ var COL_GTR_EQ_ZERO = "`column` must be greater than or equal to 0 (columns start at column 0)";
64908
+ var TraceMap = class {
64909
+ constructor(map, mapUrl) {
64910
+ const isString = typeof map === "string";
64911
+ if (!isString && map._decodedMemo) return map;
64912
+ const parsed = parse(map);
64913
+ const { version, file, names, sourceRoot, sources, sourcesContent } = parsed;
64914
+ this.version = version;
64915
+ this.file = file;
64916
+ this.names = names || [];
64917
+ this.sourceRoot = sourceRoot;
64918
+ this.sources = sources;
64919
+ this.sourcesContent = sourcesContent;
64920
+ this.ignoreList = parsed.ignoreList || parsed.x_google_ignoreList || void 0;
64921
+ const resolve = resolver(mapUrl, sourceRoot);
64922
+ this.resolvedSources = sources.map(resolve);
64923
+ const { mappings } = parsed;
64924
+ if (typeof mappings === "string") {
64925
+ this._encoded = mappings;
64926
+ this._decoded = void 0;
64927
+ } else if (Array.isArray(mappings)) {
64928
+ this._encoded = void 0;
64929
+ this._decoded = maybeSort(mappings, isString);
64930
+ } else if (parsed.sections) throw new Error(`TraceMap passed sectioned source map, please use FlattenMap export instead`);
64931
+ else throw new Error(`invalid source map: ${JSON.stringify(parsed)}`);
64932
+ this._decodedMemo = memoizedState();
64933
+ this._bySources = void 0;
64934
+ this._bySourceMemos = void 0;
64935
+ }
64936
+ };
64937
+ function cast(map) {
64938
+ return map;
64939
+ }
64940
+ function decodedMappings(map) {
64941
+ var _a;
64942
+ return (_a = cast(map))._decoded || (_a._decoded = decode(cast(map)._encoded));
64943
+ }
64944
+ function originalPositionFor(map, needle) {
64945
+ let { line, column, bias } = needle;
64946
+ line--;
64947
+ if (line < 0) throw new Error(LINE_GTR_ZERO);
64948
+ if (column < 0) throw new Error(COL_GTR_EQ_ZERO);
64949
+ const decoded = decodedMappings(map);
64950
+ if (line >= decoded.length) return OMapping(null, null, null, null);
64951
+ const segments = decoded[line];
64952
+ const index = traceSegmentInternal(segments, cast(map)._decodedMemo, line, column, bias || 1);
64953
+ if (index === -1) return OMapping(null, null, null, null);
64954
+ const segment = segments[index];
64955
+ if (segment.length === 1) return OMapping(null, null, null, null);
64956
+ const { names, resolvedSources } = map;
64957
+ return OMapping(resolvedSources[segment[SOURCES_INDEX]], segment[SOURCE_LINE] + 1, segment[SOURCE_COLUMN], segment.length === 5 ? names[segment[NAMES_INDEX]] : null);
64958
+ }
64959
+ function OMapping(source, line, column, name) {
64960
+ return {
64961
+ source,
64962
+ line,
64963
+ column,
64964
+ name
64965
+ };
64966
+ }
64967
+ function traceSegmentInternal(segments, memo, line, column, bias) {
64968
+ let index = memoizedBinarySearch(segments, column, memo, line);
64969
+ if (found) index = (bias === -1 ? upperBound : lowerBound)(segments, column, index);
64970
+ else if (bias === -1) index++;
64971
+ if (index === -1 || index === segments.length) return -1;
64972
+ return index;
64973
+ }
64974
+ //#endregion
64551
64975
  //#region ../core/dist/index.js
64552
64976
  var __create = Object.create;
64553
64977
  var __defProp = Object.defineProperty;
@@ -64617,7 +65041,7 @@ var AmbiguousProjectError = class extends Error {
64617
65041
  };
64618
65042
  const isProjectDiscoveryError = (value) => value instanceof ProjectNotFoundError || value instanceof NoReactDependencyError || value instanceof PackageJsonNotFoundError || value instanceof NotADirectoryError || value instanceof AmbiguousProjectError;
64619
65043
  const HTML_FILE_PATTERN = /\.html$/i;
64620
- const SOURCE_FILE_PATTERN = /\.(?:tsx?|jsx?|mts|mjs|[hH][tT][mM][lL])$/;
65044
+ const SOURCE_FILE_PATTERN = /\.(?:astro|tsx?|jsx?|mts|mjs|[hH][tT][mM][lL])$/;
64621
65045
  const GENERATED_BUNDLE_FILE_PATTERN = /\.(iife|umd|global|min)\.m?js$/i;
64622
65046
  const GENERATED_SOURCE_DIRECTORY_PATTERN = /(?:^|\/)__generated__\//;
64623
65047
  const MINIFIED_SNIFF_BYTES = 65536;
@@ -64995,7 +65419,7 @@ const SOCKET_FREE_USER_AGENT = "react-doctor-supply-chain";
64995
65419
  const FILE_LINT_CACHE_FILENAME = "file-lint-cache.json";
64996
65420
  const FILE_LINT_CACHE_MAX_FILE_COUNT = 5e4;
64997
65421
  const SIDECAR_LINT_CACHE_FILENAME = "sidecar-lint-cache.json";
64998
- const CORE_PACKAGE_VERSION = "0.9.1";
65422
+ const CORE_PACKAGE_VERSION = "0.9.2";
64999
65423
  const DEAD_CODE_CACHE_FILENAME = "dead-code-cache.json";
65000
65424
  const DEAD_CODE_SUMMARY_CACHE_FILENAME = "dead-code-summaries.json";
65001
65425
  const SUPPLY_CHAIN_PLUGIN = "socket";
@@ -65239,8 +65663,13 @@ const findMonorepoRoot = (startDirectory) => {
65239
65663
  * byte-equivalent copy.
65240
65664
  */
65241
65665
  const isProjectBoundary = (directory) => NFS.existsSync(Path.join(directory, ".git")) || isMonorepoRoot(directory);
65666
+ const unwrapTypescriptExpression = (expression) => {
65667
+ let currentExpression = expression;
65668
+ while (ts.isParenthesizedExpression(currentExpression) || ts.isAsExpression(currentExpression) || ts.isSatisfiesExpression(currentExpression) || ts.isNonNullExpression(currentExpression) || ts.isTypeAssertionExpression(currentExpression)) currentExpression = currentExpression.expression;
65669
+ return currentExpression;
65670
+ };
65242
65671
  const TSCONFIG_FILENAME = "tsconfig.json";
65243
- const isRelativeExtendsValue = (extendsValue) => extendsValue.startsWith("./") || extendsValue.startsWith("../") || Path.isAbsolute(extendsValue);
65672
+ const isLocalModuleSpecifier = (moduleSpecifier) => moduleSpecifier === "." || moduleSpecifier === ".." || moduleSpecifier.startsWith("./") || moduleSpecifier.startsWith("../") || Path.isAbsolute(moduleSpecifier);
65244
65673
  const ensureJsonExtension = (filePath) => Path.extname(filePath) === "" ? `${filePath}.json` : filePath;
65245
65674
  const resolvePackageExtendsPath = (extendsValue, fromConfigDirectory) => {
65246
65675
  const requireFromConfig = createRequire(Path.join(fromConfigDirectory, "tsconfig.json"));
@@ -65257,7 +65686,12 @@ const resolvePackageExtendsPath = (extendsValue, fromConfigDirectory) => {
65257
65686
  return null;
65258
65687
  };
65259
65688
  const resolveExtendsPath = (extendsValue, fromConfigDirectory) => {
65260
- if (isRelativeExtendsValue(extendsValue)) return ensureJsonExtension(Path.resolve(fromConfigDirectory, extendsValue));
65689
+ if (isLocalModuleSpecifier(extendsValue)) {
65690
+ const resolvedPath = Path.resolve(fromConfigDirectory, extendsValue);
65691
+ if (isFile(resolvedPath)) return resolvedPath;
65692
+ const directoryConfigPath = Path.join(resolvedPath, TSCONFIG_FILENAME);
65693
+ return isFile(directoryConfigPath) ? directoryConfigPath : ensureJsonExtension(resolvedPath);
65694
+ }
65261
65695
  return resolvePackageExtendsPath(extendsValue, fromConfigDirectory);
65262
65696
  };
65263
65697
  const normalizeCompilerOptions = (compilerOptions) => {
@@ -65364,6 +65798,7 @@ const FRAMEWORK_PACKAGES = {
65364
65798
  "@tanstack/react-start": "tanstack-start",
65365
65799
  "@remix-run/react": "remix",
65366
65800
  gatsby: "gatsby",
65801
+ astro: "astro",
65367
65802
  vite: "vite",
65368
65803
  "react-scripts": "cra",
65369
65804
  expo: "expo",
@@ -65451,6 +65886,15 @@ const REACT_COMPILER_CONFIG_SOURCE_EXTENSIONS = [
65451
65886
  ".cts",
65452
65887
  ".json"
65453
65888
  ];
65889
+ const REACT_COMPILER_CONFIG_RESOLVER = new ResolverFactory({
65890
+ conditionNames: [
65891
+ "import",
65892
+ "require",
65893
+ "node",
65894
+ "default"
65895
+ ],
65896
+ extensions: REACT_COMPILER_CONFIG_SOURCE_EXTENSIONS
65897
+ });
65454
65898
  const STATIC_EXPORT_OUTPUT_PATTERN = /(?:^|[^.\w])["']?output["']?\s*:\s*["']export["']/m;
65455
65899
  const hasCompilerPackage = (packageJson, compilerPackages) => {
65456
65900
  const allDependencies = {
@@ -65474,6 +65918,18 @@ const hasCompilerPackageInAncestors = (directory, compilerPackages) => {
65474
65918
  return false;
65475
65919
  };
65476
65920
  const resolveImportedConfigFile = (fromFilePath, moduleSpecifier) => {
65921
+ if (!isLocalModuleSpecifier(moduleSpecifier)) {
65922
+ try {
65923
+ const resolvedPath = REACT_COMPILER_CONFIG_RESOLVER.resolveFileSync(fromFilePath, moduleSpecifier).path;
65924
+ if (resolvedPath && isFile(resolvedPath)) return resolvedPath;
65925
+ } catch {}
65926
+ try {
65927
+ const resolvedPath = createRequire(fromFilePath).resolve(moduleSpecifier);
65928
+ return isFile(resolvedPath) ? resolvedPath : null;
65929
+ } catch {
65930
+ return null;
65931
+ }
65932
+ }
65477
65933
  const unresolvedPath = Path.resolve(Path.dirname(fromFilePath), moduleSpecifier);
65478
65934
  const extension = Path.extname(unresolvedPath);
65479
65935
  return (extension ? [unresolvedPath, ...REACT_COMPILER_CONFIG_SOURCE_EXTENSIONS.map((sourceExtension) => `${unresolvedPath.slice(0, -extension.length)}${sourceExtension}`)] : [
@@ -65499,7 +65955,7 @@ const hasTopLevelValueBinding = (sourceFile, bindingName) => sourceFile.statemen
65499
65955
  const namedBindings = importClause?.namedBindings;
65500
65956
  return namedBindings ? ts.isNamespaceImport(namedBindings) ? namedBindings.name.text === bindingName : namedBindings.elements.some((element) => element.name.text === bindingName) : false;
65501
65957
  }
65502
- if (ts.isVariableStatement(statement)) return statement.declarationList.declarations.some((declaration) => ts.isIdentifier(declaration.name) && declaration.name.text === bindingName);
65958
+ if (ts.isVariableStatement(statement)) return statement.declarationList.declarations.some((declaration) => bindingNameContainsIdentifier(declaration.name, bindingName));
65503
65959
  return (ts.isFunctionDeclaration(statement) || ts.isClassDeclaration(statement)) && statement.name?.text === bindingName;
65504
65960
  });
65505
65961
  const getImportBinding = (sourceFile, bindingName) => {
@@ -65564,10 +66020,16 @@ const getTopLevelBinding = (sourceFile, bindingName) => {
65564
66020
  }
65565
66021
  return null;
65566
66022
  };
65567
- const getFunctionLocalBindings = (functionNode, argumentsList) => {
66023
+ const getFunctionLocalBindings = (functionNode, argumentsList, argumentAnalysis, functionAnalysis) => {
65568
66024
  const localBindings = /* @__PURE__ */ new Map();
65569
66025
  functionNode.parameters.forEach((parameter, parameterIndex) => {
65570
- if (ts.isIdentifier(parameter.name)) localBindings.set(parameter.name.text, argumentsList[parameterIndex] ?? parameter.initializer ?? null);
66026
+ if (ts.isIdentifier(parameter.name)) {
66027
+ const argument = argumentsList[parameterIndex];
66028
+ localBindings.set(parameter.name.text, {
66029
+ expression: argument ?? parameter.initializer ?? null,
66030
+ analysis: argument ? argumentAnalysis : functionAnalysis
66031
+ });
66032
+ }
65571
66033
  });
65572
66034
  return localBindings;
65573
66035
  };
@@ -65600,6 +66062,48 @@ const getScopedConfigBinding = (identifier) => {
65600
66062
  };
65601
66063
  };
65602
66064
  const isCompilerTransformModule = (moduleSpecifier, exportName) => moduleSpecifier === "babel-plugin-react-compiler" && exportName === "default" || moduleSpecifier === "@vitejs/plugin-react" && exportName === "reactCompilerPreset";
66065
+ const NODE_MODULE_SPECIFIERS = new Set(["module", "node:module"]);
66066
+ const isConstantVariableInitializer = (node) => ts.isExpression(node) && ts.isVariableDeclaration(node.parent) && ts.isVariableDeclarationList(node.parent.parent) && Boolean(node.parent.parent.flags & ts.NodeFlags.Const);
66067
+ const isNodeCreateRequireCall = (node, analysis) => {
66068
+ if (ts.isParenthesizedExpression(node) || ts.isAsExpression(node) || ts.isTypeAssertionExpression(node) || ts.isSatisfiesExpression(node) || ts.isNonNullExpression(node) || ts.isAwaitExpression(node)) return isNodeCreateRequireCall(node.expression, analysis);
66069
+ if (!ts.isCallExpression(node)) return false;
66070
+ const target = node.expression;
66071
+ if (ts.isIdentifier(target)) {
66072
+ if (analysis.localBindings.has(target.text) || getScopedConfigBinding(target).wasFound) return false;
66073
+ const importBinding = getImportBinding(analysis.sourceFile, target.text);
66074
+ return Boolean(importBinding && NODE_MODULE_SPECIFIERS.has(importBinding.moduleSpecifier) && importBinding.exportName === "createRequire");
66075
+ }
66076
+ if (!ts.isPropertyAccessExpression(target) && !ts.isElementAccessExpression(target)) return false;
66077
+ if ((ts.isPropertyAccessExpression(target) ? target.name.text : target.argumentExpression && ts.isStringLiteralLike(target.argumentExpression) ? target.argumentExpression.text : null) !== "createRequire") return false;
66078
+ const createRequireReceiver = target.expression;
66079
+ if (ts.isCallExpression(createRequireReceiver)) {
66080
+ const requiredModuleSpecifier = getRequireModuleSpecifier$1(createRequireReceiver);
66081
+ if (requiredModuleSpecifier === null || !NODE_MODULE_SPECIFIERS.has(requiredModuleSpecifier) || !ts.isIdentifier(createRequireReceiver.expression)) return false;
66082
+ const requireIdentifier = createRequireReceiver.expression;
66083
+ return !analysis.localBindings.has(requireIdentifier.text) && !getScopedConfigBinding(requireIdentifier).wasFound && !hasTopLevelValueBinding(analysis.sourceFile, requireIdentifier.text);
66084
+ }
66085
+ if (!ts.isIdentifier(createRequireReceiver)) return false;
66086
+ if (analysis.localBindings.has(createRequireReceiver.text) || getScopedConfigBinding(createRequireReceiver).wasFound) return false;
66087
+ const importBinding = getImportBinding(analysis.sourceFile, createRequireReceiver.text);
66088
+ return Boolean(importBinding?.isNamespace && NODE_MODULE_SPECIFIERS.has(importBinding.moduleSpecifier));
66089
+ };
66090
+ const getNodeRequireResolveModuleSpecifier = (callExpression, analysis) => {
66091
+ const [moduleSpecifierNode] = callExpression.arguments;
66092
+ if (!moduleSpecifierNode || !ts.isStringLiteralLike(moduleSpecifierNode)) return null;
66093
+ const target = callExpression.expression;
66094
+ if (!ts.isPropertyAccessExpression(target) && !ts.isElementAccessExpression(target)) return null;
66095
+ if ((ts.isPropertyAccessExpression(target) ? target.name.text : target.argumentExpression && ts.isStringLiteralLike(target.argumentExpression) ? target.argumentExpression.text : null) !== "resolve") return null;
66096
+ if (isNodeCreateRequireCall(target.expression, analysis)) return moduleSpecifierNode.text;
66097
+ if (!ts.isIdentifier(target.expression)) return null;
66098
+ const resolverIdentifier = target.expression;
66099
+ if (analysis.localBindings.has(resolverIdentifier.text)) return null;
66100
+ const scopedBinding = getScopedConfigBinding(resolverIdentifier);
66101
+ const topLevelBinding = scopedBinding.wasFound ? null : getTopLevelBinding(analysis.sourceFile, resolverIdentifier.text);
66102
+ const resolverInitializer = scopedBinding.wasFound ? scopedBinding.initializer : topLevelBinding;
66103
+ if (resolverInitializer === null && !scopedBinding.wasFound && resolverIdentifier.text === "require" && !hasTopLevelValueBinding(analysis.sourceFile, resolverIdentifier.text) && getImportBinding(analysis.sourceFile, resolverIdentifier.text) === null) return moduleSpecifierNode.text;
66104
+ if (!resolverInitializer || !isConstantVariableInitializer(resolverInitializer) || !isNodeCreateRequireCall(resolverInitializer, analysis)) return null;
66105
+ return moduleSpecifierNode.text;
66106
+ };
65603
66107
  const getAssignedPropertyInitializer = (identifier, propertyName) => {
65604
66108
  let bindingScope = null;
65605
66109
  let currentNode = identifier;
@@ -65642,9 +66146,11 @@ const getAssignedPropertyInitializer = (identifier, propertyName) => {
65642
66146
  initializer: assignedInitializer
65643
66147
  };
65644
66148
  };
65645
- const getStaticConfigValueState = (expression, analysis) => {
65646
- let unwrappedExpression = expression;
65647
- while (ts.isParenthesizedExpression(unwrappedExpression) || ts.isAsExpression(unwrappedExpression) || ts.isTypeAssertionExpression(unwrappedExpression) || ts.isSatisfiesExpression(unwrappedExpression) || ts.isNonNullExpression(unwrappedExpression)) unwrappedExpression = unwrappedExpression.expression;
66149
+ const getStaticConfigValueState = (expression, analysis, visitedExpressions = /* @__PURE__ */ new Set()) => {
66150
+ const unwrappedExpression = unwrapTypescriptExpression(expression);
66151
+ if (visitedExpressions.has(unwrappedExpression)) return null;
66152
+ const nextVisitedExpressions = new Set(visitedExpressions);
66153
+ nextVisitedExpressions.add(unwrappedExpression);
65648
66154
  if (unwrappedExpression.kind === ts.SyntaxKind.NullKeyword || ts.isIdentifier(unwrappedExpression) && unwrappedExpression.text === "undefined") return {
65649
66155
  isNullish: true,
65650
66156
  isTruthy: false
@@ -65659,32 +66165,32 @@ const getStaticConfigValueState = (expression, analysis) => {
65659
66165
  };
65660
66166
  if (ts.isIdentifier(unwrappedExpression)) {
65661
66167
  if (analysis.localBindings.has(unwrappedExpression.text)) {
65662
- const localInitializer = analysis.localBindings.get(unwrappedExpression.text);
65663
- return localInitializer ? getStaticConfigValueState(localInitializer, analysis) : null;
66168
+ const localReference = analysis.localBindings.get(unwrappedExpression.text);
66169
+ return localReference?.expression ? getStaticConfigValueState(localReference.expression, localReference.analysis, nextVisitedExpressions) : null;
65664
66170
  }
65665
66171
  const topLevelBinding = getTopLevelBinding(analysis.sourceFile, unwrappedExpression.text);
65666
- return topLevelBinding && ts.isExpression(topLevelBinding) ? getStaticConfigValueState(topLevelBinding, analysis) : null;
66172
+ return topLevelBinding && ts.isExpression(topLevelBinding) ? getStaticConfigValueState(topLevelBinding, analysis, nextVisitedExpressions) : null;
65667
66173
  }
65668
66174
  if (ts.isConditionalExpression(unwrappedExpression)) {
65669
- const conditionState = getStaticConfigValueState(unwrappedExpression.condition, analysis);
65670
- if (conditionState !== null) return getStaticConfigValueState(conditionState.isTruthy ? unwrappedExpression.whenTrue : unwrappedExpression.whenFalse, analysis);
65671
- const whenTrueState = getStaticConfigValueState(unwrappedExpression.whenTrue, analysis);
65672
- const whenFalseState = getStaticConfigValueState(unwrappedExpression.whenFalse, analysis);
66175
+ const conditionState = getStaticConfigValueState(unwrappedExpression.condition, analysis, nextVisitedExpressions);
66176
+ if (conditionState !== null) return getStaticConfigValueState(conditionState.isTruthy ? unwrappedExpression.whenTrue : unwrappedExpression.whenFalse, analysis, nextVisitedExpressions);
66177
+ const whenTrueState = getStaticConfigValueState(unwrappedExpression.whenTrue, analysis, nextVisitedExpressions);
66178
+ const whenFalseState = getStaticConfigValueState(unwrappedExpression.whenFalse, analysis, nextVisitedExpressions);
65673
66179
  return whenTrueState !== null && whenFalseState !== null && whenTrueState.isNullish === whenFalseState.isNullish && whenTrueState.isTruthy === whenFalseState.isTruthy ? whenTrueState : null;
65674
66180
  }
65675
66181
  if (ts.isBinaryExpression(unwrappedExpression)) {
65676
- const leftState = getStaticConfigValueState(unwrappedExpression.left, analysis);
66182
+ const leftState = getStaticConfigValueState(unwrappedExpression.left, analysis, nextVisitedExpressions);
65677
66183
  if (unwrappedExpression.operatorToken.kind === ts.SyntaxKind.AmpersandAmpersandToken) {
65678
66184
  if (leftState === null) return null;
65679
- return leftState.isTruthy ? getStaticConfigValueState(unwrappedExpression.right, analysis) : leftState;
66185
+ return leftState.isTruthy ? getStaticConfigValueState(unwrappedExpression.right, analysis, nextVisitedExpressions) : leftState;
65680
66186
  }
65681
66187
  if (unwrappedExpression.operatorToken.kind === ts.SyntaxKind.BarBarToken) {
65682
66188
  if (leftState === null) return null;
65683
- return leftState.isTruthy ? leftState : getStaticConfigValueState(unwrappedExpression.right, analysis);
66189
+ return leftState.isTruthy ? leftState : getStaticConfigValueState(unwrappedExpression.right, analysis, nextVisitedExpressions);
65684
66190
  }
65685
66191
  if (unwrappedExpression.operatorToken.kind === ts.SyntaxKind.QuestionQuestionToken) {
65686
66192
  if (leftState === null) return null;
65687
- return leftState.isNullish ? getStaticConfigValueState(unwrappedExpression.right, analysis) : leftState;
66193
+ return leftState.isNullish ? getStaticConfigValueState(unwrappedExpression.right, analysis, nextVisitedExpressions) : leftState;
65688
66194
  }
65689
66195
  }
65690
66196
  return null;
@@ -65693,25 +66199,27 @@ const isStaticallyDisabledConfigExpression = (expression, analysis) => getStatic
65693
66199
  const isStaticallyTruthyConfigExpression = (expression, analysis) => getStaticConfigValueState(expression, analysis)?.isTruthy === true;
65694
66200
  const isStaticallyNullishConfigExpression = (expression, analysis) => getStaticConfigValueState(expression, analysis)?.isNullish === true;
65695
66201
  const isStaticallyNonNullishConfigExpression = (expression, analysis) => getStaticConfigValueState(expression, analysis)?.isNullish === false;
65696
- const getReactCompilerFlagState = (expression, analysis) => {
65697
- let unwrappedExpression = expression;
65698
- while (ts.isParenthesizedExpression(unwrappedExpression) || ts.isAsExpression(unwrappedExpression) || ts.isTypeAssertionExpression(unwrappedExpression) || ts.isSatisfiesExpression(unwrappedExpression) || ts.isNonNullExpression(unwrappedExpression)) unwrappedExpression = unwrappedExpression.expression;
66202
+ const getReactCompilerFlagState = (expression, analysis, visitedExpressions = /* @__PURE__ */ new Set()) => {
66203
+ const unwrappedExpression = unwrapTypescriptExpression(expression);
66204
+ if (visitedExpressions.has(unwrappedExpression)) return null;
66205
+ const nextVisitedExpressions = new Set(visitedExpressions);
66206
+ nextVisitedExpressions.add(unwrappedExpression);
65699
66207
  if (ts.isIdentifier(unwrappedExpression)) {
65700
66208
  const assignedBinding = getAssignedPropertyInitializer(unwrappedExpression, "reactCompiler");
65701
66209
  if (assignedBinding.wasFound && assignedBinding.initializer) return { isEnabled: !isStaticallyDisabledConfigExpression(assignedBinding.initializer, analysis) };
65702
66210
  if (analysis.localBindings.has(unwrappedExpression.text)) {
65703
- const localInitializer = analysis.localBindings.get(unwrappedExpression.text);
65704
- return localInitializer ? getReactCompilerFlagState(localInitializer, analysis) : null;
66211
+ const localReference = analysis.localBindings.get(unwrappedExpression.text);
66212
+ return localReference?.expression ? getReactCompilerFlagState(localReference.expression, localReference.analysis, nextVisitedExpressions) : null;
65705
66213
  }
65706
66214
  const topLevelBinding = getTopLevelBinding(analysis.sourceFile, unwrappedExpression.text);
65707
- return topLevelBinding && ts.isExpression(topLevelBinding) ? getReactCompilerFlagState(topLevelBinding, analysis) : null;
66215
+ return topLevelBinding && ts.isExpression(topLevelBinding) ? getReactCompilerFlagState(topLevelBinding, analysis, nextVisitedExpressions) : null;
65708
66216
  }
65709
66217
  if (!ts.isObjectLiteralExpression(unwrappedExpression)) return null;
65710
66218
  for (const property of [...unwrappedExpression.properties].reverse()) {
65711
66219
  if (ts.isPropertyAssignment(property) && getStaticPropertyName$2(property.name) === "reactCompiler") return { isEnabled: !isStaticallyDisabledConfigExpression(property.initializer, analysis) };
65712
66220
  if (ts.isShorthandPropertyAssignment(property) && property.name.text === "reactCompiler") return { isEnabled: !isStaticallyDisabledConfigExpression(property.name, analysis) };
65713
66221
  if (ts.isSpreadAssignment(property)) {
65714
- const spreadState = getReactCompilerFlagState(property.expression, analysis);
66222
+ const spreadState = getReactCompilerFlagState(property.expression, analysis, nextVisitedExpressions);
65715
66223
  if (spreadState) return spreadState;
65716
66224
  }
65717
66225
  }
@@ -65724,8 +66232,8 @@ const getSelectedObjectProperty = (expression, propertyName, analysis, visitedEx
65724
66232
  visitedExpressions.add(resolvedExpression);
65725
66233
  if (ts.isIdentifier(resolvedExpression)) {
65726
66234
  if (analysis.localBindings.has(resolvedExpression.text)) {
65727
- const localInitializer = analysis.localBindings.get(resolvedExpression.text);
65728
- return localInitializer ? getSelectedObjectProperty(localInitializer, propertyName, analysis, visitedExpressions) : null;
66235
+ const localReference = analysis.localBindings.get(resolvedExpression.text);
66236
+ return localReference?.expression ? getSelectedObjectProperty(localReference.expression, propertyName, localReference.analysis, visitedExpressions) : null;
65729
66237
  }
65730
66238
  const scopedBinding = getScopedConfigBinding(resolvedExpression);
65731
66239
  if (scopedBinding.wasFound) return scopedBinding.initializer ? getSelectedObjectProperty(scopedBinding.initializer, propertyName, analysis, visitedExpressions) : null;
@@ -65734,9 +66242,18 @@ const getSelectedObjectProperty = (expression, propertyName, analysis, visitedEx
65734
66242
  }
65735
66243
  if (!ts.isObjectLiteralExpression(resolvedExpression)) return null;
65736
66244
  for (const property of [...resolvedExpression.properties].reverse()) {
65737
- if (ts.isPropertyAssignment(property) && getStaticPropertyName$2(property.name) === propertyName) return property.initializer;
65738
- if (ts.isMethodDeclaration(property) && getStaticPropertyName$2(property.name) === propertyName) return property;
65739
- if (ts.isShorthandPropertyAssignment(property) && property.name.text === propertyName) return property.name;
66245
+ if (ts.isPropertyAssignment(property) && getStaticPropertyName$2(property.name) === propertyName) return {
66246
+ node: property.initializer,
66247
+ analysis
66248
+ };
66249
+ if (ts.isMethodDeclaration(property) && getStaticPropertyName$2(property.name) === propertyName) return {
66250
+ node: property,
66251
+ analysis
66252
+ };
66253
+ if (ts.isShorthandPropertyAssignment(property) && property.name.text === propertyName) return {
66254
+ node: property.name,
66255
+ analysis
66256
+ };
65740
66257
  if (ts.isSpreadAssignment(property)) {
65741
66258
  const spreadProperty = getSelectedObjectProperty(property.expression, propertyName, analysis, visitedExpressions);
65742
66259
  if (spreadProperty) return spreadProperty;
@@ -65749,8 +66266,8 @@ const configExpressionMayDefineProperty = (expression, propertyName, analysis) =
65749
66266
  while (ts.isParenthesizedExpression(resolvedExpression) || ts.isAsExpression(resolvedExpression) || ts.isTypeAssertionExpression(resolvedExpression) || ts.isSatisfiesExpression(resolvedExpression) || ts.isNonNullExpression(resolvedExpression)) resolvedExpression = resolvedExpression.expression;
65750
66267
  if (ts.isIdentifier(resolvedExpression)) {
65751
66268
  if (analysis.localBindings.has(resolvedExpression.text)) {
65752
- const localInitializer = analysis.localBindings.get(resolvedExpression.text);
65753
- return localInitializer ? configExpressionMayDefineProperty(localInitializer, propertyName, analysis) : true;
66269
+ const localReference = analysis.localBindings.get(resolvedExpression.text);
66270
+ return localReference?.expression ? configExpressionMayDefineProperty(localReference.expression, propertyName, localReference.analysis) : true;
65754
66271
  }
65755
66272
  const scopedBinding = getScopedConfigBinding(resolvedExpression);
65756
66273
  if (scopedBinding.wasFound) return scopedBinding.initializer ? configExpressionMayDefineProperty(scopedBinding.initializer, propertyName, analysis) : true;
@@ -65834,15 +66351,15 @@ const getReExportedConfigModules = (sourceFile, exportName) => {
65834
66351
  }
65835
66352
  return bindings;
65836
66353
  };
65837
- const analyzeConfigModuleExport = (filePath, exportName, allowCompilerTransform, importDepth, visitedModules, argumentsList = []) => {
66354
+ const analyzeConfigModuleExport = (filePath, exportName, allowCompilerTransform, importDepth, visitedModules, argumentsList = [], argumentAnalysis) => {
65838
66355
  if (!isFile(filePath) || importDepth > 4) return false;
65839
66356
  const moduleVisitKey = `${filePath}:${exportName}:${allowCompilerTransform}`;
65840
66357
  if (visitedModules.has(moduleVisitKey)) return false;
65841
66358
  const nextVisitedModules = new Set(visitedModules);
65842
66359
  nextVisitedModules.add(moduleVisitKey);
65843
- return analyzeConfigSourceFileExport(parseConfigSourceFile(filePath, NFS.readFileSync(filePath, "utf-8")), filePath, exportName, allowCompilerTransform, importDepth, nextVisitedModules, argumentsList);
66360
+ return analyzeConfigSourceFileExport(parseConfigSourceFile(filePath, NFS.readFileSync(filePath, "utf-8")), filePath, exportName, allowCompilerTransform, importDepth, nextVisitedModules, argumentsList, argumentAnalysis);
65844
66361
  };
65845
- const analyzeConfigSourceFileExport = (sourceFile, filePath, exportName, allowCompilerTransform, importDepth, visitedModules, argumentsList = []) => {
66362
+ const analyzeConfigSourceFileExport = (sourceFile, filePath, exportName, allowCompilerTransform, importDepth, visitedModules, argumentsList = [], argumentAnalysis) => {
65846
66363
  const analysis = {
65847
66364
  filePath,
65848
66365
  sourceFile,
@@ -65852,14 +66369,27 @@ const analyzeConfigSourceFileExport = (sourceFile, filePath, exportName, allowCo
65852
66369
  localBindings: /* @__PURE__ */ new Map(),
65853
66370
  activeFunctions: /* @__PURE__ */ new Set()
65854
66371
  };
66372
+ const resolvedArgumentAnalysis = argumentAnalysis ?? analysis;
65855
66373
  const exportedConfigNodes = getExportedConfigNodes(sourceFile, exportName);
65856
- 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) => {
66374
+ return exportedConfigNodes.some((node) => {
66375
+ if (ts.isArrowFunction(node) || ts.isFunctionExpression(node) || ts.isFunctionDeclaration(node)) return analyzeConfigFunction(node, analysis, allowCompilerTransform, argumentsList, resolvedArgumentAnalysis);
66376
+ if (argumentsList.length > 0 && ts.isIdentifier(node)) {
66377
+ const topLevelBinding = getTopLevelBinding(sourceFile, node.text);
66378
+ if (topLevelBinding && ts.isFunctionLike(topLevelBinding)) return analyzeConfigFunction(topLevelBinding, analysis, allowCompilerTransform, argumentsList, resolvedArgumentAnalysis);
66379
+ const importBinding = getImportBinding(sourceFile, node.text);
66380
+ if (importBinding) {
66381
+ const importedFilePath = resolveImportedConfigFile(filePath, importBinding.moduleSpecifier);
66382
+ return Boolean(importedFilePath && analyzeConfigModuleExport(importedFilePath, importBinding.exportName, allowCompilerTransform, importDepth + 1, visitedModules, argumentsList, resolvedArgumentAnalysis));
66383
+ }
66384
+ }
66385
+ return analyzeConfigNode(node, analysis, allowCompilerTransform);
66386
+ }) || getReExportedConfigModules(sourceFile, exportName).some((binding) => {
65857
66387
  if (exportedConfigNodes.length > 0 && binding.isNamespace) return false;
65858
66388
  const importedFilePath = resolveImportedConfigFile(filePath, binding.moduleSpecifier);
65859
- return Boolean(importedFilePath && analyzeConfigModuleExport(importedFilePath, binding.exportName, allowCompilerTransform, importDepth + 1, visitedModules, argumentsList));
66389
+ return Boolean(importedFilePath && analyzeConfigModuleExport(importedFilePath, binding.exportName, allowCompilerTransform, importDepth + 1, visitedModules, argumentsList, resolvedArgumentAnalysis));
65860
66390
  });
65861
66391
  };
65862
- const analyzeConfigFunction = (functionNode, analysis, allowCompilerTransform, argumentsList = []) => {
66392
+ const analyzeConfigFunction = (functionNode, analysis, allowCompilerTransform, argumentsList = [], argumentAnalysis = analysis) => {
65863
66393
  if (!functionNode.body) return false;
65864
66394
  if (analysis.activeFunctions.has(functionNode.pos)) return false;
65865
66395
  const activeFunctions = new Set(analysis.activeFunctions);
@@ -65867,7 +66397,7 @@ const analyzeConfigFunction = (functionNode, analysis, allowCompilerTransform, a
65867
66397
  const functionAnalysis = {
65868
66398
  ...analysis,
65869
66399
  visitedNodes: /* @__PURE__ */ new Set(),
65870
- localBindings: getFunctionLocalBindings(functionNode, argumentsList),
66400
+ localBindings: getFunctionLocalBindings(functionNode, argumentsList, argumentAnalysis, analysis),
65871
66401
  activeFunctions
65872
66402
  };
65873
66403
  if (!ts.isBlock(functionNode.body)) return analyzeConfigNode(functionNode.body, functionAnalysis, allowCompilerTransform);
@@ -65883,6 +66413,11 @@ const analyzeConfigFunction = (functionNode, analysis, allowCompilerTransform, a
65883
66413
  visitReturns(functionNode.body);
65884
66414
  return hasCompiler;
65885
66415
  };
66416
+ const analyzeImportedConfig = ({ analysis, moduleSpecifier, exportName, allowCompilerTransform, argumentsList }) => {
66417
+ const importedFilePath = resolveImportedConfigFile(analysis.filePath, moduleSpecifier);
66418
+ if (!importedFilePath) return null;
66419
+ return analyzeConfigModuleExport(importedFilePath, exportName, allowCompilerTransform, analysis.importDepth + 1, analysis.visitedModules, argumentsList, analysis);
66420
+ };
65886
66421
  const analyzeConfigIdentifier = (identifier, analysis, allowCompilerTransform, isCompilerTransformCollection, excludedPropertyNames) => {
65887
66422
  const assignedReactCompiler = getAssignedPropertyInitializer(identifier, "reactCompiler");
65888
66423
  if (assignedReactCompiler.initializer && !isStaticallyDisabledConfigExpression(assignedReactCompiler.initializer, analysis)) return true;
@@ -65895,42 +66430,74 @@ const analyzeConfigIdentifier = (identifier, analysis, allowCompilerTransform, i
65895
66430
  if (assignedPlugins.wasFound) overriddenPropertyNames.add("plugins");
65896
66431
  if (assignedPresets.wasFound) overriddenPropertyNames.add("presets");
65897
66432
  if (analysis.localBindings.has(identifier.text)) {
65898
- const localInitializer = analysis.localBindings.get(identifier.text);
65899
- return Boolean(localInitializer && analyzeConfigNode(localInitializer, analysis, allowCompilerTransform, isCompilerTransformCollection, overriddenPropertyNames));
66433
+ const localReference = analysis.localBindings.get(identifier.text);
66434
+ return Boolean(localReference?.expression && analyzeConfigNode(localReference.expression, localReference.analysis, allowCompilerTransform, isCompilerTransformCollection, overriddenPropertyNames));
65900
66435
  }
65901
66436
  const scopedBinding = getScopedConfigBinding(identifier);
65902
66437
  if (scopedBinding.wasFound) return Boolean(scopedBinding.initializer && analyzeConfigNode(scopedBinding.initializer, analysis, allowCompilerTransform, isCompilerTransformCollection, overriddenPropertyNames));
65903
66438
  const importBinding = getImportBinding(analysis.sourceFile, identifier.text);
65904
66439
  if (importBinding) {
65905
66440
  if (allowCompilerTransform && isCompilerTransformModule(importBinding.moduleSpecifier, importBinding.exportName)) return true;
65906
- if (!importBinding.moduleSpecifier.startsWith(".")) return false;
65907
- const importedFilePath = resolveImportedConfigFile(analysis.filePath, importBinding.moduleSpecifier);
65908
- return Boolean(importedFilePath && analyzeConfigModuleExport(importedFilePath, importBinding.exportName, allowCompilerTransform, analysis.importDepth + 1, analysis.visitedModules));
66441
+ return Boolean(analyzeImportedConfig({
66442
+ analysis,
66443
+ moduleSpecifier: importBinding.moduleSpecifier,
66444
+ exportName: importBinding.exportName,
66445
+ allowCompilerTransform
66446
+ }));
65909
66447
  }
65910
66448
  const topLevelBinding = getTopLevelBinding(analysis.sourceFile, identifier.text);
65911
66449
  return Boolean(topLevelBinding && analyzeConfigNode(topLevelBinding, analysis, allowCompilerTransform, isCompilerTransformCollection, overriddenPropertyNames));
65912
66450
  };
65913
66451
  const analyzeConfigCallTarget = (callExpression, analysis, allowCompilerTransform) => {
65914
66452
  const target = callExpression.expression;
66453
+ const callableRequiredModuleSpecifier = getRequireModuleSpecifier$1(target);
66454
+ if (callableRequiredModuleSpecifier !== null) {
66455
+ if (ts.isCallExpression(target) && ts.isIdentifier(target.expression) && (analysis.localBindings.has(target.expression.text) || getScopedConfigBinding(target.expression).wasFound || hasTopLevelValueBinding(analysis.sourceFile, "require"))) return false;
66456
+ if (allowCompilerTransform && isCompilerTransformModule(callableRequiredModuleSpecifier, "default")) return true;
66457
+ const hasCompilerTransform = analyzeImportedConfig({
66458
+ analysis,
66459
+ moduleSpecifier: callableRequiredModuleSpecifier,
66460
+ exportName: "default",
66461
+ allowCompilerTransform,
66462
+ argumentsList: callExpression.arguments
66463
+ });
66464
+ if (isLocalModuleSpecifier(callableRequiredModuleSpecifier) || hasCompilerTransform !== null) return Boolean(hasCompilerTransform);
66465
+ return null;
66466
+ }
65915
66467
  if (!ts.isPropertyAccessExpression(target) && !ts.isElementAccessExpression(target)) return null;
65916
66468
  const propertyName = ts.isPropertyAccessExpression(target) ? target.name.text : target.argumentExpression && ts.isStringLiteralLike(target.argumentExpression) ? target.argumentExpression.text : null;
65917
66469
  if (propertyName === null) return null;
65918
66470
  const requiredModuleSpecifier = getRequireModuleSpecifier$1(target.expression);
65919
66471
  if (requiredModuleSpecifier !== null) {
65920
- if (ts.isCallExpression(target.expression) && ts.isIdentifier(target.expression.expression) && (getScopedConfigBinding(target.expression.expression).wasFound || hasTopLevelValueBinding(analysis.sourceFile, "require"))) return false;
65921
- if (!requiredModuleSpecifier.startsWith(".")) return null;
65922
- const importedFilePath = resolveImportedConfigFile(analysis.filePath, requiredModuleSpecifier);
65923
- return Boolean(importedFilePath && analyzeConfigModuleExport(importedFilePath, propertyName, allowCompilerTransform, analysis.importDepth + 1, analysis.visitedModules, callExpression.arguments));
66472
+ if (ts.isCallExpression(target.expression) && ts.isIdentifier(target.expression.expression) && (analysis.localBindings.has(target.expression.expression.text) || getScopedConfigBinding(target.expression.expression).wasFound || hasTopLevelValueBinding(analysis.sourceFile, "require"))) return false;
66473
+ if (allowCompilerTransform && isCompilerTransformModule(requiredModuleSpecifier, propertyName)) return true;
66474
+ const hasCompilerTransform = analyzeImportedConfig({
66475
+ analysis,
66476
+ moduleSpecifier: requiredModuleSpecifier,
66477
+ exportName: propertyName,
66478
+ allowCompilerTransform,
66479
+ argumentsList: callExpression.arguments
66480
+ });
66481
+ if (isLocalModuleSpecifier(requiredModuleSpecifier) || hasCompilerTransform !== null) return Boolean(hasCompilerTransform);
66482
+ return null;
65924
66483
  }
65925
66484
  if (!ts.isIdentifier(target.expression)) return null;
65926
- const importBinding = getImportBinding(analysis.sourceFile, target.expression.text);
65927
- if (importBinding?.isNamespace && importBinding.moduleSpecifier.startsWith(".")) {
65928
- const importedFilePath = resolveImportedConfigFile(analysis.filePath, importBinding.moduleSpecifier);
65929
- return Boolean(importedFilePath && analyzeConfigModuleExport(importedFilePath, propertyName, allowCompilerTransform, analysis.importDepth + 1, analysis.visitedModules, callExpression.arguments));
66485
+ const importBinding = analysis.localBindings.has(target.expression.text) || getScopedConfigBinding(target.expression).wasFound ? null : getImportBinding(analysis.sourceFile, target.expression.text);
66486
+ if (importBinding?.isNamespace) {
66487
+ if (allowCompilerTransform && isCompilerTransformModule(importBinding.moduleSpecifier, propertyName)) return true;
66488
+ const hasCompilerTransform = analyzeImportedConfig({
66489
+ analysis,
66490
+ moduleSpecifier: importBinding.moduleSpecifier,
66491
+ exportName: propertyName,
66492
+ allowCompilerTransform,
66493
+ argumentsList: callExpression.arguments
66494
+ });
66495
+ if (isLocalModuleSpecifier(importBinding.moduleSpecifier) || hasCompilerTransform !== null) return Boolean(hasCompilerTransform);
66496
+ return null;
65930
66497
  }
65931
66498
  const selectedProperty = getSelectedObjectProperty(target.expression, propertyName, analysis);
65932
66499
  if (selectedProperty === null) return null;
65933
- return ts.isFunctionLike(selectedProperty) ? analyzeConfigFunction(selectedProperty, analysis, allowCompilerTransform, callExpression.arguments) : analyzeConfigNode(selectedProperty, analysis, allowCompilerTransform);
66500
+ return ts.isFunctionLike(selectedProperty.node) ? analyzeConfigFunction(selectedProperty.node, selectedProperty.analysis, allowCompilerTransform, callExpression.arguments, analysis) : analyzeConfigNode(selectedProperty.node, selectedProperty.analysis, allowCompilerTransform);
65934
66501
  };
65935
66502
  const analyzeConfigNode = (node, analysis, allowCompilerTransform, isCompilerTransformCollection = false, excludedPropertyNames) => {
65936
66503
  const excludedPropertiesVisitKey = excludedPropertyNames ? [...excludedPropertyNames].sort().join(",") : "";
@@ -65949,9 +66516,13 @@ const analyzeConfigNode = (node, analysis, allowCompilerTransform, isCompilerTra
65949
66516
  if (propertyName === "reactCompiler") continue;
65950
66517
  if ((propertyName === "plugins" || propertyName === "presets") && node.properties.slice(propertyIndex + 1).some((laterProperty) => ts.isSpreadAssignment(laterProperty) && configExpressionMayDefineProperty(laterProperty.expression, propertyName, analysis) || (ts.isPropertyAssignment(laterProperty) || ts.isShorthandPropertyAssignment(laterProperty)) && getStaticPropertyName$2(laterProperty.name) === propertyName)) continue;
65951
66518
  const propertyAllowsCompilerTransform = propertyName === "plugins" || propertyName === "presets";
65952
- if (propertyName === "extends" && ts.isStringLiteralLike(property.initializer) && property.initializer.text.startsWith(".")) {
65953
- const extendedFilePath = resolveImportedConfigFile(analysis.filePath, property.initializer.text);
65954
- if (extendedFilePath && analyzeConfigModuleExport(extendedFilePath, "default", false, analysis.importDepth + 1, analysis.visitedModules)) return true;
66519
+ if (propertyName === "extends" && ts.isStringLiteralLike(property.initializer)) {
66520
+ if (analyzeImportedConfig({
66521
+ analysis,
66522
+ moduleSpecifier: property.initializer.text,
66523
+ exportName: "default",
66524
+ allowCompilerTransform: false
66525
+ })) return true;
65955
66526
  }
65956
66527
  if (analyzeConfigNode(property.initializer, analysis, propertyAllowsCompilerTransform, propertyAllowsCompilerTransform)) return true;
65957
66528
  } else if (ts.isShorthandPropertyAssignment(property)) {
@@ -65975,6 +66546,8 @@ const analyzeConfigNode = (node, analysis, allowCompilerTransform, isCompilerTra
65975
66546
  });
65976
66547
  }
65977
66548
  if (ts.isCallExpression(node)) {
66549
+ const resolvedModuleSpecifier = getNodeRequireResolveModuleSpecifier(node, analysis);
66550
+ if (resolvedModuleSpecifier !== null) return allowCompilerTransform && isCompilerTransformModule(resolvedModuleSpecifier, "default");
65978
66551
  const callTargetResult = analyzeConfigCallTarget(node, analysis, allowCompilerTransform);
65979
66552
  if (callTargetResult !== null) return callTargetResult;
65980
66553
  const directModuleSpecifier = getRequireModuleSpecifier$1(node);
@@ -65982,16 +66555,27 @@ const analyzeConfigNode = (node, analysis, allowCompilerTransform, isCompilerTra
65982
66555
  if (directModuleSpecifier && isRequireShadowed) return analyzeConfigNode(node.expression, analysis, allowCompilerTransform);
65983
66556
  if (directModuleSpecifier && !isRequireShadowed) {
65984
66557
  if (allowCompilerTransform && isCompilerTransformModule(directModuleSpecifier, "default")) return true;
65985
- if (directModuleSpecifier.startsWith(".")) {
65986
- const importedFilePath = resolveImportedConfigFile(analysis.filePath, directModuleSpecifier);
65987
- if (importedFilePath && analyzeConfigModuleExport(importedFilePath, "default", allowCompilerTransform, analysis.importDepth + 1, analysis.visitedModules)) return true;
65988
- }
66558
+ if (analyzeImportedConfig({
66559
+ analysis,
66560
+ moduleSpecifier: directModuleSpecifier,
66561
+ exportName: "default",
66562
+ allowCompilerTransform
66563
+ })) return true;
65989
66564
  }
65990
66565
  if (ts.isIdentifier(node.expression)) {
65991
- const importBinding = getImportBinding(analysis.sourceFile, node.expression.text);
65992
- if (importBinding?.moduleSpecifier.startsWith(".")) {
65993
- const importedFilePath = resolveImportedConfigFile(analysis.filePath, importBinding.moduleSpecifier);
65994
- return Boolean(importedFilePath && analyzeConfigModuleExport(importedFilePath, importBinding.exportName, allowCompilerTransform, analysis.importDepth + 1, analysis.visitedModules, node.arguments));
66566
+ if (!analysis.localBindings.has(node.expression.text) && !getScopedConfigBinding(node.expression).wasFound) {
66567
+ const importBinding = getImportBinding(analysis.sourceFile, node.expression.text);
66568
+ if (importBinding) {
66569
+ if (allowCompilerTransform && isCompilerTransformModule(importBinding.moduleSpecifier, importBinding.exportName)) return true;
66570
+ const hasCompilerTransform = analyzeImportedConfig({
66571
+ analysis,
66572
+ moduleSpecifier: importBinding.moduleSpecifier,
66573
+ exportName: importBinding.exportName,
66574
+ allowCompilerTransform,
66575
+ argumentsList: node.arguments
66576
+ });
66577
+ if (isLocalModuleSpecifier(importBinding.moduleSpecifier) || hasCompilerTransform !== null) return Boolean(hasCompilerTransform);
66578
+ }
65995
66579
  }
65996
66580
  const topLevelBinding = getTopLevelBinding(analysis.sourceFile, node.expression.text);
65997
66581
  if (topLevelBinding && ts.isFunctionLike(topLevelBinding) && analyzeConfigFunction(topLevelBinding, analysis, allowCompilerTransform, node.arguments)) return true;
@@ -66001,45 +66585,55 @@ const analyzeConfigNode = (node, analysis, allowCompilerTransform, isCompilerTra
66001
66585
  if (ts.isPropertyAccessExpression(node)) {
66002
66586
  const requiredModuleSpecifier = getRequireModuleSpecifier$1(node.expression);
66003
66587
  if (requiredModuleSpecifier) {
66004
- if (ts.isCallExpression(node.expression) && ts.isIdentifier(node.expression.expression) && (getScopedConfigBinding(node.expression.expression).wasFound || hasTopLevelValueBinding(analysis.sourceFile, "require"))) return false;
66005
- if (requiredModuleSpecifier.startsWith(".")) {
66006
- const importedFilePath = resolveImportedConfigFile(analysis.filePath, requiredModuleSpecifier);
66007
- return Boolean(importedFilePath && analyzeConfigModuleExport(importedFilePath, node.name.text, allowCompilerTransform, analysis.importDepth + 1, analysis.visitedModules));
66008
- }
66588
+ if (ts.isCallExpression(node.expression) && ts.isIdentifier(node.expression.expression) && (analysis.localBindings.has(node.expression.expression.text) || getScopedConfigBinding(node.expression.expression).wasFound || hasTopLevelValueBinding(analysis.sourceFile, "require"))) return false;
66589
+ if (analyzeImportedConfig({
66590
+ analysis,
66591
+ moduleSpecifier: requiredModuleSpecifier,
66592
+ exportName: node.name.text,
66593
+ allowCompilerTransform
66594
+ })) return true;
66009
66595
  return allowCompilerTransform && isCompilerTransformModule(requiredModuleSpecifier, node.name.text);
66010
66596
  }
66011
66597
  if (ts.isIdentifier(node.expression)) {
66012
- if (analysis.localBindings.has(node.expression.text)) {
66013
- const localInitializer = analysis.localBindings.get(node.expression.text);
66014
- return Boolean(localInitializer && analyzeConfigNode(localInitializer, analysis, allowCompilerTransform));
66598
+ if (analysis.localBindings.has(node.expression.text) || getScopedConfigBinding(node.expression).wasFound) {
66599
+ const selectedProperty = getSelectedObjectProperty(node.expression, node.name.text, analysis);
66600
+ return Boolean(selectedProperty && analyzeConfigNode(selectedProperty.node, selectedProperty.analysis, allowCompilerTransform));
66015
66601
  }
66016
66602
  const importBinding = getImportBinding(analysis.sourceFile, node.expression.text);
66017
66603
  if (importBinding?.isNamespace) {
66018
66604
  if (allowCompilerTransform && isCompilerTransformModule(importBinding.moduleSpecifier, node.name.text)) return true;
66019
- if (importBinding.moduleSpecifier.startsWith(".")) {
66020
- const importedFilePath = resolveImportedConfigFile(analysis.filePath, importBinding.moduleSpecifier);
66021
- if (importedFilePath && analyzeConfigModuleExport(importedFilePath, node.name.text, allowCompilerTransform, analysis.importDepth + 1, analysis.visitedModules)) return true;
66022
- }
66605
+ if (analyzeImportedConfig({
66606
+ analysis,
66607
+ moduleSpecifier: importBinding.moduleSpecifier,
66608
+ exportName: node.name.text,
66609
+ allowCompilerTransform
66610
+ })) return true;
66023
66611
  return false;
66024
66612
  }
66025
66613
  const selectedProperty = getSelectedObjectProperty(node.expression, node.name.text, analysis);
66026
- if (selectedProperty) return analyzeConfigNode(selectedProperty, analysis, allowCompilerTransform);
66614
+ if (selectedProperty) return analyzeConfigNode(selectedProperty.node, selectedProperty.analysis, allowCompilerTransform);
66027
66615
  return false;
66028
66616
  }
66029
66617
  return analyzeConfigNode(node.expression, analysis, allowCompilerTransform);
66030
66618
  }
66031
66619
  if (ts.isElementAccessExpression(node) && node.argumentExpression && ts.isStringLiteralLike(node.argumentExpression)) {
66032
66620
  if (ts.isIdentifier(node.expression)) {
66621
+ if (analysis.localBindings.has(node.expression.text) || getScopedConfigBinding(node.expression).wasFound) {
66622
+ const selectedProperty = getSelectedObjectProperty(node.expression, node.argumentExpression.text, analysis);
66623
+ return Boolean(selectedProperty && analyzeConfigNode(selectedProperty.node, selectedProperty.analysis, allowCompilerTransform));
66624
+ }
66033
66625
  const importBinding = getImportBinding(analysis.sourceFile, node.expression.text);
66034
66626
  if (importBinding?.isNamespace) {
66035
66627
  if (allowCompilerTransform && isCompilerTransformModule(importBinding.moduleSpecifier, node.argumentExpression.text)) return true;
66036
- if (importBinding.moduleSpecifier.startsWith(".")) {
66037
- const importedFilePath = resolveImportedConfigFile(analysis.filePath, importBinding.moduleSpecifier);
66038
- return Boolean(importedFilePath && analyzeConfigModuleExport(importedFilePath, node.argumentExpression.text, allowCompilerTransform, analysis.importDepth + 1, analysis.visitedModules));
66039
- }
66628
+ return Boolean(analyzeImportedConfig({
66629
+ analysis,
66630
+ moduleSpecifier: importBinding.moduleSpecifier,
66631
+ exportName: node.argumentExpression.text,
66632
+ allowCompilerTransform
66633
+ }));
66040
66634
  }
66041
66635
  const selectedProperty = getSelectedObjectProperty(node.expression, node.argumentExpression.text, analysis);
66042
- if (selectedProperty) return analyzeConfigNode(selectedProperty, analysis, allowCompilerTransform);
66636
+ if (selectedProperty) return analyzeConfigNode(selectedProperty.node, selectedProperty.analysis, allowCompilerTransform);
66043
66637
  return false;
66044
66638
  }
66045
66639
  return analyzeConfigNode(node.expression, analysis, allowCompilerTransform);
@@ -66074,14 +66668,19 @@ const analyzeConfigNode = (node, analysis, allowCompilerTransform, isCompilerTra
66074
66668
  };
66075
66669
  const hasCompilerInConfigFile = (filePath) => analyzeConfigModuleExport(filePath, "default", false, 0, /* @__PURE__ */ new Set());
66076
66670
  const hasCompilerInConfigFiles = (directory, filenames) => filenames.some((filename) => hasCompilerInConfigFile(Path.join(directory, filename)));
66077
- const hasCompilerInPackageJsonConfig = (packageJson) => isPlainObject(packageJson.babel) && analyzeConfigSourceFileExport(ts.parseJsonText("package.json", JSON.stringify(packageJson.babel)), "package.json#babel", "default", false, 0, /* @__PURE__ */ new Set());
66078
- const hasCompilerConfiguration = (directory, packageJson) => hasCompilerInPackageJsonConfig(packageJson) || hasCompilerInConfigFiles(directory, REACT_COMPILER_CONFIG_FILENAMES);
66671
+ const hasCompilerInPackageJsonConfig = (directory, packageJson) => {
66672
+ if (!isPlainObject(packageJson.babel)) return false;
66673
+ const packageJsonPath = Path.join(directory, "package.json");
66674
+ return analyzeConfigSourceFileExport(ts.parseJsonText(packageJsonPath, JSON.stringify(packageJson.babel)), packageJsonPath, "default", false, 0, /* @__PURE__ */ new Set());
66675
+ };
66676
+ const hasCompilerConfiguration = (directory, packageJson) => hasCompilerInPackageJsonConfig(directory, packageJson) || hasCompilerInConfigFiles(directory, REACT_COMPILER_CONFIG_FILENAMES);
66079
66677
  const hasCompilerConfigurationInAncestors = (directory) => {
66080
66678
  if (isProjectBoundary(directory)) return false;
66081
66679
  let ancestorDirectory = Path.dirname(directory);
66082
66680
  while (ancestorDirectory !== Path.dirname(ancestorDirectory)) {
66083
66681
  const ancestorPackagePath = Path.join(ancestorDirectory, "package.json");
66084
- if (hasCompilerInPackageJsonConfig(isFile(ancestorPackagePath) ? readPackageJson$1(ancestorPackagePath) : {}) || hasCompilerInConfigFiles(ancestorDirectory, BABEL_CONFIG_FILENAMES)) return true;
66682
+ const ancestorPackageJson = isFile(ancestorPackagePath) ? readPackageJson$1(ancestorPackagePath) : {};
66683
+ if (hasCompilerInPackageJsonConfig(ancestorDirectory, ancestorPackageJson) || hasCompilerInConfigFiles(ancestorDirectory, BABEL_CONFIG_FILENAMES)) return true;
66085
66684
  if (isProjectBoundary(ancestorDirectory)) return false;
66086
66685
  ancestorDirectory = Path.dirname(ancestorDirectory);
66087
66686
  }
@@ -68411,6 +69010,7 @@ const classifyPackageRole = (filename) => {
68411
69010
  * Resolves the absolute path to read for a diagnostic's `filePath`,
68412
69011
  * accounting for the various shapes oxlint emits:
68413
69012
  *
69013
+ * - `file://` URL — decode to an absolute filesystem path.
68414
69014
  * - Absolute POSIX (`/abs/path/file.tsx`) — pass through.
68415
69015
  * - Absolute Windows (`C:/...` or `C:\...`) — pass through.
68416
69016
  * - `./relative` or bare relative — join against `rootDirectory`.
@@ -68420,6 +69020,7 @@ const classifyPackageRole = (filename) => {
68420
69020
  * use one canonical resolution path.
68421
69021
  */
68422
69022
  const resolveCandidateReadPath = (rootDirectory, filePath) => {
69023
+ if (filePath.startsWith("file://")) return fileURLToPath(filePath);
68423
69024
  const normalizedFile = filePath.replace(/\\/g, "/");
68424
69025
  if (normalizedFile.startsWith("/") || /^[a-zA-Z]:\//.test(normalizedFile) || /^[a-zA-Z]:\\/.test(filePath)) return filePath;
68425
69026
  return `${rootDirectory.replace(/\\/g, "/").replace(/\/$/, "")}/${normalizedFile.replace(/^\.\//, "")}`;
@@ -70367,11 +70968,6 @@ const getTypescriptScriptKind = (fileName) => {
70367
70968
  if (fileName.endsWith(".ts")) return ts.ScriptKind.TS;
70368
70969
  return ts.ScriptKind.JS;
70369
70970
  };
70370
- const unwrapTypescriptExpression = (expression) => {
70371
- let currentExpression = expression;
70372
- while (ts.isParenthesizedExpression(currentExpression) || ts.isAsExpression(currentExpression) || ts.isSatisfiesExpression(currentExpression) || ts.isNonNullExpression(currentExpression) || ts.isTypeAssertionExpression(currentExpression)) currentExpression = currentExpression.expression;
70373
- return currentExpression;
70374
- };
70375
70971
  const BABEL_CONFIG_FILE_NAMES$1 = [
70376
70972
  "babel.config.js",
70377
70973
  "babel.config.cjs",
@@ -72733,7 +73329,10 @@ var Git = class Git extends Service()("react-doctor/Git") {
72733
73329
  if (argvLengthChars > spawnArgsLengthCap) return yield* foldSpawnFailure(`spawn ENAMETOOLONG (${argvLengthChars} argv chars exceed ${spawnArgsLengthCap})`);
72734
73330
  const handle = yield* spawner.spawn(make$1(input.command, [...input.args], {
72735
73331
  cwd: input.directory,
72736
- env: input.env,
73332
+ env: input.command === "git" ? {
73333
+ ...input.env,
73334
+ GIT_DIR: void 0
73335
+ } : input.env,
72737
73336
  extendEnv: true
72738
73337
  }));
72739
73338
  const maxStdoutBytes = input.maxStdoutBytes;
@@ -73006,7 +73605,7 @@ var Git = class Git extends Service()("react-doctor/Git") {
73006
73605
  "--diff-filter=ACMR",
73007
73606
  "--relative"
73008
73607
  ]).pipe(map$3((result) => {
73009
- if (result.status !== 0) return [];
73608
+ if (result.status !== 0) return null;
73010
73609
  return splitNullSeparated(result.stdout);
73011
73610
  })),
73012
73611
  showStagedContent: (directory, relativePath, options) => runCommand({
@@ -74094,6 +74693,50 @@ const columnOfUtf8Offset = (sourceBuffer, utf8Offset) => {
74094
74693
  while (lineStartOffset > 0 && sourceBuffer[lineStartOffset - 1] !== 10) lineStartOffset--;
74095
74694
  return sourceBuffer.subarray(lineStartOffset, boundedOffset).toString("utf8").length + 1;
74096
74695
  };
74696
+ const utf8OffsetFromSourcePosition = (sourceBuffer, lineNumber, zeroBasedColumn) => {
74697
+ if (lineNumber < 1 || zeroBasedColumn < 0) return null;
74698
+ const sourceLines = sourceBuffer.toString("utf8").split("\n");
74699
+ const sourceLine = sourceLines[lineNumber - 1];
74700
+ if (sourceLine === void 0 || zeroBasedColumn > sourceLine.length) return null;
74701
+ const precedingLines = sourceLines.slice(0, lineNumber - 1).join("\n");
74702
+ return (lineNumber === 1 ? 0 : Buffer.byteLength(precedingLines) + Buffer.byteLength("\n")) + Buffer.byteLength(sourceLine.slice(0, zeroBasedColumn));
74703
+ };
74704
+ const mapPreparedSourceSpan = (span, preparedSourceMap) => {
74705
+ const generatedLine = lineOfUtf8Offset(preparedSourceMap.generatedBuffer, span.offset);
74706
+ const generatedColumn = columnOfUtf8Offset(preparedSourceMap.generatedBuffer, span.offset) - 1;
74707
+ const originalStart = originalPositionFor(preparedSourceMap.traceMap, {
74708
+ line: generatedLine,
74709
+ column: generatedColumn
74710
+ });
74711
+ if (originalStart.source === null || originalStart.line === null || originalStart.column === null) return null;
74712
+ const originalOffset = utf8OffsetFromSourcePosition(preparedSourceMap.sourceBuffer, originalStart.line, originalStart.column);
74713
+ if (originalOffset === null) return null;
74714
+ const generatedSpan = preparedSourceMap.generatedBuffer.subarray(span.offset, span.offset + span.length);
74715
+ return {
74716
+ offset: originalOffset,
74717
+ length: preparedSourceMap.sourceBuffer.subarray(originalOffset, originalOffset + generatedSpan.length).equals(generatedSpan) ? generatedSpan.length : 0,
74718
+ line: originalStart.line,
74719
+ column: originalStart.column + 1
74720
+ };
74721
+ };
74722
+ const mapPreparedSourceLabels = (labels, preparedSourceMap) => {
74723
+ const primaryLabel = labels[0];
74724
+ if (primaryLabel === void 0) return null;
74725
+ const primarySpan = mapPreparedSourceSpan(primaryLabel.span, preparedSourceMap);
74726
+ if (primarySpan === null) return null;
74727
+ const mappedLabels = [{
74728
+ ...primaryLabel,
74729
+ span: primarySpan
74730
+ }];
74731
+ for (const relatedLabel of labels.slice(1)) {
74732
+ const relatedSpan = mapPreparedSourceSpan(relatedLabel.span, preparedSourceMap);
74733
+ if (relatedSpan !== null) mappedLabels.push({
74734
+ ...relatedLabel,
74735
+ span: relatedSpan
74736
+ });
74737
+ }
74738
+ return mappedLabels;
74739
+ };
74097
74740
  const REDACTED_PLACEHOLDER = "<redacted>";
74098
74741
  const KEEP_PREFIX = `$1${REDACTED_PLACEHOLDER}`;
74099
74742
  const KNOWN_SECRET_RULES = [
@@ -74838,7 +75481,7 @@ const isOxlintOutput = (value) => isRecord$1(value) && Array.isArray(value.diagn
74838
75481
  * to the first `{`. Raises `OxlintOutputUnparseable` when the
74839
75482
  * stdout isn't valid JSON or doesn't carry a `diagnostics` array.
74840
75483
  */
74841
- const parseOxlintOutput = (stdout, project, rootDirectory, sourcePathByLintPath) => {
75484
+ const parseOxlintOutput = (stdout, project, rootDirectory, sourcePathByLintPath, sourceMapByLintPath) => {
74842
75485
  if (!stdout) return [];
74843
75486
  const jsonStart = stdout.indexOf("{");
74844
75487
  const sanitizedStdout = jsonStart > 0 ? stdout.slice(jsonStart) : stdout;
@@ -74856,6 +75499,7 @@ const parseOxlintOutput = (stdout, project, rootDirectory, sourcePathByLintPath)
74856
75499
  const sourceLinesCache = /* @__PURE__ */ new Map();
74857
75500
  const resolveAbsolutePath = (filename) => Path.isAbsolute(filename) ? filename : Path.resolve(rootDirectory || ".", filename);
74858
75501
  const resolveMappedSourceFilename = (filename) => sourcePathByLintPath?.get(Path.normalize(resolveAbsolutePath(filename)));
75502
+ const resolvePreparedSourceMap = (filename) => sourceMapByLintPath?.get(Path.normalize(resolveAbsolutePath(filename)));
74859
75503
  const resolveSourceFilename = (filename) => resolveMappedSourceFilename(filename) ?? filename;
74860
75504
  const readSourceBuffer = (filename) => {
74861
75505
  const absolutePath = resolveAbsolutePath(resolveSourceFilename(filename));
@@ -74887,7 +75531,19 @@ const parseOxlintOutput = (stdout, project, rootDirectory, sourcePathByLintPath)
74887
75531
  minifiedFileCache.set(absolutePath, minified);
74888
75532
  return minified;
74889
75533
  };
74890
- 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) => {
75534
+ return suppressMemoizationInBailedOutFunctions(parsed.diagnostics.flatMap((diagnostic) => {
75535
+ const preparedSourceMap = resolvePreparedSourceMap(diagnostic.filename);
75536
+ if (preparedSourceMap === void 0) return [diagnostic];
75537
+ const { plugin, rule } = parseRuleCode(diagnostic.code);
75538
+ if (plugin !== "react-doctor" || !reactDoctorPlugin.rules[rule]?.tags?.includes("design")) return [];
75539
+ const labels = mapPreparedSourceLabels(diagnostic.labels, preparedSourceMap);
75540
+ const sourceFilename = resolveMappedSourceFilename(diagnostic.filename);
75541
+ return labels === null || sourceFilename === void 0 ? [] : [{
75542
+ ...diagnostic,
75543
+ filename: sourceFilename,
75544
+ labels
75545
+ }];
75546
+ }).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) => {
74891
75547
  const { plugin, rule } = parseRuleCode(diagnostic.code);
74892
75548
  const primaryLabel = diagnostic.labels[0];
74893
75549
  const cleaned = cleanDiagnosticMessage(diagnostic.message, diagnostic.help, plugin, rule, project);
@@ -75105,7 +75761,7 @@ const isParallelismRelatedSpawnError = (error) => {
75105
75761
  * loop with a slimmer config in that case.
75106
75762
  */
75107
75763
  const spawnLintBatches = async (input) => {
75108
- const { baseArgs, fileBatches, rootDirectory, nodeBinaryPath, project, sourcePathByLintPath, onPartialFailure, onFileProgress, spawnTimeoutMs, outputMaxBytes, splitTotalBudgetMs = OXLINT_SPLIT_TOTAL_BUDGET_MS, splitMaxDepth = 8, signal, deadlineEpochMs } = input;
75764
+ const { baseArgs, fileBatches, rootDirectory, nodeBinaryPath, project, sourcePathByLintPath, sourceMapByLintPath, onPartialFailure, onFileProgress, spawnTimeoutMs, outputMaxBytes, splitTotalBudgetMs = OXLINT_SPLIT_TOTAL_BUDGET_MS, splitMaxDepth = 8, signal, deadlineEpochMs } = input;
75109
75765
  const resolveSourcePath = (filePath) => {
75110
75766
  const absoluteFilePath = Path.isAbsolute(filePath) ? filePath : Path.resolve(rootDirectory, filePath);
75111
75767
  return sourcePathByLintPath?.get(Path.normalize(absoluteFilePath)) ?? filePath;
@@ -75129,7 +75785,7 @@ const spawnLintBatches = async (input) => {
75129
75785
  }
75130
75786
  const batchArgs = [...baseArgs, ...batch];
75131
75787
  try {
75132
- return parseOxlintOutput(await spawnOxlint(batchArgs, rootDirectory, nodeBinaryPath, spawnTimeoutMs, outputMaxBytes, signal), project, rootDirectory, sourcePathByLintPath);
75788
+ return parseOxlintOutput(await spawnOxlint(batchArgs, rootDirectory, nodeBinaryPath, spawnTimeoutMs, outputMaxBytes, signal), project, rootDirectory, sourcePathByLintPath, sourceMapByLintPath);
75133
75789
  } catch (error) {
75134
75790
  if (!isSplittableReactDoctorError(error)) throw error;
75135
75791
  if (isPastDeadline()) {
@@ -75568,20 +76224,47 @@ const prepareHtmlScriptSource = (sourceBuffer) => {
75568
76224
  lintBuffer: maskedBuffer ?? sourceBuffer
75569
76225
  };
75570
76226
  };
75571
- const prepareHtmlLintSources = (rootDirectory, temporaryDirectory, candidateFiles) => {
76227
+ const ASTRO_FILE_PATTERN = /\.astro$/;
76228
+ const prepareLintSources = (rootDirectory, temporaryDirectory, candidateFiles) => {
75572
76229
  const lintFiles = [];
75573
76230
  const sourcePathByLintPath = /* @__PURE__ */ new Map();
76231
+ const sourceMapByLintPath = /* @__PURE__ */ new Map();
75574
76232
  const sizeByLintPath = /* @__PURE__ */ new Map();
75575
76233
  const htmlSourcesDirectory = Path.join(temporaryDirectory, "html-sources");
76234
+ const astroSourcesDirectory = Path.join(temporaryDirectory, "astro-sources");
75576
76235
  let htmlFileIndex = 0;
76236
+ let astroFileIndex = 0;
75577
76237
  let hasThreeModuleImport = false;
75578
76238
  for (const candidateFile of candidateFiles) {
75579
- if (!HTML_FILE_PATTERN.test(candidateFile)) {
76239
+ if (!HTML_FILE_PATTERN.test(candidateFile) && !ASTRO_FILE_PATTERN.test(candidateFile)) {
75580
76240
  lintFiles.push(candidateFile);
75581
76241
  continue;
75582
76242
  }
75583
76243
  const absoluteSourcePath = Path.isAbsolute(candidateFile) ? candidateFile : Path.resolve(rootDirectory, candidateFile);
75584
76244
  const sourceBuffer = NFS.readFileSync(absoluteSourcePath);
76245
+ if (ASTRO_FILE_PATTERN.test(candidateFile)) {
76246
+ const compilerSourcePath = absoluteSourcePath.replaceAll("\\", "/");
76247
+ const convertedSource = convertToTSX(sourceBuffer.toString("utf8"), {
76248
+ filename: compilerSourcePath,
76249
+ sourcemap: "external",
76250
+ includeScripts: true
76251
+ });
76252
+ if (astroFileIndex === 0) NFS.mkdirSync(astroSourcesDirectory, { recursive: true });
76253
+ const lintPath = Path.join(astroSourcesDirectory, `${astroFileIndex}.tsx`);
76254
+ const generatedBuffer = Buffer.from(convertedSource.code);
76255
+ NFS.writeFileSync(lintPath, generatedBuffer);
76256
+ lintFiles.push(candidateFile);
76257
+ lintFiles.push(lintPath);
76258
+ sourcePathByLintPath.set(Path.resolve(lintPath), candidateFile);
76259
+ sourceMapByLintPath.set(Path.resolve(lintPath), {
76260
+ traceMap: new TraceMap(JSON.stringify(convertedSource.map)),
76261
+ generatedBuffer,
76262
+ sourceBuffer
76263
+ });
76264
+ sizeByLintPath.set(lintPath, sourceBuffer.length);
76265
+ astroFileIndex++;
76266
+ continue;
76267
+ }
75585
76268
  const { executableScriptBodies, lintBuffer } = prepareHtmlScriptSource(sourceBuffer);
75586
76269
  if (htmlFileIndex === 0) NFS.mkdirSync(htmlSourcesDirectory, { recursive: true });
75587
76270
  const lintPath = Path.join(htmlSourcesDirectory, `${htmlFileIndex}.astro`);
@@ -75595,6 +76278,7 @@ const prepareHtmlLintSources = (rootDirectory, temporaryDirectory, candidateFile
75595
76278
  return {
75596
76279
  lintFiles,
75597
76280
  sourcePathByLintPath,
76281
+ sourceMapByLintPath,
75598
76282
  sizeByLintPath,
75599
76283
  hasThreeModuleImport
75600
76284
  };
@@ -75813,10 +76497,10 @@ const runOxlint = async (options) => {
75813
76497
  rootDirectory,
75814
76498
  candidateFiles
75815
76499
  });
75816
- const preparedHtmlSources = prepareHtmlLintSources(rootDirectory, configDirectory, candidateFiles);
75817
- const lintFiles = preparedHtmlSources.lintFiles;
75818
- const hasHtmlFiles = preparedHtmlSources.sourcePathByLintPath.size > 0;
75819
- const lintProject = !project.hasThree && preparedHtmlSources.hasThreeModuleImport ? {
76500
+ const preparedLintSources = prepareLintSources(rootDirectory, configDirectory, candidateFiles);
76501
+ const lintFiles = preparedLintSources.lintFiles;
76502
+ const hasPreparedFiles = preparedLintSources.sourcePathByLintPath.size > 0;
76503
+ const lintProject = !project.hasThree && preparedLintSources.hasThreeModuleImport ? {
75820
76504
  ...project,
75821
76505
  hasThree: true
75822
76506
  } : project;
@@ -75838,7 +76522,7 @@ const runOxlint = async (options) => {
75838
76522
  sidecarRuleIdFilter: overrides.sidecarRuleIdFilter
75839
76523
  });
75840
76524
  const sizeByFile = sizedScanFiles !== null && lintBatchOrdering === "cost" ? new Map(sizedScanFiles.map((entry) => [entry.path, entry.sizeBytes])) : null;
75841
- if (sizeByFile !== null) for (const [lintPath, sizeBytes] of preparedHtmlSources.sizeByLintPath) sizeByFile.set(lintPath, sizeBytes);
76525
+ if (sizeByFile !== null) for (const [lintPath, sizeBytes] of preparedLintSources.sizeByLintPath) sizeByFile.set(lintPath, sizeBytes);
75842
76526
  const buildFileBatches = (passBaseArgs, passFiles) => sizeByFile !== null ? planLintBatches({
75843
76527
  baseArgs: passBaseArgs,
75844
76528
  files: passFiles,
@@ -75868,7 +76552,8 @@ const runOxlint = async (options) => {
75868
76552
  rootDirectory,
75869
76553
  nodeBinaryPath,
75870
76554
  project: lintProject,
75871
- sourcePathByLintPath: preparedHtmlSources.sourcePathByLintPath,
76555
+ sourcePathByLintPath: preparedLintSources.sourcePathByLintPath,
76556
+ sourceMapByLintPath: preparedLintSources.sourceMapByLintPath,
75872
76557
  onPartialFailure: reportPartialFailure,
75873
76558
  onAnalyzedFiles: (filePaths) => {
75874
76559
  analyzedFiles = filePaths;
@@ -75903,7 +76588,7 @@ const runOxlint = async (options) => {
75903
76588
  };
75904
76589
  }
75905
76590
  };
75906
- if (perFileLintCacheEnabled && !project.hasReactCompiler && project.hasReactCompilerLintPlugin !== true && extendsPaths.length === 0 && userPlugins.length === 0 && !hasHtmlFiles) {
76591
+ if (perFileLintCacheEnabled && !project.hasReactCompiler && project.hasReactCompilerLintPlugin !== true && extendsPaths.length === 0 && userPlugins.length === 0 && !hasPreparedFiles) {
75907
76592
  const rulesetHash = computeRulesetHash({
75908
76593
  config: buildConfig({
75909
76594
  extendsPaths: [],
@@ -76069,7 +76754,8 @@ const runOxlint = async (options) => {
76069
76754
  rootDirectory,
76070
76755
  nodeBinaryPath,
76071
76756
  project: lintProject,
76072
- sourcePathByLintPath: preparedHtmlSources.sourcePathByLintPath,
76757
+ sourcePathByLintPath: preparedLintSources.sourcePathByLintPath,
76758
+ sourceMapByLintPath: preparedLintSources.sourceMapByLintPath,
76073
76759
  onPartialFailure,
76074
76760
  onAnalyzedFiles: (filePaths) => {
76075
76761
  analyzedFiles = filePaths;
@@ -77429,10 +78115,14 @@ const materializeSourceTree = (input) => gen(function* () {
77429
78115
  materializedFiles.push(relativePath);
77430
78116
  }
77431
78117
  yield* sync(() => {
77432
- for (const configFilename of STAGED_FILES_PROJECT_CONFIG_FILENAMES) {
77433
- const sourcePath = path.join(input.directory, configFilename);
77434
- const targetPath = path.join(resolvedTempDirectory, configFilename);
77435
- if (fs.existsSync(sourcePath) && !fs.existsSync(targetPath)) fs.cpSync(sourcePath, targetPath);
78118
+ for (const subdirectory of ["", ...input.configSubdirectories ?? []]) for (const configFilename of STAGED_FILES_PROJECT_CONFIG_FILENAMES) {
78119
+ const sourcePath = path.join(input.directory, subdirectory, configFilename);
78120
+ const targetPath = path.resolve(resolvedTempDirectory, subdirectory, configFilename);
78121
+ if (!isPathInsideDirectory(targetPath, resolvedTempDirectory)) continue;
78122
+ if (fs.existsSync(sourcePath) && !fs.existsSync(targetPath)) {
78123
+ fs.mkdirSync(path.dirname(targetPath), { recursive: true });
78124
+ fs.cpSync(sourcePath, targetPath);
78125
+ }
77436
78126
  }
77437
78127
  });
77438
78128
  return {
@@ -77465,15 +78155,17 @@ var StagedFiles = class StagedFiles extends Service()("react-doctor/StagedFiles"
77465
78155
  static layerNode = effect(StagedFiles, gen(function* () {
77466
78156
  const git = yield* Git;
77467
78157
  return StagedFiles.of({
77468
- discoverSourceFiles: (directory) => git.stagedFilePaths(directory).pipe(map$3((entries) => entries.filter(isLintableSourceFile)), withSpan("StagedFiles.discoverSourceFiles")),
77469
- materialize: ({ directory, stagedFiles, tempDirectory }) => materializeSourceTree({
78158
+ discoverSourceFiles: (directory) => git.stagedFilePaths(directory).pipe(map$3((entries) => entries === null ? null : entries.filter(isLintableSourceFile)), withSpan("StagedFiles.discoverSourceFiles")),
78159
+ materialize: ({ directory, stagedFiles, tempDirectory, configSubdirectories }) => materializeSourceTree({
77470
78160
  directory,
77471
78161
  files: stagedFiles,
77472
78162
  tempDirectory,
78163
+ configSubdirectories,
77473
78164
  readContent: (relativePath) => git.showStagedContent(directory, relativePath, { maxBufferBytes: GIT_SHOW_MAX_BUFFER_BYTES })
77474
78165
  }).pipe(map$3((tree) => ({
77475
78166
  tempDirectory: tree.tempDirectory,
77476
78167
  stagedFiles: tree.materializedFiles,
78168
+ unmaterializedFiles: tree.unmaterializedFiles,
77477
78169
  cleanup: tree.cleanup
77478
78170
  })), withSpan("StagedFiles.materialize"))
77479
78171
  });
@@ -77488,6 +78180,7 @@ var StagedFiles = class StagedFiles extends Service()("react-doctor/StagedFiles"
77488
78180
  materialize: ({ tempDirectory }) => succeed$2({
77489
78181
  tempDirectory,
77490
78182
  stagedFiles: snapshot.materializedFiles ?? snapshot.sourceFiles ?? [],
78183
+ unmaterializedFiles: [],
77491
78184
  cleanup: () => {}
77492
78185
  })
77493
78186
  }));
@@ -78184,6 +78877,7 @@ const BASELINE_FILES_TEMP_DIR_PREFIX = "react-doctor-baseline-";
78184
78877
  const SCAN_RESULT_CACHE_FILENAME = "scan-cache.json";
78185
78878
  const RUN_GIT_MAX_BUFFER_BYTES = 64 * 1024 * 1024;
78186
78879
  const GH_DEFAULT_BRANCH_PROBE_TIMEOUT_MS = 5e3;
78880
+ const TUI_REPORT_COMPACT_MAX_ROWS = 29;
78187
78881
  const TUI_REPORT_DETAIL_WIDTH_FRACTION = .6;
78188
78882
  const CI_TRUST_COMPANIES = "PayPal, Rippling, and Alibaba";
78189
78883
  const WELCOME_EXPLANATION_HOLD_MS = 1e3;
@@ -78196,11 +78890,13 @@ const METRIC = {
78196
78890
  cliError: "cli.error",
78197
78891
  cliEnvironmentError: "cli.env_error",
78198
78892
  stagedSnapshotDivergence: "staged.snapshot_divergence",
78893
+ stagedPerProject: "staged.per_project",
78199
78894
  projectDetected: "project.detected",
78200
78895
  projectPathSelected: "project.path_selected",
78201
78896
  projectConfigSelected: "project.config_selected",
78202
78897
  scanCompleted: "scan.completed",
78203
78898
  scanDuration: "scan.duration",
78899
+ scanFeedbackDelay: "scan.feedback_delay",
78204
78900
  scanPhaseDuration: "scan.phase_duration",
78205
78901
  scanFiles: "scan.files",
78206
78902
  scanScore: "scan.score",
@@ -78232,6 +78928,10 @@ const METRIC = {
78232
78928
  lspScanCompleted: "lsp.scan.completed",
78233
78929
  lspScanDuration: "lsp.scan.duration",
78234
78930
  lspScanDiagnostics: "lsp.scan.diagnostics",
78931
+ tuiActionMenuOpened: "tui.action_menu_opened",
78932
+ tuiCompactReportShown: "tui.compact_report_shown",
78933
+ tuiFindingNavigated: "tui.finding_navigated",
78934
+ tuiStackedReportCapped: "tui.stacked_report_capped",
78235
78935
  aiTrainingWarningShown: "ai.training.warning_shown",
78236
78936
  jsonOutUsed: "json.out_used"
78237
78937
  };
@@ -78276,7 +78976,7 @@ const makeNoopConsole = () => ({
78276
78976
  });
78277
78977
  //#endregion
78278
78978
  //#region src/cli/utils/version.ts
78279
- const VERSION = "0.9.1-dev.b1b62db";
78979
+ const VERSION = "0.9.2-dev.01ca0b3";
78280
78980
  //#endregion
78281
78981
  //#region src/cli/utils/json-mode.ts
78282
78982
  let context = null;
@@ -78634,13 +79334,13 @@ const isDevVersion = (version) => version === "0.0.0" || version.includes("-");
78634
79334
  * uploads source-map artifacts under, so stack frames symbolicate. Honors the
78635
79335
  * standard `SENTRY_RELEASE` override.
78636
79336
  */
78637
- const resolveSentryRelease = () => process.env.SENTRY_RELEASE || `react-doctor@0.9.1-dev.b1b62db`;
79337
+ const resolveSentryRelease = () => process.env.SENTRY_RELEASE || `react-doctor@0.9.2-dev.01ca0b3`;
78638
79338
  /**
78639
79339
  * Deployment environment shown in Sentry's environment filter. Defaults to
78640
79340
  * `production` for tagged releases and `development` for dev/unbuilt versions,
78641
79341
  * overridable via the standard `SENTRY_ENVIRONMENT` env var.
78642
79342
  */
78643
- const resolveSentryEnvironment = () => process.env.SENTRY_ENVIRONMENT || (isDevVersion("0.9.1-dev.b1b62db") ? "development" : "production");
79343
+ const resolveSentryEnvironment = () => process.env.SENTRY_ENVIRONMENT || (isDevVersion("0.9.2-dev.01ca0b3") ? "development" : "production");
78644
79344
  /**
78645
79345
  * Performance-tracing sample rate in `[0, 1]`. Reads `SENTRY_TRACES_SAMPLE_RATE`
78646
79346
  * (set to `0` to disable tracing) and falls back to
@@ -92097,16 +92797,19 @@ const formatClusterLocation = (cluster, resolveSourceRoot, hyperlinks) => {
92097
92797
  if (!hyperlinks) return `${location}${contextTag}`;
92098
92798
  return `${formatHyperlink(location, pathToFileURL(resolveAbsolutePath(lead.filePath, resolveSourceRoot(lead))).href)}${contextTag}`;
92099
92799
  };
92100
- const buildDiagnosticClusterLines = (cluster, resolveSourceRoot, renderCodeFrame, hyperlinks) => {
92800
+ const buildDiagnosticClusterLines = (cluster, resolveSourceRoot, resolveFrameSourceRoot, renderCodeFrame, hyperlinks) => {
92101
92801
  const lead = cluster.diagnostics[0];
92102
92802
  const isMultiSite = cluster.diagnostics.length > 1;
92803
+ const sourceRoot = resolveSourceRoot(lead);
92804
+ const frameSourceRoot = resolveFrameSourceRoot(lead);
92805
+ const frameFilePath = Path.isAbsolute(lead.filePath) && sourceRoot !== frameSourceRoot ? Path.relative(sourceRoot, lead.filePath) : lead.filePath;
92103
92806
  const lines = ["", highlighter.gray(`${TOP_ERROR_DETAIL_INDENT}${formatClusterLocation(cluster, resolveSourceRoot, hyperlinks)}`)];
92104
92807
  const codeFrame = renderCodeFrame ? buildCodeFrame({
92105
- filePath: lead.filePath,
92808
+ filePath: frameFilePath,
92106
92809
  line: cluster.startLine,
92107
92810
  column: isMultiSite ? 0 : lead.column,
92108
92811
  endLine: isMultiSite ? cluster.endLine : void 0,
92109
- rootDirectory: resolveSourceRoot(lead)
92812
+ rootDirectory: frameSourceRoot
92110
92813
  }) : null;
92111
92814
  if (codeFrame) {
92112
92815
  const boxInnerWidth = resolveMeasureWidth(8);
@@ -92119,7 +92822,7 @@ const buildDiagnosticClusterLines = (cluster, resolveSourceRoot, renderCodeFrame
92119
92822
  }
92120
92823
  return lines;
92121
92824
  };
92122
- const buildRuleDetailBlock = (ruleKey, ruleDiagnostics, resolveSourceRoot, renderEverySite, isAgentEnvironment, hyperlinks) => {
92825
+ const buildRuleDetailBlock = (ruleKey, ruleDiagnostics, resolveSourceRoot, resolveFrameSourceRoot, renderEverySite, isAgentEnvironment, hyperlinks) => {
92123
92826
  const representative = pickRepresentativeDiagnostic(ruleDiagnostics);
92124
92827
  const { severity } = representative;
92125
92828
  const trailingBadge = formatTrailingSiteBadge(ruleDiagnostics.length);
@@ -92141,7 +92844,7 @@ const buildRuleDetailBlock = (ruleKey, ruleDiagnostics, resolveSourceRoot, rende
92141
92844
  }
92142
92845
  const renderCodeFrame = severity === "error";
92143
92846
  const sites = renderEverySite ? ruleDiagnostics : [representative];
92144
- if (!(isCollapsedWarningGroup && representative.help.includes(representative.filePath))) for (const cluster of clusterNearbyDiagnostics(sites)) lines.push(...buildDiagnosticClusterLines(cluster, resolveSourceRoot, renderCodeFrame, hyperlinks));
92847
+ if (!(isCollapsedWarningGroup && representative.help.includes(representative.filePath))) for (const cluster of clusterNearbyDiagnostics(sites)) lines.push(...buildDiagnosticClusterLines(cluster, resolveSourceRoot, resolveFrameSourceRoot, renderCodeFrame, hyperlinks));
92145
92848
  return lines;
92146
92849
  };
92147
92850
  const selectErrorRuleGroups = (diagnostics, rulePriority) => buildSortedRuleGroups(diagnostics.filter((diagnostic) => diagnostic.severity === "error"), rulePriority);
@@ -92167,7 +92870,7 @@ const buildMigrationScaleAdvisoryLines = (diagnostics) => {
92167
92870
  return lines;
92168
92871
  };
92169
92872
  const getTopErrorRuleKeys = (diagnostics, limit, rulePriority) => new Set(selectTopErrorRuleGroups(diagnostics, limit, rulePriority).map(([ruleKey]) => ruleKey));
92170
- const buildTopErrorsSection = (diagnostics, resolveSourceRoot, hyperlinks, rulePriority) => {
92873
+ const buildTopErrorsSection = (diagnostics, resolveSourceRoot, resolveFrameSourceRoot, hyperlinks, rulePriority) => {
92171
92874
  const topRuleGroups = selectErrorRuleGroups(diagnostics, rulePriority).slice(0, 3);
92172
92875
  if (topRuleGroups.length === 0) return {
92173
92876
  lines: [],
@@ -92177,7 +92880,7 @@ const buildTopErrorsSection = (diagnostics, resolveSourceRoot, hyperlinks, ruleP
92177
92880
  const blockOffsets = [];
92178
92881
  for (const [ruleKey, ruleDiagnostics] of topRuleGroups) {
92179
92882
  blockOffsets.push(lines.length);
92180
- lines.push(...buildRuleDetailBlock(ruleKey, ruleDiagnostics, resolveSourceRoot, false, false, hyperlinks));
92883
+ lines.push(...buildRuleDetailBlock(ruleKey, ruleDiagnostics, resolveSourceRoot, resolveFrameSourceRoot, false, false, hyperlinks));
92181
92884
  lines.push("");
92182
92885
  }
92183
92886
  return {
@@ -92215,18 +92918,19 @@ const buildOverviewHeaderLines = (diagnostics) => {
92215
92918
  * single Effect.forEach over Console.log so failures or fiber
92216
92919
  * interruption produce predictable partial output.
92217
92920
  */
92218
- const printDiagnostics = (diagnostics, isVerbose, sourceRoot, rulePriority, isAgentEnvironment = false, onboarding = {}, hyperlinks = false) => gen(function* () {
92921
+ const printDiagnostics = (diagnostics, isVerbose, sourceRoot, rulePriority, isAgentEnvironment = false, onboarding = {}, hyperlinks = false, frameSourceRoot = sourceRoot) => gen(function* () {
92219
92922
  const sectionPause = onboarding.sectionPause ?? void_;
92220
92923
  const animateCountUp = onboarding.animateCountUp ?? false;
92221
92924
  const resolveSourceRoot = typeof sourceRoot === "function" ? sourceRoot : () => sourceRoot;
92925
+ const resolveFrameSourceRoot = typeof frameSourceRoot === "function" ? frameSourceRoot : () => frameSourceRoot;
92222
92926
  let detailLines;
92223
92927
  let topErrorBlockOffsets = [];
92224
92928
  if (!isVerbose) {
92225
- const topErrors = buildTopErrorsSection(diagnostics, resolveSourceRoot, hyperlinks, rulePriority);
92929
+ const topErrors = buildTopErrorsSection(diagnostics, resolveSourceRoot, resolveFrameSourceRoot, hyperlinks, rulePriority);
92226
92930
  detailLines = topErrors.lines;
92227
92931
  topErrorBlockOffsets = topErrors.blockOffsets;
92228
92932
  } else detailLines = buildSortedRuleGroups(diagnostics, rulePriority).flatMap(([ruleKey, ruleDiagnostics]) => {
92229
- return [...buildRuleDetailBlock(ruleKey, ruleDiagnostics, resolveSourceRoot, true, isAgentEnvironment, hyperlinks), ""];
92933
+ return [...buildRuleDetailBlock(ruleKey, ruleDiagnostics, resolveSourceRoot, resolveFrameSourceRoot, true, isAgentEnvironment, hyperlinks), ""];
92230
92934
  });
92231
92935
  const overflowLine = isVerbose ? void 0 : buildOverflowSummaryLine(diagnostics, rulePriority);
92232
92936
  const categoryTallies = buildCategoryDiagnosticGroups(diagnostics, rulePriority).map(buildCategoryTally);
@@ -93490,26 +94194,26 @@ const finalizeAndRender = (input) => gen(function* () {
93490
94194
  //#region src/cli/utils/get-staged-files.ts
93491
94195
  const stagedFilesLayer = StagedFiles.layerNode.pipe(provide$2(Git.layerNode));
93492
94196
  const getStagedSourceFiles = async (directory) => {
94197
+ let stagedSourceFiles;
93493
94198
  try {
93494
- return [...await runPromise(gen(function* () {
94199
+ stagedSourceFiles = await runPromise(gen(function* () {
93495
94200
  return yield* (yield* StagedFiles).discoverSourceFiles(directory);
93496
- }).pipe(provide(stagedFilesLayer)))];
94201
+ }).pipe(provide(stagedFilesLayer)));
93497
94202
  } catch (error) {
93498
94203
  cliLogger.warn(`Failed to discover staged files: ${messageFromUnknown(error)}`);
93499
94204
  return [];
93500
94205
  }
94206
+ if (stagedSourceFiles === null) throw new CliInputError("Could not read the git index to list staged files. Check that git can read the index in this directory.");
94207
+ return [...stagedSourceFiles];
93501
94208
  };
93502
- const materializeStagedFiles = async (directory, stagedFiles, tempDirectory) => {
94209
+ const materializeStagedFiles = async (input) => {
93503
94210
  const snapshot = await runPromise(gen(function* () {
93504
- return yield* (yield* StagedFiles).materialize({
93505
- directory,
93506
- stagedFiles,
93507
- tempDirectory
93508
- });
94211
+ return yield* (yield* StagedFiles).materialize(input);
93509
94212
  }).pipe(provide(stagedFilesLayer)));
93510
94213
  return {
93511
94214
  tempDirectory: snapshot.tempDirectory,
93512
94215
  stagedFiles: [...snapshot.stagedFiles],
94216
+ unmaterializedFiles: [...snapshot.unmaterializedFiles],
93513
94217
  cleanup: snapshot.cleanup
93514
94218
  };
93515
94219
  };
@@ -95383,13 +96087,18 @@ const printMultiProjectSummary = (input) => gen(function* () {
95383
96087
  const scoreDiagnostics = new Set(filterScansForSurface(completedScans, "score"));
95384
96088
  const displayedScoreDiagnostics = displayDiagnostics.filter((diagnostic) => scoreDiagnostics.has(diagnostic));
95385
96089
  const projectRootByDiagnostic = /* @__PURE__ */ new WeakMap();
95386
- for (const scan of completedScans) for (const diagnostic of scan.result.diagnostics) projectRootByDiagnostic.set(diagnostic, scan.result.project.rootDirectory);
96090
+ const frameSourceRootByDiagnostic = /* @__PURE__ */ new WeakMap();
96091
+ for (const scan of completedScans) for (const diagnostic of scan.result.diagnostics) {
96092
+ projectRootByDiagnostic.set(diagnostic, scan.result.project.rootDirectory);
96093
+ frameSourceRootByDiagnostic.set(diagnostic, scan.frameSourceRoot ?? scan.result.project.rootDirectory);
96094
+ }
95387
96095
  const resolveDiagnosticSourceRoot = (diagnostic) => projectRootByDiagnostic.get(diagnostic) ?? "";
96096
+ const resolveDiagnosticFrameSourceRoot = (diagnostic) => frameSourceRootByDiagnostic.get(diagnostic) ?? resolveDiagnosticSourceRoot(diagnostic);
95388
96097
  const totalScannedFileCount = countUniqueScannedFiles(completedScans.map((scan) => scan.result));
95389
96098
  yield* log(`${highlighter.success("✔")} Scanned ${totalScannedFileCount} ${totalScannedFileCount === 1 ? "file" : "files"} in ${formatElapsedTime(totalElapsedMilliseconds)}`);
95390
96099
  if (displayDiagnostics.length > 0) {
95391
96100
  yield* log("");
95392
- yield* printDiagnostics(displayDiagnostics, verbose, resolveDiagnosticSourceRoot, buildRulePriorityMap(completedScans.map((scan) => scan.result.score)), isCodingAgentEnvironment(), { animateCountUp: animateRender }, shouldRenderHyperlinks(process.stdout));
96101
+ yield* printDiagnostics(displayDiagnostics, verbose, resolveDiagnosticSourceRoot, buildRulePriorityMap(completedScans.map((scan) => scan.result.score)), isCodingAgentEnvironment(), { animateCountUp: animateRender }, shouldRenderHyperlinks(process.stdout), resolveDiagnosticFrameSourceRoot);
95393
96102
  }
95394
96103
  const lowestScoredScan = findLowestScoredScan(completedScans);
95395
96104
  const aggregateScore = lowestScoredScan?.result.score ?? null;
@@ -95777,6 +96486,45 @@ const runExplain = async (fileLineArgument, context) => {
95777
96486
  }
95778
96487
  };
95779
96488
  //#endregion
96489
+ //#region src/cli/utils/run-project-scan-batch.ts
96490
+ /**
96491
+ * Run one scan per project through the same bounded pool as
96492
+ * `diagnose({ projects })`, with the batch spinner and its progress counter.
96493
+ *
96494
+ * Pool members must not toggle the module-level spinner-silent flag themselves —
96495
+ * overlapping save/restore pairs would race — so the batch owns that toggle once
96496
+ * around the whole run.
96497
+ *
96498
+ * A `scanProject` that returns `null` drops the project from the results: diff
96499
+ * mode skips projects with no changed source.
96500
+ */
96501
+ const runProjectScanBatch = async (input) => {
96502
+ const startTime = performance$1.now();
96503
+ const projectCount = input.projects.length;
96504
+ const isMultiProject = projectCount > 1;
96505
+ const batchSpinner = isMultiProject && !input.isQuiet ? spinner(`Scanning ${projectCount} projects…`).start() : null;
96506
+ const ownsBatchSpinnerSilence = isMultiProject && input.isSilent;
96507
+ const wasSpinnerSilent = isSpinnerSilent();
96508
+ if (ownsBatchSpinnerSilence) setSpinnerSilent(true);
96509
+ let finishedProjectCount = 0;
96510
+ let scanOutcomes;
96511
+ try {
96512
+ scanOutcomes = await mapWithConcurrency(input.projects, isMultiProject ? 4 : 1, async (project) => {
96513
+ const scanOutcome = await input.scanProject(project);
96514
+ finishedProjectCount += 1;
96515
+ batchSpinner?.update(`Scanning ${projectCount} projects… (${finishedProjectCount}/${projectCount})`);
96516
+ return scanOutcome;
96517
+ });
96518
+ } finally {
96519
+ if (ownsBatchSpinnerSilence) setSpinnerSilent(wasSpinnerSilent);
96520
+ batchSpinner?.stop();
96521
+ }
96522
+ return {
96523
+ completedScans: scanOutcomes.filter((scanOutcome) => scanOutcome !== null),
96524
+ elapsedMilliseconds: performance$1.now() - startTime
96525
+ };
96526
+ };
96527
+ //#endregion
95780
96528
  //#region src/cli/utils/project-manifest-changed.ts
95781
96529
  const PACKAGE_JSON = "package.json";
95782
96530
  /**
@@ -95793,6 +96541,29 @@ const projectManifestChanged = (rootDirectory, projectDirectory, diffInfo) => {
95793
96541
  return diffInfo.changedFiles.some((filePath) => toForwardSlashes(filePath) === manifestPath);
95794
96542
  };
95795
96543
  //#endregion
96544
+ //#region src/cli/utils/select-staged-projects.ts
96545
+ /**
96546
+ * Appended to the reason a `--staged` run could not scan per package. Shared so
96547
+ * both fallback sites word it identically.
96548
+ */
96549
+ const STAGED_PROJECT_FALLBACK_HINT = "Scanning the staged files at the scan root instead — fix the `projects` entries in your config to scan per package.";
96550
+ /**
96551
+ * Resolve the project directories a `--staged` scan owns. The interactive picker
96552
+ * is always skipped: a commit hook has nobody to answer it.
96553
+ */
96554
+ const selectStagedProjects = async (input) => {
96555
+ if (input.projectFlag) return selectProjects(input.rootDirectory, input.projectFlag, true, void 0);
96556
+ if (input.configProjects === void 0) return [input.rootDirectory];
96557
+ try {
96558
+ return await selectProjects(input.rootDirectory, void 0, true, input.configProjects);
96559
+ } catch (error) {
96560
+ if (!(error instanceof CliInputError)) throw error;
96561
+ cliLogger.warn(`${error.message} ${STAGED_PROJECT_FALLBACK_HINT}`);
96562
+ cliLogger.break();
96563
+ return [input.rootDirectory];
96564
+ }
96565
+ };
96566
+ //#endregion
95796
96567
  //#region src/cli/utils/should-fail-scan-gate.ts
95797
96568
  const shouldFailScanGate = (input) => {
95798
96569
  if (input.blockingLevel === "none") return false;
@@ -95958,6 +96729,7 @@ const inspectAction = async (directory, flags, invocationCommand = "inspect") =>
95958
96729
  const isQuiet = isScoreOnly || isJsonMode;
95959
96730
  const requestedDirectory = Path.resolve(directory);
95960
96731
  const startTime = performance$1.now();
96732
+ let scanStartupSpinner = null;
95961
96733
  if (isJsonMode) {
95962
96734
  enableJsonMode({
95963
96735
  compact: Boolean(flags.jsonCompact),
@@ -96013,8 +96785,13 @@ const inspectAction = async (directory, flags, invocationCommand = "inspect") =>
96013
96785
  json: flags.json
96014
96786
  });
96015
96787
  if (flags.staged) {
96016
- const stagedFiles = await getStagedSourceFiles(resolvedDirectory);
96017
- if (stagedFiles.length === 0) {
96788
+ const configProjectsApply = (userConfig?.projects ?? []).some((projectName) => projectName.trim().length > 0) && scanTarget.requestedDirectory === scanTarget.configSourceDirectory;
96789
+ const projectDirectories = await selectStagedProjects({
96790
+ rootDirectory: resolvedDirectory,
96791
+ projectFlag: flags.project,
96792
+ configProjects: configProjectsApply ? userConfig?.projects : void 0
96793
+ });
96794
+ const reportNothingToScan = (input) => {
96018
96795
  if (isJsonMode) writeJsonReport(buildJsonReport({
96019
96796
  version: VERSION,
96020
96797
  directory: resolvedDirectory,
@@ -96023,75 +96800,214 @@ const inspectAction = async (directory, flags, invocationCommand = "inspect") =>
96023
96800
  scans: [],
96024
96801
  totalElapsedMilliseconds: performance$1.now() - startTime
96025
96802
  }));
96026
- else if (!isScoreOnly) cliLogger.dim("No staged source files found.");
96803
+ else if (!isScoreOnly) if (input.severity === "warn") {
96804
+ cliLogger.warn(input.reason);
96805
+ cliLogger.break();
96806
+ } else cliLogger.dim(input.reason);
96807
+ };
96808
+ const rootStagedFiles = await getStagedSourceFiles(resolvedDirectory);
96809
+ if (rootStagedFiles.length === 0) {
96810
+ reportNothingToScan({ reason: "No staged source files found." });
96027
96811
  return;
96028
96812
  }
96029
- if (!isQuiet) {
96030
- cliLogger.log(`Scanning ${highlighter.info(`${stagedFiles.length}`)} staged files...`);
96813
+ const buildProjectScanContext = async (projectDirectory) => {
96814
+ const projectScanTarget = projectDirectory === resolvedDirectory ? scanTarget : await resolveScanTarget(projectDirectory, { allowAmbiguous: true });
96815
+ const scanDirectory = projectScanTarget.resolvedDirectory;
96816
+ const treeRelativeDirectory = resolveProjectRelativeDirectory(resolvedDirectory, scanDirectory);
96817
+ if (treeRelativeDirectory === null) return null;
96818
+ return {
96819
+ projectDirectory,
96820
+ scanDirectory,
96821
+ treeRelativeDirectory,
96822
+ projectConfig: projectDirectory === resolvedDirectory ? userConfig : mergeReactDoctorConfigs(userConfig, projectScanTarget.userConfig ?? void 0),
96823
+ projectConfigSourceDirectory: projectScanTarget.userConfig?.plugins === void 0 ? scanTarget.configSourceDirectory : projectScanTarget.configSourceDirectory
96824
+ };
96825
+ };
96826
+ const projectScanContexts = [];
96827
+ const seenScanDirectories = /* @__PURE__ */ new Set();
96828
+ for (const projectDirectory of projectDirectories) {
96829
+ const projectScanContext = await buildProjectScanContext(projectDirectory);
96830
+ if (projectScanContext === null) {
96831
+ if (flags.project) throw new CliInputError(`Project "${toRelativePath(projectDirectory, resolvedDirectory)}" is outside ${resolvedDirectory}, so it holds none of the staged files. Run --staged from a directory that contains the project.`);
96832
+ continue;
96833
+ }
96834
+ if (seenScanDirectories.has(projectScanContext.scanDirectory)) continue;
96835
+ seenScanDirectories.add(projectScanContext.scanDirectory);
96836
+ projectScanContexts.push(projectScanContext);
96837
+ }
96838
+ if (projectScanContexts.length === 0) {
96839
+ cliLogger.warn(`No configured project is inside ${resolvedDirectory}. ${STAGED_PROJECT_FALLBACK_HINT}`);
96031
96840
  cliLogger.break();
96841
+ const rootScanContext = await buildProjectScanContext(resolvedDirectory);
96842
+ if (rootScanContext !== null) projectScanContexts.push(rootScanContext);
96032
96843
  }
96033
- const tempDirectory = NFS.mkdtempSync(Path.join(tmpdir(), STAGED_FILES_TEMP_DIR_PREFIX));
96034
- const snapshot = await materializeStagedFiles(resolvedDirectory, stagedFiles, tempDirectory).catch((error) => {
96035
- NFS.rmSync(tempDirectory, {
96036
- recursive: true,
96037
- force: true
96844
+ const contextsByLongestPathFirst = [...projectScanContexts].sort((left, right) => right.treeRelativeDirectory.length - left.treeRelativeDirectory.length);
96845
+ const ownedStagedFiles = /* @__PURE__ */ new Map();
96846
+ for (const stagedFile of rootStagedFiles) {
96847
+ const owner = contextsByLongestPathFirst.find((context) => context.treeRelativeDirectory.length === 0 || stagedFile.startsWith(`${context.treeRelativeDirectory}/`));
96848
+ if (owner === void 0) continue;
96849
+ const ownedFiles = ownedStagedFiles.get(owner.scanDirectory);
96850
+ if (ownedFiles === void 0) ownedStagedFiles.set(owner.scanDirectory, [stagedFile]);
96851
+ else ownedFiles.push(stagedFile);
96852
+ }
96853
+ const stagedProjectScans = [];
96854
+ for (const projectScanContext of projectScanContexts) {
96855
+ const projectStagedFiles = ownedStagedFiles.get(projectScanContext.scanDirectory);
96856
+ if (projectStagedFiles === void 0) continue;
96857
+ stagedProjectScans.push({
96858
+ ...projectScanContext,
96859
+ stagedFiles: projectStagedFiles
96038
96860
  });
96039
- throw error;
96040
- });
96861
+ }
96862
+ if (stagedProjectScans.length === 0) {
96863
+ reportNothingToScan({ reason: "No staged source files in the selected projects." });
96864
+ return;
96865
+ }
96866
+ const selectedStagedFiles = stagedProjectScans.flatMap((projectScan) => projectScan.stagedFiles);
96867
+ const stagedFileCount = selectedStagedFiles.length;
96868
+ const unselectedStagedFileCount = rootStagedFiles.length - stagedFileCount;
96869
+ if (!isQuiet) {
96870
+ cliLogger.log(`Scanning ${highlighter.info(`${stagedFileCount}`)} staged files...`);
96871
+ if (unselectedStagedFileCount > 0) cliLogger.dim(`${unselectedStagedFileCount} more staged file${unselectedStagedFileCount === 1 ? "" : "s"} outside the selected projects.`);
96872
+ cliLogger.break();
96873
+ }
96041
96874
  const stagedWantsLines = resolveScope(flags, userConfig).scope === "lines";
96042
96875
  const stagedLineRanges = stagedWantsLines ? await getChangedLineRanges({
96043
96876
  directory: resolvedDirectory,
96044
96877
  cached: true,
96045
- files: snapshot.stagedFiles
96878
+ files: selectedStagedFiles
96046
96879
  }) : null;
96047
96880
  if (stagedWantsLines && stagedLineRanges === null && !isQuiet) {
96048
96881
  cliLogger.warn("Could not determine staged changed lines; reporting all issues in staged files.");
96049
96882
  cliLogger.break();
96050
96883
  }
96051
- try {
96052
- const scanResult = await inspect(snapshot.tempDirectory, {
96884
+ if (stagedProjectScans.some((projectScan) => projectScan.treeRelativeDirectory.length > 0)) recordCount(METRIC.stagedPerProject, 1, { projectCount: stagedProjectScans.length });
96885
+ const tempDirectory = NFS.mkdtempSync(Path.join(tmpdir(), STAGED_FILES_TEMP_DIR_PREFIX));
96886
+ const configSubdirectories = /* @__PURE__ */ new Set();
96887
+ for (const projectScan of stagedProjectScans) {
96888
+ configSubdirectories.add(projectScan.treeRelativeDirectory);
96889
+ const projectRelativeDirectory = resolveProjectRelativeDirectory(resolvedDirectory, projectScan.projectDirectory);
96890
+ if (projectRelativeDirectory !== null) configSubdirectories.add(projectRelativeDirectory);
96891
+ }
96892
+ const snapshot = await materializeStagedFiles({
96893
+ directory: resolvedDirectory,
96894
+ stagedFiles: selectedStagedFiles,
96895
+ tempDirectory,
96896
+ configSubdirectories: [...configSubdirectories]
96897
+ }).catch((error) => {
96898
+ NFS.rmSync(tempDirectory, {
96899
+ recursive: true,
96900
+ force: true
96901
+ });
96902
+ throw error;
96903
+ });
96904
+ const materializedStagedFiles = new Set(snapshot.stagedFiles);
96905
+ const stagedProjectRuns = stagedProjectScans.map((projectScan) => ({
96906
+ projectScan,
96907
+ includePaths: resolveProjectSourceFilePaths(resolvedDirectory, projectScan.scanDirectory, projectScan.stagedFiles.filter((stagedFile) => materializedStagedFiles.has(stagedFile)))
96908
+ })).filter((projectRun) => projectRun.includePaths.length > 0);
96909
+ const isMultiProject = stagedProjectRuns.length > 1;
96910
+ if (stagedProjectRuns.length === 0) {
96911
+ snapshot.cleanup();
96912
+ reportNothingToScan({
96913
+ reason: `Could not read any of the ${stagedFileCount} staged file${stagedFileCount === 1 ? "" : "s"} out of the index, so nothing was scanned. An unusually large staged file is the usual cause.`,
96914
+ severity: "warn"
96915
+ });
96916
+ return;
96917
+ }
96918
+ if (snapshot.unmaterializedFiles.length > 0 && !isQuiet) {
96919
+ const stagedFileLabel = `staged file${stagedFileCount === 1 ? "" : "s"}`;
96920
+ cliLogger.warn(`Skipped ${snapshot.unmaterializedFiles.length} of ${stagedFileCount} ${stagedFileLabel}; they could not be snapshotted from the index.`);
96921
+ cliLogger.break();
96922
+ }
96923
+ const scanStagedProject = async (projectRun) => {
96924
+ const { projectScan, includePaths } = projectRun;
96925
+ const projectTempDirectory = Path.join(snapshot.tempDirectory, projectScan.treeRelativeDirectory);
96926
+ const scanResult = await inspect(projectTempDirectory, {
96053
96927
  ...scanOptions,
96054
96928
  deadlineEpochMs: scanDeadlineEpochMs,
96055
- includePaths: snapshot.stagedFiles,
96056
- configOverride: userConfig,
96057
- configSourceDirectory: scanTarget.configSourceDirectory ?? void 0,
96058
- changedLineRanges: stagedLineRanges ?? void 0
96929
+ includePaths: [...includePaths],
96930
+ configOverride: projectScan.projectConfig,
96931
+ configSourceDirectory: projectScan.projectConfigSourceDirectory ?? void 0,
96932
+ changedLineRanges: stagedLineRanges === null ? void 0 : resolveProjectChangedLineRanges(resolvedDirectory, projectScan.scanDirectory, stagedLineRanges),
96933
+ suppressRendering: isMultiProject,
96934
+ concurrentScan: isMultiProject
96059
96935
  });
96060
96936
  const remappedDiagnostics = scanResult.diagnostics.map((diagnostic) => ({
96061
96937
  ...diagnostic,
96062
- filePath: Path.isAbsolute(diagnostic.filePath) ? diagnostic.filePath.replaceAll(snapshot.tempDirectory, () => resolvedDirectory) : diagnostic.filePath
96938
+ filePath: Path.isAbsolute(diagnostic.filePath) ? diagnostic.filePath.replaceAll(projectTempDirectory, () => projectScan.scanDirectory) : diagnostic.filePath
96063
96939
  }));
96064
- finalizeScans({
96065
- completedScans: [{
96066
- directory: resolvedDirectory,
96067
- result: {
96068
- ...scanResult,
96069
- diagnostics: remappedDiagnostics,
96070
- project: {
96071
- ...scanResult.project,
96072
- rootDirectory: resolvedDirectory
96073
- }
96074
- },
96075
- config: userConfig
96076
- }],
96077
- mode: "staged",
96078
- diff: null,
96079
- baselineIntended: false,
96080
- isJsonMode,
96081
- isScoreOnly,
96082
- flags,
96083
- categoryFilters,
96084
- userConfig,
96085
- resolvedDirectory,
96086
- startTime
96087
- });
96940
+ return {
96941
+ directory: projectScan.scanDirectory,
96942
+ result: {
96943
+ ...scanResult,
96944
+ diagnostics: remappedDiagnostics,
96945
+ project: {
96946
+ ...scanResult.project,
96947
+ rootDirectory: projectScan.scanDirectory
96948
+ }
96949
+ },
96950
+ config: projectScan.projectConfig,
96951
+ frameSourceRoot: projectTempDirectory
96952
+ };
96953
+ };
96954
+ const stagedBatch = await runProjectScanBatch({
96955
+ projects: stagedProjectRuns,
96956
+ isQuiet,
96957
+ isSilent: scanOptions.silent === true,
96958
+ scanProject: scanStagedProject
96959
+ }).catch((error) => {
96960
+ snapshot.cleanup();
96961
+ throw error;
96962
+ });
96963
+ const completedScans = stagedBatch.completedScans;
96964
+ try {
96965
+ if (!isQuiet && isMultiProject) {
96966
+ const showShareLink = !isShareOptedOut(completedScans, scanOptions.noScore) && !scanOptions.isCi;
96967
+ await runPromise(printMultiProjectSummary({
96968
+ completedScans,
96969
+ categoryFilters,
96970
+ verbose: Boolean(flags.verbose),
96971
+ outputDirectory: flags.outputDir,
96972
+ isOffline: !showShareLink,
96973
+ projectName: Path.basename(resolvedDirectory),
96974
+ totalElapsedMilliseconds: stagedBatch.elapsedMilliseconds
96975
+ }));
96976
+ }
96977
+ if (flags.outputDir && isMultiProject && isQuiet) await runPromise(printDiagnosticsDump(filterDiagnosticsByCategories(filterScansForSurface(completedScans, scanOptions.outputSurface ?? "cli"), categoryFilters), flags.outputDir, false, "stderr"));
96088
96978
  } finally {
96089
96979
  snapshot.cleanup();
96090
96980
  }
96981
+ finalizeScans({
96982
+ completedScans,
96983
+ mode: "staged",
96984
+ diff: null,
96985
+ baselineIntended: false,
96986
+ isJsonMode,
96987
+ isScoreOnly,
96988
+ flags,
96989
+ categoryFilters,
96990
+ userConfig,
96991
+ resolvedDirectory,
96992
+ startTime
96993
+ });
96091
96994
  return;
96092
96995
  }
96093
96996
  const projectDirectories = await selectProjects(resolvedDirectory, flags.project, skipPrompts, userConfig?.projects);
96094
- const changedFilesDiffInfo = flags.changedFilesFrom ? buildChangedFilesDiffInfo(readChangedFilesFrom(Path.resolve(flags.changedFilesFrom))) : null;
96997
+ const projectSelectionCompletedTime = performance$1.now();
96998
+ let changedFilesDiffInfo = flags.changedFilesFrom ? buildChangedFilesDiffInfo(readChangedFilesFrom(Path.resolve(flags.changedFilesFrom))) : null;
96999
+ if (changedFilesDiffInfo !== null && scanTarget.didRedirectViaRootDir) {
97000
+ const relativeProjectDirectory = resolveProjectRelativeDirectory(requestedDirectory, resolvedDirectory);
97001
+ if (relativeProjectDirectory) {
97002
+ const projectPrefix = `${relativeProjectDirectory}/`;
97003
+ changedFilesDiffInfo = {
97004
+ ...changedFilesDiffInfo,
97005
+ changedFiles: changedFilesDiffInfo.changedFiles.flatMap((filePath) => {
97006
+ return filePath.startsWith(projectPrefix) ? [filePath.slice(projectPrefix.length)] : [];
97007
+ })
97008
+ };
97009
+ }
97010
+ }
96095
97011
  const requestedScope = resolveScope(flags, userConfig);
96096
97012
  const includeUntracked = flags.includeUntracked ?? false;
96097
97013
  const scopeRequest = requestedScope.scope === void 0 && changedFilesDiffInfo !== null ? {
@@ -96099,15 +97015,20 @@ const inspectAction = async (directory, flags, invocationCommand = "inspect") =>
96099
97015
  scope: "changed"
96100
97016
  } : requestedScope;
96101
97017
  validateIncludeUntrackedScope(includeUntracked, scopeRequest.scope);
97018
+ scanStartupSpinner = !isQuiet ? spinner("Scanning...").start() : null;
97019
+ if (scanStartupSpinner !== null) recordDistribution(METRIC.scanFeedbackDelay, performance$1.now() - projectSelectionCompletedTime, { unit: "millisecond" });
96102
97020
  const wantsDiffMode = scopeRequest.scope !== void 0 && scopeRequest.scope !== "full";
96103
97021
  const shouldDetectDiff = changedFilesDiffInfo === null && (wantsDiffMode || scopeRequest.scope === void 0 && !skipPrompts && !isQuiet);
96104
97022
  const diffInfo = changedFilesDiffInfo ?? (shouldDetectDiff ? await getDiffInfo(resolvedDirectory, scopeRequest.base, includeUntracked) : null);
97023
+ scanStartupSpinner?.stop();
97024
+ scanStartupSpinner = null;
96105
97025
  const scope = await finalizeScope({
96106
97026
  requested: scopeRequest,
96107
97027
  diffInfo,
96108
97028
  skipPrompts,
96109
97029
  isQuiet
96110
97030
  });
97031
+ scanStartupSpinner = !isQuiet ? spinner("Scanning...").start() : null;
96111
97032
  const isDiffMode = scope !== "full";
96112
97033
  const comparisonBaseRef = isDiffMode && diffInfo && !diffInfo.isCurrentChanges ? diffInfo.baseSha ? await resolveMergeBaseRef(resolvedDirectory, diffInfo.baseSha) : diffInfo.diffBaseRef ?? await resolveMergeBaseRef(resolvedDirectory, diffInfo.baseBranch) : null;
96113
97034
  const baselineRef = scope === "changed" ? comparisonBaseRef : null;
@@ -96119,6 +97040,8 @@ const inspectAction = async (directory, flags, invocationCommand = "inspect") =>
96119
97040
  files: [...diffInfo.changedFiles],
96120
97041
  includeUntracked
96121
97042
  }) : null;
97043
+ scanStartupSpinner?.stop();
97044
+ scanStartupSpinner = null;
96122
97045
  if (scope === "lines" && changedLineRanges === null && !isQuiet) {
96123
97046
  cliLogger.warn("Could not determine changed lines (no base ref or git diff failed); reporting all issues in changed files.");
96124
97047
  cliLogger.break();
@@ -96132,7 +97055,6 @@ const inspectAction = async (directory, flags, invocationCommand = "inspect") =>
96132
97055
  }
96133
97056
  cliLogger.break();
96134
97057
  }
96135
- const completedScans = [];
96136
97058
  const isMultiProject = projectDirectories.length > 1;
96137
97059
  const scanProject = async (projectDirectory) => {
96138
97060
  const projectScanTarget = projectDirectory === resolvedDirectory ? scanTarget : await resolveScanTarget(projectDirectory, { allowAmbiguous: true });
@@ -96183,29 +97105,13 @@ const inspectAction = async (directory, flags, invocationCommand = "inspect") =>
96183
97105
  config: projectConfig
96184
97106
  };
96185
97107
  };
96186
- const scanLoopStartTime = performance$1.now();
96187
- const projectCount = projectDirectories.length;
96188
- const batchSpinner = isMultiProject && !isQuiet ? spinner(`Scanning ${projectCount} projects…`).start() : null;
96189
- const ownsBatchSpinnerSilence = isMultiProject && scanOptions.silent === true;
96190
- const wasSpinnerSilent = isSpinnerSilent();
96191
- if (ownsBatchSpinnerSilence) setSpinnerSilent(true);
96192
- let finishedProjectCount = 0;
96193
- let scanOutcomes;
96194
- try {
96195
- scanOutcomes = await mapWithConcurrency(projectDirectories, isMultiProject ? 4 : 1, async (projectDirectory) => {
96196
- const scanOutcome = await scanProject(projectDirectory);
96197
- finishedProjectCount += 1;
96198
- batchSpinner?.update(`Scanning ${projectCount} projects… (${finishedProjectCount}/${projectCount})`);
96199
- return scanOutcome;
96200
- });
96201
- } finally {
96202
- if (ownsBatchSpinnerSilence) setSpinnerSilent(wasSpinnerSilent);
96203
- batchSpinner?.stop();
96204
- }
96205
- for (const scanOutcome of scanOutcomes) {
96206
- if (scanOutcome === null) continue;
96207
- completedScans.push(scanOutcome);
96208
- }
97108
+ const projectBatch = await runProjectScanBatch({
97109
+ projects: projectDirectories,
97110
+ isQuiet,
97111
+ isSilent: scanOptions.silent === true,
97112
+ scanProject
97113
+ });
97114
+ const completedScans = projectBatch.completedScans;
96209
97115
  if (!isQuiet && isMultiProject && completedScans.length > 0) {
96210
97116
  const showShareLink = !isShareOptedOut(completedScans, scanOptions.noScore) && !scanOptions.isCi;
96211
97117
  await runPromise(printMultiProjectSummary({
@@ -96215,7 +97121,7 @@ const inspectAction = async (directory, flags, invocationCommand = "inspect") =>
96215
97121
  outputDirectory: flags.outputDir,
96216
97122
  isOffline: !showShareLink,
96217
97123
  projectName: Path.basename(resolvedDirectory),
96218
- totalElapsedMilliseconds: performance$1.now() - scanLoopStartTime
97124
+ totalElapsedMilliseconds: projectBatch.elapsedMilliseconds
96219
97125
  }));
96220
97126
  }
96221
97127
  const selectedSurfaceDiagnostics = filterDiagnosticsByCategories(filterScansForSurface(completedScans, scanOptions.outputSurface ?? "cli"), categoryFilters);
@@ -96262,6 +97168,7 @@ const inspectAction = async (directory, flags, invocationCommand = "inspect") =>
96262
97168
  }
96263
97169
  }
96264
97170
  } catch (error) {
97171
+ scanStartupSpinner?.stop();
96265
97172
  const isUserError = isExpectedUserError(error);
96266
97173
  const sentryEventId = isUserError ? void 0 : await reportErrorToSentry(error);
96267
97174
  if (isDebugFlagEnabled()) await flushSentry();
@@ -97196,6 +98103,7 @@ const COMMAND_FLAG_SPECS = new Map([
97196
98103
  "--no-color",
97197
98104
  "--no-dead-code",
97198
98105
  "--no-score",
98106
+ "--no-supply-chain",
97199
98107
  "--yes"
97200
98108
  ]),
97201
98109
  longOptionsWithRequiredValues: new Set(["--blocking", "--project"]),
@@ -97359,7 +98267,7 @@ ${highlighter.dim("Learn more:")}
97359
98267
  ${highlighter.info(CI_URL)}
97360
98268
  `;
97361
98269
  const collectCategoryOption = (value, previousValues) => [...previousValues ?? [], value];
97362
- const program = new Command().name("react-doctor").description("Diagnose React codebase health").version(VERSION, "-v, --version", "display the version number").argument("[directory]", "project directory to scan", ".").option("--lint", "enable linting").option("--no-lint", "skip linting").option("--dead-code", "enable dead-code analysis (default)").option("--no-dead-code", "skip dead-code analysis (unused files / exports / dependencies, circular imports)").option("--supply-chain", "enable the dependency supply-chain scan (default)").option("--no-supply-chain", "skip the dependency supply-chain scan (Socket.dev dependency health checks)").option("--verbose", "show every rule and per-file details (default shows top 3 rules)").option("--debug", "force a Sentry trace and print its id at the end (paste it into a bug report)").option("--output-dir <dir>", "directory for the full diagnostics dump (default: a temp folder)").option("--score", "output only the score").option("--json", "output a single structured JSON report (suppresses other output)").option("--json-compact", "with --json, emit compact JSON (no indentation)").option("--json-out <path>", "with --json, write the report to a file instead of stdout").option("-y, --yes", "skip prompts, scan all workspace projects").option("--no-parallel", "lint serially with one worker (default: parallel across CPU cores; set the worker count with REACT_DOCTOR_PARALLEL)").option("--project <name>", "select projects: workspace names or directory paths (comma-separated for multiple); overrides the `projects` config field").option("--scope <value>", "how much supported JS/TS and inline HTML script source to scan/report: full (default), files, changed (only new issues vs base), or lines (issues whose source spans touch changed lines)").option("--base <ref>", "base git ref for files/changed/lines scope (auto-detected when omitted)").option("--include-untracked", "with --scope files/changed/lines, also scan ordinary untracked files (respects .gitignore)").addOption(new Option("--diff [base]", "[deprecated] alias for --scope changed (pass `false` to force a full scan)").hideHelp()).addOption(new Option("--changed-files-from <file>", "scan source files listed in a newline-delimited changed-files file").hideHelp()).option("--no-score", "skip the score API, the share URL, and crash reporting").addOption(new Option("--category <category>", "only show diagnostics in a category (repeatable; e.g. Security)").argParser(collectCategoryOption)).option("--no-telemetry", "alias for --no-score (skip the score API, share URL, and crash reporting)").option("--staged", "scan only staged (git index) files for pre-commit hooks").option("--max-duration <seconds>", "scan time budget for the whole run, shared across workspace projects: past it, remaining lint batches and dead-code are skipped and partial results are reported (skipped files are listed in the JSON report)").option("--blocking <level>", "severity that fails CI: error (default), warning, or none (advisory)").addOption(new Option("--fail-on <level>", "[deprecated] alias for --blocking <level>").hideHelp()).option("--no-respect-inline-disables", "audit mode: neutralize inline lint suppressions before scanning").option("--warnings", "show warning-severity diagnostics (default)").option("--no-warnings", "hide warning-severity diagnostics (errors only)").option("--color", "force colored output").option("--no-color", "disable colored output (also honors NO_COLOR)").addHelpText("after", renderRootHelpEpilog);
98270
+ const program = new Command().name("react-doctor").description("Diagnose React codebase health").version(VERSION, "-v, --version", "display the version number").argument("[directory]", "project directory to scan", ".").option("--lint", "enable linting").option("--no-lint", "skip linting").option("--dead-code", "enable dead-code analysis (default)").option("--no-dead-code", "skip dead-code analysis (unused files / exports / dependencies, circular imports)").option("--supply-chain", "enable the dependency supply-chain scan (default)").option("--no-supply-chain", "skip the dependency supply-chain scan (Socket.dev dependency health checks)").option("--verbose", "show every rule and per-file details (default shows top 3 rules)").option("--debug", "force a Sentry trace and print its id at the end (paste it into a bug report)").option("--output-dir <dir>", "directory for the full diagnostics dump (default: a temp folder)").option("--score", "output only the score").option("--json", "output a single structured JSON report (suppresses other output)").option("--json-compact", "with --json, emit compact JSON (no indentation)").option("--json-out <path>", "with --json, write the report to a file instead of stdout").option("-y, --yes", "skip prompts, scan all workspace projects").option("--no-parallel", "lint serially with one worker (default: parallel across CPU cores; set the worker count with REACT_DOCTOR_PARALLEL)").option("--project <name>", "select projects: workspace names or directory paths (comma-separated for multiple); overrides the `projects` config field").option("--scope <value>", "how much supported JS/TS and inline HTML script source to scan/report: full (default), files, changed (only new issues vs base), or lines (issues whose source spans touch changed lines)").option("--base <ref>", "base git ref for files/changed/lines scope (auto-detected when omitted)").option("--include-untracked", "with --scope files/changed/lines, also scan ordinary untracked files (respects .gitignore)").addOption(new Option("--diff [base]", "[deprecated] alias for --scope changed (pass `false` to force a full scan)").hideHelp()).addOption(new Option("--changed-files-from <file>", "scan source files listed in a newline-delimited changed-files file").hideHelp()).option("--no-score", "skip the score API, the share URL, and crash reporting").addOption(new Option("--category <category>", "only show diagnostics in a category (repeatable; e.g. Security)").argParser(collectCategoryOption)).option("--no-telemetry", "alias for --no-score (skip the score API, share URL, and crash reporting)").option("--staged", "scan only staged (git index) files for pre-commit hooks (honors --project and config `projects`; exits 0 when nothing is staged)").option("--max-duration <seconds>", "scan time budget for the whole run, shared across workspace projects: past it, remaining lint batches and dead-code are skipped and partial results are reported (skipped files are listed in the JSON report)").option("--blocking <level>", "severity that fails CI: error (default), warning, or none (advisory)").addOption(new Option("--fail-on <level>", "[deprecated] alias for --blocking <level>").hideHelp()).option("--no-respect-inline-disables", "audit mode: neutralize inline lint suppressions before scanning").option("--warnings", "show warning-severity diagnostics (default)").option("--no-warnings", "hide warning-severity diagnostics (errors only)").option("--color", "force colored output").option("--no-color", "disable colored output (also honors NO_COLOR)").addHelpText("after", renderRootHelpEpilog);
97363
98271
  program.action(inspectAction);
97364
98272
  program.command("design [directory]").description("Run only the focused UI design diagnostics").addHelpText("after", renderDesignHelpEpilog).action((directory, _options, command) => designAction(directory ?? ".", command.optsWithGlobals()));
97365
98273
  program.command("why <location>").description("Explain why a rule fired (or why a suppression didn't apply) at a file:line").option("--project <name>", "select projects: workspace names or directory paths (comma-separated for multiple)").option("-c, --cwd <cwd>", "working directory", process.cwd()).option("--color", "force colored output").option("--no-color", "disable colored output (also honors NO_COLOR)").action((location, options) => whyAction(location, options));
@@ -97381,15 +98289,17 @@ rules.command("category <category> <severity>").description("Set the severity fo
97381
98289
  rules.command("ignore-tag <tag>").description("Skip a whole rule family by tag before linting (e.g. design)").option("-c, --cwd <cwd>", "working directory", process.cwd()).action((tag, _options, command) => rulesIgnoreTagAction(tag, command.optsWithGlobals()));
97382
98290
  rules.command("unignore-tag <tag>").description("Stop ignoring a tag previously skipped via ignore-tag").option("-c, --cwd <cwd>", "working directory", process.cwd()).action((tag, _options, command) => rulesUnignoreTagAction(tag, command.optsWithGlobals()));
97383
98291
  program.command("experimental-lsp", { hidden: false }).description("[experimental] run the React Doctor language server over stdio (for editors)").allowUnknownOption().action(() => {});
97384
- program.command("experimental-tui [directory]", { hidden: true }).description("[experimental] interactive, scrollable scan report").option("--blocking <level>", "severity that fails CI: error (default), warning, or none (advisory)").option("--color", "force colored output").option("--no-color", "disable colored output (also honors NO_COLOR)").option("--no-dead-code", "skip dead-code analysis").option("--no-score", "skip the score API, the share URL, and crash reporting").option("-p, --project <names>", "scan specific workspace projects (comma-separated, or *)").option("-y, --yes", "skip the project prompt and scan every discovered project").action(async (directory = ".", _localOptions, command) => {
98292
+ program.command("experimental-tui [directory]", { hidden: true }).description("[experimental] interactive, scrollable scan report").option("--blocking <level>", "severity that fails CI: error (default), warning, or none (advisory)").option("--color", "force colored output").option("--no-color", "disable colored output (also honors NO_COLOR)").option("--no-dead-code", "skip dead-code analysis").option("--no-supply-chain", "skip the dependency supply-chain scan").option("--no-score", "skip the score API, the share URL, and crash reporting").option("-p, --project <names>", "scan specific workspace projects (comma-separated, or *)").option("-y, --yes", "skip the project prompt and scan every discovered project").action(async (directory = ".", _localOptions, command) => {
97385
98293
  const options = command.optsWithGlobals();
97386
98294
  const deadCode = options.deadCode === false ? false : void 0;
97387
98295
  const noScore = options.score === false ? true : void 0;
98296
+ const supplyChain = options.supplyChain === false ? false : void 0;
97388
98297
  const nodeMajorVersion = Number(process.versions.node.split(".")[0]);
97389
98298
  if (process.stdout.isTTY !== true || process.stdin.isTTY !== true || isNonInteractiveEnvironment() || nodeMajorVersion < 22) {
97390
98299
  await inspectAction(directory, {
97391
98300
  deadCode,
97392
98301
  score: options.score === false ? false : void 0,
98302
+ supplyChain,
97393
98303
  project: options.project,
97394
98304
  yes: options.yes,
97395
98305
  blocking: options.blocking
@@ -97397,12 +98307,13 @@ program.command("experimental-tui [directory]", { hidden: true }).description("[
97397
98307
  return;
97398
98308
  }
97399
98309
  recordCount(METRIC.cliInvoked, 1, { command: "experimental-tui" });
97400
- const { runScanApp } = await import("./run-scan-app-DZ5jGWFf.js");
98310
+ const { runScanApp } = await import("./run-scan-app-C9MJnVwv.js");
97401
98311
  const { shouldFail } = await runScanApp({
97402
98312
  directory,
97403
98313
  options: {
97404
98314
  deadCode,
97405
- noScore
98315
+ noScore,
98316
+ supplyChain
97406
98317
  },
97407
98318
  projectFlag: options.project,
97408
98319
  skipPrompts: options.yes ?? false,
@@ -97436,7 +98347,7 @@ Promise.resolve().then(() => assertNoRemovedFlags(process.argv)).then(() => prog
97436
98347
  handleError(error, { sentryEventId });
97437
98348
  });
97438
98349
  //#endregion
97439
- export { toForwardSlashes as A, highlighter as B, buildRulePriorityMap as C, resolveBlockingLevel as D, formatLearnMoreLine as E, isCiEnvironment as F, sync as G, mergeReactDoctorConfigs as H, DIAGNOSTIC_CATEGORY_BUCKETS as I, void_ as K, Progress as L, isUnicodeSupported as M, METRIC as N, isReactDoctorWorkflowInstalled as O, TUI_REPORT_DETAIL_WIDTH_FRACTION as P, Reporter as R, hasLintHardFailure as S, formatFixRecipeLine as T, resolveScanTarget as U, mapWithConcurrency as V, runPromise as W, canAnimateOnboarding as _, resolveCliInspectOptions as a, buildCodeFrame as b, detectLaunchableAgents as c, launchCliAgent as d, isShareOptedOut as f, doctorFace as g, easeOutCubic as h, selectProjects as i, findNearestPackageDirectory as j, recordCount as k, CLI_AGENT_BINARIES as l, printFooter as m, shouldFailScanGate as n, countUniqueScannedFiles as o, inspect as p, succeed$3 as q, discoverWorkspacePackages as r, setUpGitHubActions as s, exitGracefully as t, copyToClipboard as u, computeProjectedScore as v, buildSortedRuleGroups as w, buildNoScoreMessage as x, formatElapsedTime as y, getCategoryImpact as z };
98350
+ export { toForwardSlashes as A, getCategoryImpact as B, buildRulePriorityMap as C, resolveBlockingLevel as D, formatLearnMoreLine as E, TUI_REPORT_DETAIL_WIDTH_FRACTION as F, runPromise as G, mapWithConcurrency as H, isCiEnvironment as I, succeed$3 as J, sync as K, DIAGNOSTIC_CATEGORY_BUCKETS as L, isUnicodeSupported as M, METRIC as N, isReactDoctorWorkflowInstalled as O, TUI_REPORT_COMPACT_MAX_ROWS as P, Progress as R, hasLintHardFailure as S, formatFixRecipeLine as T, mergeReactDoctorConfigs as U, highlighter as V, resolveScanTarget as W, canAnimateOnboarding as _, resolveCliInspectOptions as a, buildCodeFrame as b, detectLaunchableAgents as c, launchCliAgent as d, isShareOptedOut as f, doctorFace as g, easeOutCubic as h, selectProjects as i, findNearestPackageDirectory as j, recordCount as k, CLI_AGENT_BINARIES as l, printFooter as m, shouldFailScanGate as n, countUniqueScannedFiles as o, inspect as p, void_ as q, discoverWorkspacePackages as r, setUpGitHubActions as s, exitGracefully as t, copyToClipboard as u, computeProjectedScore as v, buildSortedRuleGroups as w, buildNoScoreMessage as x, formatElapsedTime as y, Reporter as z };
97440
98351
 
97441
98352
  //# sourceMappingURL=cli.js.map
97442
- //# debugId=cf9aea89-a185-53f6-9e42-7af2cece64f2
98353
+ //# debugId=bb982094-8280-5afe-b061-eb103665c55c