react-doctor 0.9.2-dev.f1a1b16 → 0.9.2-dev.fb5f881
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/README.md +2 -2
- package/dist/cli.js +951 -194
- package/dist/index.d.ts +9 -3
- package/dist/index.js +662 -95
- package/dist/lsp.js +643 -90
- package/dist/{run-scan-app-C9MJnVwv.js → run-scan-app-DHRvqfkX.js} +11 -10
- package/package.json +5 -4
package/dist/lsp.js
CHANGED
|
@@ -5,18 +5,19 @@ import * as OS from "node:os";
|
|
|
5
5
|
import os from "node:os";
|
|
6
6
|
import * as Path from "node:path";
|
|
7
7
|
import path from "node:path";
|
|
8
|
-
import
|
|
8
|
+
import { ALL_REACT_DOCTOR_RULE_KEYS, CROSS_FILE_DEPENDENCY_COLLECTORS, CROSS_FILE_RULE_IDS, FRAMEWORK_SPECIFIC_RULE_KEYS, FRAMEWORK_TOKENS, MOTION_LIBRARY_PACKAGES, REACT_COMPILER_RULES, REACT_DOCTOR_RULES, REACT_DOCTOR_RULE_REGISTRY, REACT_DOCTOR_SCAN_RULES, classifySecurityScanFile, collectCrossFileDependencyProbes, resetManifestCaches, shouldReadSecurityScanContent } from "oxlint-plugin-react-doctor/core";
|
|
9
9
|
import * as Crypto from "node:crypto";
|
|
10
10
|
import crypto, { createHash } from "node:crypto";
|
|
11
11
|
import * as NodeChildProcess from "node:child_process";
|
|
12
12
|
import { execFileSync, spawn, spawnSync } from "node:child_process";
|
|
13
13
|
import { ResolverFactory } from "oxc-resolver";
|
|
14
14
|
import ts from "typescript";
|
|
15
|
-
import { parseJSON5 } from "confbox";
|
|
16
15
|
import * as NodeUrl from "node:url";
|
|
17
16
|
import { fileURLToPath } from "node:url";
|
|
17
|
+
import { parseJSON5 } from "confbox";
|
|
18
18
|
import { createJiti } from "jiti";
|
|
19
19
|
import { ANALYZED_MANIFEST_FILENAMES, DEFAULT_EXTENSIONS } from "deslop-js/analyzed-inputs";
|
|
20
|
+
import { convertToTSX } from "@astrojs/compiler/sync";
|
|
20
21
|
import { gzipSync } from "node:zlib";
|
|
21
22
|
import { CodeActionKind, CodeActionTriggerKind, DidChangeWatchedFilesNotification, DocumentDiagnosticReportKind, FileChangeType, TextDocumentSyncKind, TextDocuments, createConnection } from "vscode-languageserver/node.js";
|
|
22
23
|
import { TextDocument } from "vscode-languageserver-textdocument";
|
|
@@ -10280,7 +10281,7 @@ const Number$4 = globalThis.Number;
|
|
|
10280
10281
|
* @category constructors
|
|
10281
10282
|
* @since 2.0.0
|
|
10282
10283
|
*/
|
|
10283
|
-
const parse = (s) => {
|
|
10284
|
+
const parse$1 = (s) => {
|
|
10284
10285
|
if (s === "NaN") return some(NaN);
|
|
10285
10286
|
if (s === "Infinity") return some(Infinity);
|
|
10286
10287
|
if (s === "-Infinity") return some(-Infinity);
|
|
@@ -14334,12 +14335,12 @@ TaggedError("EncodingError");
|
|
|
14334
14335
|
//#endregion
|
|
14335
14336
|
//#region ../../node_modules/.pnpm/effect@4.0.0-beta.70/node_modules/effect/dist/internal/schema/annotations.js
|
|
14336
14337
|
/** @internal */
|
|
14337
|
-
function resolve(ast) {
|
|
14338
|
+
function resolve$1(ast) {
|
|
14338
14339
|
return ast.checks ? ast.checks[ast.checks.length - 1].annotations : ast.annotations;
|
|
14339
14340
|
}
|
|
14340
14341
|
/** @internal */
|
|
14341
14342
|
function resolveAt(key) {
|
|
14342
|
-
return (ast) => resolve(ast)?.[key];
|
|
14343
|
+
return (ast) => resolve$1(ast)?.[key];
|
|
14343
14344
|
}
|
|
14344
14345
|
/** @internal */
|
|
14345
14346
|
const resolveIdentifier = /* @__PURE__ */ resolveAt("identifier");
|
|
@@ -18091,7 +18092,7 @@ function asSync(parser) {
|
|
|
18091
18092
|
}
|
|
18092
18093
|
const recur$1 = /* @__PURE__ */ memoize((ast) => {
|
|
18093
18094
|
let parser;
|
|
18094
|
-
const astOptions = resolve(ast)?.["parseOptions"];
|
|
18095
|
+
const astOptions = resolve$1(ast)?.["parseOptions"];
|
|
18095
18096
|
if (!ast.context && !ast.encoding && !ast.checks) return (ou, options) => {
|
|
18096
18097
|
parser ??= ast.getParser(recur$1);
|
|
18097
18098
|
if (astOptions) options = {
|
|
@@ -57696,7 +57697,7 @@ var UrlParamsError = class extends TaggedError("UrlParamsError") {};
|
|
|
57696
57697
|
* @category converting
|
|
57697
57698
|
* @since 4.0.0
|
|
57698
57699
|
*/
|
|
57699
|
-
const makeUrl = (url, params, hash) => {
|
|
57700
|
+
const makeUrl$1 = (url, params, hash) => {
|
|
57700
57701
|
try {
|
|
57701
57702
|
const urlInstance = new URL(url, baseUrl());
|
|
57702
57703
|
for (let i = 0; i < params.params.length; i++) {
|
|
@@ -58330,7 +58331,7 @@ const Proto$2 = {
|
|
|
58330
58331
|
const make$10 = (f) => makeWith$1((effect) => flatMap$2(effect, (request) => withFiber((fiber) => {
|
|
58331
58332
|
const scopedController = scopedRequests.get(request);
|
|
58332
58333
|
const controller = scopedController ?? new AbortController();
|
|
58333
|
-
const urlResult = makeUrl(request.url, request.urlParams, getOrUndefined(request.hash));
|
|
58334
|
+
const urlResult = makeUrl$1(request.url, request.urlParams, getOrUndefined(request.hash));
|
|
58334
58335
|
if (isFailure(urlResult)) return fail$4(new HttpClientError({ reason: new InvalidUrlError({
|
|
58335
58336
|
request,
|
|
58336
58337
|
cause: urlResult.failure
|
|
@@ -58769,7 +58770,7 @@ const layer$7 = (loggers, options) => effect(CurrentLoggers, withFiber$1(fnUntra
|
|
|
58769
58770
|
* @since 4.0.0
|
|
58770
58771
|
*/
|
|
58771
58772
|
const policy = /* @__PURE__ */ forever$1.pipe(passthrough$2, /* @__PURE__ */ addDelay((error) => {
|
|
58772
|
-
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))));
|
|
58773
|
+
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))));
|
|
58773
58774
|
return succeed$2(seconds(1));
|
|
58774
58775
|
}));
|
|
58775
58776
|
/**
|
|
@@ -61411,6 +61412,428 @@ const layer = /* @__PURE__ */ succeed$3(Path$1)({
|
|
|
61411
61412
|
toFileUrl
|
|
61412
61413
|
});
|
|
61413
61414
|
//#endregion
|
|
61415
|
+
//#region ../../node_modules/.pnpm/@jridgewell+sourcemap-codec@1.5.5/node_modules/@jridgewell/sourcemap-codec/dist/sourcemap-codec.mjs
|
|
61416
|
+
var comma = ",".charCodeAt(0);
|
|
61417
|
+
";".charCodeAt(0);
|
|
61418
|
+
var chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
|
|
61419
|
+
var intToChar = new Uint8Array(64);
|
|
61420
|
+
var charToInt = new Uint8Array(128);
|
|
61421
|
+
for (let i = 0; i < chars.length; i++) {
|
|
61422
|
+
const c = chars.charCodeAt(i);
|
|
61423
|
+
intToChar[i] = c;
|
|
61424
|
+
charToInt[c] = i;
|
|
61425
|
+
}
|
|
61426
|
+
function decodeInteger(reader, relative) {
|
|
61427
|
+
let value = 0;
|
|
61428
|
+
let shift = 0;
|
|
61429
|
+
let integer = 0;
|
|
61430
|
+
do {
|
|
61431
|
+
integer = charToInt[reader.next()];
|
|
61432
|
+
value |= (integer & 31) << shift;
|
|
61433
|
+
shift += 5;
|
|
61434
|
+
} while (integer & 32);
|
|
61435
|
+
const shouldNegate = value & 1;
|
|
61436
|
+
value >>>= 1;
|
|
61437
|
+
if (shouldNegate) value = -2147483648 | -value;
|
|
61438
|
+
return relative + value;
|
|
61439
|
+
}
|
|
61440
|
+
function hasMoreVlq(reader, max) {
|
|
61441
|
+
if (reader.pos >= max) return false;
|
|
61442
|
+
return reader.peek() !== comma;
|
|
61443
|
+
}
|
|
61444
|
+
var StringReader = class {
|
|
61445
|
+
constructor(buffer) {
|
|
61446
|
+
this.pos = 0;
|
|
61447
|
+
this.buffer = buffer;
|
|
61448
|
+
}
|
|
61449
|
+
next() {
|
|
61450
|
+
return this.buffer.charCodeAt(this.pos++);
|
|
61451
|
+
}
|
|
61452
|
+
peek() {
|
|
61453
|
+
return this.buffer.charCodeAt(this.pos);
|
|
61454
|
+
}
|
|
61455
|
+
indexOf(char) {
|
|
61456
|
+
const { buffer, pos } = this;
|
|
61457
|
+
const idx = buffer.indexOf(char, pos);
|
|
61458
|
+
return idx === -1 ? buffer.length : idx;
|
|
61459
|
+
}
|
|
61460
|
+
};
|
|
61461
|
+
function decode(mappings) {
|
|
61462
|
+
const { length } = mappings;
|
|
61463
|
+
const reader = new StringReader(mappings);
|
|
61464
|
+
const decoded = [];
|
|
61465
|
+
let genColumn = 0;
|
|
61466
|
+
let sourcesIndex = 0;
|
|
61467
|
+
let sourceLine = 0;
|
|
61468
|
+
let sourceColumn = 0;
|
|
61469
|
+
let namesIndex = 0;
|
|
61470
|
+
do {
|
|
61471
|
+
const semi = reader.indexOf(";");
|
|
61472
|
+
const line = [];
|
|
61473
|
+
let sorted = true;
|
|
61474
|
+
let lastCol = 0;
|
|
61475
|
+
genColumn = 0;
|
|
61476
|
+
while (reader.pos < semi) {
|
|
61477
|
+
let seg;
|
|
61478
|
+
genColumn = decodeInteger(reader, genColumn);
|
|
61479
|
+
if (genColumn < lastCol) sorted = false;
|
|
61480
|
+
lastCol = genColumn;
|
|
61481
|
+
if (hasMoreVlq(reader, semi)) {
|
|
61482
|
+
sourcesIndex = decodeInteger(reader, sourcesIndex);
|
|
61483
|
+
sourceLine = decodeInteger(reader, sourceLine);
|
|
61484
|
+
sourceColumn = decodeInteger(reader, sourceColumn);
|
|
61485
|
+
if (hasMoreVlq(reader, semi)) {
|
|
61486
|
+
namesIndex = decodeInteger(reader, namesIndex);
|
|
61487
|
+
seg = [
|
|
61488
|
+
genColumn,
|
|
61489
|
+
sourcesIndex,
|
|
61490
|
+
sourceLine,
|
|
61491
|
+
sourceColumn,
|
|
61492
|
+
namesIndex
|
|
61493
|
+
];
|
|
61494
|
+
} else seg = [
|
|
61495
|
+
genColumn,
|
|
61496
|
+
sourcesIndex,
|
|
61497
|
+
sourceLine,
|
|
61498
|
+
sourceColumn
|
|
61499
|
+
];
|
|
61500
|
+
} else seg = [genColumn];
|
|
61501
|
+
line.push(seg);
|
|
61502
|
+
reader.pos++;
|
|
61503
|
+
}
|
|
61504
|
+
if (!sorted) sort(line);
|
|
61505
|
+
decoded.push(line);
|
|
61506
|
+
reader.pos = semi + 1;
|
|
61507
|
+
} while (reader.pos <= length);
|
|
61508
|
+
return decoded;
|
|
61509
|
+
}
|
|
61510
|
+
function sort(line) {
|
|
61511
|
+
line.sort(sortComparator$1);
|
|
61512
|
+
}
|
|
61513
|
+
function sortComparator$1(a, b) {
|
|
61514
|
+
return a[0] - b[0];
|
|
61515
|
+
}
|
|
61516
|
+
//#endregion
|
|
61517
|
+
//#region ../../node_modules/.pnpm/@jridgewell+resolve-uri@3.1.2/node_modules/@jridgewell/resolve-uri/dist/resolve-uri.mjs
|
|
61518
|
+
const schemeRegex = /^[\w+.-]+:\/\//;
|
|
61519
|
+
/**
|
|
61520
|
+
* Matches the parts of a URL:
|
|
61521
|
+
* 1. Scheme, including ":", guaranteed.
|
|
61522
|
+
* 2. User/password, including "@", optional.
|
|
61523
|
+
* 3. Host, guaranteed.
|
|
61524
|
+
* 4. Port, including ":", optional.
|
|
61525
|
+
* 5. Path, including "/", optional.
|
|
61526
|
+
* 6. Query, including "?", optional.
|
|
61527
|
+
* 7. Hash, including "#", optional.
|
|
61528
|
+
*/
|
|
61529
|
+
const urlRegex = /^([\w+.-]+:)\/\/([^@/#?]*@)?([^:/#?]*)(:\d+)?(\/[^#?]*)?(\?[^#]*)?(#.*)?/;
|
|
61530
|
+
/**
|
|
61531
|
+
* File URLs are weird. They dont' need the regular `//` in the scheme, they may or may not start
|
|
61532
|
+
* with a leading `/`, they can have a domain (but only if they don't start with a Windows drive).
|
|
61533
|
+
*
|
|
61534
|
+
* 1. Host, optional.
|
|
61535
|
+
* 2. Path, which may include "/", guaranteed.
|
|
61536
|
+
* 3. Query, including "?", optional.
|
|
61537
|
+
* 4. Hash, including "#", optional.
|
|
61538
|
+
*/
|
|
61539
|
+
const fileRegex = /^file:(?:\/\/((?![a-z]:)[^/#?]*)?)?(\/?[^#?]*)(\?[^#]*)?(#.*)?/i;
|
|
61540
|
+
function isAbsoluteUrl(input) {
|
|
61541
|
+
return schemeRegex.test(input);
|
|
61542
|
+
}
|
|
61543
|
+
function isSchemeRelativeUrl(input) {
|
|
61544
|
+
return input.startsWith("//");
|
|
61545
|
+
}
|
|
61546
|
+
function isAbsolutePath(input) {
|
|
61547
|
+
return input.startsWith("/");
|
|
61548
|
+
}
|
|
61549
|
+
function isFileUrl(input) {
|
|
61550
|
+
return input.startsWith("file:");
|
|
61551
|
+
}
|
|
61552
|
+
function isRelative(input) {
|
|
61553
|
+
return /^[.?#]/.test(input);
|
|
61554
|
+
}
|
|
61555
|
+
function parseAbsoluteUrl(input) {
|
|
61556
|
+
const match = urlRegex.exec(input);
|
|
61557
|
+
return makeUrl(match[1], match[2] || "", match[3], match[4] || "", match[5] || "/", match[6] || "", match[7] || "");
|
|
61558
|
+
}
|
|
61559
|
+
function parseFileUrl(input) {
|
|
61560
|
+
const match = fileRegex.exec(input);
|
|
61561
|
+
const path = match[2];
|
|
61562
|
+
return makeUrl("file:", "", match[1] || "", "", isAbsolutePath(path) ? path : "/" + path, match[3] || "", match[4] || "");
|
|
61563
|
+
}
|
|
61564
|
+
function makeUrl(scheme, user, host, port, path, query, hash) {
|
|
61565
|
+
return {
|
|
61566
|
+
scheme,
|
|
61567
|
+
user,
|
|
61568
|
+
host,
|
|
61569
|
+
port,
|
|
61570
|
+
path,
|
|
61571
|
+
query,
|
|
61572
|
+
hash,
|
|
61573
|
+
type: 7
|
|
61574
|
+
};
|
|
61575
|
+
}
|
|
61576
|
+
function parseUrl(input) {
|
|
61577
|
+
if (isSchemeRelativeUrl(input)) {
|
|
61578
|
+
const url = parseAbsoluteUrl("http:" + input);
|
|
61579
|
+
url.scheme = "";
|
|
61580
|
+
url.type = 6;
|
|
61581
|
+
return url;
|
|
61582
|
+
}
|
|
61583
|
+
if (isAbsolutePath(input)) {
|
|
61584
|
+
const url = parseAbsoluteUrl("http://foo.com" + input);
|
|
61585
|
+
url.scheme = "";
|
|
61586
|
+
url.host = "";
|
|
61587
|
+
url.type = 5;
|
|
61588
|
+
return url;
|
|
61589
|
+
}
|
|
61590
|
+
if (isFileUrl(input)) return parseFileUrl(input);
|
|
61591
|
+
if (isAbsoluteUrl(input)) return parseAbsoluteUrl(input);
|
|
61592
|
+
const url = parseAbsoluteUrl("http://foo.com/" + input);
|
|
61593
|
+
url.scheme = "";
|
|
61594
|
+
url.host = "";
|
|
61595
|
+
url.type = input ? input.startsWith("?") ? 3 : input.startsWith("#") ? 2 : 4 : 1;
|
|
61596
|
+
return url;
|
|
61597
|
+
}
|
|
61598
|
+
function stripPathFilename(path) {
|
|
61599
|
+
if (path.endsWith("/..")) return path;
|
|
61600
|
+
const index = path.lastIndexOf("/");
|
|
61601
|
+
return path.slice(0, index + 1);
|
|
61602
|
+
}
|
|
61603
|
+
function mergePaths(url, base) {
|
|
61604
|
+
normalizePath(base, base.type);
|
|
61605
|
+
if (url.path === "/") url.path = base.path;
|
|
61606
|
+
else url.path = stripPathFilename(base.path) + url.path;
|
|
61607
|
+
}
|
|
61608
|
+
/**
|
|
61609
|
+
* The path can have empty directories "//", unneeded parents "foo/..", or current directory
|
|
61610
|
+
* "foo/.". We need to normalize to a standard representation.
|
|
61611
|
+
*/
|
|
61612
|
+
function normalizePath(url, type) {
|
|
61613
|
+
const rel = type <= 4;
|
|
61614
|
+
const pieces = url.path.split("/");
|
|
61615
|
+
let pointer = 1;
|
|
61616
|
+
let positive = 0;
|
|
61617
|
+
let addTrailingSlash = false;
|
|
61618
|
+
for (let i = 1; i < pieces.length; i++) {
|
|
61619
|
+
const piece = pieces[i];
|
|
61620
|
+
if (!piece) {
|
|
61621
|
+
addTrailingSlash = true;
|
|
61622
|
+
continue;
|
|
61623
|
+
}
|
|
61624
|
+
addTrailingSlash = false;
|
|
61625
|
+
if (piece === ".") continue;
|
|
61626
|
+
if (piece === "..") {
|
|
61627
|
+
if (positive) {
|
|
61628
|
+
addTrailingSlash = true;
|
|
61629
|
+
positive--;
|
|
61630
|
+
pointer--;
|
|
61631
|
+
} else if (rel) pieces[pointer++] = piece;
|
|
61632
|
+
continue;
|
|
61633
|
+
}
|
|
61634
|
+
pieces[pointer++] = piece;
|
|
61635
|
+
positive++;
|
|
61636
|
+
}
|
|
61637
|
+
let path = "";
|
|
61638
|
+
for (let i = 1; i < pointer; i++) path += "/" + pieces[i];
|
|
61639
|
+
if (!path || addTrailingSlash && !path.endsWith("/..")) path += "/";
|
|
61640
|
+
url.path = path;
|
|
61641
|
+
}
|
|
61642
|
+
/**
|
|
61643
|
+
* Attempts to resolve `input` URL/path relative to `base`.
|
|
61644
|
+
*/
|
|
61645
|
+
function resolve(input, base) {
|
|
61646
|
+
if (!input && !base) return "";
|
|
61647
|
+
const url = parseUrl(input);
|
|
61648
|
+
let inputType = url.type;
|
|
61649
|
+
if (base && inputType !== 7) {
|
|
61650
|
+
const baseUrl = parseUrl(base);
|
|
61651
|
+
const baseType = baseUrl.type;
|
|
61652
|
+
switch (inputType) {
|
|
61653
|
+
case 1: url.hash = baseUrl.hash;
|
|
61654
|
+
case 2: url.query = baseUrl.query;
|
|
61655
|
+
case 3:
|
|
61656
|
+
case 4: mergePaths(url, baseUrl);
|
|
61657
|
+
case 5:
|
|
61658
|
+
url.user = baseUrl.user;
|
|
61659
|
+
url.host = baseUrl.host;
|
|
61660
|
+
url.port = baseUrl.port;
|
|
61661
|
+
case 6: url.scheme = baseUrl.scheme;
|
|
61662
|
+
}
|
|
61663
|
+
if (baseType > inputType) inputType = baseType;
|
|
61664
|
+
}
|
|
61665
|
+
normalizePath(url, inputType);
|
|
61666
|
+
const queryHash = url.query + url.hash;
|
|
61667
|
+
switch (inputType) {
|
|
61668
|
+
case 2:
|
|
61669
|
+
case 3: return queryHash;
|
|
61670
|
+
case 4: {
|
|
61671
|
+
const path = url.path.slice(1);
|
|
61672
|
+
if (!path) return queryHash || ".";
|
|
61673
|
+
if (isRelative(base || input) && !isRelative(path)) return "./" + path + queryHash;
|
|
61674
|
+
return path + queryHash;
|
|
61675
|
+
}
|
|
61676
|
+
case 5: return url.path + queryHash;
|
|
61677
|
+
default: return url.scheme + "//" + url.user + url.host + url.port + url.path + queryHash;
|
|
61678
|
+
}
|
|
61679
|
+
}
|
|
61680
|
+
//#endregion
|
|
61681
|
+
//#region ../../node_modules/.pnpm/@jridgewell+trace-mapping@0.3.31/node_modules/@jridgewell/trace-mapping/dist/trace-mapping.mjs
|
|
61682
|
+
function stripFilename(path) {
|
|
61683
|
+
if (!path) return "";
|
|
61684
|
+
const index = path.lastIndexOf("/");
|
|
61685
|
+
return path.slice(0, index + 1);
|
|
61686
|
+
}
|
|
61687
|
+
function resolver(mapUrl, sourceRoot) {
|
|
61688
|
+
const from = stripFilename(mapUrl);
|
|
61689
|
+
const prefix = sourceRoot ? sourceRoot + "/" : "";
|
|
61690
|
+
return (source) => resolve(prefix + (source || ""), from);
|
|
61691
|
+
}
|
|
61692
|
+
var COLUMN = 0;
|
|
61693
|
+
var SOURCES_INDEX = 1;
|
|
61694
|
+
var SOURCE_LINE = 2;
|
|
61695
|
+
var SOURCE_COLUMN = 3;
|
|
61696
|
+
var NAMES_INDEX = 4;
|
|
61697
|
+
function maybeSort(mappings, owned) {
|
|
61698
|
+
const unsortedIndex = nextUnsortedSegmentLine(mappings, 0);
|
|
61699
|
+
if (unsortedIndex === mappings.length) return mappings;
|
|
61700
|
+
if (!owned) mappings = mappings.slice();
|
|
61701
|
+
for (let i = unsortedIndex; i < mappings.length; i = nextUnsortedSegmentLine(mappings, i + 1)) mappings[i] = sortSegments(mappings[i], owned);
|
|
61702
|
+
return mappings;
|
|
61703
|
+
}
|
|
61704
|
+
function nextUnsortedSegmentLine(mappings, start) {
|
|
61705
|
+
for (let i = start; i < mappings.length; i++) if (!isSorted(mappings[i])) return i;
|
|
61706
|
+
return mappings.length;
|
|
61707
|
+
}
|
|
61708
|
+
function isSorted(line) {
|
|
61709
|
+
for (let j = 1; j < line.length; j++) if (line[j][COLUMN] < line[j - 1][COLUMN]) return false;
|
|
61710
|
+
return true;
|
|
61711
|
+
}
|
|
61712
|
+
function sortSegments(line, owned) {
|
|
61713
|
+
if (!owned) line = line.slice();
|
|
61714
|
+
return line.sort(sortComparator);
|
|
61715
|
+
}
|
|
61716
|
+
function sortComparator(a, b) {
|
|
61717
|
+
return a[COLUMN] - b[COLUMN];
|
|
61718
|
+
}
|
|
61719
|
+
var found = false;
|
|
61720
|
+
function binarySearch(haystack, needle, low, high) {
|
|
61721
|
+
while (low <= high) {
|
|
61722
|
+
const mid = low + (high - low >> 1);
|
|
61723
|
+
const cmp = haystack[mid][COLUMN] - needle;
|
|
61724
|
+
if (cmp === 0) {
|
|
61725
|
+
found = true;
|
|
61726
|
+
return mid;
|
|
61727
|
+
}
|
|
61728
|
+
if (cmp < 0) low = mid + 1;
|
|
61729
|
+
else high = mid - 1;
|
|
61730
|
+
}
|
|
61731
|
+
found = false;
|
|
61732
|
+
return low - 1;
|
|
61733
|
+
}
|
|
61734
|
+
function upperBound(haystack, needle, index) {
|
|
61735
|
+
for (let i = index + 1; i < haystack.length; index = i++) if (haystack[i][COLUMN] !== needle) break;
|
|
61736
|
+
return index;
|
|
61737
|
+
}
|
|
61738
|
+
function lowerBound(haystack, needle, index) {
|
|
61739
|
+
for (let i = index - 1; i >= 0; index = i--) if (haystack[i][COLUMN] !== needle) break;
|
|
61740
|
+
return index;
|
|
61741
|
+
}
|
|
61742
|
+
function memoizedState() {
|
|
61743
|
+
return {
|
|
61744
|
+
lastKey: -1,
|
|
61745
|
+
lastNeedle: -1,
|
|
61746
|
+
lastIndex: -1
|
|
61747
|
+
};
|
|
61748
|
+
}
|
|
61749
|
+
function memoizedBinarySearch(haystack, needle, state, key) {
|
|
61750
|
+
const { lastKey, lastNeedle, lastIndex } = state;
|
|
61751
|
+
let low = 0;
|
|
61752
|
+
let high = haystack.length - 1;
|
|
61753
|
+
if (key === lastKey) {
|
|
61754
|
+
if (needle === lastNeedle) {
|
|
61755
|
+
found = lastIndex !== -1 && haystack[lastIndex][COLUMN] === needle;
|
|
61756
|
+
return lastIndex;
|
|
61757
|
+
}
|
|
61758
|
+
if (needle >= lastNeedle) low = lastIndex === -1 ? 0 : lastIndex;
|
|
61759
|
+
else high = lastIndex;
|
|
61760
|
+
}
|
|
61761
|
+
state.lastKey = key;
|
|
61762
|
+
state.lastNeedle = needle;
|
|
61763
|
+
return state.lastIndex = binarySearch(haystack, needle, low, high);
|
|
61764
|
+
}
|
|
61765
|
+
function parse(map) {
|
|
61766
|
+
return typeof map === "string" ? JSON.parse(map) : map;
|
|
61767
|
+
}
|
|
61768
|
+
var LINE_GTR_ZERO = "`line` must be greater than 0 (lines start at line 1)";
|
|
61769
|
+
var COL_GTR_EQ_ZERO = "`column` must be greater than or equal to 0 (columns start at column 0)";
|
|
61770
|
+
var TraceMap = class {
|
|
61771
|
+
constructor(map, mapUrl) {
|
|
61772
|
+
const isString = typeof map === "string";
|
|
61773
|
+
if (!isString && map._decodedMemo) return map;
|
|
61774
|
+
const parsed = parse(map);
|
|
61775
|
+
const { version, file, names, sourceRoot, sources, sourcesContent } = parsed;
|
|
61776
|
+
this.version = version;
|
|
61777
|
+
this.file = file;
|
|
61778
|
+
this.names = names || [];
|
|
61779
|
+
this.sourceRoot = sourceRoot;
|
|
61780
|
+
this.sources = sources;
|
|
61781
|
+
this.sourcesContent = sourcesContent;
|
|
61782
|
+
this.ignoreList = parsed.ignoreList || parsed.x_google_ignoreList || void 0;
|
|
61783
|
+
const resolve = resolver(mapUrl, sourceRoot);
|
|
61784
|
+
this.resolvedSources = sources.map(resolve);
|
|
61785
|
+
const { mappings } = parsed;
|
|
61786
|
+
if (typeof mappings === "string") {
|
|
61787
|
+
this._encoded = mappings;
|
|
61788
|
+
this._decoded = void 0;
|
|
61789
|
+
} else if (Array.isArray(mappings)) {
|
|
61790
|
+
this._encoded = void 0;
|
|
61791
|
+
this._decoded = maybeSort(mappings, isString);
|
|
61792
|
+
} else if (parsed.sections) throw new Error(`TraceMap passed sectioned source map, please use FlattenMap export instead`);
|
|
61793
|
+
else throw new Error(`invalid source map: ${JSON.stringify(parsed)}`);
|
|
61794
|
+
this._decodedMemo = memoizedState();
|
|
61795
|
+
this._bySources = void 0;
|
|
61796
|
+
this._bySourceMemos = void 0;
|
|
61797
|
+
}
|
|
61798
|
+
};
|
|
61799
|
+
function cast(map) {
|
|
61800
|
+
return map;
|
|
61801
|
+
}
|
|
61802
|
+
function decodedMappings(map) {
|
|
61803
|
+
var _a;
|
|
61804
|
+
return (_a = cast(map))._decoded || (_a._decoded = decode(cast(map)._encoded));
|
|
61805
|
+
}
|
|
61806
|
+
function originalPositionFor(map, needle) {
|
|
61807
|
+
let { line, column, bias } = needle;
|
|
61808
|
+
line--;
|
|
61809
|
+
if (line < 0) throw new Error(LINE_GTR_ZERO);
|
|
61810
|
+
if (column < 0) throw new Error(COL_GTR_EQ_ZERO);
|
|
61811
|
+
const decoded = decodedMappings(map);
|
|
61812
|
+
if (line >= decoded.length) return OMapping(null, null, null, null);
|
|
61813
|
+
const segments = decoded[line];
|
|
61814
|
+
const index = traceSegmentInternal(segments, cast(map)._decodedMemo, line, column, bias || 1);
|
|
61815
|
+
if (index === -1) return OMapping(null, null, null, null);
|
|
61816
|
+
const segment = segments[index];
|
|
61817
|
+
if (segment.length === 1) return OMapping(null, null, null, null);
|
|
61818
|
+
const { names, resolvedSources } = map;
|
|
61819
|
+
return OMapping(resolvedSources[segment[SOURCES_INDEX]], segment[SOURCE_LINE] + 1, segment[SOURCE_COLUMN], segment.length === 5 ? names[segment[NAMES_INDEX]] : null);
|
|
61820
|
+
}
|
|
61821
|
+
function OMapping(source, line, column, name) {
|
|
61822
|
+
return {
|
|
61823
|
+
source,
|
|
61824
|
+
line,
|
|
61825
|
+
column,
|
|
61826
|
+
name
|
|
61827
|
+
};
|
|
61828
|
+
}
|
|
61829
|
+
function traceSegmentInternal(segments, memo, line, column, bias) {
|
|
61830
|
+
let index = memoizedBinarySearch(segments, column, memo, line);
|
|
61831
|
+
if (found) index = (bias === -1 ? upperBound : lowerBound)(segments, column, index);
|
|
61832
|
+
else if (bias === -1) index++;
|
|
61833
|
+
if (index === -1 || index === segments.length) return -1;
|
|
61834
|
+
return index;
|
|
61835
|
+
}
|
|
61836
|
+
//#endregion
|
|
61414
61837
|
//#region ../core/dist/index.js
|
|
61415
61838
|
var __create = Object.create;
|
|
61416
61839
|
var __defProp = Object.defineProperty;
|
|
@@ -61480,7 +61903,7 @@ var AmbiguousProjectError = class extends Error {
|
|
|
61480
61903
|
};
|
|
61481
61904
|
const isProjectDiscoveryError = (value) => value instanceof ProjectNotFoundError || value instanceof NoReactDependencyError || value instanceof PackageJsonNotFoundError || value instanceof NotADirectoryError || value instanceof AmbiguousProjectError;
|
|
61482
61905
|
const HTML_FILE_PATTERN = /\.html$/i;
|
|
61483
|
-
const SOURCE_FILE_PATTERN = /\.(?:tsx?|jsx?|mts|mjs|[hH][tT][mM][lL])$/;
|
|
61906
|
+
const SOURCE_FILE_PATTERN = /\.(?:astro|tsx?|jsx?|mts|mjs|[hH][tT][mM][lL])$/;
|
|
61484
61907
|
const GENERATED_BUNDLE_FILE_PATTERN = /\.(iife|umd|global|min)\.m?js$/i;
|
|
61485
61908
|
const GENERATED_SOURCE_DIRECTORY_PATTERN = /(?:^|\/)__generated__\//;
|
|
61486
61909
|
const MINIFIED_SNIFF_BYTES = 65536;
|
|
@@ -62231,6 +62654,7 @@ const FRAMEWORK_PACKAGES = {
|
|
|
62231
62654
|
"@tanstack/react-start": "tanstack-start",
|
|
62232
62655
|
"@remix-run/react": "remix",
|
|
62233
62656
|
gatsby: "gatsby",
|
|
62657
|
+
astro: "astro",
|
|
62234
62658
|
vite: "vite",
|
|
62235
62659
|
"react-scripts": "cra",
|
|
62236
62660
|
expo: "expo",
|
|
@@ -65302,7 +65726,7 @@ const evaluateSuppression = (lines, diagnosticLineIndex, ruleId) => {
|
|
|
65302
65726
|
const getDiagnosticRuleIdentity = (diagnostic) => ({
|
|
65303
65727
|
ruleKey: `${diagnostic.plugin}/${diagnostic.rule}`,
|
|
65304
65728
|
category: diagnostic.category,
|
|
65305
|
-
tags: diagnostic.plugin === "react-doctor" ?
|
|
65729
|
+
tags: diagnostic.plugin === "react-doctor" ? REACT_DOCTOR_RULE_REGISTRY[diagnostic.rule]?.tags ?? [] : []
|
|
65306
65730
|
});
|
|
65307
65731
|
const compileIgnoredFilePatterns = (userConfig) => {
|
|
65308
65732
|
const files = userConfig?.ignore?.files;
|
|
@@ -65438,6 +65862,7 @@ const classifyPackageRole = (filename) => {
|
|
|
65438
65862
|
* Resolves the absolute path to read for a diagnostic's `filePath`,
|
|
65439
65863
|
* accounting for the various shapes oxlint emits:
|
|
65440
65864
|
*
|
|
65865
|
+
* - `file://` URL — decode to an absolute filesystem path.
|
|
65441
65866
|
* - Absolute POSIX (`/abs/path/file.tsx`) — pass through.
|
|
65442
65867
|
* - Absolute Windows (`C:/...` or `C:\...`) — pass through.
|
|
65443
65868
|
* - `./relative` or bare relative — join against `rootDirectory`.
|
|
@@ -65447,6 +65872,7 @@ const classifyPackageRole = (filename) => {
|
|
|
65447
65872
|
* use one canonical resolution path.
|
|
65448
65873
|
*/
|
|
65449
65874
|
const resolveCandidateReadPath = (rootDirectory, filePath) => {
|
|
65875
|
+
if (filePath.startsWith("file://")) return fileURLToPath(filePath);
|
|
65450
65876
|
const normalizedFile = filePath.replace(/\\/g, "/");
|
|
65451
65877
|
if (normalizedFile.startsWith("/") || /^[a-zA-Z]:\//.test(normalizedFile) || /^[a-zA-Z]:\\/.test(filePath)) return filePath;
|
|
65452
65878
|
return `${rootDirectory.replace(/\\/g, "/").replace(/\/$/, "")}/${normalizedFile.replace(/^\.\//, "")}`;
|
|
@@ -65648,7 +66074,7 @@ const buildDiagnosticPipeline = (input) => {
|
|
|
65648
66074
|
};
|
|
65649
66075
|
const shouldAutoSuppress = (diagnostic) => {
|
|
65650
66076
|
if (diagnostic.plugin !== "react-doctor") return false;
|
|
65651
|
-
const rule =
|
|
66077
|
+
const rule = REACT_DOCTOR_RULE_REGISTRY[diagnostic.rule];
|
|
65652
66078
|
if (!rule?.tags?.includes("test-noise")) return false;
|
|
65653
66079
|
if (rule.tags.includes("migration-hint")) return false;
|
|
65654
66080
|
return getFileContext(diagnostic.filePath) !== "production";
|
|
@@ -66058,6 +66484,7 @@ var OxlintConcurrency = class extends Reference("react-doctor/OxlintConcurrency"
|
|
|
66058
66484
|
if (Number.isInteger(parsed) && parsed > 0) return resolveScanConcurrency(parsed);
|
|
66059
66485
|
return resolveAutoScanConcurrency();
|
|
66060
66486
|
} }) {};
|
|
66487
|
+
var OxlintSpawnSlots = class extends Reference("react-doctor/OxlintSpawnSlots", { defaultValue: () => null }) {};
|
|
66061
66488
|
/**
|
|
66062
66489
|
* Three-state control for overlapping the dead-code pass with the lint pass —
|
|
66063
66490
|
* forking dead-code as a child fiber that runs DURING lint instead of strictly
|
|
@@ -68332,8 +68759,8 @@ const getCapabilities = (project) => {
|
|
|
68332
68759
|
const cached = capabilitiesByProject.get(project);
|
|
68333
68760
|
if (cached !== void 0) return cached;
|
|
68334
68761
|
const capabilities = new Set(buildCapabilities(project));
|
|
68335
|
-
const
|
|
68336
|
-
const targetBlankOpenerProtection = detectTargetBlankOpenerProtection(
|
|
68762
|
+
const capabilityRootDirectory = isFile(Path.join(project.rootDirectory, "package.json")) ? project.rootDirectory : findNearestAncestorPackageJson(project.rootDirectory) ?? project.rootDirectory;
|
|
68763
|
+
const targetBlankOpenerProtection = detectTargetBlankOpenerProtection(capabilityRootDirectory, readPackageJson(Path.join(capabilityRootDirectory, "package.json")));
|
|
68337
68764
|
if (targetBlankOpenerProtection !== void 0) capabilities.add("target-blank-needs-explicit-protection");
|
|
68338
68765
|
if (targetBlankOpenerProtection === "noreferrer") capabilities.add("target-blank-needs-noreferrer");
|
|
68339
68766
|
capabilitiesByProject.set(project, capabilities);
|
|
@@ -68363,7 +68790,7 @@ const createSecurityScanSession = (rootDirectory, options) => {
|
|
|
68363
68790
|
const capabilities = options.project ? getCapabilities(options.project) : /* @__PURE__ */ new Set();
|
|
68364
68791
|
const ignoredTags = options.ignoredTags ?? /* @__PURE__ */ new Set();
|
|
68365
68792
|
const includedTags = options.includedTags ?? /* @__PURE__ */ new Set();
|
|
68366
|
-
const enabledScanRules =
|
|
68793
|
+
const enabledScanRules = REACT_DOCTOR_SCAN_RULES.flatMap((entry) => {
|
|
68367
68794
|
const rule = entry.rule;
|
|
68368
68795
|
const scan = rule.scan;
|
|
68369
68796
|
if (typeof scan !== "function") return [];
|
|
@@ -68808,47 +69235,55 @@ const resolveDeadCodeConcurrency = (facts = readSystemFacts()) => {
|
|
|
68808
69235
|
const memoryBoundedWorkers = Math.floor(availableMemoryBytes / DEAD_CODE_WORKER_MEM_BUDGET_BYTES);
|
|
68809
69236
|
return Math.max(1, Math.min(facts.availableCores, memoryBoundedWorkers));
|
|
68810
69237
|
};
|
|
68811
|
-
|
|
68812
|
-
|
|
68813
|
-
const
|
|
68814
|
-
const
|
|
68815
|
-
|
|
68816
|
-
|
|
69238
|
+
const createWorkerSlots = (input) => {
|
|
69239
|
+
let availableSlotCount = input.slotCount;
|
|
69240
|
+
const waiters = [];
|
|
69241
|
+
const releaseSlot = () => {
|
|
69242
|
+
const nextWaiter = waiters.shift();
|
|
69243
|
+
if (nextWaiter === void 0) {
|
|
69244
|
+
availableSlotCount += 1;
|
|
69245
|
+
return;
|
|
69246
|
+
}
|
|
69247
|
+
nextWaiter.abortSignal?.removeEventListener("abort", nextWaiter.onAbort);
|
|
69248
|
+
nextWaiter.resolve();
|
|
69249
|
+
};
|
|
69250
|
+
const acquireSlot = async (abortSignal) => {
|
|
69251
|
+
if (abortSignal?.aborted) throw input.createAbortError();
|
|
69252
|
+
if (availableSlotCount > 0) {
|
|
69253
|
+
availableSlotCount -= 1;
|
|
69254
|
+
return;
|
|
69255
|
+
}
|
|
69256
|
+
await new Promise((resolve, reject) => {
|
|
69257
|
+
const onAbort = () => {
|
|
69258
|
+
const waiterIndex = waiters.indexOf(waiter);
|
|
69259
|
+
if (waiterIndex !== -1) waiters.splice(waiterIndex, 1);
|
|
69260
|
+
reject(input.createAbortError());
|
|
69261
|
+
};
|
|
69262
|
+
const waiter = {
|
|
69263
|
+
resolve,
|
|
69264
|
+
abortSignal,
|
|
69265
|
+
onAbort
|
|
69266
|
+
};
|
|
69267
|
+
waiters.push(waiter);
|
|
69268
|
+
abortSignal?.addEventListener("abort", onAbort, { once: true });
|
|
69269
|
+
});
|
|
69270
|
+
};
|
|
69271
|
+
return { run: async (task, abortSignal) => {
|
|
69272
|
+
await acquireSlot(abortSignal);
|
|
69273
|
+
try {
|
|
69274
|
+
return await task();
|
|
69275
|
+
} finally {
|
|
69276
|
+
releaseSlot();
|
|
69277
|
+
}
|
|
69278
|
+
} };
|
|
68817
69279
|
};
|
|
68818
|
-
|
|
68819
|
-
* Runs `task` once a dead-code worker slot is free, releasing the slot when the
|
|
68820
|
-
* task settles (success or failure). With a high cap (roomy machine) every
|
|
68821
|
-
* caller proceeds immediately; with a low cap (constrained runner) callers
|
|
68822
|
-
* queue and run as slots free.
|
|
68823
|
-
*
|
|
68824
|
-
* `abortSignal` short-circuits the WAIT: if it's already aborted, or fires while
|
|
68825
|
-
* this caller is queued, the call rejects without acquiring a slot or running
|
|
68826
|
-
* `task` — so a cancelled scan (e.g. lint failed) doesn't sit in the queue and
|
|
68827
|
-
* then spawn a child only to tear it down. A queued caller that aborts removes
|
|
68828
|
-
* its own waiter so a later release never hands a slot to a dead request.
|
|
68829
|
-
*/
|
|
69280
|
+
let deadCodeWorkerSlots = null;
|
|
68830
69281
|
const withDeadCodeWorkerSlot = async (task, abortSignal) => {
|
|
68831
|
-
|
|
68832
|
-
|
|
68833
|
-
|
|
68834
|
-
else await new Promise((resolve, reject) => {
|
|
68835
|
-
const waiter = () => {
|
|
68836
|
-
abortSignal?.removeEventListener("abort", onAbort);
|
|
68837
|
-
resolve();
|
|
68838
|
-
};
|
|
68839
|
-
const onAbort = () => {
|
|
68840
|
-
const queuedIndex = waiters.indexOf(waiter);
|
|
68841
|
-
if (queuedIndex !== -1) waiters.splice(queuedIndex, 1);
|
|
68842
|
-
reject(/* @__PURE__ */ new Error("Dead-code worker aborted."));
|
|
68843
|
-
};
|
|
68844
|
-
waiters.push(waiter);
|
|
68845
|
-
abortSignal?.addEventListener("abort", onAbort, { once: true });
|
|
69282
|
+
deadCodeWorkerSlots ??= createWorkerSlots({
|
|
69283
|
+
slotCount: resolveDeadCodeConcurrency(),
|
|
69284
|
+
createAbortError: () => /* @__PURE__ */ new Error("Dead-code worker aborted.")
|
|
68846
69285
|
});
|
|
68847
|
-
|
|
68848
|
-
return await task();
|
|
68849
|
-
} finally {
|
|
68850
|
-
releaseSlot();
|
|
68851
|
-
}
|
|
69286
|
+
return deadCodeWorkerSlots.run(task, abortSignal);
|
|
68852
69287
|
};
|
|
68853
69288
|
const projectCacheSubdir = (projectDirectory) => crypto.createHash("sha256").update(projectDirectory).digest("hex").slice(0, 16);
|
|
68854
69289
|
const resolveReactDoctorCacheDir = (projectDirectory) => {
|
|
@@ -69641,7 +70076,10 @@ var Git = class Git extends Service()("react-doctor/Git") {
|
|
|
69641
70076
|
if (argvLengthChars > spawnArgsLengthCap) return yield* foldSpawnFailure(`spawn ENAMETOOLONG (${argvLengthChars} argv chars exceed ${spawnArgsLengthCap})`);
|
|
69642
70077
|
const handle = yield* spawner.spawn(make$1(input.command, [...input.args], {
|
|
69643
70078
|
cwd: input.directory,
|
|
69644
|
-
env: input.
|
|
70079
|
+
env: input.command === "git" ? {
|
|
70080
|
+
...input.env,
|
|
70081
|
+
GIT_DIR: void 0
|
|
70082
|
+
} : input.env,
|
|
69645
70083
|
extendEnv: true
|
|
69646
70084
|
}));
|
|
69647
70085
|
const maxStdoutBytes = input.maxStdoutBytes;
|
|
@@ -69914,7 +70352,7 @@ var Git = class Git extends Service()("react-doctor/Git") {
|
|
|
69914
70352
|
"--diff-filter=ACMR",
|
|
69915
70353
|
"--relative"
|
|
69916
70354
|
]).pipe(map$3((result) => {
|
|
69917
|
-
if (result.status !== 0) return
|
|
70355
|
+
if (result.status !== 0) return null;
|
|
69918
70356
|
return splitNullSeparated(result.stdout);
|
|
69919
70357
|
})),
|
|
69920
70358
|
showStagedContent: (directory, relativePath, options) => runCommand({
|
|
@@ -70372,12 +70810,12 @@ const createOxlintConfig = ({ pluginPath, project, customRulesOnly = false, exte
|
|
|
70372
70810
|
const settingsRootDirectory = resolveSettingsRootDirectory(project.rootDirectory);
|
|
70373
70811
|
const enabledReactDoctorRules = {};
|
|
70374
70812
|
for (const registryEntry of REACT_DOCTOR_RULES) {
|
|
70375
|
-
const rule =
|
|
70813
|
+
const rule = REACT_DOCTOR_RULE_REGISTRY[registryEntry.id];
|
|
70376
70814
|
if (!rule) continue;
|
|
70377
70815
|
if (ruleSelection === "cacheable" && CROSS_FILE_RULE_IDS.has(registryEntry.id)) continue;
|
|
70378
70816
|
if (ruleSelection === "sidecar" && !CROSS_FILE_RULE_IDS.has(registryEntry.id)) continue;
|
|
70379
70817
|
if (ruleSelection === "sidecar" && sidecarRuleIdFilter !== void 0 && !sidecarRuleIdFilter.has(registryEntry.id)) continue;
|
|
70380
|
-
if (rule.
|
|
70818
|
+
if (rule.isScanRule) continue;
|
|
70381
70819
|
if (customRulesOnly && registryEntry.originallyExternal) continue;
|
|
70382
70820
|
if (rule.framework !== "global" && !rule.requires) continue;
|
|
70383
70821
|
if (!shouldEnableRule(rule.requires, rule.tags, capabilities, ignoredTags, rule.disabledWhen, includedTags)) continue;
|
|
@@ -71002,6 +71440,50 @@ const columnOfUtf8Offset = (sourceBuffer, utf8Offset) => {
|
|
|
71002
71440
|
while (lineStartOffset > 0 && sourceBuffer[lineStartOffset - 1] !== 10) lineStartOffset--;
|
|
71003
71441
|
return sourceBuffer.subarray(lineStartOffset, boundedOffset).toString("utf8").length + 1;
|
|
71004
71442
|
};
|
|
71443
|
+
const utf8OffsetFromSourcePosition = (sourceBuffer, lineNumber, zeroBasedColumn) => {
|
|
71444
|
+
if (lineNumber < 1 || zeroBasedColumn < 0) return null;
|
|
71445
|
+
const sourceLines = sourceBuffer.toString("utf8").split("\n");
|
|
71446
|
+
const sourceLine = sourceLines[lineNumber - 1];
|
|
71447
|
+
if (sourceLine === void 0 || zeroBasedColumn > sourceLine.length) return null;
|
|
71448
|
+
const precedingLines = sourceLines.slice(0, lineNumber - 1).join("\n");
|
|
71449
|
+
return (lineNumber === 1 ? 0 : Buffer.byteLength(precedingLines) + Buffer.byteLength("\n")) + Buffer.byteLength(sourceLine.slice(0, zeroBasedColumn));
|
|
71450
|
+
};
|
|
71451
|
+
const mapPreparedSourceSpan = (span, preparedSourceMap) => {
|
|
71452
|
+
const generatedLine = lineOfUtf8Offset(preparedSourceMap.generatedBuffer, span.offset);
|
|
71453
|
+
const generatedColumn = columnOfUtf8Offset(preparedSourceMap.generatedBuffer, span.offset) - 1;
|
|
71454
|
+
const originalStart = originalPositionFor(preparedSourceMap.traceMap, {
|
|
71455
|
+
line: generatedLine,
|
|
71456
|
+
column: generatedColumn
|
|
71457
|
+
});
|
|
71458
|
+
if (originalStart.source === null || originalStart.line === null || originalStart.column === null) return null;
|
|
71459
|
+
const originalOffset = utf8OffsetFromSourcePosition(preparedSourceMap.sourceBuffer, originalStart.line, originalStart.column);
|
|
71460
|
+
if (originalOffset === null) return null;
|
|
71461
|
+
const generatedSpan = preparedSourceMap.generatedBuffer.subarray(span.offset, span.offset + span.length);
|
|
71462
|
+
return {
|
|
71463
|
+
offset: originalOffset,
|
|
71464
|
+
length: preparedSourceMap.sourceBuffer.subarray(originalOffset, originalOffset + generatedSpan.length).equals(generatedSpan) ? generatedSpan.length : 0,
|
|
71465
|
+
line: originalStart.line,
|
|
71466
|
+
column: originalStart.column + 1
|
|
71467
|
+
};
|
|
71468
|
+
};
|
|
71469
|
+
const mapPreparedSourceLabels = (labels, preparedSourceMap) => {
|
|
71470
|
+
const primaryLabel = labels[0];
|
|
71471
|
+
if (primaryLabel === void 0) return null;
|
|
71472
|
+
const primarySpan = mapPreparedSourceSpan(primaryLabel.span, preparedSourceMap);
|
|
71473
|
+
if (primarySpan === null) return null;
|
|
71474
|
+
const mappedLabels = [{
|
|
71475
|
+
...primaryLabel,
|
|
71476
|
+
span: primarySpan
|
|
71477
|
+
}];
|
|
71478
|
+
for (const relatedLabel of labels.slice(1)) {
|
|
71479
|
+
const relatedSpan = mapPreparedSourceSpan(relatedLabel.span, preparedSourceMap);
|
|
71480
|
+
if (relatedSpan !== null) mappedLabels.push({
|
|
71481
|
+
...relatedLabel,
|
|
71482
|
+
span: relatedSpan
|
|
71483
|
+
});
|
|
71484
|
+
}
|
|
71485
|
+
return mappedLabels;
|
|
71486
|
+
};
|
|
71005
71487
|
const REDACTED_PLACEHOLDER = "<redacted>";
|
|
71006
71488
|
const KEEP_PREFIX = `$1${REDACTED_PLACEHOLDER}`;
|
|
71007
71489
|
const KNOWN_SECRET_RULES = [
|
|
@@ -71644,7 +72126,7 @@ const PLUGIN_CATEGORY_MAP = {
|
|
|
71644
72126
|
};
|
|
71645
72127
|
const lookupOwnString = (record, key) => Object.hasOwn(record, key) ? record[key] : void 0;
|
|
71646
72128
|
const getRuleRecommendation = (ruleName, project) => {
|
|
71647
|
-
const rule =
|
|
72129
|
+
const rule = REACT_DOCTOR_RULE_REGISTRY[ruleName];
|
|
71648
72130
|
if (!rule) return void 0;
|
|
71649
72131
|
if (rule.recommendationFor) {
|
|
71650
72132
|
const capabilities = getCapabilities(project);
|
|
@@ -71653,8 +72135,8 @@ const getRuleRecommendation = (ruleName, project) => {
|
|
|
71653
72135
|
}
|
|
71654
72136
|
return rule.recommendation;
|
|
71655
72137
|
};
|
|
71656
|
-
const getRuleCategory = (ruleName) =>
|
|
71657
|
-
const getRuleTitle = (ruleName) =>
|
|
72138
|
+
const getRuleCategory = (ruleName) => REACT_DOCTOR_RULE_REGISTRY[ruleName]?.category;
|
|
72139
|
+
const getRuleTitle = (ruleName) => REACT_DOCTOR_RULE_REGISTRY[ruleName]?.title;
|
|
71658
72140
|
const resolveDiagnosticTitle = (plugin, rule) => {
|
|
71659
72141
|
if (plugin !== "react-hooks-js") return getRuleTitle(rule);
|
|
71660
72142
|
if (rule === "error-boundaries") return REACT_ERROR_BOUNDARY_TITLE;
|
|
@@ -71709,7 +72191,7 @@ const resolveDiagnosticCategory = (plugin, rule) => {
|
|
|
71709
72191
|
if (plugin === "react-hooks-js" && rule === "error-boundaries") return "Bugs";
|
|
71710
72192
|
return getRuleCategory(rule) ?? lookupOwnString(PLUGIN_CATEGORY_MAP, plugin) ?? "Bugs";
|
|
71711
72193
|
};
|
|
71712
|
-
const resolveMatchByOccurrence = (rule, category) => OCCURRENCE_MATCHED_CATEGORIES.has(category) || Boolean(
|
|
72194
|
+
const resolveMatchByOccurrence = (rule, category) => OCCURRENCE_MATCHED_CATEGORIES.has(category) || Boolean(REACT_DOCTOR_RULE_REGISTRY[rule]?.matchByOccurrence);
|
|
71713
72195
|
/**
|
|
71714
72196
|
* Maps oxlint's non-primary labels (`labels[1..]`) into related source
|
|
71715
72197
|
* locations. Editors surface these as a diagnostic's
|
|
@@ -71746,7 +72228,7 @@ const isOxlintOutput = (value) => isRecord(value) && Array.isArray(value.diagnos
|
|
|
71746
72228
|
* to the first `{`. Raises `OxlintOutputUnparseable` when the
|
|
71747
72229
|
* stdout isn't valid JSON or doesn't carry a `diagnostics` array.
|
|
71748
72230
|
*/
|
|
71749
|
-
const parseOxlintOutput = (stdout, project, rootDirectory, sourcePathByLintPath) => {
|
|
72231
|
+
const parseOxlintOutput = (stdout, project, rootDirectory, sourcePathByLintPath, sourceMapByLintPath) => {
|
|
71750
72232
|
if (!stdout) return [];
|
|
71751
72233
|
const jsonStart = stdout.indexOf("{");
|
|
71752
72234
|
const sanitizedStdout = jsonStart > 0 ? stdout.slice(jsonStart) : stdout;
|
|
@@ -71764,6 +72246,7 @@ const parseOxlintOutput = (stdout, project, rootDirectory, sourcePathByLintPath)
|
|
|
71764
72246
|
const sourceLinesCache = /* @__PURE__ */ new Map();
|
|
71765
72247
|
const resolveAbsolutePath = (filename) => Path.isAbsolute(filename) ? filename : Path.resolve(rootDirectory || ".", filename);
|
|
71766
72248
|
const resolveMappedSourceFilename = (filename) => sourcePathByLintPath?.get(Path.normalize(resolveAbsolutePath(filename)));
|
|
72249
|
+
const resolvePreparedSourceMap = (filename) => sourceMapByLintPath?.get(Path.normalize(resolveAbsolutePath(filename)));
|
|
71767
72250
|
const resolveSourceFilename = (filename) => resolveMappedSourceFilename(filename) ?? filename;
|
|
71768
72251
|
const readSourceBuffer = (filename) => {
|
|
71769
72252
|
const absolutePath = resolveAbsolutePath(resolveSourceFilename(filename));
|
|
@@ -71795,7 +72278,19 @@ const parseOxlintOutput = (stdout, project, rootDirectory, sourcePathByLintPath)
|
|
|
71795
72278
|
minifiedFileCache.set(absolutePath, minified);
|
|
71796
72279
|
return minified;
|
|
71797
72280
|
};
|
|
71798
|
-
return suppressMemoizationInBailedOutFunctions(parsed.diagnostics.
|
|
72281
|
+
return suppressMemoizationInBailedOutFunctions(parsed.diagnostics.flatMap((diagnostic) => {
|
|
72282
|
+
const preparedSourceMap = resolvePreparedSourceMap(diagnostic.filename);
|
|
72283
|
+
if (preparedSourceMap === void 0) return [diagnostic];
|
|
72284
|
+
const { plugin, rule } = parseRuleCode(diagnostic.code);
|
|
72285
|
+
if (plugin !== "react-doctor" || !REACT_DOCTOR_RULE_REGISTRY[rule]?.tags?.includes("design")) return [];
|
|
72286
|
+
const labels = mapPreparedSourceLabels(diagnostic.labels, preparedSourceMap);
|
|
72287
|
+
const sourceFilename = resolveMappedSourceFilename(diagnostic.filename);
|
|
72288
|
+
return labels === null || sourceFilename === void 0 ? [] : [{
|
|
72289
|
+
...diagnostic,
|
|
72290
|
+
filename: sourceFilename,
|
|
72291
|
+
labels
|
|
72292
|
+
}];
|
|
72293
|
+
}).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) => {
|
|
71799
72294
|
const { plugin, rule } = parseRuleCode(diagnostic.code);
|
|
71800
72295
|
const primaryLabel = diagnostic.labels[0];
|
|
71801
72296
|
const cleaned = cleanDiagnosticMessage(diagnostic.message, diagnostic.help, plugin, rule, project);
|
|
@@ -71873,11 +72368,12 @@ const SANITIZED_ENV = buildOxlintChildEnv(process.env);
|
|
|
71873
72368
|
* The first three are splittable (the caller's binary-split retry
|
|
71874
72369
|
* shrinks the batch and re-spawns); the fourth isn't.
|
|
71875
72370
|
*/
|
|
71876
|
-
const spawnOxlint = (args, rootDirectory, nodeBinaryPath, spawnTimeoutMs = OXLINT_SPAWN_TIMEOUT_MS, outputMaxBytes = OXLINT_OUTPUT_MAX_BYTES, abortSignal) => new Promise((resolve, reject) => {
|
|
72371
|
+
const spawnOxlint = (args, rootDirectory, nodeBinaryPath, spawnTimeoutMs = OXLINT_SPAWN_TIMEOUT_MS, outputMaxBytes = OXLINT_OUTPUT_MAX_BYTES, abortSignal, onSpawn) => new Promise((resolve, reject) => {
|
|
71877
72372
|
if (abortSignal?.aborted) {
|
|
71878
72373
|
reject(new ReactDoctorError({ reason: new OxlintSpawnFailed({ cause: "lint phase aborted" }) }));
|
|
71879
72374
|
return;
|
|
71880
72375
|
}
|
|
72376
|
+
onSpawn?.();
|
|
71881
72377
|
const child = spawn(nodeBinaryPath, buildProfiledNodeArguments({
|
|
71882
72378
|
argumentsList: args,
|
|
71883
72379
|
cpuProfileDirectory: SANITIZED_ENV.REACT_DOCTOR_CPU_PROFILE_DIR,
|
|
@@ -72013,7 +72509,7 @@ const isParallelismRelatedSpawnError = (error) => {
|
|
|
72013
72509
|
* loop with a slimmer config in that case.
|
|
72014
72510
|
*/
|
|
72015
72511
|
const spawnLintBatches = async (input) => {
|
|
72016
|
-
const { baseArgs, fileBatches, rootDirectory, nodeBinaryPath, project, sourcePathByLintPath, onPartialFailure, onFileProgress, spawnTimeoutMs, outputMaxBytes, splitTotalBudgetMs = OXLINT_SPLIT_TOTAL_BUDGET_MS, splitMaxDepth = 8, signal, deadlineEpochMs } = input;
|
|
72512
|
+
const { baseArgs, fileBatches, rootDirectory, nodeBinaryPath, project, sourcePathByLintPath, sourceMapByLintPath, onPartialFailure, onFileProgress, spawnTimeoutMs, outputMaxBytes, splitTotalBudgetMs = OXLINT_SPLIT_TOTAL_BUDGET_MS, splitMaxDepth = 8, signal, deadlineEpochMs } = input;
|
|
72017
72513
|
const resolveSourcePath = (filePath) => {
|
|
72018
72514
|
const absoluteFilePath = Path.isAbsolute(filePath) ? filePath : Path.resolve(rootDirectory, filePath);
|
|
72019
72515
|
return sourcePathByLintPath?.get(Path.normalize(absoluteFilePath)) ?? filePath;
|
|
@@ -72037,7 +72533,21 @@ const spawnLintBatches = async (input) => {
|
|
|
72037
72533
|
}
|
|
72038
72534
|
const batchArgs = [...baseArgs, ...batch];
|
|
72039
72535
|
try {
|
|
72040
|
-
|
|
72536
|
+
const spawnBatch = () => {
|
|
72537
|
+
if (isPastDeadline()) {
|
|
72538
|
+
deadlineSkippedFiles.push(...batch);
|
|
72539
|
+
batchState.deadlineSkippedFileCount += batch.length;
|
|
72540
|
+
return Promise.resolve(null);
|
|
72541
|
+
}
|
|
72542
|
+
return spawnOxlint(batchArgs, rootDirectory, nodeBinaryPath, spawnTimeoutMs, outputMaxBytes, signal, () => {
|
|
72543
|
+
if (batchState.didStart) return;
|
|
72544
|
+
batchState.didStart = true;
|
|
72545
|
+
startedFileCount += batchState.initialFileCount;
|
|
72546
|
+
});
|
|
72547
|
+
};
|
|
72548
|
+
const stdout = input.spawnSlots === void 0 ? await spawnBatch() : await input.spawnSlots.run(spawnBatch, signal);
|
|
72549
|
+
if (stdout === null) return [];
|
|
72550
|
+
return parseOxlintOutput(stdout, project, rootDirectory, sourcePathByLintPath, sourceMapByLintPath);
|
|
72041
72551
|
} catch (error) {
|
|
72042
72552
|
if (!isSplittableReactDoctorError(error)) throw error;
|
|
72043
72553
|
if (isPastDeadline()) {
|
|
@@ -72081,14 +72591,15 @@ const spawnLintBatches = async (input) => {
|
|
|
72081
72591
|
deadlineSkippedFiles.push(...batch);
|
|
72082
72592
|
return [];
|
|
72083
72593
|
}
|
|
72084
|
-
startedFileCount += batch.length;
|
|
72085
72594
|
const batchState = {
|
|
72086
72595
|
deadlineMs: null,
|
|
72087
|
-
deadlineSkippedFileCount: 0
|
|
72596
|
+
deadlineSkippedFileCount: 0,
|
|
72597
|
+
didStart: false,
|
|
72598
|
+
initialFileCount: batch.length
|
|
72088
72599
|
};
|
|
72089
72600
|
const batchDiagnostics = await spawnLintBatch(batch, 0, batchState);
|
|
72090
72601
|
scannedFileCount += batch.length - batchState.deadlineSkippedFileCount;
|
|
72091
|
-
if (passOnFileProgress) {
|
|
72602
|
+
if (passOnFileProgress && batchState.didStart) {
|
|
72092
72603
|
displayedFileCount = Math.min(Math.max(displayedFileCount, scannedFileCount), totalFileCount);
|
|
72093
72604
|
passOnFileProgress(displayedFileCount, totalFileCount);
|
|
72094
72605
|
}
|
|
@@ -72172,8 +72683,8 @@ const validateRuleRegistration = () => {
|
|
|
72172
72683
|
for (const fullKey of ALL_REACT_DOCTOR_RULE_KEYS) {
|
|
72173
72684
|
const ruleName = fullKey.replace(/^react-doctor\//, "");
|
|
72174
72685
|
if (!getRuleCategory(ruleName)) missingCategory.push(fullKey);
|
|
72175
|
-
if (!
|
|
72176
|
-
if (FRAMEWORK_SPECIFIC_RULE_KEYS.has(fullKey) && !
|
|
72686
|
+
if (!REACT_DOCTOR_RULE_REGISTRY[ruleName]?.recommendation) missingHelp.push(fullKey);
|
|
72687
|
+
if (FRAMEWORK_SPECIFIC_RULE_KEYS.has(fullKey) && !REACT_DOCTOR_RULE_REGISTRY[ruleName]?.requires) missingMetadata.push(fullKey);
|
|
72177
72688
|
}
|
|
72178
72689
|
if (missingCategory.length === 0 && missingHelp.length === 0 && missingMetadata.length === 0) return;
|
|
72179
72690
|
const detail = [
|
|
@@ -72476,20 +72987,47 @@ const prepareHtmlScriptSource = (sourceBuffer) => {
|
|
|
72476
72987
|
lintBuffer: maskedBuffer ?? sourceBuffer
|
|
72477
72988
|
};
|
|
72478
72989
|
};
|
|
72479
|
-
const
|
|
72990
|
+
const ASTRO_FILE_PATTERN = /\.astro$/;
|
|
72991
|
+
const prepareLintSources = (rootDirectory, temporaryDirectory, candidateFiles) => {
|
|
72480
72992
|
const lintFiles = [];
|
|
72481
72993
|
const sourcePathByLintPath = /* @__PURE__ */ new Map();
|
|
72994
|
+
const sourceMapByLintPath = /* @__PURE__ */ new Map();
|
|
72482
72995
|
const sizeByLintPath = /* @__PURE__ */ new Map();
|
|
72483
72996
|
const htmlSourcesDirectory = Path.join(temporaryDirectory, "html-sources");
|
|
72997
|
+
const astroSourcesDirectory = Path.join(temporaryDirectory, "astro-sources");
|
|
72484
72998
|
let htmlFileIndex = 0;
|
|
72999
|
+
let astroFileIndex = 0;
|
|
72485
73000
|
let hasThreeModuleImport = false;
|
|
72486
73001
|
for (const candidateFile of candidateFiles) {
|
|
72487
|
-
if (!HTML_FILE_PATTERN.test(candidateFile)) {
|
|
73002
|
+
if (!HTML_FILE_PATTERN.test(candidateFile) && !ASTRO_FILE_PATTERN.test(candidateFile)) {
|
|
72488
73003
|
lintFiles.push(candidateFile);
|
|
72489
73004
|
continue;
|
|
72490
73005
|
}
|
|
72491
73006
|
const absoluteSourcePath = Path.isAbsolute(candidateFile) ? candidateFile : Path.resolve(rootDirectory, candidateFile);
|
|
72492
73007
|
const sourceBuffer = NFS.readFileSync(absoluteSourcePath);
|
|
73008
|
+
if (ASTRO_FILE_PATTERN.test(candidateFile)) {
|
|
73009
|
+
const compilerSourcePath = absoluteSourcePath.replaceAll("\\", "/");
|
|
73010
|
+
const convertedSource = convertToTSX(sourceBuffer.toString("utf8"), {
|
|
73011
|
+
filename: compilerSourcePath,
|
|
73012
|
+
sourcemap: "external",
|
|
73013
|
+
includeScripts: true
|
|
73014
|
+
});
|
|
73015
|
+
if (astroFileIndex === 0) NFS.mkdirSync(astroSourcesDirectory, { recursive: true });
|
|
73016
|
+
const lintPath = Path.join(astroSourcesDirectory, `${astroFileIndex}.tsx`);
|
|
73017
|
+
const generatedBuffer = Buffer.from(convertedSource.code);
|
|
73018
|
+
NFS.writeFileSync(lintPath, generatedBuffer);
|
|
73019
|
+
lintFiles.push(candidateFile);
|
|
73020
|
+
lintFiles.push(lintPath);
|
|
73021
|
+
sourcePathByLintPath.set(Path.resolve(lintPath), candidateFile);
|
|
73022
|
+
sourceMapByLintPath.set(Path.resolve(lintPath), {
|
|
73023
|
+
traceMap: new TraceMap(JSON.stringify(convertedSource.map)),
|
|
73024
|
+
generatedBuffer,
|
|
73025
|
+
sourceBuffer
|
|
73026
|
+
});
|
|
73027
|
+
sizeByLintPath.set(lintPath, sourceBuffer.length);
|
|
73028
|
+
astroFileIndex++;
|
|
73029
|
+
continue;
|
|
73030
|
+
}
|
|
72493
73031
|
const { executableScriptBodies, lintBuffer } = prepareHtmlScriptSource(sourceBuffer);
|
|
72494
73032
|
if (htmlFileIndex === 0) NFS.mkdirSync(htmlSourcesDirectory, { recursive: true });
|
|
72495
73033
|
const lintPath = Path.join(htmlSourcesDirectory, `${htmlFileIndex}.astro`);
|
|
@@ -72503,6 +73041,7 @@ const prepareHtmlLintSources = (rootDirectory, temporaryDirectory, candidateFile
|
|
|
72503
73041
|
return {
|
|
72504
73042
|
lintFiles,
|
|
72505
73043
|
sourcePathByLintPath,
|
|
73044
|
+
sourceMapByLintPath,
|
|
72506
73045
|
sizeByLintPath,
|
|
72507
73046
|
hasThreeModuleImport
|
|
72508
73047
|
};
|
|
@@ -72721,10 +73260,10 @@ const runOxlint = async (options) => {
|
|
|
72721
73260
|
rootDirectory,
|
|
72722
73261
|
candidateFiles
|
|
72723
73262
|
});
|
|
72724
|
-
const
|
|
72725
|
-
const lintFiles =
|
|
72726
|
-
const
|
|
72727
|
-
const lintProject = !project.hasThree &&
|
|
73263
|
+
const preparedLintSources = prepareLintSources(rootDirectory, configDirectory, candidateFiles);
|
|
73264
|
+
const lintFiles = preparedLintSources.lintFiles;
|
|
73265
|
+
const hasPreparedFiles = preparedLintSources.sourcePathByLintPath.size > 0;
|
|
73266
|
+
const lintProject = !project.hasThree && preparedLintSources.hasThreeModuleImport ? {
|
|
72728
73267
|
...project,
|
|
72729
73268
|
hasThree: true
|
|
72730
73269
|
} : project;
|
|
@@ -72746,7 +73285,7 @@ const runOxlint = async (options) => {
|
|
|
72746
73285
|
sidecarRuleIdFilter: overrides.sidecarRuleIdFilter
|
|
72747
73286
|
});
|
|
72748
73287
|
const sizeByFile = sizedScanFiles !== null && lintBatchOrdering === "cost" ? new Map(sizedScanFiles.map((entry) => [entry.path, entry.sizeBytes])) : null;
|
|
72749
|
-
if (sizeByFile !== null) for (const [lintPath, sizeBytes] of
|
|
73288
|
+
if (sizeByFile !== null) for (const [lintPath, sizeBytes] of preparedLintSources.sizeByLintPath) sizeByFile.set(lintPath, sizeBytes);
|
|
72750
73289
|
const buildFileBatches = (passBaseArgs, passFiles) => sizeByFile !== null ? planLintBatches({
|
|
72751
73290
|
baseArgs: passBaseArgs,
|
|
72752
73291
|
files: passFiles,
|
|
@@ -72776,7 +73315,8 @@ const runOxlint = async (options) => {
|
|
|
72776
73315
|
rootDirectory,
|
|
72777
73316
|
nodeBinaryPath,
|
|
72778
73317
|
project: lintProject,
|
|
72779
|
-
sourcePathByLintPath:
|
|
73318
|
+
sourcePathByLintPath: preparedLintSources.sourcePathByLintPath,
|
|
73319
|
+
sourceMapByLintPath: preparedLintSources.sourceMapByLintPath,
|
|
72780
73320
|
onPartialFailure: reportPartialFailure,
|
|
72781
73321
|
onAnalyzedFiles: (filePaths) => {
|
|
72782
73322
|
analyzedFiles = filePaths;
|
|
@@ -72785,6 +73325,7 @@ const runOxlint = async (options) => {
|
|
|
72785
73325
|
spawnTimeoutMs,
|
|
72786
73326
|
outputMaxBytes,
|
|
72787
73327
|
concurrency: options.concurrency,
|
|
73328
|
+
spawnSlots: options.spawnSlots,
|
|
72788
73329
|
signal: options.signal,
|
|
72789
73330
|
deadlineEpochMs: options.deadlineEpochMs
|
|
72790
73331
|
});
|
|
@@ -72811,7 +73352,7 @@ const runOxlint = async (options) => {
|
|
|
72811
73352
|
};
|
|
72812
73353
|
}
|
|
72813
73354
|
};
|
|
72814
|
-
if (perFileLintCacheEnabled && !project.hasReactCompiler && project.hasReactCompilerLintPlugin !== true && extendsPaths.length === 0 && userPlugins.length === 0 && !
|
|
73355
|
+
if (perFileLintCacheEnabled && !project.hasReactCompiler && project.hasReactCompilerLintPlugin !== true && extendsPaths.length === 0 && userPlugins.length === 0 && !hasPreparedFiles) {
|
|
72815
73356
|
const rulesetHash = computeRulesetHash({
|
|
72816
73357
|
config: buildConfig({
|
|
72817
73358
|
extendsPaths: [],
|
|
@@ -72977,7 +73518,8 @@ const runOxlint = async (options) => {
|
|
|
72977
73518
|
rootDirectory,
|
|
72978
73519
|
nodeBinaryPath,
|
|
72979
73520
|
project: lintProject,
|
|
72980
|
-
sourcePathByLintPath:
|
|
73521
|
+
sourcePathByLintPath: preparedLintSources.sourcePathByLintPath,
|
|
73522
|
+
sourceMapByLintPath: preparedLintSources.sourceMapByLintPath,
|
|
72981
73523
|
onPartialFailure,
|
|
72982
73524
|
onAnalyzedFiles: (filePaths) => {
|
|
72983
73525
|
analyzedFiles = filePaths;
|
|
@@ -72986,6 +73528,7 @@ const runOxlint = async (options) => {
|
|
|
72986
73528
|
spawnTimeoutMs,
|
|
72987
73529
|
outputMaxBytes,
|
|
72988
73530
|
concurrency: options.concurrency,
|
|
73531
|
+
spawnSlots: options.spawnSlots,
|
|
72989
73532
|
signal: options.signal,
|
|
72990
73533
|
deadlineEpochMs: options.deadlineEpochMs
|
|
72991
73534
|
});
|
|
@@ -73080,6 +73623,7 @@ var Linter = class Linter extends Service()("react-doctor/Linter") {
|
|
|
73080
73623
|
const spawnTimeoutMs = yield* OxlintSpawnTimeoutMs;
|
|
73081
73624
|
const outputMaxBytes = yield* OxlintOutputMaxBytes;
|
|
73082
73625
|
const concurrency = yield* OxlintConcurrency;
|
|
73626
|
+
const spawnSlots = yield* OxlintSpawnSlots;
|
|
73083
73627
|
const lintBatchOrdering = yield* LintBatchOrdering;
|
|
73084
73628
|
const perFileLintCacheEnabled = yield* PerFileLintCacheEnabled;
|
|
73085
73629
|
const sidecarLintCacheEnabled = yield* SidecarLintCacheEnabled;
|
|
@@ -73109,6 +73653,7 @@ var Linter = class Linter extends Service()("react-doctor/Linter") {
|
|
|
73109
73653
|
onSidecarStats: input.onSidecarStats,
|
|
73110
73654
|
spawnTimeoutMs,
|
|
73111
73655
|
outputMaxBytes,
|
|
73656
|
+
spawnSlots: spawnSlots ?? void 0,
|
|
73112
73657
|
concurrency,
|
|
73113
73658
|
signal,
|
|
73114
73659
|
lintBatchOrdering,
|
|
@@ -74326,10 +74871,14 @@ const materializeSourceTree = (input) => gen(function* () {
|
|
|
74326
74871
|
materializedFiles.push(relativePath);
|
|
74327
74872
|
}
|
|
74328
74873
|
yield* sync(() => {
|
|
74329
|
-
for (const configFilename of STAGED_FILES_PROJECT_CONFIG_FILENAMES) {
|
|
74330
|
-
const sourcePath = path.join(input.directory, configFilename);
|
|
74331
|
-
const targetPath = path.
|
|
74332
|
-
if (
|
|
74874
|
+
for (const subdirectory of ["", ...input.configSubdirectories ?? []]) for (const configFilename of STAGED_FILES_PROJECT_CONFIG_FILENAMES) {
|
|
74875
|
+
const sourcePath = path.join(input.directory, subdirectory, configFilename);
|
|
74876
|
+
const targetPath = path.resolve(resolvedTempDirectory, subdirectory, configFilename);
|
|
74877
|
+
if (!isPathInsideDirectory(targetPath, resolvedTempDirectory)) continue;
|
|
74878
|
+
if (fs.existsSync(sourcePath) && !fs.existsSync(targetPath)) {
|
|
74879
|
+
fs.mkdirSync(path.dirname(targetPath), { recursive: true });
|
|
74880
|
+
fs.cpSync(sourcePath, targetPath);
|
|
74881
|
+
}
|
|
74333
74882
|
}
|
|
74334
74883
|
});
|
|
74335
74884
|
return {
|
|
@@ -74350,15 +74899,17 @@ const materializeSourceTree = (input) => gen(function* () {
|
|
|
74350
74899
|
static layerNode = effect(StagedFiles, gen(function* () {
|
|
74351
74900
|
const git = yield* Git;
|
|
74352
74901
|
return StagedFiles.of({
|
|
74353
|
-
discoverSourceFiles: (directory) => git.stagedFilePaths(directory).pipe(map$3((entries) => entries.filter(isLintableSourceFile)), withSpan("StagedFiles.discoverSourceFiles")),
|
|
74354
|
-
materialize: ({ directory, stagedFiles, tempDirectory }) => materializeSourceTree({
|
|
74902
|
+
discoverSourceFiles: (directory) => git.stagedFilePaths(directory).pipe(map$3((entries) => entries === null ? null : entries.filter(isLintableSourceFile)), withSpan("StagedFiles.discoverSourceFiles")),
|
|
74903
|
+
materialize: ({ directory, stagedFiles, tempDirectory, configSubdirectories }) => materializeSourceTree({
|
|
74355
74904
|
directory,
|
|
74356
74905
|
files: stagedFiles,
|
|
74357
74906
|
tempDirectory,
|
|
74907
|
+
configSubdirectories,
|
|
74358
74908
|
readContent: (relativePath) => git.showStagedContent(directory, relativePath, { maxBufferBytes: GIT_SHOW_MAX_BUFFER_BYTES })
|
|
74359
74909
|
}).pipe(map$3((tree) => ({
|
|
74360
74910
|
tempDirectory: tree.tempDirectory,
|
|
74361
74911
|
stagedFiles: tree.materializedFiles,
|
|
74912
|
+
unmaterializedFiles: tree.unmaterializedFiles,
|
|
74362
74913
|
cleanup: tree.cleanup
|
|
74363
74914
|
})), withSpan("StagedFiles.materialize"))
|
|
74364
74915
|
});
|
|
@@ -74373,6 +74924,7 @@ const materializeSourceTree = (input) => gen(function* () {
|
|
|
74373
74924
|
materialize: ({ tempDirectory }) => succeed$2({
|
|
74374
74925
|
tempDirectory,
|
|
74375
74926
|
stagedFiles: snapshot.materializedFiles ?? snapshot.sourceFiles ?? [],
|
|
74927
|
+
unmaterializedFiles: [],
|
|
74376
74928
|
cleanup: () => {}
|
|
74377
74929
|
})
|
|
74378
74930
|
}));
|
|
@@ -74472,7 +75024,7 @@ const runEditorScan = async (input) => {
|
|
|
74472
75024
|
* other `clear*` helpers.
|
|
74473
75025
|
*/
|
|
74474
75026
|
const clearAutoSuppressionCaches = () => {};
|
|
74475
|
-
const lookupOwnRule = (rule) => Object.hasOwn(
|
|
75027
|
+
const lookupOwnRule = (rule) => Object.hasOwn(REACT_DOCTOR_RULE_REGISTRY, rule) ? REACT_DOCTOR_RULE_REGISTRY[rule] : void 0;
|
|
74476
75028
|
/**
|
|
74477
75029
|
* Returns presentation metadata for `<plugin>/<rule>`, or `null` when the
|
|
74478
75030
|
* rule is not part of the bundled react-doctor plugin (e.g. an adopted
|
|
@@ -76205,6 +76757,7 @@ const METRIC = {
|
|
|
76205
76757
|
cliError: "cli.error",
|
|
76206
76758
|
cliEnvironmentError: "cli.env_error",
|
|
76207
76759
|
stagedSnapshotDivergence: "staged.snapshot_divergence",
|
|
76760
|
+
stagedPerProject: "staged.per_project",
|
|
76208
76761
|
projectDetected: "project.detected",
|
|
76209
76762
|
projectPathSelected: "project.path_selected",
|
|
76210
76763
|
projectConfigSelected: "project.config_selected",
|
|
@@ -76547,5 +77100,5 @@ const startLanguageServer = () => {
|
|
|
76547
77100
|
};
|
|
76548
77101
|
//#endregion
|
|
76549
77102
|
export { startLanguageServer };
|
|
76550
|
-
!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]="
|
|
76551
|
-
//# debugId=
|
|
77103
|
+
!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]="ec49e114-f0f3-593d-b3c1-8b1a04d065a6")}catch(e){}}();
|
|
77104
|
+
//# debugId=ec49e114-f0f3-593d-b3c1-8b1a04d065a6
|