react-doctor 0.9.2-dev.b31fd85 → 0.9.2-dev.c6bdd2d
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 +892 -155
- package/dist/index.d.ts +8 -2
- package/dist/index.js +613 -62
- package/dist/lsp.js +613 -61
- package/package.json +5 -4
package/dist/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
|
|
2
|
-
!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="
|
|
2
|
+
!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="18c61424-4926-5cae-8f2a-6001534ea755")}catch(e){}}();
|
|
3
3
|
import { i as __toESM$1, r as __require, t as __commonJSMin$1 } from "./chunk-ChKA3wi6.js";
|
|
4
4
|
import { createRequire } from "node:module";
|
|
5
5
|
import reactDoctorPlugin, { ALL_REACT_DOCTOR_RULE_KEYS, CROSS_FILE_DEPENDENCY_COLLECTORS, CROSS_FILE_RULE_IDS, FRAMEWORK_SPECIFIC_RULE_KEYS, FRAMEWORK_TOKENS, MOTION_LIBRARY_PACKAGES, REACT_COMPILER_RULES, REACT_DOCTOR_RULES, classifySecurityScanFile, collectCrossFileDependencyProbes, resetManifestCaches, shouldReadSecurityScanContent } from "oxlint-plugin-react-doctor";
|
|
@@ -13,13 +13,14 @@ import * as NodeChildProcess from "node:child_process";
|
|
|
13
13
|
import { execFileSync, spawn, spawnSync } from "node:child_process";
|
|
14
14
|
import { ResolverFactory } from "oxc-resolver";
|
|
15
15
|
import ts from "typescript";
|
|
16
|
+
import * as NodeUrl from "node:url";
|
|
17
|
+
import { fileURLToPath } from "node:url";
|
|
16
18
|
import * as OS from "node:os";
|
|
17
19
|
import os from "node:os";
|
|
18
20
|
import { parseJSON5 } from "confbox";
|
|
19
|
-
import * as NodeUrl from "node:url";
|
|
20
|
-
import { fileURLToPath } from "node:url";
|
|
21
21
|
import { createJiti } from "jiti";
|
|
22
22
|
import { ANALYZED_MANIFEST_FILENAMES, DEFAULT_EXTENSIONS } from "deslop-js/analyzed-inputs";
|
|
23
|
+
import { convertToTSX } from "@astrojs/compiler/sync";
|
|
23
24
|
import { gzipSync } from "node:zlib";
|
|
24
25
|
//#region ../../node_modules/.pnpm/effect@4.0.0-beta.70/node_modules/effect/dist/Pipeable.js
|
|
25
26
|
/**
|
|
@@ -10262,7 +10263,7 @@ const Number$4 = globalThis.Number;
|
|
|
10262
10263
|
* @category constructors
|
|
10263
10264
|
* @since 2.0.0
|
|
10264
10265
|
*/
|
|
10265
|
-
const parse = (s) => {
|
|
10266
|
+
const parse$1 = (s) => {
|
|
10266
10267
|
if (s === "NaN") return some(NaN);
|
|
10267
10268
|
if (s === "Infinity") return some(Infinity);
|
|
10268
10269
|
if (s === "-Infinity") return some(-Infinity);
|
|
@@ -14304,12 +14305,12 @@ TaggedError("EncodingError");
|
|
|
14304
14305
|
//#endregion
|
|
14305
14306
|
//#region ../../node_modules/.pnpm/effect@4.0.0-beta.70/node_modules/effect/dist/internal/schema/annotations.js
|
|
14306
14307
|
/** @internal */
|
|
14307
|
-
function resolve(ast) {
|
|
14308
|
+
function resolve$1(ast) {
|
|
14308
14309
|
return ast.checks ? ast.checks[ast.checks.length - 1].annotations : ast.annotations;
|
|
14309
14310
|
}
|
|
14310
14311
|
/** @internal */
|
|
14311
14312
|
function resolveAt(key) {
|
|
14312
|
-
return (ast) => resolve(ast)?.[key];
|
|
14313
|
+
return (ast) => resolve$1(ast)?.[key];
|
|
14313
14314
|
}
|
|
14314
14315
|
/** @internal */
|
|
14315
14316
|
const resolveIdentifier = /* @__PURE__ */ resolveAt("identifier");
|
|
@@ -18061,7 +18062,7 @@ function asSync(parser) {
|
|
|
18061
18062
|
}
|
|
18062
18063
|
const recur$1 = /* @__PURE__ */ memoize((ast) => {
|
|
18063
18064
|
let parser;
|
|
18064
|
-
const astOptions = resolve(ast)?.["parseOptions"];
|
|
18065
|
+
const astOptions = resolve$1(ast)?.["parseOptions"];
|
|
18065
18066
|
if (!ast.context && !ast.encoding && !ast.checks) return (ou, options) => {
|
|
18066
18067
|
parser ??= ast.getParser(recur$1);
|
|
18067
18068
|
if (astOptions) options = {
|
|
@@ -57666,7 +57667,7 @@ var UrlParamsError = class extends TaggedError("UrlParamsError") {};
|
|
|
57666
57667
|
* @category converting
|
|
57667
57668
|
* @since 4.0.0
|
|
57668
57669
|
*/
|
|
57669
|
-
const makeUrl = (url, params, hash) => {
|
|
57670
|
+
const makeUrl$1 = (url, params, hash) => {
|
|
57670
57671
|
try {
|
|
57671
57672
|
const urlInstance = new URL(url, baseUrl());
|
|
57672
57673
|
for (let i = 0; i < params.params.length; i++) {
|
|
@@ -58300,7 +58301,7 @@ const Proto$2 = {
|
|
|
58300
58301
|
const make$10 = (f) => makeWith$1((effect) => flatMap$2(effect, (request) => withFiber((fiber) => {
|
|
58301
58302
|
const scopedController = scopedRequests.get(request);
|
|
58302
58303
|
const controller = scopedController ?? new AbortController();
|
|
58303
|
-
const urlResult = makeUrl(request.url, request.urlParams, getOrUndefined(request.hash));
|
|
58304
|
+
const urlResult = makeUrl$1(request.url, request.urlParams, getOrUndefined(request.hash));
|
|
58304
58305
|
if (isFailure(urlResult)) return fail$4(new HttpClientError({ reason: new InvalidUrlError({
|
|
58305
58306
|
request,
|
|
58306
58307
|
cause: urlResult.failure
|
|
@@ -58739,7 +58740,7 @@ const layer$7 = (loggers, options) => effect(CurrentLoggers, withFiber$1(fnUntra
|
|
|
58739
58740
|
* @since 4.0.0
|
|
58740
58741
|
*/
|
|
58741
58742
|
const policy = /* @__PURE__ */ forever$1.pipe(passthrough$2, /* @__PURE__ */ addDelay((error) => {
|
|
58742
|
-
if (isHttpClientError(error) && error.reason._tag === "StatusCodeError" && error.reason.response.status === 429) return succeed$2(seconds(fromUndefinedOr(error.reason.response.headers["retry-after"]).pipe(flatMap$5(parse), getOrElse$1(() => 5))));
|
|
58743
|
+
if (isHttpClientError(error) && error.reason._tag === "StatusCodeError" && error.reason.response.status === 429) return succeed$2(seconds(fromUndefinedOr(error.reason.response.headers["retry-after"]).pipe(flatMap$5(parse$1), getOrElse$1(() => 5))));
|
|
58743
58744
|
return succeed$2(seconds(1));
|
|
58744
58745
|
}));
|
|
58745
58746
|
/**
|
|
@@ -61381,6 +61382,428 @@ const layer = /* @__PURE__ */ succeed$3(Path$1)({
|
|
|
61381
61382
|
toFileUrl
|
|
61382
61383
|
});
|
|
61383
61384
|
//#endregion
|
|
61385
|
+
//#region ../../node_modules/.pnpm/@jridgewell+sourcemap-codec@1.5.5/node_modules/@jridgewell/sourcemap-codec/dist/sourcemap-codec.mjs
|
|
61386
|
+
var comma = ",".charCodeAt(0);
|
|
61387
|
+
";".charCodeAt(0);
|
|
61388
|
+
var chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
|
|
61389
|
+
var intToChar = new Uint8Array(64);
|
|
61390
|
+
var charToInt = new Uint8Array(128);
|
|
61391
|
+
for (let i = 0; i < chars.length; i++) {
|
|
61392
|
+
const c = chars.charCodeAt(i);
|
|
61393
|
+
intToChar[i] = c;
|
|
61394
|
+
charToInt[c] = i;
|
|
61395
|
+
}
|
|
61396
|
+
function decodeInteger(reader, relative) {
|
|
61397
|
+
let value = 0;
|
|
61398
|
+
let shift = 0;
|
|
61399
|
+
let integer = 0;
|
|
61400
|
+
do {
|
|
61401
|
+
integer = charToInt[reader.next()];
|
|
61402
|
+
value |= (integer & 31) << shift;
|
|
61403
|
+
shift += 5;
|
|
61404
|
+
} while (integer & 32);
|
|
61405
|
+
const shouldNegate = value & 1;
|
|
61406
|
+
value >>>= 1;
|
|
61407
|
+
if (shouldNegate) value = -2147483648 | -value;
|
|
61408
|
+
return relative + value;
|
|
61409
|
+
}
|
|
61410
|
+
function hasMoreVlq(reader, max) {
|
|
61411
|
+
if (reader.pos >= max) return false;
|
|
61412
|
+
return reader.peek() !== comma;
|
|
61413
|
+
}
|
|
61414
|
+
var StringReader = class {
|
|
61415
|
+
constructor(buffer) {
|
|
61416
|
+
this.pos = 0;
|
|
61417
|
+
this.buffer = buffer;
|
|
61418
|
+
}
|
|
61419
|
+
next() {
|
|
61420
|
+
return this.buffer.charCodeAt(this.pos++);
|
|
61421
|
+
}
|
|
61422
|
+
peek() {
|
|
61423
|
+
return this.buffer.charCodeAt(this.pos);
|
|
61424
|
+
}
|
|
61425
|
+
indexOf(char) {
|
|
61426
|
+
const { buffer, pos } = this;
|
|
61427
|
+
const idx = buffer.indexOf(char, pos);
|
|
61428
|
+
return idx === -1 ? buffer.length : idx;
|
|
61429
|
+
}
|
|
61430
|
+
};
|
|
61431
|
+
function decode(mappings) {
|
|
61432
|
+
const { length } = mappings;
|
|
61433
|
+
const reader = new StringReader(mappings);
|
|
61434
|
+
const decoded = [];
|
|
61435
|
+
let genColumn = 0;
|
|
61436
|
+
let sourcesIndex = 0;
|
|
61437
|
+
let sourceLine = 0;
|
|
61438
|
+
let sourceColumn = 0;
|
|
61439
|
+
let namesIndex = 0;
|
|
61440
|
+
do {
|
|
61441
|
+
const semi = reader.indexOf(";");
|
|
61442
|
+
const line = [];
|
|
61443
|
+
let sorted = true;
|
|
61444
|
+
let lastCol = 0;
|
|
61445
|
+
genColumn = 0;
|
|
61446
|
+
while (reader.pos < semi) {
|
|
61447
|
+
let seg;
|
|
61448
|
+
genColumn = decodeInteger(reader, genColumn);
|
|
61449
|
+
if (genColumn < lastCol) sorted = false;
|
|
61450
|
+
lastCol = genColumn;
|
|
61451
|
+
if (hasMoreVlq(reader, semi)) {
|
|
61452
|
+
sourcesIndex = decodeInteger(reader, sourcesIndex);
|
|
61453
|
+
sourceLine = decodeInteger(reader, sourceLine);
|
|
61454
|
+
sourceColumn = decodeInteger(reader, sourceColumn);
|
|
61455
|
+
if (hasMoreVlq(reader, semi)) {
|
|
61456
|
+
namesIndex = decodeInteger(reader, namesIndex);
|
|
61457
|
+
seg = [
|
|
61458
|
+
genColumn,
|
|
61459
|
+
sourcesIndex,
|
|
61460
|
+
sourceLine,
|
|
61461
|
+
sourceColumn,
|
|
61462
|
+
namesIndex
|
|
61463
|
+
];
|
|
61464
|
+
} else seg = [
|
|
61465
|
+
genColumn,
|
|
61466
|
+
sourcesIndex,
|
|
61467
|
+
sourceLine,
|
|
61468
|
+
sourceColumn
|
|
61469
|
+
];
|
|
61470
|
+
} else seg = [genColumn];
|
|
61471
|
+
line.push(seg);
|
|
61472
|
+
reader.pos++;
|
|
61473
|
+
}
|
|
61474
|
+
if (!sorted) sort(line);
|
|
61475
|
+
decoded.push(line);
|
|
61476
|
+
reader.pos = semi + 1;
|
|
61477
|
+
} while (reader.pos <= length);
|
|
61478
|
+
return decoded;
|
|
61479
|
+
}
|
|
61480
|
+
function sort(line) {
|
|
61481
|
+
line.sort(sortComparator$1);
|
|
61482
|
+
}
|
|
61483
|
+
function sortComparator$1(a, b) {
|
|
61484
|
+
return a[0] - b[0];
|
|
61485
|
+
}
|
|
61486
|
+
//#endregion
|
|
61487
|
+
//#region ../../node_modules/.pnpm/@jridgewell+resolve-uri@3.1.2/node_modules/@jridgewell/resolve-uri/dist/resolve-uri.mjs
|
|
61488
|
+
const schemeRegex = /^[\w+.-]+:\/\//;
|
|
61489
|
+
/**
|
|
61490
|
+
* Matches the parts of a URL:
|
|
61491
|
+
* 1. Scheme, including ":", guaranteed.
|
|
61492
|
+
* 2. User/password, including "@", optional.
|
|
61493
|
+
* 3. Host, guaranteed.
|
|
61494
|
+
* 4. Port, including ":", optional.
|
|
61495
|
+
* 5. Path, including "/", optional.
|
|
61496
|
+
* 6. Query, including "?", optional.
|
|
61497
|
+
* 7. Hash, including "#", optional.
|
|
61498
|
+
*/
|
|
61499
|
+
const urlRegex = /^([\w+.-]+:)\/\/([^@/#?]*@)?([^:/#?]*)(:\d+)?(\/[^#?]*)?(\?[^#]*)?(#.*)?/;
|
|
61500
|
+
/**
|
|
61501
|
+
* File URLs are weird. They dont' need the regular `//` in the scheme, they may or may not start
|
|
61502
|
+
* with a leading `/`, they can have a domain (but only if they don't start with a Windows drive).
|
|
61503
|
+
*
|
|
61504
|
+
* 1. Host, optional.
|
|
61505
|
+
* 2. Path, which may include "/", guaranteed.
|
|
61506
|
+
* 3. Query, including "?", optional.
|
|
61507
|
+
* 4. Hash, including "#", optional.
|
|
61508
|
+
*/
|
|
61509
|
+
const fileRegex = /^file:(?:\/\/((?![a-z]:)[^/#?]*)?)?(\/?[^#?]*)(\?[^#]*)?(#.*)?/i;
|
|
61510
|
+
function isAbsoluteUrl(input) {
|
|
61511
|
+
return schemeRegex.test(input);
|
|
61512
|
+
}
|
|
61513
|
+
function isSchemeRelativeUrl(input) {
|
|
61514
|
+
return input.startsWith("//");
|
|
61515
|
+
}
|
|
61516
|
+
function isAbsolutePath(input) {
|
|
61517
|
+
return input.startsWith("/");
|
|
61518
|
+
}
|
|
61519
|
+
function isFileUrl(input) {
|
|
61520
|
+
return input.startsWith("file:");
|
|
61521
|
+
}
|
|
61522
|
+
function isRelative(input) {
|
|
61523
|
+
return /^[.?#]/.test(input);
|
|
61524
|
+
}
|
|
61525
|
+
function parseAbsoluteUrl(input) {
|
|
61526
|
+
const match = urlRegex.exec(input);
|
|
61527
|
+
return makeUrl(match[1], match[2] || "", match[3], match[4] || "", match[5] || "/", match[6] || "", match[7] || "");
|
|
61528
|
+
}
|
|
61529
|
+
function parseFileUrl(input) {
|
|
61530
|
+
const match = fileRegex.exec(input);
|
|
61531
|
+
const path = match[2];
|
|
61532
|
+
return makeUrl("file:", "", match[1] || "", "", isAbsolutePath(path) ? path : "/" + path, match[3] || "", match[4] || "");
|
|
61533
|
+
}
|
|
61534
|
+
function makeUrl(scheme, user, host, port, path, query, hash) {
|
|
61535
|
+
return {
|
|
61536
|
+
scheme,
|
|
61537
|
+
user,
|
|
61538
|
+
host,
|
|
61539
|
+
port,
|
|
61540
|
+
path,
|
|
61541
|
+
query,
|
|
61542
|
+
hash,
|
|
61543
|
+
type: 7
|
|
61544
|
+
};
|
|
61545
|
+
}
|
|
61546
|
+
function parseUrl(input) {
|
|
61547
|
+
if (isSchemeRelativeUrl(input)) {
|
|
61548
|
+
const url = parseAbsoluteUrl("http:" + input);
|
|
61549
|
+
url.scheme = "";
|
|
61550
|
+
url.type = 6;
|
|
61551
|
+
return url;
|
|
61552
|
+
}
|
|
61553
|
+
if (isAbsolutePath(input)) {
|
|
61554
|
+
const url = parseAbsoluteUrl("http://foo.com" + input);
|
|
61555
|
+
url.scheme = "";
|
|
61556
|
+
url.host = "";
|
|
61557
|
+
url.type = 5;
|
|
61558
|
+
return url;
|
|
61559
|
+
}
|
|
61560
|
+
if (isFileUrl(input)) return parseFileUrl(input);
|
|
61561
|
+
if (isAbsoluteUrl(input)) return parseAbsoluteUrl(input);
|
|
61562
|
+
const url = parseAbsoluteUrl("http://foo.com/" + input);
|
|
61563
|
+
url.scheme = "";
|
|
61564
|
+
url.host = "";
|
|
61565
|
+
url.type = input ? input.startsWith("?") ? 3 : input.startsWith("#") ? 2 : 4 : 1;
|
|
61566
|
+
return url;
|
|
61567
|
+
}
|
|
61568
|
+
function stripPathFilename(path) {
|
|
61569
|
+
if (path.endsWith("/..")) return path;
|
|
61570
|
+
const index = path.lastIndexOf("/");
|
|
61571
|
+
return path.slice(0, index + 1);
|
|
61572
|
+
}
|
|
61573
|
+
function mergePaths(url, base) {
|
|
61574
|
+
normalizePath(base, base.type);
|
|
61575
|
+
if (url.path === "/") url.path = base.path;
|
|
61576
|
+
else url.path = stripPathFilename(base.path) + url.path;
|
|
61577
|
+
}
|
|
61578
|
+
/**
|
|
61579
|
+
* The path can have empty directories "//", unneeded parents "foo/..", or current directory
|
|
61580
|
+
* "foo/.". We need to normalize to a standard representation.
|
|
61581
|
+
*/
|
|
61582
|
+
function normalizePath(url, type) {
|
|
61583
|
+
const rel = type <= 4;
|
|
61584
|
+
const pieces = url.path.split("/");
|
|
61585
|
+
let pointer = 1;
|
|
61586
|
+
let positive = 0;
|
|
61587
|
+
let addTrailingSlash = false;
|
|
61588
|
+
for (let i = 1; i < pieces.length; i++) {
|
|
61589
|
+
const piece = pieces[i];
|
|
61590
|
+
if (!piece) {
|
|
61591
|
+
addTrailingSlash = true;
|
|
61592
|
+
continue;
|
|
61593
|
+
}
|
|
61594
|
+
addTrailingSlash = false;
|
|
61595
|
+
if (piece === ".") continue;
|
|
61596
|
+
if (piece === "..") {
|
|
61597
|
+
if (positive) {
|
|
61598
|
+
addTrailingSlash = true;
|
|
61599
|
+
positive--;
|
|
61600
|
+
pointer--;
|
|
61601
|
+
} else if (rel) pieces[pointer++] = piece;
|
|
61602
|
+
continue;
|
|
61603
|
+
}
|
|
61604
|
+
pieces[pointer++] = piece;
|
|
61605
|
+
positive++;
|
|
61606
|
+
}
|
|
61607
|
+
let path = "";
|
|
61608
|
+
for (let i = 1; i < pointer; i++) path += "/" + pieces[i];
|
|
61609
|
+
if (!path || addTrailingSlash && !path.endsWith("/..")) path += "/";
|
|
61610
|
+
url.path = path;
|
|
61611
|
+
}
|
|
61612
|
+
/**
|
|
61613
|
+
* Attempts to resolve `input` URL/path relative to `base`.
|
|
61614
|
+
*/
|
|
61615
|
+
function resolve(input, base) {
|
|
61616
|
+
if (!input && !base) return "";
|
|
61617
|
+
const url = parseUrl(input);
|
|
61618
|
+
let inputType = url.type;
|
|
61619
|
+
if (base && inputType !== 7) {
|
|
61620
|
+
const baseUrl = parseUrl(base);
|
|
61621
|
+
const baseType = baseUrl.type;
|
|
61622
|
+
switch (inputType) {
|
|
61623
|
+
case 1: url.hash = baseUrl.hash;
|
|
61624
|
+
case 2: url.query = baseUrl.query;
|
|
61625
|
+
case 3:
|
|
61626
|
+
case 4: mergePaths(url, baseUrl);
|
|
61627
|
+
case 5:
|
|
61628
|
+
url.user = baseUrl.user;
|
|
61629
|
+
url.host = baseUrl.host;
|
|
61630
|
+
url.port = baseUrl.port;
|
|
61631
|
+
case 6: url.scheme = baseUrl.scheme;
|
|
61632
|
+
}
|
|
61633
|
+
if (baseType > inputType) inputType = baseType;
|
|
61634
|
+
}
|
|
61635
|
+
normalizePath(url, inputType);
|
|
61636
|
+
const queryHash = url.query + url.hash;
|
|
61637
|
+
switch (inputType) {
|
|
61638
|
+
case 2:
|
|
61639
|
+
case 3: return queryHash;
|
|
61640
|
+
case 4: {
|
|
61641
|
+
const path = url.path.slice(1);
|
|
61642
|
+
if (!path) return queryHash || ".";
|
|
61643
|
+
if (isRelative(base || input) && !isRelative(path)) return "./" + path + queryHash;
|
|
61644
|
+
return path + queryHash;
|
|
61645
|
+
}
|
|
61646
|
+
case 5: return url.path + queryHash;
|
|
61647
|
+
default: return url.scheme + "//" + url.user + url.host + url.port + url.path + queryHash;
|
|
61648
|
+
}
|
|
61649
|
+
}
|
|
61650
|
+
//#endregion
|
|
61651
|
+
//#region ../../node_modules/.pnpm/@jridgewell+trace-mapping@0.3.31/node_modules/@jridgewell/trace-mapping/dist/trace-mapping.mjs
|
|
61652
|
+
function stripFilename(path) {
|
|
61653
|
+
if (!path) return "";
|
|
61654
|
+
const index = path.lastIndexOf("/");
|
|
61655
|
+
return path.slice(0, index + 1);
|
|
61656
|
+
}
|
|
61657
|
+
function resolver(mapUrl, sourceRoot) {
|
|
61658
|
+
const from = stripFilename(mapUrl);
|
|
61659
|
+
const prefix = sourceRoot ? sourceRoot + "/" : "";
|
|
61660
|
+
return (source) => resolve(prefix + (source || ""), from);
|
|
61661
|
+
}
|
|
61662
|
+
var COLUMN = 0;
|
|
61663
|
+
var SOURCES_INDEX = 1;
|
|
61664
|
+
var SOURCE_LINE = 2;
|
|
61665
|
+
var SOURCE_COLUMN = 3;
|
|
61666
|
+
var NAMES_INDEX = 4;
|
|
61667
|
+
function maybeSort(mappings, owned) {
|
|
61668
|
+
const unsortedIndex = nextUnsortedSegmentLine(mappings, 0);
|
|
61669
|
+
if (unsortedIndex === mappings.length) return mappings;
|
|
61670
|
+
if (!owned) mappings = mappings.slice();
|
|
61671
|
+
for (let i = unsortedIndex; i < mappings.length; i = nextUnsortedSegmentLine(mappings, i + 1)) mappings[i] = sortSegments(mappings[i], owned);
|
|
61672
|
+
return mappings;
|
|
61673
|
+
}
|
|
61674
|
+
function nextUnsortedSegmentLine(mappings, start) {
|
|
61675
|
+
for (let i = start; i < mappings.length; i++) if (!isSorted(mappings[i])) return i;
|
|
61676
|
+
return mappings.length;
|
|
61677
|
+
}
|
|
61678
|
+
function isSorted(line) {
|
|
61679
|
+
for (let j = 1; j < line.length; j++) if (line[j][COLUMN] < line[j - 1][COLUMN]) return false;
|
|
61680
|
+
return true;
|
|
61681
|
+
}
|
|
61682
|
+
function sortSegments(line, owned) {
|
|
61683
|
+
if (!owned) line = line.slice();
|
|
61684
|
+
return line.sort(sortComparator);
|
|
61685
|
+
}
|
|
61686
|
+
function sortComparator(a, b) {
|
|
61687
|
+
return a[COLUMN] - b[COLUMN];
|
|
61688
|
+
}
|
|
61689
|
+
var found = false;
|
|
61690
|
+
function binarySearch(haystack, needle, low, high) {
|
|
61691
|
+
while (low <= high) {
|
|
61692
|
+
const mid = low + (high - low >> 1);
|
|
61693
|
+
const cmp = haystack[mid][COLUMN] - needle;
|
|
61694
|
+
if (cmp === 0) {
|
|
61695
|
+
found = true;
|
|
61696
|
+
return mid;
|
|
61697
|
+
}
|
|
61698
|
+
if (cmp < 0) low = mid + 1;
|
|
61699
|
+
else high = mid - 1;
|
|
61700
|
+
}
|
|
61701
|
+
found = false;
|
|
61702
|
+
return low - 1;
|
|
61703
|
+
}
|
|
61704
|
+
function upperBound(haystack, needle, index) {
|
|
61705
|
+
for (let i = index + 1; i < haystack.length; index = i++) if (haystack[i][COLUMN] !== needle) break;
|
|
61706
|
+
return index;
|
|
61707
|
+
}
|
|
61708
|
+
function lowerBound(haystack, needle, index) {
|
|
61709
|
+
for (let i = index - 1; i >= 0; index = i--) if (haystack[i][COLUMN] !== needle) break;
|
|
61710
|
+
return index;
|
|
61711
|
+
}
|
|
61712
|
+
function memoizedState() {
|
|
61713
|
+
return {
|
|
61714
|
+
lastKey: -1,
|
|
61715
|
+
lastNeedle: -1,
|
|
61716
|
+
lastIndex: -1
|
|
61717
|
+
};
|
|
61718
|
+
}
|
|
61719
|
+
function memoizedBinarySearch(haystack, needle, state, key) {
|
|
61720
|
+
const { lastKey, lastNeedle, lastIndex } = state;
|
|
61721
|
+
let low = 0;
|
|
61722
|
+
let high = haystack.length - 1;
|
|
61723
|
+
if (key === lastKey) {
|
|
61724
|
+
if (needle === lastNeedle) {
|
|
61725
|
+
found = lastIndex !== -1 && haystack[lastIndex][COLUMN] === needle;
|
|
61726
|
+
return lastIndex;
|
|
61727
|
+
}
|
|
61728
|
+
if (needle >= lastNeedle) low = lastIndex === -1 ? 0 : lastIndex;
|
|
61729
|
+
else high = lastIndex;
|
|
61730
|
+
}
|
|
61731
|
+
state.lastKey = key;
|
|
61732
|
+
state.lastNeedle = needle;
|
|
61733
|
+
return state.lastIndex = binarySearch(haystack, needle, low, high);
|
|
61734
|
+
}
|
|
61735
|
+
function parse(map) {
|
|
61736
|
+
return typeof map === "string" ? JSON.parse(map) : map;
|
|
61737
|
+
}
|
|
61738
|
+
var LINE_GTR_ZERO = "`line` must be greater than 0 (lines start at line 1)";
|
|
61739
|
+
var COL_GTR_EQ_ZERO = "`column` must be greater than or equal to 0 (columns start at column 0)";
|
|
61740
|
+
var TraceMap = class {
|
|
61741
|
+
constructor(map, mapUrl) {
|
|
61742
|
+
const isString = typeof map === "string";
|
|
61743
|
+
if (!isString && map._decodedMemo) return map;
|
|
61744
|
+
const parsed = parse(map);
|
|
61745
|
+
const { version, file, names, sourceRoot, sources, sourcesContent } = parsed;
|
|
61746
|
+
this.version = version;
|
|
61747
|
+
this.file = file;
|
|
61748
|
+
this.names = names || [];
|
|
61749
|
+
this.sourceRoot = sourceRoot;
|
|
61750
|
+
this.sources = sources;
|
|
61751
|
+
this.sourcesContent = sourcesContent;
|
|
61752
|
+
this.ignoreList = parsed.ignoreList || parsed.x_google_ignoreList || void 0;
|
|
61753
|
+
const resolve = resolver(mapUrl, sourceRoot);
|
|
61754
|
+
this.resolvedSources = sources.map(resolve);
|
|
61755
|
+
const { mappings } = parsed;
|
|
61756
|
+
if (typeof mappings === "string") {
|
|
61757
|
+
this._encoded = mappings;
|
|
61758
|
+
this._decoded = void 0;
|
|
61759
|
+
} else if (Array.isArray(mappings)) {
|
|
61760
|
+
this._encoded = void 0;
|
|
61761
|
+
this._decoded = maybeSort(mappings, isString);
|
|
61762
|
+
} else if (parsed.sections) throw new Error(`TraceMap passed sectioned source map, please use FlattenMap export instead`);
|
|
61763
|
+
else throw new Error(`invalid source map: ${JSON.stringify(parsed)}`);
|
|
61764
|
+
this._decodedMemo = memoizedState();
|
|
61765
|
+
this._bySources = void 0;
|
|
61766
|
+
this._bySourceMemos = void 0;
|
|
61767
|
+
}
|
|
61768
|
+
};
|
|
61769
|
+
function cast(map) {
|
|
61770
|
+
return map;
|
|
61771
|
+
}
|
|
61772
|
+
function decodedMappings(map) {
|
|
61773
|
+
var _a;
|
|
61774
|
+
return (_a = cast(map))._decoded || (_a._decoded = decode(cast(map)._encoded));
|
|
61775
|
+
}
|
|
61776
|
+
function originalPositionFor(map, needle) {
|
|
61777
|
+
let { line, column, bias } = needle;
|
|
61778
|
+
line--;
|
|
61779
|
+
if (line < 0) throw new Error(LINE_GTR_ZERO);
|
|
61780
|
+
if (column < 0) throw new Error(COL_GTR_EQ_ZERO);
|
|
61781
|
+
const decoded = decodedMappings(map);
|
|
61782
|
+
if (line >= decoded.length) return OMapping(null, null, null, null);
|
|
61783
|
+
const segments = decoded[line];
|
|
61784
|
+
const index = traceSegmentInternal(segments, cast(map)._decodedMemo, line, column, bias || 1);
|
|
61785
|
+
if (index === -1) return OMapping(null, null, null, null);
|
|
61786
|
+
const segment = segments[index];
|
|
61787
|
+
if (segment.length === 1) return OMapping(null, null, null, null);
|
|
61788
|
+
const { names, resolvedSources } = map;
|
|
61789
|
+
return OMapping(resolvedSources[segment[SOURCES_INDEX]], segment[SOURCE_LINE] + 1, segment[SOURCE_COLUMN], segment.length === 5 ? names[segment[NAMES_INDEX]] : null);
|
|
61790
|
+
}
|
|
61791
|
+
function OMapping(source, line, column, name) {
|
|
61792
|
+
return {
|
|
61793
|
+
source,
|
|
61794
|
+
line,
|
|
61795
|
+
column,
|
|
61796
|
+
name
|
|
61797
|
+
};
|
|
61798
|
+
}
|
|
61799
|
+
function traceSegmentInternal(segments, memo, line, column, bias) {
|
|
61800
|
+
let index = memoizedBinarySearch(segments, column, memo, line);
|
|
61801
|
+
if (found) index = (bias === -1 ? upperBound : lowerBound)(segments, column, index);
|
|
61802
|
+
else if (bias === -1) index++;
|
|
61803
|
+
if (index === -1 || index === segments.length) return -1;
|
|
61804
|
+
return index;
|
|
61805
|
+
}
|
|
61806
|
+
//#endregion
|
|
61384
61807
|
//#region ../core/dist/index.js
|
|
61385
61808
|
var __create = Object.create;
|
|
61386
61809
|
var __defProp = Object.defineProperty;
|
|
@@ -61450,7 +61873,7 @@ var AmbiguousProjectError = class extends Error {
|
|
|
61450
61873
|
};
|
|
61451
61874
|
const isProjectDiscoveryError = (value) => value instanceof ProjectNotFoundError || value instanceof NoReactDependencyError || value instanceof PackageJsonNotFoundError || value instanceof NotADirectoryError || value instanceof AmbiguousProjectError;
|
|
61452
61875
|
const HTML_FILE_PATTERN = /\.html$/i;
|
|
61453
|
-
const SOURCE_FILE_PATTERN = /\.(?:tsx?|jsx?|mts|mjs|[hH][tT][mM][lL])$/;
|
|
61876
|
+
const SOURCE_FILE_PATTERN = /\.(?:astro|tsx?|jsx?|mts|mjs|[hH][tT][mM][lL])$/;
|
|
61454
61877
|
const GENERATED_BUNDLE_FILE_PATTERN = /\.(iife|umd|global|min)\.m?js$/i;
|
|
61455
61878
|
const GENERATED_SOURCE_DIRECTORY_PATTERN = /(?:^|\/)__generated__\//;
|
|
61456
61879
|
const MINIFIED_SNIFF_BYTES = 65536;
|
|
@@ -62178,6 +62601,7 @@ const FRAMEWORK_PACKAGES = {
|
|
|
62178
62601
|
"@tanstack/react-start": "tanstack-start",
|
|
62179
62602
|
"@remix-run/react": "remix",
|
|
62180
62603
|
gatsby: "gatsby",
|
|
62604
|
+
astro: "astro",
|
|
62181
62605
|
vite: "vite",
|
|
62182
62606
|
"react-scripts": "cra",
|
|
62183
62607
|
expo: "expo",
|
|
@@ -62399,10 +62823,16 @@ const getTopLevelBinding = (sourceFile, bindingName) => {
|
|
|
62399
62823
|
}
|
|
62400
62824
|
return null;
|
|
62401
62825
|
};
|
|
62402
|
-
const getFunctionLocalBindings = (functionNode, argumentsList) => {
|
|
62826
|
+
const getFunctionLocalBindings = (functionNode, argumentsList, argumentAnalysis, functionAnalysis) => {
|
|
62403
62827
|
const localBindings = /* @__PURE__ */ new Map();
|
|
62404
62828
|
functionNode.parameters.forEach((parameter, parameterIndex) => {
|
|
62405
|
-
if (ts.isIdentifier(parameter.name))
|
|
62829
|
+
if (ts.isIdentifier(parameter.name)) {
|
|
62830
|
+
const argument = argumentsList[parameterIndex];
|
|
62831
|
+
localBindings.set(parameter.name.text, {
|
|
62832
|
+
expression: argument ?? parameter.initializer ?? null,
|
|
62833
|
+
analysis: argument ? argumentAnalysis : functionAnalysis
|
|
62834
|
+
});
|
|
62835
|
+
}
|
|
62406
62836
|
});
|
|
62407
62837
|
return localBindings;
|
|
62408
62838
|
};
|
|
@@ -62538,8 +62968,8 @@ const getStaticConfigValueState = (expression, analysis, visitedExpressions = /*
|
|
|
62538
62968
|
};
|
|
62539
62969
|
if (ts.isIdentifier(unwrappedExpression)) {
|
|
62540
62970
|
if (analysis.localBindings.has(unwrappedExpression.text)) {
|
|
62541
|
-
const
|
|
62542
|
-
return
|
|
62971
|
+
const localReference = analysis.localBindings.get(unwrappedExpression.text);
|
|
62972
|
+
return localReference?.expression ? getStaticConfigValueState(localReference.expression, localReference.analysis, nextVisitedExpressions) : null;
|
|
62543
62973
|
}
|
|
62544
62974
|
const topLevelBinding = getTopLevelBinding(analysis.sourceFile, unwrappedExpression.text);
|
|
62545
62975
|
return topLevelBinding && ts.isExpression(topLevelBinding) ? getStaticConfigValueState(topLevelBinding, analysis, nextVisitedExpressions) : null;
|
|
@@ -62581,8 +63011,8 @@ const getReactCompilerFlagState = (expression, analysis, visitedExpressions = /*
|
|
|
62581
63011
|
const assignedBinding = getAssignedPropertyInitializer(unwrappedExpression, "reactCompiler");
|
|
62582
63012
|
if (assignedBinding.wasFound && assignedBinding.initializer) return { isEnabled: !isStaticallyDisabledConfigExpression(assignedBinding.initializer, analysis) };
|
|
62583
63013
|
if (analysis.localBindings.has(unwrappedExpression.text)) {
|
|
62584
|
-
const
|
|
62585
|
-
return
|
|
63014
|
+
const localReference = analysis.localBindings.get(unwrappedExpression.text);
|
|
63015
|
+
return localReference?.expression ? getReactCompilerFlagState(localReference.expression, localReference.analysis, nextVisitedExpressions) : null;
|
|
62586
63016
|
}
|
|
62587
63017
|
const topLevelBinding = getTopLevelBinding(analysis.sourceFile, unwrappedExpression.text);
|
|
62588
63018
|
return topLevelBinding && ts.isExpression(topLevelBinding) ? getReactCompilerFlagState(topLevelBinding, analysis, nextVisitedExpressions) : null;
|
|
@@ -62605,8 +63035,8 @@ const getSelectedObjectProperty = (expression, propertyName, analysis, visitedEx
|
|
|
62605
63035
|
visitedExpressions.add(resolvedExpression);
|
|
62606
63036
|
if (ts.isIdentifier(resolvedExpression)) {
|
|
62607
63037
|
if (analysis.localBindings.has(resolvedExpression.text)) {
|
|
62608
|
-
const
|
|
62609
|
-
return
|
|
63038
|
+
const localReference = analysis.localBindings.get(resolvedExpression.text);
|
|
63039
|
+
return localReference?.expression ? getSelectedObjectProperty(localReference.expression, propertyName, localReference.analysis, visitedExpressions) : null;
|
|
62610
63040
|
}
|
|
62611
63041
|
const scopedBinding = getScopedConfigBinding(resolvedExpression);
|
|
62612
63042
|
if (scopedBinding.wasFound) return scopedBinding.initializer ? getSelectedObjectProperty(scopedBinding.initializer, propertyName, analysis, visitedExpressions) : null;
|
|
@@ -62615,9 +63045,18 @@ const getSelectedObjectProperty = (expression, propertyName, analysis, visitedEx
|
|
|
62615
63045
|
}
|
|
62616
63046
|
if (!ts.isObjectLiteralExpression(resolvedExpression)) return null;
|
|
62617
63047
|
for (const property of [...resolvedExpression.properties].reverse()) {
|
|
62618
|
-
if (ts.isPropertyAssignment(property) && getStaticPropertyName$2(property.name) === propertyName) return
|
|
62619
|
-
|
|
62620
|
-
|
|
63048
|
+
if (ts.isPropertyAssignment(property) && getStaticPropertyName$2(property.name) === propertyName) return {
|
|
63049
|
+
node: property.initializer,
|
|
63050
|
+
analysis
|
|
63051
|
+
};
|
|
63052
|
+
if (ts.isMethodDeclaration(property) && getStaticPropertyName$2(property.name) === propertyName) return {
|
|
63053
|
+
node: property,
|
|
63054
|
+
analysis
|
|
63055
|
+
};
|
|
63056
|
+
if (ts.isShorthandPropertyAssignment(property) && property.name.text === propertyName) return {
|
|
63057
|
+
node: property.name,
|
|
63058
|
+
analysis
|
|
63059
|
+
};
|
|
62621
63060
|
if (ts.isSpreadAssignment(property)) {
|
|
62622
63061
|
const spreadProperty = getSelectedObjectProperty(property.expression, propertyName, analysis, visitedExpressions);
|
|
62623
63062
|
if (spreadProperty) return spreadProperty;
|
|
@@ -62630,8 +63069,8 @@ const configExpressionMayDefineProperty = (expression, propertyName, analysis) =
|
|
|
62630
63069
|
while (ts.isParenthesizedExpression(resolvedExpression) || ts.isAsExpression(resolvedExpression) || ts.isTypeAssertionExpression(resolvedExpression) || ts.isSatisfiesExpression(resolvedExpression) || ts.isNonNullExpression(resolvedExpression)) resolvedExpression = resolvedExpression.expression;
|
|
62631
63070
|
if (ts.isIdentifier(resolvedExpression)) {
|
|
62632
63071
|
if (analysis.localBindings.has(resolvedExpression.text)) {
|
|
62633
|
-
const
|
|
62634
|
-
return
|
|
63072
|
+
const localReference = analysis.localBindings.get(resolvedExpression.text);
|
|
63073
|
+
return localReference?.expression ? configExpressionMayDefineProperty(localReference.expression, propertyName, localReference.analysis) : true;
|
|
62635
63074
|
}
|
|
62636
63075
|
const scopedBinding = getScopedConfigBinding(resolvedExpression);
|
|
62637
63076
|
if (scopedBinding.wasFound) return scopedBinding.initializer ? configExpressionMayDefineProperty(scopedBinding.initializer, propertyName, analysis) : true;
|
|
@@ -62715,15 +63154,15 @@ const getReExportedConfigModules = (sourceFile, exportName) => {
|
|
|
62715
63154
|
}
|
|
62716
63155
|
return bindings;
|
|
62717
63156
|
};
|
|
62718
|
-
const analyzeConfigModuleExport = (filePath, exportName, allowCompilerTransform, importDepth, visitedModules, argumentsList = []) => {
|
|
63157
|
+
const analyzeConfigModuleExport = (filePath, exportName, allowCompilerTransform, importDepth, visitedModules, argumentsList = [], argumentAnalysis) => {
|
|
62719
63158
|
if (!isFile(filePath) || importDepth > 4) return false;
|
|
62720
63159
|
const moduleVisitKey = `${filePath}:${exportName}:${allowCompilerTransform}`;
|
|
62721
63160
|
if (visitedModules.has(moduleVisitKey)) return false;
|
|
62722
63161
|
const nextVisitedModules = new Set(visitedModules);
|
|
62723
63162
|
nextVisitedModules.add(moduleVisitKey);
|
|
62724
|
-
return analyzeConfigSourceFileExport(parseConfigSourceFile(filePath, NFS.readFileSync(filePath, "utf-8")), filePath, exportName, allowCompilerTransform, importDepth, nextVisitedModules, argumentsList);
|
|
63163
|
+
return analyzeConfigSourceFileExport(parseConfigSourceFile(filePath, NFS.readFileSync(filePath, "utf-8")), filePath, exportName, allowCompilerTransform, importDepth, nextVisitedModules, argumentsList, argumentAnalysis);
|
|
62725
63164
|
};
|
|
62726
|
-
const analyzeConfigSourceFileExport = (sourceFile, filePath, exportName, allowCompilerTransform, importDepth, visitedModules, argumentsList = []) => {
|
|
63165
|
+
const analyzeConfigSourceFileExport = (sourceFile, filePath, exportName, allowCompilerTransform, importDepth, visitedModules, argumentsList = [], argumentAnalysis) => {
|
|
62727
63166
|
const analysis = {
|
|
62728
63167
|
filePath,
|
|
62729
63168
|
sourceFile,
|
|
@@ -62733,14 +63172,27 @@ const analyzeConfigSourceFileExport = (sourceFile, filePath, exportName, allowCo
|
|
|
62733
63172
|
localBindings: /* @__PURE__ */ new Map(),
|
|
62734
63173
|
activeFunctions: /* @__PURE__ */ new Set()
|
|
62735
63174
|
};
|
|
63175
|
+
const resolvedArgumentAnalysis = argumentAnalysis ?? analysis;
|
|
62736
63176
|
const exportedConfigNodes = getExportedConfigNodes(sourceFile, exportName);
|
|
62737
|
-
return exportedConfigNodes.some((node) =>
|
|
63177
|
+
return exportedConfigNodes.some((node) => {
|
|
63178
|
+
if (ts.isArrowFunction(node) || ts.isFunctionExpression(node) || ts.isFunctionDeclaration(node)) return analyzeConfigFunction(node, analysis, allowCompilerTransform, argumentsList, resolvedArgumentAnalysis);
|
|
63179
|
+
if (argumentsList.length > 0 && ts.isIdentifier(node)) {
|
|
63180
|
+
const topLevelBinding = getTopLevelBinding(sourceFile, node.text);
|
|
63181
|
+
if (topLevelBinding && ts.isFunctionLike(topLevelBinding)) return analyzeConfigFunction(topLevelBinding, analysis, allowCompilerTransform, argumentsList, resolvedArgumentAnalysis);
|
|
63182
|
+
const importBinding = getImportBinding(sourceFile, node.text);
|
|
63183
|
+
if (importBinding) {
|
|
63184
|
+
const importedFilePath = resolveImportedConfigFile(filePath, importBinding.moduleSpecifier);
|
|
63185
|
+
return Boolean(importedFilePath && analyzeConfigModuleExport(importedFilePath, importBinding.exportName, allowCompilerTransform, importDepth + 1, visitedModules, argumentsList, resolvedArgumentAnalysis));
|
|
63186
|
+
}
|
|
63187
|
+
}
|
|
63188
|
+
return analyzeConfigNode(node, analysis, allowCompilerTransform);
|
|
63189
|
+
}) || getReExportedConfigModules(sourceFile, exportName).some((binding) => {
|
|
62738
63190
|
if (exportedConfigNodes.length > 0 && binding.isNamespace) return false;
|
|
62739
63191
|
const importedFilePath = resolveImportedConfigFile(filePath, binding.moduleSpecifier);
|
|
62740
|
-
return Boolean(importedFilePath && analyzeConfigModuleExport(importedFilePath, binding.exportName, allowCompilerTransform, importDepth + 1, visitedModules, argumentsList));
|
|
63192
|
+
return Boolean(importedFilePath && analyzeConfigModuleExport(importedFilePath, binding.exportName, allowCompilerTransform, importDepth + 1, visitedModules, argumentsList, resolvedArgumentAnalysis));
|
|
62741
63193
|
});
|
|
62742
63194
|
};
|
|
62743
|
-
const analyzeConfigFunction = (functionNode, analysis, allowCompilerTransform, argumentsList = []) => {
|
|
63195
|
+
const analyzeConfigFunction = (functionNode, analysis, allowCompilerTransform, argumentsList = [], argumentAnalysis = analysis) => {
|
|
62744
63196
|
if (!functionNode.body) return false;
|
|
62745
63197
|
if (analysis.activeFunctions.has(functionNode.pos)) return false;
|
|
62746
63198
|
const activeFunctions = new Set(analysis.activeFunctions);
|
|
@@ -62748,7 +63200,7 @@ const analyzeConfigFunction = (functionNode, analysis, allowCompilerTransform, a
|
|
|
62748
63200
|
const functionAnalysis = {
|
|
62749
63201
|
...analysis,
|
|
62750
63202
|
visitedNodes: /* @__PURE__ */ new Set(),
|
|
62751
|
-
localBindings: getFunctionLocalBindings(functionNode, argumentsList),
|
|
63203
|
+
localBindings: getFunctionLocalBindings(functionNode, argumentsList, argumentAnalysis, analysis),
|
|
62752
63204
|
activeFunctions
|
|
62753
63205
|
};
|
|
62754
63206
|
if (!ts.isBlock(functionNode.body)) return analyzeConfigNode(functionNode.body, functionAnalysis, allowCompilerTransform);
|
|
@@ -62767,7 +63219,7 @@ const analyzeConfigFunction = (functionNode, analysis, allowCompilerTransform, a
|
|
|
62767
63219
|
const analyzeImportedConfig = ({ analysis, moduleSpecifier, exportName, allowCompilerTransform, argumentsList }) => {
|
|
62768
63220
|
const importedFilePath = resolveImportedConfigFile(analysis.filePath, moduleSpecifier);
|
|
62769
63221
|
if (!importedFilePath) return null;
|
|
62770
|
-
return analyzeConfigModuleExport(importedFilePath, exportName, allowCompilerTransform, analysis.importDepth + 1, analysis.visitedModules, argumentsList);
|
|
63222
|
+
return analyzeConfigModuleExport(importedFilePath, exportName, allowCompilerTransform, analysis.importDepth + 1, analysis.visitedModules, argumentsList, analysis);
|
|
62771
63223
|
};
|
|
62772
63224
|
const analyzeConfigIdentifier = (identifier, analysis, allowCompilerTransform, isCompilerTransformCollection, excludedPropertyNames) => {
|
|
62773
63225
|
const assignedReactCompiler = getAssignedPropertyInitializer(identifier, "reactCompiler");
|
|
@@ -62781,8 +63233,8 @@ const analyzeConfigIdentifier = (identifier, analysis, allowCompilerTransform, i
|
|
|
62781
63233
|
if (assignedPlugins.wasFound) overriddenPropertyNames.add("plugins");
|
|
62782
63234
|
if (assignedPresets.wasFound) overriddenPropertyNames.add("presets");
|
|
62783
63235
|
if (analysis.localBindings.has(identifier.text)) {
|
|
62784
|
-
const
|
|
62785
|
-
return Boolean(
|
|
63236
|
+
const localReference = analysis.localBindings.get(identifier.text);
|
|
63237
|
+
return Boolean(localReference?.expression && analyzeConfigNode(localReference.expression, localReference.analysis, allowCompilerTransform, isCompilerTransformCollection, overriddenPropertyNames));
|
|
62786
63238
|
}
|
|
62787
63239
|
const scopedBinding = getScopedConfigBinding(identifier);
|
|
62788
63240
|
if (scopedBinding.wasFound) return Boolean(scopedBinding.initializer && analyzeConfigNode(scopedBinding.initializer, analysis, allowCompilerTransform, isCompilerTransformCollection, overriddenPropertyNames));
|
|
@@ -62848,7 +63300,7 @@ const analyzeConfigCallTarget = (callExpression, analysis, allowCompilerTransfor
|
|
|
62848
63300
|
}
|
|
62849
63301
|
const selectedProperty = getSelectedObjectProperty(target.expression, propertyName, analysis);
|
|
62850
63302
|
if (selectedProperty === null) return null;
|
|
62851
|
-
return ts.isFunctionLike(selectedProperty) ? analyzeConfigFunction(selectedProperty, analysis, allowCompilerTransform, callExpression.arguments) : analyzeConfigNode(selectedProperty, analysis, allowCompilerTransform);
|
|
63303
|
+
return ts.isFunctionLike(selectedProperty.node) ? analyzeConfigFunction(selectedProperty.node, selectedProperty.analysis, allowCompilerTransform, callExpression.arguments, analysis) : analyzeConfigNode(selectedProperty.node, selectedProperty.analysis, allowCompilerTransform);
|
|
62852
63304
|
};
|
|
62853
63305
|
const analyzeConfigNode = (node, analysis, allowCompilerTransform, isCompilerTransformCollection = false, excludedPropertyNames) => {
|
|
62854
63306
|
const excludedPropertiesVisitKey = excludedPropertyNames ? [...excludedPropertyNames].sort().join(",") : "";
|
|
@@ -62948,7 +63400,7 @@ const analyzeConfigNode = (node, analysis, allowCompilerTransform, isCompilerTra
|
|
|
62948
63400
|
if (ts.isIdentifier(node.expression)) {
|
|
62949
63401
|
if (analysis.localBindings.has(node.expression.text) || getScopedConfigBinding(node.expression).wasFound) {
|
|
62950
63402
|
const selectedProperty = getSelectedObjectProperty(node.expression, node.name.text, analysis);
|
|
62951
|
-
return Boolean(selectedProperty && analyzeConfigNode(selectedProperty, analysis, allowCompilerTransform));
|
|
63403
|
+
return Boolean(selectedProperty && analyzeConfigNode(selectedProperty.node, selectedProperty.analysis, allowCompilerTransform));
|
|
62952
63404
|
}
|
|
62953
63405
|
const importBinding = getImportBinding(analysis.sourceFile, node.expression.text);
|
|
62954
63406
|
if (importBinding?.isNamespace) {
|
|
@@ -62962,7 +63414,7 @@ const analyzeConfigNode = (node, analysis, allowCompilerTransform, isCompilerTra
|
|
|
62962
63414
|
return false;
|
|
62963
63415
|
}
|
|
62964
63416
|
const selectedProperty = getSelectedObjectProperty(node.expression, node.name.text, analysis);
|
|
62965
|
-
if (selectedProperty) return analyzeConfigNode(selectedProperty, analysis, allowCompilerTransform);
|
|
63417
|
+
if (selectedProperty) return analyzeConfigNode(selectedProperty.node, selectedProperty.analysis, allowCompilerTransform);
|
|
62966
63418
|
return false;
|
|
62967
63419
|
}
|
|
62968
63420
|
return analyzeConfigNode(node.expression, analysis, allowCompilerTransform);
|
|
@@ -62971,7 +63423,7 @@ const analyzeConfigNode = (node, analysis, allowCompilerTransform, isCompilerTra
|
|
|
62971
63423
|
if (ts.isIdentifier(node.expression)) {
|
|
62972
63424
|
if (analysis.localBindings.has(node.expression.text) || getScopedConfigBinding(node.expression).wasFound) {
|
|
62973
63425
|
const selectedProperty = getSelectedObjectProperty(node.expression, node.argumentExpression.text, analysis);
|
|
62974
|
-
return Boolean(selectedProperty && analyzeConfigNode(selectedProperty, analysis, allowCompilerTransform));
|
|
63426
|
+
return Boolean(selectedProperty && analyzeConfigNode(selectedProperty.node, selectedProperty.analysis, allowCompilerTransform));
|
|
62975
63427
|
}
|
|
62976
63428
|
const importBinding = getImportBinding(analysis.sourceFile, node.expression.text);
|
|
62977
63429
|
if (importBinding?.isNamespace) {
|
|
@@ -62984,7 +63436,7 @@ const analyzeConfigNode = (node, analysis, allowCompilerTransform, isCompilerTra
|
|
|
62984
63436
|
}));
|
|
62985
63437
|
}
|
|
62986
63438
|
const selectedProperty = getSelectedObjectProperty(node.expression, node.argumentExpression.text, analysis);
|
|
62987
|
-
if (selectedProperty) return analyzeConfigNode(selectedProperty, analysis, allowCompilerTransform);
|
|
63439
|
+
if (selectedProperty) return analyzeConfigNode(selectedProperty.node, selectedProperty.analysis, allowCompilerTransform);
|
|
62988
63440
|
return false;
|
|
62989
63441
|
}
|
|
62990
63442
|
return analyzeConfigNode(node.expression, analysis, allowCompilerTransform);
|
|
@@ -65361,6 +65813,7 @@ const classifyPackageRole = (filename) => {
|
|
|
65361
65813
|
* Resolves the absolute path to read for a diagnostic's `filePath`,
|
|
65362
65814
|
* accounting for the various shapes oxlint emits:
|
|
65363
65815
|
*
|
|
65816
|
+
* - `file://` URL — decode to an absolute filesystem path.
|
|
65364
65817
|
* - Absolute POSIX (`/abs/path/file.tsx`) — pass through.
|
|
65365
65818
|
* - Absolute Windows (`C:/...` or `C:\...`) — pass through.
|
|
65366
65819
|
* - `./relative` or bare relative — join against `rootDirectory`.
|
|
@@ -65370,6 +65823,7 @@ const classifyPackageRole = (filename) => {
|
|
|
65370
65823
|
* use one canonical resolution path.
|
|
65371
65824
|
*/
|
|
65372
65825
|
const resolveCandidateReadPath = (rootDirectory, filePath) => {
|
|
65826
|
+
if (filePath.startsWith("file://")) return fileURLToPath(filePath);
|
|
65373
65827
|
const normalizedFile = filePath.replace(/\\/g, "/");
|
|
65374
65828
|
if (normalizedFile.startsWith("/") || /^[a-zA-Z]:\//.test(normalizedFile) || /^[a-zA-Z]:\\/.test(filePath)) return filePath;
|
|
65375
65829
|
return `${rootDirectory.replace(/\\/g, "/").replace(/\/$/, "")}/${normalizedFile.replace(/^\.\//, "")}`;
|
|
@@ -69634,7 +70088,10 @@ var Git = class Git extends Service()("react-doctor/Git") {
|
|
|
69634
70088
|
if (argvLengthChars > spawnArgsLengthCap) return yield* foldSpawnFailure(`spawn ENAMETOOLONG (${argvLengthChars} argv chars exceed ${spawnArgsLengthCap})`);
|
|
69635
70089
|
const handle = yield* spawner.spawn(make$1(input.command, [...input.args], {
|
|
69636
70090
|
cwd: input.directory,
|
|
69637
|
-
env: input.
|
|
70091
|
+
env: input.command === "git" ? {
|
|
70092
|
+
...input.env,
|
|
70093
|
+
GIT_DIR: void 0
|
|
70094
|
+
} : input.env,
|
|
69638
70095
|
extendEnv: true
|
|
69639
70096
|
}));
|
|
69640
70097
|
const maxStdoutBytes = input.maxStdoutBytes;
|
|
@@ -69907,7 +70364,7 @@ var Git = class Git extends Service()("react-doctor/Git") {
|
|
|
69907
70364
|
"--diff-filter=ACMR",
|
|
69908
70365
|
"--relative"
|
|
69909
70366
|
]).pipe(map$3((result) => {
|
|
69910
|
-
if (result.status !== 0) return
|
|
70367
|
+
if (result.status !== 0) return null;
|
|
69911
70368
|
return splitNullSeparated(result.stdout);
|
|
69912
70369
|
})),
|
|
69913
70370
|
showStagedContent: (directory, relativePath, options) => runCommand({
|
|
@@ -70995,6 +71452,50 @@ const columnOfUtf8Offset = (sourceBuffer, utf8Offset) => {
|
|
|
70995
71452
|
while (lineStartOffset > 0 && sourceBuffer[lineStartOffset - 1] !== 10) lineStartOffset--;
|
|
70996
71453
|
return sourceBuffer.subarray(lineStartOffset, boundedOffset).toString("utf8").length + 1;
|
|
70997
71454
|
};
|
|
71455
|
+
const utf8OffsetFromSourcePosition = (sourceBuffer, lineNumber, zeroBasedColumn) => {
|
|
71456
|
+
if (lineNumber < 1 || zeroBasedColumn < 0) return null;
|
|
71457
|
+
const sourceLines = sourceBuffer.toString("utf8").split("\n");
|
|
71458
|
+
const sourceLine = sourceLines[lineNumber - 1];
|
|
71459
|
+
if (sourceLine === void 0 || zeroBasedColumn > sourceLine.length) return null;
|
|
71460
|
+
const precedingLines = sourceLines.slice(0, lineNumber - 1).join("\n");
|
|
71461
|
+
return (lineNumber === 1 ? 0 : Buffer.byteLength(precedingLines) + Buffer.byteLength("\n")) + Buffer.byteLength(sourceLine.slice(0, zeroBasedColumn));
|
|
71462
|
+
};
|
|
71463
|
+
const mapPreparedSourceSpan = (span, preparedSourceMap) => {
|
|
71464
|
+
const generatedLine = lineOfUtf8Offset(preparedSourceMap.generatedBuffer, span.offset);
|
|
71465
|
+
const generatedColumn = columnOfUtf8Offset(preparedSourceMap.generatedBuffer, span.offset) - 1;
|
|
71466
|
+
const originalStart = originalPositionFor(preparedSourceMap.traceMap, {
|
|
71467
|
+
line: generatedLine,
|
|
71468
|
+
column: generatedColumn
|
|
71469
|
+
});
|
|
71470
|
+
if (originalStart.source === null || originalStart.line === null || originalStart.column === null) return null;
|
|
71471
|
+
const originalOffset = utf8OffsetFromSourcePosition(preparedSourceMap.sourceBuffer, originalStart.line, originalStart.column);
|
|
71472
|
+
if (originalOffset === null) return null;
|
|
71473
|
+
const generatedSpan = preparedSourceMap.generatedBuffer.subarray(span.offset, span.offset + span.length);
|
|
71474
|
+
return {
|
|
71475
|
+
offset: originalOffset,
|
|
71476
|
+
length: preparedSourceMap.sourceBuffer.subarray(originalOffset, originalOffset + generatedSpan.length).equals(generatedSpan) ? generatedSpan.length : 0,
|
|
71477
|
+
line: originalStart.line,
|
|
71478
|
+
column: originalStart.column + 1
|
|
71479
|
+
};
|
|
71480
|
+
};
|
|
71481
|
+
const mapPreparedSourceLabels = (labels, preparedSourceMap) => {
|
|
71482
|
+
const primaryLabel = labels[0];
|
|
71483
|
+
if (primaryLabel === void 0) return null;
|
|
71484
|
+
const primarySpan = mapPreparedSourceSpan(primaryLabel.span, preparedSourceMap);
|
|
71485
|
+
if (primarySpan === null) return null;
|
|
71486
|
+
const mappedLabels = [{
|
|
71487
|
+
...primaryLabel,
|
|
71488
|
+
span: primarySpan
|
|
71489
|
+
}];
|
|
71490
|
+
for (const relatedLabel of labels.slice(1)) {
|
|
71491
|
+
const relatedSpan = mapPreparedSourceSpan(relatedLabel.span, preparedSourceMap);
|
|
71492
|
+
if (relatedSpan !== null) mappedLabels.push({
|
|
71493
|
+
...relatedLabel,
|
|
71494
|
+
span: relatedSpan
|
|
71495
|
+
});
|
|
71496
|
+
}
|
|
71497
|
+
return mappedLabels;
|
|
71498
|
+
};
|
|
70998
71499
|
const REDACTED_PLACEHOLDER = "<redacted>";
|
|
70999
71500
|
const KEEP_PREFIX = `$1${REDACTED_PLACEHOLDER}`;
|
|
71000
71501
|
const KNOWN_SECRET_RULES = [
|
|
@@ -71739,7 +72240,7 @@ const isOxlintOutput = (value) => isRecord(value) && Array.isArray(value.diagnos
|
|
|
71739
72240
|
* to the first `{`. Raises `OxlintOutputUnparseable` when the
|
|
71740
72241
|
* stdout isn't valid JSON or doesn't carry a `diagnostics` array.
|
|
71741
72242
|
*/
|
|
71742
|
-
const parseOxlintOutput = (stdout, project, rootDirectory, sourcePathByLintPath) => {
|
|
72243
|
+
const parseOxlintOutput = (stdout, project, rootDirectory, sourcePathByLintPath, sourceMapByLintPath) => {
|
|
71743
72244
|
if (!stdout) return [];
|
|
71744
72245
|
const jsonStart = stdout.indexOf("{");
|
|
71745
72246
|
const sanitizedStdout = jsonStart > 0 ? stdout.slice(jsonStart) : stdout;
|
|
@@ -71757,6 +72258,7 @@ const parseOxlintOutput = (stdout, project, rootDirectory, sourcePathByLintPath)
|
|
|
71757
72258
|
const sourceLinesCache = /* @__PURE__ */ new Map();
|
|
71758
72259
|
const resolveAbsolutePath = (filename) => Path.isAbsolute(filename) ? filename : Path.resolve(rootDirectory || ".", filename);
|
|
71759
72260
|
const resolveMappedSourceFilename = (filename) => sourcePathByLintPath?.get(Path.normalize(resolveAbsolutePath(filename)));
|
|
72261
|
+
const resolvePreparedSourceMap = (filename) => sourceMapByLintPath?.get(Path.normalize(resolveAbsolutePath(filename)));
|
|
71760
72262
|
const resolveSourceFilename = (filename) => resolveMappedSourceFilename(filename) ?? filename;
|
|
71761
72263
|
const readSourceBuffer = (filename) => {
|
|
71762
72264
|
const absolutePath = resolveAbsolutePath(resolveSourceFilename(filename));
|
|
@@ -71788,7 +72290,19 @@ const parseOxlintOutput = (stdout, project, rootDirectory, sourcePathByLintPath)
|
|
|
71788
72290
|
minifiedFileCache.set(absolutePath, minified);
|
|
71789
72291
|
return minified;
|
|
71790
72292
|
};
|
|
71791
|
-
return suppressMemoizationInBailedOutFunctions(parsed.diagnostics.
|
|
72293
|
+
return suppressMemoizationInBailedOutFunctions(parsed.diagnostics.flatMap((diagnostic) => {
|
|
72294
|
+
const preparedSourceMap = resolvePreparedSourceMap(diagnostic.filename);
|
|
72295
|
+
if (preparedSourceMap === void 0) return [diagnostic];
|
|
72296
|
+
const { plugin, rule } = parseRuleCode(diagnostic.code);
|
|
72297
|
+
if (plugin !== "react-doctor" || !reactDoctorPlugin.rules[rule]?.tags?.includes("design")) return [];
|
|
72298
|
+
const labels = mapPreparedSourceLabels(diagnostic.labels, preparedSourceMap);
|
|
72299
|
+
const sourceFilename = resolveMappedSourceFilename(diagnostic.filename);
|
|
72300
|
+
return labels === null || sourceFilename === void 0 ? [] : [{
|
|
72301
|
+
...diagnostic,
|
|
72302
|
+
filename: sourceFilename,
|
|
72303
|
+
labels
|
|
72304
|
+
}];
|
|
72305
|
+
}).filter((diagnostic) => isMappableOxlintDiagnostic(diagnostic) && isLintableSourceFile(resolveSourceFilename(diagnostic.filename)) && !(TYPESCRIPT_DECLARATION_FILE_PATTERN.test(diagnostic.filename) && OXLINT_IGNORED_DECLARATION_DIAGNOSTIC_CODES.has(diagnostic.code)) && !isMinifiedDiagnosticFile(diagnostic.filename) && !shouldSuppressLocalUseHookDiagnostic(diagnostic, rootDirectory) && !shouldSuppressCompilerFindingInWorklet(diagnostic, project, rootDirectory)).map((diagnostic) => {
|
|
71792
72306
|
const { plugin, rule } = parseRuleCode(diagnostic.code);
|
|
71793
72307
|
const primaryLabel = diagnostic.labels[0];
|
|
71794
72308
|
const cleaned = cleanDiagnosticMessage(diagnostic.message, diagnostic.help, plugin, rule, project);
|
|
@@ -72006,7 +72520,7 @@ const isParallelismRelatedSpawnError = (error) => {
|
|
|
72006
72520
|
* loop with a slimmer config in that case.
|
|
72007
72521
|
*/
|
|
72008
72522
|
const spawnLintBatches = async (input) => {
|
|
72009
|
-
const { baseArgs, fileBatches, rootDirectory, nodeBinaryPath, project, sourcePathByLintPath, onPartialFailure, onFileProgress, spawnTimeoutMs, outputMaxBytes, splitTotalBudgetMs = OXLINT_SPLIT_TOTAL_BUDGET_MS, splitMaxDepth = 8, signal, deadlineEpochMs } = input;
|
|
72523
|
+
const { baseArgs, fileBatches, rootDirectory, nodeBinaryPath, project, sourcePathByLintPath, sourceMapByLintPath, onPartialFailure, onFileProgress, spawnTimeoutMs, outputMaxBytes, splitTotalBudgetMs = OXLINT_SPLIT_TOTAL_BUDGET_MS, splitMaxDepth = 8, signal, deadlineEpochMs } = input;
|
|
72010
72524
|
const resolveSourcePath = (filePath) => {
|
|
72011
72525
|
const absoluteFilePath = Path.isAbsolute(filePath) ? filePath : Path.resolve(rootDirectory, filePath);
|
|
72012
72526
|
return sourcePathByLintPath?.get(Path.normalize(absoluteFilePath)) ?? filePath;
|
|
@@ -72030,7 +72544,7 @@ const spawnLintBatches = async (input) => {
|
|
|
72030
72544
|
}
|
|
72031
72545
|
const batchArgs = [...baseArgs, ...batch];
|
|
72032
72546
|
try {
|
|
72033
|
-
return parseOxlintOutput(await spawnOxlint(batchArgs, rootDirectory, nodeBinaryPath, spawnTimeoutMs, outputMaxBytes, signal), project, rootDirectory, sourcePathByLintPath);
|
|
72547
|
+
return parseOxlintOutput(await spawnOxlint(batchArgs, rootDirectory, nodeBinaryPath, spawnTimeoutMs, outputMaxBytes, signal), project, rootDirectory, sourcePathByLintPath, sourceMapByLintPath);
|
|
72034
72548
|
} catch (error) {
|
|
72035
72549
|
if (!isSplittableReactDoctorError(error)) throw error;
|
|
72036
72550
|
if (isPastDeadline()) {
|
|
@@ -72469,20 +72983,47 @@ const prepareHtmlScriptSource = (sourceBuffer) => {
|
|
|
72469
72983
|
lintBuffer: maskedBuffer ?? sourceBuffer
|
|
72470
72984
|
};
|
|
72471
72985
|
};
|
|
72472
|
-
const
|
|
72986
|
+
const ASTRO_FILE_PATTERN = /\.astro$/;
|
|
72987
|
+
const prepareLintSources = (rootDirectory, temporaryDirectory, candidateFiles) => {
|
|
72473
72988
|
const lintFiles = [];
|
|
72474
72989
|
const sourcePathByLintPath = /* @__PURE__ */ new Map();
|
|
72990
|
+
const sourceMapByLintPath = /* @__PURE__ */ new Map();
|
|
72475
72991
|
const sizeByLintPath = /* @__PURE__ */ new Map();
|
|
72476
72992
|
const htmlSourcesDirectory = Path.join(temporaryDirectory, "html-sources");
|
|
72993
|
+
const astroSourcesDirectory = Path.join(temporaryDirectory, "astro-sources");
|
|
72477
72994
|
let htmlFileIndex = 0;
|
|
72995
|
+
let astroFileIndex = 0;
|
|
72478
72996
|
let hasThreeModuleImport = false;
|
|
72479
72997
|
for (const candidateFile of candidateFiles) {
|
|
72480
|
-
if (!HTML_FILE_PATTERN.test(candidateFile)) {
|
|
72998
|
+
if (!HTML_FILE_PATTERN.test(candidateFile) && !ASTRO_FILE_PATTERN.test(candidateFile)) {
|
|
72481
72999
|
lintFiles.push(candidateFile);
|
|
72482
73000
|
continue;
|
|
72483
73001
|
}
|
|
72484
73002
|
const absoluteSourcePath = Path.isAbsolute(candidateFile) ? candidateFile : Path.resolve(rootDirectory, candidateFile);
|
|
72485
73003
|
const sourceBuffer = NFS.readFileSync(absoluteSourcePath);
|
|
73004
|
+
if (ASTRO_FILE_PATTERN.test(candidateFile)) {
|
|
73005
|
+
const compilerSourcePath = absoluteSourcePath.replaceAll("\\", "/");
|
|
73006
|
+
const convertedSource = convertToTSX(sourceBuffer.toString("utf8"), {
|
|
73007
|
+
filename: compilerSourcePath,
|
|
73008
|
+
sourcemap: "external",
|
|
73009
|
+
includeScripts: true
|
|
73010
|
+
});
|
|
73011
|
+
if (astroFileIndex === 0) NFS.mkdirSync(astroSourcesDirectory, { recursive: true });
|
|
73012
|
+
const lintPath = Path.join(astroSourcesDirectory, `${astroFileIndex}.tsx`);
|
|
73013
|
+
const generatedBuffer = Buffer.from(convertedSource.code);
|
|
73014
|
+
NFS.writeFileSync(lintPath, generatedBuffer);
|
|
73015
|
+
lintFiles.push(candidateFile);
|
|
73016
|
+
lintFiles.push(lintPath);
|
|
73017
|
+
sourcePathByLintPath.set(Path.resolve(lintPath), candidateFile);
|
|
73018
|
+
sourceMapByLintPath.set(Path.resolve(lintPath), {
|
|
73019
|
+
traceMap: new TraceMap(JSON.stringify(convertedSource.map)),
|
|
73020
|
+
generatedBuffer,
|
|
73021
|
+
sourceBuffer
|
|
73022
|
+
});
|
|
73023
|
+
sizeByLintPath.set(lintPath, sourceBuffer.length);
|
|
73024
|
+
astroFileIndex++;
|
|
73025
|
+
continue;
|
|
73026
|
+
}
|
|
72486
73027
|
const { executableScriptBodies, lintBuffer } = prepareHtmlScriptSource(sourceBuffer);
|
|
72487
73028
|
if (htmlFileIndex === 0) NFS.mkdirSync(htmlSourcesDirectory, { recursive: true });
|
|
72488
73029
|
const lintPath = Path.join(htmlSourcesDirectory, `${htmlFileIndex}.astro`);
|
|
@@ -72496,6 +73037,7 @@ const prepareHtmlLintSources = (rootDirectory, temporaryDirectory, candidateFile
|
|
|
72496
73037
|
return {
|
|
72497
73038
|
lintFiles,
|
|
72498
73039
|
sourcePathByLintPath,
|
|
73040
|
+
sourceMapByLintPath,
|
|
72499
73041
|
sizeByLintPath,
|
|
72500
73042
|
hasThreeModuleImport
|
|
72501
73043
|
};
|
|
@@ -72714,10 +73256,10 @@ const runOxlint = async (options) => {
|
|
|
72714
73256
|
rootDirectory,
|
|
72715
73257
|
candidateFiles
|
|
72716
73258
|
});
|
|
72717
|
-
const
|
|
72718
|
-
const lintFiles =
|
|
72719
|
-
const
|
|
72720
|
-
const lintProject = !project.hasThree &&
|
|
73259
|
+
const preparedLintSources = prepareLintSources(rootDirectory, configDirectory, candidateFiles);
|
|
73260
|
+
const lintFiles = preparedLintSources.lintFiles;
|
|
73261
|
+
const hasPreparedFiles = preparedLintSources.sourcePathByLintPath.size > 0;
|
|
73262
|
+
const lintProject = !project.hasThree && preparedLintSources.hasThreeModuleImport ? {
|
|
72721
73263
|
...project,
|
|
72722
73264
|
hasThree: true
|
|
72723
73265
|
} : project;
|
|
@@ -72739,7 +73281,7 @@ const runOxlint = async (options) => {
|
|
|
72739
73281
|
sidecarRuleIdFilter: overrides.sidecarRuleIdFilter
|
|
72740
73282
|
});
|
|
72741
73283
|
const sizeByFile = sizedScanFiles !== null && lintBatchOrdering === "cost" ? new Map(sizedScanFiles.map((entry) => [entry.path, entry.sizeBytes])) : null;
|
|
72742
|
-
if (sizeByFile !== null) for (const [lintPath, sizeBytes] of
|
|
73284
|
+
if (sizeByFile !== null) for (const [lintPath, sizeBytes] of preparedLintSources.sizeByLintPath) sizeByFile.set(lintPath, sizeBytes);
|
|
72743
73285
|
const buildFileBatches = (passBaseArgs, passFiles) => sizeByFile !== null ? planLintBatches({
|
|
72744
73286
|
baseArgs: passBaseArgs,
|
|
72745
73287
|
files: passFiles,
|
|
@@ -72769,7 +73311,8 @@ const runOxlint = async (options) => {
|
|
|
72769
73311
|
rootDirectory,
|
|
72770
73312
|
nodeBinaryPath,
|
|
72771
73313
|
project: lintProject,
|
|
72772
|
-
sourcePathByLintPath:
|
|
73314
|
+
sourcePathByLintPath: preparedLintSources.sourcePathByLintPath,
|
|
73315
|
+
sourceMapByLintPath: preparedLintSources.sourceMapByLintPath,
|
|
72773
73316
|
onPartialFailure: reportPartialFailure,
|
|
72774
73317
|
onAnalyzedFiles: (filePaths) => {
|
|
72775
73318
|
analyzedFiles = filePaths;
|
|
@@ -72804,7 +73347,7 @@ const runOxlint = async (options) => {
|
|
|
72804
73347
|
};
|
|
72805
73348
|
}
|
|
72806
73349
|
};
|
|
72807
|
-
if (perFileLintCacheEnabled && !project.hasReactCompiler && project.hasReactCompilerLintPlugin !== true && extendsPaths.length === 0 && userPlugins.length === 0 && !
|
|
73350
|
+
if (perFileLintCacheEnabled && !project.hasReactCompiler && project.hasReactCompilerLintPlugin !== true && extendsPaths.length === 0 && userPlugins.length === 0 && !hasPreparedFiles) {
|
|
72808
73351
|
const rulesetHash = computeRulesetHash({
|
|
72809
73352
|
config: buildConfig({
|
|
72810
73353
|
extendsPaths: [],
|
|
@@ -72970,7 +73513,8 @@ const runOxlint = async (options) => {
|
|
|
72970
73513
|
rootDirectory,
|
|
72971
73514
|
nodeBinaryPath,
|
|
72972
73515
|
project: lintProject,
|
|
72973
|
-
sourcePathByLintPath:
|
|
73516
|
+
sourcePathByLintPath: preparedLintSources.sourcePathByLintPath,
|
|
73517
|
+
sourceMapByLintPath: preparedLintSources.sourceMapByLintPath,
|
|
72974
73518
|
onPartialFailure,
|
|
72975
73519
|
onAnalyzedFiles: (filePaths) => {
|
|
72976
73520
|
analyzedFiles = filePaths;
|
|
@@ -74319,10 +74863,14 @@ const materializeSourceTree = (input) => gen(function* () {
|
|
|
74319
74863
|
materializedFiles.push(relativePath);
|
|
74320
74864
|
}
|
|
74321
74865
|
yield* sync(() => {
|
|
74322
|
-
for (const configFilename of STAGED_FILES_PROJECT_CONFIG_FILENAMES) {
|
|
74323
|
-
const sourcePath = path.join(input.directory, configFilename);
|
|
74324
|
-
const targetPath = path.
|
|
74325
|
-
if (
|
|
74866
|
+
for (const subdirectory of ["", ...input.configSubdirectories ?? []]) for (const configFilename of STAGED_FILES_PROJECT_CONFIG_FILENAMES) {
|
|
74867
|
+
const sourcePath = path.join(input.directory, subdirectory, configFilename);
|
|
74868
|
+
const targetPath = path.resolve(resolvedTempDirectory, subdirectory, configFilename);
|
|
74869
|
+
if (!isPathInsideDirectory(targetPath, resolvedTempDirectory)) continue;
|
|
74870
|
+
if (fs.existsSync(sourcePath) && !fs.existsSync(targetPath)) {
|
|
74871
|
+
fs.mkdirSync(path.dirname(targetPath), { recursive: true });
|
|
74872
|
+
fs.cpSync(sourcePath, targetPath);
|
|
74873
|
+
}
|
|
74326
74874
|
}
|
|
74327
74875
|
});
|
|
74328
74876
|
return {
|
|
@@ -74343,15 +74891,17 @@ const materializeSourceTree = (input) => gen(function* () {
|
|
|
74343
74891
|
static layerNode = effect(StagedFiles, gen(function* () {
|
|
74344
74892
|
const git = yield* Git;
|
|
74345
74893
|
return StagedFiles.of({
|
|
74346
|
-
discoverSourceFiles: (directory) => git.stagedFilePaths(directory).pipe(map$3((entries) => entries.filter(isLintableSourceFile)), withSpan("StagedFiles.discoverSourceFiles")),
|
|
74347
|
-
materialize: ({ directory, stagedFiles, tempDirectory }) => materializeSourceTree({
|
|
74894
|
+
discoverSourceFiles: (directory) => git.stagedFilePaths(directory).pipe(map$3((entries) => entries === null ? null : entries.filter(isLintableSourceFile)), withSpan("StagedFiles.discoverSourceFiles")),
|
|
74895
|
+
materialize: ({ directory, stagedFiles, tempDirectory, configSubdirectories }) => materializeSourceTree({
|
|
74348
74896
|
directory,
|
|
74349
74897
|
files: stagedFiles,
|
|
74350
74898
|
tempDirectory,
|
|
74899
|
+
configSubdirectories,
|
|
74351
74900
|
readContent: (relativePath) => git.showStagedContent(directory, relativePath, { maxBufferBytes: GIT_SHOW_MAX_BUFFER_BYTES })
|
|
74352
74901
|
}).pipe(map$3((tree) => ({
|
|
74353
74902
|
tempDirectory: tree.tempDirectory,
|
|
74354
74903
|
stagedFiles: tree.materializedFiles,
|
|
74904
|
+
unmaterializedFiles: tree.unmaterializedFiles,
|
|
74355
74905
|
cleanup: tree.cleanup
|
|
74356
74906
|
})), withSpan("StagedFiles.materialize"))
|
|
74357
74907
|
});
|
|
@@ -74366,6 +74916,7 @@ const materializeSourceTree = (input) => gen(function* () {
|
|
|
74366
74916
|
materialize: ({ tempDirectory }) => succeed$2({
|
|
74367
74917
|
tempDirectory,
|
|
74368
74918
|
stagedFiles: snapshot.materializedFiles ?? snapshot.sourceFiles ?? [],
|
|
74919
|
+
unmaterializedFiles: [],
|
|
74369
74920
|
cleanup: () => {}
|
|
74370
74921
|
})
|
|
74371
74922
|
}));
|
|
@@ -74892,4 +75443,4 @@ const toJsonReport = (result, options) => buildJsonReport({
|
|
|
74892
75443
|
export { AmbiguousProjectError, NoReactDependencyError, NotADirectoryError, PackageJsonNotFoundError, ProjectNotFoundError, ReactDoctorError, buildJsonReport, buildJsonReportError, clearCaches, defineConfig, diagnose, filterSourceFiles, getDiffInfo, hasReactRuntime, isProjectDiscoveryError, isReactDoctorError, summarizeDiagnostics, toJsonReport };
|
|
74893
75444
|
|
|
74894
75445
|
//# sourceMappingURL=index.js.map
|
|
74895
|
-
//# debugId=
|
|
75446
|
+
//# debugId=18c61424-4926-5cae-8f2a-6001534ea755
|