react-doctor 0.9.2-dev.86add14 → 0.9.2-dev.b10cd4c

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]="cc06d86a-0b85-5115-a9f2-cc30c268ad79")}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";
@@ -20,6 +20,7 @@ import os from "node:os";
20
20
  import { parseJSON5 } from "confbox";
21
21
  import { createJiti } from "jiti";
22
22
  import { ANALYZED_MANIFEST_FILENAMES, DEFAULT_EXTENSIONS } from "deslop-js/analyzed-inputs";
23
+ import { convertToTSX } from "@astrojs/compiler/sync";
23
24
  import { gzipSync } from "node:zlib";
24
25
  //#region ../../node_modules/.pnpm/effect@4.0.0-beta.70/node_modules/effect/dist/Pipeable.js
25
26
  /**
@@ -10262,7 +10263,7 @@ const Number$4 = globalThis.Number;
10262
10263
  * @category constructors
10263
10264
  * @since 2.0.0
10264
10265
  */
10265
- const parse = (s) => {
10266
+ const parse$1 = (s) => {
10266
10267
  if (s === "NaN") return some(NaN);
10267
10268
  if (s === "Infinity") return some(Infinity);
10268
10269
  if (s === "-Infinity") return some(-Infinity);
@@ -14304,12 +14305,12 @@ TaggedError("EncodingError");
14304
14305
  //#endregion
14305
14306
  //#region ../../node_modules/.pnpm/effect@4.0.0-beta.70/node_modules/effect/dist/internal/schema/annotations.js
14306
14307
  /** @internal */
14307
- function resolve(ast) {
14308
+ function resolve$1(ast) {
14308
14309
  return ast.checks ? ast.checks[ast.checks.length - 1].annotations : ast.annotations;
14309
14310
  }
14310
14311
  /** @internal */
14311
14312
  function resolveAt(key) {
14312
- return (ast) => resolve(ast)?.[key];
14313
+ return (ast) => resolve$1(ast)?.[key];
14313
14314
  }
14314
14315
  /** @internal */
14315
14316
  const resolveIdentifier = /* @__PURE__ */ resolveAt("identifier");
@@ -18061,7 +18062,7 @@ function asSync(parser) {
18061
18062
  }
18062
18063
  const recur$1 = /* @__PURE__ */ memoize((ast) => {
18063
18064
  let parser;
18064
- const astOptions = resolve(ast)?.["parseOptions"];
18065
+ const astOptions = resolve$1(ast)?.["parseOptions"];
18065
18066
  if (!ast.context && !ast.encoding && !ast.checks) return (ou, options) => {
18066
18067
  parser ??= ast.getParser(recur$1);
18067
18068
  if (astOptions) options = {
@@ -57666,7 +57667,7 @@ var UrlParamsError = class extends TaggedError("UrlParamsError") {};
57666
57667
  * @category converting
57667
57668
  * @since 4.0.0
57668
57669
  */
57669
- const makeUrl = (url, params, hash) => {
57670
+ const makeUrl$1 = (url, params, hash) => {
57670
57671
  try {
57671
57672
  const urlInstance = new URL(url, baseUrl());
57672
57673
  for (let i = 0; i < params.params.length; i++) {
@@ -58300,7 +58301,7 @@ const Proto$2 = {
58300
58301
  const make$10 = (f) => makeWith$1((effect) => flatMap$2(effect, (request) => withFiber((fiber) => {
58301
58302
  const scopedController = scopedRequests.get(request);
58302
58303
  const controller = scopedController ?? new AbortController();
58303
- const urlResult = makeUrl(request.url, request.urlParams, getOrUndefined(request.hash));
58304
+ const urlResult = makeUrl$1(request.url, request.urlParams, getOrUndefined(request.hash));
58304
58305
  if (isFailure(urlResult)) return fail$4(new HttpClientError({ reason: new InvalidUrlError({
58305
58306
  request,
58306
58307
  cause: urlResult.failure
@@ -58739,7 +58740,7 @@ const layer$7 = (loggers, options) => effect(CurrentLoggers, withFiber$1(fnUntra
58739
58740
  * @since 4.0.0
58740
58741
  */
58741
58742
  const policy = /* @__PURE__ */ forever$1.pipe(passthrough$2, /* @__PURE__ */ addDelay((error) => {
58742
- if (isHttpClientError(error) && error.reason._tag === "StatusCodeError" && error.reason.response.status === 429) return succeed$2(seconds(fromUndefinedOr(error.reason.response.headers["retry-after"]).pipe(flatMap$5(parse), getOrElse$1(() => 5))));
58743
+ if (isHttpClientError(error) && error.reason._tag === "StatusCodeError" && error.reason.response.status === 429) return succeed$2(seconds(fromUndefinedOr(error.reason.response.headers["retry-after"]).pipe(flatMap$5(parse$1), getOrElse$1(() => 5))));
58743
58744
  return succeed$2(seconds(1));
58744
58745
  }));
58745
58746
  /**
@@ -61381,6 +61382,428 @@ const layer = /* @__PURE__ */ succeed$3(Path$1)({
61381
61382
  toFileUrl
61382
61383
  });
61383
61384
  //#endregion
61385
+ //#region ../../node_modules/.pnpm/@jridgewell+sourcemap-codec@1.5.5/node_modules/@jridgewell/sourcemap-codec/dist/sourcemap-codec.mjs
61386
+ var comma = ",".charCodeAt(0);
61387
+ ";".charCodeAt(0);
61388
+ var chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
61389
+ var intToChar = new Uint8Array(64);
61390
+ var charToInt = new Uint8Array(128);
61391
+ for (let i = 0; i < chars.length; i++) {
61392
+ const c = chars.charCodeAt(i);
61393
+ intToChar[i] = c;
61394
+ charToInt[c] = i;
61395
+ }
61396
+ function decodeInteger(reader, relative) {
61397
+ let value = 0;
61398
+ let shift = 0;
61399
+ let integer = 0;
61400
+ do {
61401
+ integer = charToInt[reader.next()];
61402
+ value |= (integer & 31) << shift;
61403
+ shift += 5;
61404
+ } while (integer & 32);
61405
+ const shouldNegate = value & 1;
61406
+ value >>>= 1;
61407
+ if (shouldNegate) value = -2147483648 | -value;
61408
+ return relative + value;
61409
+ }
61410
+ function hasMoreVlq(reader, max) {
61411
+ if (reader.pos >= max) return false;
61412
+ return reader.peek() !== comma;
61413
+ }
61414
+ var StringReader = class {
61415
+ constructor(buffer) {
61416
+ this.pos = 0;
61417
+ this.buffer = buffer;
61418
+ }
61419
+ next() {
61420
+ return this.buffer.charCodeAt(this.pos++);
61421
+ }
61422
+ peek() {
61423
+ return this.buffer.charCodeAt(this.pos);
61424
+ }
61425
+ indexOf(char) {
61426
+ const { buffer, pos } = this;
61427
+ const idx = buffer.indexOf(char, pos);
61428
+ return idx === -1 ? buffer.length : idx;
61429
+ }
61430
+ };
61431
+ function decode(mappings) {
61432
+ const { length } = mappings;
61433
+ const reader = new StringReader(mappings);
61434
+ const decoded = [];
61435
+ let genColumn = 0;
61436
+ let sourcesIndex = 0;
61437
+ let sourceLine = 0;
61438
+ let sourceColumn = 0;
61439
+ let namesIndex = 0;
61440
+ do {
61441
+ const semi = reader.indexOf(";");
61442
+ const line = [];
61443
+ let sorted = true;
61444
+ let lastCol = 0;
61445
+ genColumn = 0;
61446
+ while (reader.pos < semi) {
61447
+ let seg;
61448
+ genColumn = decodeInteger(reader, genColumn);
61449
+ if (genColumn < lastCol) sorted = false;
61450
+ lastCol = genColumn;
61451
+ if (hasMoreVlq(reader, semi)) {
61452
+ sourcesIndex = decodeInteger(reader, sourcesIndex);
61453
+ sourceLine = decodeInteger(reader, sourceLine);
61454
+ sourceColumn = decodeInteger(reader, sourceColumn);
61455
+ if (hasMoreVlq(reader, semi)) {
61456
+ namesIndex = decodeInteger(reader, namesIndex);
61457
+ seg = [
61458
+ genColumn,
61459
+ sourcesIndex,
61460
+ sourceLine,
61461
+ sourceColumn,
61462
+ namesIndex
61463
+ ];
61464
+ } else seg = [
61465
+ genColumn,
61466
+ sourcesIndex,
61467
+ sourceLine,
61468
+ sourceColumn
61469
+ ];
61470
+ } else seg = [genColumn];
61471
+ line.push(seg);
61472
+ reader.pos++;
61473
+ }
61474
+ if (!sorted) sort(line);
61475
+ decoded.push(line);
61476
+ reader.pos = semi + 1;
61477
+ } while (reader.pos <= length);
61478
+ return decoded;
61479
+ }
61480
+ function sort(line) {
61481
+ line.sort(sortComparator$1);
61482
+ }
61483
+ function sortComparator$1(a, b) {
61484
+ return a[0] - b[0];
61485
+ }
61486
+ //#endregion
61487
+ //#region ../../node_modules/.pnpm/@jridgewell+resolve-uri@3.1.2/node_modules/@jridgewell/resolve-uri/dist/resolve-uri.mjs
61488
+ const schemeRegex = /^[\w+.-]+:\/\//;
61489
+ /**
61490
+ * Matches the parts of a URL:
61491
+ * 1. Scheme, including ":", guaranteed.
61492
+ * 2. User/password, including "@", optional.
61493
+ * 3. Host, guaranteed.
61494
+ * 4. Port, including ":", optional.
61495
+ * 5. Path, including "/", optional.
61496
+ * 6. Query, including "?", optional.
61497
+ * 7. Hash, including "#", optional.
61498
+ */
61499
+ const urlRegex = /^([\w+.-]+:)\/\/([^@/#?]*@)?([^:/#?]*)(:\d+)?(\/[^#?]*)?(\?[^#]*)?(#.*)?/;
61500
+ /**
61501
+ * File URLs are weird. They dont' need the regular `//` in the scheme, they may or may not start
61502
+ * with a leading `/`, they can have a domain (but only if they don't start with a Windows drive).
61503
+ *
61504
+ * 1. Host, optional.
61505
+ * 2. Path, which may include "/", guaranteed.
61506
+ * 3. Query, including "?", optional.
61507
+ * 4. Hash, including "#", optional.
61508
+ */
61509
+ const fileRegex = /^file:(?:\/\/((?![a-z]:)[^/#?]*)?)?(\/?[^#?]*)(\?[^#]*)?(#.*)?/i;
61510
+ function isAbsoluteUrl(input) {
61511
+ return schemeRegex.test(input);
61512
+ }
61513
+ function isSchemeRelativeUrl(input) {
61514
+ return input.startsWith("//");
61515
+ }
61516
+ function isAbsolutePath(input) {
61517
+ return input.startsWith("/");
61518
+ }
61519
+ function isFileUrl(input) {
61520
+ return input.startsWith("file:");
61521
+ }
61522
+ function isRelative(input) {
61523
+ return /^[.?#]/.test(input);
61524
+ }
61525
+ function parseAbsoluteUrl(input) {
61526
+ const match = urlRegex.exec(input);
61527
+ return makeUrl(match[1], match[2] || "", match[3], match[4] || "", match[5] || "/", match[6] || "", match[7] || "");
61528
+ }
61529
+ function parseFileUrl(input) {
61530
+ const match = fileRegex.exec(input);
61531
+ const path = match[2];
61532
+ return makeUrl("file:", "", match[1] || "", "", isAbsolutePath(path) ? path : "/" + path, match[3] || "", match[4] || "");
61533
+ }
61534
+ function makeUrl(scheme, user, host, port, path, query, hash) {
61535
+ return {
61536
+ scheme,
61537
+ user,
61538
+ host,
61539
+ port,
61540
+ path,
61541
+ query,
61542
+ hash,
61543
+ type: 7
61544
+ };
61545
+ }
61546
+ function parseUrl(input) {
61547
+ if (isSchemeRelativeUrl(input)) {
61548
+ const url = parseAbsoluteUrl("http:" + input);
61549
+ url.scheme = "";
61550
+ url.type = 6;
61551
+ return url;
61552
+ }
61553
+ if (isAbsolutePath(input)) {
61554
+ const url = parseAbsoluteUrl("http://foo.com" + input);
61555
+ url.scheme = "";
61556
+ url.host = "";
61557
+ url.type = 5;
61558
+ return url;
61559
+ }
61560
+ if (isFileUrl(input)) return parseFileUrl(input);
61561
+ if (isAbsoluteUrl(input)) return parseAbsoluteUrl(input);
61562
+ const url = parseAbsoluteUrl("http://foo.com/" + input);
61563
+ url.scheme = "";
61564
+ url.host = "";
61565
+ url.type = input ? input.startsWith("?") ? 3 : input.startsWith("#") ? 2 : 4 : 1;
61566
+ return url;
61567
+ }
61568
+ function stripPathFilename(path) {
61569
+ if (path.endsWith("/..")) return path;
61570
+ const index = path.lastIndexOf("/");
61571
+ return path.slice(0, index + 1);
61572
+ }
61573
+ function mergePaths(url, base) {
61574
+ normalizePath(base, base.type);
61575
+ if (url.path === "/") url.path = base.path;
61576
+ else url.path = stripPathFilename(base.path) + url.path;
61577
+ }
61578
+ /**
61579
+ * The path can have empty directories "//", unneeded parents "foo/..", or current directory
61580
+ * "foo/.". We need to normalize to a standard representation.
61581
+ */
61582
+ function normalizePath(url, type) {
61583
+ const rel = type <= 4;
61584
+ const pieces = url.path.split("/");
61585
+ let pointer = 1;
61586
+ let positive = 0;
61587
+ let addTrailingSlash = false;
61588
+ for (let i = 1; i < pieces.length; i++) {
61589
+ const piece = pieces[i];
61590
+ if (!piece) {
61591
+ addTrailingSlash = true;
61592
+ continue;
61593
+ }
61594
+ addTrailingSlash = false;
61595
+ if (piece === ".") continue;
61596
+ if (piece === "..") {
61597
+ if (positive) {
61598
+ addTrailingSlash = true;
61599
+ positive--;
61600
+ pointer--;
61601
+ } else if (rel) pieces[pointer++] = piece;
61602
+ continue;
61603
+ }
61604
+ pieces[pointer++] = piece;
61605
+ positive++;
61606
+ }
61607
+ let path = "";
61608
+ for (let i = 1; i < pointer; i++) path += "/" + pieces[i];
61609
+ if (!path || addTrailingSlash && !path.endsWith("/..")) path += "/";
61610
+ url.path = path;
61611
+ }
61612
+ /**
61613
+ * Attempts to resolve `input` URL/path relative to `base`.
61614
+ */
61615
+ function resolve(input, base) {
61616
+ if (!input && !base) return "";
61617
+ const url = parseUrl(input);
61618
+ let inputType = url.type;
61619
+ if (base && inputType !== 7) {
61620
+ const baseUrl = parseUrl(base);
61621
+ const baseType = baseUrl.type;
61622
+ switch (inputType) {
61623
+ case 1: url.hash = baseUrl.hash;
61624
+ case 2: url.query = baseUrl.query;
61625
+ case 3:
61626
+ case 4: mergePaths(url, baseUrl);
61627
+ case 5:
61628
+ url.user = baseUrl.user;
61629
+ url.host = baseUrl.host;
61630
+ url.port = baseUrl.port;
61631
+ case 6: url.scheme = baseUrl.scheme;
61632
+ }
61633
+ if (baseType > inputType) inputType = baseType;
61634
+ }
61635
+ normalizePath(url, inputType);
61636
+ const queryHash = url.query + url.hash;
61637
+ switch (inputType) {
61638
+ case 2:
61639
+ case 3: return queryHash;
61640
+ case 4: {
61641
+ const path = url.path.slice(1);
61642
+ if (!path) return queryHash || ".";
61643
+ if (isRelative(base || input) && !isRelative(path)) return "./" + path + queryHash;
61644
+ return path + queryHash;
61645
+ }
61646
+ case 5: return url.path + queryHash;
61647
+ default: return url.scheme + "//" + url.user + url.host + url.port + url.path + queryHash;
61648
+ }
61649
+ }
61650
+ //#endregion
61651
+ //#region ../../node_modules/.pnpm/@jridgewell+trace-mapping@0.3.31/node_modules/@jridgewell/trace-mapping/dist/trace-mapping.mjs
61652
+ function stripFilename(path) {
61653
+ if (!path) return "";
61654
+ const index = path.lastIndexOf("/");
61655
+ return path.slice(0, index + 1);
61656
+ }
61657
+ function resolver(mapUrl, sourceRoot) {
61658
+ const from = stripFilename(mapUrl);
61659
+ const prefix = sourceRoot ? sourceRoot + "/" : "";
61660
+ return (source) => resolve(prefix + (source || ""), from);
61661
+ }
61662
+ var COLUMN = 0;
61663
+ var SOURCES_INDEX = 1;
61664
+ var SOURCE_LINE = 2;
61665
+ var SOURCE_COLUMN = 3;
61666
+ var NAMES_INDEX = 4;
61667
+ function maybeSort(mappings, owned) {
61668
+ const unsortedIndex = nextUnsortedSegmentLine(mappings, 0);
61669
+ if (unsortedIndex === mappings.length) return mappings;
61670
+ if (!owned) mappings = mappings.slice();
61671
+ for (let i = unsortedIndex; i < mappings.length; i = nextUnsortedSegmentLine(mappings, i + 1)) mappings[i] = sortSegments(mappings[i], owned);
61672
+ return mappings;
61673
+ }
61674
+ function nextUnsortedSegmentLine(mappings, start) {
61675
+ for (let i = start; i < mappings.length; i++) if (!isSorted(mappings[i])) return i;
61676
+ return mappings.length;
61677
+ }
61678
+ function isSorted(line) {
61679
+ for (let j = 1; j < line.length; j++) if (line[j][COLUMN] < line[j - 1][COLUMN]) return false;
61680
+ return true;
61681
+ }
61682
+ function sortSegments(line, owned) {
61683
+ if (!owned) line = line.slice();
61684
+ return line.sort(sortComparator);
61685
+ }
61686
+ function sortComparator(a, b) {
61687
+ return a[COLUMN] - b[COLUMN];
61688
+ }
61689
+ var found = false;
61690
+ function binarySearch(haystack, needle, low, high) {
61691
+ while (low <= high) {
61692
+ const mid = low + (high - low >> 1);
61693
+ const cmp = haystack[mid][COLUMN] - needle;
61694
+ if (cmp === 0) {
61695
+ found = true;
61696
+ return mid;
61697
+ }
61698
+ if (cmp < 0) low = mid + 1;
61699
+ else high = mid - 1;
61700
+ }
61701
+ found = false;
61702
+ return low - 1;
61703
+ }
61704
+ function upperBound(haystack, needle, index) {
61705
+ for (let i = index + 1; i < haystack.length; index = i++) if (haystack[i][COLUMN] !== needle) break;
61706
+ return index;
61707
+ }
61708
+ function lowerBound(haystack, needle, index) {
61709
+ for (let i = index - 1; i >= 0; index = i--) if (haystack[i][COLUMN] !== needle) break;
61710
+ return index;
61711
+ }
61712
+ function memoizedState() {
61713
+ return {
61714
+ lastKey: -1,
61715
+ lastNeedle: -1,
61716
+ lastIndex: -1
61717
+ };
61718
+ }
61719
+ function memoizedBinarySearch(haystack, needle, state, key) {
61720
+ const { lastKey, lastNeedle, lastIndex } = state;
61721
+ let low = 0;
61722
+ let high = haystack.length - 1;
61723
+ if (key === lastKey) {
61724
+ if (needle === lastNeedle) {
61725
+ found = lastIndex !== -1 && haystack[lastIndex][COLUMN] === needle;
61726
+ return lastIndex;
61727
+ }
61728
+ if (needle >= lastNeedle) low = lastIndex === -1 ? 0 : lastIndex;
61729
+ else high = lastIndex;
61730
+ }
61731
+ state.lastKey = key;
61732
+ state.lastNeedle = needle;
61733
+ return state.lastIndex = binarySearch(haystack, needle, low, high);
61734
+ }
61735
+ function parse(map) {
61736
+ return typeof map === "string" ? JSON.parse(map) : map;
61737
+ }
61738
+ var LINE_GTR_ZERO = "`line` must be greater than 0 (lines start at line 1)";
61739
+ var COL_GTR_EQ_ZERO = "`column` must be greater than or equal to 0 (columns start at column 0)";
61740
+ var TraceMap = class {
61741
+ constructor(map, mapUrl) {
61742
+ const isString = typeof map === "string";
61743
+ if (!isString && map._decodedMemo) return map;
61744
+ const parsed = parse(map);
61745
+ const { version, file, names, sourceRoot, sources, sourcesContent } = parsed;
61746
+ this.version = version;
61747
+ this.file = file;
61748
+ this.names = names || [];
61749
+ this.sourceRoot = sourceRoot;
61750
+ this.sources = sources;
61751
+ this.sourcesContent = sourcesContent;
61752
+ this.ignoreList = parsed.ignoreList || parsed.x_google_ignoreList || void 0;
61753
+ const resolve = resolver(mapUrl, sourceRoot);
61754
+ this.resolvedSources = sources.map(resolve);
61755
+ const { mappings } = parsed;
61756
+ if (typeof mappings === "string") {
61757
+ this._encoded = mappings;
61758
+ this._decoded = void 0;
61759
+ } else if (Array.isArray(mappings)) {
61760
+ this._encoded = void 0;
61761
+ this._decoded = maybeSort(mappings, isString);
61762
+ } else if (parsed.sections) throw new Error(`TraceMap passed sectioned source map, please use FlattenMap export instead`);
61763
+ else throw new Error(`invalid source map: ${JSON.stringify(parsed)}`);
61764
+ this._decodedMemo = memoizedState();
61765
+ this._bySources = void 0;
61766
+ this._bySourceMemos = void 0;
61767
+ }
61768
+ };
61769
+ function cast(map) {
61770
+ return map;
61771
+ }
61772
+ function decodedMappings(map) {
61773
+ var _a;
61774
+ return (_a = cast(map))._decoded || (_a._decoded = decode(cast(map)._encoded));
61775
+ }
61776
+ function originalPositionFor(map, needle) {
61777
+ let { line, column, bias } = needle;
61778
+ line--;
61779
+ if (line < 0) throw new Error(LINE_GTR_ZERO);
61780
+ if (column < 0) throw new Error(COL_GTR_EQ_ZERO);
61781
+ const decoded = decodedMappings(map);
61782
+ if (line >= decoded.length) return OMapping(null, null, null, null);
61783
+ const segments = decoded[line];
61784
+ const index = traceSegmentInternal(segments, cast(map)._decodedMemo, line, column, bias || 1);
61785
+ if (index === -1) return OMapping(null, null, null, null);
61786
+ const segment = segments[index];
61787
+ if (segment.length === 1) return OMapping(null, null, null, null);
61788
+ const { names, resolvedSources } = map;
61789
+ return OMapping(resolvedSources[segment[SOURCES_INDEX]], segment[SOURCE_LINE] + 1, segment[SOURCE_COLUMN], segment.length === 5 ? names[segment[NAMES_INDEX]] : null);
61790
+ }
61791
+ function OMapping(source, line, column, name) {
61792
+ return {
61793
+ source,
61794
+ line,
61795
+ column,
61796
+ name
61797
+ };
61798
+ }
61799
+ function traceSegmentInternal(segments, memo, line, column, bias) {
61800
+ let index = memoizedBinarySearch(segments, column, memo, line);
61801
+ if (found) index = (bias === -1 ? upperBound : lowerBound)(segments, column, index);
61802
+ else if (bias === -1) index++;
61803
+ if (index === -1 || index === segments.length) return -1;
61804
+ return index;
61805
+ }
61806
+ //#endregion
61384
61807
  //#region ../core/dist/index.js
61385
61808
  var __create = Object.create;
61386
61809
  var __defProp = Object.defineProperty;
@@ -61450,7 +61873,7 @@ var AmbiguousProjectError = class extends Error {
61450
61873
  };
61451
61874
  const isProjectDiscoveryError = (value) => value instanceof ProjectNotFoundError || value instanceof NoReactDependencyError || value instanceof PackageJsonNotFoundError || value instanceof NotADirectoryError || value instanceof AmbiguousProjectError;
61452
61875
  const HTML_FILE_PATTERN = /\.html$/i;
61453
- const SOURCE_FILE_PATTERN = /\.(?:tsx?|jsx?|mts|mjs|[hH][tT][mM][lL])$/;
61876
+ const SOURCE_FILE_PATTERN = /\.(?:astro|tsx?|jsx?|mts|mjs|[hH][tT][mM][lL])$/;
61454
61877
  const GENERATED_BUNDLE_FILE_PATTERN = /\.(iife|umd|global|min)\.m?js$/i;
61455
61878
  const GENERATED_SOURCE_DIRECTORY_PATTERN = /(?:^|\/)__generated__\//;
61456
61879
  const MINIFIED_SNIFF_BYTES = 65536;
@@ -62178,6 +62601,7 @@ const FRAMEWORK_PACKAGES = {
62178
62601
  "@tanstack/react-start": "tanstack-start",
62179
62602
  "@remix-run/react": "remix",
62180
62603
  gatsby: "gatsby",
62604
+ astro: "astro",
62181
62605
  vite: "vite",
62182
62606
  "react-scripts": "cra",
62183
62607
  expo: "expo",
@@ -71028,6 +71452,50 @@ const columnOfUtf8Offset = (sourceBuffer, utf8Offset) => {
71028
71452
  while (lineStartOffset > 0 && sourceBuffer[lineStartOffset - 1] !== 10) lineStartOffset--;
71029
71453
  return sourceBuffer.subarray(lineStartOffset, boundedOffset).toString("utf8").length + 1;
71030
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
+ };
71031
71499
  const REDACTED_PLACEHOLDER = "<redacted>";
71032
71500
  const KEEP_PREFIX = `$1${REDACTED_PLACEHOLDER}`;
71033
71501
  const KNOWN_SECRET_RULES = [
@@ -71772,7 +72240,7 @@ const isOxlintOutput = (value) => isRecord(value) && Array.isArray(value.diagnos
71772
72240
  * to the first `{`. Raises `OxlintOutputUnparseable` when the
71773
72241
  * stdout isn't valid JSON or doesn't carry a `diagnostics` array.
71774
72242
  */
71775
- const parseOxlintOutput = (stdout, project, rootDirectory, sourcePathByLintPath) => {
72243
+ const parseOxlintOutput = (stdout, project, rootDirectory, sourcePathByLintPath, sourceMapByLintPath) => {
71776
72244
  if (!stdout) return [];
71777
72245
  const jsonStart = stdout.indexOf("{");
71778
72246
  const sanitizedStdout = jsonStart > 0 ? stdout.slice(jsonStart) : stdout;
@@ -71790,6 +72258,7 @@ const parseOxlintOutput = (stdout, project, rootDirectory, sourcePathByLintPath)
71790
72258
  const sourceLinesCache = /* @__PURE__ */ new Map();
71791
72259
  const resolveAbsolutePath = (filename) => Path.isAbsolute(filename) ? filename : Path.resolve(rootDirectory || ".", filename);
71792
72260
  const resolveMappedSourceFilename = (filename) => sourcePathByLintPath?.get(Path.normalize(resolveAbsolutePath(filename)));
72261
+ const resolvePreparedSourceMap = (filename) => sourceMapByLintPath?.get(Path.normalize(resolveAbsolutePath(filename)));
71793
72262
  const resolveSourceFilename = (filename) => resolveMappedSourceFilename(filename) ?? filename;
71794
72263
  const readSourceBuffer = (filename) => {
71795
72264
  const absolutePath = resolveAbsolutePath(resolveSourceFilename(filename));
@@ -71821,7 +72290,19 @@ const parseOxlintOutput = (stdout, project, rootDirectory, sourcePathByLintPath)
71821
72290
  minifiedFileCache.set(absolutePath, minified);
71822
72291
  return minified;
71823
72292
  };
71824
- 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) => {
71825
72306
  const { plugin, rule } = parseRuleCode(diagnostic.code);
71826
72307
  const primaryLabel = diagnostic.labels[0];
71827
72308
  const cleaned = cleanDiagnosticMessage(diagnostic.message, diagnostic.help, plugin, rule, project);
@@ -72039,7 +72520,7 @@ const isParallelismRelatedSpawnError = (error) => {
72039
72520
  * loop with a slimmer config in that case.
72040
72521
  */
72041
72522
  const spawnLintBatches = async (input) => {
72042
- 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;
72043
72524
  const resolveSourcePath = (filePath) => {
72044
72525
  const absoluteFilePath = Path.isAbsolute(filePath) ? filePath : Path.resolve(rootDirectory, filePath);
72045
72526
  return sourcePathByLintPath?.get(Path.normalize(absoluteFilePath)) ?? filePath;
@@ -72063,7 +72544,7 @@ const spawnLintBatches = async (input) => {
72063
72544
  }
72064
72545
  const batchArgs = [...baseArgs, ...batch];
72065
72546
  try {
72066
- 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);
72067
72548
  } catch (error) {
72068
72549
  if (!isSplittableReactDoctorError(error)) throw error;
72069
72550
  if (isPastDeadline()) {
@@ -72502,20 +72983,47 @@ const prepareHtmlScriptSource = (sourceBuffer) => {
72502
72983
  lintBuffer: maskedBuffer ?? sourceBuffer
72503
72984
  };
72504
72985
  };
72505
- const prepareHtmlLintSources = (rootDirectory, temporaryDirectory, candidateFiles) => {
72986
+ const ASTRO_FILE_PATTERN = /\.astro$/;
72987
+ const prepareLintSources = (rootDirectory, temporaryDirectory, candidateFiles) => {
72506
72988
  const lintFiles = [];
72507
72989
  const sourcePathByLintPath = /* @__PURE__ */ new Map();
72990
+ const sourceMapByLintPath = /* @__PURE__ */ new Map();
72508
72991
  const sizeByLintPath = /* @__PURE__ */ new Map();
72509
72992
  const htmlSourcesDirectory = Path.join(temporaryDirectory, "html-sources");
72993
+ const astroSourcesDirectory = Path.join(temporaryDirectory, "astro-sources");
72510
72994
  let htmlFileIndex = 0;
72995
+ let astroFileIndex = 0;
72511
72996
  let hasThreeModuleImport = false;
72512
72997
  for (const candidateFile of candidateFiles) {
72513
- if (!HTML_FILE_PATTERN.test(candidateFile)) {
72998
+ if (!HTML_FILE_PATTERN.test(candidateFile) && !ASTRO_FILE_PATTERN.test(candidateFile)) {
72514
72999
  lintFiles.push(candidateFile);
72515
73000
  continue;
72516
73001
  }
72517
73002
  const absoluteSourcePath = Path.isAbsolute(candidateFile) ? candidateFile : Path.resolve(rootDirectory, candidateFile);
72518
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
+ }
72519
73027
  const { executableScriptBodies, lintBuffer } = prepareHtmlScriptSource(sourceBuffer);
72520
73028
  if (htmlFileIndex === 0) NFS.mkdirSync(htmlSourcesDirectory, { recursive: true });
72521
73029
  const lintPath = Path.join(htmlSourcesDirectory, `${htmlFileIndex}.astro`);
@@ -72529,6 +73037,7 @@ const prepareHtmlLintSources = (rootDirectory, temporaryDirectory, candidateFile
72529
73037
  return {
72530
73038
  lintFiles,
72531
73039
  sourcePathByLintPath,
73040
+ sourceMapByLintPath,
72532
73041
  sizeByLintPath,
72533
73042
  hasThreeModuleImport
72534
73043
  };
@@ -72747,10 +73256,10 @@ const runOxlint = async (options) => {
72747
73256
  rootDirectory,
72748
73257
  candidateFiles
72749
73258
  });
72750
- const preparedHtmlSources = prepareHtmlLintSources(rootDirectory, configDirectory, candidateFiles);
72751
- const lintFiles = preparedHtmlSources.lintFiles;
72752
- const hasHtmlFiles = preparedHtmlSources.sourcePathByLintPath.size > 0;
72753
- 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 ? {
72754
73263
  ...project,
72755
73264
  hasThree: true
72756
73265
  } : project;
@@ -72772,7 +73281,7 @@ const runOxlint = async (options) => {
72772
73281
  sidecarRuleIdFilter: overrides.sidecarRuleIdFilter
72773
73282
  });
72774
73283
  const sizeByFile = sizedScanFiles !== null && lintBatchOrdering === "cost" ? new Map(sizedScanFiles.map((entry) => [entry.path, entry.sizeBytes])) : null;
72775
- 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);
72776
73285
  const buildFileBatches = (passBaseArgs, passFiles) => sizeByFile !== null ? planLintBatches({
72777
73286
  baseArgs: passBaseArgs,
72778
73287
  files: passFiles,
@@ -72802,7 +73311,8 @@ const runOxlint = async (options) => {
72802
73311
  rootDirectory,
72803
73312
  nodeBinaryPath,
72804
73313
  project: lintProject,
72805
- sourcePathByLintPath: preparedHtmlSources.sourcePathByLintPath,
73314
+ sourcePathByLintPath: preparedLintSources.sourcePathByLintPath,
73315
+ sourceMapByLintPath: preparedLintSources.sourceMapByLintPath,
72806
73316
  onPartialFailure: reportPartialFailure,
72807
73317
  onAnalyzedFiles: (filePaths) => {
72808
73318
  analyzedFiles = filePaths;
@@ -72837,7 +73347,7 @@ const runOxlint = async (options) => {
72837
73347
  };
72838
73348
  }
72839
73349
  };
72840
- 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) {
72841
73351
  const rulesetHash = computeRulesetHash({
72842
73352
  config: buildConfig({
72843
73353
  extendsPaths: [],
@@ -73003,7 +73513,8 @@ const runOxlint = async (options) => {
73003
73513
  rootDirectory,
73004
73514
  nodeBinaryPath,
73005
73515
  project: lintProject,
73006
- sourcePathByLintPath: preparedHtmlSources.sourcePathByLintPath,
73516
+ sourcePathByLintPath: preparedLintSources.sourcePathByLintPath,
73517
+ sourceMapByLintPath: preparedLintSources.sourceMapByLintPath,
73007
73518
  onPartialFailure,
73008
73519
  onAnalyzedFiles: (filePaths) => {
73009
73520
  analyzedFiles = filePaths;
@@ -74932,4 +75443,4 @@ const toJsonReport = (result, options) => buildJsonReport({
74932
75443
  export { AmbiguousProjectError, NoReactDependencyError, NotADirectoryError, PackageJsonNotFoundError, ProjectNotFoundError, ReactDoctorError, buildJsonReport, buildJsonReportError, clearCaches, defineConfig, diagnose, filterSourceFiles, getDiffInfo, hasReactRuntime, isProjectDiscoveryError, isReactDoctorError, summarizeDiagnostics, toJsonReport };
74933
75444
 
74934
75445
  //# sourceMappingURL=index.js.map
74935
- //# debugId=cc06d86a-0b85-5115-a9f2-cc30c268ad79
75446
+ //# debugId=18c61424-4926-5cae-8f2a-6001534ea755