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/lsp.js
CHANGED
|
@@ -12,11 +12,12 @@ import * as NodeChildProcess from "node:child_process";
|
|
|
12
12
|
import { execFileSync, spawn, spawnSync } from "node:child_process";
|
|
13
13
|
import { ResolverFactory } from "oxc-resolver";
|
|
14
14
|
import ts from "typescript";
|
|
15
|
-
import { parseJSON5 } from "confbox";
|
|
16
15
|
import * as NodeUrl from "node:url";
|
|
17
16
|
import { fileURLToPath } from "node:url";
|
|
17
|
+
import { parseJSON5 } from "confbox";
|
|
18
18
|
import { createJiti } from "jiti";
|
|
19
19
|
import { ANALYZED_MANIFEST_FILENAMES, DEFAULT_EXTENSIONS } from "deslop-js/analyzed-inputs";
|
|
20
|
+
import { convertToTSX } from "@astrojs/compiler/sync";
|
|
20
21
|
import { gzipSync } from "node:zlib";
|
|
21
22
|
import { CodeActionKind, CodeActionTriggerKind, DidChangeWatchedFilesNotification, DocumentDiagnosticReportKind, FileChangeType, TextDocumentSyncKind, TextDocuments, createConnection } from "vscode-languageserver/node.js";
|
|
22
23
|
import { TextDocument } from "vscode-languageserver-textdocument";
|
|
@@ -10280,7 +10281,7 @@ const Number$4 = globalThis.Number;
|
|
|
10280
10281
|
* @category constructors
|
|
10281
10282
|
* @since 2.0.0
|
|
10282
10283
|
*/
|
|
10283
|
-
const parse = (s) => {
|
|
10284
|
+
const parse$1 = (s) => {
|
|
10284
10285
|
if (s === "NaN") return some(NaN);
|
|
10285
10286
|
if (s === "Infinity") return some(Infinity);
|
|
10286
10287
|
if (s === "-Infinity") return some(-Infinity);
|
|
@@ -14334,12 +14335,12 @@ TaggedError("EncodingError");
|
|
|
14334
14335
|
//#endregion
|
|
14335
14336
|
//#region ../../node_modules/.pnpm/effect@4.0.0-beta.70/node_modules/effect/dist/internal/schema/annotations.js
|
|
14336
14337
|
/** @internal */
|
|
14337
|
-
function resolve(ast) {
|
|
14338
|
+
function resolve$1(ast) {
|
|
14338
14339
|
return ast.checks ? ast.checks[ast.checks.length - 1].annotations : ast.annotations;
|
|
14339
14340
|
}
|
|
14340
14341
|
/** @internal */
|
|
14341
14342
|
function resolveAt(key) {
|
|
14342
|
-
return (ast) => resolve(ast)?.[key];
|
|
14343
|
+
return (ast) => resolve$1(ast)?.[key];
|
|
14343
14344
|
}
|
|
14344
14345
|
/** @internal */
|
|
14345
14346
|
const resolveIdentifier = /* @__PURE__ */ resolveAt("identifier");
|
|
@@ -18091,7 +18092,7 @@ function asSync(parser) {
|
|
|
18091
18092
|
}
|
|
18092
18093
|
const recur$1 = /* @__PURE__ */ memoize((ast) => {
|
|
18093
18094
|
let parser;
|
|
18094
|
-
const astOptions = resolve(ast)?.["parseOptions"];
|
|
18095
|
+
const astOptions = resolve$1(ast)?.["parseOptions"];
|
|
18095
18096
|
if (!ast.context && !ast.encoding && !ast.checks) return (ou, options) => {
|
|
18096
18097
|
parser ??= ast.getParser(recur$1);
|
|
18097
18098
|
if (astOptions) options = {
|
|
@@ -57696,7 +57697,7 @@ var UrlParamsError = class extends TaggedError("UrlParamsError") {};
|
|
|
57696
57697
|
* @category converting
|
|
57697
57698
|
* @since 4.0.0
|
|
57698
57699
|
*/
|
|
57699
|
-
const makeUrl = (url, params, hash) => {
|
|
57700
|
+
const makeUrl$1 = (url, params, hash) => {
|
|
57700
57701
|
try {
|
|
57701
57702
|
const urlInstance = new URL(url, baseUrl());
|
|
57702
57703
|
for (let i = 0; i < params.params.length; i++) {
|
|
@@ -58330,7 +58331,7 @@ const Proto$2 = {
|
|
|
58330
58331
|
const make$10 = (f) => makeWith$1((effect) => flatMap$2(effect, (request) => withFiber((fiber) => {
|
|
58331
58332
|
const scopedController = scopedRequests.get(request);
|
|
58332
58333
|
const controller = scopedController ?? new AbortController();
|
|
58333
|
-
const urlResult = makeUrl(request.url, request.urlParams, getOrUndefined(request.hash));
|
|
58334
|
+
const urlResult = makeUrl$1(request.url, request.urlParams, getOrUndefined(request.hash));
|
|
58334
58335
|
if (isFailure(urlResult)) return fail$4(new HttpClientError({ reason: new InvalidUrlError({
|
|
58335
58336
|
request,
|
|
58336
58337
|
cause: urlResult.failure
|
|
@@ -58769,7 +58770,7 @@ const layer$7 = (loggers, options) => effect(CurrentLoggers, withFiber$1(fnUntra
|
|
|
58769
58770
|
* @since 4.0.0
|
|
58770
58771
|
*/
|
|
58771
58772
|
const policy = /* @__PURE__ */ forever$1.pipe(passthrough$2, /* @__PURE__ */ addDelay((error) => {
|
|
58772
|
-
if (isHttpClientError(error) && error.reason._tag === "StatusCodeError" && error.reason.response.status === 429) return succeed$2(seconds(fromUndefinedOr(error.reason.response.headers["retry-after"]).pipe(flatMap$5(parse), getOrElse$1(() => 5))));
|
|
58773
|
+
if (isHttpClientError(error) && error.reason._tag === "StatusCodeError" && error.reason.response.status === 429) return succeed$2(seconds(fromUndefinedOr(error.reason.response.headers["retry-after"]).pipe(flatMap$5(parse$1), getOrElse$1(() => 5))));
|
|
58773
58774
|
return succeed$2(seconds(1));
|
|
58774
58775
|
}));
|
|
58775
58776
|
/**
|
|
@@ -61411,6 +61412,428 @@ const layer = /* @__PURE__ */ succeed$3(Path$1)({
|
|
|
61411
61412
|
toFileUrl
|
|
61412
61413
|
});
|
|
61413
61414
|
//#endregion
|
|
61415
|
+
//#region ../../node_modules/.pnpm/@jridgewell+sourcemap-codec@1.5.5/node_modules/@jridgewell/sourcemap-codec/dist/sourcemap-codec.mjs
|
|
61416
|
+
var comma = ",".charCodeAt(0);
|
|
61417
|
+
";".charCodeAt(0);
|
|
61418
|
+
var chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
|
|
61419
|
+
var intToChar = new Uint8Array(64);
|
|
61420
|
+
var charToInt = new Uint8Array(128);
|
|
61421
|
+
for (let i = 0; i < chars.length; i++) {
|
|
61422
|
+
const c = chars.charCodeAt(i);
|
|
61423
|
+
intToChar[i] = c;
|
|
61424
|
+
charToInt[c] = i;
|
|
61425
|
+
}
|
|
61426
|
+
function decodeInteger(reader, relative) {
|
|
61427
|
+
let value = 0;
|
|
61428
|
+
let shift = 0;
|
|
61429
|
+
let integer = 0;
|
|
61430
|
+
do {
|
|
61431
|
+
integer = charToInt[reader.next()];
|
|
61432
|
+
value |= (integer & 31) << shift;
|
|
61433
|
+
shift += 5;
|
|
61434
|
+
} while (integer & 32);
|
|
61435
|
+
const shouldNegate = value & 1;
|
|
61436
|
+
value >>>= 1;
|
|
61437
|
+
if (shouldNegate) value = -2147483648 | -value;
|
|
61438
|
+
return relative + value;
|
|
61439
|
+
}
|
|
61440
|
+
function hasMoreVlq(reader, max) {
|
|
61441
|
+
if (reader.pos >= max) return false;
|
|
61442
|
+
return reader.peek() !== comma;
|
|
61443
|
+
}
|
|
61444
|
+
var StringReader = class {
|
|
61445
|
+
constructor(buffer) {
|
|
61446
|
+
this.pos = 0;
|
|
61447
|
+
this.buffer = buffer;
|
|
61448
|
+
}
|
|
61449
|
+
next() {
|
|
61450
|
+
return this.buffer.charCodeAt(this.pos++);
|
|
61451
|
+
}
|
|
61452
|
+
peek() {
|
|
61453
|
+
return this.buffer.charCodeAt(this.pos);
|
|
61454
|
+
}
|
|
61455
|
+
indexOf(char) {
|
|
61456
|
+
const { buffer, pos } = this;
|
|
61457
|
+
const idx = buffer.indexOf(char, pos);
|
|
61458
|
+
return idx === -1 ? buffer.length : idx;
|
|
61459
|
+
}
|
|
61460
|
+
};
|
|
61461
|
+
function decode(mappings) {
|
|
61462
|
+
const { length } = mappings;
|
|
61463
|
+
const reader = new StringReader(mappings);
|
|
61464
|
+
const decoded = [];
|
|
61465
|
+
let genColumn = 0;
|
|
61466
|
+
let sourcesIndex = 0;
|
|
61467
|
+
let sourceLine = 0;
|
|
61468
|
+
let sourceColumn = 0;
|
|
61469
|
+
let namesIndex = 0;
|
|
61470
|
+
do {
|
|
61471
|
+
const semi = reader.indexOf(";");
|
|
61472
|
+
const line = [];
|
|
61473
|
+
let sorted = true;
|
|
61474
|
+
let lastCol = 0;
|
|
61475
|
+
genColumn = 0;
|
|
61476
|
+
while (reader.pos < semi) {
|
|
61477
|
+
let seg;
|
|
61478
|
+
genColumn = decodeInteger(reader, genColumn);
|
|
61479
|
+
if (genColumn < lastCol) sorted = false;
|
|
61480
|
+
lastCol = genColumn;
|
|
61481
|
+
if (hasMoreVlq(reader, semi)) {
|
|
61482
|
+
sourcesIndex = decodeInteger(reader, sourcesIndex);
|
|
61483
|
+
sourceLine = decodeInteger(reader, sourceLine);
|
|
61484
|
+
sourceColumn = decodeInteger(reader, sourceColumn);
|
|
61485
|
+
if (hasMoreVlq(reader, semi)) {
|
|
61486
|
+
namesIndex = decodeInteger(reader, namesIndex);
|
|
61487
|
+
seg = [
|
|
61488
|
+
genColumn,
|
|
61489
|
+
sourcesIndex,
|
|
61490
|
+
sourceLine,
|
|
61491
|
+
sourceColumn,
|
|
61492
|
+
namesIndex
|
|
61493
|
+
];
|
|
61494
|
+
} else seg = [
|
|
61495
|
+
genColumn,
|
|
61496
|
+
sourcesIndex,
|
|
61497
|
+
sourceLine,
|
|
61498
|
+
sourceColumn
|
|
61499
|
+
];
|
|
61500
|
+
} else seg = [genColumn];
|
|
61501
|
+
line.push(seg);
|
|
61502
|
+
reader.pos++;
|
|
61503
|
+
}
|
|
61504
|
+
if (!sorted) sort(line);
|
|
61505
|
+
decoded.push(line);
|
|
61506
|
+
reader.pos = semi + 1;
|
|
61507
|
+
} while (reader.pos <= length);
|
|
61508
|
+
return decoded;
|
|
61509
|
+
}
|
|
61510
|
+
function sort(line) {
|
|
61511
|
+
line.sort(sortComparator$1);
|
|
61512
|
+
}
|
|
61513
|
+
function sortComparator$1(a, b) {
|
|
61514
|
+
return a[0] - b[0];
|
|
61515
|
+
}
|
|
61516
|
+
//#endregion
|
|
61517
|
+
//#region ../../node_modules/.pnpm/@jridgewell+resolve-uri@3.1.2/node_modules/@jridgewell/resolve-uri/dist/resolve-uri.mjs
|
|
61518
|
+
const schemeRegex = /^[\w+.-]+:\/\//;
|
|
61519
|
+
/**
|
|
61520
|
+
* Matches the parts of a URL:
|
|
61521
|
+
* 1. Scheme, including ":", guaranteed.
|
|
61522
|
+
* 2. User/password, including "@", optional.
|
|
61523
|
+
* 3. Host, guaranteed.
|
|
61524
|
+
* 4. Port, including ":", optional.
|
|
61525
|
+
* 5. Path, including "/", optional.
|
|
61526
|
+
* 6. Query, including "?", optional.
|
|
61527
|
+
* 7. Hash, including "#", optional.
|
|
61528
|
+
*/
|
|
61529
|
+
const urlRegex = /^([\w+.-]+:)\/\/([^@/#?]*@)?([^:/#?]*)(:\d+)?(\/[^#?]*)?(\?[^#]*)?(#.*)?/;
|
|
61530
|
+
/**
|
|
61531
|
+
* File URLs are weird. They dont' need the regular `//` in the scheme, they may or may not start
|
|
61532
|
+
* with a leading `/`, they can have a domain (but only if they don't start with a Windows drive).
|
|
61533
|
+
*
|
|
61534
|
+
* 1. Host, optional.
|
|
61535
|
+
* 2. Path, which may include "/", guaranteed.
|
|
61536
|
+
* 3. Query, including "?", optional.
|
|
61537
|
+
* 4. Hash, including "#", optional.
|
|
61538
|
+
*/
|
|
61539
|
+
const fileRegex = /^file:(?:\/\/((?![a-z]:)[^/#?]*)?)?(\/?[^#?]*)(\?[^#]*)?(#.*)?/i;
|
|
61540
|
+
function isAbsoluteUrl(input) {
|
|
61541
|
+
return schemeRegex.test(input);
|
|
61542
|
+
}
|
|
61543
|
+
function isSchemeRelativeUrl(input) {
|
|
61544
|
+
return input.startsWith("//");
|
|
61545
|
+
}
|
|
61546
|
+
function isAbsolutePath(input) {
|
|
61547
|
+
return input.startsWith("/");
|
|
61548
|
+
}
|
|
61549
|
+
function isFileUrl(input) {
|
|
61550
|
+
return input.startsWith("file:");
|
|
61551
|
+
}
|
|
61552
|
+
function isRelative(input) {
|
|
61553
|
+
return /^[.?#]/.test(input);
|
|
61554
|
+
}
|
|
61555
|
+
function parseAbsoluteUrl(input) {
|
|
61556
|
+
const match = urlRegex.exec(input);
|
|
61557
|
+
return makeUrl(match[1], match[2] || "", match[3], match[4] || "", match[5] || "/", match[6] || "", match[7] || "");
|
|
61558
|
+
}
|
|
61559
|
+
function parseFileUrl(input) {
|
|
61560
|
+
const match = fileRegex.exec(input);
|
|
61561
|
+
const path = match[2];
|
|
61562
|
+
return makeUrl("file:", "", match[1] || "", "", isAbsolutePath(path) ? path : "/" + path, match[3] || "", match[4] || "");
|
|
61563
|
+
}
|
|
61564
|
+
function makeUrl(scheme, user, host, port, path, query, hash) {
|
|
61565
|
+
return {
|
|
61566
|
+
scheme,
|
|
61567
|
+
user,
|
|
61568
|
+
host,
|
|
61569
|
+
port,
|
|
61570
|
+
path,
|
|
61571
|
+
query,
|
|
61572
|
+
hash,
|
|
61573
|
+
type: 7
|
|
61574
|
+
};
|
|
61575
|
+
}
|
|
61576
|
+
function parseUrl(input) {
|
|
61577
|
+
if (isSchemeRelativeUrl(input)) {
|
|
61578
|
+
const url = parseAbsoluteUrl("http:" + input);
|
|
61579
|
+
url.scheme = "";
|
|
61580
|
+
url.type = 6;
|
|
61581
|
+
return url;
|
|
61582
|
+
}
|
|
61583
|
+
if (isAbsolutePath(input)) {
|
|
61584
|
+
const url = parseAbsoluteUrl("http://foo.com" + input);
|
|
61585
|
+
url.scheme = "";
|
|
61586
|
+
url.host = "";
|
|
61587
|
+
url.type = 5;
|
|
61588
|
+
return url;
|
|
61589
|
+
}
|
|
61590
|
+
if (isFileUrl(input)) return parseFileUrl(input);
|
|
61591
|
+
if (isAbsoluteUrl(input)) return parseAbsoluteUrl(input);
|
|
61592
|
+
const url = parseAbsoluteUrl("http://foo.com/" + input);
|
|
61593
|
+
url.scheme = "";
|
|
61594
|
+
url.host = "";
|
|
61595
|
+
url.type = input ? input.startsWith("?") ? 3 : input.startsWith("#") ? 2 : 4 : 1;
|
|
61596
|
+
return url;
|
|
61597
|
+
}
|
|
61598
|
+
function stripPathFilename(path) {
|
|
61599
|
+
if (path.endsWith("/..")) return path;
|
|
61600
|
+
const index = path.lastIndexOf("/");
|
|
61601
|
+
return path.slice(0, index + 1);
|
|
61602
|
+
}
|
|
61603
|
+
function mergePaths(url, base) {
|
|
61604
|
+
normalizePath(base, base.type);
|
|
61605
|
+
if (url.path === "/") url.path = base.path;
|
|
61606
|
+
else url.path = stripPathFilename(base.path) + url.path;
|
|
61607
|
+
}
|
|
61608
|
+
/**
|
|
61609
|
+
* The path can have empty directories "//", unneeded parents "foo/..", or current directory
|
|
61610
|
+
* "foo/.". We need to normalize to a standard representation.
|
|
61611
|
+
*/
|
|
61612
|
+
function normalizePath(url, type) {
|
|
61613
|
+
const rel = type <= 4;
|
|
61614
|
+
const pieces = url.path.split("/");
|
|
61615
|
+
let pointer = 1;
|
|
61616
|
+
let positive = 0;
|
|
61617
|
+
let addTrailingSlash = false;
|
|
61618
|
+
for (let i = 1; i < pieces.length; i++) {
|
|
61619
|
+
const piece = pieces[i];
|
|
61620
|
+
if (!piece) {
|
|
61621
|
+
addTrailingSlash = true;
|
|
61622
|
+
continue;
|
|
61623
|
+
}
|
|
61624
|
+
addTrailingSlash = false;
|
|
61625
|
+
if (piece === ".") continue;
|
|
61626
|
+
if (piece === "..") {
|
|
61627
|
+
if (positive) {
|
|
61628
|
+
addTrailingSlash = true;
|
|
61629
|
+
positive--;
|
|
61630
|
+
pointer--;
|
|
61631
|
+
} else if (rel) pieces[pointer++] = piece;
|
|
61632
|
+
continue;
|
|
61633
|
+
}
|
|
61634
|
+
pieces[pointer++] = piece;
|
|
61635
|
+
positive++;
|
|
61636
|
+
}
|
|
61637
|
+
let path = "";
|
|
61638
|
+
for (let i = 1; i < pointer; i++) path += "/" + pieces[i];
|
|
61639
|
+
if (!path || addTrailingSlash && !path.endsWith("/..")) path += "/";
|
|
61640
|
+
url.path = path;
|
|
61641
|
+
}
|
|
61642
|
+
/**
|
|
61643
|
+
* Attempts to resolve `input` URL/path relative to `base`.
|
|
61644
|
+
*/
|
|
61645
|
+
function resolve(input, base) {
|
|
61646
|
+
if (!input && !base) return "";
|
|
61647
|
+
const url = parseUrl(input);
|
|
61648
|
+
let inputType = url.type;
|
|
61649
|
+
if (base && inputType !== 7) {
|
|
61650
|
+
const baseUrl = parseUrl(base);
|
|
61651
|
+
const baseType = baseUrl.type;
|
|
61652
|
+
switch (inputType) {
|
|
61653
|
+
case 1: url.hash = baseUrl.hash;
|
|
61654
|
+
case 2: url.query = baseUrl.query;
|
|
61655
|
+
case 3:
|
|
61656
|
+
case 4: mergePaths(url, baseUrl);
|
|
61657
|
+
case 5:
|
|
61658
|
+
url.user = baseUrl.user;
|
|
61659
|
+
url.host = baseUrl.host;
|
|
61660
|
+
url.port = baseUrl.port;
|
|
61661
|
+
case 6: url.scheme = baseUrl.scheme;
|
|
61662
|
+
}
|
|
61663
|
+
if (baseType > inputType) inputType = baseType;
|
|
61664
|
+
}
|
|
61665
|
+
normalizePath(url, inputType);
|
|
61666
|
+
const queryHash = url.query + url.hash;
|
|
61667
|
+
switch (inputType) {
|
|
61668
|
+
case 2:
|
|
61669
|
+
case 3: return queryHash;
|
|
61670
|
+
case 4: {
|
|
61671
|
+
const path = url.path.slice(1);
|
|
61672
|
+
if (!path) return queryHash || ".";
|
|
61673
|
+
if (isRelative(base || input) && !isRelative(path)) return "./" + path + queryHash;
|
|
61674
|
+
return path + queryHash;
|
|
61675
|
+
}
|
|
61676
|
+
case 5: return url.path + queryHash;
|
|
61677
|
+
default: return url.scheme + "//" + url.user + url.host + url.port + url.path + queryHash;
|
|
61678
|
+
}
|
|
61679
|
+
}
|
|
61680
|
+
//#endregion
|
|
61681
|
+
//#region ../../node_modules/.pnpm/@jridgewell+trace-mapping@0.3.31/node_modules/@jridgewell/trace-mapping/dist/trace-mapping.mjs
|
|
61682
|
+
function stripFilename(path) {
|
|
61683
|
+
if (!path) return "";
|
|
61684
|
+
const index = path.lastIndexOf("/");
|
|
61685
|
+
return path.slice(0, index + 1);
|
|
61686
|
+
}
|
|
61687
|
+
function resolver(mapUrl, sourceRoot) {
|
|
61688
|
+
const from = stripFilename(mapUrl);
|
|
61689
|
+
const prefix = sourceRoot ? sourceRoot + "/" : "";
|
|
61690
|
+
return (source) => resolve(prefix + (source || ""), from);
|
|
61691
|
+
}
|
|
61692
|
+
var COLUMN = 0;
|
|
61693
|
+
var SOURCES_INDEX = 1;
|
|
61694
|
+
var SOURCE_LINE = 2;
|
|
61695
|
+
var SOURCE_COLUMN = 3;
|
|
61696
|
+
var NAMES_INDEX = 4;
|
|
61697
|
+
function maybeSort(mappings, owned) {
|
|
61698
|
+
const unsortedIndex = nextUnsortedSegmentLine(mappings, 0);
|
|
61699
|
+
if (unsortedIndex === mappings.length) return mappings;
|
|
61700
|
+
if (!owned) mappings = mappings.slice();
|
|
61701
|
+
for (let i = unsortedIndex; i < mappings.length; i = nextUnsortedSegmentLine(mappings, i + 1)) mappings[i] = sortSegments(mappings[i], owned);
|
|
61702
|
+
return mappings;
|
|
61703
|
+
}
|
|
61704
|
+
function nextUnsortedSegmentLine(mappings, start) {
|
|
61705
|
+
for (let i = start; i < mappings.length; i++) if (!isSorted(mappings[i])) return i;
|
|
61706
|
+
return mappings.length;
|
|
61707
|
+
}
|
|
61708
|
+
function isSorted(line) {
|
|
61709
|
+
for (let j = 1; j < line.length; j++) if (line[j][COLUMN] < line[j - 1][COLUMN]) return false;
|
|
61710
|
+
return true;
|
|
61711
|
+
}
|
|
61712
|
+
function sortSegments(line, owned) {
|
|
61713
|
+
if (!owned) line = line.slice();
|
|
61714
|
+
return line.sort(sortComparator);
|
|
61715
|
+
}
|
|
61716
|
+
function sortComparator(a, b) {
|
|
61717
|
+
return a[COLUMN] - b[COLUMN];
|
|
61718
|
+
}
|
|
61719
|
+
var found = false;
|
|
61720
|
+
function binarySearch(haystack, needle, low, high) {
|
|
61721
|
+
while (low <= high) {
|
|
61722
|
+
const mid = low + (high - low >> 1);
|
|
61723
|
+
const cmp = haystack[mid][COLUMN] - needle;
|
|
61724
|
+
if (cmp === 0) {
|
|
61725
|
+
found = true;
|
|
61726
|
+
return mid;
|
|
61727
|
+
}
|
|
61728
|
+
if (cmp < 0) low = mid + 1;
|
|
61729
|
+
else high = mid - 1;
|
|
61730
|
+
}
|
|
61731
|
+
found = false;
|
|
61732
|
+
return low - 1;
|
|
61733
|
+
}
|
|
61734
|
+
function upperBound(haystack, needle, index) {
|
|
61735
|
+
for (let i = index + 1; i < haystack.length; index = i++) if (haystack[i][COLUMN] !== needle) break;
|
|
61736
|
+
return index;
|
|
61737
|
+
}
|
|
61738
|
+
function lowerBound(haystack, needle, index) {
|
|
61739
|
+
for (let i = index - 1; i >= 0; index = i--) if (haystack[i][COLUMN] !== needle) break;
|
|
61740
|
+
return index;
|
|
61741
|
+
}
|
|
61742
|
+
function memoizedState() {
|
|
61743
|
+
return {
|
|
61744
|
+
lastKey: -1,
|
|
61745
|
+
lastNeedle: -1,
|
|
61746
|
+
lastIndex: -1
|
|
61747
|
+
};
|
|
61748
|
+
}
|
|
61749
|
+
function memoizedBinarySearch(haystack, needle, state, key) {
|
|
61750
|
+
const { lastKey, lastNeedle, lastIndex } = state;
|
|
61751
|
+
let low = 0;
|
|
61752
|
+
let high = haystack.length - 1;
|
|
61753
|
+
if (key === lastKey) {
|
|
61754
|
+
if (needle === lastNeedle) {
|
|
61755
|
+
found = lastIndex !== -1 && haystack[lastIndex][COLUMN] === needle;
|
|
61756
|
+
return lastIndex;
|
|
61757
|
+
}
|
|
61758
|
+
if (needle >= lastNeedle) low = lastIndex === -1 ? 0 : lastIndex;
|
|
61759
|
+
else high = lastIndex;
|
|
61760
|
+
}
|
|
61761
|
+
state.lastKey = key;
|
|
61762
|
+
state.lastNeedle = needle;
|
|
61763
|
+
return state.lastIndex = binarySearch(haystack, needle, low, high);
|
|
61764
|
+
}
|
|
61765
|
+
function parse(map) {
|
|
61766
|
+
return typeof map === "string" ? JSON.parse(map) : map;
|
|
61767
|
+
}
|
|
61768
|
+
var LINE_GTR_ZERO = "`line` must be greater than 0 (lines start at line 1)";
|
|
61769
|
+
var COL_GTR_EQ_ZERO = "`column` must be greater than or equal to 0 (columns start at column 0)";
|
|
61770
|
+
var TraceMap = class {
|
|
61771
|
+
constructor(map, mapUrl) {
|
|
61772
|
+
const isString = typeof map === "string";
|
|
61773
|
+
if (!isString && map._decodedMemo) return map;
|
|
61774
|
+
const parsed = parse(map);
|
|
61775
|
+
const { version, file, names, sourceRoot, sources, sourcesContent } = parsed;
|
|
61776
|
+
this.version = version;
|
|
61777
|
+
this.file = file;
|
|
61778
|
+
this.names = names || [];
|
|
61779
|
+
this.sourceRoot = sourceRoot;
|
|
61780
|
+
this.sources = sources;
|
|
61781
|
+
this.sourcesContent = sourcesContent;
|
|
61782
|
+
this.ignoreList = parsed.ignoreList || parsed.x_google_ignoreList || void 0;
|
|
61783
|
+
const resolve = resolver(mapUrl, sourceRoot);
|
|
61784
|
+
this.resolvedSources = sources.map(resolve);
|
|
61785
|
+
const { mappings } = parsed;
|
|
61786
|
+
if (typeof mappings === "string") {
|
|
61787
|
+
this._encoded = mappings;
|
|
61788
|
+
this._decoded = void 0;
|
|
61789
|
+
} else if (Array.isArray(mappings)) {
|
|
61790
|
+
this._encoded = void 0;
|
|
61791
|
+
this._decoded = maybeSort(mappings, isString);
|
|
61792
|
+
} else if (parsed.sections) throw new Error(`TraceMap passed sectioned source map, please use FlattenMap export instead`);
|
|
61793
|
+
else throw new Error(`invalid source map: ${JSON.stringify(parsed)}`);
|
|
61794
|
+
this._decodedMemo = memoizedState();
|
|
61795
|
+
this._bySources = void 0;
|
|
61796
|
+
this._bySourceMemos = void 0;
|
|
61797
|
+
}
|
|
61798
|
+
};
|
|
61799
|
+
function cast(map) {
|
|
61800
|
+
return map;
|
|
61801
|
+
}
|
|
61802
|
+
function decodedMappings(map) {
|
|
61803
|
+
var _a;
|
|
61804
|
+
return (_a = cast(map))._decoded || (_a._decoded = decode(cast(map)._encoded));
|
|
61805
|
+
}
|
|
61806
|
+
function originalPositionFor(map, needle) {
|
|
61807
|
+
let { line, column, bias } = needle;
|
|
61808
|
+
line--;
|
|
61809
|
+
if (line < 0) throw new Error(LINE_GTR_ZERO);
|
|
61810
|
+
if (column < 0) throw new Error(COL_GTR_EQ_ZERO);
|
|
61811
|
+
const decoded = decodedMappings(map);
|
|
61812
|
+
if (line >= decoded.length) return OMapping(null, null, null, null);
|
|
61813
|
+
const segments = decoded[line];
|
|
61814
|
+
const index = traceSegmentInternal(segments, cast(map)._decodedMemo, line, column, bias || 1);
|
|
61815
|
+
if (index === -1) return OMapping(null, null, null, null);
|
|
61816
|
+
const segment = segments[index];
|
|
61817
|
+
if (segment.length === 1) return OMapping(null, null, null, null);
|
|
61818
|
+
const { names, resolvedSources } = map;
|
|
61819
|
+
return OMapping(resolvedSources[segment[SOURCES_INDEX]], segment[SOURCE_LINE] + 1, segment[SOURCE_COLUMN], segment.length === 5 ? names[segment[NAMES_INDEX]] : null);
|
|
61820
|
+
}
|
|
61821
|
+
function OMapping(source, line, column, name) {
|
|
61822
|
+
return {
|
|
61823
|
+
source,
|
|
61824
|
+
line,
|
|
61825
|
+
column,
|
|
61826
|
+
name
|
|
61827
|
+
};
|
|
61828
|
+
}
|
|
61829
|
+
function traceSegmentInternal(segments, memo, line, column, bias) {
|
|
61830
|
+
let index = memoizedBinarySearch(segments, column, memo, line);
|
|
61831
|
+
if (found) index = (bias === -1 ? upperBound : lowerBound)(segments, column, index);
|
|
61832
|
+
else if (bias === -1) index++;
|
|
61833
|
+
if (index === -1 || index === segments.length) return -1;
|
|
61834
|
+
return index;
|
|
61835
|
+
}
|
|
61836
|
+
//#endregion
|
|
61414
61837
|
//#region ../core/dist/index.js
|
|
61415
61838
|
var __create = Object.create;
|
|
61416
61839
|
var __defProp = Object.defineProperty;
|
|
@@ -61480,7 +61903,7 @@ var AmbiguousProjectError = class extends Error {
|
|
|
61480
61903
|
};
|
|
61481
61904
|
const isProjectDiscoveryError = (value) => value instanceof ProjectNotFoundError || value instanceof NoReactDependencyError || value instanceof PackageJsonNotFoundError || value instanceof NotADirectoryError || value instanceof AmbiguousProjectError;
|
|
61482
61905
|
const HTML_FILE_PATTERN = /\.html$/i;
|
|
61483
|
-
const SOURCE_FILE_PATTERN = /\.(?:tsx?|jsx?|mts|mjs|[hH][tT][mM][lL])$/;
|
|
61906
|
+
const SOURCE_FILE_PATTERN = /\.(?:astro|tsx?|jsx?|mts|mjs|[hH][tT][mM][lL])$/;
|
|
61484
61907
|
const GENERATED_BUNDLE_FILE_PATTERN = /\.(iife|umd|global|min)\.m?js$/i;
|
|
61485
61908
|
const GENERATED_SOURCE_DIRECTORY_PATTERN = /(?:^|\/)__generated__\//;
|
|
61486
61909
|
const MINIFIED_SNIFF_BYTES = 65536;
|
|
@@ -62231,6 +62654,7 @@ const FRAMEWORK_PACKAGES = {
|
|
|
62231
62654
|
"@tanstack/react-start": "tanstack-start",
|
|
62232
62655
|
"@remix-run/react": "remix",
|
|
62233
62656
|
gatsby: "gatsby",
|
|
62657
|
+
astro: "astro",
|
|
62234
62658
|
vite: "vite",
|
|
62235
62659
|
"react-scripts": "cra",
|
|
62236
62660
|
expo: "expo",
|
|
@@ -62452,10 +62876,16 @@ const getTopLevelBinding = (sourceFile, bindingName) => {
|
|
|
62452
62876
|
}
|
|
62453
62877
|
return null;
|
|
62454
62878
|
};
|
|
62455
|
-
const getFunctionLocalBindings = (functionNode, argumentsList) => {
|
|
62879
|
+
const getFunctionLocalBindings = (functionNode, argumentsList, argumentAnalysis, functionAnalysis) => {
|
|
62456
62880
|
const localBindings = /* @__PURE__ */ new Map();
|
|
62457
62881
|
functionNode.parameters.forEach((parameter, parameterIndex) => {
|
|
62458
|
-
if (ts.isIdentifier(parameter.name))
|
|
62882
|
+
if (ts.isIdentifier(parameter.name)) {
|
|
62883
|
+
const argument = argumentsList[parameterIndex];
|
|
62884
|
+
localBindings.set(parameter.name.text, {
|
|
62885
|
+
expression: argument ?? parameter.initializer ?? null,
|
|
62886
|
+
analysis: argument ? argumentAnalysis : functionAnalysis
|
|
62887
|
+
});
|
|
62888
|
+
}
|
|
62459
62889
|
});
|
|
62460
62890
|
return localBindings;
|
|
62461
62891
|
};
|
|
@@ -62591,8 +63021,8 @@ const getStaticConfigValueState = (expression, analysis, visitedExpressions = /*
|
|
|
62591
63021
|
};
|
|
62592
63022
|
if (ts.isIdentifier(unwrappedExpression)) {
|
|
62593
63023
|
if (analysis.localBindings.has(unwrappedExpression.text)) {
|
|
62594
|
-
const
|
|
62595
|
-
return
|
|
63024
|
+
const localReference = analysis.localBindings.get(unwrappedExpression.text);
|
|
63025
|
+
return localReference?.expression ? getStaticConfigValueState(localReference.expression, localReference.analysis, nextVisitedExpressions) : null;
|
|
62596
63026
|
}
|
|
62597
63027
|
const topLevelBinding = getTopLevelBinding(analysis.sourceFile, unwrappedExpression.text);
|
|
62598
63028
|
return topLevelBinding && ts.isExpression(topLevelBinding) ? getStaticConfigValueState(topLevelBinding, analysis, nextVisitedExpressions) : null;
|
|
@@ -62634,8 +63064,8 @@ const getReactCompilerFlagState = (expression, analysis, visitedExpressions = /*
|
|
|
62634
63064
|
const assignedBinding = getAssignedPropertyInitializer(unwrappedExpression, "reactCompiler");
|
|
62635
63065
|
if (assignedBinding.wasFound && assignedBinding.initializer) return { isEnabled: !isStaticallyDisabledConfigExpression(assignedBinding.initializer, analysis) };
|
|
62636
63066
|
if (analysis.localBindings.has(unwrappedExpression.text)) {
|
|
62637
|
-
const
|
|
62638
|
-
return
|
|
63067
|
+
const localReference = analysis.localBindings.get(unwrappedExpression.text);
|
|
63068
|
+
return localReference?.expression ? getReactCompilerFlagState(localReference.expression, localReference.analysis, nextVisitedExpressions) : null;
|
|
62639
63069
|
}
|
|
62640
63070
|
const topLevelBinding = getTopLevelBinding(analysis.sourceFile, unwrappedExpression.text);
|
|
62641
63071
|
return topLevelBinding && ts.isExpression(topLevelBinding) ? getReactCompilerFlagState(topLevelBinding, analysis, nextVisitedExpressions) : null;
|
|
@@ -62658,8 +63088,8 @@ const getSelectedObjectProperty = (expression, propertyName, analysis, visitedEx
|
|
|
62658
63088
|
visitedExpressions.add(resolvedExpression);
|
|
62659
63089
|
if (ts.isIdentifier(resolvedExpression)) {
|
|
62660
63090
|
if (analysis.localBindings.has(resolvedExpression.text)) {
|
|
62661
|
-
const
|
|
62662
|
-
return
|
|
63091
|
+
const localReference = analysis.localBindings.get(resolvedExpression.text);
|
|
63092
|
+
return localReference?.expression ? getSelectedObjectProperty(localReference.expression, propertyName, localReference.analysis, visitedExpressions) : null;
|
|
62663
63093
|
}
|
|
62664
63094
|
const scopedBinding = getScopedConfigBinding(resolvedExpression);
|
|
62665
63095
|
if (scopedBinding.wasFound) return scopedBinding.initializer ? getSelectedObjectProperty(scopedBinding.initializer, propertyName, analysis, visitedExpressions) : null;
|
|
@@ -62668,9 +63098,18 @@ const getSelectedObjectProperty = (expression, propertyName, analysis, visitedEx
|
|
|
62668
63098
|
}
|
|
62669
63099
|
if (!ts.isObjectLiteralExpression(resolvedExpression)) return null;
|
|
62670
63100
|
for (const property of [...resolvedExpression.properties].reverse()) {
|
|
62671
|
-
if (ts.isPropertyAssignment(property) && getStaticPropertyName$2(property.name) === propertyName) return
|
|
62672
|
-
|
|
62673
|
-
|
|
63101
|
+
if (ts.isPropertyAssignment(property) && getStaticPropertyName$2(property.name) === propertyName) return {
|
|
63102
|
+
node: property.initializer,
|
|
63103
|
+
analysis
|
|
63104
|
+
};
|
|
63105
|
+
if (ts.isMethodDeclaration(property) && getStaticPropertyName$2(property.name) === propertyName) return {
|
|
63106
|
+
node: property,
|
|
63107
|
+
analysis
|
|
63108
|
+
};
|
|
63109
|
+
if (ts.isShorthandPropertyAssignment(property) && property.name.text === propertyName) return {
|
|
63110
|
+
node: property.name,
|
|
63111
|
+
analysis
|
|
63112
|
+
};
|
|
62674
63113
|
if (ts.isSpreadAssignment(property)) {
|
|
62675
63114
|
const spreadProperty = getSelectedObjectProperty(property.expression, propertyName, analysis, visitedExpressions);
|
|
62676
63115
|
if (spreadProperty) return spreadProperty;
|
|
@@ -62683,8 +63122,8 @@ const configExpressionMayDefineProperty = (expression, propertyName, analysis) =
|
|
|
62683
63122
|
while (ts.isParenthesizedExpression(resolvedExpression) || ts.isAsExpression(resolvedExpression) || ts.isTypeAssertionExpression(resolvedExpression) || ts.isSatisfiesExpression(resolvedExpression) || ts.isNonNullExpression(resolvedExpression)) resolvedExpression = resolvedExpression.expression;
|
|
62684
63123
|
if (ts.isIdentifier(resolvedExpression)) {
|
|
62685
63124
|
if (analysis.localBindings.has(resolvedExpression.text)) {
|
|
62686
|
-
const
|
|
62687
|
-
return
|
|
63125
|
+
const localReference = analysis.localBindings.get(resolvedExpression.text);
|
|
63126
|
+
return localReference?.expression ? configExpressionMayDefineProperty(localReference.expression, propertyName, localReference.analysis) : true;
|
|
62688
63127
|
}
|
|
62689
63128
|
const scopedBinding = getScopedConfigBinding(resolvedExpression);
|
|
62690
63129
|
if (scopedBinding.wasFound) return scopedBinding.initializer ? configExpressionMayDefineProperty(scopedBinding.initializer, propertyName, analysis) : true;
|
|
@@ -62768,15 +63207,15 @@ const getReExportedConfigModules = (sourceFile, exportName) => {
|
|
|
62768
63207
|
}
|
|
62769
63208
|
return bindings;
|
|
62770
63209
|
};
|
|
62771
|
-
const analyzeConfigModuleExport = (filePath, exportName, allowCompilerTransform, importDepth, visitedModules, argumentsList = []) => {
|
|
63210
|
+
const analyzeConfigModuleExport = (filePath, exportName, allowCompilerTransform, importDepth, visitedModules, argumentsList = [], argumentAnalysis) => {
|
|
62772
63211
|
if (!isFile(filePath) || importDepth > 4) return false;
|
|
62773
63212
|
const moduleVisitKey = `${filePath}:${exportName}:${allowCompilerTransform}`;
|
|
62774
63213
|
if (visitedModules.has(moduleVisitKey)) return false;
|
|
62775
63214
|
const nextVisitedModules = new Set(visitedModules);
|
|
62776
63215
|
nextVisitedModules.add(moduleVisitKey);
|
|
62777
|
-
return analyzeConfigSourceFileExport(parseConfigSourceFile(filePath, NFS.readFileSync(filePath, "utf-8")), filePath, exportName, allowCompilerTransform, importDepth, nextVisitedModules, argumentsList);
|
|
63216
|
+
return analyzeConfigSourceFileExport(parseConfigSourceFile(filePath, NFS.readFileSync(filePath, "utf-8")), filePath, exportName, allowCompilerTransform, importDepth, nextVisitedModules, argumentsList, argumentAnalysis);
|
|
62778
63217
|
};
|
|
62779
|
-
const analyzeConfigSourceFileExport = (sourceFile, filePath, exportName, allowCompilerTransform, importDepth, visitedModules, argumentsList = []) => {
|
|
63218
|
+
const analyzeConfigSourceFileExport = (sourceFile, filePath, exportName, allowCompilerTransform, importDepth, visitedModules, argumentsList = [], argumentAnalysis) => {
|
|
62780
63219
|
const analysis = {
|
|
62781
63220
|
filePath,
|
|
62782
63221
|
sourceFile,
|
|
@@ -62786,14 +63225,27 @@ const analyzeConfigSourceFileExport = (sourceFile, filePath, exportName, allowCo
|
|
|
62786
63225
|
localBindings: /* @__PURE__ */ new Map(),
|
|
62787
63226
|
activeFunctions: /* @__PURE__ */ new Set()
|
|
62788
63227
|
};
|
|
63228
|
+
const resolvedArgumentAnalysis = argumentAnalysis ?? analysis;
|
|
62789
63229
|
const exportedConfigNodes = getExportedConfigNodes(sourceFile, exportName);
|
|
62790
|
-
return exportedConfigNodes.some((node) =>
|
|
63230
|
+
return exportedConfigNodes.some((node) => {
|
|
63231
|
+
if (ts.isArrowFunction(node) || ts.isFunctionExpression(node) || ts.isFunctionDeclaration(node)) return analyzeConfigFunction(node, analysis, allowCompilerTransform, argumentsList, resolvedArgumentAnalysis);
|
|
63232
|
+
if (argumentsList.length > 0 && ts.isIdentifier(node)) {
|
|
63233
|
+
const topLevelBinding = getTopLevelBinding(sourceFile, node.text);
|
|
63234
|
+
if (topLevelBinding && ts.isFunctionLike(topLevelBinding)) return analyzeConfigFunction(topLevelBinding, analysis, allowCompilerTransform, argumentsList, resolvedArgumentAnalysis);
|
|
63235
|
+
const importBinding = getImportBinding(sourceFile, node.text);
|
|
63236
|
+
if (importBinding) {
|
|
63237
|
+
const importedFilePath = resolveImportedConfigFile(filePath, importBinding.moduleSpecifier);
|
|
63238
|
+
return Boolean(importedFilePath && analyzeConfigModuleExport(importedFilePath, importBinding.exportName, allowCompilerTransform, importDepth + 1, visitedModules, argumentsList, resolvedArgumentAnalysis));
|
|
63239
|
+
}
|
|
63240
|
+
}
|
|
63241
|
+
return analyzeConfigNode(node, analysis, allowCompilerTransform);
|
|
63242
|
+
}) || getReExportedConfigModules(sourceFile, exportName).some((binding) => {
|
|
62791
63243
|
if (exportedConfigNodes.length > 0 && binding.isNamespace) return false;
|
|
62792
63244
|
const importedFilePath = resolveImportedConfigFile(filePath, binding.moduleSpecifier);
|
|
62793
|
-
return Boolean(importedFilePath && analyzeConfigModuleExport(importedFilePath, binding.exportName, allowCompilerTransform, importDepth + 1, visitedModules, argumentsList));
|
|
63245
|
+
return Boolean(importedFilePath && analyzeConfigModuleExport(importedFilePath, binding.exportName, allowCompilerTransform, importDepth + 1, visitedModules, argumentsList, resolvedArgumentAnalysis));
|
|
62794
63246
|
});
|
|
62795
63247
|
};
|
|
62796
|
-
const analyzeConfigFunction = (functionNode, analysis, allowCompilerTransform, argumentsList = []) => {
|
|
63248
|
+
const analyzeConfigFunction = (functionNode, analysis, allowCompilerTransform, argumentsList = [], argumentAnalysis = analysis) => {
|
|
62797
63249
|
if (!functionNode.body) return false;
|
|
62798
63250
|
if (analysis.activeFunctions.has(functionNode.pos)) return false;
|
|
62799
63251
|
const activeFunctions = new Set(analysis.activeFunctions);
|
|
@@ -62801,7 +63253,7 @@ const analyzeConfigFunction = (functionNode, analysis, allowCompilerTransform, a
|
|
|
62801
63253
|
const functionAnalysis = {
|
|
62802
63254
|
...analysis,
|
|
62803
63255
|
visitedNodes: /* @__PURE__ */ new Set(),
|
|
62804
|
-
localBindings: getFunctionLocalBindings(functionNode, argumentsList),
|
|
63256
|
+
localBindings: getFunctionLocalBindings(functionNode, argumentsList, argumentAnalysis, analysis),
|
|
62805
63257
|
activeFunctions
|
|
62806
63258
|
};
|
|
62807
63259
|
if (!ts.isBlock(functionNode.body)) return analyzeConfigNode(functionNode.body, functionAnalysis, allowCompilerTransform);
|
|
@@ -62820,7 +63272,7 @@ const analyzeConfigFunction = (functionNode, analysis, allowCompilerTransform, a
|
|
|
62820
63272
|
const analyzeImportedConfig = ({ analysis, moduleSpecifier, exportName, allowCompilerTransform, argumentsList }) => {
|
|
62821
63273
|
const importedFilePath = resolveImportedConfigFile(analysis.filePath, moduleSpecifier);
|
|
62822
63274
|
if (!importedFilePath) return null;
|
|
62823
|
-
return analyzeConfigModuleExport(importedFilePath, exportName, allowCompilerTransform, analysis.importDepth + 1, analysis.visitedModules, argumentsList);
|
|
63275
|
+
return analyzeConfigModuleExport(importedFilePath, exportName, allowCompilerTransform, analysis.importDepth + 1, analysis.visitedModules, argumentsList, analysis);
|
|
62824
63276
|
};
|
|
62825
63277
|
const analyzeConfigIdentifier = (identifier, analysis, allowCompilerTransform, isCompilerTransformCollection, excludedPropertyNames) => {
|
|
62826
63278
|
const assignedReactCompiler = getAssignedPropertyInitializer(identifier, "reactCompiler");
|
|
@@ -62834,8 +63286,8 @@ const analyzeConfigIdentifier = (identifier, analysis, allowCompilerTransform, i
|
|
|
62834
63286
|
if (assignedPlugins.wasFound) overriddenPropertyNames.add("plugins");
|
|
62835
63287
|
if (assignedPresets.wasFound) overriddenPropertyNames.add("presets");
|
|
62836
63288
|
if (analysis.localBindings.has(identifier.text)) {
|
|
62837
|
-
const
|
|
62838
|
-
return Boolean(
|
|
63289
|
+
const localReference = analysis.localBindings.get(identifier.text);
|
|
63290
|
+
return Boolean(localReference?.expression && analyzeConfigNode(localReference.expression, localReference.analysis, allowCompilerTransform, isCompilerTransformCollection, overriddenPropertyNames));
|
|
62839
63291
|
}
|
|
62840
63292
|
const scopedBinding = getScopedConfigBinding(identifier);
|
|
62841
63293
|
if (scopedBinding.wasFound) return Boolean(scopedBinding.initializer && analyzeConfigNode(scopedBinding.initializer, analysis, allowCompilerTransform, isCompilerTransformCollection, overriddenPropertyNames));
|
|
@@ -62901,7 +63353,7 @@ const analyzeConfigCallTarget = (callExpression, analysis, allowCompilerTransfor
|
|
|
62901
63353
|
}
|
|
62902
63354
|
const selectedProperty = getSelectedObjectProperty(target.expression, propertyName, analysis);
|
|
62903
63355
|
if (selectedProperty === null) return null;
|
|
62904
|
-
return ts.isFunctionLike(selectedProperty) ? analyzeConfigFunction(selectedProperty, analysis, allowCompilerTransform, callExpression.arguments) : analyzeConfigNode(selectedProperty, analysis, allowCompilerTransform);
|
|
63356
|
+
return ts.isFunctionLike(selectedProperty.node) ? analyzeConfigFunction(selectedProperty.node, selectedProperty.analysis, allowCompilerTransform, callExpression.arguments, analysis) : analyzeConfigNode(selectedProperty.node, selectedProperty.analysis, allowCompilerTransform);
|
|
62905
63357
|
};
|
|
62906
63358
|
const analyzeConfigNode = (node, analysis, allowCompilerTransform, isCompilerTransformCollection = false, excludedPropertyNames) => {
|
|
62907
63359
|
const excludedPropertiesVisitKey = excludedPropertyNames ? [...excludedPropertyNames].sort().join(",") : "";
|
|
@@ -63001,7 +63453,7 @@ const analyzeConfigNode = (node, analysis, allowCompilerTransform, isCompilerTra
|
|
|
63001
63453
|
if (ts.isIdentifier(node.expression)) {
|
|
63002
63454
|
if (analysis.localBindings.has(node.expression.text) || getScopedConfigBinding(node.expression).wasFound) {
|
|
63003
63455
|
const selectedProperty = getSelectedObjectProperty(node.expression, node.name.text, analysis);
|
|
63004
|
-
return Boolean(selectedProperty && analyzeConfigNode(selectedProperty, analysis, allowCompilerTransform));
|
|
63456
|
+
return Boolean(selectedProperty && analyzeConfigNode(selectedProperty.node, selectedProperty.analysis, allowCompilerTransform));
|
|
63005
63457
|
}
|
|
63006
63458
|
const importBinding = getImportBinding(analysis.sourceFile, node.expression.text);
|
|
63007
63459
|
if (importBinding?.isNamespace) {
|
|
@@ -63015,7 +63467,7 @@ const analyzeConfigNode = (node, analysis, allowCompilerTransform, isCompilerTra
|
|
|
63015
63467
|
return false;
|
|
63016
63468
|
}
|
|
63017
63469
|
const selectedProperty = getSelectedObjectProperty(node.expression, node.name.text, analysis);
|
|
63018
|
-
if (selectedProperty) return analyzeConfigNode(selectedProperty, analysis, allowCompilerTransform);
|
|
63470
|
+
if (selectedProperty) return analyzeConfigNode(selectedProperty.node, selectedProperty.analysis, allowCompilerTransform);
|
|
63019
63471
|
return false;
|
|
63020
63472
|
}
|
|
63021
63473
|
return analyzeConfigNode(node.expression, analysis, allowCompilerTransform);
|
|
@@ -63024,7 +63476,7 @@ const analyzeConfigNode = (node, analysis, allowCompilerTransform, isCompilerTra
|
|
|
63024
63476
|
if (ts.isIdentifier(node.expression)) {
|
|
63025
63477
|
if (analysis.localBindings.has(node.expression.text) || getScopedConfigBinding(node.expression).wasFound) {
|
|
63026
63478
|
const selectedProperty = getSelectedObjectProperty(node.expression, node.argumentExpression.text, analysis);
|
|
63027
|
-
return Boolean(selectedProperty && analyzeConfigNode(selectedProperty, analysis, allowCompilerTransform));
|
|
63479
|
+
return Boolean(selectedProperty && analyzeConfigNode(selectedProperty.node, selectedProperty.analysis, allowCompilerTransform));
|
|
63028
63480
|
}
|
|
63029
63481
|
const importBinding = getImportBinding(analysis.sourceFile, node.expression.text);
|
|
63030
63482
|
if (importBinding?.isNamespace) {
|
|
@@ -63037,7 +63489,7 @@ const analyzeConfigNode = (node, analysis, allowCompilerTransform, isCompilerTra
|
|
|
63037
63489
|
}));
|
|
63038
63490
|
}
|
|
63039
63491
|
const selectedProperty = getSelectedObjectProperty(node.expression, node.argumentExpression.text, analysis);
|
|
63040
|
-
if (selectedProperty) return analyzeConfigNode(selectedProperty, analysis, allowCompilerTransform);
|
|
63492
|
+
if (selectedProperty) return analyzeConfigNode(selectedProperty.node, selectedProperty.analysis, allowCompilerTransform);
|
|
63041
63493
|
return false;
|
|
63042
63494
|
}
|
|
63043
63495
|
return analyzeConfigNode(node.expression, analysis, allowCompilerTransform);
|
|
@@ -65410,6 +65862,7 @@ const classifyPackageRole = (filename) => {
|
|
|
65410
65862
|
* Resolves the absolute path to read for a diagnostic's `filePath`,
|
|
65411
65863
|
* accounting for the various shapes oxlint emits:
|
|
65412
65864
|
*
|
|
65865
|
+
* - `file://` URL — decode to an absolute filesystem path.
|
|
65413
65866
|
* - Absolute POSIX (`/abs/path/file.tsx`) — pass through.
|
|
65414
65867
|
* - Absolute Windows (`C:/...` or `C:\...`) — pass through.
|
|
65415
65868
|
* - `./relative` or bare relative — join against `rootDirectory`.
|
|
@@ -65419,6 +65872,7 @@ const classifyPackageRole = (filename) => {
|
|
|
65419
65872
|
* use one canonical resolution path.
|
|
65420
65873
|
*/
|
|
65421
65874
|
const resolveCandidateReadPath = (rootDirectory, filePath) => {
|
|
65875
|
+
if (filePath.startsWith("file://")) return fileURLToPath(filePath);
|
|
65422
65876
|
const normalizedFile = filePath.replace(/\\/g, "/");
|
|
65423
65877
|
if (normalizedFile.startsWith("/") || /^[a-zA-Z]:\//.test(normalizedFile) || /^[a-zA-Z]:\\/.test(filePath)) return filePath;
|
|
65424
65878
|
return `${rootDirectory.replace(/\\/g, "/").replace(/\/$/, "")}/${normalizedFile.replace(/^\.\//, "")}`;
|
|
@@ -69613,7 +70067,10 @@ var Git = class Git extends Service()("react-doctor/Git") {
|
|
|
69613
70067
|
if (argvLengthChars > spawnArgsLengthCap) return yield* foldSpawnFailure(`spawn ENAMETOOLONG (${argvLengthChars} argv chars exceed ${spawnArgsLengthCap})`);
|
|
69614
70068
|
const handle = yield* spawner.spawn(make$1(input.command, [...input.args], {
|
|
69615
70069
|
cwd: input.directory,
|
|
69616
|
-
env: input.
|
|
70070
|
+
env: input.command === "git" ? {
|
|
70071
|
+
...input.env,
|
|
70072
|
+
GIT_DIR: void 0
|
|
70073
|
+
} : input.env,
|
|
69617
70074
|
extendEnv: true
|
|
69618
70075
|
}));
|
|
69619
70076
|
const maxStdoutBytes = input.maxStdoutBytes;
|
|
@@ -69886,7 +70343,7 @@ var Git = class Git extends Service()("react-doctor/Git") {
|
|
|
69886
70343
|
"--diff-filter=ACMR",
|
|
69887
70344
|
"--relative"
|
|
69888
70345
|
]).pipe(map$3((result) => {
|
|
69889
|
-
if (result.status !== 0) return
|
|
70346
|
+
if (result.status !== 0) return null;
|
|
69890
70347
|
return splitNullSeparated(result.stdout);
|
|
69891
70348
|
})),
|
|
69892
70349
|
showStagedContent: (directory, relativePath, options) => runCommand({
|
|
@@ -70974,6 +71431,50 @@ const columnOfUtf8Offset = (sourceBuffer, utf8Offset) => {
|
|
|
70974
71431
|
while (lineStartOffset > 0 && sourceBuffer[lineStartOffset - 1] !== 10) lineStartOffset--;
|
|
70975
71432
|
return sourceBuffer.subarray(lineStartOffset, boundedOffset).toString("utf8").length + 1;
|
|
70976
71433
|
};
|
|
71434
|
+
const utf8OffsetFromSourcePosition = (sourceBuffer, lineNumber, zeroBasedColumn) => {
|
|
71435
|
+
if (lineNumber < 1 || zeroBasedColumn < 0) return null;
|
|
71436
|
+
const sourceLines = sourceBuffer.toString("utf8").split("\n");
|
|
71437
|
+
const sourceLine = sourceLines[lineNumber - 1];
|
|
71438
|
+
if (sourceLine === void 0 || zeroBasedColumn > sourceLine.length) return null;
|
|
71439
|
+
const precedingLines = sourceLines.slice(0, lineNumber - 1).join("\n");
|
|
71440
|
+
return (lineNumber === 1 ? 0 : Buffer.byteLength(precedingLines) + Buffer.byteLength("\n")) + Buffer.byteLength(sourceLine.slice(0, zeroBasedColumn));
|
|
71441
|
+
};
|
|
71442
|
+
const mapPreparedSourceSpan = (span, preparedSourceMap) => {
|
|
71443
|
+
const generatedLine = lineOfUtf8Offset(preparedSourceMap.generatedBuffer, span.offset);
|
|
71444
|
+
const generatedColumn = columnOfUtf8Offset(preparedSourceMap.generatedBuffer, span.offset) - 1;
|
|
71445
|
+
const originalStart = originalPositionFor(preparedSourceMap.traceMap, {
|
|
71446
|
+
line: generatedLine,
|
|
71447
|
+
column: generatedColumn
|
|
71448
|
+
});
|
|
71449
|
+
if (originalStart.source === null || originalStart.line === null || originalStart.column === null) return null;
|
|
71450
|
+
const originalOffset = utf8OffsetFromSourcePosition(preparedSourceMap.sourceBuffer, originalStart.line, originalStart.column);
|
|
71451
|
+
if (originalOffset === null) return null;
|
|
71452
|
+
const generatedSpan = preparedSourceMap.generatedBuffer.subarray(span.offset, span.offset + span.length);
|
|
71453
|
+
return {
|
|
71454
|
+
offset: originalOffset,
|
|
71455
|
+
length: preparedSourceMap.sourceBuffer.subarray(originalOffset, originalOffset + generatedSpan.length).equals(generatedSpan) ? generatedSpan.length : 0,
|
|
71456
|
+
line: originalStart.line,
|
|
71457
|
+
column: originalStart.column + 1
|
|
71458
|
+
};
|
|
71459
|
+
};
|
|
71460
|
+
const mapPreparedSourceLabels = (labels, preparedSourceMap) => {
|
|
71461
|
+
const primaryLabel = labels[0];
|
|
71462
|
+
if (primaryLabel === void 0) return null;
|
|
71463
|
+
const primarySpan = mapPreparedSourceSpan(primaryLabel.span, preparedSourceMap);
|
|
71464
|
+
if (primarySpan === null) return null;
|
|
71465
|
+
const mappedLabels = [{
|
|
71466
|
+
...primaryLabel,
|
|
71467
|
+
span: primarySpan
|
|
71468
|
+
}];
|
|
71469
|
+
for (const relatedLabel of labels.slice(1)) {
|
|
71470
|
+
const relatedSpan = mapPreparedSourceSpan(relatedLabel.span, preparedSourceMap);
|
|
71471
|
+
if (relatedSpan !== null) mappedLabels.push({
|
|
71472
|
+
...relatedLabel,
|
|
71473
|
+
span: relatedSpan
|
|
71474
|
+
});
|
|
71475
|
+
}
|
|
71476
|
+
return mappedLabels;
|
|
71477
|
+
};
|
|
70977
71478
|
const REDACTED_PLACEHOLDER = "<redacted>";
|
|
70978
71479
|
const KEEP_PREFIX = `$1${REDACTED_PLACEHOLDER}`;
|
|
70979
71480
|
const KNOWN_SECRET_RULES = [
|
|
@@ -71718,7 +72219,7 @@ const isOxlintOutput = (value) => isRecord(value) && Array.isArray(value.diagnos
|
|
|
71718
72219
|
* to the first `{`. Raises `OxlintOutputUnparseable` when the
|
|
71719
72220
|
* stdout isn't valid JSON or doesn't carry a `diagnostics` array.
|
|
71720
72221
|
*/
|
|
71721
|
-
const parseOxlintOutput = (stdout, project, rootDirectory, sourcePathByLintPath) => {
|
|
72222
|
+
const parseOxlintOutput = (stdout, project, rootDirectory, sourcePathByLintPath, sourceMapByLintPath) => {
|
|
71722
72223
|
if (!stdout) return [];
|
|
71723
72224
|
const jsonStart = stdout.indexOf("{");
|
|
71724
72225
|
const sanitizedStdout = jsonStart > 0 ? stdout.slice(jsonStart) : stdout;
|
|
@@ -71736,6 +72237,7 @@ const parseOxlintOutput = (stdout, project, rootDirectory, sourcePathByLintPath)
|
|
|
71736
72237
|
const sourceLinesCache = /* @__PURE__ */ new Map();
|
|
71737
72238
|
const resolveAbsolutePath = (filename) => Path.isAbsolute(filename) ? filename : Path.resolve(rootDirectory || ".", filename);
|
|
71738
72239
|
const resolveMappedSourceFilename = (filename) => sourcePathByLintPath?.get(Path.normalize(resolveAbsolutePath(filename)));
|
|
72240
|
+
const resolvePreparedSourceMap = (filename) => sourceMapByLintPath?.get(Path.normalize(resolveAbsolutePath(filename)));
|
|
71739
72241
|
const resolveSourceFilename = (filename) => resolveMappedSourceFilename(filename) ?? filename;
|
|
71740
72242
|
const readSourceBuffer = (filename) => {
|
|
71741
72243
|
const absolutePath = resolveAbsolutePath(resolveSourceFilename(filename));
|
|
@@ -71767,7 +72269,19 @@ const parseOxlintOutput = (stdout, project, rootDirectory, sourcePathByLintPath)
|
|
|
71767
72269
|
minifiedFileCache.set(absolutePath, minified);
|
|
71768
72270
|
return minified;
|
|
71769
72271
|
};
|
|
71770
|
-
return suppressMemoizationInBailedOutFunctions(parsed.diagnostics.
|
|
72272
|
+
return suppressMemoizationInBailedOutFunctions(parsed.diagnostics.flatMap((diagnostic) => {
|
|
72273
|
+
const preparedSourceMap = resolvePreparedSourceMap(diagnostic.filename);
|
|
72274
|
+
if (preparedSourceMap === void 0) return [diagnostic];
|
|
72275
|
+
const { plugin, rule } = parseRuleCode(diagnostic.code);
|
|
72276
|
+
if (plugin !== "react-doctor" || !reactDoctorPlugin.rules[rule]?.tags?.includes("design")) return [];
|
|
72277
|
+
const labels = mapPreparedSourceLabels(diagnostic.labels, preparedSourceMap);
|
|
72278
|
+
const sourceFilename = resolveMappedSourceFilename(diagnostic.filename);
|
|
72279
|
+
return labels === null || sourceFilename === void 0 ? [] : [{
|
|
72280
|
+
...diagnostic,
|
|
72281
|
+
filename: sourceFilename,
|
|
72282
|
+
labels
|
|
72283
|
+
}];
|
|
72284
|
+
}).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) => {
|
|
71771
72285
|
const { plugin, rule } = parseRuleCode(diagnostic.code);
|
|
71772
72286
|
const primaryLabel = diagnostic.labels[0];
|
|
71773
72287
|
const cleaned = cleanDiagnosticMessage(diagnostic.message, diagnostic.help, plugin, rule, project);
|
|
@@ -71985,7 +72499,7 @@ const isParallelismRelatedSpawnError = (error) => {
|
|
|
71985
72499
|
* loop with a slimmer config in that case.
|
|
71986
72500
|
*/
|
|
71987
72501
|
const spawnLintBatches = async (input) => {
|
|
71988
|
-
const { baseArgs, fileBatches, rootDirectory, nodeBinaryPath, project, sourcePathByLintPath, onPartialFailure, onFileProgress, spawnTimeoutMs, outputMaxBytes, splitTotalBudgetMs = OXLINT_SPLIT_TOTAL_BUDGET_MS, splitMaxDepth = 8, signal, deadlineEpochMs } = input;
|
|
72502
|
+
const { baseArgs, fileBatches, rootDirectory, nodeBinaryPath, project, sourcePathByLintPath, sourceMapByLintPath, onPartialFailure, onFileProgress, spawnTimeoutMs, outputMaxBytes, splitTotalBudgetMs = OXLINT_SPLIT_TOTAL_BUDGET_MS, splitMaxDepth = 8, signal, deadlineEpochMs } = input;
|
|
71989
72503
|
const resolveSourcePath = (filePath) => {
|
|
71990
72504
|
const absoluteFilePath = Path.isAbsolute(filePath) ? filePath : Path.resolve(rootDirectory, filePath);
|
|
71991
72505
|
return sourcePathByLintPath?.get(Path.normalize(absoluteFilePath)) ?? filePath;
|
|
@@ -72009,7 +72523,7 @@ const spawnLintBatches = async (input) => {
|
|
|
72009
72523
|
}
|
|
72010
72524
|
const batchArgs = [...baseArgs, ...batch];
|
|
72011
72525
|
try {
|
|
72012
|
-
return parseOxlintOutput(await spawnOxlint(batchArgs, rootDirectory, nodeBinaryPath, spawnTimeoutMs, outputMaxBytes, signal), project, rootDirectory, sourcePathByLintPath);
|
|
72526
|
+
return parseOxlintOutput(await spawnOxlint(batchArgs, rootDirectory, nodeBinaryPath, spawnTimeoutMs, outputMaxBytes, signal), project, rootDirectory, sourcePathByLintPath, sourceMapByLintPath);
|
|
72013
72527
|
} catch (error) {
|
|
72014
72528
|
if (!isSplittableReactDoctorError(error)) throw error;
|
|
72015
72529
|
if (isPastDeadline()) {
|
|
@@ -72448,20 +72962,47 @@ const prepareHtmlScriptSource = (sourceBuffer) => {
|
|
|
72448
72962
|
lintBuffer: maskedBuffer ?? sourceBuffer
|
|
72449
72963
|
};
|
|
72450
72964
|
};
|
|
72451
|
-
const
|
|
72965
|
+
const ASTRO_FILE_PATTERN = /\.astro$/;
|
|
72966
|
+
const prepareLintSources = (rootDirectory, temporaryDirectory, candidateFiles) => {
|
|
72452
72967
|
const lintFiles = [];
|
|
72453
72968
|
const sourcePathByLintPath = /* @__PURE__ */ new Map();
|
|
72969
|
+
const sourceMapByLintPath = /* @__PURE__ */ new Map();
|
|
72454
72970
|
const sizeByLintPath = /* @__PURE__ */ new Map();
|
|
72455
72971
|
const htmlSourcesDirectory = Path.join(temporaryDirectory, "html-sources");
|
|
72972
|
+
const astroSourcesDirectory = Path.join(temporaryDirectory, "astro-sources");
|
|
72456
72973
|
let htmlFileIndex = 0;
|
|
72974
|
+
let astroFileIndex = 0;
|
|
72457
72975
|
let hasThreeModuleImport = false;
|
|
72458
72976
|
for (const candidateFile of candidateFiles) {
|
|
72459
|
-
if (!HTML_FILE_PATTERN.test(candidateFile)) {
|
|
72977
|
+
if (!HTML_FILE_PATTERN.test(candidateFile) && !ASTRO_FILE_PATTERN.test(candidateFile)) {
|
|
72460
72978
|
lintFiles.push(candidateFile);
|
|
72461
72979
|
continue;
|
|
72462
72980
|
}
|
|
72463
72981
|
const absoluteSourcePath = Path.isAbsolute(candidateFile) ? candidateFile : Path.resolve(rootDirectory, candidateFile);
|
|
72464
72982
|
const sourceBuffer = NFS.readFileSync(absoluteSourcePath);
|
|
72983
|
+
if (ASTRO_FILE_PATTERN.test(candidateFile)) {
|
|
72984
|
+
const compilerSourcePath = absoluteSourcePath.replaceAll("\\", "/");
|
|
72985
|
+
const convertedSource = convertToTSX(sourceBuffer.toString("utf8"), {
|
|
72986
|
+
filename: compilerSourcePath,
|
|
72987
|
+
sourcemap: "external",
|
|
72988
|
+
includeScripts: true
|
|
72989
|
+
});
|
|
72990
|
+
if (astroFileIndex === 0) NFS.mkdirSync(astroSourcesDirectory, { recursive: true });
|
|
72991
|
+
const lintPath = Path.join(astroSourcesDirectory, `${astroFileIndex}.tsx`);
|
|
72992
|
+
const generatedBuffer = Buffer.from(convertedSource.code);
|
|
72993
|
+
NFS.writeFileSync(lintPath, generatedBuffer);
|
|
72994
|
+
lintFiles.push(candidateFile);
|
|
72995
|
+
lintFiles.push(lintPath);
|
|
72996
|
+
sourcePathByLintPath.set(Path.resolve(lintPath), candidateFile);
|
|
72997
|
+
sourceMapByLintPath.set(Path.resolve(lintPath), {
|
|
72998
|
+
traceMap: new TraceMap(JSON.stringify(convertedSource.map)),
|
|
72999
|
+
generatedBuffer,
|
|
73000
|
+
sourceBuffer
|
|
73001
|
+
});
|
|
73002
|
+
sizeByLintPath.set(lintPath, sourceBuffer.length);
|
|
73003
|
+
astroFileIndex++;
|
|
73004
|
+
continue;
|
|
73005
|
+
}
|
|
72465
73006
|
const { executableScriptBodies, lintBuffer } = prepareHtmlScriptSource(sourceBuffer);
|
|
72466
73007
|
if (htmlFileIndex === 0) NFS.mkdirSync(htmlSourcesDirectory, { recursive: true });
|
|
72467
73008
|
const lintPath = Path.join(htmlSourcesDirectory, `${htmlFileIndex}.astro`);
|
|
@@ -72475,6 +73016,7 @@ const prepareHtmlLintSources = (rootDirectory, temporaryDirectory, candidateFile
|
|
|
72475
73016
|
return {
|
|
72476
73017
|
lintFiles,
|
|
72477
73018
|
sourcePathByLintPath,
|
|
73019
|
+
sourceMapByLintPath,
|
|
72478
73020
|
sizeByLintPath,
|
|
72479
73021
|
hasThreeModuleImport
|
|
72480
73022
|
};
|
|
@@ -72693,10 +73235,10 @@ const runOxlint = async (options) => {
|
|
|
72693
73235
|
rootDirectory,
|
|
72694
73236
|
candidateFiles
|
|
72695
73237
|
});
|
|
72696
|
-
const
|
|
72697
|
-
const lintFiles =
|
|
72698
|
-
const
|
|
72699
|
-
const lintProject = !project.hasThree &&
|
|
73238
|
+
const preparedLintSources = prepareLintSources(rootDirectory, configDirectory, candidateFiles);
|
|
73239
|
+
const lintFiles = preparedLintSources.lintFiles;
|
|
73240
|
+
const hasPreparedFiles = preparedLintSources.sourcePathByLintPath.size > 0;
|
|
73241
|
+
const lintProject = !project.hasThree && preparedLintSources.hasThreeModuleImport ? {
|
|
72700
73242
|
...project,
|
|
72701
73243
|
hasThree: true
|
|
72702
73244
|
} : project;
|
|
@@ -72718,7 +73260,7 @@ const runOxlint = async (options) => {
|
|
|
72718
73260
|
sidecarRuleIdFilter: overrides.sidecarRuleIdFilter
|
|
72719
73261
|
});
|
|
72720
73262
|
const sizeByFile = sizedScanFiles !== null && lintBatchOrdering === "cost" ? new Map(sizedScanFiles.map((entry) => [entry.path, entry.sizeBytes])) : null;
|
|
72721
|
-
if (sizeByFile !== null) for (const [lintPath, sizeBytes] of
|
|
73263
|
+
if (sizeByFile !== null) for (const [lintPath, sizeBytes] of preparedLintSources.sizeByLintPath) sizeByFile.set(lintPath, sizeBytes);
|
|
72722
73264
|
const buildFileBatches = (passBaseArgs, passFiles) => sizeByFile !== null ? planLintBatches({
|
|
72723
73265
|
baseArgs: passBaseArgs,
|
|
72724
73266
|
files: passFiles,
|
|
@@ -72748,7 +73290,8 @@ const runOxlint = async (options) => {
|
|
|
72748
73290
|
rootDirectory,
|
|
72749
73291
|
nodeBinaryPath,
|
|
72750
73292
|
project: lintProject,
|
|
72751
|
-
sourcePathByLintPath:
|
|
73293
|
+
sourcePathByLintPath: preparedLintSources.sourcePathByLintPath,
|
|
73294
|
+
sourceMapByLintPath: preparedLintSources.sourceMapByLintPath,
|
|
72752
73295
|
onPartialFailure: reportPartialFailure,
|
|
72753
73296
|
onAnalyzedFiles: (filePaths) => {
|
|
72754
73297
|
analyzedFiles = filePaths;
|
|
@@ -72783,7 +73326,7 @@ const runOxlint = async (options) => {
|
|
|
72783
73326
|
};
|
|
72784
73327
|
}
|
|
72785
73328
|
};
|
|
72786
|
-
if (perFileLintCacheEnabled && !project.hasReactCompiler && project.hasReactCompilerLintPlugin !== true && extendsPaths.length === 0 && userPlugins.length === 0 && !
|
|
73329
|
+
if (perFileLintCacheEnabled && !project.hasReactCompiler && project.hasReactCompilerLintPlugin !== true && extendsPaths.length === 0 && userPlugins.length === 0 && !hasPreparedFiles) {
|
|
72787
73330
|
const rulesetHash = computeRulesetHash({
|
|
72788
73331
|
config: buildConfig({
|
|
72789
73332
|
extendsPaths: [],
|
|
@@ -72949,7 +73492,8 @@ const runOxlint = async (options) => {
|
|
|
72949
73492
|
rootDirectory,
|
|
72950
73493
|
nodeBinaryPath,
|
|
72951
73494
|
project: lintProject,
|
|
72952
|
-
sourcePathByLintPath:
|
|
73495
|
+
sourcePathByLintPath: preparedLintSources.sourcePathByLintPath,
|
|
73496
|
+
sourceMapByLintPath: preparedLintSources.sourceMapByLintPath,
|
|
72953
73497
|
onPartialFailure,
|
|
72954
73498
|
onAnalyzedFiles: (filePaths) => {
|
|
72955
73499
|
analyzedFiles = filePaths;
|
|
@@ -74298,10 +74842,14 @@ const materializeSourceTree = (input) => gen(function* () {
|
|
|
74298
74842
|
materializedFiles.push(relativePath);
|
|
74299
74843
|
}
|
|
74300
74844
|
yield* sync(() => {
|
|
74301
|
-
for (const configFilename of STAGED_FILES_PROJECT_CONFIG_FILENAMES) {
|
|
74302
|
-
const sourcePath = path.join(input.directory, configFilename);
|
|
74303
|
-
const targetPath = path.
|
|
74304
|
-
if (
|
|
74845
|
+
for (const subdirectory of ["", ...input.configSubdirectories ?? []]) for (const configFilename of STAGED_FILES_PROJECT_CONFIG_FILENAMES) {
|
|
74846
|
+
const sourcePath = path.join(input.directory, subdirectory, configFilename);
|
|
74847
|
+
const targetPath = path.resolve(resolvedTempDirectory, subdirectory, configFilename);
|
|
74848
|
+
if (!isPathInsideDirectory(targetPath, resolvedTempDirectory)) continue;
|
|
74849
|
+
if (fs.existsSync(sourcePath) && !fs.existsSync(targetPath)) {
|
|
74850
|
+
fs.mkdirSync(path.dirname(targetPath), { recursive: true });
|
|
74851
|
+
fs.cpSync(sourcePath, targetPath);
|
|
74852
|
+
}
|
|
74305
74853
|
}
|
|
74306
74854
|
});
|
|
74307
74855
|
return {
|
|
@@ -74322,15 +74870,17 @@ const materializeSourceTree = (input) => gen(function* () {
|
|
|
74322
74870
|
static layerNode = effect(StagedFiles, gen(function* () {
|
|
74323
74871
|
const git = yield* Git;
|
|
74324
74872
|
return StagedFiles.of({
|
|
74325
|
-
discoverSourceFiles: (directory) => git.stagedFilePaths(directory).pipe(map$3((entries) => entries.filter(isLintableSourceFile)), withSpan("StagedFiles.discoverSourceFiles")),
|
|
74326
|
-
materialize: ({ directory, stagedFiles, tempDirectory }) => materializeSourceTree({
|
|
74873
|
+
discoverSourceFiles: (directory) => git.stagedFilePaths(directory).pipe(map$3((entries) => entries === null ? null : entries.filter(isLintableSourceFile)), withSpan("StagedFiles.discoverSourceFiles")),
|
|
74874
|
+
materialize: ({ directory, stagedFiles, tempDirectory, configSubdirectories }) => materializeSourceTree({
|
|
74327
74875
|
directory,
|
|
74328
74876
|
files: stagedFiles,
|
|
74329
74877
|
tempDirectory,
|
|
74878
|
+
configSubdirectories,
|
|
74330
74879
|
readContent: (relativePath) => git.showStagedContent(directory, relativePath, { maxBufferBytes: GIT_SHOW_MAX_BUFFER_BYTES })
|
|
74331
74880
|
}).pipe(map$3((tree) => ({
|
|
74332
74881
|
tempDirectory: tree.tempDirectory,
|
|
74333
74882
|
stagedFiles: tree.materializedFiles,
|
|
74883
|
+
unmaterializedFiles: tree.unmaterializedFiles,
|
|
74334
74884
|
cleanup: tree.cleanup
|
|
74335
74885
|
})), withSpan("StagedFiles.materialize"))
|
|
74336
74886
|
});
|
|
@@ -74345,6 +74895,7 @@ const materializeSourceTree = (input) => gen(function* () {
|
|
|
74345
74895
|
materialize: ({ tempDirectory }) => succeed$2({
|
|
74346
74896
|
tempDirectory,
|
|
74347
74897
|
stagedFiles: snapshot.materializedFiles ?? snapshot.sourceFiles ?? [],
|
|
74898
|
+
unmaterializedFiles: [],
|
|
74348
74899
|
cleanup: () => {}
|
|
74349
74900
|
})
|
|
74350
74901
|
}));
|
|
@@ -76177,6 +76728,7 @@ const METRIC = {
|
|
|
76177
76728
|
cliError: "cli.error",
|
|
76178
76729
|
cliEnvironmentError: "cli.env_error",
|
|
76179
76730
|
stagedSnapshotDivergence: "staged.snapshot_divergence",
|
|
76731
|
+
stagedPerProject: "staged.per_project",
|
|
76180
76732
|
projectDetected: "project.detected",
|
|
76181
76733
|
projectPathSelected: "project.path_selected",
|
|
76182
76734
|
projectConfigSelected: "project.config_selected",
|
|
@@ -76519,5 +77071,5 @@ const startLanguageServer = () => {
|
|
|
76519
77071
|
};
|
|
76520
77072
|
//#endregion
|
|
76521
77073
|
export { startLanguageServer };
|
|
76522
|
-
!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]="
|
|
76523
|
-
//# debugId=
|
|
77074
|
+
!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]="7cb1cf13-9787-536b-856a-49d43fec26a4")}catch(e){}}();
|
|
77075
|
+
//# debugId=7cb1cf13-9787-536b-856a-49d43fec26a4
|