react-doctor 0.9.6 → 0.9.7-dev.f27fd5d

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.
@@ -1,7 +1,13 @@
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]="b6b21d8e-ff51-5d69-94f0-aa652f9def50")}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]="9a37b35f-e3b2-56a0-97a0-d925c7e914bb")}catch(e){}}();
3
3
  import { n as __require, r as __toESM, t as __commonJSMin } from "./chunk-q7NCDQ7-.js";
4
- import { $ as filterDiagnosticsByCategories, $n as GITHUB_ACTIONS_SETUP_URL, B as buildHandoffPayload, C as isGatePending, Cr as highlighter, Dt as recordDistribution, Et as recordCount, F as CLI_AGENT_BINARIES, Gr as sync, Gt as chalk, H as collectProjectSourceFileCounts, Ht as isWide$1, I as copyToClipboard, J as formatElapsedTime, Jr as succeed, Kr as void_, L as launchCliAgent, Ln as TUI_REPORT_COMPACT_MAX_ROWS, M as ONBOARDING_EVENT, Mn as METRIC, Mt as toForwardSlashes, Nr as remainingDeadlineBudgetMs, P as detectLaunchableAgents, Pr as resolveScanTarget, Pt as findNearestPackageDirectory, Q as formatDiagnosticSite, Qn as DIAGNOSTIC_CATEGORY_BUCKETS, Rn as TUI_REPORT_DETAIL_WIDTH_FRACTION, Rr as yieldToEventLoop, S as openUrl, T as recordGate, Tr as isPathInsideDirectory, U as deduplicateProjectScans, Un as isCiEnvironment, Ur as runPromise, Ut as stripAnsi, V as formatSkippedProjectsMessage, Vn as isGitHookEnvironment, Vt as isFullWidth$1, W as createInvocationInspect, Wt as isUnicodeSupported, Y as printFooter, Z as printDiagnosticsDump, _ as resolveCliInspectOptions, _n as cliLogger, _r as getCategoryImpact, _t as resolveBlockingLevel, a as shouldFailScanGate, at as buildRulePriorityMap, b as setUpGitHubActions, c as selectProjects, cr as buildRuleDocsUrl, ct as formatLearnMoreLine, d as resolveProjectChangedLineRanges, et as buildEmptyReportMessage, f as resolveProjectDiffIncludePaths, ft as finalizeScope, g as resolveWorkspaceDeadCodeOwner, gr as getBaselineDiffPlan, h as retryMissingProjectScores, it as hasLintHardFailure, jn as CI_TRUST_COMPANIES, jr as mapWithConcurrency, l as buildCodeFrame, lr as calculateScore, mt as resolveScope, n as registerActiveTuiRenderer, nr as Progress, nt as buildNoScoreMessage, o as projectManifestChanged, ot as buildSortedRuleGroups, p as resolveProjectSourceFilePaths, q as pluralize, r as validateIncludeUntrackedScope, rr as Reporter, rt as resolveMergeBaseRef, s as discoverWorkspacePackages, st as formatFixRecipeLine, t as exitGracefully, tt as hasIncompleteScoreAnalysis, u as resolveProjectScan, v as filterScansForSurface, vr as getChangedLineRanges, xr as hasPublishedFixRecipe, xt as isReactDoctorWorkflowInstalled, y as countUniqueScannedFiles, yr as getDiffInfo } from "./exit-gracefully-DcDvSbzg.js";
4
+ import { Et as buildRuleDocsUrl, F as isGitHookEnvironment, Gt as getCategoryImpact, Jn as runPromise, Jt as getDiffInfo, Kt as getChangedLineRanges, M as TUI_REPORT_DETAIL_WIDTH_FRACTION, Ot as calculateScore, Pn as yieldToEventLoop, Qn as void_, Tn as resolveScanTarget, Wt as getBaselineDiffPlan, Xn as sync, Y as DIAGNOSTIC_CATEGORY_BUCKETS, Zt as hasPublishedFixRecipe, _ as CI_TRUST_COMPANIES, an as isPathInsideDirectory, bn as remainingDeadlineBudgetMs, en as highlighter, et as GITHUB_ACTIONS_SETUP_URL, gt as Reporter, hn as mapWithConcurrency, j as TUI_REPORT_COMPACT_MAX_ROWS, mt as Progress, n as recordDistribution, nr as succeed, t as recordCount, y as METRIC, z as isCiEnvironment } from "./record-metric-BseP74fk.js";
5
+ import { n as registerActiveTuiRenderer, t as exitGracefully } from "./exit-gracefully-BtEG5JVC.js";
6
+ import { L as cliLogger, d as stripAnsi, f as isUnicodeSupported, l as isFullWidth$1, n as findNearestPackageDirectory, p as chalk, u as isWide$1 } from "./install-doctor-script-CoPE8MvO.js";
7
+ import { i as isReactDoctorWorkflowInstalled } from "./install-github-workflow-S8vkQtho.js";
8
+ import { r as resolveScope, s as resolveBlockingLevel, t as finalizeScope, u as toForwardSlashes } from "./resolve-scope-DeQeaQa9.js";
9
+ import { A as resolveMergeBaseRef, B as buildEmptyReportMessage, C as copyToClipboard, D as deduplicateProjectScans, E as collectProjectSourceFileCounts, F as printDiagnosticsDump, G as formatLearnMoreLine, H as buildRulePriorityMap, I as formatDiagnosticSite, L as hasIncompleteScoreAnalysis, M as pluralize, N as formatElapsedTime, O as createInvocationInspect, P as printFooter, R as filterDiagnosticsByCategories, S as CLI_AGENT_BINARIES, T as buildHandoffPayload, U as buildSortedRuleGroups, V as hasLintHardFailure, W as formatFixRecipeLine, _ as resolveCliInspectOptions, a as projectManifestChanged, b as setUpGitHubActions, c as selectProjects, d as resolveProjectChangedLineRanges, f as resolveProjectDiffIncludePaths, g as resolveWorkspaceDeadCodeOwner, h as retryMissingProjectScores, l as buildCodeFrame, n as formatSkippedProjectsMessage, o as partitionProjectScanOutcomes, p as resolveProjectSourceFilePaths, r as validateIncludeUntrackedScope, s as discoverWorkspacePackages, t as shouldFailScanGate, u as resolveProjectScan, v as filterScansForSurface, w as launchCliAgent, x as detectLaunchableAgents, y as countUniqueScannedFiles, z as buildNoScoreMessage } from "./should-fail-scan-gate-Di3zg4jS.js";
10
+ import { a as recordGate, f as ONBOARDING_EVENT, n as openUrl, r as isGatePending } from "./report-workflow-result-RjTlaDuS.js";
5
11
  import { EventEmitter } from "node:events";
6
12
  import { execFileSync } from "node:child_process";
7
13
  import path from "node:path";
@@ -20442,7 +20448,7 @@ if (process$1.env["DEV"] === "true") {
20442
20448
  import.meta.resolve("react-devtools-core");
20443
20449
  isDevtoolsInstalled = true;
20444
20450
  } catch {}
20445
- if (isDevtoolsInstalled) await import("./devtools-BQATi33M.js");
20451
+ if (isDevtoolsInstalled) await import("./devtools-DPRVRu3S.js");
20446
20452
  }
20447
20453
  const diff = (before, after) => {
20448
20454
  if (before === after) return;
@@ -27720,7 +27726,7 @@ const ScanApp = ({ store, displayMode = "report", launchableAgents, onHandoff, c
27720
27726
  onQuit?.();
27721
27727
  exit();
27722
27728
  };
27723
- if (displayMode === "report" && snapshot.phase === "summary" && snapshot.summary) return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Summary, {
27729
+ if (displayMode === "report" && snapshot.phase === "summary") return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Summary, {
27724
27730
  summary: snapshot.summary,
27725
27731
  launchableAgents,
27726
27732
  onHandoff,
@@ -27729,7 +27735,7 @@ const ScanApp = ({ store, displayMode = "report", launchableAgents, onHandoff, c
27729
27735
  onExit: exit,
27730
27736
  onQuit: handleQuit
27731
27737
  });
27732
- if (displayMode === "report" && snapshot.phase === "report" && snapshot.report) return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Report, {
27738
+ if (displayMode === "report" && snapshot.phase === "report") return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Report, {
27733
27739
  report: snapshot.report,
27734
27740
  launchableAgents,
27735
27741
  onHandoff,
@@ -27765,9 +27771,7 @@ const progressLayerForStore = (store, options = {}) => Progress.layerOra(progres
27765
27771
  const INITIAL_SNAPSHOT = {
27766
27772
  phase: "scanning",
27767
27773
  liveDiagnostics: [],
27768
- progress: null,
27769
- report: null,
27770
- summary: null
27774
+ progress: null
27771
27775
  };
27772
27776
  const createScanStore = () => {
27773
27777
  let snapshot = INITIAL_SNAPSHOT;
@@ -27776,7 +27780,7 @@ const createScanStore = () => {
27776
27780
  let progressTimer = null;
27777
27781
  const commit = (next) => {
27778
27782
  snapshot = next;
27779
- for (const listener of listeners) listener();
27783
+ for (const listener of [...listeners]) listener();
27780
27784
  };
27781
27785
  const cancelPendingProgress = () => {
27782
27786
  pendingProgress = null;
@@ -27821,17 +27825,19 @@ const createScanStore = () => {
27821
27825
  setReport: (report) => {
27822
27826
  cancelPendingProgress();
27823
27827
  commit({
27824
- ...snapshot,
27825
- report,
27826
- phase: "report"
27828
+ phase: "report",
27829
+ liveDiagnostics: snapshot.liveDiagnostics,
27830
+ progress: snapshot.progress,
27831
+ report
27827
27832
  });
27828
27833
  },
27829
27834
  setSummary: (summary) => {
27830
27835
  cancelPendingProgress();
27831
27836
  commit({
27832
- ...snapshot,
27833
- summary,
27834
- phase: "summary"
27837
+ phase: "summary",
27838
+ liveDiagnostics: snapshot.liveDiagnostics,
27839
+ progress: snapshot.progress,
27840
+ summary
27835
27841
  });
27836
27842
  }
27837
27843
  };
@@ -28158,14 +28164,16 @@ const runMultiProjectScan = async (rootScanTarget, directories, input, scopePlan
28158
28164
  context.store.setProgress(`Scanning ${projectCount} projects…`);
28159
28165
  await yieldToEventLoop();
28160
28166
  const precomputedSourceFileCounts = scopePlan.scope === "full" ? await collectProjectSourceFileCounts(rootDirectory, projectScans.map(({ projectScan }) => projectScan.directory)) : null;
28161
- const scanOutcomes = await mapWithConcurrency(projectScans, 4, async ({ projectScan, scopeOptions }) => {
28167
+ const { completedScans, skippedScans } = partitionProjectScanOutcomes(await mapWithConcurrency(projectScans, 4, async ({ projectScan, scopeOptions }) => {
28162
28168
  if (input.options?.deadlineEpochMs !== void 0 && remainingDeadlineBudgetMs(input.options.deadlineEpochMs) === 0) {
28163
28169
  finishedCount += 1;
28164
28170
  context.store.setProgress(`Scanning ${projectCount} projects… (${finishedCount}/${projectCount})`);
28165
28171
  return {
28166
28172
  status: "skipped",
28167
- directory: projectScan.directory,
28168
- reason: "max-duration"
28173
+ value: {
28174
+ directory: projectScan.directory,
28175
+ reason: "max-duration"
28176
+ }
28169
28177
  };
28170
28178
  }
28171
28179
  const projectLabel = path.relative(rootDirectory, projectScan.directory) || path.basename(rootDirectory);
@@ -28196,19 +28204,18 @@ const runMultiProjectScan = async (rootScanTarget, directories, input, scopePlan
28196
28204
  await yieldToEventLoop();
28197
28205
  return {
28198
28206
  status: "completed",
28199
- directory: projectScan.directory,
28200
- result,
28201
- config: projectScan.config
28207
+ value: {
28208
+ directory: projectScan.directory,
28209
+ result,
28210
+ config: projectScan.config
28211
+ }
28202
28212
  };
28203
- });
28204
- const results = await retryMissingProjectScores(scanOutcomes.filter((scanOutcome) => scanOutcome.status === "completed").map((completedScan) => ({
28213
+ }));
28214
+ const results = await retryMissingProjectScores(completedScans.map((completedScan) => ({
28205
28215
  ...completedScan,
28206
28216
  isScoreDisabled: input.options?.noScore ?? completedScan.config?.noScore ?? false
28207
28217
  })));
28208
- const skippedProjects = scanOutcomes.filter((scanOutcome) => scanOutcome.status === "skipped").map(({ directory, reason }) => ({
28209
- directory,
28210
- reason
28211
- })).sort((left, right) => left.directory.localeCompare(right.directory));
28218
+ const skippedProjects = skippedScans.sort((left, right) => left.directory.localeCompare(right.directory));
28212
28219
  if (skippedProjects.length > 0) recordCount(METRIC.scanProjectSkipped, skippedProjects.length, { reason: "max-duration" });
28213
28220
  const projectEntries = results.map(({ directory, result, config }) => {
28214
28221
  const reportSelection = selectReportDiagnostics({
@@ -28307,5 +28314,5 @@ const runScanApp = async (input) => {
28307
28314
  //#endregion
28308
28315
  export { runScanApp };
28309
28316
 
28310
- //# sourceMappingURL=run-scan-app-CeiP4spo.js.map
28311
- //# debugId=b6b21d8e-ff51-5d69-94f0-aa652f9def50
28317
+ //# sourceMappingURL=run-scan-app-DhH3Uvaz.js.map
28318
+ //# debugId=9a37b35f-e3b2-56a0-97a0-d925c7e914bb
@@ -0,0 +1,53 @@
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]="8ac612e5-dd5d-5fa2-ac83-8920542c8498")}catch(e){}}();
3
+ import { P as isNonInteractiveEnvironment, Tn as resolveScanTarget, t as recordCount, y as METRIC } from "./record-metric-BseP74fk.js";
4
+ import { i as warnDeprecatedDiff } from "./resolve-scope-DeQeaQa9.js";
5
+ import { _ as resolveCliInspectOptions, i as validateModeFlags } from "./should-fail-scan-gate-Di3zg4jS.js";
6
+ import { n as warnDeprecatedFailOn, r as runProjectMigrations, t as inspectAction } from "./inspect-D6s9mWr_.js";
7
+ import path from "node:path";
8
+ //#region src/cli/utils/should-use-tui.ts
9
+ const shouldUseTui = (input) => {
10
+ if (input.isNonInteractiveEnvironment || !input.stdinIsTty || !input.stdoutIsTty || !input.supportsRawMode || input.nodeMajorVersion < 22 || input.terminalName === "dumb") return false;
11
+ const flags = input.flags;
12
+ return !(flags.score === true || flags.json === true || flags.jsonCompact === true || flags.jsonOut !== void 0 || flags.staged === true || flags.changedFilesFrom !== void 0);
13
+ };
14
+ //#endregion
15
+ //#region src/cli/commands/scan.ts
16
+ const runScanCommand = async (input) => {
17
+ if (input.flags.cache === false) process.env.REACT_DOCTOR_NO_CACHE = "1";
18
+ const nodeMajorVersion = Number(process.versions.node.split(".")[0]);
19
+ if (!shouldUseTui({
20
+ flags: input.flags,
21
+ isNonInteractiveEnvironment: isNonInteractiveEnvironment(),
22
+ nodeMajorVersion,
23
+ stdinIsTty: process.stdin.isTTY === true,
24
+ stdoutIsTty: process.stdout.isTTY === true,
25
+ supportsRawMode: typeof process.stdin.setRawMode === "function",
26
+ terminalName: process.env.TERM
27
+ })) {
28
+ await inspectAction(input.directory, input.flags, input.invocationCommand);
29
+ return;
30
+ }
31
+ await runProjectMigrations(path.resolve(input.directory));
32
+ const scanTarget = await resolveScanTarget(input.directory, { allowAmbiguous: true });
33
+ validateModeFlags(input.flags);
34
+ warnDeprecatedFailOn(input.flags, scanTarget.userConfig);
35
+ warnDeprecatedDiff(input.flags, scanTarget.userConfig);
36
+ recordCount(METRIC.cliInvoked, 1, { command: input.invocationCommand });
37
+ const { runScanApp } = await import("./run-scan-app-DhH3Uvaz.js");
38
+ const { shouldFail } = await runScanApp({
39
+ directory: input.directory,
40
+ scanTarget,
41
+ options: resolveCliInspectOptions(input.flags, null),
42
+ projectFlag: input.flags.project,
43
+ skipPrompts: input.flags.yes ?? false,
44
+ blocking: input.flags.blocking ?? input.flags.failOn,
45
+ flags: input.flags
46
+ });
47
+ if (shouldFail) process.exitCode = 1;
48
+ };
49
+ //#endregion
50
+ export { runScanCommand };
51
+
52
+ //# sourceMappingURL=scan-DJhL4P2g.js.map
53
+ //# debugId=8ac612e5-dd5d-5fa2-ac83-8920542c8498