react-doctor 0.2.16-dev.ec5d58c → 0.2.17-dev.5614b32
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/dist/cli.js +34 -18
- package/dist/index.js +2 -2
- package/package.json +4 -4
package/dist/cli.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
|
|
2
|
-
!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="
|
|
2
|
+
!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="f83fc141-ff41-5c96-8a8e-f4ea0399b0f2")}catch(e){}}();
|
|
3
3
|
import { createRequire } from "node:module";
|
|
4
4
|
import { execFileSync, spawn, spawnSync } from "node:child_process";
|
|
5
5
|
import * as Path from "node:path";
|
|
@@ -6299,7 +6299,7 @@ const MILLISECONDS_PER_SECOND = 1e3;
|
|
|
6299
6299
|
const SCORE_API_URL = "https://www.react.doctor/api/score";
|
|
6300
6300
|
const ENTERPRISE_CONTACT_URL = "https://react.doctor/enterprise";
|
|
6301
6301
|
const SHARE_BASE_URL = "https://react.doctor/share";
|
|
6302
|
-
const DOCS_URL = "https://
|
|
6302
|
+
const DOCS_URL = "https://react.doctor/docs";
|
|
6303
6303
|
const DOCS_RULES_BASE_URL = `${DOCS_URL}/rules`;
|
|
6304
6304
|
const FETCH_TIMEOUT_MS = 1e4;
|
|
6305
6305
|
const GITHUB_VIEWER_PERMISSION_TIMEOUT_MS = 2e3;
|
|
@@ -11759,7 +11759,7 @@ const filterSourceFiles = (filePaths) => filePaths.filter(isLintableSourceFile);
|
|
|
11759
11759
|
/**
|
|
11760
11760
|
* Canonical URL for a rule's documentation page — its reviewer-tested fix
|
|
11761
11761
|
* recipe rendered for humans — served at
|
|
11762
|
-
* `https://
|
|
11762
|
+
* `https://react.doctor/docs/rules/<plugin>/<rule>`. The CLI links here
|
|
11763
11763
|
* from its fix-recipe directive so each fix follows the canonical recipe
|
|
11764
11764
|
* instead of being improvised per diagnostic.
|
|
11765
11765
|
*/
|
|
@@ -11876,6 +11876,7 @@ const isNonInteractiveEnvironment = () => NON_INTERACTIVE_ENVIRONMENT_VARIABLES.
|
|
|
11876
11876
|
const STAGED_FILES_TEMP_DIR_PREFIX = "react-doctor-staged-";
|
|
11877
11877
|
const WELCOME_EXPLANATION_HOLD_MS = 2e3;
|
|
11878
11878
|
const WELCOME_HOLD_MS = 1e3;
|
|
11879
|
+
const CATEGORY_COUNTUP_SETTLE_HOLD_MS = 1e3;
|
|
11879
11880
|
const INTERNAL_ERROR_JSON_FALLBACK = "{\"schemaVersion\":1,\"ok\":false,\"error\":{\"message\":\"Internal error\",\"name\":\"Error\",\"chain\":[]}}\n";
|
|
11880
11881
|
const SENTRY_FLUSH_TIMEOUT_MS = 2e3;
|
|
11881
11882
|
const NANOSECONDS_PER_SECOND = 1000000000n;
|
|
@@ -11947,7 +11948,7 @@ const makeNoopConsole = () => ({
|
|
|
11947
11948
|
});
|
|
11948
11949
|
//#endregion
|
|
11949
11950
|
//#region src/cli/utils/version.ts
|
|
11950
|
-
const VERSION = "0.2.
|
|
11951
|
+
const VERSION = "0.2.17-dev.5614b32";
|
|
11951
11952
|
//#endregion
|
|
11952
11953
|
//#region src/cli/utils/json-mode.ts
|
|
11953
11954
|
let context = null;
|
|
@@ -12293,13 +12294,13 @@ const isDevVersion = (version) => version === "0.0.0" || version.includes("-");
|
|
|
12293
12294
|
* uploads source-map artifacts under, so stack frames symbolicate. Honors the
|
|
12294
12295
|
* standard `SENTRY_RELEASE` override.
|
|
12295
12296
|
*/
|
|
12296
|
-
const resolveSentryRelease = () => process.env.SENTRY_RELEASE || `react-doctor@0.2.
|
|
12297
|
+
const resolveSentryRelease = () => process.env.SENTRY_RELEASE || `react-doctor@0.2.17-dev.5614b32`;
|
|
12297
12298
|
/**
|
|
12298
12299
|
* Deployment environment shown in Sentry's environment filter. Defaults to
|
|
12299
12300
|
* `production` for tagged releases and `development` for dev/unbuilt versions,
|
|
12300
12301
|
* overridable via the standard `SENTRY_ENVIRONMENT` env var.
|
|
12301
12302
|
*/
|
|
12302
|
-
const resolveSentryEnvironment = () => process.env.SENTRY_ENVIRONMENT || (isDevVersion("0.2.
|
|
12303
|
+
const resolveSentryEnvironment = () => process.env.SENTRY_ENVIRONMENT || (isDevVersion("0.2.17-dev.5614b32") ? "development" : "production");
|
|
12303
12304
|
/**
|
|
12304
12305
|
* Performance-tracing sample rate in `[0, 1]`. Reads `SENTRY_TRACES_SAMPLE_RATE`
|
|
12305
12306
|
* (set to `0` to disable tracing) and falls back to
|
|
@@ -15882,9 +15883,6 @@ const buildCodeFrame = (input) => {
|
|
|
15882
15883
|
//#region src/cli/utils/build-section-divider.ts
|
|
15883
15884
|
const buildSectionDivider = () => highlighter.dim(` ${"─".repeat(60)}`);
|
|
15884
15885
|
//#endregion
|
|
15885
|
-
//#region src/cli/utils/ease-out-cubic.ts
|
|
15886
|
-
const easeOutCubic = (progress) => 1 - (1 - progress) ** 3;
|
|
15887
|
-
//#endregion
|
|
15888
15886
|
//#region src/cli/utils/indent-multiline-text.ts
|
|
15889
15887
|
const indentMultilineText = (text, linePrefix) => text.split("\n").map((lineText) => `${linePrefix}${lineText}`).join("\n");
|
|
15890
15888
|
//#endregion
|
|
@@ -15974,13 +15972,26 @@ const buildCategoryTally = (categoryGroup) => ({
|
|
|
15974
15972
|
warningCount: categoryGroup.diagnostics.filter((diagnostic) => diagnostic.severity === "warning").length
|
|
15975
15973
|
});
|
|
15976
15974
|
const buildCategoryTallyLines = (tallies) => tallies.map((tally) => formatCategoryTallyLine(tally, tally.errorCount, tally.warningCount));
|
|
15975
|
+
const buildPartiallyRevealedTallyLines = (tallies, revealedUnitCount) => {
|
|
15976
|
+
let remainingToReveal = revealedUnitCount;
|
|
15977
|
+
return tallies.map((tally) => {
|
|
15978
|
+
const errorShown = Math.min(tally.errorCount, remainingToReveal);
|
|
15979
|
+
remainingToReveal -= errorShown;
|
|
15980
|
+
const warningShown = Math.min(tally.warningCount, remainingToReveal);
|
|
15981
|
+
remainingToReveal -= warningShown;
|
|
15982
|
+
return formatCategoryTallyLine(tally, errorShown, warningShown);
|
|
15983
|
+
});
|
|
15984
|
+
};
|
|
15977
15985
|
const printCategoryCountUp = (tallies) => Effect.gen(function* () {
|
|
15978
|
-
|
|
15979
|
-
|
|
15980
|
-
|
|
15981
|
-
|
|
15982
|
-
|
|
15983
|
-
|
|
15986
|
+
const totalUnitCount = tallies.reduce((sum, tally) => sum + tally.errorCount + tally.warningCount, 0);
|
|
15987
|
+
const unitsPerStep = Math.max(1, Math.ceil(totalUnitCount / 24));
|
|
15988
|
+
for (let revealedUnitCount = 0; revealedUnitCount < totalUnitCount; revealedUnitCount += unitsPerStep) {
|
|
15989
|
+
const lines = buildPartiallyRevealedTallyLines(tallies, revealedUnitCount);
|
|
15990
|
+
yield* writeStdout(`${revealedUnitCount === 0 ? "" : `\x1b[${tallies.length}A`}\r${lines.join("\n\r")}\n`);
|
|
15991
|
+
yield* Effect.sleep(70);
|
|
15992
|
+
}
|
|
15993
|
+
yield* writeStdout(`${totalUnitCount === 0 ? "" : `\x1b[${tallies.length}A`}\r${buildCategoryTallyLines(tallies).join("\n\r")}\n`);
|
|
15994
|
+
yield* Effect.sleep(CATEGORY_COUNTUP_SETTLE_HOLD_MS);
|
|
15984
15995
|
});
|
|
15985
15996
|
const TOP_ERROR_DETAIL_INDENT = " ";
|
|
15986
15997
|
const pickRepresentativeDiagnostic = (ruleDiagnostics) => ruleDiagnostics.find((diagnostic) => diagnostic.line > 0) ?? ruleDiagnostics[0];
|
|
@@ -16246,6 +16257,9 @@ const colorizeByScore = (text, score) => {
|
|
|
16246
16257
|
return highlighter.error(text);
|
|
16247
16258
|
};
|
|
16248
16259
|
//#endregion
|
|
16260
|
+
//#region src/cli/utils/ease-out-cubic.ts
|
|
16261
|
+
const easeOutCubic = (progress) => 1 - (1 - progress) ** 3;
|
|
16262
|
+
//#endregion
|
|
16249
16263
|
//#region src/cli/utils/render-score-header.ts
|
|
16250
16264
|
const RAINBOW_HUE_SHIFT_PER_FRAME = 9;
|
|
16251
16265
|
const RAINBOW_GRADIENT_WIDTH = 80;
|
|
@@ -18608,6 +18622,7 @@ const findLowestScoredScan = (completedScans) => {
|
|
|
18608
18622
|
};
|
|
18609
18623
|
const printMultiProjectSummary = (input) => Effect.gen(function* () {
|
|
18610
18624
|
const { completedScans, userConfig, verbose, isOffline, projectName } = input;
|
|
18625
|
+
const animateRender = !verbose && canAnimateOnboarding(process.stdout);
|
|
18611
18626
|
const surfaceDiagnostics = filterDiagnosticsForSurface(completedScans.flatMap((scan) => scan.result.diagnostics), "cli", userConfig);
|
|
18612
18627
|
const projectRootByDiagnostic = /* @__PURE__ */ new WeakMap();
|
|
18613
18628
|
for (const scan of completedScans) for (const diagnostic of scan.result.diagnostics) projectRootByDiagnostic.set(diagnostic, scan.result.project.rootDirectory);
|
|
@@ -18624,7 +18639,7 @@ const printMultiProjectSummary = (input) => Effect.gen(function* () {
|
|
|
18624
18639
|
yield* Console.log(`${highlighter.success("✔")} Scanned ${totalScannedFileCount} ${totalScannedFileCount === 1 ? "file" : "files"} in ${formatElapsedTime(totalScanElapsedMilliseconds)}`);
|
|
18625
18640
|
if (surfaceDiagnostics.length > 0) {
|
|
18626
18641
|
yield* Console.log("");
|
|
18627
|
-
yield* printDiagnostics(surfaceDiagnostics, verbose, resolveDiagnosticSourceRoot, buildRulePriorityMap(completedScans.map((scan) => scan.result.score)), isCodingAgentEnvironment());
|
|
18642
|
+
yield* printDiagnostics(surfaceDiagnostics, verbose, resolveDiagnosticSourceRoot, buildRulePriorityMap(completedScans.map((scan) => scan.result.score)), isCodingAgentEnvironment(), { animateCountUp: animateRender });
|
|
18628
18643
|
}
|
|
18629
18644
|
const lowestScoredScan = findLowestScoredScan(completedScans);
|
|
18630
18645
|
const aggregateScore = lowestScoredScan?.result.score ?? null;
|
|
@@ -18636,7 +18651,8 @@ const printMultiProjectSummary = (input) => Effect.gen(function* () {
|
|
|
18636
18651
|
potentialScore: lowestScoredScan ? yield* Effect.promise(() => computeProjectedScore(surfaceDiagnostics, lowestScoredScan.result.diagnostics, lowestScoredScan.result.score)) : null,
|
|
18637
18652
|
totalSourceFileCount,
|
|
18638
18653
|
noScoreMessage: "Score unavailable.",
|
|
18639
|
-
verbose
|
|
18654
|
+
verbose,
|
|
18655
|
+
animateProjection: animateRender
|
|
18640
18656
|
});
|
|
18641
18657
|
const entries = completedScans.map((scan) => {
|
|
18642
18658
|
const errorCount = scan.result.diagnostics.filter((diagnostic) => diagnostic.severity === "error").length;
|
|
@@ -20161,4 +20177,4 @@ program.parseAsync(argv).then(() => flushSentry()).catch(async (error) => {
|
|
|
20161
20177
|
export {};
|
|
20162
20178
|
|
|
20163
20179
|
//# sourceMappingURL=cli.js.map
|
|
20164
|
-
//# debugId=
|
|
20180
|
+
//# debugId=f83fc141-ff41-5c96-8a8e-f4ea0399b0f2
|
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]="de59ec3d-8219-56e6-b16a-5aed5d046e99")}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";
|
|
@@ -8742,4 +8742,4 @@ const toJsonReport = (result, options) => buildJsonReport({
|
|
|
8742
8742
|
export { AmbiguousProjectError, NoReactDependencyError, NotADirectoryError, PackageJsonNotFoundError, ProjectNotFoundError, ReactDoctorError, buildJsonReport, buildJsonReportError, clearCaches, diagnose, filterSourceFiles, getDiffInfo, isProjectDiscoveryError, isReactDoctorError, summarizeDiagnostics, toJsonReport };
|
|
8743
8743
|
|
|
8744
8744
|
//# sourceMappingURL=index.js.map
|
|
8745
|
-
//# debugId=
|
|
8745
|
+
//# debugId=de59ec3d-8219-56e6-b16a-5aed5d046e99
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "react-doctor",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.17-dev.5614b32",
|
|
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.
|
|
66
|
+
"oxlint-plugin-react-doctor": "0.2.17-dev.5614b32"
|
|
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/api": "0.2.
|
|
75
|
-
"@react-doctor/core": "0.2.
|
|
74
|
+
"@react-doctor/api": "0.2.17",
|
|
75
|
+
"@react-doctor/core": "0.2.17"
|
|
76
76
|
},
|
|
77
77
|
"engines": {
|
|
78
78
|
"node": "^20.19.0 || >=22.12.0"
|