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/index.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]="e6d636d4-ff95-5229-92f8-47807b2a44c4")}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]="18c61424-4926-5cae-8f2a-6001534ea755")}catch(e){}}();
3
3
  import { i as __toESM$1, r as __require, t as __commonJSMin$1 } from "./chunk-ChKA3wi6.js";
4
4
  import { createRequire } from "node:module";
5
5
  import reactDoctorPlugin, { ALL_REACT_DOCTOR_RULE_KEYS, CROSS_FILE_DEPENDENCY_COLLECTORS, CROSS_FILE_RULE_IDS, FRAMEWORK_SPECIFIC_RULE_KEYS, FRAMEWORK_TOKENS, MOTION_LIBRARY_PACKAGES, REACT_COMPILER_RULES, REACT_DOCTOR_RULES, classifySecurityScanFile, collectCrossFileDependencyProbes, resetManifestCaches, shouldReadSecurityScanContent } from "oxlint-plugin-react-doctor";
@@ -11,14 +11,16 @@ import * as Path from "node:path";
11
11
  import path from "node:path";
12
12
  import * as NodeChildProcess from "node:child_process";
13
13
  import { execFileSync, spawn, spawnSync } from "node:child_process";
14
+ import { ResolverFactory } from "oxc-resolver";
14
15
  import ts from "typescript";
16
+ import * as NodeUrl from "node:url";
17
+ import { fileURLToPath } from "node:url";
15
18
  import * as OS from "node:os";
16
19
  import os from "node:os";
17
20
  import { parseJSON5 } from "confbox";
18
- import * as NodeUrl from "node:url";
19
- import { fileURLToPath } 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
  //#region ../../node_modules/.pnpm/effect@4.0.0-beta.70/node_modules/effect/dist/Pipeable.js
24
26
  /**
@@ -10261,7 +10263,7 @@ const Number$4 = globalThis.Number;
10261
10263
  * @category constructors
10262
10264
  * @since 2.0.0
10263
10265
  */
10264
- const parse = (s) => {
10266
+ const parse$1 = (s) => {
10265
10267
  if (s === "NaN") return some(NaN);
10266
10268
  if (s === "Infinity") return some(Infinity);
10267
10269
  if (s === "-Infinity") return some(-Infinity);
@@ -14303,12 +14305,12 @@ TaggedError("EncodingError");
14303
14305
  //#endregion
14304
14306
  //#region ../../node_modules/.pnpm/effect@4.0.0-beta.70/node_modules/effect/dist/internal/schema/annotations.js
14305
14307
  /** @internal */
14306
- function resolve(ast) {
14308
+ function resolve$1(ast) {
14307
14309
  return ast.checks ? ast.checks[ast.checks.length - 1].annotations : ast.annotations;
14308
14310
  }
14309
14311
  /** @internal */
14310
14312
  function resolveAt(key) {
14311
- return (ast) => resolve(ast)?.[key];
14313
+ return (ast) => resolve$1(ast)?.[key];
14312
14314
  }
14313
14315
  /** @internal */
14314
14316
  const resolveIdentifier = /* @__PURE__ */ resolveAt("identifier");
@@ -18060,7 +18062,7 @@ function asSync(parser) {
18060
18062
  }
18061
18063
  const recur$1 = /* @__PURE__ */ memoize((ast) => {
18062
18064
  let parser;
18063
- const astOptions = resolve(ast)?.["parseOptions"];
18065
+ const astOptions = resolve$1(ast)?.["parseOptions"];
18064
18066
  if (!ast.context && !ast.encoding && !ast.checks) return (ou, options) => {
18065
18067
  parser ??= ast.getParser(recur$1);
18066
18068
  if (astOptions) options = {
@@ -57665,7 +57667,7 @@ var UrlParamsError = class extends TaggedError("UrlParamsError") {};
57665
57667
  * @category converting
57666
57668
  * @since 4.0.0
57667
57669
  */
57668
- const makeUrl = (url, params, hash) => {
57670
+ const makeUrl$1 = (url, params, hash) => {
57669
57671
  try {
57670
57672
  const urlInstance = new URL(url, baseUrl());
57671
57673
  for (let i = 0; i < params.params.length; i++) {
@@ -58299,7 +58301,7 @@ const Proto$2 = {
58299
58301
  const make$10 = (f) => makeWith$1((effect) => flatMap$2(effect, (request) => withFiber((fiber) => {
58300
58302
  const scopedController = scopedRequests.get(request);
58301
58303
  const controller = scopedController ?? new AbortController();
58302
- const urlResult = makeUrl(request.url, request.urlParams, getOrUndefined(request.hash));
58304
+ const urlResult = makeUrl$1(request.url, request.urlParams, getOrUndefined(request.hash));
58303
58305
  if (isFailure(urlResult)) return fail$4(new HttpClientError({ reason: new InvalidUrlError({
58304
58306
  request,
58305
58307
  cause: urlResult.failure
@@ -58738,7 +58740,7 @@ const layer$7 = (loggers, options) => effect(CurrentLoggers, withFiber$1(fnUntra
58738
58740
  * @since 4.0.0
58739
58741
  */
58740
58742
  const policy = /* @__PURE__ */ forever$1.pipe(passthrough$2, /* @__PURE__ */ addDelay((error) => {
58741
- if (isHttpClientError(error) && error.reason._tag === "StatusCodeError" && error.reason.response.status === 429) return succeed$2(seconds(fromUndefinedOr(error.reason.response.headers["retry-after"]).pipe(flatMap$5(parse), getOrElse$1(() => 5))));
58743
+ if (isHttpClientError(error) && error.reason._tag === "StatusCodeError" && error.reason.response.status === 429) return succeed$2(seconds(fromUndefinedOr(error.reason.response.headers["retry-after"]).pipe(flatMap$5(parse$1), getOrElse$1(() => 5))));
58742
58744
  return succeed$2(seconds(1));
58743
58745
  }));
58744
58746
  /**
@@ -61380,6 +61382,428 @@ const layer = /* @__PURE__ */ succeed$3(Path$1)({
61380
61382
  toFileUrl
61381
61383
  });
61382
61384
  //#endregion
61385
+ //#region ../../node_modules/.pnpm/@jridgewell+sourcemap-codec@1.5.5/node_modules/@jridgewell/sourcemap-codec/dist/sourcemap-codec.mjs
61386
+ var comma = ",".charCodeAt(0);
61387
+ ";".charCodeAt(0);
61388
+ var chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
61389
+ var intToChar = new Uint8Array(64);
61390
+ var charToInt = new Uint8Array(128);
61391
+ for (let i = 0; i < chars.length; i++) {
61392
+ const c = chars.charCodeAt(i);
61393
+ intToChar[i] = c;
61394
+ charToInt[c] = i;
61395
+ }
61396
+ function decodeInteger(reader, relative) {
61397
+ let value = 0;
61398
+ let shift = 0;
61399
+ let integer = 0;
61400
+ do {
61401
+ integer = charToInt[reader.next()];
61402
+ value |= (integer & 31) << shift;
61403
+ shift += 5;
61404
+ } while (integer & 32);
61405
+ const shouldNegate = value & 1;
61406
+ value >>>= 1;
61407
+ if (shouldNegate) value = -2147483648 | -value;
61408
+ return relative + value;
61409
+ }
61410
+ function hasMoreVlq(reader, max) {
61411
+ if (reader.pos >= max) return false;
61412
+ return reader.peek() !== comma;
61413
+ }
61414
+ var StringReader = class {
61415
+ constructor(buffer) {
61416
+ this.pos = 0;
61417
+ this.buffer = buffer;
61418
+ }
61419
+ next() {
61420
+ return this.buffer.charCodeAt(this.pos++);
61421
+ }
61422
+ peek() {
61423
+ return this.buffer.charCodeAt(this.pos);
61424
+ }
61425
+ indexOf(char) {
61426
+ const { buffer, pos } = this;
61427
+ const idx = buffer.indexOf(char, pos);
61428
+ return idx === -1 ? buffer.length : idx;
61429
+ }
61430
+ };
61431
+ function decode(mappings) {
61432
+ const { length } = mappings;
61433
+ const reader = new StringReader(mappings);
61434
+ const decoded = [];
61435
+ let genColumn = 0;
61436
+ let sourcesIndex = 0;
61437
+ let sourceLine = 0;
61438
+ let sourceColumn = 0;
61439
+ let namesIndex = 0;
61440
+ do {
61441
+ const semi = reader.indexOf(";");
61442
+ const line = [];
61443
+ let sorted = true;
61444
+ let lastCol = 0;
61445
+ genColumn = 0;
61446
+ while (reader.pos < semi) {
61447
+ let seg;
61448
+ genColumn = decodeInteger(reader, genColumn);
61449
+ if (genColumn < lastCol) sorted = false;
61450
+ lastCol = genColumn;
61451
+ if (hasMoreVlq(reader, semi)) {
61452
+ sourcesIndex = decodeInteger(reader, sourcesIndex);
61453
+ sourceLine = decodeInteger(reader, sourceLine);
61454
+ sourceColumn = decodeInteger(reader, sourceColumn);
61455
+ if (hasMoreVlq(reader, semi)) {
61456
+ namesIndex = decodeInteger(reader, namesIndex);
61457
+ seg = [
61458
+ genColumn,
61459
+ sourcesIndex,
61460
+ sourceLine,
61461
+ sourceColumn,
61462
+ namesIndex
61463
+ ];
61464
+ } else seg = [
61465
+ genColumn,
61466
+ sourcesIndex,
61467
+ sourceLine,
61468
+ sourceColumn
61469
+ ];
61470
+ } else seg = [genColumn];
61471
+ line.push(seg);
61472
+ reader.pos++;
61473
+ }
61474
+ if (!sorted) sort(line);
61475
+ decoded.push(line);
61476
+ reader.pos = semi + 1;
61477
+ } while (reader.pos <= length);
61478
+ return decoded;
61479
+ }
61480
+ function sort(line) {
61481
+ line.sort(sortComparator$1);
61482
+ }
61483
+ function sortComparator$1(a, b) {
61484
+ return a[0] - b[0];
61485
+ }
61486
+ //#endregion
61487
+ //#region ../../node_modules/.pnpm/@jridgewell+resolve-uri@3.1.2/node_modules/@jridgewell/resolve-uri/dist/resolve-uri.mjs
61488
+ const schemeRegex = /^[\w+.-]+:\/\//;
61489
+ /**
61490
+ * Matches the parts of a URL:
61491
+ * 1. Scheme, including ":", guaranteed.
61492
+ * 2. User/password, including "@", optional.
61493
+ * 3. Host, guaranteed.
61494
+ * 4. Port, including ":", optional.
61495
+ * 5. Path, including "/", optional.
61496
+ * 6. Query, including "?", optional.
61497
+ * 7. Hash, including "#", optional.
61498
+ */
61499
+ const urlRegex = /^([\w+.-]+:)\/\/([^@/#?]*@)?([^:/#?]*)(:\d+)?(\/[^#?]*)?(\?[^#]*)?(#.*)?/;
61500
+ /**
61501
+ * File URLs are weird. They dont' need the regular `//` in the scheme, they may or may not start
61502
+ * with a leading `/`, they can have a domain (but only if they don't start with a Windows drive).
61503
+ *
61504
+ * 1. Host, optional.
61505
+ * 2. Path, which may include "/", guaranteed.
61506
+ * 3. Query, including "?", optional.
61507
+ * 4. Hash, including "#", optional.
61508
+ */
61509
+ const fileRegex = /^file:(?:\/\/((?![a-z]:)[^/#?]*)?)?(\/?[^#?]*)(\?[^#]*)?(#.*)?/i;
61510
+ function isAbsoluteUrl(input) {
61511
+ return schemeRegex.test(input);
61512
+ }
61513
+ function isSchemeRelativeUrl(input) {
61514
+ return input.startsWith("//");
61515
+ }
61516
+ function isAbsolutePath(input) {
61517
+ return input.startsWith("/");
61518
+ }
61519
+ function isFileUrl(input) {
61520
+ return input.startsWith("file:");
61521
+ }
61522
+ function isRelative(input) {
61523
+ return /^[.?#]/.test(input);
61524
+ }
61525
+ function parseAbsoluteUrl(input) {
61526
+ const match = urlRegex.exec(input);
61527
+ return makeUrl(match[1], match[2] || "", match[3], match[4] || "", match[5] || "/", match[6] || "", match[7] || "");
61528
+ }
61529
+ function parseFileUrl(input) {
61530
+ const match = fileRegex.exec(input);
61531
+ const path = match[2];
61532
+ return makeUrl("file:", "", match[1] || "", "", isAbsolutePath(path) ? path : "/" + path, match[3] || "", match[4] || "");
61533
+ }
61534
+ function makeUrl(scheme, user, host, port, path, query, hash) {
61535
+ return {
61536
+ scheme,
61537
+ user,
61538
+ host,
61539
+ port,
61540
+ path,
61541
+ query,
61542
+ hash,
61543
+ type: 7
61544
+ };
61545
+ }
61546
+ function parseUrl(input) {
61547
+ if (isSchemeRelativeUrl(input)) {
61548
+ const url = parseAbsoluteUrl("http:" + input);
61549
+ url.scheme = "";
61550
+ url.type = 6;
61551
+ return url;
61552
+ }
61553
+ if (isAbsolutePath(input)) {
61554
+ const url = parseAbsoluteUrl("http://foo.com" + input);
61555
+ url.scheme = "";
61556
+ url.host = "";
61557
+ url.type = 5;
61558
+ return url;
61559
+ }
61560
+ if (isFileUrl(input)) return parseFileUrl(input);
61561
+ if (isAbsoluteUrl(input)) return parseAbsoluteUrl(input);
61562
+ const url = parseAbsoluteUrl("http://foo.com/" + input);
61563
+ url.scheme = "";
61564
+ url.host = "";
61565
+ url.type = input ? input.startsWith("?") ? 3 : input.startsWith("#") ? 2 : 4 : 1;
61566
+ return url;
61567
+ }
61568
+ function stripPathFilename(path) {
61569
+ if (path.endsWith("/..")) return path;
61570
+ const index = path.lastIndexOf("/");
61571
+ return path.slice(0, index + 1);
61572
+ }
61573
+ function mergePaths(url, base) {
61574
+ normalizePath(base, base.type);
61575
+ if (url.path === "/") url.path = base.path;
61576
+ else url.path = stripPathFilename(base.path) + url.path;
61577
+ }
61578
+ /**
61579
+ * The path can have empty directories "//", unneeded parents "foo/..", or current directory
61580
+ * "foo/.". We need to normalize to a standard representation.
61581
+ */
61582
+ function normalizePath(url, type) {
61583
+ const rel = type <= 4;
61584
+ const pieces = url.path.split("/");
61585
+ let pointer = 1;
61586
+ let positive = 0;
61587
+ let addTrailingSlash = false;
61588
+ for (let i = 1; i < pieces.length; i++) {
61589
+ const piece = pieces[i];
61590
+ if (!piece) {
61591
+ addTrailingSlash = true;
61592
+ continue;
61593
+ }
61594
+ addTrailingSlash = false;
61595
+ if (piece === ".") continue;
61596
+ if (piece === "..") {
61597
+ if (positive) {
61598
+ addTrailingSlash = true;
61599
+ positive--;
61600
+ pointer--;
61601
+ } else if (rel) pieces[pointer++] = piece;
61602
+ continue;
61603
+ }
61604
+ pieces[pointer++] = piece;
61605
+ positive++;
61606
+ }
61607
+ let path = "";
61608
+ for (let i = 1; i < pointer; i++) path += "/" + pieces[i];
61609
+ if (!path || addTrailingSlash && !path.endsWith("/..")) path += "/";
61610
+ url.path = path;
61611
+ }
61612
+ /**
61613
+ * Attempts to resolve `input` URL/path relative to `base`.
61614
+ */
61615
+ function resolve(input, base) {
61616
+ if (!input && !base) return "";
61617
+ const url = parseUrl(input);
61618
+ let inputType = url.type;
61619
+ if (base && inputType !== 7) {
61620
+ const baseUrl = parseUrl(base);
61621
+ const baseType = baseUrl.type;
61622
+ switch (inputType) {
61623
+ case 1: url.hash = baseUrl.hash;
61624
+ case 2: url.query = baseUrl.query;
61625
+ case 3:
61626
+ case 4: mergePaths(url, baseUrl);
61627
+ case 5:
61628
+ url.user = baseUrl.user;
61629
+ url.host = baseUrl.host;
61630
+ url.port = baseUrl.port;
61631
+ case 6: url.scheme = baseUrl.scheme;
61632
+ }
61633
+ if (baseType > inputType) inputType = baseType;
61634
+ }
61635
+ normalizePath(url, inputType);
61636
+ const queryHash = url.query + url.hash;
61637
+ switch (inputType) {
61638
+ case 2:
61639
+ case 3: return queryHash;
61640
+ case 4: {
61641
+ const path = url.path.slice(1);
61642
+ if (!path) return queryHash || ".";
61643
+ if (isRelative(base || input) && !isRelative(path)) return "./" + path + queryHash;
61644
+ return path + queryHash;
61645
+ }
61646
+ case 5: return url.path + queryHash;
61647
+ default: return url.scheme + "//" + url.user + url.host + url.port + url.path + queryHash;
61648
+ }
61649
+ }
61650
+ //#endregion
61651
+ //#region ../../node_modules/.pnpm/@jridgewell+trace-mapping@0.3.31/node_modules/@jridgewell/trace-mapping/dist/trace-mapping.mjs
61652
+ function stripFilename(path) {
61653
+ if (!path) return "";
61654
+ const index = path.lastIndexOf("/");
61655
+ return path.slice(0, index + 1);
61656
+ }
61657
+ function resolver(mapUrl, sourceRoot) {
61658
+ const from = stripFilename(mapUrl);
61659
+ const prefix = sourceRoot ? sourceRoot + "/" : "";
61660
+ return (source) => resolve(prefix + (source || ""), from);
61661
+ }
61662
+ var COLUMN = 0;
61663
+ var SOURCES_INDEX = 1;
61664
+ var SOURCE_LINE = 2;
61665
+ var SOURCE_COLUMN = 3;
61666
+ var NAMES_INDEX = 4;
61667
+ function maybeSort(mappings, owned) {
61668
+ const unsortedIndex = nextUnsortedSegmentLine(mappings, 0);
61669
+ if (unsortedIndex === mappings.length) return mappings;
61670
+ if (!owned) mappings = mappings.slice();
61671
+ for (let i = unsortedIndex; i < mappings.length; i = nextUnsortedSegmentLine(mappings, i + 1)) mappings[i] = sortSegments(mappings[i], owned);
61672
+ return mappings;
61673
+ }
61674
+ function nextUnsortedSegmentLine(mappings, start) {
61675
+ for (let i = start; i < mappings.length; i++) if (!isSorted(mappings[i])) return i;
61676
+ return mappings.length;
61677
+ }
61678
+ function isSorted(line) {
61679
+ for (let j = 1; j < line.length; j++) if (line[j][COLUMN] < line[j - 1][COLUMN]) return false;
61680
+ return true;
61681
+ }
61682
+ function sortSegments(line, owned) {
61683
+ if (!owned) line = line.slice();
61684
+ return line.sort(sortComparator);
61685
+ }
61686
+ function sortComparator(a, b) {
61687
+ return a[COLUMN] - b[COLUMN];
61688
+ }
61689
+ var found = false;
61690
+ function binarySearch(haystack, needle, low, high) {
61691
+ while (low <= high) {
61692
+ const mid = low + (high - low >> 1);
61693
+ const cmp = haystack[mid][COLUMN] - needle;
61694
+ if (cmp === 0) {
61695
+ found = true;
61696
+ return mid;
61697
+ }
61698
+ if (cmp < 0) low = mid + 1;
61699
+ else high = mid - 1;
61700
+ }
61701
+ found = false;
61702
+ return low - 1;
61703
+ }
61704
+ function upperBound(haystack, needle, index) {
61705
+ for (let i = index + 1; i < haystack.length; index = i++) if (haystack[i][COLUMN] !== needle) break;
61706
+ return index;
61707
+ }
61708
+ function lowerBound(haystack, needle, index) {
61709
+ for (let i = index - 1; i >= 0; index = i--) if (haystack[i][COLUMN] !== needle) break;
61710
+ return index;
61711
+ }
61712
+ function memoizedState() {
61713
+ return {
61714
+ lastKey: -1,
61715
+ lastNeedle: -1,
61716
+ lastIndex: -1
61717
+ };
61718
+ }
61719
+ function memoizedBinarySearch(haystack, needle, state, key) {
61720
+ const { lastKey, lastNeedle, lastIndex } = state;
61721
+ let low = 0;
61722
+ let high = haystack.length - 1;
61723
+ if (key === lastKey) {
61724
+ if (needle === lastNeedle) {
61725
+ found = lastIndex !== -1 && haystack[lastIndex][COLUMN] === needle;
61726
+ return lastIndex;
61727
+ }
61728
+ if (needle >= lastNeedle) low = lastIndex === -1 ? 0 : lastIndex;
61729
+ else high = lastIndex;
61730
+ }
61731
+ state.lastKey = key;
61732
+ state.lastNeedle = needle;
61733
+ return state.lastIndex = binarySearch(haystack, needle, low, high);
61734
+ }
61735
+ function parse(map) {
61736
+ return typeof map === "string" ? JSON.parse(map) : map;
61737
+ }
61738
+ var LINE_GTR_ZERO = "`line` must be greater than 0 (lines start at line 1)";
61739
+ var COL_GTR_EQ_ZERO = "`column` must be greater than or equal to 0 (columns start at column 0)";
61740
+ var TraceMap = class {
61741
+ constructor(map, mapUrl) {
61742
+ const isString = typeof map === "string";
61743
+ if (!isString && map._decodedMemo) return map;
61744
+ const parsed = parse(map);
61745
+ const { version, file, names, sourceRoot, sources, sourcesContent } = parsed;
61746
+ this.version = version;
61747
+ this.file = file;
61748
+ this.names = names || [];
61749
+ this.sourceRoot = sourceRoot;
61750
+ this.sources = sources;
61751
+ this.sourcesContent = sourcesContent;
61752
+ this.ignoreList = parsed.ignoreList || parsed.x_google_ignoreList || void 0;
61753
+ const resolve = resolver(mapUrl, sourceRoot);
61754
+ this.resolvedSources = sources.map(resolve);
61755
+ const { mappings } = parsed;
61756
+ if (typeof mappings === "string") {
61757
+ this._encoded = mappings;
61758
+ this._decoded = void 0;
61759
+ } else if (Array.isArray(mappings)) {
61760
+ this._encoded = void 0;
61761
+ this._decoded = maybeSort(mappings, isString);
61762
+ } else if (parsed.sections) throw new Error(`TraceMap passed sectioned source map, please use FlattenMap export instead`);
61763
+ else throw new Error(`invalid source map: ${JSON.stringify(parsed)}`);
61764
+ this._decodedMemo = memoizedState();
61765
+ this._bySources = void 0;
61766
+ this._bySourceMemos = void 0;
61767
+ }
61768
+ };
61769
+ function cast(map) {
61770
+ return map;
61771
+ }
61772
+ function decodedMappings(map) {
61773
+ var _a;
61774
+ return (_a = cast(map))._decoded || (_a._decoded = decode(cast(map)._encoded));
61775
+ }
61776
+ function originalPositionFor(map, needle) {
61777
+ let { line, column, bias } = needle;
61778
+ line--;
61779
+ if (line < 0) throw new Error(LINE_GTR_ZERO);
61780
+ if (column < 0) throw new Error(COL_GTR_EQ_ZERO);
61781
+ const decoded = decodedMappings(map);
61782
+ if (line >= decoded.length) return OMapping(null, null, null, null);
61783
+ const segments = decoded[line];
61784
+ const index = traceSegmentInternal(segments, cast(map)._decodedMemo, line, column, bias || 1);
61785
+ if (index === -1) return OMapping(null, null, null, null);
61786
+ const segment = segments[index];
61787
+ if (segment.length === 1) return OMapping(null, null, null, null);
61788
+ const { names, resolvedSources } = map;
61789
+ return OMapping(resolvedSources[segment[SOURCES_INDEX]], segment[SOURCE_LINE] + 1, segment[SOURCE_COLUMN], segment.length === 5 ? names[segment[NAMES_INDEX]] : null);
61790
+ }
61791
+ function OMapping(source, line, column, name) {
61792
+ return {
61793
+ source,
61794
+ line,
61795
+ column,
61796
+ name
61797
+ };
61798
+ }
61799
+ function traceSegmentInternal(segments, memo, line, column, bias) {
61800
+ let index = memoizedBinarySearch(segments, column, memo, line);
61801
+ if (found) index = (bias === -1 ? upperBound : lowerBound)(segments, column, index);
61802
+ else if (bias === -1) index++;
61803
+ if (index === -1 || index === segments.length) return -1;
61804
+ return index;
61805
+ }
61806
+ //#endregion
61383
61807
  //#region ../core/dist/index.js
61384
61808
  var __create = Object.create;
61385
61809
  var __defProp = Object.defineProperty;
@@ -61449,7 +61873,7 @@ var AmbiguousProjectError = class extends Error {
61449
61873
  };
61450
61874
  const isProjectDiscoveryError = (value) => value instanceof ProjectNotFoundError || value instanceof NoReactDependencyError || value instanceof PackageJsonNotFoundError || value instanceof NotADirectoryError || value instanceof AmbiguousProjectError;
61451
61875
  const HTML_FILE_PATTERN = /\.html$/i;
61452
- const SOURCE_FILE_PATTERN = /\.(?:tsx?|jsx?|mts|mjs|[hH][tT][mM][lL])$/;
61876
+ const SOURCE_FILE_PATTERN = /\.(?:astro|tsx?|jsx?|mts|mjs|[hH][tT][mM][lL])$/;
61453
61877
  const GENERATED_BUNDLE_FILE_PATTERN = /\.(iife|umd|global|min)\.m?js$/i;
61454
61878
  const GENERATED_SOURCE_DIRECTORY_PATTERN = /(?:^|\/)__generated__\//;
61455
61879
  const MINIFIED_SNIFF_BYTES = 65536;
@@ -61792,7 +62216,7 @@ const SOCKET_FREE_USER_AGENT = "react-doctor-supply-chain";
61792
62216
  const FILE_LINT_CACHE_FILENAME = "file-lint-cache.json";
61793
62217
  const FILE_LINT_CACHE_MAX_FILE_COUNT = 5e4;
61794
62218
  const SIDECAR_LINT_CACHE_FILENAME = "sidecar-lint-cache.json";
61795
- const CORE_PACKAGE_VERSION = "0.9.1";
62219
+ const CORE_PACKAGE_VERSION = "0.9.2";
61796
62220
  const DEAD_CODE_CACHE_FILENAME = "dead-code-cache.json";
61797
62221
  const DEAD_CODE_SUMMARY_CACHE_FILENAME = "dead-code-summaries.json";
61798
62222
  const SUPPLY_CHAIN_PLUGIN = "socket";
@@ -62042,8 +62466,13 @@ const findMonorepoRoot = (startDirectory) => {
62042
62466
  * byte-equivalent copy.
62043
62467
  */
62044
62468
  const isProjectBoundary = (directory) => NFS.existsSync(Path.join(directory, ".git")) || isMonorepoRoot(directory);
62469
+ const unwrapTypescriptExpression = (expression) => {
62470
+ let currentExpression = expression;
62471
+ while (ts.isParenthesizedExpression(currentExpression) || ts.isAsExpression(currentExpression) || ts.isSatisfiesExpression(currentExpression) || ts.isNonNullExpression(currentExpression) || ts.isTypeAssertionExpression(currentExpression)) currentExpression = currentExpression.expression;
62472
+ return currentExpression;
62473
+ };
62045
62474
  const TSCONFIG_FILENAME = "tsconfig.json";
62046
- const isRelativeExtendsValue = (extendsValue) => extendsValue.startsWith("./") || extendsValue.startsWith("../") || Path.isAbsolute(extendsValue);
62475
+ const isLocalModuleSpecifier = (moduleSpecifier) => moduleSpecifier === "." || moduleSpecifier === ".." || moduleSpecifier.startsWith("./") || moduleSpecifier.startsWith("../") || Path.isAbsolute(moduleSpecifier);
62047
62476
  const ensureJsonExtension = (filePath) => Path.extname(filePath) === "" ? `${filePath}.json` : filePath;
62048
62477
  const resolvePackageExtendsPath = (extendsValue, fromConfigDirectory) => {
62049
62478
  const requireFromConfig = createRequire(Path.join(fromConfigDirectory, "tsconfig.json"));
@@ -62060,7 +62489,12 @@ const resolvePackageExtendsPath = (extendsValue, fromConfigDirectory) => {
62060
62489
  return null;
62061
62490
  };
62062
62491
  const resolveExtendsPath = (extendsValue, fromConfigDirectory) => {
62063
- if (isRelativeExtendsValue(extendsValue)) return ensureJsonExtension(Path.resolve(fromConfigDirectory, extendsValue));
62492
+ if (isLocalModuleSpecifier(extendsValue)) {
62493
+ const resolvedPath = Path.resolve(fromConfigDirectory, extendsValue);
62494
+ if (isFile(resolvedPath)) return resolvedPath;
62495
+ const directoryConfigPath = Path.join(resolvedPath, TSCONFIG_FILENAME);
62496
+ return isFile(directoryConfigPath) ? directoryConfigPath : ensureJsonExtension(resolvedPath);
62497
+ }
62064
62498
  return resolvePackageExtendsPath(extendsValue, fromConfigDirectory);
62065
62499
  };
62066
62500
  const normalizeCompilerOptions = (compilerOptions) => {
@@ -62167,6 +62601,7 @@ const FRAMEWORK_PACKAGES = {
62167
62601
  "@tanstack/react-start": "tanstack-start",
62168
62602
  "@remix-run/react": "remix",
62169
62603
  gatsby: "gatsby",
62604
+ astro: "astro",
62170
62605
  vite: "vite",
62171
62606
  "react-scripts": "cra",
62172
62607
  expo: "expo",
@@ -62254,6 +62689,15 @@ const REACT_COMPILER_CONFIG_SOURCE_EXTENSIONS = [
62254
62689
  ".cts",
62255
62690
  ".json"
62256
62691
  ];
62692
+ const REACT_COMPILER_CONFIG_RESOLVER = new ResolverFactory({
62693
+ conditionNames: [
62694
+ "import",
62695
+ "require",
62696
+ "node",
62697
+ "default"
62698
+ ],
62699
+ extensions: REACT_COMPILER_CONFIG_SOURCE_EXTENSIONS
62700
+ });
62257
62701
  const STATIC_EXPORT_OUTPUT_PATTERN = /(?:^|[^.\w])["']?output["']?\s*:\s*["']export["']/m;
62258
62702
  const hasCompilerPackage = (packageJson, compilerPackages) => {
62259
62703
  const allDependencies = {
@@ -62277,6 +62721,18 @@ const hasCompilerPackageInAncestors = (directory, compilerPackages) => {
62277
62721
  return false;
62278
62722
  };
62279
62723
  const resolveImportedConfigFile = (fromFilePath, moduleSpecifier) => {
62724
+ if (!isLocalModuleSpecifier(moduleSpecifier)) {
62725
+ try {
62726
+ const resolvedPath = REACT_COMPILER_CONFIG_RESOLVER.resolveFileSync(fromFilePath, moduleSpecifier).path;
62727
+ if (resolvedPath && isFile(resolvedPath)) return resolvedPath;
62728
+ } catch {}
62729
+ try {
62730
+ const resolvedPath = createRequire(fromFilePath).resolve(moduleSpecifier);
62731
+ return isFile(resolvedPath) ? resolvedPath : null;
62732
+ } catch {
62733
+ return null;
62734
+ }
62735
+ }
62280
62736
  const unresolvedPath = Path.resolve(Path.dirname(fromFilePath), moduleSpecifier);
62281
62737
  const extension = Path.extname(unresolvedPath);
62282
62738
  return (extension ? [unresolvedPath, ...REACT_COMPILER_CONFIG_SOURCE_EXTENSIONS.map((sourceExtension) => `${unresolvedPath.slice(0, -extension.length)}${sourceExtension}`)] : [
@@ -62302,7 +62758,7 @@ const hasTopLevelValueBinding = (sourceFile, bindingName) => sourceFile.statemen
62302
62758
  const namedBindings = importClause?.namedBindings;
62303
62759
  return namedBindings ? ts.isNamespaceImport(namedBindings) ? namedBindings.name.text === bindingName : namedBindings.elements.some((element) => element.name.text === bindingName) : false;
62304
62760
  }
62305
- if (ts.isVariableStatement(statement)) return statement.declarationList.declarations.some((declaration) => ts.isIdentifier(declaration.name) && declaration.name.text === bindingName);
62761
+ if (ts.isVariableStatement(statement)) return statement.declarationList.declarations.some((declaration) => bindingNameContainsIdentifier(declaration.name, bindingName));
62306
62762
  return (ts.isFunctionDeclaration(statement) || ts.isClassDeclaration(statement)) && statement.name?.text === bindingName;
62307
62763
  });
62308
62764
  const getImportBinding = (sourceFile, bindingName) => {
@@ -62367,10 +62823,16 @@ const getTopLevelBinding = (sourceFile, bindingName) => {
62367
62823
  }
62368
62824
  return null;
62369
62825
  };
62370
- const getFunctionLocalBindings = (functionNode, argumentsList) => {
62826
+ const getFunctionLocalBindings = (functionNode, argumentsList, argumentAnalysis, functionAnalysis) => {
62371
62827
  const localBindings = /* @__PURE__ */ new Map();
62372
62828
  functionNode.parameters.forEach((parameter, parameterIndex) => {
62373
- if (ts.isIdentifier(parameter.name)) localBindings.set(parameter.name.text, argumentsList[parameterIndex] ?? parameter.initializer ?? null);
62829
+ if (ts.isIdentifier(parameter.name)) {
62830
+ const argument = argumentsList[parameterIndex];
62831
+ localBindings.set(parameter.name.text, {
62832
+ expression: argument ?? parameter.initializer ?? null,
62833
+ analysis: argument ? argumentAnalysis : functionAnalysis
62834
+ });
62835
+ }
62374
62836
  });
62375
62837
  return localBindings;
62376
62838
  };
@@ -62403,6 +62865,48 @@ const getScopedConfigBinding = (identifier) => {
62403
62865
  };
62404
62866
  };
62405
62867
  const isCompilerTransformModule = (moduleSpecifier, exportName) => moduleSpecifier === "babel-plugin-react-compiler" && exportName === "default" || moduleSpecifier === "@vitejs/plugin-react" && exportName === "reactCompilerPreset";
62868
+ const NODE_MODULE_SPECIFIERS = new Set(["module", "node:module"]);
62869
+ const isConstantVariableInitializer = (node) => ts.isExpression(node) && ts.isVariableDeclaration(node.parent) && ts.isVariableDeclarationList(node.parent.parent) && Boolean(node.parent.parent.flags & ts.NodeFlags.Const);
62870
+ const isNodeCreateRequireCall = (node, analysis) => {
62871
+ if (ts.isParenthesizedExpression(node) || ts.isAsExpression(node) || ts.isTypeAssertionExpression(node) || ts.isSatisfiesExpression(node) || ts.isNonNullExpression(node) || ts.isAwaitExpression(node)) return isNodeCreateRequireCall(node.expression, analysis);
62872
+ if (!ts.isCallExpression(node)) return false;
62873
+ const target = node.expression;
62874
+ if (ts.isIdentifier(target)) {
62875
+ if (analysis.localBindings.has(target.text) || getScopedConfigBinding(target).wasFound) return false;
62876
+ const importBinding = getImportBinding(analysis.sourceFile, target.text);
62877
+ return Boolean(importBinding && NODE_MODULE_SPECIFIERS.has(importBinding.moduleSpecifier) && importBinding.exportName === "createRequire");
62878
+ }
62879
+ if (!ts.isPropertyAccessExpression(target) && !ts.isElementAccessExpression(target)) return false;
62880
+ if ((ts.isPropertyAccessExpression(target) ? target.name.text : target.argumentExpression && ts.isStringLiteralLike(target.argumentExpression) ? target.argumentExpression.text : null) !== "createRequire") return false;
62881
+ const createRequireReceiver = target.expression;
62882
+ if (ts.isCallExpression(createRequireReceiver)) {
62883
+ const requiredModuleSpecifier = getRequireModuleSpecifier$1(createRequireReceiver);
62884
+ if (requiredModuleSpecifier === null || !NODE_MODULE_SPECIFIERS.has(requiredModuleSpecifier) || !ts.isIdentifier(createRequireReceiver.expression)) return false;
62885
+ const requireIdentifier = createRequireReceiver.expression;
62886
+ return !analysis.localBindings.has(requireIdentifier.text) && !getScopedConfigBinding(requireIdentifier).wasFound && !hasTopLevelValueBinding(analysis.sourceFile, requireIdentifier.text);
62887
+ }
62888
+ if (!ts.isIdentifier(createRequireReceiver)) return false;
62889
+ if (analysis.localBindings.has(createRequireReceiver.text) || getScopedConfigBinding(createRequireReceiver).wasFound) return false;
62890
+ const importBinding = getImportBinding(analysis.sourceFile, createRequireReceiver.text);
62891
+ return Boolean(importBinding?.isNamespace && NODE_MODULE_SPECIFIERS.has(importBinding.moduleSpecifier));
62892
+ };
62893
+ const getNodeRequireResolveModuleSpecifier = (callExpression, analysis) => {
62894
+ const [moduleSpecifierNode] = callExpression.arguments;
62895
+ if (!moduleSpecifierNode || !ts.isStringLiteralLike(moduleSpecifierNode)) return null;
62896
+ const target = callExpression.expression;
62897
+ if (!ts.isPropertyAccessExpression(target) && !ts.isElementAccessExpression(target)) return null;
62898
+ if ((ts.isPropertyAccessExpression(target) ? target.name.text : target.argumentExpression && ts.isStringLiteralLike(target.argumentExpression) ? target.argumentExpression.text : null) !== "resolve") return null;
62899
+ if (isNodeCreateRequireCall(target.expression, analysis)) return moduleSpecifierNode.text;
62900
+ if (!ts.isIdentifier(target.expression)) return null;
62901
+ const resolverIdentifier = target.expression;
62902
+ if (analysis.localBindings.has(resolverIdentifier.text)) return null;
62903
+ const scopedBinding = getScopedConfigBinding(resolverIdentifier);
62904
+ const topLevelBinding = scopedBinding.wasFound ? null : getTopLevelBinding(analysis.sourceFile, resolverIdentifier.text);
62905
+ const resolverInitializer = scopedBinding.wasFound ? scopedBinding.initializer : topLevelBinding;
62906
+ if (resolverInitializer === null && !scopedBinding.wasFound && resolverIdentifier.text === "require" && !hasTopLevelValueBinding(analysis.sourceFile, resolverIdentifier.text) && getImportBinding(analysis.sourceFile, resolverIdentifier.text) === null) return moduleSpecifierNode.text;
62907
+ if (!resolverInitializer || !isConstantVariableInitializer(resolverInitializer) || !isNodeCreateRequireCall(resolverInitializer, analysis)) return null;
62908
+ return moduleSpecifierNode.text;
62909
+ };
62406
62910
  const getAssignedPropertyInitializer = (identifier, propertyName) => {
62407
62911
  let bindingScope = null;
62408
62912
  let currentNode = identifier;
@@ -62445,9 +62949,11 @@ const getAssignedPropertyInitializer = (identifier, propertyName) => {
62445
62949
  initializer: assignedInitializer
62446
62950
  };
62447
62951
  };
62448
- const getStaticConfigValueState = (expression, analysis) => {
62449
- let unwrappedExpression = expression;
62450
- while (ts.isParenthesizedExpression(unwrappedExpression) || ts.isAsExpression(unwrappedExpression) || ts.isTypeAssertionExpression(unwrappedExpression) || ts.isSatisfiesExpression(unwrappedExpression) || ts.isNonNullExpression(unwrappedExpression)) unwrappedExpression = unwrappedExpression.expression;
62952
+ const getStaticConfigValueState = (expression, analysis, visitedExpressions = /* @__PURE__ */ new Set()) => {
62953
+ const unwrappedExpression = unwrapTypescriptExpression(expression);
62954
+ if (visitedExpressions.has(unwrappedExpression)) return null;
62955
+ const nextVisitedExpressions = new Set(visitedExpressions);
62956
+ nextVisitedExpressions.add(unwrappedExpression);
62451
62957
  if (unwrappedExpression.kind === ts.SyntaxKind.NullKeyword || ts.isIdentifier(unwrappedExpression) && unwrappedExpression.text === "undefined") return {
62452
62958
  isNullish: true,
62453
62959
  isTruthy: false
@@ -62462,32 +62968,32 @@ const getStaticConfigValueState = (expression, analysis) => {
62462
62968
  };
62463
62969
  if (ts.isIdentifier(unwrappedExpression)) {
62464
62970
  if (analysis.localBindings.has(unwrappedExpression.text)) {
62465
- const localInitializer = analysis.localBindings.get(unwrappedExpression.text);
62466
- return localInitializer ? getStaticConfigValueState(localInitializer, analysis) : null;
62971
+ const localReference = analysis.localBindings.get(unwrappedExpression.text);
62972
+ return localReference?.expression ? getStaticConfigValueState(localReference.expression, localReference.analysis, nextVisitedExpressions) : null;
62467
62973
  }
62468
62974
  const topLevelBinding = getTopLevelBinding(analysis.sourceFile, unwrappedExpression.text);
62469
- return topLevelBinding && ts.isExpression(topLevelBinding) ? getStaticConfigValueState(topLevelBinding, analysis) : null;
62975
+ return topLevelBinding && ts.isExpression(topLevelBinding) ? getStaticConfigValueState(topLevelBinding, analysis, nextVisitedExpressions) : null;
62470
62976
  }
62471
62977
  if (ts.isConditionalExpression(unwrappedExpression)) {
62472
- const conditionState = getStaticConfigValueState(unwrappedExpression.condition, analysis);
62473
- if (conditionState !== null) return getStaticConfigValueState(conditionState.isTruthy ? unwrappedExpression.whenTrue : unwrappedExpression.whenFalse, analysis);
62474
- const whenTrueState = getStaticConfigValueState(unwrappedExpression.whenTrue, analysis);
62475
- const whenFalseState = getStaticConfigValueState(unwrappedExpression.whenFalse, analysis);
62978
+ const conditionState = getStaticConfigValueState(unwrappedExpression.condition, analysis, nextVisitedExpressions);
62979
+ if (conditionState !== null) return getStaticConfigValueState(conditionState.isTruthy ? unwrappedExpression.whenTrue : unwrappedExpression.whenFalse, analysis, nextVisitedExpressions);
62980
+ const whenTrueState = getStaticConfigValueState(unwrappedExpression.whenTrue, analysis, nextVisitedExpressions);
62981
+ const whenFalseState = getStaticConfigValueState(unwrappedExpression.whenFalse, analysis, nextVisitedExpressions);
62476
62982
  return whenTrueState !== null && whenFalseState !== null && whenTrueState.isNullish === whenFalseState.isNullish && whenTrueState.isTruthy === whenFalseState.isTruthy ? whenTrueState : null;
62477
62983
  }
62478
62984
  if (ts.isBinaryExpression(unwrappedExpression)) {
62479
- const leftState = getStaticConfigValueState(unwrappedExpression.left, analysis);
62985
+ const leftState = getStaticConfigValueState(unwrappedExpression.left, analysis, nextVisitedExpressions);
62480
62986
  if (unwrappedExpression.operatorToken.kind === ts.SyntaxKind.AmpersandAmpersandToken) {
62481
62987
  if (leftState === null) return null;
62482
- return leftState.isTruthy ? getStaticConfigValueState(unwrappedExpression.right, analysis) : leftState;
62988
+ return leftState.isTruthy ? getStaticConfigValueState(unwrappedExpression.right, analysis, nextVisitedExpressions) : leftState;
62483
62989
  }
62484
62990
  if (unwrappedExpression.operatorToken.kind === ts.SyntaxKind.BarBarToken) {
62485
62991
  if (leftState === null) return null;
62486
- return leftState.isTruthy ? leftState : getStaticConfigValueState(unwrappedExpression.right, analysis);
62992
+ return leftState.isTruthy ? leftState : getStaticConfigValueState(unwrappedExpression.right, analysis, nextVisitedExpressions);
62487
62993
  }
62488
62994
  if (unwrappedExpression.operatorToken.kind === ts.SyntaxKind.QuestionQuestionToken) {
62489
62995
  if (leftState === null) return null;
62490
- return leftState.isNullish ? getStaticConfigValueState(unwrappedExpression.right, analysis) : leftState;
62996
+ return leftState.isNullish ? getStaticConfigValueState(unwrappedExpression.right, analysis, nextVisitedExpressions) : leftState;
62491
62997
  }
62492
62998
  }
62493
62999
  return null;
@@ -62496,25 +63002,27 @@ const isStaticallyDisabledConfigExpression = (expression, analysis) => getStatic
62496
63002
  const isStaticallyTruthyConfigExpression = (expression, analysis) => getStaticConfigValueState(expression, analysis)?.isTruthy === true;
62497
63003
  const isStaticallyNullishConfigExpression = (expression, analysis) => getStaticConfigValueState(expression, analysis)?.isNullish === true;
62498
63004
  const isStaticallyNonNullishConfigExpression = (expression, analysis) => getStaticConfigValueState(expression, analysis)?.isNullish === false;
62499
- const getReactCompilerFlagState = (expression, analysis) => {
62500
- let unwrappedExpression = expression;
62501
- while (ts.isParenthesizedExpression(unwrappedExpression) || ts.isAsExpression(unwrappedExpression) || ts.isTypeAssertionExpression(unwrappedExpression) || ts.isSatisfiesExpression(unwrappedExpression) || ts.isNonNullExpression(unwrappedExpression)) unwrappedExpression = unwrappedExpression.expression;
63005
+ const getReactCompilerFlagState = (expression, analysis, visitedExpressions = /* @__PURE__ */ new Set()) => {
63006
+ const unwrappedExpression = unwrapTypescriptExpression(expression);
63007
+ if (visitedExpressions.has(unwrappedExpression)) return null;
63008
+ const nextVisitedExpressions = new Set(visitedExpressions);
63009
+ nextVisitedExpressions.add(unwrappedExpression);
62502
63010
  if (ts.isIdentifier(unwrappedExpression)) {
62503
63011
  const assignedBinding = getAssignedPropertyInitializer(unwrappedExpression, "reactCompiler");
62504
63012
  if (assignedBinding.wasFound && assignedBinding.initializer) return { isEnabled: !isStaticallyDisabledConfigExpression(assignedBinding.initializer, analysis) };
62505
63013
  if (analysis.localBindings.has(unwrappedExpression.text)) {
62506
- const localInitializer = analysis.localBindings.get(unwrappedExpression.text);
62507
- return localInitializer ? getReactCompilerFlagState(localInitializer, analysis) : null;
63014
+ const localReference = analysis.localBindings.get(unwrappedExpression.text);
63015
+ return localReference?.expression ? getReactCompilerFlagState(localReference.expression, localReference.analysis, nextVisitedExpressions) : null;
62508
63016
  }
62509
63017
  const topLevelBinding = getTopLevelBinding(analysis.sourceFile, unwrappedExpression.text);
62510
- return topLevelBinding && ts.isExpression(topLevelBinding) ? getReactCompilerFlagState(topLevelBinding, analysis) : null;
63018
+ return topLevelBinding && ts.isExpression(topLevelBinding) ? getReactCompilerFlagState(topLevelBinding, analysis, nextVisitedExpressions) : null;
62511
63019
  }
62512
63020
  if (!ts.isObjectLiteralExpression(unwrappedExpression)) return null;
62513
63021
  for (const property of [...unwrappedExpression.properties].reverse()) {
62514
63022
  if (ts.isPropertyAssignment(property) && getStaticPropertyName$2(property.name) === "reactCompiler") return { isEnabled: !isStaticallyDisabledConfigExpression(property.initializer, analysis) };
62515
63023
  if (ts.isShorthandPropertyAssignment(property) && property.name.text === "reactCompiler") return { isEnabled: !isStaticallyDisabledConfigExpression(property.name, analysis) };
62516
63024
  if (ts.isSpreadAssignment(property)) {
62517
- const spreadState = getReactCompilerFlagState(property.expression, analysis);
63025
+ const spreadState = getReactCompilerFlagState(property.expression, analysis, nextVisitedExpressions);
62518
63026
  if (spreadState) return spreadState;
62519
63027
  }
62520
63028
  }
@@ -62527,8 +63035,8 @@ const getSelectedObjectProperty = (expression, propertyName, analysis, visitedEx
62527
63035
  visitedExpressions.add(resolvedExpression);
62528
63036
  if (ts.isIdentifier(resolvedExpression)) {
62529
63037
  if (analysis.localBindings.has(resolvedExpression.text)) {
62530
- const localInitializer = analysis.localBindings.get(resolvedExpression.text);
62531
- return localInitializer ? getSelectedObjectProperty(localInitializer, propertyName, analysis, visitedExpressions) : null;
63038
+ const localReference = analysis.localBindings.get(resolvedExpression.text);
63039
+ return localReference?.expression ? getSelectedObjectProperty(localReference.expression, propertyName, localReference.analysis, visitedExpressions) : null;
62532
63040
  }
62533
63041
  const scopedBinding = getScopedConfigBinding(resolvedExpression);
62534
63042
  if (scopedBinding.wasFound) return scopedBinding.initializer ? getSelectedObjectProperty(scopedBinding.initializer, propertyName, analysis, visitedExpressions) : null;
@@ -62537,9 +63045,18 @@ const getSelectedObjectProperty = (expression, propertyName, analysis, visitedEx
62537
63045
  }
62538
63046
  if (!ts.isObjectLiteralExpression(resolvedExpression)) return null;
62539
63047
  for (const property of [...resolvedExpression.properties].reverse()) {
62540
- if (ts.isPropertyAssignment(property) && getStaticPropertyName$2(property.name) === propertyName) return property.initializer;
62541
- if (ts.isMethodDeclaration(property) && getStaticPropertyName$2(property.name) === propertyName) return property;
62542
- if (ts.isShorthandPropertyAssignment(property) && property.name.text === propertyName) return property.name;
63048
+ if (ts.isPropertyAssignment(property) && getStaticPropertyName$2(property.name) === propertyName) return {
63049
+ node: property.initializer,
63050
+ analysis
63051
+ };
63052
+ if (ts.isMethodDeclaration(property) && getStaticPropertyName$2(property.name) === propertyName) return {
63053
+ node: property,
63054
+ analysis
63055
+ };
63056
+ if (ts.isShorthandPropertyAssignment(property) && property.name.text === propertyName) return {
63057
+ node: property.name,
63058
+ analysis
63059
+ };
62543
63060
  if (ts.isSpreadAssignment(property)) {
62544
63061
  const spreadProperty = getSelectedObjectProperty(property.expression, propertyName, analysis, visitedExpressions);
62545
63062
  if (spreadProperty) return spreadProperty;
@@ -62552,8 +63069,8 @@ const configExpressionMayDefineProperty = (expression, propertyName, analysis) =
62552
63069
  while (ts.isParenthesizedExpression(resolvedExpression) || ts.isAsExpression(resolvedExpression) || ts.isTypeAssertionExpression(resolvedExpression) || ts.isSatisfiesExpression(resolvedExpression) || ts.isNonNullExpression(resolvedExpression)) resolvedExpression = resolvedExpression.expression;
62553
63070
  if (ts.isIdentifier(resolvedExpression)) {
62554
63071
  if (analysis.localBindings.has(resolvedExpression.text)) {
62555
- const localInitializer = analysis.localBindings.get(resolvedExpression.text);
62556
- return localInitializer ? configExpressionMayDefineProperty(localInitializer, propertyName, analysis) : true;
63072
+ const localReference = analysis.localBindings.get(resolvedExpression.text);
63073
+ return localReference?.expression ? configExpressionMayDefineProperty(localReference.expression, propertyName, localReference.analysis) : true;
62557
63074
  }
62558
63075
  const scopedBinding = getScopedConfigBinding(resolvedExpression);
62559
63076
  if (scopedBinding.wasFound) return scopedBinding.initializer ? configExpressionMayDefineProperty(scopedBinding.initializer, propertyName, analysis) : true;
@@ -62637,15 +63154,15 @@ const getReExportedConfigModules = (sourceFile, exportName) => {
62637
63154
  }
62638
63155
  return bindings;
62639
63156
  };
62640
- const analyzeConfigModuleExport = (filePath, exportName, allowCompilerTransform, importDepth, visitedModules, argumentsList = []) => {
63157
+ const analyzeConfigModuleExport = (filePath, exportName, allowCompilerTransform, importDepth, visitedModules, argumentsList = [], argumentAnalysis) => {
62641
63158
  if (!isFile(filePath) || importDepth > 4) return false;
62642
63159
  const moduleVisitKey = `${filePath}:${exportName}:${allowCompilerTransform}`;
62643
63160
  if (visitedModules.has(moduleVisitKey)) return false;
62644
63161
  const nextVisitedModules = new Set(visitedModules);
62645
63162
  nextVisitedModules.add(moduleVisitKey);
62646
- return analyzeConfigSourceFileExport(parseConfigSourceFile(filePath, NFS.readFileSync(filePath, "utf-8")), filePath, exportName, allowCompilerTransform, importDepth, nextVisitedModules, argumentsList);
63163
+ return analyzeConfigSourceFileExport(parseConfigSourceFile(filePath, NFS.readFileSync(filePath, "utf-8")), filePath, exportName, allowCompilerTransform, importDepth, nextVisitedModules, argumentsList, argumentAnalysis);
62647
63164
  };
62648
- const analyzeConfigSourceFileExport = (sourceFile, filePath, exportName, allowCompilerTransform, importDepth, visitedModules, argumentsList = []) => {
63165
+ const analyzeConfigSourceFileExport = (sourceFile, filePath, exportName, allowCompilerTransform, importDepth, visitedModules, argumentsList = [], argumentAnalysis) => {
62649
63166
  const analysis = {
62650
63167
  filePath,
62651
63168
  sourceFile,
@@ -62655,14 +63172,27 @@ const analyzeConfigSourceFileExport = (sourceFile, filePath, exportName, allowCo
62655
63172
  localBindings: /* @__PURE__ */ new Map(),
62656
63173
  activeFunctions: /* @__PURE__ */ new Set()
62657
63174
  };
63175
+ const resolvedArgumentAnalysis = argumentAnalysis ?? analysis;
62658
63176
  const exportedConfigNodes = getExportedConfigNodes(sourceFile, exportName);
62659
- return exportedConfigNodes.some((node) => ts.isArrowFunction(node) || ts.isFunctionExpression(node) || ts.isFunctionDeclaration(node) ? analyzeConfigFunction(node, analysis, allowCompilerTransform, argumentsList) : analyzeConfigNode(node, analysis, allowCompilerTransform)) || getReExportedConfigModules(sourceFile, exportName).some((binding) => {
63177
+ return exportedConfigNodes.some((node) => {
63178
+ if (ts.isArrowFunction(node) || ts.isFunctionExpression(node) || ts.isFunctionDeclaration(node)) return analyzeConfigFunction(node, analysis, allowCompilerTransform, argumentsList, resolvedArgumentAnalysis);
63179
+ if (argumentsList.length > 0 && ts.isIdentifier(node)) {
63180
+ const topLevelBinding = getTopLevelBinding(sourceFile, node.text);
63181
+ if (topLevelBinding && ts.isFunctionLike(topLevelBinding)) return analyzeConfigFunction(topLevelBinding, analysis, allowCompilerTransform, argumentsList, resolvedArgumentAnalysis);
63182
+ const importBinding = getImportBinding(sourceFile, node.text);
63183
+ if (importBinding) {
63184
+ const importedFilePath = resolveImportedConfigFile(filePath, importBinding.moduleSpecifier);
63185
+ return Boolean(importedFilePath && analyzeConfigModuleExport(importedFilePath, importBinding.exportName, allowCompilerTransform, importDepth + 1, visitedModules, argumentsList, resolvedArgumentAnalysis));
63186
+ }
63187
+ }
63188
+ return analyzeConfigNode(node, analysis, allowCompilerTransform);
63189
+ }) || getReExportedConfigModules(sourceFile, exportName).some((binding) => {
62660
63190
  if (exportedConfigNodes.length > 0 && binding.isNamespace) return false;
62661
63191
  const importedFilePath = resolveImportedConfigFile(filePath, binding.moduleSpecifier);
62662
- return Boolean(importedFilePath && analyzeConfigModuleExport(importedFilePath, binding.exportName, allowCompilerTransform, importDepth + 1, visitedModules, argumentsList));
63192
+ return Boolean(importedFilePath && analyzeConfigModuleExport(importedFilePath, binding.exportName, allowCompilerTransform, importDepth + 1, visitedModules, argumentsList, resolvedArgumentAnalysis));
62663
63193
  });
62664
63194
  };
62665
- const analyzeConfigFunction = (functionNode, analysis, allowCompilerTransform, argumentsList = []) => {
63195
+ const analyzeConfigFunction = (functionNode, analysis, allowCompilerTransform, argumentsList = [], argumentAnalysis = analysis) => {
62666
63196
  if (!functionNode.body) return false;
62667
63197
  if (analysis.activeFunctions.has(functionNode.pos)) return false;
62668
63198
  const activeFunctions = new Set(analysis.activeFunctions);
@@ -62670,7 +63200,7 @@ const analyzeConfigFunction = (functionNode, analysis, allowCompilerTransform, a
62670
63200
  const functionAnalysis = {
62671
63201
  ...analysis,
62672
63202
  visitedNodes: /* @__PURE__ */ new Set(),
62673
- localBindings: getFunctionLocalBindings(functionNode, argumentsList),
63203
+ localBindings: getFunctionLocalBindings(functionNode, argumentsList, argumentAnalysis, analysis),
62674
63204
  activeFunctions
62675
63205
  };
62676
63206
  if (!ts.isBlock(functionNode.body)) return analyzeConfigNode(functionNode.body, functionAnalysis, allowCompilerTransform);
@@ -62686,6 +63216,11 @@ const analyzeConfigFunction = (functionNode, analysis, allowCompilerTransform, a
62686
63216
  visitReturns(functionNode.body);
62687
63217
  return hasCompiler;
62688
63218
  };
63219
+ const analyzeImportedConfig = ({ analysis, moduleSpecifier, exportName, allowCompilerTransform, argumentsList }) => {
63220
+ const importedFilePath = resolveImportedConfigFile(analysis.filePath, moduleSpecifier);
63221
+ if (!importedFilePath) return null;
63222
+ return analyzeConfigModuleExport(importedFilePath, exportName, allowCompilerTransform, analysis.importDepth + 1, analysis.visitedModules, argumentsList, analysis);
63223
+ };
62689
63224
  const analyzeConfigIdentifier = (identifier, analysis, allowCompilerTransform, isCompilerTransformCollection, excludedPropertyNames) => {
62690
63225
  const assignedReactCompiler = getAssignedPropertyInitializer(identifier, "reactCompiler");
62691
63226
  if (assignedReactCompiler.initializer && !isStaticallyDisabledConfigExpression(assignedReactCompiler.initializer, analysis)) return true;
@@ -62698,42 +63233,74 @@ const analyzeConfigIdentifier = (identifier, analysis, allowCompilerTransform, i
62698
63233
  if (assignedPlugins.wasFound) overriddenPropertyNames.add("plugins");
62699
63234
  if (assignedPresets.wasFound) overriddenPropertyNames.add("presets");
62700
63235
  if (analysis.localBindings.has(identifier.text)) {
62701
- const localInitializer = analysis.localBindings.get(identifier.text);
62702
- return Boolean(localInitializer && analyzeConfigNode(localInitializer, analysis, allowCompilerTransform, isCompilerTransformCollection, overriddenPropertyNames));
63236
+ const localReference = analysis.localBindings.get(identifier.text);
63237
+ return Boolean(localReference?.expression && analyzeConfigNode(localReference.expression, localReference.analysis, allowCompilerTransform, isCompilerTransformCollection, overriddenPropertyNames));
62703
63238
  }
62704
63239
  const scopedBinding = getScopedConfigBinding(identifier);
62705
63240
  if (scopedBinding.wasFound) return Boolean(scopedBinding.initializer && analyzeConfigNode(scopedBinding.initializer, analysis, allowCompilerTransform, isCompilerTransformCollection, overriddenPropertyNames));
62706
63241
  const importBinding = getImportBinding(analysis.sourceFile, identifier.text);
62707
63242
  if (importBinding) {
62708
63243
  if (allowCompilerTransform && isCompilerTransformModule(importBinding.moduleSpecifier, importBinding.exportName)) return true;
62709
- if (!importBinding.moduleSpecifier.startsWith(".")) return false;
62710
- const importedFilePath = resolveImportedConfigFile(analysis.filePath, importBinding.moduleSpecifier);
62711
- return Boolean(importedFilePath && analyzeConfigModuleExport(importedFilePath, importBinding.exportName, allowCompilerTransform, analysis.importDepth + 1, analysis.visitedModules));
63244
+ return Boolean(analyzeImportedConfig({
63245
+ analysis,
63246
+ moduleSpecifier: importBinding.moduleSpecifier,
63247
+ exportName: importBinding.exportName,
63248
+ allowCompilerTransform
63249
+ }));
62712
63250
  }
62713
63251
  const topLevelBinding = getTopLevelBinding(analysis.sourceFile, identifier.text);
62714
63252
  return Boolean(topLevelBinding && analyzeConfigNode(topLevelBinding, analysis, allowCompilerTransform, isCompilerTransformCollection, overriddenPropertyNames));
62715
63253
  };
62716
63254
  const analyzeConfigCallTarget = (callExpression, analysis, allowCompilerTransform) => {
62717
63255
  const target = callExpression.expression;
63256
+ const callableRequiredModuleSpecifier = getRequireModuleSpecifier$1(target);
63257
+ if (callableRequiredModuleSpecifier !== null) {
63258
+ if (ts.isCallExpression(target) && ts.isIdentifier(target.expression) && (analysis.localBindings.has(target.expression.text) || getScopedConfigBinding(target.expression).wasFound || hasTopLevelValueBinding(analysis.sourceFile, "require"))) return false;
63259
+ if (allowCompilerTransform && isCompilerTransformModule(callableRequiredModuleSpecifier, "default")) return true;
63260
+ const hasCompilerTransform = analyzeImportedConfig({
63261
+ analysis,
63262
+ moduleSpecifier: callableRequiredModuleSpecifier,
63263
+ exportName: "default",
63264
+ allowCompilerTransform,
63265
+ argumentsList: callExpression.arguments
63266
+ });
63267
+ if (isLocalModuleSpecifier(callableRequiredModuleSpecifier) || hasCompilerTransform !== null) return Boolean(hasCompilerTransform);
63268
+ return null;
63269
+ }
62718
63270
  if (!ts.isPropertyAccessExpression(target) && !ts.isElementAccessExpression(target)) return null;
62719
63271
  const propertyName = ts.isPropertyAccessExpression(target) ? target.name.text : target.argumentExpression && ts.isStringLiteralLike(target.argumentExpression) ? target.argumentExpression.text : null;
62720
63272
  if (propertyName === null) return null;
62721
63273
  const requiredModuleSpecifier = getRequireModuleSpecifier$1(target.expression);
62722
63274
  if (requiredModuleSpecifier !== null) {
62723
- if (ts.isCallExpression(target.expression) && ts.isIdentifier(target.expression.expression) && (getScopedConfigBinding(target.expression.expression).wasFound || hasTopLevelValueBinding(analysis.sourceFile, "require"))) return false;
62724
- if (!requiredModuleSpecifier.startsWith(".")) return null;
62725
- const importedFilePath = resolveImportedConfigFile(analysis.filePath, requiredModuleSpecifier);
62726
- return Boolean(importedFilePath && analyzeConfigModuleExport(importedFilePath, propertyName, allowCompilerTransform, analysis.importDepth + 1, analysis.visitedModules, callExpression.arguments));
63275
+ 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;
63276
+ if (allowCompilerTransform && isCompilerTransformModule(requiredModuleSpecifier, propertyName)) return true;
63277
+ const hasCompilerTransform = analyzeImportedConfig({
63278
+ analysis,
63279
+ moduleSpecifier: requiredModuleSpecifier,
63280
+ exportName: propertyName,
63281
+ allowCompilerTransform,
63282
+ argumentsList: callExpression.arguments
63283
+ });
63284
+ if (isLocalModuleSpecifier(requiredModuleSpecifier) || hasCompilerTransform !== null) return Boolean(hasCompilerTransform);
63285
+ return null;
62727
63286
  }
62728
63287
  if (!ts.isIdentifier(target.expression)) return null;
62729
- const importBinding = getImportBinding(analysis.sourceFile, target.expression.text);
62730
- if (importBinding?.isNamespace && importBinding.moduleSpecifier.startsWith(".")) {
62731
- const importedFilePath = resolveImportedConfigFile(analysis.filePath, importBinding.moduleSpecifier);
62732
- return Boolean(importedFilePath && analyzeConfigModuleExport(importedFilePath, propertyName, allowCompilerTransform, analysis.importDepth + 1, analysis.visitedModules, callExpression.arguments));
63288
+ const importBinding = analysis.localBindings.has(target.expression.text) || getScopedConfigBinding(target.expression).wasFound ? null : getImportBinding(analysis.sourceFile, target.expression.text);
63289
+ if (importBinding?.isNamespace) {
63290
+ if (allowCompilerTransform && isCompilerTransformModule(importBinding.moduleSpecifier, propertyName)) return true;
63291
+ const hasCompilerTransform = analyzeImportedConfig({
63292
+ analysis,
63293
+ moduleSpecifier: importBinding.moduleSpecifier,
63294
+ exportName: propertyName,
63295
+ allowCompilerTransform,
63296
+ argumentsList: callExpression.arguments
63297
+ });
63298
+ if (isLocalModuleSpecifier(importBinding.moduleSpecifier) || hasCompilerTransform !== null) return Boolean(hasCompilerTransform);
63299
+ return null;
62733
63300
  }
62734
63301
  const selectedProperty = getSelectedObjectProperty(target.expression, propertyName, analysis);
62735
63302
  if (selectedProperty === null) return null;
62736
- return ts.isFunctionLike(selectedProperty) ? analyzeConfigFunction(selectedProperty, analysis, allowCompilerTransform, callExpression.arguments) : analyzeConfigNode(selectedProperty, analysis, allowCompilerTransform);
63303
+ return ts.isFunctionLike(selectedProperty.node) ? analyzeConfigFunction(selectedProperty.node, selectedProperty.analysis, allowCompilerTransform, callExpression.arguments, analysis) : analyzeConfigNode(selectedProperty.node, selectedProperty.analysis, allowCompilerTransform);
62737
63304
  };
62738
63305
  const analyzeConfigNode = (node, analysis, allowCompilerTransform, isCompilerTransformCollection = false, excludedPropertyNames) => {
62739
63306
  const excludedPropertiesVisitKey = excludedPropertyNames ? [...excludedPropertyNames].sort().join(",") : "";
@@ -62752,9 +63319,13 @@ const analyzeConfigNode = (node, analysis, allowCompilerTransform, isCompilerTra
62752
63319
  if (propertyName === "reactCompiler") continue;
62753
63320
  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;
62754
63321
  const propertyAllowsCompilerTransform = propertyName === "plugins" || propertyName === "presets";
62755
- if (propertyName === "extends" && ts.isStringLiteralLike(property.initializer) && property.initializer.text.startsWith(".")) {
62756
- const extendedFilePath = resolveImportedConfigFile(analysis.filePath, property.initializer.text);
62757
- if (extendedFilePath && analyzeConfigModuleExport(extendedFilePath, "default", false, analysis.importDepth + 1, analysis.visitedModules)) return true;
63322
+ if (propertyName === "extends" && ts.isStringLiteralLike(property.initializer)) {
63323
+ if (analyzeImportedConfig({
63324
+ analysis,
63325
+ moduleSpecifier: property.initializer.text,
63326
+ exportName: "default",
63327
+ allowCompilerTransform: false
63328
+ })) return true;
62758
63329
  }
62759
63330
  if (analyzeConfigNode(property.initializer, analysis, propertyAllowsCompilerTransform, propertyAllowsCompilerTransform)) return true;
62760
63331
  } else if (ts.isShorthandPropertyAssignment(property)) {
@@ -62778,6 +63349,8 @@ const analyzeConfigNode = (node, analysis, allowCompilerTransform, isCompilerTra
62778
63349
  });
62779
63350
  }
62780
63351
  if (ts.isCallExpression(node)) {
63352
+ const resolvedModuleSpecifier = getNodeRequireResolveModuleSpecifier(node, analysis);
63353
+ if (resolvedModuleSpecifier !== null) return allowCompilerTransform && isCompilerTransformModule(resolvedModuleSpecifier, "default");
62781
63354
  const callTargetResult = analyzeConfigCallTarget(node, analysis, allowCompilerTransform);
62782
63355
  if (callTargetResult !== null) return callTargetResult;
62783
63356
  const directModuleSpecifier = getRequireModuleSpecifier$1(node);
@@ -62785,16 +63358,27 @@ const analyzeConfigNode = (node, analysis, allowCompilerTransform, isCompilerTra
62785
63358
  if (directModuleSpecifier && isRequireShadowed) return analyzeConfigNode(node.expression, analysis, allowCompilerTransform);
62786
63359
  if (directModuleSpecifier && !isRequireShadowed) {
62787
63360
  if (allowCompilerTransform && isCompilerTransformModule(directModuleSpecifier, "default")) return true;
62788
- if (directModuleSpecifier.startsWith(".")) {
62789
- const importedFilePath = resolveImportedConfigFile(analysis.filePath, directModuleSpecifier);
62790
- if (importedFilePath && analyzeConfigModuleExport(importedFilePath, "default", allowCompilerTransform, analysis.importDepth + 1, analysis.visitedModules)) return true;
62791
- }
63361
+ if (analyzeImportedConfig({
63362
+ analysis,
63363
+ moduleSpecifier: directModuleSpecifier,
63364
+ exportName: "default",
63365
+ allowCompilerTransform
63366
+ })) return true;
62792
63367
  }
62793
63368
  if (ts.isIdentifier(node.expression)) {
62794
- const importBinding = getImportBinding(analysis.sourceFile, node.expression.text);
62795
- if (importBinding?.moduleSpecifier.startsWith(".")) {
62796
- const importedFilePath = resolveImportedConfigFile(analysis.filePath, importBinding.moduleSpecifier);
62797
- return Boolean(importedFilePath && analyzeConfigModuleExport(importedFilePath, importBinding.exportName, allowCompilerTransform, analysis.importDepth + 1, analysis.visitedModules, node.arguments));
63369
+ if (!analysis.localBindings.has(node.expression.text) && !getScopedConfigBinding(node.expression).wasFound) {
63370
+ const importBinding = getImportBinding(analysis.sourceFile, node.expression.text);
63371
+ if (importBinding) {
63372
+ if (allowCompilerTransform && isCompilerTransformModule(importBinding.moduleSpecifier, importBinding.exportName)) return true;
63373
+ const hasCompilerTransform = analyzeImportedConfig({
63374
+ analysis,
63375
+ moduleSpecifier: importBinding.moduleSpecifier,
63376
+ exportName: importBinding.exportName,
63377
+ allowCompilerTransform,
63378
+ argumentsList: node.arguments
63379
+ });
63380
+ if (isLocalModuleSpecifier(importBinding.moduleSpecifier) || hasCompilerTransform !== null) return Boolean(hasCompilerTransform);
63381
+ }
62798
63382
  }
62799
63383
  const topLevelBinding = getTopLevelBinding(analysis.sourceFile, node.expression.text);
62800
63384
  if (topLevelBinding && ts.isFunctionLike(topLevelBinding) && analyzeConfigFunction(topLevelBinding, analysis, allowCompilerTransform, node.arguments)) return true;
@@ -62804,45 +63388,55 @@ const analyzeConfigNode = (node, analysis, allowCompilerTransform, isCompilerTra
62804
63388
  if (ts.isPropertyAccessExpression(node)) {
62805
63389
  const requiredModuleSpecifier = getRequireModuleSpecifier$1(node.expression);
62806
63390
  if (requiredModuleSpecifier) {
62807
- if (ts.isCallExpression(node.expression) && ts.isIdentifier(node.expression.expression) && (getScopedConfigBinding(node.expression.expression).wasFound || hasTopLevelValueBinding(analysis.sourceFile, "require"))) return false;
62808
- if (requiredModuleSpecifier.startsWith(".")) {
62809
- const importedFilePath = resolveImportedConfigFile(analysis.filePath, requiredModuleSpecifier);
62810
- return Boolean(importedFilePath && analyzeConfigModuleExport(importedFilePath, node.name.text, allowCompilerTransform, analysis.importDepth + 1, analysis.visitedModules));
62811
- }
63391
+ 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;
63392
+ if (analyzeImportedConfig({
63393
+ analysis,
63394
+ moduleSpecifier: requiredModuleSpecifier,
63395
+ exportName: node.name.text,
63396
+ allowCompilerTransform
63397
+ })) return true;
62812
63398
  return allowCompilerTransform && isCompilerTransformModule(requiredModuleSpecifier, node.name.text);
62813
63399
  }
62814
63400
  if (ts.isIdentifier(node.expression)) {
62815
- if (analysis.localBindings.has(node.expression.text)) {
62816
- const localInitializer = analysis.localBindings.get(node.expression.text);
62817
- return Boolean(localInitializer && analyzeConfigNode(localInitializer, analysis, allowCompilerTransform));
63401
+ if (analysis.localBindings.has(node.expression.text) || getScopedConfigBinding(node.expression).wasFound) {
63402
+ const selectedProperty = getSelectedObjectProperty(node.expression, node.name.text, analysis);
63403
+ return Boolean(selectedProperty && analyzeConfigNode(selectedProperty.node, selectedProperty.analysis, allowCompilerTransform));
62818
63404
  }
62819
63405
  const importBinding = getImportBinding(analysis.sourceFile, node.expression.text);
62820
63406
  if (importBinding?.isNamespace) {
62821
63407
  if (allowCompilerTransform && isCompilerTransformModule(importBinding.moduleSpecifier, node.name.text)) return true;
62822
- if (importBinding.moduleSpecifier.startsWith(".")) {
62823
- const importedFilePath = resolveImportedConfigFile(analysis.filePath, importBinding.moduleSpecifier);
62824
- if (importedFilePath && analyzeConfigModuleExport(importedFilePath, node.name.text, allowCompilerTransform, analysis.importDepth + 1, analysis.visitedModules)) return true;
62825
- }
63408
+ if (analyzeImportedConfig({
63409
+ analysis,
63410
+ moduleSpecifier: importBinding.moduleSpecifier,
63411
+ exportName: node.name.text,
63412
+ allowCompilerTransform
63413
+ })) return true;
62826
63414
  return false;
62827
63415
  }
62828
63416
  const selectedProperty = getSelectedObjectProperty(node.expression, node.name.text, analysis);
62829
- if (selectedProperty) return analyzeConfigNode(selectedProperty, analysis, allowCompilerTransform);
63417
+ if (selectedProperty) return analyzeConfigNode(selectedProperty.node, selectedProperty.analysis, allowCompilerTransform);
62830
63418
  return false;
62831
63419
  }
62832
63420
  return analyzeConfigNode(node.expression, analysis, allowCompilerTransform);
62833
63421
  }
62834
63422
  if (ts.isElementAccessExpression(node) && node.argumentExpression && ts.isStringLiteralLike(node.argumentExpression)) {
62835
63423
  if (ts.isIdentifier(node.expression)) {
63424
+ if (analysis.localBindings.has(node.expression.text) || getScopedConfigBinding(node.expression).wasFound) {
63425
+ const selectedProperty = getSelectedObjectProperty(node.expression, node.argumentExpression.text, analysis);
63426
+ return Boolean(selectedProperty && analyzeConfigNode(selectedProperty.node, selectedProperty.analysis, allowCompilerTransform));
63427
+ }
62836
63428
  const importBinding = getImportBinding(analysis.sourceFile, node.expression.text);
62837
63429
  if (importBinding?.isNamespace) {
62838
63430
  if (allowCompilerTransform && isCompilerTransformModule(importBinding.moduleSpecifier, node.argumentExpression.text)) return true;
62839
- if (importBinding.moduleSpecifier.startsWith(".")) {
62840
- const importedFilePath = resolveImportedConfigFile(analysis.filePath, importBinding.moduleSpecifier);
62841
- return Boolean(importedFilePath && analyzeConfigModuleExport(importedFilePath, node.argumentExpression.text, allowCompilerTransform, analysis.importDepth + 1, analysis.visitedModules));
62842
- }
63431
+ return Boolean(analyzeImportedConfig({
63432
+ analysis,
63433
+ moduleSpecifier: importBinding.moduleSpecifier,
63434
+ exportName: node.argumentExpression.text,
63435
+ allowCompilerTransform
63436
+ }));
62843
63437
  }
62844
63438
  const selectedProperty = getSelectedObjectProperty(node.expression, node.argumentExpression.text, analysis);
62845
- if (selectedProperty) return analyzeConfigNode(selectedProperty, analysis, allowCompilerTransform);
63439
+ if (selectedProperty) return analyzeConfigNode(selectedProperty.node, selectedProperty.analysis, allowCompilerTransform);
62846
63440
  return false;
62847
63441
  }
62848
63442
  return analyzeConfigNode(node.expression, analysis, allowCompilerTransform);
@@ -62877,14 +63471,19 @@ const analyzeConfigNode = (node, analysis, allowCompilerTransform, isCompilerTra
62877
63471
  };
62878
63472
  const hasCompilerInConfigFile = (filePath) => analyzeConfigModuleExport(filePath, "default", false, 0, /* @__PURE__ */ new Set());
62879
63473
  const hasCompilerInConfigFiles = (directory, filenames) => filenames.some((filename) => hasCompilerInConfigFile(Path.join(directory, filename)));
62880
- const hasCompilerInPackageJsonConfig = (packageJson) => isPlainObject(packageJson.babel) && analyzeConfigSourceFileExport(ts.parseJsonText("package.json", JSON.stringify(packageJson.babel)), "package.json#babel", "default", false, 0, /* @__PURE__ */ new Set());
62881
- const hasCompilerConfiguration = (directory, packageJson) => hasCompilerInPackageJsonConfig(packageJson) || hasCompilerInConfigFiles(directory, REACT_COMPILER_CONFIG_FILENAMES);
63474
+ const hasCompilerInPackageJsonConfig = (directory, packageJson) => {
63475
+ if (!isPlainObject(packageJson.babel)) return false;
63476
+ const packageJsonPath = Path.join(directory, "package.json");
63477
+ return analyzeConfigSourceFileExport(ts.parseJsonText(packageJsonPath, JSON.stringify(packageJson.babel)), packageJsonPath, "default", false, 0, /* @__PURE__ */ new Set());
63478
+ };
63479
+ const hasCompilerConfiguration = (directory, packageJson) => hasCompilerInPackageJsonConfig(directory, packageJson) || hasCompilerInConfigFiles(directory, REACT_COMPILER_CONFIG_FILENAMES);
62882
63480
  const hasCompilerConfigurationInAncestors = (directory) => {
62883
63481
  if (isProjectBoundary(directory)) return false;
62884
63482
  let ancestorDirectory = Path.dirname(directory);
62885
63483
  while (ancestorDirectory !== Path.dirname(ancestorDirectory)) {
62886
63484
  const ancestorPackagePath = Path.join(ancestorDirectory, "package.json");
62887
- if (hasCompilerInPackageJsonConfig(isFile(ancestorPackagePath) ? readPackageJson(ancestorPackagePath) : {}) || hasCompilerInConfigFiles(ancestorDirectory, BABEL_CONFIG_FILENAMES)) return true;
63485
+ const ancestorPackageJson = isFile(ancestorPackagePath) ? readPackageJson(ancestorPackagePath) : {};
63486
+ if (hasCompilerInPackageJsonConfig(ancestorDirectory, ancestorPackageJson) || hasCompilerInConfigFiles(ancestorDirectory, BABEL_CONFIG_FILENAMES)) return true;
62888
63487
  if (isProjectBoundary(ancestorDirectory)) return false;
62889
63488
  ancestorDirectory = Path.dirname(ancestorDirectory);
62890
63489
  }
@@ -65214,6 +65813,7 @@ const classifyPackageRole = (filename) => {
65214
65813
  * Resolves the absolute path to read for a diagnostic's `filePath`,
65215
65814
  * accounting for the various shapes oxlint emits:
65216
65815
  *
65816
+ * - `file://` URL — decode to an absolute filesystem path.
65217
65817
  * - Absolute POSIX (`/abs/path/file.tsx`) — pass through.
65218
65818
  * - Absolute Windows (`C:/...` or `C:\...`) — pass through.
65219
65819
  * - `./relative` or bare relative — join against `rootDirectory`.
@@ -65223,6 +65823,7 @@ const classifyPackageRole = (filename) => {
65223
65823
  * use one canonical resolution path.
65224
65824
  */
65225
65825
  const resolveCandidateReadPath = (rootDirectory, filePath) => {
65826
+ if (filePath.startsWith("file://")) return fileURLToPath(filePath);
65226
65827
  const normalizedFile = filePath.replace(/\\/g, "/");
65227
65828
  if (normalizedFile.startsWith("/") || /^[a-zA-Z]:\//.test(normalizedFile) || /^[a-zA-Z]:\\/.test(filePath)) return filePath;
65228
65829
  return `${rootDirectory.replace(/\\/g, "/").replace(/\/$/, "")}/${normalizedFile.replace(/^\.\//, "")}`;
@@ -67142,11 +67743,6 @@ const getTypescriptScriptKind = (fileName) => {
67142
67743
  if (fileName.endsWith(".ts")) return ts.ScriptKind.TS;
67143
67744
  return ts.ScriptKind.JS;
67144
67745
  };
67145
- const unwrapTypescriptExpression = (expression) => {
67146
- let currentExpression = expression;
67147
- while (ts.isParenthesizedExpression(currentExpression) || ts.isAsExpression(currentExpression) || ts.isSatisfiesExpression(currentExpression) || ts.isNonNullExpression(currentExpression) || ts.isTypeAssertionExpression(currentExpression)) currentExpression = currentExpression.expression;
67148
- return currentExpression;
67149
- };
67150
67746
  const BABEL_CONFIG_FILE_NAMES$1 = [
67151
67747
  "babel.config.js",
67152
67748
  "babel.config.cjs",
@@ -69492,7 +70088,10 @@ var Git = class Git extends Service()("react-doctor/Git") {
69492
70088
  if (argvLengthChars > spawnArgsLengthCap) return yield* foldSpawnFailure(`spawn ENAMETOOLONG (${argvLengthChars} argv chars exceed ${spawnArgsLengthCap})`);
69493
70089
  const handle = yield* spawner.spawn(make$1(input.command, [...input.args], {
69494
70090
  cwd: input.directory,
69495
- env: input.env,
70091
+ env: input.command === "git" ? {
70092
+ ...input.env,
70093
+ GIT_DIR: void 0
70094
+ } : input.env,
69496
70095
  extendEnv: true
69497
70096
  }));
69498
70097
  const maxStdoutBytes = input.maxStdoutBytes;
@@ -69765,7 +70364,7 @@ var Git = class Git extends Service()("react-doctor/Git") {
69765
70364
  "--diff-filter=ACMR",
69766
70365
  "--relative"
69767
70366
  ]).pipe(map$3((result) => {
69768
- if (result.status !== 0) return [];
70367
+ if (result.status !== 0) return null;
69769
70368
  return splitNullSeparated(result.stdout);
69770
70369
  })),
69771
70370
  showStagedContent: (directory, relativePath, options) => runCommand({
@@ -70853,6 +71452,50 @@ const columnOfUtf8Offset = (sourceBuffer, utf8Offset) => {
70853
71452
  while (lineStartOffset > 0 && sourceBuffer[lineStartOffset - 1] !== 10) lineStartOffset--;
70854
71453
  return sourceBuffer.subarray(lineStartOffset, boundedOffset).toString("utf8").length + 1;
70855
71454
  };
71455
+ const utf8OffsetFromSourcePosition = (sourceBuffer, lineNumber, zeroBasedColumn) => {
71456
+ if (lineNumber < 1 || zeroBasedColumn < 0) return null;
71457
+ const sourceLines = sourceBuffer.toString("utf8").split("\n");
71458
+ const sourceLine = sourceLines[lineNumber - 1];
71459
+ if (sourceLine === void 0 || zeroBasedColumn > sourceLine.length) return null;
71460
+ const precedingLines = sourceLines.slice(0, lineNumber - 1).join("\n");
71461
+ return (lineNumber === 1 ? 0 : Buffer.byteLength(precedingLines) + Buffer.byteLength("\n")) + Buffer.byteLength(sourceLine.slice(0, zeroBasedColumn));
71462
+ };
71463
+ const mapPreparedSourceSpan = (span, preparedSourceMap) => {
71464
+ const generatedLine = lineOfUtf8Offset(preparedSourceMap.generatedBuffer, span.offset);
71465
+ const generatedColumn = columnOfUtf8Offset(preparedSourceMap.generatedBuffer, span.offset) - 1;
71466
+ const originalStart = originalPositionFor(preparedSourceMap.traceMap, {
71467
+ line: generatedLine,
71468
+ column: generatedColumn
71469
+ });
71470
+ if (originalStart.source === null || originalStart.line === null || originalStart.column === null) return null;
71471
+ const originalOffset = utf8OffsetFromSourcePosition(preparedSourceMap.sourceBuffer, originalStart.line, originalStart.column);
71472
+ if (originalOffset === null) return null;
71473
+ const generatedSpan = preparedSourceMap.generatedBuffer.subarray(span.offset, span.offset + span.length);
71474
+ return {
71475
+ offset: originalOffset,
71476
+ length: preparedSourceMap.sourceBuffer.subarray(originalOffset, originalOffset + generatedSpan.length).equals(generatedSpan) ? generatedSpan.length : 0,
71477
+ line: originalStart.line,
71478
+ column: originalStart.column + 1
71479
+ };
71480
+ };
71481
+ const mapPreparedSourceLabels = (labels, preparedSourceMap) => {
71482
+ const primaryLabel = labels[0];
71483
+ if (primaryLabel === void 0) return null;
71484
+ const primarySpan = mapPreparedSourceSpan(primaryLabel.span, preparedSourceMap);
71485
+ if (primarySpan === null) return null;
71486
+ const mappedLabels = [{
71487
+ ...primaryLabel,
71488
+ span: primarySpan
71489
+ }];
71490
+ for (const relatedLabel of labels.slice(1)) {
71491
+ const relatedSpan = mapPreparedSourceSpan(relatedLabel.span, preparedSourceMap);
71492
+ if (relatedSpan !== null) mappedLabels.push({
71493
+ ...relatedLabel,
71494
+ span: relatedSpan
71495
+ });
71496
+ }
71497
+ return mappedLabels;
71498
+ };
70856
71499
  const REDACTED_PLACEHOLDER = "<redacted>";
70857
71500
  const KEEP_PREFIX = `$1${REDACTED_PLACEHOLDER}`;
70858
71501
  const KNOWN_SECRET_RULES = [
@@ -71597,7 +72240,7 @@ const isOxlintOutput = (value) => isRecord(value) && Array.isArray(value.diagnos
71597
72240
  * to the first `{`. Raises `OxlintOutputUnparseable` when the
71598
72241
  * stdout isn't valid JSON or doesn't carry a `diagnostics` array.
71599
72242
  */
71600
- const parseOxlintOutput = (stdout, project, rootDirectory, sourcePathByLintPath) => {
72243
+ const parseOxlintOutput = (stdout, project, rootDirectory, sourcePathByLintPath, sourceMapByLintPath) => {
71601
72244
  if (!stdout) return [];
71602
72245
  const jsonStart = stdout.indexOf("{");
71603
72246
  const sanitizedStdout = jsonStart > 0 ? stdout.slice(jsonStart) : stdout;
@@ -71615,6 +72258,7 @@ const parseOxlintOutput = (stdout, project, rootDirectory, sourcePathByLintPath)
71615
72258
  const sourceLinesCache = /* @__PURE__ */ new Map();
71616
72259
  const resolveAbsolutePath = (filename) => Path.isAbsolute(filename) ? filename : Path.resolve(rootDirectory || ".", filename);
71617
72260
  const resolveMappedSourceFilename = (filename) => sourcePathByLintPath?.get(Path.normalize(resolveAbsolutePath(filename)));
72261
+ const resolvePreparedSourceMap = (filename) => sourceMapByLintPath?.get(Path.normalize(resolveAbsolutePath(filename)));
71618
72262
  const resolveSourceFilename = (filename) => resolveMappedSourceFilename(filename) ?? filename;
71619
72263
  const readSourceBuffer = (filename) => {
71620
72264
  const absolutePath = resolveAbsolutePath(resolveSourceFilename(filename));
@@ -71646,7 +72290,19 @@ const parseOxlintOutput = (stdout, project, rootDirectory, sourcePathByLintPath)
71646
72290
  minifiedFileCache.set(absolutePath, minified);
71647
72291
  return minified;
71648
72292
  };
71649
- 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) => {
72293
+ return suppressMemoizationInBailedOutFunctions(parsed.diagnostics.flatMap((diagnostic) => {
72294
+ const preparedSourceMap = resolvePreparedSourceMap(diagnostic.filename);
72295
+ if (preparedSourceMap === void 0) return [diagnostic];
72296
+ const { plugin, rule } = parseRuleCode(diagnostic.code);
72297
+ if (plugin !== "react-doctor" || !reactDoctorPlugin.rules[rule]?.tags?.includes("design")) return [];
72298
+ const labels = mapPreparedSourceLabels(diagnostic.labels, preparedSourceMap);
72299
+ const sourceFilename = resolveMappedSourceFilename(diagnostic.filename);
72300
+ return labels === null || sourceFilename === void 0 ? [] : [{
72301
+ ...diagnostic,
72302
+ filename: sourceFilename,
72303
+ labels
72304
+ }];
72305
+ }).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) => {
71650
72306
  const { plugin, rule } = parseRuleCode(diagnostic.code);
71651
72307
  const primaryLabel = diagnostic.labels[0];
71652
72308
  const cleaned = cleanDiagnosticMessage(diagnostic.message, diagnostic.help, plugin, rule, project);
@@ -71864,7 +72520,7 @@ const isParallelismRelatedSpawnError = (error) => {
71864
72520
  * loop with a slimmer config in that case.
71865
72521
  */
71866
72522
  const spawnLintBatches = async (input) => {
71867
- const { baseArgs, fileBatches, rootDirectory, nodeBinaryPath, project, sourcePathByLintPath, onPartialFailure, onFileProgress, spawnTimeoutMs, outputMaxBytes, splitTotalBudgetMs = OXLINT_SPLIT_TOTAL_BUDGET_MS, splitMaxDepth = 8, signal, deadlineEpochMs } = input;
72523
+ const { baseArgs, fileBatches, rootDirectory, nodeBinaryPath, project, sourcePathByLintPath, sourceMapByLintPath, onPartialFailure, onFileProgress, spawnTimeoutMs, outputMaxBytes, splitTotalBudgetMs = OXLINT_SPLIT_TOTAL_BUDGET_MS, splitMaxDepth = 8, signal, deadlineEpochMs } = input;
71868
72524
  const resolveSourcePath = (filePath) => {
71869
72525
  const absoluteFilePath = Path.isAbsolute(filePath) ? filePath : Path.resolve(rootDirectory, filePath);
71870
72526
  return sourcePathByLintPath?.get(Path.normalize(absoluteFilePath)) ?? filePath;
@@ -71888,7 +72544,7 @@ const spawnLintBatches = async (input) => {
71888
72544
  }
71889
72545
  const batchArgs = [...baseArgs, ...batch];
71890
72546
  try {
71891
- return parseOxlintOutput(await spawnOxlint(batchArgs, rootDirectory, nodeBinaryPath, spawnTimeoutMs, outputMaxBytes, signal), project, rootDirectory, sourcePathByLintPath);
72547
+ return parseOxlintOutput(await spawnOxlint(batchArgs, rootDirectory, nodeBinaryPath, spawnTimeoutMs, outputMaxBytes, signal), project, rootDirectory, sourcePathByLintPath, sourceMapByLintPath);
71892
72548
  } catch (error) {
71893
72549
  if (!isSplittableReactDoctorError(error)) throw error;
71894
72550
  if (isPastDeadline()) {
@@ -72327,20 +72983,47 @@ const prepareHtmlScriptSource = (sourceBuffer) => {
72327
72983
  lintBuffer: maskedBuffer ?? sourceBuffer
72328
72984
  };
72329
72985
  };
72330
- const prepareHtmlLintSources = (rootDirectory, temporaryDirectory, candidateFiles) => {
72986
+ const ASTRO_FILE_PATTERN = /\.astro$/;
72987
+ const prepareLintSources = (rootDirectory, temporaryDirectory, candidateFiles) => {
72331
72988
  const lintFiles = [];
72332
72989
  const sourcePathByLintPath = /* @__PURE__ */ new Map();
72990
+ const sourceMapByLintPath = /* @__PURE__ */ new Map();
72333
72991
  const sizeByLintPath = /* @__PURE__ */ new Map();
72334
72992
  const htmlSourcesDirectory = Path.join(temporaryDirectory, "html-sources");
72993
+ const astroSourcesDirectory = Path.join(temporaryDirectory, "astro-sources");
72335
72994
  let htmlFileIndex = 0;
72995
+ let astroFileIndex = 0;
72336
72996
  let hasThreeModuleImport = false;
72337
72997
  for (const candidateFile of candidateFiles) {
72338
- if (!HTML_FILE_PATTERN.test(candidateFile)) {
72998
+ if (!HTML_FILE_PATTERN.test(candidateFile) && !ASTRO_FILE_PATTERN.test(candidateFile)) {
72339
72999
  lintFiles.push(candidateFile);
72340
73000
  continue;
72341
73001
  }
72342
73002
  const absoluteSourcePath = Path.isAbsolute(candidateFile) ? candidateFile : Path.resolve(rootDirectory, candidateFile);
72343
73003
  const sourceBuffer = NFS.readFileSync(absoluteSourcePath);
73004
+ if (ASTRO_FILE_PATTERN.test(candidateFile)) {
73005
+ const compilerSourcePath = absoluteSourcePath.replaceAll("\\", "/");
73006
+ const convertedSource = convertToTSX(sourceBuffer.toString("utf8"), {
73007
+ filename: compilerSourcePath,
73008
+ sourcemap: "external",
73009
+ includeScripts: true
73010
+ });
73011
+ if (astroFileIndex === 0) NFS.mkdirSync(astroSourcesDirectory, { recursive: true });
73012
+ const lintPath = Path.join(astroSourcesDirectory, `${astroFileIndex}.tsx`);
73013
+ const generatedBuffer = Buffer.from(convertedSource.code);
73014
+ NFS.writeFileSync(lintPath, generatedBuffer);
73015
+ lintFiles.push(candidateFile);
73016
+ lintFiles.push(lintPath);
73017
+ sourcePathByLintPath.set(Path.resolve(lintPath), candidateFile);
73018
+ sourceMapByLintPath.set(Path.resolve(lintPath), {
73019
+ traceMap: new TraceMap(JSON.stringify(convertedSource.map)),
73020
+ generatedBuffer,
73021
+ sourceBuffer
73022
+ });
73023
+ sizeByLintPath.set(lintPath, sourceBuffer.length);
73024
+ astroFileIndex++;
73025
+ continue;
73026
+ }
72344
73027
  const { executableScriptBodies, lintBuffer } = prepareHtmlScriptSource(sourceBuffer);
72345
73028
  if (htmlFileIndex === 0) NFS.mkdirSync(htmlSourcesDirectory, { recursive: true });
72346
73029
  const lintPath = Path.join(htmlSourcesDirectory, `${htmlFileIndex}.astro`);
@@ -72354,6 +73037,7 @@ const prepareHtmlLintSources = (rootDirectory, temporaryDirectory, candidateFile
72354
73037
  return {
72355
73038
  lintFiles,
72356
73039
  sourcePathByLintPath,
73040
+ sourceMapByLintPath,
72357
73041
  sizeByLintPath,
72358
73042
  hasThreeModuleImport
72359
73043
  };
@@ -72572,10 +73256,10 @@ const runOxlint = async (options) => {
72572
73256
  rootDirectory,
72573
73257
  candidateFiles
72574
73258
  });
72575
- const preparedHtmlSources = prepareHtmlLintSources(rootDirectory, configDirectory, candidateFiles);
72576
- const lintFiles = preparedHtmlSources.lintFiles;
72577
- const hasHtmlFiles = preparedHtmlSources.sourcePathByLintPath.size > 0;
72578
- const lintProject = !project.hasThree && preparedHtmlSources.hasThreeModuleImport ? {
73259
+ const preparedLintSources = prepareLintSources(rootDirectory, configDirectory, candidateFiles);
73260
+ const lintFiles = preparedLintSources.lintFiles;
73261
+ const hasPreparedFiles = preparedLintSources.sourcePathByLintPath.size > 0;
73262
+ const lintProject = !project.hasThree && preparedLintSources.hasThreeModuleImport ? {
72579
73263
  ...project,
72580
73264
  hasThree: true
72581
73265
  } : project;
@@ -72597,7 +73281,7 @@ const runOxlint = async (options) => {
72597
73281
  sidecarRuleIdFilter: overrides.sidecarRuleIdFilter
72598
73282
  });
72599
73283
  const sizeByFile = sizedScanFiles !== null && lintBatchOrdering === "cost" ? new Map(sizedScanFiles.map((entry) => [entry.path, entry.sizeBytes])) : null;
72600
- if (sizeByFile !== null) for (const [lintPath, sizeBytes] of preparedHtmlSources.sizeByLintPath) sizeByFile.set(lintPath, sizeBytes);
73284
+ if (sizeByFile !== null) for (const [lintPath, sizeBytes] of preparedLintSources.sizeByLintPath) sizeByFile.set(lintPath, sizeBytes);
72601
73285
  const buildFileBatches = (passBaseArgs, passFiles) => sizeByFile !== null ? planLintBatches({
72602
73286
  baseArgs: passBaseArgs,
72603
73287
  files: passFiles,
@@ -72627,7 +73311,8 @@ const runOxlint = async (options) => {
72627
73311
  rootDirectory,
72628
73312
  nodeBinaryPath,
72629
73313
  project: lintProject,
72630
- sourcePathByLintPath: preparedHtmlSources.sourcePathByLintPath,
73314
+ sourcePathByLintPath: preparedLintSources.sourcePathByLintPath,
73315
+ sourceMapByLintPath: preparedLintSources.sourceMapByLintPath,
72631
73316
  onPartialFailure: reportPartialFailure,
72632
73317
  onAnalyzedFiles: (filePaths) => {
72633
73318
  analyzedFiles = filePaths;
@@ -72662,7 +73347,7 @@ const runOxlint = async (options) => {
72662
73347
  };
72663
73348
  }
72664
73349
  };
72665
- if (perFileLintCacheEnabled && !project.hasReactCompiler && project.hasReactCompilerLintPlugin !== true && extendsPaths.length === 0 && userPlugins.length === 0 && !hasHtmlFiles) {
73350
+ if (perFileLintCacheEnabled && !project.hasReactCompiler && project.hasReactCompilerLintPlugin !== true && extendsPaths.length === 0 && userPlugins.length === 0 && !hasPreparedFiles) {
72666
73351
  const rulesetHash = computeRulesetHash({
72667
73352
  config: buildConfig({
72668
73353
  extendsPaths: [],
@@ -72828,7 +73513,8 @@ const runOxlint = async (options) => {
72828
73513
  rootDirectory,
72829
73514
  nodeBinaryPath,
72830
73515
  project: lintProject,
72831
- sourcePathByLintPath: preparedHtmlSources.sourcePathByLintPath,
73516
+ sourcePathByLintPath: preparedLintSources.sourcePathByLintPath,
73517
+ sourceMapByLintPath: preparedLintSources.sourceMapByLintPath,
72832
73518
  onPartialFailure,
72833
73519
  onAnalyzedFiles: (filePaths) => {
72834
73520
  analyzedFiles = filePaths;
@@ -74177,10 +74863,14 @@ const materializeSourceTree = (input) => gen(function* () {
74177
74863
  materializedFiles.push(relativePath);
74178
74864
  }
74179
74865
  yield* sync(() => {
74180
- for (const configFilename of STAGED_FILES_PROJECT_CONFIG_FILENAMES) {
74181
- const sourcePath = path.join(input.directory, configFilename);
74182
- const targetPath = path.join(resolvedTempDirectory, configFilename);
74183
- if (fs.existsSync(sourcePath) && !fs.existsSync(targetPath)) fs.cpSync(sourcePath, targetPath);
74866
+ for (const subdirectory of ["", ...input.configSubdirectories ?? []]) for (const configFilename of STAGED_FILES_PROJECT_CONFIG_FILENAMES) {
74867
+ const sourcePath = path.join(input.directory, subdirectory, configFilename);
74868
+ const targetPath = path.resolve(resolvedTempDirectory, subdirectory, configFilename);
74869
+ if (!isPathInsideDirectory(targetPath, resolvedTempDirectory)) continue;
74870
+ if (fs.existsSync(sourcePath) && !fs.existsSync(targetPath)) {
74871
+ fs.mkdirSync(path.dirname(targetPath), { recursive: true });
74872
+ fs.cpSync(sourcePath, targetPath);
74873
+ }
74184
74874
  }
74185
74875
  });
74186
74876
  return {
@@ -74201,15 +74891,17 @@ const materializeSourceTree = (input) => gen(function* () {
74201
74891
  static layerNode = effect(StagedFiles, gen(function* () {
74202
74892
  const git = yield* Git;
74203
74893
  return StagedFiles.of({
74204
- discoverSourceFiles: (directory) => git.stagedFilePaths(directory).pipe(map$3((entries) => entries.filter(isLintableSourceFile)), withSpan("StagedFiles.discoverSourceFiles")),
74205
- materialize: ({ directory, stagedFiles, tempDirectory }) => materializeSourceTree({
74894
+ discoverSourceFiles: (directory) => git.stagedFilePaths(directory).pipe(map$3((entries) => entries === null ? null : entries.filter(isLintableSourceFile)), withSpan("StagedFiles.discoverSourceFiles")),
74895
+ materialize: ({ directory, stagedFiles, tempDirectory, configSubdirectories }) => materializeSourceTree({
74206
74896
  directory,
74207
74897
  files: stagedFiles,
74208
74898
  tempDirectory,
74899
+ configSubdirectories,
74209
74900
  readContent: (relativePath) => git.showStagedContent(directory, relativePath, { maxBufferBytes: GIT_SHOW_MAX_BUFFER_BYTES })
74210
74901
  }).pipe(map$3((tree) => ({
74211
74902
  tempDirectory: tree.tempDirectory,
74212
74903
  stagedFiles: tree.materializedFiles,
74904
+ unmaterializedFiles: tree.unmaterializedFiles,
74213
74905
  cleanup: tree.cleanup
74214
74906
  })), withSpan("StagedFiles.materialize"))
74215
74907
  });
@@ -74224,6 +74916,7 @@ const materializeSourceTree = (input) => gen(function* () {
74224
74916
  materialize: ({ tempDirectory }) => succeed$2({
74225
74917
  tempDirectory,
74226
74918
  stagedFiles: snapshot.materializedFiles ?? snapshot.sourceFiles ?? [],
74919
+ unmaterializedFiles: [],
74227
74920
  cleanup: () => {}
74228
74921
  })
74229
74922
  }));
@@ -74750,4 +75443,4 @@ const toJsonReport = (result, options) => buildJsonReport({
74750
75443
  export { AmbiguousProjectError, NoReactDependencyError, NotADirectoryError, PackageJsonNotFoundError, ProjectNotFoundError, ReactDoctorError, buildJsonReport, buildJsonReportError, clearCaches, defineConfig, diagnose, filterSourceFiles, getDiffInfo, hasReactRuntime, isProjectDiscoveryError, isReactDoctorError, summarizeDiagnostics, toJsonReport };
74751
75444
 
74752
75445
  //# sourceMappingURL=index.js.map
74753
- //# debugId=e6d636d4-ff95-5229-92f8-47807b2a44c4
75446
+ //# debugId=18c61424-4926-5cae-8f2a-6001534ea755