react-doctor 0.2.16-dev.114893e → 0.2.16-dev.b336f54

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 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]="005f503a-c838-5177-8bea-002799f23989")}catch(e){}}();
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://www.react.doctor/docs";
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://www.react.doctor/docs/rules/<plugin>/<rule>`. The CLI links here
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
  */
@@ -11851,6 +11851,9 @@ const detectCodingAgent = () => {
11851
11851
  const isCodingAgentEnvironment = () => detectCodingAgent() !== null;
11852
11852
  const isCiOrCodingAgentEnvironment = () => isCiEnvironment() || isCodingAgentEnvironment();
11853
11853
  //#endregion
11854
+ //#region src/cli/utils/is-git-hook-environment.ts
11855
+ const isGitHookEnvironment = () => Boolean(process.env.GIT_DIR);
11856
+ //#endregion
11854
11857
  //#region src/cli/utils/is-non-interactive-environment.ts
11855
11858
  const NON_INTERACTIVE_ENVIRONMENT_VARIABLES = [
11856
11859
  "CI",
@@ -11873,6 +11876,7 @@ const isNonInteractiveEnvironment = () => NON_INTERACTIVE_ENVIRONMENT_VARIABLES.
11873
11876
  const STAGED_FILES_TEMP_DIR_PREFIX = "react-doctor-staged-";
11874
11877
  const WELCOME_EXPLANATION_HOLD_MS = 2e3;
11875
11878
  const WELCOME_HOLD_MS = 1e3;
11879
+ const CATEGORY_COUNTUP_SETTLE_HOLD_MS = 1e3;
11876
11880
  const INTERNAL_ERROR_JSON_FALLBACK = "{\"schemaVersion\":1,\"ok\":false,\"error\":{\"message\":\"Internal error\",\"name\":\"Error\",\"chain\":[]}}\n";
11877
11881
  const SENTRY_FLUSH_TIMEOUT_MS = 2e3;
11878
11882
  const NANOSECONDS_PER_SECOND = 1000000000n;
@@ -11944,7 +11948,7 @@ const makeNoopConsole = () => ({
11944
11948
  });
11945
11949
  //#endregion
11946
11950
  //#region src/cli/utils/version.ts
11947
- const VERSION = "0.2.16-dev.114893e";
11951
+ const VERSION = "0.2.16-dev.b336f54";
11948
11952
  //#endregion
11949
11953
  //#region src/cli/utils/json-mode.ts
11950
11954
  let context = null;
@@ -12046,7 +12050,7 @@ const detectNodeMajor = () => {
12046
12050
  return Number.isNaN(major) ? 0 : major;
12047
12051
  };
12048
12052
  const detectOrigin = () => {
12049
- if (process.env.GIT_DIR) return "git-hook";
12053
+ if (isGitHookEnvironment()) return "git-hook";
12050
12054
  if (isCodingAgentEnvironment()) return "agent";
12051
12055
  if (isCiEnvironment()) return "ci";
12052
12056
  return "cli";
@@ -12290,13 +12294,13 @@ const isDevVersion = (version) => version === "0.0.0" || version.includes("-");
12290
12294
  * uploads source-map artifacts under, so stack frames symbolicate. Honors the
12291
12295
  * standard `SENTRY_RELEASE` override.
12292
12296
  */
12293
- const resolveSentryRelease = () => process.env.SENTRY_RELEASE || `react-doctor@0.2.16-dev.114893e`;
12297
+ const resolveSentryRelease = () => process.env.SENTRY_RELEASE || `react-doctor@0.2.16-dev.b336f54`;
12294
12298
  /**
12295
12299
  * Deployment environment shown in Sentry's environment filter. Defaults to
12296
12300
  * `production` for tagged releases and `development` for dev/unbuilt versions,
12297
12301
  * overridable via the standard `SENTRY_ENVIRONMENT` env var.
12298
12302
  */
12299
- const resolveSentryEnvironment = () => process.env.SENTRY_ENVIRONMENT || (isDevVersion("0.2.16-dev.114893e") ? "development" : "production");
12303
+ const resolveSentryEnvironment = () => process.env.SENTRY_ENVIRONMENT || (isDevVersion("0.2.16-dev.b336f54") ? "development" : "production");
12300
12304
  /**
12301
12305
  * Performance-tracing sample rate in `[0, 1]`. Reads `SENTRY_TRACES_SAMPLE_RATE`
12302
12306
  * (set to `0` to disable tracing) and falls back to
@@ -15879,9 +15883,6 @@ const buildCodeFrame = (input) => {
15879
15883
  //#region src/cli/utils/build-section-divider.ts
15880
15884
  const buildSectionDivider = () => highlighter.dim(` ${"─".repeat(60)}`);
15881
15885
  //#endregion
15882
- //#region src/cli/utils/ease-out-cubic.ts
15883
- const easeOutCubic = (progress) => 1 - (1 - progress) ** 3;
15884
- //#endregion
15885
15886
  //#region src/cli/utils/indent-multiline-text.ts
15886
15887
  const indentMultilineText = (text, linePrefix) => text.split("\n").map((lineText) => `${linePrefix}${lineText}`).join("\n");
15887
15888
  //#endregion
@@ -15971,13 +15972,26 @@ const buildCategoryTally = (categoryGroup) => ({
15971
15972
  warningCount: categoryGroup.diagnostics.filter((diagnostic) => diagnostic.severity === "warning").length
15972
15973
  });
15973
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
+ };
15974
15985
  const printCategoryCountUp = (tallies) => Effect.gen(function* () {
15975
- for (let frame = 0; frame <= 16; frame += 1) {
15976
- const fraction = easeOutCubic(frame / 16);
15977
- const lines = tallies.map((tally) => formatCategoryTallyLine(tally, Math.round(tally.errorCount * fraction), Math.round(tally.warningCount * fraction)));
15978
- yield* writeStdout(`${frame === 0 ? "" : `\x1b[${tallies.length}A`}\r${lines.join("\n\r")}\n`);
15979
- if (frame < 16) yield* Effect.sleep(45);
15980
- }
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);
15981
15995
  });
15982
15996
  const TOP_ERROR_DETAIL_INDENT = " ";
15983
15997
  const pickRepresentativeDiagnostic = (ruleDiagnostics) => ruleDiagnostics.find((diagnostic) => diagnostic.line > 0) ?? ruleDiagnostics[0];
@@ -16207,7 +16221,8 @@ const onboardingSectionPause = (shouldPace) => shouldPace ? Effect.sleep(850) :
16207
16221
  const shouldRecordOnboarding = (input) => input.paceOnboardingSections && !input.forceOnboarding && !input.verbose && !input.isNonInteractiveEnvironment;
16208
16222
  const canAnimateOnboarding = (stream = process.stdout) => {
16209
16223
  if (!(stream.isTTY === true && (stream.columns ?? 0) > 0 && process.env.TERM !== "dumb")) return false;
16210
- return isOnboardingForced() || !isCiEnvironment();
16224
+ if (isOnboardingForced()) return true;
16225
+ return !isGitHookEnvironment() && !isCiEnvironment();
16211
16226
  };
16212
16227
  //#endregion
16213
16228
  //#region src/cli/utils/onboarding-state.ts
@@ -16242,6 +16257,9 @@ const colorizeByScore = (text, score) => {
16242
16257
  return highlighter.error(text);
16243
16258
  };
16244
16259
  //#endregion
16260
+ //#region src/cli/utils/ease-out-cubic.ts
16261
+ const easeOutCubic = (progress) => 1 - (1 - progress) ** 3;
16262
+ //#endregion
16245
16263
  //#region src/cli/utils/render-score-header.ts
16246
16264
  const RAINBOW_HUE_SHIFT_PER_FRAME = 9;
16247
16265
  const RAINBOW_GRADIENT_WIDTH = 80;
@@ -18604,6 +18622,7 @@ const findLowestScoredScan = (completedScans) => {
18604
18622
  };
18605
18623
  const printMultiProjectSummary = (input) => Effect.gen(function* () {
18606
18624
  const { completedScans, userConfig, verbose, isOffline, projectName } = input;
18625
+ const animateRender = !verbose && canAnimateOnboarding(process.stdout);
18607
18626
  const surfaceDiagnostics = filterDiagnosticsForSurface(completedScans.flatMap((scan) => scan.result.diagnostics), "cli", userConfig);
18608
18627
  const projectRootByDiagnostic = /* @__PURE__ */ new WeakMap();
18609
18628
  for (const scan of completedScans) for (const diagnostic of scan.result.diagnostics) projectRootByDiagnostic.set(diagnostic, scan.result.project.rootDirectory);
@@ -18620,7 +18639,7 @@ const printMultiProjectSummary = (input) => Effect.gen(function* () {
18620
18639
  yield* Console.log(`${highlighter.success("✔")} Scanned ${totalScannedFileCount} ${totalScannedFileCount === 1 ? "file" : "files"} in ${formatElapsedTime(totalScanElapsedMilliseconds)}`);
18621
18640
  if (surfaceDiagnostics.length > 0) {
18622
18641
  yield* Console.log("");
18623
- 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 });
18624
18643
  }
18625
18644
  const lowestScoredScan = findLowestScoredScan(completedScans);
18626
18645
  const aggregateScore = lowestScoredScan?.result.score ?? null;
@@ -18632,7 +18651,8 @@ const printMultiProjectSummary = (input) => Effect.gen(function* () {
18632
18651
  potentialScore: lowestScoredScan ? yield* Effect.promise(() => computeProjectedScore(surfaceDiagnostics, lowestScoredScan.result.diagnostics, lowestScoredScan.result.score)) : null,
18633
18652
  totalSourceFileCount,
18634
18653
  noScoreMessage: "Score unavailable.",
18635
- verbose
18654
+ verbose,
18655
+ animateProjection: animateRender
18636
18656
  });
18637
18657
  const entries = completedScans.map((scan) => {
18638
18658
  const errorCount = scan.result.diagnostics.filter((diagnostic) => diagnostic.severity === "error").length;
@@ -20157,4 +20177,4 @@ program.parseAsync(argv).then(() => flushSentry()).catch(async (error) => {
20157
20177
  export {};
20158
20178
 
20159
20179
  //# sourceMappingURL=cli.js.map
20160
- //# debugId=005f503a-c838-5177-8bea-002799f23989
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]="a56b86f0-1c28-52ae-9677-12f5e67df34f")}catch(e){}}();
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=a56b86f0-1c28-52ae-9677-12f5e67df34f
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.16-dev.114893e",
3
+ "version": "0.2.16-dev.b336f54",
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.114893e"
66
+ "oxlint-plugin-react-doctor": "0.2.16-dev.b336f54"
67
67
  },
68
68
  "devDependencies": {
69
69
  "@types/babel__code-frame": "^7.27.0",