react-doctor 0.8.1-dev.cd9ca68 → 0.8.1-dev.d970055

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]="434800fc-200b-5a59-aa25-61e682ab57d7")}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]="c24708ed-97a3-59cc-81f7-4cf277ab29f2")}catch(e){}}();
3
3
  import { createRequire } from "node:module";
4
4
  import * as NodeChildProcess from "node:child_process";
5
5
  import { execFile, execFileSync, spawn, spawnSync } from "node:child_process";
@@ -36571,10 +36571,10 @@ const FALLBACK_TSCONFIG_FILENAMES = ["tsconfig.app.json", "tsconfig.build.json"]
36571
36571
  const FRAMEWORK_PACKAGES = {
36572
36572
  next: "nextjs",
36573
36573
  "@tanstack/react-start": "tanstack-start",
36574
- "@remix-run/react": "remix",
36575
- gatsby: "gatsby",
36576
36574
  vite: "vite",
36577
36575
  "react-scripts": "cra",
36576
+ "@remix-run/react": "remix",
36577
+ gatsby: "gatsby",
36578
36578
  expo: "expo",
36579
36579
  "react-native": "react-native"
36580
36580
  };
@@ -37101,6 +37101,19 @@ const getPreactVersion = (packageJson) => {
37101
37101
  ...packageJson.devDependencies
37102
37102
  }.preact ?? null;
37103
37103
  };
37104
+ const TANSTACK_QUERY_PACKAGES = new Set([
37105
+ "@tanstack/react-query",
37106
+ "@tanstack/query-core",
37107
+ "react-query"
37108
+ ]);
37109
+ const hasTanStackQuery = (packageJson) => {
37110
+ const allDependencies = {
37111
+ ...packageJson.peerDependencies,
37112
+ ...packageJson.dependencies,
37113
+ ...packageJson.devDependencies
37114
+ };
37115
+ return Object.keys(allDependencies).some((packageName) => TANSTACK_QUERY_PACKAGES.has(packageName));
37116
+ };
37104
37117
  const resolveCatalogBackedDependencyVersion = ({ rootDirectory, rootPackageJson, packageName, version }) => {
37105
37118
  if (version === null || !isCatalogReference(version)) return version;
37106
37119
  const catalogName = extractCatalogName(version);
@@ -37303,60 +37316,7 @@ const listWorkspacePackages = (rootDirectory) => {
37303
37316
  }
37304
37317
  return packages;
37305
37318
  };
37306
- const getPreferredDependencyVersion = ({ packageJson, packageNames }) => {
37307
- const allDependencies = {
37308
- ...packageJson.devDependencies,
37309
- ...packageJson.peerDependencies,
37310
- ...packageJson.dependencies
37311
- };
37312
- for (const packageName of packageNames) {
37313
- const version = allDependencies[packageName];
37314
- if (version !== void 0) return version;
37315
- }
37316
- return null;
37317
- };
37318
- const TANSTACK_REACT_QUERY_PACKAGES = ["@tanstack/react-query", "react-query"];
37319
- const getTanStackQueryVersion = (packageJson) => {
37320
- return getPreferredDependencyVersion({
37321
- packageJson,
37322
- packageNames: TANSTACK_REACT_QUERY_PACKAGES
37323
- });
37324
- };
37325
- const STYLED_COMPONENTS_PACKAGES = ["styled-components"];
37326
- const getStyledComponentsVersion = (packageJson) => {
37327
- return getPreferredDependencyVersion({
37328
- packageJson,
37329
- packageNames: STYLED_COMPONENTS_PACKAGES
37330
- });
37331
- };
37332
- const I18N_PACKAGES = [
37333
- "i18next",
37334
- "react-i18next",
37335
- "next-i18next",
37336
- "react-intl",
37337
- "next-intl",
37338
- "use-intl",
37339
- "@formatjs/intl",
37340
- "@lingui/core",
37341
- "@lingui/react",
37342
- "typesafe-i18n",
37343
- "@tolgee/react",
37344
- "react-intl-universal"
37345
- ];
37346
- const hasI18nDependency = (packageJson) => {
37347
- const allDependencies = {
37348
- ...packageJson.peerDependencies,
37349
- ...packageJson.dependencies,
37350
- ...packageJson.devDependencies,
37351
- ...packageJson.optionalDependencies
37352
- };
37353
- return I18N_PACKAGES.some((packageName) => allDependencies[packageName] !== void 0);
37354
- };
37355
37319
  const REANIMATED_DEPENDENCY_NAME = "react-native-reanimated";
37356
- const MOBX_REACT_PACKAGE_NAME = "mobx-react";
37357
- const MOBX_REACT_LITE_PACKAGE_NAME = "mobx-react-lite";
37358
- const MOBX_STATE_TREE_PACKAGE_NAME = "mobx-state-tree";
37359
- const MOBX_REACT_OBSERVER_PACKAGE_NAME = "mobx-react-observer";
37360
37320
  const SHOPIFY_FLASH_LIST_PACKAGE_NAME = "@shopify/flash-list";
37361
37321
  const resolveWorkspaceDependencyVersion = ({ concreteVersion, packageName, rootDirectory, rootPackageJson, sections, workspaceDirectory, workspacePackageJson }) => {
37362
37322
  const dependencyDeclaration = getDependencyDeclaration({
@@ -37375,26 +37335,7 @@ const shouldReplaceReactVersion = (currentVersion, nextVersion) => {
37375
37335
  if (nextMajor === null) return false;
37376
37336
  return nextMajor < currentMajor;
37377
37337
  };
37378
- const shouldReplaceSupportedDependencyFact = (currentFact, nextFact, latestSupportedMajor) => {
37379
- if (currentFact.version === null) return true;
37380
- if (nextFact.version === null) return false;
37381
- const currentMajor = getLowestDependencyMajor(currentFact.version);
37382
- const nextMajor = getLowestDependencyMajor(nextFact.version);
37383
- if (currentMajor === null) return false;
37384
- if (nextMajor === null) return true;
37385
- if (currentMajor > latestSupportedMajor) return false;
37386
- if (nextMajor > latestSupportedMajor) return true;
37387
- return nextMajor < currentMajor;
37388
- };
37389
- const shouldReplaceStyledComponentsVersion = (currentVersion, nextVersion) => {
37390
- if (!currentVersion) return true;
37391
- const currentMajor = getLowestDependencyMajor(currentVersion);
37392
- const nextMajor = getLowestDependencyMajor(nextVersion);
37393
- if (currentMajor === null) return nextMajor !== null && nextMajor < 6;
37394
- if (nextMajor === null) return currentMajor >= 6;
37395
- return nextMajor < currentMajor;
37396
- };
37397
- const evaluateManifestFacts = (facts, packageJson, directory, rootDirectory, rootPackageJson) => {
37338
+ const evaluateManifestFacts = (facts, packageJson, directory) => {
37398
37339
  if (facts.expo.version === null) {
37399
37340
  const spec = getDependencySpec(packageJson, "expo");
37400
37341
  if (spec !== null) facts.expo = {
@@ -37416,74 +37357,13 @@ const evaluateManifestFacts = (facts, packageJson, directory, rootDirectory, roo
37416
37357
  sourceDirectory: directory
37417
37358
  };
37418
37359
  }
37419
- const mobxSpec = getDependencySpec(packageJson, "mobx");
37420
- if (mobxSpec !== null) {
37421
- const nextMobxFact = {
37422
- version: resolveCatalogBackedDependencyVersion({
37423
- rootDirectory: directory,
37424
- rootPackageJson: packageJson,
37425
- packageName: "mobx",
37426
- version: mobxSpec
37427
- }),
37428
- sourceDirectory: directory
37429
- };
37430
- if (shouldReplaceSupportedDependencyFact(facts.mobx, nextMobxFact, 6)) facts.mobx = nextMobxFact;
37431
- }
37432
- facts.hasMobxReact = facts.hasMobxReact || getDependencySpec(packageJson, MOBX_REACT_PACKAGE_NAME) !== null;
37433
- facts.hasMobxReactLite = facts.hasMobxReactLite || getDependencySpec(packageJson, MOBX_REACT_LITE_PACKAGE_NAME) !== null;
37434
- facts.hasMobxStateTree = facts.hasMobxStateTree || getDependencySpec(packageJson, MOBX_STATE_TREE_PACKAGE_NAME) !== null;
37435
- facts.hasMobxReactObserver = facts.hasMobxReactObserver || getDependencySpec(packageJson, MOBX_REACT_OBSERVER_PACKAGE_NAME) !== null;
37436
- const zustandSpec = getDependencySpec(packageJson, "zustand");
37437
- if (zustandSpec !== null) {
37438
- const nextZustandFact = {
37439
- version: resolveCatalogBackedDependencyVersion({
37440
- rootDirectory: directory,
37441
- rootPackageJson: packageJson,
37442
- packageName: "zustand",
37443
- version: zustandSpec
37444
- }),
37445
- sourceDirectory: directory
37446
- };
37447
- if (shouldReplaceSupportedDependencyFact(facts.zustand, nextZustandFact, 5)) facts.zustand = nextZustandFact;
37448
- }
37449
37360
  if (facts.reanimatedVersion === null) {
37450
37361
  const spec = getDependencySpec(packageJson, REANIMATED_DEPENDENCY_NAME);
37451
37362
  if (spec !== null) facts.reanimatedVersion = spec;
37452
37363
  }
37453
- if (facts.valtioVersion === null) {
37454
- const spec = getDependencySpec(packageJson, "valtio");
37455
- if (spec !== null) facts.valtioVersion = spec;
37456
- }
37457
- facts.tanstackQueryVersion ??= getTanStackQueryVersion(packageJson);
37458
- const styledComponentsVersion = resolveCatalogBackedDependencyVersion({
37459
- rootDirectory: directory,
37460
- rootPackageJson: packageJson,
37461
- packageName: "styled-components",
37462
- version: getStyledComponentsVersion(packageJson)
37463
- });
37464
- if (styledComponentsVersion && shouldReplaceStyledComponentsVersion(facts.styledComponentsVersion, styledComponentsVersion)) facts.styledComponentsVersion = styledComponentsVersion;
37465
- facts.hasI18nLibrary = facts.hasI18nLibrary || hasI18nDependency(packageJson);
37466
37364
  facts.hasReactNativeAwarePackage = facts.hasReactNativeAwarePackage || isPackageJsonReactNativeAware(packageJson);
37467
37365
  facts.hasReanimatedAwarePackage = facts.hasReanimatedAwarePackage || isPackageJsonReanimatedAware(packageJson);
37468
37366
  facts.hasSsrDependency = facts.hasSsrDependency || isPackageJsonSsrAware(packageJson);
37469
- const remotionSpec = getDependencySpec(packageJson, "remotion");
37470
- if (remotionSpec !== null) {
37471
- facts.hasRemotionDependency = true;
37472
- const resolvedRemotionVersion = resolveCatalogBackedDependencyVersion({
37473
- rootDirectory,
37474
- rootPackageJson,
37475
- packageName: "remotion",
37476
- version: remotionSpec
37477
- });
37478
- const remotionMajorVersion = resolvedRemotionVersion === null ? null : getLowestDependencyMajor(resolvedRemotionVersion);
37479
- if (remotionMajorVersion === null) {
37480
- facts.hasUnknownRemotionVersion = true;
37481
- facts.remotionVersion = null;
37482
- } else if (!facts.hasUnknownRemotionVersion) {
37483
- const currentRemotionMajorVersion = facts.remotionVersion === null ? null : getLowestDependencyMajor(facts.remotionVersion);
37484
- if (currentRemotionMajorVersion === null || remotionMajorVersion < currentRemotionMajorVersion) facts.remotionVersion = resolvedRemotionVersion;
37485
- }
37486
- }
37487
37367
  };
37488
37368
  const collectWorkspaceFacts = (rootDirectory, rootPackageJson, { collectReactGroup }) => {
37489
37369
  const facts = {
@@ -37503,31 +37383,12 @@ const collectWorkspaceFacts = (rootDirectory, rootPackageJson, { collectReactGro
37503
37383
  version: null,
37504
37384
  sourceDirectory: null
37505
37385
  },
37506
- valtioVersion: null,
37507
- mobx: {
37508
- version: null,
37509
- sourceDirectory: null
37510
- },
37511
- hasMobxReact: false,
37512
- hasMobxReactLite: false,
37513
- hasMobxStateTree: false,
37514
- hasMobxReactObserver: false,
37515
- zustand: {
37516
- version: null,
37517
- sourceDirectory: null
37518
- },
37519
- tanstackQueryVersion: null,
37520
- styledComponentsVersion: null,
37521
- hasI18nLibrary: false,
37522
37386
  hasReactNativeAwarePackage: false,
37523
37387
  hasReanimatedAwarePackage: false,
37524
37388
  hasSsrDependency: false,
37525
- hasRemotionDependency: false,
37526
- hasUnknownRemotionVersion: false,
37527
- remotionVersion: null,
37528
37389
  reanimatedVersion: null
37529
37390
  };
37530
- evaluateManifestFacts(facts, rootPackageJson, rootDirectory, rootDirectory, rootPackageJson);
37391
+ evaluateManifestFacts(facts, rootPackageJson, rootDirectory);
37531
37392
  let isReactGroupSettled = !collectReactGroup;
37532
37393
  const visitedDirectories = /* @__PURE__ */ new Set();
37533
37394
  for (const pattern of getWorkspacePatterns(rootDirectory, rootPackageJson)) {
@@ -37536,7 +37397,7 @@ const collectWorkspaceFacts = (rootDirectory, rootPackageJson, { collectReactGro
37536
37397
  if (visitedDirectories.has(workspaceDirectory)) continue;
37537
37398
  visitedDirectories.add(workspaceDirectory);
37538
37399
  const workspacePackageJson = readPackageJson$1(Path.join(workspaceDirectory, "package.json"));
37539
- evaluateManifestFacts(facts, workspacePackageJson, workspaceDirectory, rootDirectory, rootPackageJson);
37400
+ evaluateManifestFacts(facts, workspacePackageJson, workspaceDirectory);
37540
37401
  const info = extractDependencyInfo(workspacePackageJson);
37541
37402
  if (info.framework !== "unknown" && frameworkMergeRank(info.framework) < frameworkMergeRank(facts.framework)) facts.framework = info.framework;
37542
37403
  if (isReactGroupSettled) continue;
@@ -37757,27 +37618,11 @@ const discoverProjectWithoutPackageJson = (directory) => {
37757
37618
  tailwindVersion: null,
37758
37619
  zodVersion: null,
37759
37620
  zodMajorVersion: null,
37760
- mobxVersion: null,
37761
- mobxMajorVersion: null,
37762
- hasMobxReact: false,
37763
- hasMobxReactLite: false,
37764
- hasMobxStateTree: false,
37765
- hasMobxReactObserver: false,
37766
- zustandVersion: null,
37767
- zustandMajorVersion: null,
37768
37621
  framework: "unknown",
37769
37622
  hasTypeScript: hasOwnTsConfig,
37770
37623
  hasReactCompiler: false,
37771
37624
  hasReactCompilerLintPlugin: false,
37772
37625
  hasTanStackQuery: false,
37773
- valtioVersion: null,
37774
- valtioMajorVersion: null,
37775
- hasRemotion: false,
37776
- remotionVersion: null,
37777
- remotionMajorVersion: null,
37778
- hasI18nLibrary: false,
37779
- tanstackQueryVersion: null,
37780
- styledComponentsVersion: null,
37781
37626
  hasSsrDependency: false,
37782
37627
  preactVersion: null,
37783
37628
  preactMajorVersion: null,
@@ -37876,12 +37721,6 @@ const discoverProject = (directory) => {
37876
37721
  packageName: SHOPIFY_FLASH_LIST_PACKAGE_NAME,
37877
37722
  version: workspaceFacts.shopifyFlashList.version
37878
37723
  }) : null;
37879
- const zustandVersion = resolveCatalogBackedDependencyVersion({
37880
- rootDirectory: directory,
37881
- rootPackageJson: packageJson,
37882
- packageName: "zustand",
37883
- version: workspaceFacts.zustand.version
37884
- });
37885
37724
  const hasReanimated = hasReactNativeWorkspace && workspaceFacts.hasReanimatedAwarePackage;
37886
37725
  const reanimatedVersion = hasReanimated ? workspaceFacts.reanimatedVersion : null;
37887
37726
  const nextjsVersion = framework === "nextjs" ? resolveCatalogBackedDependencyVersion({
@@ -37890,21 +37729,7 @@ const discoverProject = (directory) => {
37890
37729
  packageName: "next",
37891
37730
  version: workspaceFacts.next.version
37892
37731
  }) : null;
37893
- const valtioVersion = resolveCatalogBackedDependencyVersion({
37894
- rootDirectory: directory,
37895
- rootPackageJson: packageJson,
37896
- packageName: "valtio",
37897
- version: workspaceFacts.valtioVersion
37898
- });
37899
- const mobxVersion = resolveCatalogBackedDependencyVersion({
37900
- rootDirectory: directory,
37901
- rootPackageJson: packageJson,
37902
- packageName: "mobx",
37903
- version: workspaceFacts.mobx.version
37904
- });
37905
37732
  const preactVersion = getPreactVersion(packageJson);
37906
- const remotionVersion = workspaceFacts.remotionVersion;
37907
- const tanstackQueryVersion = getTanStackQueryVersion(packageJson) ?? workspaceFacts.tanstackQueryVersion;
37908
37733
  const isPreES2023Target = hasTypeScript && detectPreES2023Target(directory);
37909
37734
  const projectInfo = {
37910
37735
  rootDirectory: directory,
@@ -37914,27 +37739,11 @@ const discoverProject = (directory) => {
37914
37739
  tailwindVersion,
37915
37740
  zodVersion,
37916
37741
  zodMajorVersion: zodVersion === null ? null : getLowestDependencyMajor(zodVersion),
37917
- mobxVersion,
37918
- mobxMajorVersion: mobxVersion === null ? null : getLowestDependencyMajor(mobxVersion),
37919
- hasMobxReact: workspaceFacts.hasMobxReact,
37920
- hasMobxReactLite: workspaceFacts.hasMobxReactLite,
37921
- hasMobxStateTree: workspaceFacts.hasMobxStateTree,
37922
- hasMobxReactObserver: workspaceFacts.hasMobxReactObserver,
37923
- zustandVersion,
37924
- zustandMajorVersion: zustandVersion === null ? null : getLowestDependencyMajor(zustandVersion),
37925
37742
  framework,
37926
37743
  hasTypeScript,
37927
37744
  hasReactCompiler: detectReactCompiler(directory, packageJson),
37928
37745
  hasReactCompilerLintPlugin: detectReactCompilerLintPlugin(directory, packageJson),
37929
- hasTanStackQuery: tanstackQueryVersion !== null,
37930
- hasI18nLibrary: workspaceFacts.hasI18nLibrary,
37931
- tanstackQueryVersion,
37932
- styledComponentsVersion: workspaceFacts.styledComponentsVersion,
37933
- valtioVersion,
37934
- valtioMajorVersion: valtioVersion === null ? null : getLowestDependencyMajor(valtioVersion),
37935
- hasRemotion: workspaceFacts.hasRemotionDependency,
37936
- remotionVersion,
37937
- remotionMajorVersion: remotionVersion === null ? null : getLowestDependencyMajor(remotionVersion),
37746
+ hasTanStackQuery: hasTanStackQuery(packageJson),
37938
37747
  hasSsrDependency: workspaceFacts.hasSsrDependency,
37939
37748
  preactVersion,
37940
37749
  preactMajorVersion: parseReactMajor(preactVersion),
@@ -38168,6 +37977,7 @@ const LEGACY_RULE_KEY_TO_NATIVE_RULE_KEY = {
38168
37977
  "react/jsx-no-new-function-as-prop": "react-doctor/jsx-no-new-function-as-prop",
38169
37978
  "react/jsx-no-new-object-as-prop": "react-doctor/jsx-no-new-object-as-prop",
38170
37979
  "react/jsx-no-script-url": "react-doctor/jsx-no-script-url",
37980
+ "react/jsx-no-target-blank": "react-doctor/jsx-no-target-blank",
38171
37981
  "react/jsx-no-undef": "react-doctor/jsx-no-undef",
38172
37982
  "react/jsx-no-useless-fragment": "react-doctor/jsx-no-useless-fragment",
38173
37983
  "react/jsx-pascal-case": "react-doctor/jsx-pascal-case",
@@ -40489,25 +40299,9 @@ const BABEL_CONFIG_FILE_NAMES = [
40489
40299
  ".babelrc.json"
40490
40300
  ];
40491
40301
  const LEGACY_PRESET_SPEC = "module:metro-react-native-babel-preset";
40492
- const LEGACY_PRESET_PACKAGE = "metro-react-native-babel-preset";
40493
- const REACT_NATIVE_PACKAGE = "react-native";
40494
- const PRESET_RENAME_MINIMUM_REACT_NATIVE_VERSION = "0.73.0";
40495
- const LEGACY_PRESET_REFERENCE = new RegExp(`['"]${LEGACY_PRESET_SPEC}['"]`);
40496
40302
  const MODERN_PRESET_REFERENCE = new RegExp(`['"]module:@react-native/babel-preset['"]`);
40497
40303
  const ENABLE_BABEL_RUNTIME_VERSION = /enableBabelRuntime["']?\s*:\s*['"]/;
40498
- const isReactNativeVersionAtLeastPresetRename = (rootDirectory, packageJson) => {
40499
- const installedReactNativeManifestPath = Path.join(rootDirectory, "node_modules", REACT_NATIVE_PACKAGE, "package.json");
40500
- const reactNativeVersionSpec = (isFile(installedReactNativeManifestPath) ? readPackageJson$1(installedReactNativeManifestPath).version : void 0) ?? getDependencySpec(packageJson, REACT_NATIVE_PACKAGE);
40501
- if (reactNativeVersionSpec === null || reactNativeVersionSpec === void 0) return false;
40502
- const normalizedVersionRange = import_semver.validRange(reactNativeVersionSpec);
40503
- if (normalizedVersionRange === null) return false;
40504
- const minimumVersion = import_semver.minVersion(normalizedVersionRange);
40505
- return minimumVersion !== null && import_semver.gte(minimumVersion, PRESET_RENAME_MINIMUM_REACT_NATIVE_VERSION);
40506
- };
40507
- const canResolveLegacyPreset = (rootDirectory, packageJson) => getDependencySpec(packageJson, LEGACY_PRESET_PACKAGE) !== null || isFile(Path.join(rootDirectory, "node_modules", LEGACY_PRESET_PACKAGE, "package.json"));
40508
40304
  const checkReactNativeMetroBabelPreset = (rootDirectory) => {
40509
- const packageJson = readPackageJson$1(Path.join(rootDirectory, "package.json"));
40510
- const shouldReportLegacyPreset = isReactNativeVersionAtLeastPresetRename(rootDirectory, packageJson) && !canResolveLegacyPreset(rootDirectory, packageJson);
40511
40305
  for (const fileName of BABEL_CONFIG_FILE_NAMES) {
40512
40306
  const filePath = Path.join(rootDirectory, fileName);
40513
40307
  if (!isFile(filePath)) continue;
@@ -40517,7 +40311,7 @@ const checkReactNativeMetroBabelPreset = (rootDirectory) => {
40517
40311
  } catch {
40518
40312
  continue;
40519
40313
  }
40520
- if (shouldReportLegacyPreset && LEGACY_PRESET_REFERENCE.test(contents)) return [buildReactNativeDiagnostic({
40314
+ if (contents.includes(LEGACY_PRESET_SPEC)) return [buildReactNativeDiagnostic({
40521
40315
  filePath: fileName,
40522
40316
  rule: "rn-no-metro-babel-preset",
40523
40317
  severity: "error",
@@ -40540,6 +40334,12 @@ const checkReactNativeProject = (rootDirectory, project) => {
40540
40334
  return [...checkReactNativeMetroBabelPreset(rootDirectory), ...checkReactNativeLibraryDependencies(rootDirectory)];
40541
40335
  };
40542
40336
  const RULE_KEY = "no-vulnerable-react-server-components";
40337
+ const DEPENDENCY_SECTIONS = [
40338
+ "dependencies",
40339
+ "devDependencies",
40340
+ "peerDependencies",
40341
+ "optionalDependencies"
40342
+ ];
40543
40343
  const REACT_RSC_ADVISORIES_BY_MINOR = {
40544
40344
  "19.0": {
40545
40345
  rceFixedVersion: "19.0.1",
@@ -40586,13 +40386,20 @@ const enumerateWorkspaceDirectories = (workspaceRoot) => {
40586
40386
  for (const pattern of patterns) for (const directory of resolveWorkspaceDirectories(workspaceRoot, pattern)) directories.add(directory);
40587
40387
  return [...directories];
40588
40388
  };
40389
+ const readDeclaredSpec = (packageJson, packageName) => {
40390
+ for (const section of DEPENDENCY_SECTIONS) {
40391
+ const spec = packageJson[section]?.[packageName];
40392
+ if (typeof spec === "string") return spec;
40393
+ }
40394
+ return null;
40395
+ };
40589
40396
  const resolveVersionInDirectory = (directory, packageName, declaredSpecOverride) => {
40590
40397
  const manifestPath = Path.join(directory, "node_modules", packageName, "package.json");
40591
40398
  if (isFile(manifestPath)) {
40592
40399
  const installedVersion = import_semver.valid(readPackageJson$1(manifestPath).version ?? null);
40593
40400
  if (installedVersion !== null) return installedVersion;
40594
40401
  }
40595
- const candidateSpecs = [getDependencySpec(readPackageJson$1(Path.join(directory, "package.json")), packageName), declaredSpecOverride];
40402
+ const candidateSpecs = [readDeclaredSpec(readPackageJson$1(Path.join(directory, "package.json")), packageName), declaredSpecOverride];
40596
40403
  for (const spec of candidateSpecs) {
40597
40404
  const pinnedVersion = spec === null ? null : import_semver.valid(spec);
40598
40405
  if (pinnedVersion !== null) return pinnedVersion;
@@ -41260,7 +41067,6 @@ const buildCapabilities = (project) => {
41260
41067
  if (CLIENT_ONLY_FRAMEWORKS.has(project.framework)) capabilities.add("client-only");
41261
41068
  if (project.isStaticExport) capabilities.add("nextjs:static-export");
41262
41069
  if (project.nextjsMajorVersion !== null && project.nextjsMajorVersion >= 15) capabilities.add("nextjs:15");
41263
- if (project.nextjsMajorVersion !== null && project.nextjsMajorVersion >= 16) capabilities.add("nextjs:16");
41264
41070
  addMajorLadder(capabilities, "react", project.reactMajorVersion, 17, 30);
41265
41071
  if (project.reactMajorVersion !== null && project.reactMajorVersion >= 19 && isMajorMinorAtLeast(parseReactMajorMinor(project.reactVersion), {
41266
41072
  major: 19,
@@ -41273,30 +41079,9 @@ const buildCapabilities = (project) => {
41273
41079
  })) capabilities.add("tailwind:3.4");
41274
41080
  if (project.zodVersion !== null) capabilities.add("zod");
41275
41081
  if (project.zodMajorVersion !== null && project.zodMajorVersion >= 4) capabilities.add("zod:4");
41276
- if (project.mobxVersion !== void 0 && project.mobxVersion !== null || project.hasMobxReact === true || project.hasMobxReactLite === true || project.hasMobxStateTree === true || project.hasMobxReactObserver === true) capabilities.add("mobx");
41277
- if (project.hasMobxReact === true) capabilities.add("mobx-react");
41278
- if (project.hasMobxReactLite === true) capabilities.add("mobx-react-lite");
41279
- if (project.hasMobxReact === true || project.hasMobxReactLite === true) capabilities.add("mobx-react-binding");
41280
- if (project.hasMobxStateTree === true) capabilities.add("mobx-state-tree");
41281
- if (project.hasMobxReactObserver === true) capabilities.add("mobx-react-observer");
41282
- if (project.mobxMajorVersion !== void 0 && project.mobxMajorVersion !== null && project.mobxMajorVersion >= 4 && project.mobxMajorVersion <= 6) addMajorLadder(capabilities, "mobx", project.mobxMajorVersion, 4, 6);
41283
- if (project.zustandVersion !== void 0 && project.zustandVersion !== null) capabilities.add("zustand");
41284
- if (project.zustandMajorVersion !== void 0 && project.zustandMajorVersion !== null && project.zustandMajorVersion >= 1 && project.zustandMajorVersion <= 5) addMajorLadder(capabilities, "zustand", project.zustandMajorVersion, 1, 5);
41285
41082
  if (project.isPreES2023Target) capabilities.add("pre-es2023");
41286
41083
  if (project.hasReactCompiler) capabilities.add("react-compiler");
41287
- if (Boolean(project.hasTanStackQuery) || Boolean(project.tanstackQueryVersion)) capabilities.add("tanstack-query");
41288
- if (project.styledComponentsVersion) {
41289
- capabilities.add("styled-components");
41290
- const styledComponentsMajor = getLowestDependencyMajor(project.styledComponentsVersion);
41291
- if (styledComponentsMajor !== null && styledComponentsMajor >= 6) capabilities.add("styled-components:6");
41292
- }
41293
- if (project.hasI18nLibrary) capabilities.add("i18n");
41294
- if (project.valtioVersion !== null) capabilities.add("valtio");
41295
- addMajorLadder(capabilities, "valtio", project.valtioMajorVersion, 1, 10);
41296
- if (project.hasRemotion) {
41297
- capabilities.add("remotion");
41298
- addMajorLadder(capabilities, "remotion", project.remotionMajorVersion ?? null, 4, 30);
41299
- }
41084
+ if (project.hasTanStackQuery) capabilities.add("tanstack-query");
41300
41085
  if (project.hasTypeScript) capabilities.add("typescript");
41301
41086
  if (project.preactVersion !== null) capabilities.add("preact");
41302
41087
  addMajorLadder(capabilities, "preact", project.preactMajorVersion, 10, 20);
@@ -43581,19 +43366,6 @@ const createSidecarLintCache = (cacheDirectory, rulesetHash) => {
43581
43366
  }
43582
43367
  };
43583
43368
  };
43584
- const fingerprintCacheByFilePath = /* @__PURE__ */ new Map();
43585
- const fingerprintFileContents = (filePath, fingerprintLength) => {
43586
- const fileStats = NFS.statSync(filePath, { bigint: true });
43587
- const cachedFingerprint = fingerprintCacheByFilePath.get(filePath);
43588
- if (cachedFingerprint?.modifiedTimeNanoseconds === fileStats.mtimeNs && cachedFingerprint.sizeBytes === fileStats.size) return cachedFingerprint.fingerprint;
43589
- const fingerprint = crypto.createHash("sha256").update(NFS.readFileSync(filePath)).digest("hex").slice(0, fingerprintLength);
43590
- fingerprintCacheByFilePath.set(filePath, {
43591
- fingerprint,
43592
- modifiedTimeNanoseconds: fileStats.mtimeNs,
43593
- sizeBytes: fileStats.size
43594
- });
43595
- return fingerprint;
43596
- };
43597
43369
  const bundledRequire$3 = createRequire(import.meta.url);
43598
43370
  const childNodeVersionByBinaryPath = /* @__PURE__ */ new Map();
43599
43371
  const resolveChildNodeVersion = (nodeBinaryPath) => {
@@ -43617,13 +43389,6 @@ const TOOLCHAIN_PACKAGE_SPECIFIERS$1 = [
43617
43389
  "oxlint-plugin-react-doctor/package.json",
43618
43390
  "eslint-plugin-react-hooks/package.json"
43619
43391
  ];
43620
- const resolvePluginFingerprint = () => {
43621
- try {
43622
- return fingerprintFileContents(bundledRequire$3.resolve("oxlint-plugin-react-doctor"), 16);
43623
- } catch {
43624
- return "unresolved";
43625
- }
43626
- };
43627
43392
  const resolveOxlintToolchainVersions = (nodeBinaryPath = process.execPath) => {
43628
43393
  const versions = [`node=${resolveChildNodeVersion(nodeBinaryPath)}`];
43629
43394
  for (const specifier of TOOLCHAIN_PACKAGE_SPECIFIERS$1) try {
@@ -43633,7 +43398,6 @@ const resolveOxlintToolchainVersions = (nodeBinaryPath = process.execPath) => {
43633
43398
  } catch {
43634
43399
  versions.push(`${specifier}=missing`);
43635
43400
  }
43636
- versions.push(`oxlint-plugin-react-doctor#fingerprint=${resolvePluginFingerprint()}`);
43637
43401
  return versions;
43638
43402
  };
43639
43403
  const esmRequire = createRequire(import.meta.url);
@@ -44327,17 +44091,12 @@ const REACT_ERROR_BOUNDARY_MESSAGE = "This try/catch cannot catch errors thrown
44327
44091
  const REACT_COMPILER_IMPACT = "This component misses React Compiler's automatic memoization & re-renders more than it should";
44328
44092
  const REACT_COMPILER_ACTION = "Rewrite the flagged code so the compiler can optimize it.";
44329
44093
  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`.";
44330
- const SET_STATE_IN_EFFECT_ACTION = "Prefer deriving or initializing the value before render. If the effect must read a browser API after mount, treat this as advisory or suppress it with `// react-doctor-disable-next-line react-hooks-js/set-state-in-effect`.";
44331
44094
  const REACT_COMPILER_GENERIC_MESSAGE = `${REACT_COMPILER_IMPACT}. ${REACT_COMPILER_ACTION}`;
44332
44095
  const buildReactCompilerMessage = (reasonSummary, action = REACT_COMPILER_ACTION) => {
44333
44096
  const normalizedSummary = reasonSummary.replace(TRAILING_PERIOD_PATTERN, "");
44334
44097
  if (!normalizedSummary) return `${REACT_COMPILER_IMPACT}. ${action}`;
44335
44098
  return `${REACT_COMPILER_IMPACT}: ${normalizedSummary}. ${action}`;
44336
44099
  };
44337
- const buildSetStateInEffectMessage = (reasonSummary) => {
44338
- const normalizedSummary = reasonSummary.replace(TRAILING_PERIOD_PATTERN, "");
44339
- return `This synchronous effect update causes an extra render${normalizedSummary ? `: ${normalizedSummary}` : ""}. ${SET_STATE_IN_EFFECT_ACTION}`;
44340
- };
44341
44100
  const PLUGIN_CATEGORY_MAP = {
44342
44101
  react: "Bugs",
44343
44102
  "react-hooks": "Bugs",
@@ -44395,10 +44154,6 @@ const resolveCleanedDiagnostic = (message, help, plugin, rule, project) => {
44395
44154
  message: REACT_ERROR_BOUNDARY_MESSAGE,
44396
44155
  help: reasonDetail || help
44397
44156
  };
44398
- if (rule === "set-state-in-effect") return {
44399
- message: buildSetStateInEffectMessage(reasonSummary.trim()),
44400
- help: reasonDetail || help
44401
- };
44402
44157
  return {
44403
44158
  message: buildReactCompilerMessage(reasonSummary.trim(), rule === "incompatible-library" ? REACT_COMPILER_INCOMPATIBLE_LIBRARY_ACTION : REACT_COMPILER_ACTION),
44404
44159
  help: appendReanimatedSharedValueHint(reasonDetail || help, rule, project)
@@ -47601,7 +47356,7 @@ const makeNoopConsole = () => ({
47601
47356
  });
47602
47357
  //#endregion
47603
47358
  //#region src/cli/utils/version.ts
47604
- const VERSION = "0.8.1-dev.cd9ca68";
47359
+ const VERSION = "0.8.1-dev.d970055";
47605
47360
  //#endregion
47606
47361
  //#region src/cli/utils/json-mode.ts
47607
47362
  let context = null;
@@ -47772,9 +47527,7 @@ const buildSentryProjectContext = (projectInfo) => ({
47772
47527
  reactMajorVersion: projectInfo.reactMajorVersion,
47773
47528
  hasTypeScript: projectInfo.hasTypeScript,
47774
47529
  hasReactCompiler: projectInfo.hasReactCompiler,
47775
- tanstackQueryVersion: projectInfo.tanstackQueryVersion,
47776
- mobxVersion: projectInfo.mobxVersion,
47777
- styledComponentsVersion: projectInfo.styledComponentsVersion,
47530
+ hasTanStackQuery: projectInfo.hasTanStackQuery,
47778
47531
  tailwindVersion: projectInfo.tailwindVersion,
47779
47532
  zodVersion: projectInfo.zodVersion,
47780
47533
  preactVersion: projectInfo.preactVersion,
@@ -47955,13 +47708,13 @@ const isDevVersion = (version) => version === "0.0.0" || version.includes("-");
47955
47708
  * uploads source-map artifacts under, so stack frames symbolicate. Honors the
47956
47709
  * standard `SENTRY_RELEASE` override.
47957
47710
  */
47958
- const resolveSentryRelease = () => process.env.SENTRY_RELEASE || `react-doctor@0.8.1-dev.cd9ca68`;
47711
+ const resolveSentryRelease = () => process.env.SENTRY_RELEASE || `react-doctor@0.8.1-dev.d970055`;
47959
47712
  /**
47960
47713
  * Deployment environment shown in Sentry's environment filter. Defaults to
47961
47714
  * `production` for tagged releases and `development` for dev/unbuilt versions,
47962
47715
  * overridable via the standard `SENTRY_ENVIRONMENT` env var.
47963
47716
  */
47964
- const resolveSentryEnvironment = () => process.env.SENTRY_ENVIRONMENT || (isDevVersion("0.8.1-dev.cd9ca68") ? "development" : "production");
47717
+ const resolveSentryEnvironment = () => process.env.SENTRY_ENVIRONMENT || (isDevVersion("0.8.1-dev.d970055") ? "development" : "production");
47965
47718
  /**
47966
47719
  * Performance-tracing sample rate in `[0, 1]`. Reads `SENTRY_TRACES_SAMPLE_RATE`
47967
47720
  * (set to `0` to disable tracing) and falls back to
@@ -66641,4 +66394,4 @@ Promise.resolve().then(() => assertNoRemovedFlags(process.argv)).then(() => prog
66641
66394
  export {};
66642
66395
 
66643
66396
  //# sourceMappingURL=cli.js.map
66644
- //# debugId=434800fc-200b-5a59-aa25-61e682ab57d7
66397
+ //# debugId=c24708ed-97a3-59cc-81f7-4cf277ab29f2
package/dist/index.d.ts CHANGED
@@ -9543,38 +9543,11 @@ interface ProjectInfo {
9543
9543
  zodVersion: string | null;
9544
9544
  /** Parsed major from `zodVersion`, or `null` when absent/unparseable. Mirrors `reactMajorVersion`. */
9545
9545
  zodMajorVersion: number | null;
9546
- /** Declared MobX core version spec. Optional so existing `ProjectInfo` consumers remain source-compatible. */
9547
- mobxVersion?: string | null;
9548
- /** Parsed major from `mobxVersion`, or `null` when absent/unparseable. */
9549
- mobxMajorVersion?: number | null;
9550
- hasMobxReact?: boolean;
9551
- hasMobxReactLite?: boolean;
9552
- hasMobxStateTree?: boolean;
9553
- hasMobxReactObserver?: boolean;
9554
- /** Declared Zustand version spec. Optional so existing `ProjectInfo` consumers remain source-compatible. */
9555
- zustandVersion?: string | null;
9556
- /** Parsed major from `zustandVersion`, or `null` when absent/unparseable. */
9557
- zustandMajorVersion?: number | null;
9558
9546
  framework: Framework;
9559
9547
  hasTypeScript: boolean;
9560
9548
  hasReactCompiler: boolean;
9561
9549
  hasReactCompilerLintPlugin?: boolean;
9562
9550
  hasTanStackQuery: boolean;
9563
- hasRemotion?: boolean;
9564
- remotionVersion?: string | null;
9565
- remotionMajorVersion?: number | null;
9566
- hasI18nLibrary?: boolean;
9567
- tanstackQueryVersion?: string | null;
9568
- styledComponentsVersion?: string | null;
9569
- /**
9570
- * The declared `valtio` version spec, or `null` when no package in the
9571
- * analyzed project declares Valtio. `useSnapshot` has kept the same
9572
- * render-read contract across Valtio 1 and 2, so presence alone drives the
9573
- * `valtio` capability and its parsed major-version ladder.
9574
- */
9575
- valtioVersion: string | null;
9576
- /** Parsed major from `valtioVersion`, or `null` when absent/unparseable. */
9577
- valtioMajorVersion: number | null;
9578
9551
  /**
9579
9552
  * `true` when the project or a workspace declares a Vite-based SSR runtime
9580
9553
  * such as React Router's Node adapter, Vike, or vite-plugin-ssr.