react-doctor 0.5.8-dev.5f2bd72 → 0.5.8-dev.6e67626

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/lsp.js CHANGED
@@ -6021,7 +6021,7 @@ const composePassthrough = /* @__PURE__ */ dual(2, (left, right) => (input) => {
6021
6021
  * @since 2.0.0
6022
6022
  */
6023
6023
  const Scheduler = /* @__PURE__ */ Reference("effect/Scheduler", { defaultValue: () => new MixedScheduler() });
6024
- const setImmediate = "setImmediate" in globalThis ? (f) => {
6024
+ const setImmediate$1 = "setImmediate" in globalThis ? (f) => {
6025
6025
  const timer = globalThis.setImmediate(f);
6026
6026
  return () => globalThis.clearImmediate(timer);
6027
6027
  } : (f) => {
@@ -6065,7 +6065,7 @@ var PriorityBuckets = class {
6065
6065
  var MixedScheduler = class {
6066
6066
  executionMode;
6067
6067
  setImmediate;
6068
- constructor(executionMode = "async", setImmediateFn = setImmediate) {
6068
+ constructor(executionMode = "async", setImmediateFn = setImmediate$1) {
6069
6069
  this.executionMode = executionMode;
6070
6070
  this.setImmediate = setImmediateFn;
6071
6071
  }
@@ -6090,7 +6090,7 @@ var MixedSchedulerDispatcher = class {
6090
6090
  tasks = /* @__PURE__ */ new PriorityBuckets();
6091
6091
  running = void 0;
6092
6092
  setImmediate;
6093
- constructor(setImmediateFn = setImmediate) {
6093
+ constructor(setImmediateFn = setImmediate$1) {
6094
6094
  this.setImmediate = setImmediateFn;
6095
6095
  }
6096
6096
  /**
@@ -33730,6 +33730,7 @@ const MILLISECONDS_PER_SECOND = 1e3;
33730
33730
  const SCORE_API_URL = "https://www.react.doctor/api/score";
33731
33731
  const FETCH_TIMEOUT_MS = 1e4;
33732
33732
  const GITHUB_VIEWER_PERMISSION_TIMEOUT_MS = 2e3;
33733
+ const SPAWN_ARGS_MAX_LENGTH_CHARS = 24e3;
33733
33734
  const PER_WORKER_MEM_BUDGET_BYTES = 1024 * 1024 * 1024;
33734
33735
  const DEFAULT_BRANCH_CANDIDATES = ["main", "master"];
33735
33736
  const ADOPTABLE_LINT_CONFIG_FILENAMES = [".oxlintrc.json", ".eslintrc.json"];
@@ -33810,6 +33811,7 @@ const DEAD_CODE_PHASE_TIMEOUT_MS = 15e4;
33810
33811
  const LINT_PHASE_TIMEOUT_MS = 3e5;
33811
33812
  const SCAN_TOTAL_DEADLINE_MS = 9e5;
33812
33813
  const DEAD_CODE_WORKER_MAX_OLD_SPACE_MB = 8192;
33814
+ const DEAD_CODE_WORKER_MEM_BUDGET_BYTES = 2 * 1024 * 1024 * 1024;
33813
33815
  const DEAD_CODE_TIMEOUT_CEILING_MS = 6e5;
33814
33816
  const DEAD_CODE_PHASE_TIMEOUT_OVER_WORKER_MS = 3e4;
33815
33817
  const DEAD_CODE_OVERLAP_PARSE_SHARE = .4;
@@ -35052,6 +35054,7 @@ const collectStringSet = (values) => {
35052
35054
  if (!Array.isArray(values)) return /* @__PURE__ */ new Set();
35053
35055
  return new Set(values.filter((value) => typeof value === "string"));
35054
35056
  };
35057
+ const JSX_NO_UNDEF_IDENTIFIER_PATTERN = /^`([^`]+)`/;
35055
35058
  /**
35056
35059
  * Pre-compiles every stateful filter and returns a single
35057
35060
  * `apply(diagnostic)` closure that runs (in order):
@@ -35085,11 +35088,28 @@ const buildDiagnosticPipeline = (input) => {
35085
35088
  const compiledOverrides = compileIgnoreOverrides(userConfig);
35086
35089
  const textComponentNames = collectStringSet(userConfig?.textComponents);
35087
35090
  const rawTextWrapperComponentNames = collectStringSet(userConfig?.rawTextWrapperComponents);
35091
+ const runtimeGlobalNames = collectStringSet(userConfig?.runtimeGlobals);
35088
35092
  const hasTextComponents = textComponentNames.size > 0;
35089
35093
  const hasRawTextWrappers = rawTextWrapperComponentNames.size > 0;
35094
+ const hasRuntimeGlobals = runtimeGlobalNames.size > 0;
35090
35095
  const fileLinesCache = /* @__PURE__ */ new Map();
35091
35096
  const fileContextCache = /* @__PURE__ */ new Map();
35092
35097
  const libraryFileCache = /* @__PURE__ */ new Map();
35098
+ const suppressions = /* @__PURE__ */ new Map();
35099
+ const suppress = (diagnostic, source) => {
35100
+ const { ruleKey } = getDiagnosticRuleIdentity(diagnostic);
35101
+ const suppressionKey = `${ruleKey}\u0000${source}`;
35102
+ const existing = suppressions.get(suppressionKey);
35103
+ suppressions.set(suppressionKey, existing ? {
35104
+ ...existing,
35105
+ count: existing.count + 1
35106
+ } : {
35107
+ rule: ruleKey,
35108
+ source,
35109
+ count: 1
35110
+ });
35111
+ return null;
35112
+ };
35093
35113
  const isLibraryFile = (filePath) => {
35094
35114
  let cached = libraryFileCache.get(filePath);
35095
35115
  if (cached === void 0) {
@@ -35138,50 +35158,60 @@ const buildDiagnosticPipeline = (input) => {
35138
35158
  if (hasRawTextWrappers && isInsideStringOnlyWrapper(lines, diagnostic.line, diagnostic.column, rawTextWrapperComponentNames)) return true;
35139
35159
  return false;
35140
35160
  };
35141
- return { apply: (diagnostic) => {
35142
- if (shouldAutoSuppress(diagnostic)) return null;
35143
- let current = diagnostic;
35144
- let explicitSeverityOverride;
35145
- let explicitRuleOverride;
35146
- if (severityControls) {
35147
- const { ruleKey, category } = getDiagnosticRuleIdentity(current);
35148
- explicitRuleOverride = resolveRuleSeverityOverride({ ruleKey }, severityControls);
35149
- explicitSeverityOverride = resolveRuleSeverityOverride({
35150
- ruleKey,
35151
- category
35152
- }, severityControls);
35153
- if (explicitSeverityOverride === "off") return null;
35154
- if (explicitSeverityOverride !== void 0) current = restampSeverity(current, explicitSeverityOverride);
35155
- }
35156
- if (explicitRuleOverride === void 0) {
35157
- if (isAppOnlyRule(`${current.plugin}/${current.rule}`) && isLibraryFile(current.filePath)) return null;
35158
- }
35159
- if (!showWarnings && current.severity === "warning" && explicitSeverityOverride !== "warn") return null;
35160
- if (userConfig) {
35161
- if (isRuleIgnored(`${current.plugin}/${current.rule}`)) return null;
35162
- if (isFileIgnoredByPatterns(current.filePath, rootDirectory, ignoredFilePatterns)) return null;
35163
- if (isDiagnosticIgnoredByOverrides(current, rootDirectory, compiledOverrides)) return null;
35164
- if (isRnRawTextSuppressedByConfig(current)) return null;
35165
- }
35166
- if (respectInlineDisables && current.line > 0) {
35167
- const lines = getFileLines(current.filePath);
35168
- if (lines) {
35169
- const ruleIdentifier = `${current.plugin}/${current.rule}`;
35170
- const evaluation = evaluateSuppression(lines, current.line - 1, ruleIdentifier);
35171
- if (evaluation.isSuppressed) return null;
35172
- if (evaluation.nearMissHint) current = {
35173
- ...current,
35174
- suppressionHint: evaluation.nearMissHint
35175
- };
35161
+ const isJsxNoUndefSuppressedByConfig = (diagnostic) => {
35162
+ if (!hasRuntimeGlobals) return false;
35163
+ if (diagnostic.rule !== "jsx-no-undef") return false;
35164
+ const identifierMatch = JSX_NO_UNDEF_IDENTIFIER_PATTERN.exec(diagnostic.message);
35165
+ return identifierMatch !== null && runtimeGlobalNames.has(identifierMatch[1]);
35166
+ };
35167
+ return {
35168
+ apply: (diagnostic) => {
35169
+ if (shouldAutoSuppress(diagnostic)) return null;
35170
+ let current = diagnostic;
35171
+ let explicitSeverityOverride;
35172
+ let explicitRuleOverride;
35173
+ if (severityControls) {
35174
+ const { ruleKey, category } = getDiagnosticRuleIdentity(current);
35175
+ explicitRuleOverride = resolveRuleSeverityOverride({ ruleKey }, severityControls);
35176
+ explicitSeverityOverride = resolveRuleSeverityOverride({
35177
+ ruleKey,
35178
+ category
35179
+ }, severityControls);
35180
+ if (explicitSeverityOverride === "off") return suppress(current, "config");
35181
+ if (explicitSeverityOverride !== void 0) current = restampSeverity(current, explicitSeverityOverride);
35176
35182
  }
35177
- }
35178
- const fileContext = getFileContext(current.filePath);
35179
- if (fileContext !== "production") current = {
35180
- ...current,
35181
- fileContext
35182
- };
35183
- return current;
35184
- } };
35183
+ if (explicitRuleOverride === void 0) {
35184
+ if (isAppOnlyRule(`${current.plugin}/${current.rule}`) && isLibraryFile(current.filePath)) return null;
35185
+ }
35186
+ if (!showWarnings && current.severity === "warning" && explicitSeverityOverride !== "warn") return null;
35187
+ if (userConfig) {
35188
+ if (isRuleIgnored(`${current.plugin}/${current.rule}`)) return suppress(current, "config");
35189
+ if (isFileIgnoredByPatterns(current.filePath, rootDirectory, ignoredFilePatterns)) return null;
35190
+ if (isDiagnosticIgnoredByOverrides(current, rootDirectory, compiledOverrides)) return suppress(current, "override");
35191
+ if (isRnRawTextSuppressedByConfig(current)) return null;
35192
+ if (isJsxNoUndefSuppressedByConfig(current)) return null;
35193
+ }
35194
+ if (respectInlineDisables && current.line > 0) {
35195
+ const lines = getFileLines(current.filePath);
35196
+ if (lines) {
35197
+ const ruleIdentifier = `${current.plugin}/${current.rule}`;
35198
+ const evaluation = evaluateSuppression(lines, current.line - 1, ruleIdentifier);
35199
+ if (evaluation.isSuppressed) return suppress(current, "inline");
35200
+ if (evaluation.nearMissHint) current = {
35201
+ ...current,
35202
+ suppressionHint: evaluation.nearMissHint
35203
+ };
35204
+ }
35205
+ }
35206
+ const fileContext = getFileContext(current.filePath);
35207
+ if (fileContext !== "production") current = {
35208
+ ...current,
35209
+ fileContext
35210
+ };
35211
+ return current;
35212
+ },
35213
+ summarizeSuppressions: () => [...suppressions.values()]
35214
+ };
35185
35215
  };
35186
35216
  const OxlintUnavailableKind = Literals(["binary-not-found", "native-binding-missing"]);
35187
35217
  var OxlintUnavailable = class extends TaggedErrorClass()("OxlintUnavailable", {
@@ -35401,7 +35431,7 @@ const resolveScanConcurrency = (requested) => {
35401
35431
  if (!Number.isFinite(requested) || requested < 1) return 1;
35402
35432
  return Math.min(Math.floor(requested), 32);
35403
35433
  };
35404
- const readSystemFacts = () => ({
35434
+ const readSystemFacts$1 = () => ({
35405
35435
  availableCores: os.availableParallelism(),
35406
35436
  totalMemoryBytes: os.totalmem(),
35407
35437
  cgroupMemoryLimitBytes: readCgroupMemoryLimitBytes()
@@ -35422,7 +35452,7 @@ const readSystemFacts = () => ({
35422
35452
  * `facts` is injectable so tests exercise core-bound, memory-bound, cgroup-
35423
35453
  * limited, and ceiling cases without mocking `os` or the filesystem.
35424
35454
  */
35425
- const resolveAutoScanConcurrency = (facts = readSystemFacts()) => {
35455
+ const resolveAutoScanConcurrency = (facts = readSystemFacts$1()) => {
35426
35456
  const availableMemoryBytes = Math.min(facts.totalMemoryBytes, facts.cgroupMemoryLimitBytes ?? Number.POSITIVE_INFINITY);
35427
35457
  const memoryBoundedWorkers = Math.floor(availableMemoryBytes / PER_WORKER_MEM_BUDGET_BYTES);
35428
35458
  return resolveScanConcurrency(Math.min(facts.availableCores, memoryBoundedWorkers));
@@ -35617,6 +35647,7 @@ const STRING_ARRAY_FIELD_NAMES = [
35617
35647
  "projects",
35618
35648
  "textComponents",
35619
35649
  "rawTextWrapperComponents",
35650
+ "runtimeGlobals",
35620
35651
  "serverAuthFunctionNames"
35621
35652
  ];
35622
35653
  const SURFACE_CONTROL_FIELD_NAMES = [
@@ -36907,7 +36938,10 @@ const shouldEnableRule = (requires, tags, capabilities, ignoredTags, disabledBy)
36907
36938
  }
36908
36939
  return true;
36909
36940
  };
36910
- const checkSecurityScan = (rootDirectory, options = {}) => {
36941
+ const yieldToEventLoop = () => new Promise((resolve) => {
36942
+ setImmediate(resolve);
36943
+ });
36944
+ const createSecurityScanSession = (rootDirectory, options) => {
36911
36945
  const capabilities = options.project ? buildCapabilities(options.project) : /* @__PURE__ */ new Set();
36912
36946
  const ignoredTags = options.ignoredTags ?? /* @__PURE__ */ new Set();
36913
36947
  const enabledScanRules = REACT_DOCTOR_RULES.flatMap((entry) => {
@@ -36922,7 +36956,7 @@ const checkSecurityScan = (rootDirectory, options = {}) => {
36922
36956
  committedFilesOnly: rule.committedFilesOnly === true
36923
36957
  }];
36924
36958
  });
36925
- if (enabledScanRules.length === 0) return [];
36959
+ if (enabledScanRules.length === 0) return null;
36926
36960
  const diagnostics = [];
36927
36961
  const seen = /* @__PURE__ */ new Set();
36928
36962
  const gitIgnoredCache = /* @__PURE__ */ new Map();
@@ -36934,15 +36968,34 @@ const checkSecurityScan = (rootDirectory, options = {}) => {
36934
36968
  }
36935
36969
  return status === true;
36936
36970
  };
36937
- for (const file of collectSecurityScanFiles(rootDirectory)) for (const { entry, scan, committedFilesOnly } of enabledScanRules) for (const finding of scan(file)) {
36938
- if (committedFilesOnly && isFileGitIgnored(file)) continue;
36939
- const diagnostic = buildSecurityScanDiagnostic(finding, entry, file.relativePath);
36940
- const key = `${diagnostic.rule}:${diagnostic.filePath}:${diagnostic.line}:${diagnostic.column}:${diagnostic.message}`;
36941
- if (seen.has(key)) continue;
36942
- seen.add(key);
36943
- diagnostics.push(diagnostic);
36971
+ const scanFile = (file) => {
36972
+ for (const { entry, scan, committedFilesOnly } of enabledScanRules) for (const finding of scan(file)) {
36973
+ if (committedFilesOnly && isFileGitIgnored(file)) continue;
36974
+ const diagnostic = buildSecurityScanDiagnostic(finding, entry, file.relativePath);
36975
+ const key = `${diagnostic.rule}:${diagnostic.filePath}:${diagnostic.line}:${diagnostic.column}:${diagnostic.message}`;
36976
+ if (seen.has(key)) continue;
36977
+ seen.add(key);
36978
+ diagnostics.push(diagnostic);
36979
+ }
36980
+ };
36981
+ return {
36982
+ scanFile,
36983
+ diagnostics
36984
+ };
36985
+ };
36986
+ const checkSecurityScanCooperative = async (rootDirectory, options = {}) => {
36987
+ const session = createSecurityScanSession(rootDirectory, options);
36988
+ if (session === null) return [];
36989
+ let filesSinceYield = 0;
36990
+ for (const file of collectSecurityScanFiles(rootDirectory)) {
36991
+ session.scanFile(file);
36992
+ filesSinceYield += 1;
36993
+ if (filesSinceYield >= 16) {
36994
+ filesSinceYield = 0;
36995
+ await yieldToEventLoop();
36996
+ }
36944
36997
  }
36945
- return diagnostics;
36998
+ return session.diagnostics;
36946
36999
  };
36947
37000
  var import_picocolors = /* @__PURE__ */ __toESM((/* @__PURE__ */ __commonJSMin(((exports, module) => {
36948
37001
  let p = process || {}, argv = p.argv || [], env = p.env || {};
@@ -37159,6 +37212,74 @@ const collectDeadCodeIgnorePatterns = (rootDirectory) => {
37159
37212
  return [...seen].filter((pattern) => pattern.length > 0);
37160
37213
  };
37161
37214
  const collectDeadCodeEntryPatterns = (rootDirectory) => [...new Set(collectKnipPatterns(rootDirectory, "entry"))].filter((pattern) => pattern.length > 0);
37215
+ const readSystemFacts = () => ({
37216
+ availableCores: os.availableParallelism(),
37217
+ totalMemoryBytes: os.totalmem(),
37218
+ cgroupMemoryLimitBytes: readCgroupMemoryLimitBytes()
37219
+ });
37220
+ /**
37221
+ * How many real deslop dead-code child processes may run at once, across the
37222
+ * concurrent per-project `runInspect` fibers of one CLI run. The cap is the
37223
+ * smaller of the core count and the number of `DEAD_CODE_WORKER_MEM_BUDGET_BYTES`
37224
+ * workers that fit in available memory, floored at 1.
37225
+ *
37226
+ * On a roomy dev box / CI runner this resolves high enough that every
37227
+ * concurrently-scanned project still spawns its own worker (no serialization vs
37228
+ * the prior uncapped behavior); on a memory-constrained runner it collapses
37229
+ * toward 1, so the `withDeadCodeWorkerSlot` semaphore serializes the spawns
37230
+ * instead of oversubscribing memory with N simultaneous children — the global
37231
+ * cap the per-project spawn path lacked.
37232
+ *
37233
+ * Mirrors `resolveAutoScanConcurrency` (lint), but budgets memory per the
37234
+ * heavier dead-code worker. `facts` is injectable for tests.
37235
+ */
37236
+ const resolveDeadCodeConcurrency = (facts = readSystemFacts()) => {
37237
+ const availableMemoryBytes = Math.min(facts.totalMemoryBytes, facts.cgroupMemoryLimitBytes ?? Number.POSITIVE_INFINITY);
37238
+ const memoryBoundedWorkers = Math.floor(availableMemoryBytes / DEAD_CODE_WORKER_MEM_BUDGET_BYTES);
37239
+ return Math.max(1, Math.min(facts.availableCores, memoryBoundedWorkers));
37240
+ };
37241
+ let availableSlots = -1;
37242
+ const waiters = [];
37243
+ const releaseSlot = () => {
37244
+ const nextWaiter = waiters.shift();
37245
+ if (nextWaiter !== void 0) nextWaiter();
37246
+ else availableSlots += 1;
37247
+ };
37248
+ /**
37249
+ * Runs `task` once a dead-code worker slot is free, releasing the slot when the
37250
+ * task settles (success or failure). With a high cap (roomy machine) every
37251
+ * caller proceeds immediately; with a low cap (constrained runner) callers
37252
+ * queue and run as slots free.
37253
+ *
37254
+ * `abortSignal` short-circuits the WAIT: if it's already aborted, or fires while
37255
+ * this caller is queued, the call rejects without acquiring a slot or running
37256
+ * `task` — so a cancelled scan (e.g. lint failed) doesn't sit in the queue and
37257
+ * then spawn a child only to tear it down. A queued caller that aborts removes
37258
+ * its own waiter so a later release never hands a slot to a dead request.
37259
+ */
37260
+ const withDeadCodeWorkerSlot = async (task, abortSignal) => {
37261
+ if (abortSignal?.aborted) throw new Error("Dead-code worker aborted.");
37262
+ if (availableSlots < 0) availableSlots = resolveDeadCodeConcurrency();
37263
+ if (availableSlots > 0) availableSlots -= 1;
37264
+ else await new Promise((resolve, reject) => {
37265
+ const waiter = () => {
37266
+ abortSignal?.removeEventListener("abort", onAbort);
37267
+ resolve();
37268
+ };
37269
+ const onAbort = () => {
37270
+ const queuedIndex = waiters.indexOf(waiter);
37271
+ if (queuedIndex !== -1) waiters.splice(queuedIndex, 1);
37272
+ reject(/* @__PURE__ */ new Error("Dead-code worker aborted."));
37273
+ };
37274
+ waiters.push(waiter);
37275
+ abortSignal?.addEventListener("abort", onAbort, { once: true });
37276
+ });
37277
+ try {
37278
+ return await task();
37279
+ } finally {
37280
+ releaseSlot();
37281
+ }
37282
+ };
37162
37283
  /**
37163
37284
  * Resolves a path to its canonical, symlink-free form, falling back to
37164
37285
  * the input when it cannot be realpath'd (broken symlink, permission
@@ -37183,6 +37304,11 @@ const toCanonicalPath = (filePath) => {
37183
37304
  };
37184
37305
  const DEAD_CODE_PLUGIN = "deslop";
37185
37306
  const DEAD_CODE_CATEGORY = "Maintainability";
37307
+ const REACT_DOCTOR_TOOLCHAIN_PACKAGES = new Set([
37308
+ "react-doctor",
37309
+ "eslint-plugin-react-doctor",
37310
+ "oxlint-plugin-react-doctor"
37311
+ ]);
37186
37312
  const DEAD_CODE_WORKER_SCRIPT = `
37187
37313
  const inputChunks = [];
37188
37314
  process.stdin.on("data", (chunk) => inputChunks.push(chunk));
@@ -37449,14 +37575,17 @@ const checkDeadCode = async (options) => {
37449
37575
  if (!NFS.existsSync(Path.join(rootDirectory, "package.json"))) return [];
37450
37576
  const entryPatterns = collectDeadCodeEntryPatterns(rootDirectory);
37451
37577
  const ignorePatterns = collectDeadCodeIgnorePatterns(rootDirectory);
37452
- const result = parseDeadCodeWorkerResult(await runDeadCodeWorkerWithTimeout((options.createWorker ?? createDeadCodeWorker)({
37453
- rootDirectory,
37454
- entryPatterns,
37455
- tsConfigPath: resolveTsConfigPath(rootDirectory),
37456
- ignorePatterns,
37457
- deslopJsModuleSpecifier: options.deslopJsModuleSpecifier ?? import.meta.resolve("deslop-js"),
37458
- parseConcurrency: options.parseConcurrency
37459
- }), options.workerTimeoutMs ?? 12e4, options.abortSignal));
37578
+ const spawnAndRun = () => {
37579
+ return runDeadCodeWorkerWithTimeout((options.createWorker ?? createDeadCodeWorker)({
37580
+ rootDirectory,
37581
+ entryPatterns,
37582
+ tsConfigPath: resolveTsConfigPath(rootDirectory),
37583
+ ignorePatterns,
37584
+ deslopJsModuleSpecifier: options.deslopJsModuleSpecifier ?? import.meta.resolve("deslop-js"),
37585
+ parseConcurrency: options.parseConcurrency
37586
+ }), options.workerTimeoutMs ?? 12e4, options.abortSignal);
37587
+ };
37588
+ const result = parseDeadCodeWorkerResult(options.createWorker === void 0 ? await withDeadCodeWorkerSlot(spawnAndRun, options.abortSignal) : await spawnAndRun());
37460
37589
  const toRelative = (filePath) => toRelativeFilePath(rootDirectory, filePath);
37461
37590
  const diagnostics = [];
37462
37591
  for (const unusedFile of result.unusedFiles) diagnostics.push({
@@ -37485,6 +37614,7 @@ const checkDeadCode = async (options) => {
37485
37614
  });
37486
37615
  }
37487
37616
  for (const unusedDependency of result.unusedDependencies) {
37617
+ if (REACT_DOCTOR_TOOLCHAIN_PACKAGES.has(unusedDependency.name)) continue;
37488
37618
  const label = unusedDependency.isDevDependency ? "devDependency" : "dependency";
37489
37619
  diagnostics.push({
37490
37620
  filePath: "package.json",
@@ -37857,43 +37987,46 @@ var Git = class Git extends Service()("react-doctor/Git") {
37857
37987
  * reason: GitInvocationFailed })` so the rest of the codebase
37858
37988
  * sees a single failure channel.
37859
37989
  */
37860
- const runCommand = (input) => scoped(gen(function* () {
37861
- const handle = yield* spawner.spawn(make$1(input.command, [...input.args], {
37862
- cwd: input.directory,
37863
- env: input.env,
37864
- extendEnv: true
37865
- }));
37866
- const maxStdoutBytes = input.maxStdoutBytes;
37867
- const stdoutByteCount = yield* make$13(0);
37868
- const [stdout, stderr, status] = yield* all([
37869
- mkString(decodeText(maxStdoutBytes === void 0 ? handle.stdout : handle.stdout.pipe(tap((chunk) => updateAndGet(stdoutByteCount, (total) => total + chunk.length).pipe(flatMap$2((total) => total > maxStdoutBytes ? fail$4(new ReactDoctorError({ reason: new GitInvocationFailed({
37870
- args: [...input.args],
37871
- directory: input.directory,
37872
- cause: /* @__PURE__ */ new Error(`git stdout exceeded ${maxStdoutBytes} bytes`)
37873
- }) })) : void_)))))),
37874
- mkString(decodeText(handle.stderr)),
37875
- handle.exitCode
37876
- ], { concurrency: 3 });
37877
- return {
37878
- status,
37879
- stdout,
37880
- stderr
37881
- };
37882
- })).pipe(catchTag$1("PlatformError", (cause) => {
37883
- if (input.command !== "git") return succeed$2({
37990
+ const runCommand = (input) => {
37991
+ const foldSpawnFailure = (cause) => input.command !== "git" ? succeed$2({
37884
37992
  status: 127,
37885
37993
  stdout: "",
37886
37994
  stderr: String(cause)
37887
- });
37888
- return new ReactDoctorError({ reason: new GitInvocationFailed({
37995
+ }) : fail$4(new ReactDoctorError({ reason: new GitInvocationFailed({
37889
37996
  args: [...input.args],
37890
37997
  directory: input.directory,
37891
37998
  cause
37892
- }) });
37893
- }), withSpan("git.exec", { attributes: {
37894
- "git.command": input.command,
37895
- "git.subcommand": input.args[0] ?? ""
37896
- } }));
37999
+ }) }));
38000
+ return scoped(gen(function* () {
38001
+ if (!isDirectory(input.directory)) return yield* foldSpawnFailure(`spawn ENOTDIR (cwd is not a directory: ${input.directory})`);
38002
+ const argvLengthChars = input.command.length + 1 + input.args.reduce((total, arg) => total + arg.length + 1, 0);
38003
+ if (argvLengthChars > 24e3) return yield* foldSpawnFailure(`spawn ENAMETOOLONG (${argvLengthChars} argv chars exceed ${SPAWN_ARGS_MAX_LENGTH_CHARS})`);
38004
+ const handle = yield* spawner.spawn(make$1(input.command, [...input.args], {
38005
+ cwd: input.directory,
38006
+ env: input.env,
38007
+ extendEnv: true
38008
+ }));
38009
+ const maxStdoutBytes = input.maxStdoutBytes;
38010
+ const stdoutByteCount = yield* make$13(0);
38011
+ const [stdout, stderr, status] = yield* all([
38012
+ mkString(decodeText(maxStdoutBytes === void 0 ? handle.stdout : handle.stdout.pipe(tap((chunk) => updateAndGet(stdoutByteCount, (total) => total + chunk.length).pipe(flatMap$2((total) => total > maxStdoutBytes ? fail$4(new ReactDoctorError({ reason: new GitInvocationFailed({
38013
+ args: [...input.args],
38014
+ directory: input.directory,
38015
+ cause: /* @__PURE__ */ new Error(`git stdout exceeded ${maxStdoutBytes} bytes`)
38016
+ }) })) : void_)))))),
38017
+ mkString(decodeText(handle.stderr)),
38018
+ handle.exitCode
38019
+ ], { concurrency: 3 });
38020
+ return {
38021
+ status,
38022
+ stdout,
38023
+ stderr
38024
+ };
38025
+ })).pipe(catchTag$1("PlatformError", foldSpawnFailure), withSpan("git.exec", { attributes: {
38026
+ "git.command": input.command,
38027
+ "git.subcommand": input.args[0] ?? ""
38028
+ } }));
38029
+ };
37897
38030
  const runGit = (directory, args) => runCommand({
37898
38031
  command: "git",
37899
38032
  args,
@@ -38140,7 +38273,7 @@ var Git = class Git extends Service()("react-doctor/Git") {
38140
38273
  ]);
38141
38274
  if (result.status !== 0) return null;
38142
38275
  return parseChangedLineRanges(result.stdout);
38143
- }).pipe(withSpan("Git.changedLineRanges"))
38276
+ }).pipe(catch_$1((error) => error.reason._tag === "GitInvocationFailed" ? succeed$2(null) : fail$4(error)), withSpan("Git.changedLineRanges"))
38144
38277
  });
38145
38278
  })).pipe(provide$2(layer$2.pipe(provide$2(mergeAll$1(layer$1, layer)))));
38146
38279
  /**
@@ -39215,11 +39348,12 @@ const REACT_COMPILER_TITLE = "React Compiler can't optimize this";
39215
39348
  const REACT_COMPILER_TODO_TITLE = "React Compiler doesn't support this syntax";
39216
39349
  const REACT_COMPILER_IMPACT = "This component misses React Compiler's automatic memoization & re-renders more than it should";
39217
39350
  const REACT_COMPILER_ACTION = "Rewrite the flagged code so the compiler can optimize it.";
39351
+ const REACT_COMPILER_INCOMPATIBLE_LIBRARY_ACTION = "It's how the library works, not a bug in your code. Memoize values you pass from it into other memoized components, or suppress it with `// react-doctor-disable-next-line react-hooks-js/incompatible-library`.";
39218
39352
  const REACT_COMPILER_GENERIC_MESSAGE = `${REACT_COMPILER_IMPACT}. ${REACT_COMPILER_ACTION}`;
39219
- const buildReactCompilerMessage = (reasonSummary) => {
39353
+ const buildReactCompilerMessage = (reasonSummary, action = REACT_COMPILER_ACTION) => {
39220
39354
  const normalizedSummary = reasonSummary.replace(TRAILING_PERIOD_PATTERN, "");
39221
- if (!normalizedSummary) return REACT_COMPILER_GENERIC_MESSAGE;
39222
- return `${REACT_COMPILER_IMPACT}: ${normalizedSummary}. ${REACT_COMPILER_ACTION}`;
39355
+ if (!normalizedSummary) return `${REACT_COMPILER_IMPACT}. ${action}`;
39356
+ return `${REACT_COMPILER_IMPACT}: ${normalizedSummary}. ${action}`;
39223
39357
  };
39224
39358
  const PLUGIN_CATEGORY_MAP = {
39225
39359
  react: "Bugs",
@@ -39268,7 +39402,7 @@ const resolveCleanedDiagnostic = (message, help, plugin, rule, project) => {
39268
39402
  const [reasonSummary = "", ...reasonDetailLines] = bailoutReason.split("\n");
39269
39403
  const reasonDetail = reasonDetailLines.join("\n").trim();
39270
39404
  return {
39271
- message: buildReactCompilerMessage(reasonSummary.trim()),
39405
+ message: buildReactCompilerMessage(reasonSummary.trim(), rule === "incompatible-library" ? REACT_COMPILER_INCOMPATIBLE_LIBRARY_ACTION : REACT_COMPILER_ACTION),
39272
39406
  help: appendReanimatedSharedValueHint(reasonDetail || help, rule, project)
39273
39407
  };
39274
39408
  }
@@ -40617,7 +40751,10 @@ const formatLintFailText = (reasonTag, nodeVersion) => {
40617
40751
  * diagnostics).
40618
40752
  * 2. beforeLint hook (e.g. CLI renders the project-detection block)
40619
40753
  * 3. environment checks (reduced-motion + pnpm hardening +
40620
- * expo/react-native + security scan), collected synchronously
40754
+ * expo/react-native), collected synchronously. The heavier
40755
+ * content-regex security scan is forked instead (like supply-chain
40756
+ * below) and joined before the concat, so its CPU overlaps lint
40757
+ * rather than blocking the event loop before it.
40621
40758
  * 4. The supply-chain check (Socket.dev) is forked onto a background
40622
40759
  * fiber so its ~100% network-bound time overlaps the ~100%
40623
40760
  * CPU/subprocess-bound lint pass below, collapsing two serial
@@ -40637,7 +40774,7 @@ const formatLintFailText = (reasonTag, nodeVersion) => {
40637
40774
  * order, so terminal output is identical either way; supply-chain
40638
40775
  * rides alongside without a spinner.
40639
40776
  * 6. Join the supply-chain fiber, then assemble the diagnostics in a
40640
- * FIXED order (env, supply-chain, lint, dead-code) so the output is
40777
+ * FIXED order (env, security-scan, supply-chain, lint, dead-code) so the output is
40641
40778
  * byte-identical regardless of which fiber settled first. The
40642
40779
  * viewer-permission fiber is joined later, during score-metadata
40643
40780
  * assembly (it feeds score metadata, not diagnostics). The per-element
@@ -40698,12 +40835,12 @@ const runInspect = (input, hooks = {}) => gen(function* () {
40698
40835
  ...checkPnpmHardening(scanDirectory),
40699
40836
  ...checkReactServerComponentsAdvisory(scanDirectory, project),
40700
40837
  ...checkExpoProject(scanDirectory, project),
40701
- ...checkReactNativeProject(scanDirectory, project),
40702
- ...checkSecurityScan(scanDirectory, {
40703
- project,
40704
- ignoredTags: input.ignoredTags
40705
- })
40838
+ ...checkReactNativeProject(scanDirectory, project)
40706
40839
  ])));
40840
+ const securityScanFiber = yield* forkChild(runCollect(applyPerElementPipeline(isDiffMode ? empty$4 : unwrap(promise(() => checkSecurityScanCooperative(scanDirectory, {
40841
+ project,
40842
+ ignoredTags: input.ignoredTags
40843
+ })).pipe(map$3((diagnostics) => fromIterable$1(diagnostics)))))).pipe(withSpan("SecurityScan.run")));
40707
40844
  const shouldRunSupplyChain = !isDiffMode || (input.supplyChainManifestChanged ?? false);
40708
40845
  const supplyChainOverlapTimeout = yield* SupplyChainOverlapTimeoutMs;
40709
40846
  const supplyChainFiber = yield* forkChild(shouldRunSupplyChain ? runCollect(applyPerElementPipeline(supplyChainService.run({
@@ -40839,9 +40976,11 @@ const runInspect = (input, hooks = {}) => gen(function* () {
40839
40976
  else yield* scanProgress.succeed(`Scanned ${scannedFilesLabel} in ${scanElapsedSeconds}s${workerCountSuffix}`);
40840
40977
  const supplyChainResult = yield* join(supplyChainFiber);
40841
40978
  const supplyChainCollected = supplyChainResult.diagnostics;
40979
+ const securityScanCollected = yield* join(securityScanFiber);
40842
40980
  yield* reporterService.finalize;
40843
40981
  const finalDiagnostics = sortDiagnosticsStable(assignFixGroups([
40844
40982
  ...envCollected,
40983
+ ...securityScanCollected,
40845
40984
  ...supplyChainCollected,
40846
40985
  ...lintCollected,
40847
40986
  ...deadCodeCollected
@@ -40888,7 +41027,8 @@ const runInspect = (input, hooks = {}) => gen(function* () {
40888
41027
  scanConcurrency,
40889
41028
  supplyChainOverlapTimedOut: supplyChainResult.timedOut,
40890
41029
  lintCacheHitFileCount,
40891
- lintCacheTotalFileCount
41030
+ lintCacheTotalFileCount,
41031
+ suppressedRuleCounts: transform.summarizeSuppressions()
40892
41032
  };
40893
41033
  }).pipe(withSpan("runInspect", { attributes: {
40894
41034
  "inspect.directory": input.directory,
@@ -42913,6 +43053,7 @@ const SENTRY_FLUSH_TIMEOUT_MS = 2e3;
42913
43053
  const METRIC = {
42914
43054
  cliInvoked: "cli.invoked",
42915
43055
  cliError: "cli.error",
43056
+ cliEnvironmentError: "cli.env_error",
42916
43057
  projectDetected: "project.detected",
42917
43058
  projectPathSelected: "project.path_selected",
42918
43059
  projectConfigSelected: "project.config_selected",
@@ -42925,6 +43066,8 @@ const METRIC = {
42925
43066
  scanCheckSkipped: "scan.check_skipped",
42926
43067
  baselineDegraded: "baseline.degraded",
42927
43068
  ruleFired: "rule.fired",
43069
+ ruleDisabled: "rule.disabled",
43070
+ ruleSuppressed: "rule.suppressed",
42928
43071
  lintFailed: "lint.failed",
42929
43072
  deadCodeFailed: "deadcode.failed",
42930
43073
  scoreUnavailable: "score.unavailable",
@@ -42937,12 +43080,17 @@ const METRIC = {
42937
43080
  installWorkflow: "install.workflow",
42938
43081
  installAgentHooks: "install.agent_hooks",
42939
43082
  installDependency: "install.dependency",
43083
+ ciScaffolded: "ci.scaffolded",
43084
+ ciUpgraded: "ci.upgraded",
43085
+ ciConfigured: "ci.configured",
42940
43086
  rulesChanged: "rules.changed",
42941
43087
  rulesQueried: "rules.queried",
42942
43088
  lspSessionStarted: "lsp.session.started",
42943
43089
  lspScanCompleted: "lsp.scan.completed",
42944
43090
  lspScanDuration: "lsp.scan.duration",
42945
- lspScanDiagnostics: "lsp.scan.diagnostics"
43091
+ lspScanDiagnostics: "lsp.scan.diagnostics",
43092
+ aiTrainingWarningShown: "ai.training.warning_shown",
43093
+ jsonOutUsed: "json.out_used"
42946
43094
  };
42947
43095
  //#endregion
42948
43096
  //#region src/cli/utils/to-category-key.ts
@@ -43259,5 +43407,5 @@ const startLanguageServer = () => {
43259
43407
  };
43260
43408
  //#endregion
43261
43409
  export { startLanguageServer };
43262
- !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]="f9576947-f3ff-58f4-b9ff-de0e2898651c")}catch(e){}}();
43263
- //# debugId=f9576947-f3ff-58f4-b9ff-de0e2898651c
43410
+ !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]="1822e36c-fbae-57bf-bdb9-98afebb9a03b")}catch(e){}}();
43411
+ //# debugId=1822e36c-fbae-57bf-bdb9-98afebb9a03b
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-doctor",
3
- "version": "0.5.8-dev.5f2bd72",
3
+ "version": "0.5.8-dev.6e67626",
4
4
  "description": "Your agent writes bad React. This catches it",
5
5
  "keywords": [
6
6
  "accessibility",
@@ -20,7 +20,7 @@
20
20
  "bugs": {
21
21
  "url": "https://github.com/millionco/react-doctor/issues"
22
22
  },
23
- "license": "MIT",
23
+ "license": "SEE LICENSE IN LICENSE",
24
24
  "author": "Million Software, Inc",
25
25
  "repository": {
26
26
  "type": "git",
@@ -34,7 +34,8 @@
34
34
  "bin/**",
35
35
  "dist/**/*.js",
36
36
  "dist/**/*.d.ts",
37
- "dist/skills/**"
37
+ "dist/skills/**",
38
+ "LICENSE"
38
39
  ],
39
40
  "type": "module",
40
41
  "sideEffects": false,
@@ -59,12 +60,13 @@
59
60
  "magicast": "^0.5.3",
60
61
  "oxlint": ">=1.66.0 <1.67.0",
61
62
  "prompts": "^2.4.2",
62
- "typescript": ">=5.0.4 <7",
63
+ "typescript": ">=5.0.4 <6",
63
64
  "vscode-languageserver": "^9.0.1",
64
65
  "vscode-languageserver-textdocument": "^1.0.12",
65
66
  "vscode-uri": "^3.1.0",
66
- "deslop-js": "0.5.8",
67
- "oxlint-plugin-react-doctor": "0.5.8-dev.5f2bd72"
67
+ "yaml": "^2.9.0",
68
+ "oxlint-plugin-react-doctor": "0.5.8-dev.6e67626",
69
+ "deslop-js": "0.5.8"
68
70
  },
69
71
  "devDependencies": {
70
72
  "@types/babel__code-frame": "^7.27.0",