react-doctor 0.2.15-dev.66f9d64 → 0.2.15-dev.bf4c21e
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 +8 -5
- package/dist/cli.js +502 -121
- package/dist/index.d.ts +7 -6
- package/dist/index.js +190 -76
- package/package.json +4 -4
package/dist/index.d.ts
CHANGED
|
@@ -772,12 +772,13 @@ declare const buildJsonReport: (input: BuildJsonReportInput) => JsonReport; //#e
|
|
|
772
772
|
* Git service runs through Effect's `ChildProcess` (true subprocess
|
|
773
773
|
* spawn, not `spawnSync`).
|
|
774
774
|
*
|
|
775
|
-
*
|
|
776
|
-
*
|
|
777
|
-
*
|
|
778
|
-
*
|
|
779
|
-
*
|
|
780
|
-
*
|
|
775
|
+
* Failures propagate as the tagged `ReactDoctorError` (rejected by
|
|
776
|
+
* `Effect.runPromise`) rather than being flattened into a plain
|
|
777
|
+
* `Error`. The message is unchanged — `ReactDoctorError.message`
|
|
778
|
+
* defers to `reason.message` — so message-matching callers keep
|
|
779
|
+
* working, while the CLI can now dispatch on `error.reason._tag` to
|
|
780
|
+
* render diff-base mistakes (`GitBaseBranchInvalid` /
|
|
781
|
+
* `GitBaseBranchMissing`) as clean user errors instead of crashes.
|
|
781
782
|
*/
|
|
782
783
|
declare const getDiffInfo: (directory: string, explicitBaseBranch?: string) => Promise<DiffInfo | null>;
|
|
783
784
|
declare const filterSourceFiles: (filePaths: string[]) => string[]; //#endregion
|
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]="4bb0de05-d610-5389-a78b-f54547ccdc56")}catch(e){}}();
|
|
3
3
|
import { createRequire } from "node:module";
|
|
4
4
|
import * as Schema from "effect/Schema";
|
|
5
5
|
import * as fs$1 from "node:fs";
|
|
@@ -4314,27 +4314,30 @@ var OxlintSpawnTimeoutMs = class extends Context.Reference("react-doctor/OxlintS
|
|
|
4314
4314
|
var OxlintOutputMaxBytes = class extends Context.Reference("react-doctor/OxlintOutputMaxBytes", { defaultValue: () => OXLINT_OUTPUT_MAX_BYTES }) {};
|
|
4315
4315
|
/**
|
|
4316
4316
|
* Number of oxlint subprocesses the lint pass runs in parallel. Defaults
|
|
4317
|
-
* to
|
|
4318
|
-
*
|
|
4319
|
-
*
|
|
4320
|
-
*
|
|
4317
|
+
* to auto-detected CPU cores (parallel) so large repos scan fast out of
|
|
4318
|
+
* the box; `spawnLintBatches` transparently falls back to a single worker
|
|
4319
|
+
* if a parallel run exhausts system resources. The CLI's `--no-parallel`
|
|
4320
|
+
* flag forces serial via `Layer.succeed`; the `REACT_DOCTOR_PARALLEL` env
|
|
4321
|
+
* var seeds the default for programmatic / CI callers that never touch the
|
|
4322
|
+
* flag — parallelism is opt-OUT, so only the explicit serial values pin
|
|
4323
|
+
* one worker:
|
|
4321
4324
|
*
|
|
4322
|
-
* - unset / `
|
|
4323
|
-
* - `
|
|
4324
|
-
* - a positive integer
|
|
4325
|
+
* - unset / `auto` / `true` / `on` → available CPU cores (clamped)
|
|
4326
|
+
* - `0` / `false` / `off` → `1` (serial)
|
|
4327
|
+
* - a positive integer → that many workers (clamped)
|
|
4328
|
+
* - any other value → available CPU cores (clamped)
|
|
4325
4329
|
*
|
|
4326
4330
|
* The resolved value is always within
|
|
4327
4331
|
* `[MIN_SCAN_CONCURRENCY, MAX_SCAN_CONCURRENCY]`.
|
|
4328
4332
|
*/
|
|
4329
4333
|
var OxlintConcurrency = class extends Context.Reference("react-doctor/OxlintConcurrency", { defaultValue: () => {
|
|
4330
4334
|
const raw = process.env["REACT_DOCTOR_PARALLEL"];
|
|
4331
|
-
if (raw === void 0) return
|
|
4335
|
+
if (raw === void 0) return resolveScanConcurrency("auto");
|
|
4332
4336
|
const normalized = raw.trim().toLowerCase();
|
|
4333
|
-
if (normalized === "
|
|
4334
|
-
if (normalized === "auto" || normalized === "true" || normalized === "on") return resolveScanConcurrency("auto");
|
|
4337
|
+
if (normalized === "0" || normalized === "false" || normalized === "off") return 1;
|
|
4335
4338
|
const parsed = Number.parseInt(normalized, 10);
|
|
4336
|
-
if (
|
|
4337
|
-
return resolveScanConcurrency(
|
|
4339
|
+
if (Number.isInteger(parsed) && parsed > 0) return resolveScanConcurrency(parsed);
|
|
4340
|
+
return resolveScanConcurrency("auto");
|
|
4338
4341
|
} }) {};
|
|
4339
4342
|
const DIAGNOSTIC_SURFACES = [
|
|
4340
4343
|
"cli",
|
|
@@ -5928,6 +5931,11 @@ const trimOrNull = (value) => {
|
|
|
5928
5931
|
* `@{` reflog suffix, or any character outside `[A-Za-z0-9_./-]`.
|
|
5929
5932
|
*/
|
|
5930
5933
|
const SAFE_GIT_REVISION_PATTERN = /^[A-Za-z0-9_./-]+$/;
|
|
5934
|
+
/** Human-readable summary of the `isSafeGitRevision` contract, reused across error details. */
|
|
5935
|
+
const GIT_REF_NAME_RULE = "must match [A-Za-z0-9_./-] without leading '-', '..', or '@{'";
|
|
5936
|
+
/** git's two range operators: two-dot (direct) and three-dot (merge-base). */
|
|
5937
|
+
const DIFF_RANGE_OPERATOR = "..";
|
|
5938
|
+
const SYMMETRIC_DIFF_RANGE_OPERATOR = "...";
|
|
5931
5939
|
const isSafeGitRevision = (candidate) => {
|
|
5932
5940
|
if (candidate.length === 0) return false;
|
|
5933
5941
|
if (candidate.startsWith("-")) return false;
|
|
@@ -5935,6 +5943,31 @@ const isSafeGitRevision = (candidate) => {
|
|
|
5935
5943
|
if (candidate.includes("..") || candidate.includes("@{")) return false;
|
|
5936
5944
|
return SAFE_GIT_REVISION_PATTERN.test(candidate);
|
|
5937
5945
|
};
|
|
5946
|
+
/**
|
|
5947
|
+
* Splits a git revision range into its endpoints: three-dot `A...B`
|
|
5948
|
+
* (symmetric, merge-base) or two-dot `A..B` (direct). Returns `null`
|
|
5949
|
+
* when `value` carries no range operator so the caller falls back to
|
|
5950
|
+
* single-base resolution.
|
|
5951
|
+
*
|
|
5952
|
+
* Only the first operator is split on; any leftover `..` stays inside an
|
|
5953
|
+
* endpoint so `isSafeGitRevision` rejects malformed input like
|
|
5954
|
+
* `A..B..C` instead of silently guessing which pair the user meant.
|
|
5955
|
+
*/
|
|
5956
|
+
const parseGitDiffRange = (value) => {
|
|
5957
|
+
const symmetricIndex = value.indexOf(SYMMETRIC_DIFF_RANGE_OPERATOR);
|
|
5958
|
+
if (symmetricIndex !== -1) return {
|
|
5959
|
+
base: value.slice(0, symmetricIndex),
|
|
5960
|
+
head: value.slice(symmetricIndex + 3),
|
|
5961
|
+
symmetric: true
|
|
5962
|
+
};
|
|
5963
|
+
const rangeIndex = value.indexOf(DIFF_RANGE_OPERATOR);
|
|
5964
|
+
if (rangeIndex !== -1) return {
|
|
5965
|
+
base: value.slice(0, rangeIndex),
|
|
5966
|
+
head: value.slice(rangeIndex + 2),
|
|
5967
|
+
symmetric: false
|
|
5968
|
+
};
|
|
5969
|
+
return null;
|
|
5970
|
+
};
|
|
5938
5971
|
const parseGithubRepoFromRemoteUrl = (remoteUrl) => {
|
|
5939
5972
|
const withoutGitSuffix = remoteUrl.trim().replace(/\.git$/, "");
|
|
5940
5973
|
const sshMatch = /^git@github\.com:([^/\s]+)\/([^/\s]+)$/.exec(withoutGitSuffix);
|
|
@@ -6086,6 +6119,49 @@ var Git = class Git extends Context.Service()("react-doctor/Git") {
|
|
|
6086
6119
|
if (result.status !== 0) return null;
|
|
6087
6120
|
return parseGithubViewerPermission(result.stdout);
|
|
6088
6121
|
}).pipe(Effect.catch(() => Effect.succeed(null)));
|
|
6122
|
+
/**
|
|
6123
|
+
* Resolves a `--diff A..B` / `A...B` commit range into a changed-file
|
|
6124
|
+
* selection. Each endpoint is validated with `isSafeGitRevision`
|
|
6125
|
+
* BEFORE it reaches `git` (so the range syntax can't smuggle a
|
|
6126
|
+
* `--upload-pack=…`-style option past the CVE-2018-17456 guard) and
|
|
6127
|
+
* verified to exist, then the diff runs between the two commits with
|
|
6128
|
+
* the same `--diff-filter=ACMR` shape the single-base path uses.
|
|
6129
|
+
*/
|
|
6130
|
+
const resolveDiffRange = (input) => Effect.gen(function* () {
|
|
6131
|
+
if (input.range.base.length === 0 && input.range.head.length === 0) return yield* Effect.fail(new ReactDoctorError({ reason: new GitBaseBranchInvalid({ detail: `Diff range "${input.raw}" must name at least one commit (e.g. "main..feature").` }) }));
|
|
6132
|
+
const baseRef = input.range.base.length === 0 ? "HEAD" : input.range.base;
|
|
6133
|
+
const headRef = input.range.head.length === 0 ? "HEAD" : input.range.head;
|
|
6134
|
+
for (const endpoint of [baseRef, headRef]) if (!isSafeGitRevision(endpoint)) return yield* Effect.fail(new ReactDoctorError({ reason: new GitBaseBranchInvalid({ detail: `Diff range "${input.raw}" has an invalid endpoint "${endpoint}" (${GIT_REF_NAME_RULE}).` }) }));
|
|
6135
|
+
for (const endpoint of [baseRef, headRef]) if (!(yield* branchExists(input.directory, endpoint))) return yield* Effect.fail(new ReactDoctorError({ reason: new GitBaseBranchMissing({ branch: endpoint }) }));
|
|
6136
|
+
let diffBaseRef = baseRef;
|
|
6137
|
+
if (input.range.symmetric) {
|
|
6138
|
+
const mergeBase = yield* runGit(input.directory, [
|
|
6139
|
+
"merge-base",
|
|
6140
|
+
baseRef,
|
|
6141
|
+
headRef
|
|
6142
|
+
]);
|
|
6143
|
+
if (mergeBase.status !== 0) return null;
|
|
6144
|
+
const mergeBaseRef = trimOrNull(mergeBase.stdout);
|
|
6145
|
+
if (mergeBaseRef === null) return null;
|
|
6146
|
+
diffBaseRef = mergeBaseRef;
|
|
6147
|
+
}
|
|
6148
|
+
const diff = yield* runGit(input.directory, [
|
|
6149
|
+
"diff",
|
|
6150
|
+
"-z",
|
|
6151
|
+
"--name-only",
|
|
6152
|
+
"--diff-filter=ACMR",
|
|
6153
|
+
"--relative",
|
|
6154
|
+
diffBaseRef,
|
|
6155
|
+
headRef
|
|
6156
|
+
]);
|
|
6157
|
+
if (diff.status !== 0) return null;
|
|
6158
|
+
return {
|
|
6159
|
+
currentBranch: yield* currentBranch(input.directory),
|
|
6160
|
+
baseBranch: baseRef,
|
|
6161
|
+
changedFiles: splitNullSeparated(diff.stdout),
|
|
6162
|
+
isCurrentChanges: false
|
|
6163
|
+
};
|
|
6164
|
+
});
|
|
6089
6165
|
return Git.of({
|
|
6090
6166
|
currentBranch,
|
|
6091
6167
|
defaultBranch,
|
|
@@ -6095,7 +6171,15 @@ var Git = class Git extends Context.Service()("react-doctor/Git") {
|
|
|
6095
6171
|
branchExists,
|
|
6096
6172
|
diffSelection: ({ directory, explicitBaseBranch }) => Effect.gen(function* () {
|
|
6097
6173
|
if (explicitBaseBranch !== void 0 && explicitBaseBranch.trim().length === 0) return yield* Effect.fail(new ReactDoctorError({ reason: new GitBaseBranchInvalid({ detail: "Diff base branch cannot be empty." }) }));
|
|
6098
|
-
if (explicitBaseBranch !== void 0
|
|
6174
|
+
if (explicitBaseBranch !== void 0) {
|
|
6175
|
+
const range = parseGitDiffRange(explicitBaseBranch);
|
|
6176
|
+
if (range !== null) return yield* resolveDiffRange({
|
|
6177
|
+
directory,
|
|
6178
|
+
range,
|
|
6179
|
+
raw: explicitBaseBranch
|
|
6180
|
+
});
|
|
6181
|
+
if (!isSafeGitRevision(explicitBaseBranch)) return yield* Effect.fail(new ReactDoctorError({ reason: new GitBaseBranchInvalid({ detail: `Diff base branch "${explicitBaseBranch}" is not a valid git ref name (${GIT_REF_NAME_RULE}).` }) }));
|
|
6182
|
+
}
|
|
6099
6183
|
const resolvedCurrentBranch = yield* currentBranch(directory);
|
|
6100
6184
|
if (resolvedCurrentBranch === null && explicitBaseBranch === void 0) return null;
|
|
6101
6185
|
const baseBranch = explicitBaseBranch ?? (yield* defaultBranch(directory));
|
|
@@ -7404,6 +7488,21 @@ const spawnOxlint = (args, rootDirectory, nodeBinaryPath, spawnTimeoutMs = OXLIN
|
|
|
7404
7488
|
resolve(output);
|
|
7405
7489
|
});
|
|
7406
7490
|
});
|
|
7491
|
+
const PARALLELISM_EXHAUSTION_ERROR_CODES = new Set([
|
|
7492
|
+
"EAGAIN",
|
|
7493
|
+
"EMFILE",
|
|
7494
|
+
"ENFILE",
|
|
7495
|
+
"ENOMEM"
|
|
7496
|
+
]);
|
|
7497
|
+
const isParallelismRelatedSpawnError = (error) => {
|
|
7498
|
+
if (!(error instanceof ReactDoctorError)) return false;
|
|
7499
|
+
const { reason } = error;
|
|
7500
|
+
if (reason._tag !== "OxlintSpawnFailed") return false;
|
|
7501
|
+
const { cause } = reason;
|
|
7502
|
+
if (typeof cause !== "object" || cause === null || !("code" in cause)) return false;
|
|
7503
|
+
const { code } = cause;
|
|
7504
|
+
return typeof code === "string" && PARALLELISM_EXHAUSTION_ERROR_CODES.has(code);
|
|
7505
|
+
};
|
|
7407
7506
|
/**
|
|
7408
7507
|
* Runs every prebuilt file batch through oxlint, with binary-split
|
|
7409
7508
|
* retry on the splittable error classes (timeout / output-too-large /
|
|
@@ -7412,66 +7511,83 @@ const spawnOxlint = (args, rootDirectory, nodeBinaryPath, spawnTimeoutMs = OXLIN
|
|
|
7412
7511
|
* (surfaced via `onPartialFailure`) so JSON-mode consumers see WHICH
|
|
7413
7512
|
* files were skipped instead of silently losing them.
|
|
7414
7513
|
*
|
|
7415
|
-
*
|
|
7416
|
-
*
|
|
7417
|
-
*
|
|
7418
|
-
*
|
|
7514
|
+
* Parallel runs (concurrency > 1) get one extra safety net: if the pass
|
|
7515
|
+
* fails with a resource-exhaustion error that's exclusive to running
|
|
7516
|
+
* many oxlint subprocesses at once (EAGAIN / EMFILE / ENFILE / ENOMEM —
|
|
7517
|
+
* see `isParallelismRelatedSpawnError`), the whole pass replays once
|
|
7518
|
+
* with a single worker. That's the only failure a serial replay can
|
|
7519
|
+
* clear, so every other error class is left to propagate.
|
|
7520
|
+
*
|
|
7521
|
+
* Errors that aren't splittable and aren't parallelism-related (oxlint
|
|
7522
|
+
* config crash, JS plugin resolution failure, etc.) propagate to the
|
|
7523
|
+
* caller — the `runOxlint` retry-without-extends fallback re-spawns this
|
|
7524
|
+
* loop with a slimmer config in that case.
|
|
7419
7525
|
*/
|
|
7420
7526
|
const spawnLintBatches = async (input) => {
|
|
7421
7527
|
const { baseArgs, fileBatches, rootDirectory, nodeBinaryPath, project, onPartialFailure, onFileProgress, spawnTimeoutMs, outputMaxBytes } = input;
|
|
7422
|
-
const
|
|
7528
|
+
const requestedConcurrency = resolveScanConcurrency(input.concurrency ?? 1);
|
|
7423
7529
|
const totalFileCount = fileBatches.reduce((sum, batch) => sum + batch.length, 0);
|
|
7424
|
-
const
|
|
7425
|
-
|
|
7426
|
-
|
|
7427
|
-
|
|
7428
|
-
const
|
|
7429
|
-
|
|
7430
|
-
|
|
7431
|
-
|
|
7432
|
-
|
|
7433
|
-
|
|
7434
|
-
|
|
7435
|
-
|
|
7436
|
-
|
|
7530
|
+
const runBatchPass = async (concurrency) => {
|
|
7531
|
+
const allDiagnostics = [];
|
|
7532
|
+
const droppedFiles = [];
|
|
7533
|
+
let firstDropReason = null;
|
|
7534
|
+
const spawnLintBatch = async (batch) => {
|
|
7535
|
+
const batchArgs = [...baseArgs, ...batch];
|
|
7536
|
+
try {
|
|
7537
|
+
return parseOxlintOutput(await spawnOxlint(batchArgs, rootDirectory, nodeBinaryPath, spawnTimeoutMs, outputMaxBytes), project, rootDirectory);
|
|
7538
|
+
} catch (error) {
|
|
7539
|
+
if (!isSplittableReactDoctorError(error)) throw error;
|
|
7540
|
+
if (batch.length <= 1) {
|
|
7541
|
+
droppedFiles.push(...batch);
|
|
7542
|
+
if (firstDropReason === null) firstDropReason = error.message;
|
|
7543
|
+
return [];
|
|
7544
|
+
}
|
|
7545
|
+
const splitIndex = Math.ceil(batch.length / 2);
|
|
7546
|
+
return [...await spawnLintBatch(batch.slice(0, splitIndex)), ...await spawnLintBatch(batch.slice(splitIndex))];
|
|
7547
|
+
}
|
|
7548
|
+
};
|
|
7549
|
+
let startedFileCount = 0;
|
|
7550
|
+
let scannedFileCount = 0;
|
|
7551
|
+
let displayedFileCount = 0;
|
|
7552
|
+
const progressTimer = onFileProgress && totalFileCount > 1 ? setInterval(() => {
|
|
7553
|
+
const ceiling = Math.min(startedFileCount, totalFileCount - 1);
|
|
7554
|
+
if (displayedFileCount < ceiling) {
|
|
7555
|
+
displayedFileCount += 1;
|
|
7556
|
+
onFileProgress(displayedFileCount, totalFileCount);
|
|
7437
7557
|
}
|
|
7438
|
-
|
|
7439
|
-
|
|
7558
|
+
}, 50) : null;
|
|
7559
|
+
progressTimer?.unref?.();
|
|
7560
|
+
try {
|
|
7561
|
+
const batchResults = await mapWithConcurrency(fileBatches, concurrency, async (batch) => {
|
|
7562
|
+
startedFileCount += batch.length;
|
|
7563
|
+
const batchDiagnostics = await spawnLintBatch(batch);
|
|
7564
|
+
scannedFileCount += batch.length;
|
|
7565
|
+
if (onFileProgress) {
|
|
7566
|
+
displayedFileCount = Math.min(Math.max(displayedFileCount, scannedFileCount), totalFileCount);
|
|
7567
|
+
onFileProgress(displayedFileCount, totalFileCount);
|
|
7568
|
+
}
|
|
7569
|
+
return batchDiagnostics;
|
|
7570
|
+
});
|
|
7571
|
+
for (const batchDiagnostics of batchResults) allDiagnostics.push(...batchDiagnostics);
|
|
7572
|
+
} finally {
|
|
7573
|
+
if (progressTimer !== null) clearInterval(progressTimer);
|
|
7440
7574
|
}
|
|
7441
|
-
|
|
7442
|
-
|
|
7443
|
-
|
|
7444
|
-
|
|
7445
|
-
|
|
7446
|
-
const ceiling = Math.min(startedFileCount, totalFileCount - 1);
|
|
7447
|
-
if (displayedFileCount < ceiling) {
|
|
7448
|
-
displayedFileCount += 1;
|
|
7449
|
-
onFileProgress(displayedFileCount, totalFileCount);
|
|
7575
|
+
if (droppedFiles.length > 0 && onPartialFailure) {
|
|
7576
|
+
const previewFiles = droppedFiles.slice(0, 3).join(", ");
|
|
7577
|
+
const remainderHint = droppedFiles.length > 3 ? `, +${droppedFiles.length - 3} more` : "";
|
|
7578
|
+
const reasonHint = firstDropReason ? ` — first failure: ${firstDropReason}` : "";
|
|
7579
|
+
onPartialFailure(`${droppedFiles.length} file(s) failed to lint and were skipped (${previewFiles}${remainderHint})${reasonHint}`);
|
|
7450
7580
|
}
|
|
7451
|
-
|
|
7452
|
-
|
|
7581
|
+
return allDiagnostics;
|
|
7582
|
+
};
|
|
7583
|
+
let diagnostics;
|
|
7453
7584
|
try {
|
|
7454
|
-
|
|
7455
|
-
|
|
7456
|
-
|
|
7457
|
-
|
|
7458
|
-
if (onFileProgress) {
|
|
7459
|
-
displayedFileCount = Math.min(Math.max(displayedFileCount, scannedFileCount), totalFileCount);
|
|
7460
|
-
onFileProgress(displayedFileCount, totalFileCount);
|
|
7461
|
-
}
|
|
7462
|
-
return batchDiagnostics;
|
|
7463
|
-
});
|
|
7464
|
-
for (const batchDiagnostics of batchResults) allDiagnostics.push(...batchDiagnostics);
|
|
7465
|
-
} finally {
|
|
7466
|
-
if (progressTimer !== null) clearInterval(progressTimer);
|
|
7467
|
-
}
|
|
7468
|
-
if (droppedFiles.length > 0 && onPartialFailure) {
|
|
7469
|
-
const previewFiles = droppedFiles.slice(0, 3).join(", ");
|
|
7470
|
-
const remainderHint = droppedFiles.length > 3 ? `, +${droppedFiles.length - 3} more` : "";
|
|
7471
|
-
const reasonHint = firstDropReason ? ` — first failure: ${firstDropReason}` : "";
|
|
7472
|
-
onPartialFailure(`${droppedFiles.length} file(s) failed to lint and were skipped (${previewFiles}${remainderHint})${reasonHint}`);
|
|
7585
|
+
diagnostics = await runBatchPass(requestedConcurrency);
|
|
7586
|
+
} catch (error) {
|
|
7587
|
+
if (requestedConcurrency <= 1 || !isParallelismRelatedSpawnError(error)) throw error;
|
|
7588
|
+
diagnostics = await runBatchPass(1);
|
|
7473
7589
|
}
|
|
7474
|
-
return dedupeDiagnostics(
|
|
7590
|
+
return dedupeDiagnostics(diagnostics);
|
|
7475
7591
|
};
|
|
7476
7592
|
let didValidate = false;
|
|
7477
7593
|
/**
|
|
@@ -8453,12 +8569,13 @@ const buildSkippedChecks = (input) => {
|
|
|
8453
8569
|
* Git service runs through Effect's `ChildProcess` (true subprocess
|
|
8454
8570
|
* spawn, not `spawnSync`).
|
|
8455
8571
|
*
|
|
8456
|
-
*
|
|
8457
|
-
*
|
|
8458
|
-
*
|
|
8459
|
-
*
|
|
8460
|
-
*
|
|
8461
|
-
*
|
|
8572
|
+
* Failures propagate as the tagged `ReactDoctorError` (rejected by
|
|
8573
|
+
* `Effect.runPromise`) rather than being flattened into a plain
|
|
8574
|
+
* `Error`. The message is unchanged — `ReactDoctorError.message`
|
|
8575
|
+
* defers to `reason.message` — so message-matching callers keep
|
|
8576
|
+
* working, while the CLI can now dispatch on `error.reason._tag` to
|
|
8577
|
+
* render diff-base mistakes (`GitBaseBranchInvalid` /
|
|
8578
|
+
* `GitBaseBranchMissing`) as clean user errors instead of crashes.
|
|
8462
8579
|
*/
|
|
8463
8580
|
const getDiffInfo = (directory, explicitBaseBranch) => Effect.runPromise(Effect.gen(function* () {
|
|
8464
8581
|
const selection = yield* (yield* Git).diffSelection({
|
|
@@ -8472,10 +8589,7 @@ const getDiffInfo = (directory, explicitBaseBranch) => Effect.runPromise(Effect.
|
|
|
8472
8589
|
changedFiles: [...selection.changedFiles],
|
|
8473
8590
|
...selection.isCurrentChanges ? { isCurrentChanges: true } : {}
|
|
8474
8591
|
};
|
|
8475
|
-
}).pipe(Effect.provide(Git.layerNode)
|
|
8476
|
-
GitBaseBranchInvalid: (reason) => Effect.die(new Error(reason.detail)),
|
|
8477
|
-
GitBaseBranchMissing: (reason) => Effect.die(new Error(reason.message))
|
|
8478
|
-
})));
|
|
8592
|
+
}).pipe(Effect.provide(Git.layerNode)));
|
|
8479
8593
|
const filterSourceFiles = (filePaths) => filePaths.filter(isLintableSourceFile);
|
|
8480
8594
|
var import_picocolors = /* @__PURE__ */ __toESM((/* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
8481
8595
|
let p = process || {}, argv = p.argv || [], env = p.env || {};
|
|
@@ -8620,4 +8734,4 @@ const toJsonReport = (result, options) => buildJsonReport({
|
|
|
8620
8734
|
export { AmbiguousProjectError, NoReactDependencyError, NotADirectoryError, PackageJsonNotFoundError, ProjectNotFoundError, ReactDoctorError, buildJsonReport, buildJsonReportError, clearCaches, diagnose, filterSourceFiles, getDiffInfo, isProjectDiscoveryError, isReactDoctorError, summarizeDiagnostics, toJsonReport };
|
|
8621
8735
|
|
|
8622
8736
|
//# sourceMappingURL=index.js.map
|
|
8623
|
-
//# debugId=
|
|
8737
|
+
//# debugId=4bb0de05-d610-5389-a78b-f54547ccdc56
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "react-doctor",
|
|
3
|
-
"version": "0.2.15-dev.
|
|
3
|
+
"version": "0.2.15-dev.bf4c21e",
|
|
4
4
|
"description": "Diagnose and fix React codebases for security, performance, correctness, accessibility, bundle-size, and architecture issues",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"accessibility",
|
|
@@ -63,7 +63,7 @@
|
|
|
63
63
|
"oxlint": "^1.66.0",
|
|
64
64
|
"prompts": "^2.4.2",
|
|
65
65
|
"typescript": ">=5.0.4 <7",
|
|
66
|
-
"oxlint-plugin-react-doctor": "0.2.15-dev.
|
|
66
|
+
"oxlint-plugin-react-doctor": "0.2.15-dev.bf4c21e"
|
|
67
67
|
},
|
|
68
68
|
"devDependencies": {
|
|
69
69
|
"@types/babel__code-frame": "^7.27.0",
|
|
@@ -71,8 +71,8 @@
|
|
|
71
71
|
"@xterm/headless": "^6.0.0",
|
|
72
72
|
"commander": "^14.0.3",
|
|
73
73
|
"ora": "^9.4.0",
|
|
74
|
-
"@react-doctor/
|
|
75
|
-
"@react-doctor/
|
|
74
|
+
"@react-doctor/core": "0.2.15",
|
|
75
|
+
"@react-doctor/api": "0.2.15"
|
|
76
76
|
},
|
|
77
77
|
"engines": {
|
|
78
78
|
"node": "^20.19.0 || >=22.12.0"
|