react-doctor 0.9.2-dev.86add14 → 0.9.2-dev.a81b3d6
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 +654 -95
- package/dist/index.d.ts +1 -1
- package/dist/index.js +640 -85
- package/dist/lsp.js +621 -81
- package/dist/{run-scan-app-C9MJnVwv.js → run-scan-app-DHRvqfkX.js} +11 -10
- package/package.json +5 -4
package/dist/cli.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
|
|
2
|
-
!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="
|
|
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]="3bff4f9b-31f8-5abe-b7a2-a0ab9f6a85b4")}catch(e){}}();
|
|
3
3
|
import { createRequire } from "node:module";
|
|
4
4
|
import * as NodeChildProcess from "node:child_process";
|
|
5
5
|
import { execFile, execFileSync, spawn, spawnSync } from "node:child_process";
|
|
@@ -8,7 +8,7 @@ import path from "node:path";
|
|
|
8
8
|
import * as NFS from "node:fs";
|
|
9
9
|
import fs, { mkdtempSync, rmSync } from "node:fs";
|
|
10
10
|
import process$1 from "node:process";
|
|
11
|
-
import
|
|
11
|
+
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";
|
|
12
12
|
import * as Crypto from "node:crypto";
|
|
13
13
|
import crypto, { createHash, randomUUID } from "node:crypto";
|
|
14
14
|
import { ResolverFactory } from "oxc-resolver";
|
|
@@ -20,6 +20,7 @@ import os, { tmpdir } 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
|
import * as Sentry from "@sentry/node";
|
|
25
26
|
import { performance as performance$1 } from "node:perf_hooks";
|
|
@@ -13342,7 +13343,7 @@ const Number$4 = globalThis.Number;
|
|
|
13342
13343
|
* @category constructors
|
|
13343
13344
|
* @since 2.0.0
|
|
13344
13345
|
*/
|
|
13345
|
-
const parse = (s) => {
|
|
13346
|
+
const parse$1 = (s) => {
|
|
13346
13347
|
if (s === "NaN") return some(NaN);
|
|
13347
13348
|
if (s === "Infinity") return some(Infinity);
|
|
13348
13349
|
if (s === "-Infinity") return some(-Infinity);
|
|
@@ -17405,12 +17406,12 @@ TaggedError("EncodingError");
|
|
|
17405
17406
|
//#endregion
|
|
17406
17407
|
//#region ../../node_modules/.pnpm/effect@4.0.0-beta.70/node_modules/effect/dist/internal/schema/annotations.js
|
|
17407
17408
|
/** @internal */
|
|
17408
|
-
function resolve(ast) {
|
|
17409
|
+
function resolve$1(ast) {
|
|
17409
17410
|
return ast.checks ? ast.checks[ast.checks.length - 1].annotations : ast.annotations;
|
|
17410
17411
|
}
|
|
17411
17412
|
/** @internal */
|
|
17412
17413
|
function resolveAt(key) {
|
|
17413
|
-
return (ast) => resolve(ast)?.[key];
|
|
17414
|
+
return (ast) => resolve$1(ast)?.[key];
|
|
17414
17415
|
}
|
|
17415
17416
|
/** @internal */
|
|
17416
17417
|
const resolveIdentifier = /* @__PURE__ */ resolveAt("identifier");
|
|
@@ -21162,7 +21163,7 @@ function asSync(parser) {
|
|
|
21162
21163
|
}
|
|
21163
21164
|
const recur$1 = /* @__PURE__ */ memoize((ast) => {
|
|
21164
21165
|
let parser;
|
|
21165
|
-
const astOptions = resolve(ast)?.["parseOptions"];
|
|
21166
|
+
const astOptions = resolve$1(ast)?.["parseOptions"];
|
|
21166
21167
|
if (!ast.context && !ast.encoding && !ast.checks) return (ou, options) => {
|
|
21167
21168
|
parser ??= ast.getParser(recur$1);
|
|
21168
21169
|
if (astOptions) options = {
|
|
@@ -60767,7 +60768,7 @@ var UrlParamsError = class extends TaggedError("UrlParamsError") {};
|
|
|
60767
60768
|
* @category converting
|
|
60768
60769
|
* @since 4.0.0
|
|
60769
60770
|
*/
|
|
60770
|
-
const makeUrl = (url, params, hash) => {
|
|
60771
|
+
const makeUrl$1 = (url, params, hash) => {
|
|
60771
60772
|
try {
|
|
60772
60773
|
const urlInstance = new URL(url, baseUrl());
|
|
60773
60774
|
for (let i = 0; i < params.params.length; i++) {
|
|
@@ -61401,7 +61402,7 @@ const Proto$2 = {
|
|
|
61401
61402
|
const make$10 = (f) => makeWith$1((effect) => flatMap$2(effect, (request) => withFiber((fiber) => {
|
|
61402
61403
|
const scopedController = scopedRequests.get(request);
|
|
61403
61404
|
const controller = scopedController ?? new AbortController();
|
|
61404
|
-
const urlResult = makeUrl(request.url, request.urlParams, getOrUndefined(request.hash));
|
|
61405
|
+
const urlResult = makeUrl$1(request.url, request.urlParams, getOrUndefined(request.hash));
|
|
61405
61406
|
if (isFailure(urlResult)) return fail$4(new HttpClientError({ reason: new InvalidUrlError({
|
|
61406
61407
|
request,
|
|
61407
61408
|
cause: urlResult.failure
|
|
@@ -61840,7 +61841,7 @@ const layer$8 = (loggers, options) => effect(CurrentLoggers, withFiber$1(fnUntra
|
|
|
61840
61841
|
* @since 4.0.0
|
|
61841
61842
|
*/
|
|
61842
61843
|
const policy = /* @__PURE__ */ forever$1.pipe(passthrough$2, /* @__PURE__ */ addDelay((error) => {
|
|
61843
|
-
if (isHttpClientError(error) && error.reason._tag === "StatusCodeError" && error.reason.response.status === 429) return succeed$2(seconds(fromUndefinedOr(error.reason.response.headers["retry-after"]).pipe(flatMap$5(parse), getOrElse$1(() => 5))));
|
|
61844
|
+
if (isHttpClientError(error) && error.reason._tag === "StatusCodeError" && error.reason.response.status === 429) return succeed$2(seconds(fromUndefinedOr(error.reason.response.headers["retry-after"]).pipe(flatMap$5(parse$1), getOrElse$1(() => 5))));
|
|
61844
61845
|
return succeed$2(seconds(1));
|
|
61845
61846
|
}));
|
|
61846
61847
|
/**
|
|
@@ -64549,6 +64550,428 @@ const layer$1 = /* @__PURE__ */ succeed$3(Path$1)({
|
|
|
64549
64550
|
toFileUrl
|
|
64550
64551
|
});
|
|
64551
64552
|
//#endregion
|
|
64553
|
+
//#region ../../node_modules/.pnpm/@jridgewell+sourcemap-codec@1.5.5/node_modules/@jridgewell/sourcemap-codec/dist/sourcemap-codec.mjs
|
|
64554
|
+
var comma = ",".charCodeAt(0);
|
|
64555
|
+
";".charCodeAt(0);
|
|
64556
|
+
var chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
|
|
64557
|
+
var intToChar = new Uint8Array(64);
|
|
64558
|
+
var charToInt = new Uint8Array(128);
|
|
64559
|
+
for (let i = 0; i < chars.length; i++) {
|
|
64560
|
+
const c = chars.charCodeAt(i);
|
|
64561
|
+
intToChar[i] = c;
|
|
64562
|
+
charToInt[c] = i;
|
|
64563
|
+
}
|
|
64564
|
+
function decodeInteger(reader, relative) {
|
|
64565
|
+
let value = 0;
|
|
64566
|
+
let shift = 0;
|
|
64567
|
+
let integer = 0;
|
|
64568
|
+
do {
|
|
64569
|
+
integer = charToInt[reader.next()];
|
|
64570
|
+
value |= (integer & 31) << shift;
|
|
64571
|
+
shift += 5;
|
|
64572
|
+
} while (integer & 32);
|
|
64573
|
+
const shouldNegate = value & 1;
|
|
64574
|
+
value >>>= 1;
|
|
64575
|
+
if (shouldNegate) value = -2147483648 | -value;
|
|
64576
|
+
return relative + value;
|
|
64577
|
+
}
|
|
64578
|
+
function hasMoreVlq(reader, max) {
|
|
64579
|
+
if (reader.pos >= max) return false;
|
|
64580
|
+
return reader.peek() !== comma;
|
|
64581
|
+
}
|
|
64582
|
+
var StringReader = class {
|
|
64583
|
+
constructor(buffer) {
|
|
64584
|
+
this.pos = 0;
|
|
64585
|
+
this.buffer = buffer;
|
|
64586
|
+
}
|
|
64587
|
+
next() {
|
|
64588
|
+
return this.buffer.charCodeAt(this.pos++);
|
|
64589
|
+
}
|
|
64590
|
+
peek() {
|
|
64591
|
+
return this.buffer.charCodeAt(this.pos);
|
|
64592
|
+
}
|
|
64593
|
+
indexOf(char) {
|
|
64594
|
+
const { buffer, pos } = this;
|
|
64595
|
+
const idx = buffer.indexOf(char, pos);
|
|
64596
|
+
return idx === -1 ? buffer.length : idx;
|
|
64597
|
+
}
|
|
64598
|
+
};
|
|
64599
|
+
function decode(mappings) {
|
|
64600
|
+
const { length } = mappings;
|
|
64601
|
+
const reader = new StringReader(mappings);
|
|
64602
|
+
const decoded = [];
|
|
64603
|
+
let genColumn = 0;
|
|
64604
|
+
let sourcesIndex = 0;
|
|
64605
|
+
let sourceLine = 0;
|
|
64606
|
+
let sourceColumn = 0;
|
|
64607
|
+
let namesIndex = 0;
|
|
64608
|
+
do {
|
|
64609
|
+
const semi = reader.indexOf(";");
|
|
64610
|
+
const line = [];
|
|
64611
|
+
let sorted = true;
|
|
64612
|
+
let lastCol = 0;
|
|
64613
|
+
genColumn = 0;
|
|
64614
|
+
while (reader.pos < semi) {
|
|
64615
|
+
let seg;
|
|
64616
|
+
genColumn = decodeInteger(reader, genColumn);
|
|
64617
|
+
if (genColumn < lastCol) sorted = false;
|
|
64618
|
+
lastCol = genColumn;
|
|
64619
|
+
if (hasMoreVlq(reader, semi)) {
|
|
64620
|
+
sourcesIndex = decodeInteger(reader, sourcesIndex);
|
|
64621
|
+
sourceLine = decodeInteger(reader, sourceLine);
|
|
64622
|
+
sourceColumn = decodeInteger(reader, sourceColumn);
|
|
64623
|
+
if (hasMoreVlq(reader, semi)) {
|
|
64624
|
+
namesIndex = decodeInteger(reader, namesIndex);
|
|
64625
|
+
seg = [
|
|
64626
|
+
genColumn,
|
|
64627
|
+
sourcesIndex,
|
|
64628
|
+
sourceLine,
|
|
64629
|
+
sourceColumn,
|
|
64630
|
+
namesIndex
|
|
64631
|
+
];
|
|
64632
|
+
} else seg = [
|
|
64633
|
+
genColumn,
|
|
64634
|
+
sourcesIndex,
|
|
64635
|
+
sourceLine,
|
|
64636
|
+
sourceColumn
|
|
64637
|
+
];
|
|
64638
|
+
} else seg = [genColumn];
|
|
64639
|
+
line.push(seg);
|
|
64640
|
+
reader.pos++;
|
|
64641
|
+
}
|
|
64642
|
+
if (!sorted) sort(line);
|
|
64643
|
+
decoded.push(line);
|
|
64644
|
+
reader.pos = semi + 1;
|
|
64645
|
+
} while (reader.pos <= length);
|
|
64646
|
+
return decoded;
|
|
64647
|
+
}
|
|
64648
|
+
function sort(line) {
|
|
64649
|
+
line.sort(sortComparator$1);
|
|
64650
|
+
}
|
|
64651
|
+
function sortComparator$1(a, b) {
|
|
64652
|
+
return a[0] - b[0];
|
|
64653
|
+
}
|
|
64654
|
+
//#endregion
|
|
64655
|
+
//#region ../../node_modules/.pnpm/@jridgewell+resolve-uri@3.1.2/node_modules/@jridgewell/resolve-uri/dist/resolve-uri.mjs
|
|
64656
|
+
const schemeRegex = /^[\w+.-]+:\/\//;
|
|
64657
|
+
/**
|
|
64658
|
+
* Matches the parts of a URL:
|
|
64659
|
+
* 1. Scheme, including ":", guaranteed.
|
|
64660
|
+
* 2. User/password, including "@", optional.
|
|
64661
|
+
* 3. Host, guaranteed.
|
|
64662
|
+
* 4. Port, including ":", optional.
|
|
64663
|
+
* 5. Path, including "/", optional.
|
|
64664
|
+
* 6. Query, including "?", optional.
|
|
64665
|
+
* 7. Hash, including "#", optional.
|
|
64666
|
+
*/
|
|
64667
|
+
const urlRegex = /^([\w+.-]+:)\/\/([^@/#?]*@)?([^:/#?]*)(:\d+)?(\/[^#?]*)?(\?[^#]*)?(#.*)?/;
|
|
64668
|
+
/**
|
|
64669
|
+
* File URLs are weird. They dont' need the regular `//` in the scheme, they may or may not start
|
|
64670
|
+
* with a leading `/`, they can have a domain (but only if they don't start with a Windows drive).
|
|
64671
|
+
*
|
|
64672
|
+
* 1. Host, optional.
|
|
64673
|
+
* 2. Path, which may include "/", guaranteed.
|
|
64674
|
+
* 3. Query, including "?", optional.
|
|
64675
|
+
* 4. Hash, including "#", optional.
|
|
64676
|
+
*/
|
|
64677
|
+
const fileRegex = /^file:(?:\/\/((?![a-z]:)[^/#?]*)?)?(\/?[^#?]*)(\?[^#]*)?(#.*)?/i;
|
|
64678
|
+
function isAbsoluteUrl(input) {
|
|
64679
|
+
return schemeRegex.test(input);
|
|
64680
|
+
}
|
|
64681
|
+
function isSchemeRelativeUrl(input) {
|
|
64682
|
+
return input.startsWith("//");
|
|
64683
|
+
}
|
|
64684
|
+
function isAbsolutePath(input) {
|
|
64685
|
+
return input.startsWith("/");
|
|
64686
|
+
}
|
|
64687
|
+
function isFileUrl(input) {
|
|
64688
|
+
return input.startsWith("file:");
|
|
64689
|
+
}
|
|
64690
|
+
function isRelative(input) {
|
|
64691
|
+
return /^[.?#]/.test(input);
|
|
64692
|
+
}
|
|
64693
|
+
function parseAbsoluteUrl(input) {
|
|
64694
|
+
const match = urlRegex.exec(input);
|
|
64695
|
+
return makeUrl(match[1], match[2] || "", match[3], match[4] || "", match[5] || "/", match[6] || "", match[7] || "");
|
|
64696
|
+
}
|
|
64697
|
+
function parseFileUrl(input) {
|
|
64698
|
+
const match = fileRegex.exec(input);
|
|
64699
|
+
const path = match[2];
|
|
64700
|
+
return makeUrl("file:", "", match[1] || "", "", isAbsolutePath(path) ? path : "/" + path, match[3] || "", match[4] || "");
|
|
64701
|
+
}
|
|
64702
|
+
function makeUrl(scheme, user, host, port, path, query, hash) {
|
|
64703
|
+
return {
|
|
64704
|
+
scheme,
|
|
64705
|
+
user,
|
|
64706
|
+
host,
|
|
64707
|
+
port,
|
|
64708
|
+
path,
|
|
64709
|
+
query,
|
|
64710
|
+
hash,
|
|
64711
|
+
type: 7
|
|
64712
|
+
};
|
|
64713
|
+
}
|
|
64714
|
+
function parseUrl(input) {
|
|
64715
|
+
if (isSchemeRelativeUrl(input)) {
|
|
64716
|
+
const url = parseAbsoluteUrl("http:" + input);
|
|
64717
|
+
url.scheme = "";
|
|
64718
|
+
url.type = 6;
|
|
64719
|
+
return url;
|
|
64720
|
+
}
|
|
64721
|
+
if (isAbsolutePath(input)) {
|
|
64722
|
+
const url = parseAbsoluteUrl("http://foo.com" + input);
|
|
64723
|
+
url.scheme = "";
|
|
64724
|
+
url.host = "";
|
|
64725
|
+
url.type = 5;
|
|
64726
|
+
return url;
|
|
64727
|
+
}
|
|
64728
|
+
if (isFileUrl(input)) return parseFileUrl(input);
|
|
64729
|
+
if (isAbsoluteUrl(input)) return parseAbsoluteUrl(input);
|
|
64730
|
+
const url = parseAbsoluteUrl("http://foo.com/" + input);
|
|
64731
|
+
url.scheme = "";
|
|
64732
|
+
url.host = "";
|
|
64733
|
+
url.type = input ? input.startsWith("?") ? 3 : input.startsWith("#") ? 2 : 4 : 1;
|
|
64734
|
+
return url;
|
|
64735
|
+
}
|
|
64736
|
+
function stripPathFilename(path) {
|
|
64737
|
+
if (path.endsWith("/..")) return path;
|
|
64738
|
+
const index = path.lastIndexOf("/");
|
|
64739
|
+
return path.slice(0, index + 1);
|
|
64740
|
+
}
|
|
64741
|
+
function mergePaths(url, base) {
|
|
64742
|
+
normalizePath(base, base.type);
|
|
64743
|
+
if (url.path === "/") url.path = base.path;
|
|
64744
|
+
else url.path = stripPathFilename(base.path) + url.path;
|
|
64745
|
+
}
|
|
64746
|
+
/**
|
|
64747
|
+
* The path can have empty directories "//", unneeded parents "foo/..", or current directory
|
|
64748
|
+
* "foo/.". We need to normalize to a standard representation.
|
|
64749
|
+
*/
|
|
64750
|
+
function normalizePath(url, type) {
|
|
64751
|
+
const rel = type <= 4;
|
|
64752
|
+
const pieces = url.path.split("/");
|
|
64753
|
+
let pointer = 1;
|
|
64754
|
+
let positive = 0;
|
|
64755
|
+
let addTrailingSlash = false;
|
|
64756
|
+
for (let i = 1; i < pieces.length; i++) {
|
|
64757
|
+
const piece = pieces[i];
|
|
64758
|
+
if (!piece) {
|
|
64759
|
+
addTrailingSlash = true;
|
|
64760
|
+
continue;
|
|
64761
|
+
}
|
|
64762
|
+
addTrailingSlash = false;
|
|
64763
|
+
if (piece === ".") continue;
|
|
64764
|
+
if (piece === "..") {
|
|
64765
|
+
if (positive) {
|
|
64766
|
+
addTrailingSlash = true;
|
|
64767
|
+
positive--;
|
|
64768
|
+
pointer--;
|
|
64769
|
+
} else if (rel) pieces[pointer++] = piece;
|
|
64770
|
+
continue;
|
|
64771
|
+
}
|
|
64772
|
+
pieces[pointer++] = piece;
|
|
64773
|
+
positive++;
|
|
64774
|
+
}
|
|
64775
|
+
let path = "";
|
|
64776
|
+
for (let i = 1; i < pointer; i++) path += "/" + pieces[i];
|
|
64777
|
+
if (!path || addTrailingSlash && !path.endsWith("/..")) path += "/";
|
|
64778
|
+
url.path = path;
|
|
64779
|
+
}
|
|
64780
|
+
/**
|
|
64781
|
+
* Attempts to resolve `input` URL/path relative to `base`.
|
|
64782
|
+
*/
|
|
64783
|
+
function resolve(input, base) {
|
|
64784
|
+
if (!input && !base) return "";
|
|
64785
|
+
const url = parseUrl(input);
|
|
64786
|
+
let inputType = url.type;
|
|
64787
|
+
if (base && inputType !== 7) {
|
|
64788
|
+
const baseUrl = parseUrl(base);
|
|
64789
|
+
const baseType = baseUrl.type;
|
|
64790
|
+
switch (inputType) {
|
|
64791
|
+
case 1: url.hash = baseUrl.hash;
|
|
64792
|
+
case 2: url.query = baseUrl.query;
|
|
64793
|
+
case 3:
|
|
64794
|
+
case 4: mergePaths(url, baseUrl);
|
|
64795
|
+
case 5:
|
|
64796
|
+
url.user = baseUrl.user;
|
|
64797
|
+
url.host = baseUrl.host;
|
|
64798
|
+
url.port = baseUrl.port;
|
|
64799
|
+
case 6: url.scheme = baseUrl.scheme;
|
|
64800
|
+
}
|
|
64801
|
+
if (baseType > inputType) inputType = baseType;
|
|
64802
|
+
}
|
|
64803
|
+
normalizePath(url, inputType);
|
|
64804
|
+
const queryHash = url.query + url.hash;
|
|
64805
|
+
switch (inputType) {
|
|
64806
|
+
case 2:
|
|
64807
|
+
case 3: return queryHash;
|
|
64808
|
+
case 4: {
|
|
64809
|
+
const path = url.path.slice(1);
|
|
64810
|
+
if (!path) return queryHash || ".";
|
|
64811
|
+
if (isRelative(base || input) && !isRelative(path)) return "./" + path + queryHash;
|
|
64812
|
+
return path + queryHash;
|
|
64813
|
+
}
|
|
64814
|
+
case 5: return url.path + queryHash;
|
|
64815
|
+
default: return url.scheme + "//" + url.user + url.host + url.port + url.path + queryHash;
|
|
64816
|
+
}
|
|
64817
|
+
}
|
|
64818
|
+
//#endregion
|
|
64819
|
+
//#region ../../node_modules/.pnpm/@jridgewell+trace-mapping@0.3.31/node_modules/@jridgewell/trace-mapping/dist/trace-mapping.mjs
|
|
64820
|
+
function stripFilename(path) {
|
|
64821
|
+
if (!path) return "";
|
|
64822
|
+
const index = path.lastIndexOf("/");
|
|
64823
|
+
return path.slice(0, index + 1);
|
|
64824
|
+
}
|
|
64825
|
+
function resolver(mapUrl, sourceRoot) {
|
|
64826
|
+
const from = stripFilename(mapUrl);
|
|
64827
|
+
const prefix = sourceRoot ? sourceRoot + "/" : "";
|
|
64828
|
+
return (source) => resolve(prefix + (source || ""), from);
|
|
64829
|
+
}
|
|
64830
|
+
var COLUMN = 0;
|
|
64831
|
+
var SOURCES_INDEX = 1;
|
|
64832
|
+
var SOURCE_LINE = 2;
|
|
64833
|
+
var SOURCE_COLUMN = 3;
|
|
64834
|
+
var NAMES_INDEX = 4;
|
|
64835
|
+
function maybeSort(mappings, owned) {
|
|
64836
|
+
const unsortedIndex = nextUnsortedSegmentLine(mappings, 0);
|
|
64837
|
+
if (unsortedIndex === mappings.length) return mappings;
|
|
64838
|
+
if (!owned) mappings = mappings.slice();
|
|
64839
|
+
for (let i = unsortedIndex; i < mappings.length; i = nextUnsortedSegmentLine(mappings, i + 1)) mappings[i] = sortSegments(mappings[i], owned);
|
|
64840
|
+
return mappings;
|
|
64841
|
+
}
|
|
64842
|
+
function nextUnsortedSegmentLine(mappings, start) {
|
|
64843
|
+
for (let i = start; i < mappings.length; i++) if (!isSorted(mappings[i])) return i;
|
|
64844
|
+
return mappings.length;
|
|
64845
|
+
}
|
|
64846
|
+
function isSorted(line) {
|
|
64847
|
+
for (let j = 1; j < line.length; j++) if (line[j][COLUMN] < line[j - 1][COLUMN]) return false;
|
|
64848
|
+
return true;
|
|
64849
|
+
}
|
|
64850
|
+
function sortSegments(line, owned) {
|
|
64851
|
+
if (!owned) line = line.slice();
|
|
64852
|
+
return line.sort(sortComparator);
|
|
64853
|
+
}
|
|
64854
|
+
function sortComparator(a, b) {
|
|
64855
|
+
return a[COLUMN] - b[COLUMN];
|
|
64856
|
+
}
|
|
64857
|
+
var found = false;
|
|
64858
|
+
function binarySearch(haystack, needle, low, high) {
|
|
64859
|
+
while (low <= high) {
|
|
64860
|
+
const mid = low + (high - low >> 1);
|
|
64861
|
+
const cmp = haystack[mid][COLUMN] - needle;
|
|
64862
|
+
if (cmp === 0) {
|
|
64863
|
+
found = true;
|
|
64864
|
+
return mid;
|
|
64865
|
+
}
|
|
64866
|
+
if (cmp < 0) low = mid + 1;
|
|
64867
|
+
else high = mid - 1;
|
|
64868
|
+
}
|
|
64869
|
+
found = false;
|
|
64870
|
+
return low - 1;
|
|
64871
|
+
}
|
|
64872
|
+
function upperBound(haystack, needle, index) {
|
|
64873
|
+
for (let i = index + 1; i < haystack.length; index = i++) if (haystack[i][COLUMN] !== needle) break;
|
|
64874
|
+
return index;
|
|
64875
|
+
}
|
|
64876
|
+
function lowerBound(haystack, needle, index) {
|
|
64877
|
+
for (let i = index - 1; i >= 0; index = i--) if (haystack[i][COLUMN] !== needle) break;
|
|
64878
|
+
return index;
|
|
64879
|
+
}
|
|
64880
|
+
function memoizedState() {
|
|
64881
|
+
return {
|
|
64882
|
+
lastKey: -1,
|
|
64883
|
+
lastNeedle: -1,
|
|
64884
|
+
lastIndex: -1
|
|
64885
|
+
};
|
|
64886
|
+
}
|
|
64887
|
+
function memoizedBinarySearch(haystack, needle, state, key) {
|
|
64888
|
+
const { lastKey, lastNeedle, lastIndex } = state;
|
|
64889
|
+
let low = 0;
|
|
64890
|
+
let high = haystack.length - 1;
|
|
64891
|
+
if (key === lastKey) {
|
|
64892
|
+
if (needle === lastNeedle) {
|
|
64893
|
+
found = lastIndex !== -1 && haystack[lastIndex][COLUMN] === needle;
|
|
64894
|
+
return lastIndex;
|
|
64895
|
+
}
|
|
64896
|
+
if (needle >= lastNeedle) low = lastIndex === -1 ? 0 : lastIndex;
|
|
64897
|
+
else high = lastIndex;
|
|
64898
|
+
}
|
|
64899
|
+
state.lastKey = key;
|
|
64900
|
+
state.lastNeedle = needle;
|
|
64901
|
+
return state.lastIndex = binarySearch(haystack, needle, low, high);
|
|
64902
|
+
}
|
|
64903
|
+
function parse(map) {
|
|
64904
|
+
return typeof map === "string" ? JSON.parse(map) : map;
|
|
64905
|
+
}
|
|
64906
|
+
var LINE_GTR_ZERO = "`line` must be greater than 0 (lines start at line 1)";
|
|
64907
|
+
var COL_GTR_EQ_ZERO = "`column` must be greater than or equal to 0 (columns start at column 0)";
|
|
64908
|
+
var TraceMap = class {
|
|
64909
|
+
constructor(map, mapUrl) {
|
|
64910
|
+
const isString = typeof map === "string";
|
|
64911
|
+
if (!isString && map._decodedMemo) return map;
|
|
64912
|
+
const parsed = parse(map);
|
|
64913
|
+
const { version, file, names, sourceRoot, sources, sourcesContent } = parsed;
|
|
64914
|
+
this.version = version;
|
|
64915
|
+
this.file = file;
|
|
64916
|
+
this.names = names || [];
|
|
64917
|
+
this.sourceRoot = sourceRoot;
|
|
64918
|
+
this.sources = sources;
|
|
64919
|
+
this.sourcesContent = sourcesContent;
|
|
64920
|
+
this.ignoreList = parsed.ignoreList || parsed.x_google_ignoreList || void 0;
|
|
64921
|
+
const resolve = resolver(mapUrl, sourceRoot);
|
|
64922
|
+
this.resolvedSources = sources.map(resolve);
|
|
64923
|
+
const { mappings } = parsed;
|
|
64924
|
+
if (typeof mappings === "string") {
|
|
64925
|
+
this._encoded = mappings;
|
|
64926
|
+
this._decoded = void 0;
|
|
64927
|
+
} else if (Array.isArray(mappings)) {
|
|
64928
|
+
this._encoded = void 0;
|
|
64929
|
+
this._decoded = maybeSort(mappings, isString);
|
|
64930
|
+
} else if (parsed.sections) throw new Error(`TraceMap passed sectioned source map, please use FlattenMap export instead`);
|
|
64931
|
+
else throw new Error(`invalid source map: ${JSON.stringify(parsed)}`);
|
|
64932
|
+
this._decodedMemo = memoizedState();
|
|
64933
|
+
this._bySources = void 0;
|
|
64934
|
+
this._bySourceMemos = void 0;
|
|
64935
|
+
}
|
|
64936
|
+
};
|
|
64937
|
+
function cast(map) {
|
|
64938
|
+
return map;
|
|
64939
|
+
}
|
|
64940
|
+
function decodedMappings(map) {
|
|
64941
|
+
var _a;
|
|
64942
|
+
return (_a = cast(map))._decoded || (_a._decoded = decode(cast(map)._encoded));
|
|
64943
|
+
}
|
|
64944
|
+
function originalPositionFor(map, needle) {
|
|
64945
|
+
let { line, column, bias } = needle;
|
|
64946
|
+
line--;
|
|
64947
|
+
if (line < 0) throw new Error(LINE_GTR_ZERO);
|
|
64948
|
+
if (column < 0) throw new Error(COL_GTR_EQ_ZERO);
|
|
64949
|
+
const decoded = decodedMappings(map);
|
|
64950
|
+
if (line >= decoded.length) return OMapping(null, null, null, null);
|
|
64951
|
+
const segments = decoded[line];
|
|
64952
|
+
const index = traceSegmentInternal(segments, cast(map)._decodedMemo, line, column, bias || 1);
|
|
64953
|
+
if (index === -1) return OMapping(null, null, null, null);
|
|
64954
|
+
const segment = segments[index];
|
|
64955
|
+
if (segment.length === 1) return OMapping(null, null, null, null);
|
|
64956
|
+
const { names, resolvedSources } = map;
|
|
64957
|
+
return OMapping(resolvedSources[segment[SOURCES_INDEX]], segment[SOURCE_LINE] + 1, segment[SOURCE_COLUMN], segment.length === 5 ? names[segment[NAMES_INDEX]] : null);
|
|
64958
|
+
}
|
|
64959
|
+
function OMapping(source, line, column, name) {
|
|
64960
|
+
return {
|
|
64961
|
+
source,
|
|
64962
|
+
line,
|
|
64963
|
+
column,
|
|
64964
|
+
name
|
|
64965
|
+
};
|
|
64966
|
+
}
|
|
64967
|
+
function traceSegmentInternal(segments, memo, line, column, bias) {
|
|
64968
|
+
let index = memoizedBinarySearch(segments, column, memo, line);
|
|
64969
|
+
if (found) index = (bias === -1 ? upperBound : lowerBound)(segments, column, index);
|
|
64970
|
+
else if (bias === -1) index++;
|
|
64971
|
+
if (index === -1 || index === segments.length) return -1;
|
|
64972
|
+
return index;
|
|
64973
|
+
}
|
|
64974
|
+
//#endregion
|
|
64552
64975
|
//#region ../core/dist/index.js
|
|
64553
64976
|
var __create = Object.create;
|
|
64554
64977
|
var __defProp = Object.defineProperty;
|
|
@@ -64618,7 +65041,7 @@ var AmbiguousProjectError = class extends Error {
|
|
|
64618
65041
|
};
|
|
64619
65042
|
const isProjectDiscoveryError = (value) => value instanceof ProjectNotFoundError || value instanceof NoReactDependencyError || value instanceof PackageJsonNotFoundError || value instanceof NotADirectoryError || value instanceof AmbiguousProjectError;
|
|
64620
65043
|
const HTML_FILE_PATTERN = /\.html$/i;
|
|
64621
|
-
const SOURCE_FILE_PATTERN = /\.(?:tsx?|jsx?|mts|mjs|[hH][tT][mM][lL])$/;
|
|
65044
|
+
const SOURCE_FILE_PATTERN = /\.(?:astro|tsx?|jsx?|mts|mjs|[hH][tT][mM][lL])$/;
|
|
64622
65045
|
const GENERATED_BUNDLE_FILE_PATTERN = /\.(iife|umd|global|min)\.m?js$/i;
|
|
64623
65046
|
const GENERATED_SOURCE_DIRECTORY_PATTERN = /(?:^|\/)__generated__\//;
|
|
64624
65047
|
const MINIFIED_SNIFF_BYTES = 65536;
|
|
@@ -65375,6 +65798,7 @@ const FRAMEWORK_PACKAGES = {
|
|
|
65375
65798
|
"@tanstack/react-start": "tanstack-start",
|
|
65376
65799
|
"@remix-run/react": "remix",
|
|
65377
65800
|
gatsby: "gatsby",
|
|
65801
|
+
astro: "astro",
|
|
65378
65802
|
vite: "vite",
|
|
65379
65803
|
"react-scripts": "cra",
|
|
65380
65804
|
expo: "expo",
|
|
@@ -68450,7 +68874,7 @@ const evaluateSuppression = (lines, diagnosticLineIndex, ruleId) => {
|
|
|
68450
68874
|
const getDiagnosticRuleIdentity = (diagnostic) => ({
|
|
68451
68875
|
ruleKey: `${diagnostic.plugin}/${diagnostic.rule}`,
|
|
68452
68876
|
category: diagnostic.category,
|
|
68453
|
-
tags: diagnostic.plugin === "react-doctor" ?
|
|
68877
|
+
tags: diagnostic.plugin === "react-doctor" ? REACT_DOCTOR_RULE_REGISTRY[diagnostic.rule]?.tags ?? [] : []
|
|
68454
68878
|
});
|
|
68455
68879
|
const compileIgnoredFilePatterns = (userConfig) => {
|
|
68456
68880
|
const files = userConfig?.ignore?.files;
|
|
@@ -68798,7 +69222,7 @@ const buildDiagnosticPipeline = (input) => {
|
|
|
68798
69222
|
};
|
|
68799
69223
|
const shouldAutoSuppress = (diagnostic) => {
|
|
68800
69224
|
if (diagnostic.plugin !== "react-doctor") return false;
|
|
68801
|
-
const rule =
|
|
69225
|
+
const rule = REACT_DOCTOR_RULE_REGISTRY[diagnostic.rule];
|
|
68802
69226
|
if (!rule?.tags?.includes("test-noise")) return false;
|
|
68803
69227
|
if (rule.tags.includes("migration-hint")) return false;
|
|
68804
69228
|
return getFileContext(diagnostic.filePath) !== "production";
|
|
@@ -69230,6 +69654,7 @@ var OxlintConcurrency = class extends Reference("react-doctor/OxlintConcurrency"
|
|
|
69230
69654
|
if (Number.isInteger(parsed) && parsed > 0) return resolveScanConcurrency(parsed);
|
|
69231
69655
|
return resolveAutoScanConcurrency();
|
|
69232
69656
|
} }) {};
|
|
69657
|
+
var OxlintSpawnSlots = class extends Reference("react-doctor/OxlintSpawnSlots", { defaultValue: () => null }) {};
|
|
69233
69658
|
/**
|
|
69234
69659
|
* Three-state control for overlapping the dead-code pass with the lint pass —
|
|
69235
69660
|
* forking dead-code as a child fiber that runs DURING lint instead of strictly
|
|
@@ -71580,8 +72005,8 @@ const getCapabilities = (project) => {
|
|
|
71580
72005
|
const cached = capabilitiesByProject.get(project);
|
|
71581
72006
|
if (cached !== void 0) return cached;
|
|
71582
72007
|
const capabilities = new Set(buildCapabilities(project));
|
|
71583
|
-
const
|
|
71584
|
-
const targetBlankOpenerProtection = detectTargetBlankOpenerProtection(
|
|
72008
|
+
const capabilityRootDirectory = isFile(Path.join(project.rootDirectory, "package.json")) ? project.rootDirectory : findNearestAncestorPackageJson(project.rootDirectory) ?? project.rootDirectory;
|
|
72009
|
+
const targetBlankOpenerProtection = detectTargetBlankOpenerProtection(capabilityRootDirectory, readPackageJson$1(Path.join(capabilityRootDirectory, "package.json")));
|
|
71585
72010
|
if (targetBlankOpenerProtection !== void 0) capabilities.add("target-blank-needs-explicit-protection");
|
|
71586
72011
|
if (targetBlankOpenerProtection === "noreferrer") capabilities.add("target-blank-needs-noreferrer");
|
|
71587
72012
|
capabilitiesByProject.set(project, capabilities);
|
|
@@ -71611,7 +72036,7 @@ const createSecurityScanSession = (rootDirectory, options) => {
|
|
|
71611
72036
|
const capabilities = options.project ? getCapabilities(options.project) : /* @__PURE__ */ new Set();
|
|
71612
72037
|
const ignoredTags = options.ignoredTags ?? /* @__PURE__ */ new Set();
|
|
71613
72038
|
const includedTags = options.includedTags ?? /* @__PURE__ */ new Set();
|
|
71614
|
-
const enabledScanRules =
|
|
72039
|
+
const enabledScanRules = REACT_DOCTOR_SCAN_RULES.flatMap((entry) => {
|
|
71615
72040
|
const rule = entry.rule;
|
|
71616
72041
|
const scan = rule.scan;
|
|
71617
72042
|
if (typeof scan !== "function") return [];
|
|
@@ -72072,47 +72497,55 @@ const resolveDeadCodeConcurrency = (facts = readSystemFacts()) => {
|
|
|
72072
72497
|
const memoryBoundedWorkers = Math.floor(availableMemoryBytes / DEAD_CODE_WORKER_MEM_BUDGET_BYTES);
|
|
72073
72498
|
return Math.max(1, Math.min(facts.availableCores, memoryBoundedWorkers));
|
|
72074
72499
|
};
|
|
72075
|
-
|
|
72076
|
-
|
|
72077
|
-
const
|
|
72078
|
-
const
|
|
72079
|
-
|
|
72080
|
-
|
|
72500
|
+
const createWorkerSlots = (input) => {
|
|
72501
|
+
let availableSlotCount = input.slotCount;
|
|
72502
|
+
const waiters = [];
|
|
72503
|
+
const releaseSlot = () => {
|
|
72504
|
+
const nextWaiter = waiters.shift();
|
|
72505
|
+
if (nextWaiter === void 0) {
|
|
72506
|
+
availableSlotCount += 1;
|
|
72507
|
+
return;
|
|
72508
|
+
}
|
|
72509
|
+
nextWaiter.abortSignal?.removeEventListener("abort", nextWaiter.onAbort);
|
|
72510
|
+
nextWaiter.resolve();
|
|
72511
|
+
};
|
|
72512
|
+
const acquireSlot = async (abortSignal) => {
|
|
72513
|
+
if (abortSignal?.aborted) throw input.createAbortError();
|
|
72514
|
+
if (availableSlotCount > 0) {
|
|
72515
|
+
availableSlotCount -= 1;
|
|
72516
|
+
return;
|
|
72517
|
+
}
|
|
72518
|
+
await new Promise((resolve, reject) => {
|
|
72519
|
+
const onAbort = () => {
|
|
72520
|
+
const waiterIndex = waiters.indexOf(waiter);
|
|
72521
|
+
if (waiterIndex !== -1) waiters.splice(waiterIndex, 1);
|
|
72522
|
+
reject(input.createAbortError());
|
|
72523
|
+
};
|
|
72524
|
+
const waiter = {
|
|
72525
|
+
resolve,
|
|
72526
|
+
abortSignal,
|
|
72527
|
+
onAbort
|
|
72528
|
+
};
|
|
72529
|
+
waiters.push(waiter);
|
|
72530
|
+
abortSignal?.addEventListener("abort", onAbort, { once: true });
|
|
72531
|
+
});
|
|
72532
|
+
};
|
|
72533
|
+
return { run: async (task, abortSignal) => {
|
|
72534
|
+
await acquireSlot(abortSignal);
|
|
72535
|
+
try {
|
|
72536
|
+
return await task();
|
|
72537
|
+
} finally {
|
|
72538
|
+
releaseSlot();
|
|
72539
|
+
}
|
|
72540
|
+
} };
|
|
72081
72541
|
};
|
|
72082
|
-
|
|
72083
|
-
* Runs `task` once a dead-code worker slot is free, releasing the slot when the
|
|
72084
|
-
* task settles (success or failure). With a high cap (roomy machine) every
|
|
72085
|
-
* caller proceeds immediately; with a low cap (constrained runner) callers
|
|
72086
|
-
* queue and run as slots free.
|
|
72087
|
-
*
|
|
72088
|
-
* `abortSignal` short-circuits the WAIT: if it's already aborted, or fires while
|
|
72089
|
-
* this caller is queued, the call rejects without acquiring a slot or running
|
|
72090
|
-
* `task` — so a cancelled scan (e.g. lint failed) doesn't sit in the queue and
|
|
72091
|
-
* then spawn a child only to tear it down. A queued caller that aborts removes
|
|
72092
|
-
* its own waiter so a later release never hands a slot to a dead request.
|
|
72093
|
-
*/
|
|
72542
|
+
let deadCodeWorkerSlots = null;
|
|
72094
72543
|
const withDeadCodeWorkerSlot = async (task, abortSignal) => {
|
|
72095
|
-
|
|
72096
|
-
|
|
72097
|
-
|
|
72098
|
-
else await new Promise((resolve, reject) => {
|
|
72099
|
-
const waiter = () => {
|
|
72100
|
-
abortSignal?.removeEventListener("abort", onAbort);
|
|
72101
|
-
resolve();
|
|
72102
|
-
};
|
|
72103
|
-
const onAbort = () => {
|
|
72104
|
-
const queuedIndex = waiters.indexOf(waiter);
|
|
72105
|
-
if (queuedIndex !== -1) waiters.splice(queuedIndex, 1);
|
|
72106
|
-
reject(/* @__PURE__ */ new Error("Dead-code worker aborted."));
|
|
72107
|
-
};
|
|
72108
|
-
waiters.push(waiter);
|
|
72109
|
-
abortSignal?.addEventListener("abort", onAbort, { once: true });
|
|
72544
|
+
deadCodeWorkerSlots ??= createWorkerSlots({
|
|
72545
|
+
slotCount: resolveDeadCodeConcurrency(),
|
|
72546
|
+
createAbortError: () => /* @__PURE__ */ new Error("Dead-code worker aborted.")
|
|
72110
72547
|
});
|
|
72111
|
-
|
|
72112
|
-
return await task();
|
|
72113
|
-
} finally {
|
|
72114
|
-
releaseSlot();
|
|
72115
|
-
}
|
|
72548
|
+
return deadCodeWorkerSlots.run(task, abortSignal);
|
|
72116
72549
|
};
|
|
72117
72550
|
const projectCacheSubdir = (projectDirectory) => crypto.createHash("sha256").update(projectDirectory).digest("hex").slice(0, 16);
|
|
72118
72551
|
const resolveReactDoctorCacheDir = (projectDirectory) => {
|
|
@@ -73639,12 +74072,12 @@ const createOxlintConfig = ({ pluginPath, project, customRulesOnly = false, exte
|
|
|
73639
74072
|
const settingsRootDirectory = resolveSettingsRootDirectory(project.rootDirectory);
|
|
73640
74073
|
const enabledReactDoctorRules = {};
|
|
73641
74074
|
for (const registryEntry of REACT_DOCTOR_RULES) {
|
|
73642
|
-
const rule =
|
|
74075
|
+
const rule = REACT_DOCTOR_RULE_REGISTRY[registryEntry.id];
|
|
73643
74076
|
if (!rule) continue;
|
|
73644
74077
|
if (ruleSelection === "cacheable" && CROSS_FILE_RULE_IDS.has(registryEntry.id)) continue;
|
|
73645
74078
|
if (ruleSelection === "sidecar" && !CROSS_FILE_RULE_IDS.has(registryEntry.id)) continue;
|
|
73646
74079
|
if (ruleSelection === "sidecar" && sidecarRuleIdFilter !== void 0 && !sidecarRuleIdFilter.has(registryEntry.id)) continue;
|
|
73647
|
-
if (rule.
|
|
74080
|
+
if (rule.isScanRule) continue;
|
|
73648
74081
|
if (customRulesOnly && registryEntry.originallyExternal) continue;
|
|
73649
74082
|
if (rule.framework !== "global" && !rule.requires) continue;
|
|
73650
74083
|
if (!shouldEnableRule(rule.requires, rule.tags, capabilities, ignoredTags, rule.disabledWhen, includedTags)) continue;
|
|
@@ -74269,6 +74702,50 @@ const columnOfUtf8Offset = (sourceBuffer, utf8Offset) => {
|
|
|
74269
74702
|
while (lineStartOffset > 0 && sourceBuffer[lineStartOffset - 1] !== 10) lineStartOffset--;
|
|
74270
74703
|
return sourceBuffer.subarray(lineStartOffset, boundedOffset).toString("utf8").length + 1;
|
|
74271
74704
|
};
|
|
74705
|
+
const utf8OffsetFromSourcePosition = (sourceBuffer, lineNumber, zeroBasedColumn) => {
|
|
74706
|
+
if (lineNumber < 1 || zeroBasedColumn < 0) return null;
|
|
74707
|
+
const sourceLines = sourceBuffer.toString("utf8").split("\n");
|
|
74708
|
+
const sourceLine = sourceLines[lineNumber - 1];
|
|
74709
|
+
if (sourceLine === void 0 || zeroBasedColumn > sourceLine.length) return null;
|
|
74710
|
+
const precedingLines = sourceLines.slice(0, lineNumber - 1).join("\n");
|
|
74711
|
+
return (lineNumber === 1 ? 0 : Buffer.byteLength(precedingLines) + Buffer.byteLength("\n")) + Buffer.byteLength(sourceLine.slice(0, zeroBasedColumn));
|
|
74712
|
+
};
|
|
74713
|
+
const mapPreparedSourceSpan = (span, preparedSourceMap) => {
|
|
74714
|
+
const generatedLine = lineOfUtf8Offset(preparedSourceMap.generatedBuffer, span.offset);
|
|
74715
|
+
const generatedColumn = columnOfUtf8Offset(preparedSourceMap.generatedBuffer, span.offset) - 1;
|
|
74716
|
+
const originalStart = originalPositionFor(preparedSourceMap.traceMap, {
|
|
74717
|
+
line: generatedLine,
|
|
74718
|
+
column: generatedColumn
|
|
74719
|
+
});
|
|
74720
|
+
if (originalStart.source === null || originalStart.line === null || originalStart.column === null) return null;
|
|
74721
|
+
const originalOffset = utf8OffsetFromSourcePosition(preparedSourceMap.sourceBuffer, originalStart.line, originalStart.column);
|
|
74722
|
+
if (originalOffset === null) return null;
|
|
74723
|
+
const generatedSpan = preparedSourceMap.generatedBuffer.subarray(span.offset, span.offset + span.length);
|
|
74724
|
+
return {
|
|
74725
|
+
offset: originalOffset,
|
|
74726
|
+
length: preparedSourceMap.sourceBuffer.subarray(originalOffset, originalOffset + generatedSpan.length).equals(generatedSpan) ? generatedSpan.length : 0,
|
|
74727
|
+
line: originalStart.line,
|
|
74728
|
+
column: originalStart.column + 1
|
|
74729
|
+
};
|
|
74730
|
+
};
|
|
74731
|
+
const mapPreparedSourceLabels = (labels, preparedSourceMap) => {
|
|
74732
|
+
const primaryLabel = labels[0];
|
|
74733
|
+
if (primaryLabel === void 0) return null;
|
|
74734
|
+
const primarySpan = mapPreparedSourceSpan(primaryLabel.span, preparedSourceMap);
|
|
74735
|
+
if (primarySpan === null) return null;
|
|
74736
|
+
const mappedLabels = [{
|
|
74737
|
+
...primaryLabel,
|
|
74738
|
+
span: primarySpan
|
|
74739
|
+
}];
|
|
74740
|
+
for (const relatedLabel of labels.slice(1)) {
|
|
74741
|
+
const relatedSpan = mapPreparedSourceSpan(relatedLabel.span, preparedSourceMap);
|
|
74742
|
+
if (relatedSpan !== null) mappedLabels.push({
|
|
74743
|
+
...relatedLabel,
|
|
74744
|
+
span: relatedSpan
|
|
74745
|
+
});
|
|
74746
|
+
}
|
|
74747
|
+
return mappedLabels;
|
|
74748
|
+
};
|
|
74272
74749
|
const REDACTED_PLACEHOLDER = "<redacted>";
|
|
74273
74750
|
const KEEP_PREFIX = `$1${REDACTED_PLACEHOLDER}`;
|
|
74274
74751
|
const KNOWN_SECRET_RULES = [
|
|
@@ -74911,7 +75388,7 @@ const PLUGIN_CATEGORY_MAP = {
|
|
|
74911
75388
|
};
|
|
74912
75389
|
const lookupOwnString = (record, key) => Object.hasOwn(record, key) ? record[key] : void 0;
|
|
74913
75390
|
const getRuleRecommendation = (ruleName, project) => {
|
|
74914
|
-
const rule =
|
|
75391
|
+
const rule = REACT_DOCTOR_RULE_REGISTRY[ruleName];
|
|
74915
75392
|
if (!rule) return void 0;
|
|
74916
75393
|
if (rule.recommendationFor) {
|
|
74917
75394
|
const capabilities = getCapabilities(project);
|
|
@@ -74920,8 +75397,8 @@ const getRuleRecommendation = (ruleName, project) => {
|
|
|
74920
75397
|
}
|
|
74921
75398
|
return rule.recommendation;
|
|
74922
75399
|
};
|
|
74923
|
-
const getRuleCategory = (ruleName) =>
|
|
74924
|
-
const getRuleTitle = (ruleName) =>
|
|
75400
|
+
const getRuleCategory = (ruleName) => REACT_DOCTOR_RULE_REGISTRY[ruleName]?.category;
|
|
75401
|
+
const getRuleTitle = (ruleName) => REACT_DOCTOR_RULE_REGISTRY[ruleName]?.title;
|
|
74925
75402
|
const resolveDiagnosticTitle = (plugin, rule) => {
|
|
74926
75403
|
if (plugin !== "react-hooks-js") return getRuleTitle(rule);
|
|
74927
75404
|
if (rule === "error-boundaries") return REACT_ERROR_BOUNDARY_TITLE;
|
|
@@ -74976,7 +75453,7 @@ const resolveDiagnosticCategory = (plugin, rule) => {
|
|
|
74976
75453
|
if (plugin === "react-hooks-js" && rule === "error-boundaries") return "Bugs";
|
|
74977
75454
|
return getRuleCategory(rule) ?? lookupOwnString(PLUGIN_CATEGORY_MAP, plugin) ?? "Bugs";
|
|
74978
75455
|
};
|
|
74979
|
-
const resolveMatchByOccurrence = (rule, category) => OCCURRENCE_MATCHED_CATEGORIES.has(category) || Boolean(
|
|
75456
|
+
const resolveMatchByOccurrence = (rule, category) => OCCURRENCE_MATCHED_CATEGORIES.has(category) || Boolean(REACT_DOCTOR_RULE_REGISTRY[rule]?.matchByOccurrence);
|
|
74980
75457
|
/**
|
|
74981
75458
|
* Maps oxlint's non-primary labels (`labels[1..]`) into related source
|
|
74982
75459
|
* locations. Editors surface these as a diagnostic's
|
|
@@ -75013,7 +75490,7 @@ const isOxlintOutput = (value) => isRecord$1(value) && Array.isArray(value.diagn
|
|
|
75013
75490
|
* to the first `{`. Raises `OxlintOutputUnparseable` when the
|
|
75014
75491
|
* stdout isn't valid JSON or doesn't carry a `diagnostics` array.
|
|
75015
75492
|
*/
|
|
75016
|
-
const parseOxlintOutput = (stdout, project, rootDirectory, sourcePathByLintPath) => {
|
|
75493
|
+
const parseOxlintOutput = (stdout, project, rootDirectory, sourcePathByLintPath, sourceMapByLintPath) => {
|
|
75017
75494
|
if (!stdout) return [];
|
|
75018
75495
|
const jsonStart = stdout.indexOf("{");
|
|
75019
75496
|
const sanitizedStdout = jsonStart > 0 ? stdout.slice(jsonStart) : stdout;
|
|
@@ -75031,6 +75508,7 @@ const parseOxlintOutput = (stdout, project, rootDirectory, sourcePathByLintPath)
|
|
|
75031
75508
|
const sourceLinesCache = /* @__PURE__ */ new Map();
|
|
75032
75509
|
const resolveAbsolutePath = (filename) => Path.isAbsolute(filename) ? filename : Path.resolve(rootDirectory || ".", filename);
|
|
75033
75510
|
const resolveMappedSourceFilename = (filename) => sourcePathByLintPath?.get(Path.normalize(resolveAbsolutePath(filename)));
|
|
75511
|
+
const resolvePreparedSourceMap = (filename) => sourceMapByLintPath?.get(Path.normalize(resolveAbsolutePath(filename)));
|
|
75034
75512
|
const resolveSourceFilename = (filename) => resolveMappedSourceFilename(filename) ?? filename;
|
|
75035
75513
|
const readSourceBuffer = (filename) => {
|
|
75036
75514
|
const absolutePath = resolveAbsolutePath(resolveSourceFilename(filename));
|
|
@@ -75062,7 +75540,19 @@ const parseOxlintOutput = (stdout, project, rootDirectory, sourcePathByLintPath)
|
|
|
75062
75540
|
minifiedFileCache.set(absolutePath, minified);
|
|
75063
75541
|
return minified;
|
|
75064
75542
|
};
|
|
75065
|
-
return suppressMemoizationInBailedOutFunctions(parsed.diagnostics.
|
|
75543
|
+
return suppressMemoizationInBailedOutFunctions(parsed.diagnostics.flatMap((diagnostic) => {
|
|
75544
|
+
const preparedSourceMap = resolvePreparedSourceMap(diagnostic.filename);
|
|
75545
|
+
if (preparedSourceMap === void 0) return [diagnostic];
|
|
75546
|
+
const { plugin, rule } = parseRuleCode(diagnostic.code);
|
|
75547
|
+
if (plugin !== "react-doctor" || !REACT_DOCTOR_RULE_REGISTRY[rule]?.tags?.includes("design")) return [];
|
|
75548
|
+
const labels = mapPreparedSourceLabels(diagnostic.labels, preparedSourceMap);
|
|
75549
|
+
const sourceFilename = resolveMappedSourceFilename(diagnostic.filename);
|
|
75550
|
+
return labels === null || sourceFilename === void 0 ? [] : [{
|
|
75551
|
+
...diagnostic,
|
|
75552
|
+
filename: sourceFilename,
|
|
75553
|
+
labels
|
|
75554
|
+
}];
|
|
75555
|
+
}).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) => {
|
|
75066
75556
|
const { plugin, rule } = parseRuleCode(diagnostic.code);
|
|
75067
75557
|
const primaryLabel = diagnostic.labels[0];
|
|
75068
75558
|
const cleaned = cleanDiagnosticMessage(diagnostic.message, diagnostic.help, plugin, rule, project);
|
|
@@ -75140,11 +75630,12 @@ const SANITIZED_ENV = buildOxlintChildEnv(process.env);
|
|
|
75140
75630
|
* The first three are splittable (the caller's binary-split retry
|
|
75141
75631
|
* shrinks the batch and re-spawns); the fourth isn't.
|
|
75142
75632
|
*/
|
|
75143
|
-
const spawnOxlint = (args, rootDirectory, nodeBinaryPath, spawnTimeoutMs = OXLINT_SPAWN_TIMEOUT_MS, outputMaxBytes = OXLINT_OUTPUT_MAX_BYTES, abortSignal) => new Promise((resolve, reject) => {
|
|
75633
|
+
const spawnOxlint = (args, rootDirectory, nodeBinaryPath, spawnTimeoutMs = OXLINT_SPAWN_TIMEOUT_MS, outputMaxBytes = OXLINT_OUTPUT_MAX_BYTES, abortSignal, onSpawn) => new Promise((resolve, reject) => {
|
|
75144
75634
|
if (abortSignal?.aborted) {
|
|
75145
75635
|
reject(new ReactDoctorError({ reason: new OxlintSpawnFailed({ cause: "lint phase aborted" }) }));
|
|
75146
75636
|
return;
|
|
75147
75637
|
}
|
|
75638
|
+
onSpawn?.();
|
|
75148
75639
|
const child = spawn(nodeBinaryPath, buildProfiledNodeArguments({
|
|
75149
75640
|
argumentsList: args,
|
|
75150
75641
|
cpuProfileDirectory: SANITIZED_ENV.REACT_DOCTOR_CPU_PROFILE_DIR,
|
|
@@ -75280,7 +75771,7 @@ const isParallelismRelatedSpawnError = (error) => {
|
|
|
75280
75771
|
* loop with a slimmer config in that case.
|
|
75281
75772
|
*/
|
|
75282
75773
|
const spawnLintBatches = async (input) => {
|
|
75283
|
-
const { baseArgs, fileBatches, rootDirectory, nodeBinaryPath, project, sourcePathByLintPath, onPartialFailure, onFileProgress, spawnTimeoutMs, outputMaxBytes, splitTotalBudgetMs = OXLINT_SPLIT_TOTAL_BUDGET_MS, splitMaxDepth = 8, signal, deadlineEpochMs } = input;
|
|
75774
|
+
const { baseArgs, fileBatches, rootDirectory, nodeBinaryPath, project, sourcePathByLintPath, sourceMapByLintPath, onPartialFailure, onFileProgress, spawnTimeoutMs, outputMaxBytes, splitTotalBudgetMs = OXLINT_SPLIT_TOTAL_BUDGET_MS, splitMaxDepth = 8, signal, deadlineEpochMs } = input;
|
|
75284
75775
|
const resolveSourcePath = (filePath) => {
|
|
75285
75776
|
const absoluteFilePath = Path.isAbsolute(filePath) ? filePath : Path.resolve(rootDirectory, filePath);
|
|
75286
75777
|
return sourcePathByLintPath?.get(Path.normalize(absoluteFilePath)) ?? filePath;
|
|
@@ -75304,7 +75795,21 @@ const spawnLintBatches = async (input) => {
|
|
|
75304
75795
|
}
|
|
75305
75796
|
const batchArgs = [...baseArgs, ...batch];
|
|
75306
75797
|
try {
|
|
75307
|
-
|
|
75798
|
+
const spawnBatch = () => {
|
|
75799
|
+
if (isPastDeadline()) {
|
|
75800
|
+
deadlineSkippedFiles.push(...batch);
|
|
75801
|
+
batchState.deadlineSkippedFileCount += batch.length;
|
|
75802
|
+
return Promise.resolve(null);
|
|
75803
|
+
}
|
|
75804
|
+
return spawnOxlint(batchArgs, rootDirectory, nodeBinaryPath, spawnTimeoutMs, outputMaxBytes, signal, () => {
|
|
75805
|
+
if (batchState.didStart) return;
|
|
75806
|
+
batchState.didStart = true;
|
|
75807
|
+
startedFileCount += batchState.initialFileCount;
|
|
75808
|
+
});
|
|
75809
|
+
};
|
|
75810
|
+
const stdout = input.spawnSlots === void 0 ? await spawnBatch() : await input.spawnSlots.run(spawnBatch, signal);
|
|
75811
|
+
if (stdout === null) return [];
|
|
75812
|
+
return parseOxlintOutput(stdout, project, rootDirectory, sourcePathByLintPath, sourceMapByLintPath);
|
|
75308
75813
|
} catch (error) {
|
|
75309
75814
|
if (!isSplittableReactDoctorError(error)) throw error;
|
|
75310
75815
|
if (isPastDeadline()) {
|
|
@@ -75348,14 +75853,15 @@ const spawnLintBatches = async (input) => {
|
|
|
75348
75853
|
deadlineSkippedFiles.push(...batch);
|
|
75349
75854
|
return [];
|
|
75350
75855
|
}
|
|
75351
|
-
startedFileCount += batch.length;
|
|
75352
75856
|
const batchState = {
|
|
75353
75857
|
deadlineMs: null,
|
|
75354
|
-
deadlineSkippedFileCount: 0
|
|
75858
|
+
deadlineSkippedFileCount: 0,
|
|
75859
|
+
didStart: false,
|
|
75860
|
+
initialFileCount: batch.length
|
|
75355
75861
|
};
|
|
75356
75862
|
const batchDiagnostics = await spawnLintBatch(batch, 0, batchState);
|
|
75357
75863
|
scannedFileCount += batch.length - batchState.deadlineSkippedFileCount;
|
|
75358
|
-
if (passOnFileProgress) {
|
|
75864
|
+
if (passOnFileProgress && batchState.didStart) {
|
|
75359
75865
|
displayedFileCount = Math.min(Math.max(displayedFileCount, scannedFileCount), totalFileCount);
|
|
75360
75866
|
passOnFileProgress(displayedFileCount, totalFileCount);
|
|
75361
75867
|
}
|
|
@@ -75439,8 +75945,8 @@ const validateRuleRegistration = () => {
|
|
|
75439
75945
|
for (const fullKey of ALL_REACT_DOCTOR_RULE_KEYS) {
|
|
75440
75946
|
const ruleName = fullKey.replace(/^react-doctor\//, "");
|
|
75441
75947
|
if (!getRuleCategory(ruleName)) missingCategory.push(fullKey);
|
|
75442
|
-
if (!
|
|
75443
|
-
if (FRAMEWORK_SPECIFIC_RULE_KEYS.has(fullKey) && !
|
|
75948
|
+
if (!REACT_DOCTOR_RULE_REGISTRY[ruleName]?.recommendation) missingHelp.push(fullKey);
|
|
75949
|
+
if (FRAMEWORK_SPECIFIC_RULE_KEYS.has(fullKey) && !REACT_DOCTOR_RULE_REGISTRY[ruleName]?.requires) missingMetadata.push(fullKey);
|
|
75444
75950
|
}
|
|
75445
75951
|
if (missingCategory.length === 0 && missingHelp.length === 0 && missingMetadata.length === 0) return;
|
|
75446
75952
|
const detail = [
|
|
@@ -75743,20 +76249,47 @@ const prepareHtmlScriptSource = (sourceBuffer) => {
|
|
|
75743
76249
|
lintBuffer: maskedBuffer ?? sourceBuffer
|
|
75744
76250
|
};
|
|
75745
76251
|
};
|
|
75746
|
-
const
|
|
76252
|
+
const ASTRO_FILE_PATTERN = /\.astro$/;
|
|
76253
|
+
const prepareLintSources = (rootDirectory, temporaryDirectory, candidateFiles) => {
|
|
75747
76254
|
const lintFiles = [];
|
|
75748
76255
|
const sourcePathByLintPath = /* @__PURE__ */ new Map();
|
|
76256
|
+
const sourceMapByLintPath = /* @__PURE__ */ new Map();
|
|
75749
76257
|
const sizeByLintPath = /* @__PURE__ */ new Map();
|
|
75750
76258
|
const htmlSourcesDirectory = Path.join(temporaryDirectory, "html-sources");
|
|
76259
|
+
const astroSourcesDirectory = Path.join(temporaryDirectory, "astro-sources");
|
|
75751
76260
|
let htmlFileIndex = 0;
|
|
76261
|
+
let astroFileIndex = 0;
|
|
75752
76262
|
let hasThreeModuleImport = false;
|
|
75753
76263
|
for (const candidateFile of candidateFiles) {
|
|
75754
|
-
if (!HTML_FILE_PATTERN.test(candidateFile)) {
|
|
76264
|
+
if (!HTML_FILE_PATTERN.test(candidateFile) && !ASTRO_FILE_PATTERN.test(candidateFile)) {
|
|
75755
76265
|
lintFiles.push(candidateFile);
|
|
75756
76266
|
continue;
|
|
75757
76267
|
}
|
|
75758
76268
|
const absoluteSourcePath = Path.isAbsolute(candidateFile) ? candidateFile : Path.resolve(rootDirectory, candidateFile);
|
|
75759
76269
|
const sourceBuffer = NFS.readFileSync(absoluteSourcePath);
|
|
76270
|
+
if (ASTRO_FILE_PATTERN.test(candidateFile)) {
|
|
76271
|
+
const compilerSourcePath = absoluteSourcePath.replaceAll("\\", "/");
|
|
76272
|
+
const convertedSource = convertToTSX(sourceBuffer.toString("utf8"), {
|
|
76273
|
+
filename: compilerSourcePath,
|
|
76274
|
+
sourcemap: "external",
|
|
76275
|
+
includeScripts: true
|
|
76276
|
+
});
|
|
76277
|
+
if (astroFileIndex === 0) NFS.mkdirSync(astroSourcesDirectory, { recursive: true });
|
|
76278
|
+
const lintPath = Path.join(astroSourcesDirectory, `${astroFileIndex}.tsx`);
|
|
76279
|
+
const generatedBuffer = Buffer.from(convertedSource.code);
|
|
76280
|
+
NFS.writeFileSync(lintPath, generatedBuffer);
|
|
76281
|
+
lintFiles.push(candidateFile);
|
|
76282
|
+
lintFiles.push(lintPath);
|
|
76283
|
+
sourcePathByLintPath.set(Path.resolve(lintPath), candidateFile);
|
|
76284
|
+
sourceMapByLintPath.set(Path.resolve(lintPath), {
|
|
76285
|
+
traceMap: new TraceMap(JSON.stringify(convertedSource.map)),
|
|
76286
|
+
generatedBuffer,
|
|
76287
|
+
sourceBuffer
|
|
76288
|
+
});
|
|
76289
|
+
sizeByLintPath.set(lintPath, sourceBuffer.length);
|
|
76290
|
+
astroFileIndex++;
|
|
76291
|
+
continue;
|
|
76292
|
+
}
|
|
75760
76293
|
const { executableScriptBodies, lintBuffer } = prepareHtmlScriptSource(sourceBuffer);
|
|
75761
76294
|
if (htmlFileIndex === 0) NFS.mkdirSync(htmlSourcesDirectory, { recursive: true });
|
|
75762
76295
|
const lintPath = Path.join(htmlSourcesDirectory, `${htmlFileIndex}.astro`);
|
|
@@ -75770,6 +76303,7 @@ const prepareHtmlLintSources = (rootDirectory, temporaryDirectory, candidateFile
|
|
|
75770
76303
|
return {
|
|
75771
76304
|
lintFiles,
|
|
75772
76305
|
sourcePathByLintPath,
|
|
76306
|
+
sourceMapByLintPath,
|
|
75773
76307
|
sizeByLintPath,
|
|
75774
76308
|
hasThreeModuleImport
|
|
75775
76309
|
};
|
|
@@ -75988,10 +76522,10 @@ const runOxlint = async (options) => {
|
|
|
75988
76522
|
rootDirectory,
|
|
75989
76523
|
candidateFiles
|
|
75990
76524
|
});
|
|
75991
|
-
const
|
|
75992
|
-
const lintFiles =
|
|
75993
|
-
const
|
|
75994
|
-
const lintProject = !project.hasThree &&
|
|
76525
|
+
const preparedLintSources = prepareLintSources(rootDirectory, configDirectory, candidateFiles);
|
|
76526
|
+
const lintFiles = preparedLintSources.lintFiles;
|
|
76527
|
+
const hasPreparedFiles = preparedLintSources.sourcePathByLintPath.size > 0;
|
|
76528
|
+
const lintProject = !project.hasThree && preparedLintSources.hasThreeModuleImport ? {
|
|
75995
76529
|
...project,
|
|
75996
76530
|
hasThree: true
|
|
75997
76531
|
} : project;
|
|
@@ -76013,7 +76547,7 @@ const runOxlint = async (options) => {
|
|
|
76013
76547
|
sidecarRuleIdFilter: overrides.sidecarRuleIdFilter
|
|
76014
76548
|
});
|
|
76015
76549
|
const sizeByFile = sizedScanFiles !== null && lintBatchOrdering === "cost" ? new Map(sizedScanFiles.map((entry) => [entry.path, entry.sizeBytes])) : null;
|
|
76016
|
-
if (sizeByFile !== null) for (const [lintPath, sizeBytes] of
|
|
76550
|
+
if (sizeByFile !== null) for (const [lintPath, sizeBytes] of preparedLintSources.sizeByLintPath) sizeByFile.set(lintPath, sizeBytes);
|
|
76017
76551
|
const buildFileBatches = (passBaseArgs, passFiles) => sizeByFile !== null ? planLintBatches({
|
|
76018
76552
|
baseArgs: passBaseArgs,
|
|
76019
76553
|
files: passFiles,
|
|
@@ -76043,7 +76577,8 @@ const runOxlint = async (options) => {
|
|
|
76043
76577
|
rootDirectory,
|
|
76044
76578
|
nodeBinaryPath,
|
|
76045
76579
|
project: lintProject,
|
|
76046
|
-
sourcePathByLintPath:
|
|
76580
|
+
sourcePathByLintPath: preparedLintSources.sourcePathByLintPath,
|
|
76581
|
+
sourceMapByLintPath: preparedLintSources.sourceMapByLintPath,
|
|
76047
76582
|
onPartialFailure: reportPartialFailure,
|
|
76048
76583
|
onAnalyzedFiles: (filePaths) => {
|
|
76049
76584
|
analyzedFiles = filePaths;
|
|
@@ -76052,6 +76587,7 @@ const runOxlint = async (options) => {
|
|
|
76052
76587
|
spawnTimeoutMs,
|
|
76053
76588
|
outputMaxBytes,
|
|
76054
76589
|
concurrency: options.concurrency,
|
|
76590
|
+
spawnSlots: options.spawnSlots,
|
|
76055
76591
|
signal: options.signal,
|
|
76056
76592
|
deadlineEpochMs: options.deadlineEpochMs
|
|
76057
76593
|
});
|
|
@@ -76078,7 +76614,7 @@ const runOxlint = async (options) => {
|
|
|
76078
76614
|
};
|
|
76079
76615
|
}
|
|
76080
76616
|
};
|
|
76081
|
-
if (perFileLintCacheEnabled && !project.hasReactCompiler && project.hasReactCompilerLintPlugin !== true && extendsPaths.length === 0 && userPlugins.length === 0 && !
|
|
76617
|
+
if (perFileLintCacheEnabled && !project.hasReactCompiler && project.hasReactCompilerLintPlugin !== true && extendsPaths.length === 0 && userPlugins.length === 0 && !hasPreparedFiles) {
|
|
76082
76618
|
const rulesetHash = computeRulesetHash({
|
|
76083
76619
|
config: buildConfig({
|
|
76084
76620
|
extendsPaths: [],
|
|
@@ -76244,7 +76780,8 @@ const runOxlint = async (options) => {
|
|
|
76244
76780
|
rootDirectory,
|
|
76245
76781
|
nodeBinaryPath,
|
|
76246
76782
|
project: lintProject,
|
|
76247
|
-
sourcePathByLintPath:
|
|
76783
|
+
sourcePathByLintPath: preparedLintSources.sourcePathByLintPath,
|
|
76784
|
+
sourceMapByLintPath: preparedLintSources.sourceMapByLintPath,
|
|
76248
76785
|
onPartialFailure,
|
|
76249
76786
|
onAnalyzedFiles: (filePaths) => {
|
|
76250
76787
|
analyzedFiles = filePaths;
|
|
@@ -76253,6 +76790,7 @@ const runOxlint = async (options) => {
|
|
|
76253
76790
|
spawnTimeoutMs,
|
|
76254
76791
|
outputMaxBytes,
|
|
76255
76792
|
concurrency: options.concurrency,
|
|
76793
|
+
spawnSlots: options.spawnSlots,
|
|
76256
76794
|
signal: options.signal,
|
|
76257
76795
|
deadlineEpochMs: options.deadlineEpochMs
|
|
76258
76796
|
});
|
|
@@ -76347,6 +76885,7 @@ var Linter = class Linter extends Service()("react-doctor/Linter") {
|
|
|
76347
76885
|
const spawnTimeoutMs = yield* OxlintSpawnTimeoutMs;
|
|
76348
76886
|
const outputMaxBytes = yield* OxlintOutputMaxBytes;
|
|
76349
76887
|
const concurrency = yield* OxlintConcurrency;
|
|
76888
|
+
const spawnSlots = yield* OxlintSpawnSlots;
|
|
76350
76889
|
const lintBatchOrdering = yield* LintBatchOrdering;
|
|
76351
76890
|
const perFileLintCacheEnabled = yield* PerFileLintCacheEnabled;
|
|
76352
76891
|
const sidecarLintCacheEnabled = yield* SidecarLintCacheEnabled;
|
|
@@ -76376,6 +76915,7 @@ var Linter = class Linter extends Service()("react-doctor/Linter") {
|
|
|
76376
76915
|
onSidecarStats: input.onSidecarStats,
|
|
76377
76916
|
spawnTimeoutMs,
|
|
76378
76917
|
outputMaxBytes,
|
|
76918
|
+
spawnSlots: spawnSlots ?? void 0,
|
|
76379
76919
|
concurrency,
|
|
76380
76920
|
signal,
|
|
76381
76921
|
lintBatchOrdering,
|
|
@@ -78038,6 +78578,11 @@ const computeConfigFingerprint = (projectDirectory, version) => {
|
|
|
78038
78578
|
}
|
|
78039
78579
|
return crypto.createHash("sha1").update(parts.join("|")).digest("hex");
|
|
78040
78580
|
};
|
|
78581
|
+
const createLintPhaseAbortError = () => new ReactDoctorError({ reason: new OxlintSpawnFailed({ cause: "lint phase aborted" }) });
|
|
78582
|
+
const createOxlintSpawnSlots = (concurrency) => createWorkerSlots({
|
|
78583
|
+
slotCount: resolveScanConcurrency(concurrency),
|
|
78584
|
+
createAbortError: createLintPhaseAbortError
|
|
78585
|
+
});
|
|
78041
78586
|
const AI_TRAINING_ENV_VARS = [
|
|
78042
78587
|
["HF_DATASETS_CACHE", "huggingface"],
|
|
78043
78588
|
["HF_HOME", "huggingface"],
|
|
@@ -78117,7 +78662,7 @@ const groupBy = (items, keyFn) => {
|
|
|
78117
78662
|
* recipe, so advertising "fetch the fix recipe" for them sends agents to
|
|
78118
78663
|
* a 404. Gate the directive on this predicate.
|
|
78119
78664
|
*/
|
|
78120
|
-
const hasPublishedFixRecipe = (diagnostic) => diagnostic.plugin === "react-doctor" && Object.hasOwn(
|
|
78665
|
+
const hasPublishedFixRecipe = (diagnostic) => diagnostic.plugin === "react-doctor" && Object.hasOwn(REACT_DOCTOR_RULE_REGISTRY, diagnostic.rule);
|
|
78121
78666
|
const unionValues = (baseValues, overrideValues) => [...new Set([...baseValues, ...overrideValues])];
|
|
78122
78667
|
const mergeIgnores = (baseIgnore, overrideIgnore) => {
|
|
78123
78668
|
const mergedIgnore = {
|
|
@@ -78465,7 +79010,7 @@ const makeNoopConsole = () => ({
|
|
|
78465
79010
|
});
|
|
78466
79011
|
//#endregion
|
|
78467
79012
|
//#region src/cli/utils/version.ts
|
|
78468
|
-
const VERSION = "0.9.2-dev.
|
|
79013
|
+
const VERSION = "0.9.2-dev.a81b3d6";
|
|
78469
79014
|
//#endregion
|
|
78470
79015
|
//#region src/cli/utils/json-mode.ts
|
|
78471
79016
|
let context = null;
|
|
@@ -78823,13 +79368,13 @@ const isDevVersion = (version) => version === "0.0.0" || version.includes("-");
|
|
|
78823
79368
|
* uploads source-map artifacts under, so stack frames symbolicate. Honors the
|
|
78824
79369
|
* standard `SENTRY_RELEASE` override.
|
|
78825
79370
|
*/
|
|
78826
|
-
const resolveSentryRelease = () => process.env.SENTRY_RELEASE || `react-doctor@0.9.2-dev.
|
|
79371
|
+
const resolveSentryRelease = () => process.env.SENTRY_RELEASE || `react-doctor@0.9.2-dev.a81b3d6`;
|
|
78827
79372
|
/**
|
|
78828
79373
|
* Deployment environment shown in Sentry's environment filter. Defaults to
|
|
78829
79374
|
* `production` for tagged releases and `development` for dev/unbuilt versions,
|
|
78830
79375
|
* overridable via the standard `SENTRY_ENVIRONMENT` env var.
|
|
78831
79376
|
*/
|
|
78832
|
-
const resolveSentryEnvironment = () => process.env.SENTRY_ENVIRONMENT || (isDevVersion("0.9.2-dev.
|
|
79377
|
+
const resolveSentryEnvironment = () => process.env.SENTRY_ENVIRONMENT || (isDevVersion("0.9.2-dev.a81b3d6") ? "development" : "production");
|
|
78833
79378
|
/**
|
|
78834
79379
|
* Performance-tracing sample rate in `[0, 1]`. Reads `SENTRY_TRACES_SAMPLE_RATE`
|
|
78835
79380
|
* (set to `0` to disable tracing) and falls back to
|
|
@@ -90683,7 +91228,8 @@ const buildRuntimeLayers = (input) => {
|
|
|
90683
91228
|
resolvedDirectory: input.directory,
|
|
90684
91229
|
configSourceDirectory: input.configSourceDirectory
|
|
90685
91230
|
}) : Config.layerNode, Files.layerNode, Git.layerNode, linterLayer, LintPartialFailures.layerLive, deadCodeLayer, progressLayer, reporterLayer, scoreLayer, supplyChainLayer);
|
|
90686
|
-
|
|
91231
|
+
const layersWithConcurrency = input.oxlintConcurrency === void 0 ? baseLayers : mergeAll$1(baseLayers, succeed$3(OxlintConcurrency, input.oxlintConcurrency));
|
|
91232
|
+
return input.oxlintSpawnSlots === void 0 ? layersWithConcurrency : mergeAll$1(layersWithConcurrency, succeed$3(OxlintSpawnSlots, input.oxlintSpawnSlots));
|
|
90687
91233
|
};
|
|
90688
91234
|
//#endregion
|
|
90689
91235
|
//#region src/cli/utils/with-sentry-run-span.ts
|
|
@@ -93187,7 +93733,7 @@ const buildRunEventConfig = (options, userConfig, hasCustomConfig, resolvedWorke
|
|
|
93187
93733
|
userConfig
|
|
93188
93734
|
};
|
|
93189
93735
|
};
|
|
93190
|
-
const
|
|
93736
|
+
const inspectWithOxlintRuntime = async (directory, inputOptions, oxlintRuntime) => {
|
|
93191
93737
|
const startTime = performance$1.now();
|
|
93192
93738
|
const deadlineEpochMs = inputOptions.deadlineEpochMs ?? (inputOptions.maxDurationMs != null ? Date.now() + inputOptions.maxDurationMs : null);
|
|
93193
93739
|
const isConcurrentScan = inputOptions.concurrentScan === true;
|
|
@@ -93213,7 +93759,7 @@ const inspect = async (directory, inputOptions = {}) => {
|
|
|
93213
93759
|
try {
|
|
93214
93760
|
const result = await withSentryRunSpan(async (rootSentrySpan) => {
|
|
93215
93761
|
try {
|
|
93216
|
-
return await runInspectWithRuntime(scanDirectory, options, userConfig, hasConfigOverride, configSourceDirectory, startTime, deadlineEpochMs, rootSentrySpan);
|
|
93762
|
+
return await runInspectWithRuntime(scanDirectory, options, userConfig, hasConfigOverride, configSourceDirectory, startTime, deadlineEpochMs, rootSentrySpan, oxlintRuntime);
|
|
93217
93763
|
} catch (error) {
|
|
93218
93764
|
recordRunEvent(rootSentrySpan, {
|
|
93219
93765
|
...buildRunEventConfig(options, userConfig, userConfig !== null),
|
|
@@ -93229,6 +93775,15 @@ const inspect = async (directory, inputOptions = {}) => {
|
|
|
93229
93775
|
if (ownsSpinnerSilence) setSpinnerSilent(wasSpinnerSilent);
|
|
93230
93776
|
}
|
|
93231
93777
|
};
|
|
93778
|
+
const createInvocationInspect = (requestedOxlintConcurrency) => {
|
|
93779
|
+
const concurrency = resolveScanConcurrency(requestedOxlintConcurrency ?? runSync(OxlintConcurrency));
|
|
93780
|
+
const oxlintRuntime = {
|
|
93781
|
+
concurrency,
|
|
93782
|
+
spawnSlots: createOxlintSpawnSlots(concurrency)
|
|
93783
|
+
};
|
|
93784
|
+
return (directory, inputOptions = {}) => inspectWithOxlintRuntime(directory, inputOptions, oxlintRuntime);
|
|
93785
|
+
};
|
|
93786
|
+
const inspect = async (directory, inputOptions = {}) => createInvocationInspect(inputOptions.concurrency)(directory, inputOptions);
|
|
93232
93787
|
const countIncompleteLintFiles = (lintPartialFailures) => countDroppedLintFiles(lintPartialFailures) + countDeadlineSkippedFiles(lintPartialFailures);
|
|
93233
93788
|
/**
|
|
93234
93789
|
* Runs a second, lint-only scan over the changed files as they existed at the
|
|
@@ -93282,7 +93837,8 @@ const runBaselineComparison = async (params) => {
|
|
|
93282
93837
|
shouldRunSupplyChain: params.options.supplyChain,
|
|
93283
93838
|
shouldComputeScore: false,
|
|
93284
93839
|
shouldShowProgressSpinners: false,
|
|
93285
|
-
oxlintConcurrency: params.
|
|
93840
|
+
oxlintConcurrency: params.oxlintRuntime.concurrency,
|
|
93841
|
+
oxlintSpawnSlots: params.oxlintRuntime.spawnSlots
|
|
93286
93842
|
});
|
|
93287
93843
|
const baseOutput = await runPromise(restoreLegacyThrow(runInspect({
|
|
93288
93844
|
directory: snapshot.tempDirectory,
|
|
@@ -93327,7 +93883,7 @@ const runBaselineComparison = async (params) => {
|
|
|
93327
93883
|
snapshot.cleanup();
|
|
93328
93884
|
}
|
|
93329
93885
|
};
|
|
93330
|
-
const runInspectWithRuntime = async (directory, options, userConfig, hasConfigOverride, configSourceDirectory, startTime, deadlineEpochMs, rootSentrySpan) => {
|
|
93886
|
+
const runInspectWithRuntime = async (directory, options, userConfig, hasConfigOverride, configSourceDirectory, startTime, deadlineEpochMs, rootSentrySpan, oxlintRuntime) => {
|
|
93331
93887
|
const isDiffMode = options.includePaths.length > 0;
|
|
93332
93888
|
const resolvedNodeBinaryPath = await resolveOxlintNode(options.lint, options.scoreOnly || options.silent);
|
|
93333
93889
|
const lintBindingMissing = options.lint && !resolvedNodeBinaryPath;
|
|
@@ -93377,7 +93933,8 @@ const runInspectWithRuntime = async (directory, options, userConfig, hasConfigOv
|
|
|
93377
93933
|
shouldRunSupplyChain: options.supplyChain,
|
|
93378
93934
|
shouldComputeScore: !options.noScore,
|
|
93379
93935
|
shouldShowProgressSpinners,
|
|
93380
|
-
oxlintConcurrency:
|
|
93936
|
+
oxlintConcurrency: oxlintRuntime.concurrency,
|
|
93937
|
+
oxlintSpawnSlots: oxlintRuntime.spawnSlots,
|
|
93381
93938
|
reporterLayer: options.uiLayers?.reporter,
|
|
93382
93939
|
progressLayer: options.uiLayers?.progress
|
|
93383
93940
|
});
|
|
@@ -93434,7 +93991,8 @@ const runInspectWithRuntime = async (directory, options, userConfig, hasConfigOv
|
|
|
93434
93991
|
baseFiles: options.baseline.baseFiles,
|
|
93435
93992
|
headFiles: options.baseline.headFiles,
|
|
93436
93993
|
headAnalyzedFiles: output.analyzedFiles,
|
|
93437
|
-
deadlineEpochMs
|
|
93994
|
+
deadlineEpochMs,
|
|
93995
|
+
oxlintRuntime
|
|
93438
93996
|
});
|
|
93439
93997
|
if (comparison) {
|
|
93440
93998
|
inspectDiagnostics = comparison.displayDiagnostics;
|
|
@@ -96267,6 +96825,7 @@ const inspectAction = async (directory, flags, invocationCommand = "inspect") =>
|
|
|
96267
96825
|
if (!isQuiet) if (!flags.verbose && canAnimateOnboarding(process.stdout)) await runPromise(playWelcomeScene({ speedMultiplier: !isOnboardingForced() && hasCompletedOnboarding() ? 2 : 1 }));
|
|
96268
96826
|
else runSync(printBrandedHeader);
|
|
96269
96827
|
const scanOptions = resolveCliInspectOptions(flags, userConfig);
|
|
96828
|
+
const inspectProject = createInvocationInspect(scanOptions.concurrency);
|
|
96270
96829
|
const scanDeadlineEpochMs = scanOptions.maxDurationMs !== void 0 ? Date.now() + scanOptions.maxDurationMs : void 0;
|
|
96271
96830
|
const categoryFilters = new Set(scanOptions.categoryFilters ?? []);
|
|
96272
96831
|
const skipPrompts = shouldSkipPrompts({
|
|
@@ -96412,7 +96971,7 @@ const inspectAction = async (directory, flags, invocationCommand = "inspect") =>
|
|
|
96412
96971
|
const scanStagedProject = async (projectRun) => {
|
|
96413
96972
|
const { projectScan, includePaths } = projectRun;
|
|
96414
96973
|
const projectTempDirectory = Path.join(snapshot.tempDirectory, projectScan.treeRelativeDirectory);
|
|
96415
|
-
const scanResult = await
|
|
96974
|
+
const scanResult = await inspectProject(projectTempDirectory, {
|
|
96416
96975
|
...scanOptions,
|
|
96417
96976
|
deadlineEpochMs: scanDeadlineEpochMs,
|
|
96418
96977
|
includePaths: [...includePaths],
|
|
@@ -96571,7 +97130,7 @@ const inspectAction = async (directory, flags, invocationCommand = "inspect") =>
|
|
|
96571
97130
|
if (supplyChainManifestChanged) includePaths.push("package.json");
|
|
96572
97131
|
}
|
|
96573
97132
|
if (!isQuiet && !isMultiProject) cliLogger.dim(" ");
|
|
96574
|
-
const scanResult = await
|
|
97133
|
+
const scanResult = await inspectProject(scanDirectory, {
|
|
96575
97134
|
...scanOptions,
|
|
96576
97135
|
deadlineEpochMs: scanDeadlineEpochMs,
|
|
96577
97136
|
includePaths,
|
|
@@ -97796,7 +98355,7 @@ program.command("experimental-tui [directory]", { hidden: true }).description("[
|
|
|
97796
98355
|
return;
|
|
97797
98356
|
}
|
|
97798
98357
|
recordCount(METRIC.cliInvoked, 1, { command: "experimental-tui" });
|
|
97799
|
-
const { runScanApp } = await import("./run-scan-app-
|
|
98358
|
+
const { runScanApp } = await import("./run-scan-app-DHRvqfkX.js");
|
|
97800
98359
|
const { shouldFail } = await runScanApp({
|
|
97801
98360
|
directory,
|
|
97802
98361
|
options: {
|
|
@@ -97836,7 +98395,7 @@ Promise.resolve().then(() => assertNoRemovedFlags(process.argv)).then(() => prog
|
|
|
97836
98395
|
handleError(error, { sentryEventId });
|
|
97837
98396
|
});
|
|
97838
98397
|
//#endregion
|
|
97839
|
-
export { toForwardSlashes as A, getCategoryImpact as B, buildRulePriorityMap as C, resolveBlockingLevel as D, formatLearnMoreLine as E, TUI_REPORT_DETAIL_WIDTH_FRACTION as F, runPromise as G, mapWithConcurrency as H, isCiEnvironment as I, succeed$3 as J, sync as K, DIAGNOSTIC_CATEGORY_BUCKETS as L, isUnicodeSupported as M, METRIC as N, isReactDoctorWorkflowInstalled as O, TUI_REPORT_COMPACT_MAX_ROWS as P, Progress as R, hasLintHardFailure as S, formatFixRecipeLine as T, mergeReactDoctorConfigs as U, highlighter as V, resolveScanTarget as W, canAnimateOnboarding as _, resolveCliInspectOptions as a, buildCodeFrame as b, detectLaunchableAgents as c, launchCliAgent as d, isShareOptedOut as f, doctorFace as g, easeOutCubic as h, selectProjects as i, findNearestPackageDirectory as j, recordCount as k, CLI_AGENT_BINARIES as l, printFooter as m, shouldFailScanGate as n, countUniqueScannedFiles as o,
|
|
98398
|
+
export { toForwardSlashes as A, getCategoryImpact as B, buildRulePriorityMap as C, resolveBlockingLevel as D, formatLearnMoreLine as E, TUI_REPORT_DETAIL_WIDTH_FRACTION as F, runPromise as G, mapWithConcurrency as H, isCiEnvironment as I, succeed$3 as J, sync as K, DIAGNOSTIC_CATEGORY_BUCKETS as L, isUnicodeSupported as M, METRIC as N, isReactDoctorWorkflowInstalled as O, TUI_REPORT_COMPACT_MAX_ROWS as P, Progress as R, hasLintHardFailure as S, formatFixRecipeLine as T, mergeReactDoctorConfigs as U, highlighter as V, resolveScanTarget as W, canAnimateOnboarding as _, resolveCliInspectOptions as a, buildCodeFrame as b, detectLaunchableAgents as c, launchCliAgent as d, isShareOptedOut as f, doctorFace as g, easeOutCubic as h, selectProjects as i, findNearestPackageDirectory as j, recordCount as k, CLI_AGENT_BINARIES as l, printFooter as m, shouldFailScanGate as n, countUniqueScannedFiles as o, createInvocationInspect as p, void_ as q, discoverWorkspacePackages as r, setUpGitHubActions as s, exitGracefully as t, copyToClipboard as u, computeProjectedScore as v, buildSortedRuleGroups as w, buildNoScoreMessage as x, formatElapsedTime as y, Reporter as z };
|
|
97840
98399
|
|
|
97841
98400
|
//# sourceMappingURL=cli.js.map
|
|
97842
|
-
//# debugId=
|
|
98401
|
+
//# debugId=3bff4f9b-31f8-5abe-b7a2-a0ab9f6a85b4
|