react-doctor 0.2.16-dev.b336f54 → 0.2.16-dev.ec5d58c
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 +18 -34
- package/dist/index.js +2 -2
- package/package.json +2 -2
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]="83b0602f-f294-5164-861f-82491ff58bf0")}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://react.doctor/docs";
|
|
6302
|
+
const DOCS_URL = "https://www.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://react.doctor/docs/rules/<plugin>/<rule>`. The CLI links here
|
|
11762
|
+
* `https://www.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,7 +11876,6 @@ 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;
|
|
11880
11879
|
const INTERNAL_ERROR_JSON_FALLBACK = "{\"schemaVersion\":1,\"ok\":false,\"error\":{\"message\":\"Internal error\",\"name\":\"Error\",\"chain\":[]}}\n";
|
|
11881
11880
|
const SENTRY_FLUSH_TIMEOUT_MS = 2e3;
|
|
11882
11881
|
const NANOSECONDS_PER_SECOND = 1000000000n;
|
|
@@ -11948,7 +11947,7 @@ const makeNoopConsole = () => ({
|
|
|
11948
11947
|
});
|
|
11949
11948
|
//#endregion
|
|
11950
11949
|
//#region src/cli/utils/version.ts
|
|
11951
|
-
const VERSION = "0.2.16-dev.
|
|
11950
|
+
const VERSION = "0.2.16-dev.ec5d58c";
|
|
11952
11951
|
//#endregion
|
|
11953
11952
|
//#region src/cli/utils/json-mode.ts
|
|
11954
11953
|
let context = null;
|
|
@@ -12294,13 +12293,13 @@ const isDevVersion = (version) => version === "0.0.0" || version.includes("-");
|
|
|
12294
12293
|
* uploads source-map artifacts under, so stack frames symbolicate. Honors the
|
|
12295
12294
|
* standard `SENTRY_RELEASE` override.
|
|
12296
12295
|
*/
|
|
12297
|
-
const resolveSentryRelease = () => process.env.SENTRY_RELEASE || `react-doctor@0.2.16-dev.
|
|
12296
|
+
const resolveSentryRelease = () => process.env.SENTRY_RELEASE || `react-doctor@0.2.16-dev.ec5d58c`;
|
|
12298
12297
|
/**
|
|
12299
12298
|
* Deployment environment shown in Sentry's environment filter. Defaults to
|
|
12300
12299
|
* `production` for tagged releases and `development` for dev/unbuilt versions,
|
|
12301
12300
|
* overridable via the standard `SENTRY_ENVIRONMENT` env var.
|
|
12302
12301
|
*/
|
|
12303
|
-
const resolveSentryEnvironment = () => process.env.SENTRY_ENVIRONMENT || (isDevVersion("0.2.16-dev.
|
|
12302
|
+
const resolveSentryEnvironment = () => process.env.SENTRY_ENVIRONMENT || (isDevVersion("0.2.16-dev.ec5d58c") ? "development" : "production");
|
|
12304
12303
|
/**
|
|
12305
12304
|
* Performance-tracing sample rate in `[0, 1]`. Reads `SENTRY_TRACES_SAMPLE_RATE`
|
|
12306
12305
|
* (set to `0` to disable tracing) and falls back to
|
|
@@ -15883,6 +15882,9 @@ const buildCodeFrame = (input) => {
|
|
|
15883
15882
|
//#region src/cli/utils/build-section-divider.ts
|
|
15884
15883
|
const buildSectionDivider = () => highlighter.dim(` ${"─".repeat(60)}`);
|
|
15885
15884
|
//#endregion
|
|
15885
|
+
//#region src/cli/utils/ease-out-cubic.ts
|
|
15886
|
+
const easeOutCubic = (progress) => 1 - (1 - progress) ** 3;
|
|
15887
|
+
//#endregion
|
|
15886
15888
|
//#region src/cli/utils/indent-multiline-text.ts
|
|
15887
15889
|
const indentMultilineText = (text, linePrefix) => text.split("\n").map((lineText) => `${linePrefix}${lineText}`).join("\n");
|
|
15888
15890
|
//#endregion
|
|
@@ -15972,26 +15974,13 @@ const buildCategoryTally = (categoryGroup) => ({
|
|
|
15972
15974
|
warningCount: categoryGroup.diagnostics.filter((diagnostic) => diagnostic.severity === "warning").length
|
|
15973
15975
|
});
|
|
15974
15976
|
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
|
-
};
|
|
15985
15977
|
const printCategoryCountUp = (tallies) => Effect.gen(function* () {
|
|
15986
|
-
|
|
15987
|
-
|
|
15988
|
-
|
|
15989
|
-
|
|
15990
|
-
|
|
15991
|
-
|
|
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);
|
|
15978
|
+
for (let frame = 0; frame <= 16; frame += 1) {
|
|
15979
|
+
const fraction = easeOutCubic(frame / 16);
|
|
15980
|
+
const lines = tallies.map((tally) => formatCategoryTallyLine(tally, Math.round(tally.errorCount * fraction), Math.round(tally.warningCount * fraction)));
|
|
15981
|
+
yield* writeStdout(`${frame === 0 ? "" : `\x1b[${tallies.length}A`}\r${lines.join("\n\r")}\n`);
|
|
15982
|
+
if (frame < 16) yield* Effect.sleep(45);
|
|
15983
|
+
}
|
|
15995
15984
|
});
|
|
15996
15985
|
const TOP_ERROR_DETAIL_INDENT = " ";
|
|
15997
15986
|
const pickRepresentativeDiagnostic = (ruleDiagnostics) => ruleDiagnostics.find((diagnostic) => diagnostic.line > 0) ?? ruleDiagnostics[0];
|
|
@@ -16257,9 +16246,6 @@ const colorizeByScore = (text, score) => {
|
|
|
16257
16246
|
return highlighter.error(text);
|
|
16258
16247
|
};
|
|
16259
16248
|
//#endregion
|
|
16260
|
-
//#region src/cli/utils/ease-out-cubic.ts
|
|
16261
|
-
const easeOutCubic = (progress) => 1 - (1 - progress) ** 3;
|
|
16262
|
-
//#endregion
|
|
16263
16249
|
//#region src/cli/utils/render-score-header.ts
|
|
16264
16250
|
const RAINBOW_HUE_SHIFT_PER_FRAME = 9;
|
|
16265
16251
|
const RAINBOW_GRADIENT_WIDTH = 80;
|
|
@@ -18622,7 +18608,6 @@ const findLowestScoredScan = (completedScans) => {
|
|
|
18622
18608
|
};
|
|
18623
18609
|
const printMultiProjectSummary = (input) => Effect.gen(function* () {
|
|
18624
18610
|
const { completedScans, userConfig, verbose, isOffline, projectName } = input;
|
|
18625
|
-
const animateRender = !verbose && canAnimateOnboarding(process.stdout);
|
|
18626
18611
|
const surfaceDiagnostics = filterDiagnosticsForSurface(completedScans.flatMap((scan) => scan.result.diagnostics), "cli", userConfig);
|
|
18627
18612
|
const projectRootByDiagnostic = /* @__PURE__ */ new WeakMap();
|
|
18628
18613
|
for (const scan of completedScans) for (const diagnostic of scan.result.diagnostics) projectRootByDiagnostic.set(diagnostic, scan.result.project.rootDirectory);
|
|
@@ -18639,7 +18624,7 @@ const printMultiProjectSummary = (input) => Effect.gen(function* () {
|
|
|
18639
18624
|
yield* Console.log(`${highlighter.success("✔")} Scanned ${totalScannedFileCount} ${totalScannedFileCount === 1 ? "file" : "files"} in ${formatElapsedTime(totalScanElapsedMilliseconds)}`);
|
|
18640
18625
|
if (surfaceDiagnostics.length > 0) {
|
|
18641
18626
|
yield* Console.log("");
|
|
18642
|
-
yield* printDiagnostics(surfaceDiagnostics, verbose, resolveDiagnosticSourceRoot, buildRulePriorityMap(completedScans.map((scan) => scan.result.score)), isCodingAgentEnvironment()
|
|
18627
|
+
yield* printDiagnostics(surfaceDiagnostics, verbose, resolveDiagnosticSourceRoot, buildRulePriorityMap(completedScans.map((scan) => scan.result.score)), isCodingAgentEnvironment());
|
|
18643
18628
|
}
|
|
18644
18629
|
const lowestScoredScan = findLowestScoredScan(completedScans);
|
|
18645
18630
|
const aggregateScore = lowestScoredScan?.result.score ?? null;
|
|
@@ -18651,8 +18636,7 @@ const printMultiProjectSummary = (input) => Effect.gen(function* () {
|
|
|
18651
18636
|
potentialScore: lowestScoredScan ? yield* Effect.promise(() => computeProjectedScore(surfaceDiagnostics, lowestScoredScan.result.diagnostics, lowestScoredScan.result.score)) : null,
|
|
18652
18637
|
totalSourceFileCount,
|
|
18653
18638
|
noScoreMessage: "Score unavailable.",
|
|
18654
|
-
verbose
|
|
18655
|
-
animateProjection: animateRender
|
|
18639
|
+
verbose
|
|
18656
18640
|
});
|
|
18657
18641
|
const entries = completedScans.map((scan) => {
|
|
18658
18642
|
const errorCount = scan.result.diagnostics.filter((diagnostic) => diagnostic.severity === "error").length;
|
|
@@ -20177,4 +20161,4 @@ program.parseAsync(argv).then(() => flushSentry()).catch(async (error) => {
|
|
|
20177
20161
|
export {};
|
|
20178
20162
|
|
|
20179
20163
|
//# sourceMappingURL=cli.js.map
|
|
20180
|
-
//# debugId=
|
|
20164
|
+
//# debugId=83b0602f-f294-5164-861f-82491ff58bf0
|
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]="a56b86f0-1c28-52ae-9677-12f5e67df34f")}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=a56b86f0-1c28-52ae-9677-12f5e67df34f
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "react-doctor",
|
|
3
|
-
"version": "0.2.16-dev.
|
|
3
|
+
"version": "0.2.16-dev.ec5d58c",
|
|
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.16-dev.
|
|
66
|
+
"oxlint-plugin-react-doctor": "0.2.16-dev.ec5d58c"
|
|
67
67
|
},
|
|
68
68
|
"devDependencies": {
|
|
69
69
|
"@types/babel__code-frame": "^7.27.0",
|