react-doctor 0.8.1-dev.f4aa821 → 0.8.1-dev.f5f13b8

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]="1b59ca76-9135-54e6-9391-ce7fec27b699")}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]="87efffda-8fc4-5b52-80e1-7ec503c85206")}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";
@@ -36022,44 +36022,6 @@ var AmbiguousProjectError = class extends Error {
36022
36022
  }
36023
36023
  };
36024
36024
  const isProjectDiscoveryError = (value) => value instanceof ProjectNotFoundError || value instanceof NoReactDependencyError || value instanceof PackageJsonNotFoundError || value instanceof NotADirectoryError || value instanceof AmbiguousProjectError;
36025
- const isErrnoException = (error) => error instanceof Error && "code" in error;
36026
- const IGNORABLE_READDIR_ERROR_CODES = new Set([
36027
- "EACCES",
36028
- "EPERM",
36029
- "ENOENT",
36030
- "ENOTDIR",
36031
- "EINVAL",
36032
- "ELOOP",
36033
- "ENAMETOOLONG"
36034
- ]);
36035
- const isIgnorableReaddirError = (error) => isErrnoException(error) && typeof error.code === "string" && IGNORABLE_READDIR_ERROR_CODES.has(error.code);
36036
- const readDirectoryEntries = (directoryPath) => {
36037
- try {
36038
- return NFS.readdirSync(directoryPath, { withFileTypes: true });
36039
- } catch (error) {
36040
- if (isIgnorableReaddirError(error)) return [];
36041
- throw error;
36042
- }
36043
- };
36044
- const isFile = (filePath) => {
36045
- try {
36046
- return NFS.statSync(filePath).isFile();
36047
- } catch {
36048
- return false;
36049
- }
36050
- };
36051
- const isDirectory = (directoryPath) => {
36052
- try {
36053
- return NFS.statSync(directoryPath).isDirectory();
36054
- } catch {
36055
- return false;
36056
- }
36057
- };
36058
- const isPlainObject = (value) => {
36059
- if (typeof value !== "object" || value === null || Array.isArray(value)) return false;
36060
- const prototype = Object.getPrototypeOf(value);
36061
- return prototype === null || prototype === Object.prototype;
36062
- };
36063
36025
  const SOURCE_FILE_PATTERN = /\.(tsx?|jsx?|mts|mjs)$/;
36064
36026
  const GENERATED_BUNDLE_FILE_PATTERN = /\.(iife|umd|global|min)\.m?js$/i;
36065
36027
  const GENERATED_SOURCE_DIRECTORY_PATTERN = /(?:^|\/)__generated__\//;
@@ -36101,6 +36063,58 @@ const IGNORED_DIRECTORIES = new Set([
36101
36063
  ]);
36102
36064
  const JSX_FILE_PATTERN = /\.(tsx|jsx)$/;
36103
36065
  const MILLISECONDS_PER_SECOND = 1e3;
36066
+ const REACT_ROUTER_CAPABILITY_THRESHOLDS = [
36067
+ {
36068
+ capability: "react-router:6.4",
36069
+ major: 6,
36070
+ minor: 4
36071
+ },
36072
+ {
36073
+ capability: "react-router:6.7",
36074
+ major: 6,
36075
+ minor: 7
36076
+ },
36077
+ {
36078
+ capability: "react-router:6.9",
36079
+ major: 6,
36080
+ minor: 9
36081
+ },
36082
+ {
36083
+ capability: "react-router:6.19",
36084
+ major: 6,
36085
+ minor: 19
36086
+ },
36087
+ {
36088
+ capability: "react-router:7",
36089
+ major: 7,
36090
+ minor: 0
36091
+ },
36092
+ {
36093
+ capability: "react-router:7.8",
36094
+ major: 7,
36095
+ minor: 8
36096
+ },
36097
+ {
36098
+ capability: "react-router:7.9",
36099
+ major: 7,
36100
+ minor: 9
36101
+ },
36102
+ {
36103
+ capability: "react-router:7.10",
36104
+ major: 7,
36105
+ minor: 10
36106
+ },
36107
+ {
36108
+ capability: "react-router:7.15",
36109
+ major: 7,
36110
+ minor: 15
36111
+ },
36112
+ {
36113
+ capability: "react-router:8",
36114
+ major: 8,
36115
+ minor: 0
36116
+ }
36117
+ ];
36104
36118
  const SCORE_API_URL = "https://www.react.doctor/api/score";
36105
36119
  const ENTERPRISE_CONTACT_URL = "https://react.doctor/enterprise";
36106
36120
  const SHARE_BASE_URL = "https://react.doctor/share";
@@ -36252,6 +36266,44 @@ const SUPPLY_CHAIN_OVERLAP_TIMEOUT_MS = 9e4;
36252
36266
  const SUPPLY_CHAIN_CACHE_TTL_MS = 864e5;
36253
36267
  const SUPPLY_CHAIN_CACHE_SUBDIR = "supply-chain";
36254
36268
  const SUPPLY_CHAIN_IGNORED_PACKAGES = new Set(["next"]);
36269
+ const isErrnoException = (error) => error instanceof Error && "code" in error;
36270
+ const IGNORABLE_READDIR_ERROR_CODES = new Set([
36271
+ "EACCES",
36272
+ "EPERM",
36273
+ "ENOENT",
36274
+ "ENOTDIR",
36275
+ "EINVAL",
36276
+ "ELOOP",
36277
+ "ENAMETOOLONG"
36278
+ ]);
36279
+ const isIgnorableReaddirError = (error) => isErrnoException(error) && typeof error.code === "string" && IGNORABLE_READDIR_ERROR_CODES.has(error.code);
36280
+ const readDirectoryEntries = (directoryPath) => {
36281
+ try {
36282
+ return NFS.readdirSync(directoryPath, { withFileTypes: true });
36283
+ } catch (error) {
36284
+ if (isIgnorableReaddirError(error)) return [];
36285
+ throw error;
36286
+ }
36287
+ };
36288
+ const isFile = (filePath) => {
36289
+ try {
36290
+ return NFS.statSync(filePath).isFile();
36291
+ } catch {
36292
+ return false;
36293
+ }
36294
+ };
36295
+ const isDirectory = (directoryPath) => {
36296
+ try {
36297
+ return NFS.statSync(directoryPath).isDirectory();
36298
+ } catch {
36299
+ return false;
36300
+ }
36301
+ };
36302
+ const isPlainObject = (value) => {
36303
+ if (typeof value !== "object" || value === null || Array.isArray(value)) return false;
36304
+ const prototype = Object.getPrototypeOf(value);
36305
+ return prototype === null || prototype === Object.prototype;
36306
+ };
36255
36307
  const lastSourceMappingUrl = (fileContent) => {
36256
36308
  const lastReference = [...fileContent.matchAll(/\/\/# sourceMappingURL=(\S+)/g)].at(-1);
36257
36309
  return lastReference ? lastReference[1] : null;
@@ -36571,10 +36623,10 @@ const FALLBACK_TSCONFIG_FILENAMES = ["tsconfig.app.json", "tsconfig.build.json"]
36571
36623
  const FRAMEWORK_PACKAGES = {
36572
36624
  next: "nextjs",
36573
36625
  "@tanstack/react-start": "tanstack-start",
36574
- vite: "vite",
36575
- "react-scripts": "cra",
36576
36626
  "@remix-run/react": "remix",
36577
36627
  gatsby: "gatsby",
36628
+ vite: "vite",
36629
+ "react-scripts": "cra",
36578
36630
  expo: "expo",
36579
36631
  "react-native": "react-native"
36580
36632
  };
@@ -36598,11 +36650,17 @@ const NEXT_CONFIG_FILENAMES = [
36598
36650
  ];
36599
36651
  const BABEL_CONFIG_FILENAMES = [
36600
36652
  ".babelrc",
36653
+ ".babelrc.js",
36601
36654
  ".babelrc.json",
36655
+ ".babelrc.cjs",
36656
+ ".babelrc.mjs",
36657
+ ".babelrc.cts",
36602
36658
  "babel.config.js",
36603
36659
  "babel.config.json",
36604
36660
  "babel.config.cjs",
36605
- "babel.config.mjs"
36661
+ "babel.config.mjs",
36662
+ "babel.config.ts",
36663
+ "babel.config.cts"
36606
36664
  ];
36607
36665
  const VITE_CONFIG_FILENAMES = [
36608
36666
  "vite.config.js",
@@ -36614,12 +36672,28 @@ const VITE_CONFIG_FILENAMES = [
36614
36672
  "vitest.config.ts",
36615
36673
  "vitest.config.js"
36616
36674
  ];
36675
+ const RSBUILD_CONFIG_FILENAMES = [
36676
+ "rsbuild.config.ts",
36677
+ "rsbuild.config.js",
36678
+ "rsbuild.config.mts",
36679
+ "rsbuild.config.mjs",
36680
+ "rsbuild.config.cts",
36681
+ "rsbuild.config.cjs"
36682
+ ];
36683
+ const RSPACK_CONFIG_FILENAMES = [
36684
+ "rspack.config.ts",
36685
+ "rspack.config.js",
36686
+ "rspack.config.mts",
36687
+ "rspack.config.mjs",
36688
+ "rspack.config.cts",
36689
+ "rspack.config.cjs"
36690
+ ];
36617
36691
  const EXPO_APP_CONFIG_FILENAMES = [
36618
36692
  "app.json",
36619
36693
  "app.config.js",
36620
36694
  "app.config.ts"
36621
36695
  ];
36622
- const REACT_COMPILER_PACKAGE_REFERENCE_PATTERN = /babel-plugin-react-compiler|react-compiler-runtime|["']react-compiler["']/;
36696
+ const REACT_COMPILER_PACKAGE_REFERENCE_PATTERN = /babel-plugin-react-compiler|react-compiler-runtime|reactCompilerPreset\s*\(|["']react-compiler["']/;
36623
36697
  const REACT_COMPILER_ENABLED_FLAG_PATTERN = /["']?reactCompiler["']?\s*:\s*(?:true\b|\{)/;
36624
36698
  const STATIC_EXPORT_OUTPUT_PATTERN = /(?:^|[^.\w])["']?output["']?\s*:\s*["']export["']/m;
36625
36699
  const hasCompilerPackage = (packageJson, compilerPackages) => {
@@ -36654,6 +36728,8 @@ const detectReactCompiler = (directory, packageJson) => {
36654
36728
  if (hasCompilerInConfigFiles(directory, NEXT_CONFIG_FILENAMES)) return true;
36655
36729
  if (hasCompilerInConfigFiles(directory, BABEL_CONFIG_FILENAMES)) return true;
36656
36730
  if (hasCompilerInConfigFiles(directory, VITE_CONFIG_FILENAMES)) return true;
36731
+ if (hasCompilerInConfigFiles(directory, RSBUILD_CONFIG_FILENAMES)) return true;
36732
+ if (hasCompilerInConfigFiles(directory, RSPACK_CONFIG_FILENAMES)) return true;
36657
36733
  if (hasCompilerInConfigFiles(directory, EXPO_APP_CONFIG_FILENAMES)) return true;
36658
36734
  return hasCompilerPackageInAncestors(directory, REACT_COMPILER_TRANSFORM_PACKAGES);
36659
36735
  };
@@ -36662,7 +36738,7 @@ const detectNextjsStaticExport = (directory) => NEXT_CONFIG_FILENAMES.some((file
36662
36738
  const filePath = Path.join(directory, filename);
36663
36739
  return isFile(filePath) && STATIC_EXPORT_OUTPUT_PATTERN.test(NFS.readFileSync(filePath, "utf-8"));
36664
36740
  });
36665
- const UNRESOLVABLE_PROTOCOL_VERSION = /^(?:file|git|github|https?|link|patch|portal|workspace|npm):/i;
36741
+ const UNRESOLVABLE_PROTOCOL_VERSION = /^(?:catalog|file|git|github|https?|link|patch|portal|workspace|npm):/i;
36666
36742
  const DIST_TAG_VERSION = /^[a-z][a-z0-9._-]*$/i;
36667
36743
  const WILDCARD_VERSION = /^[*xX](?:\.[*xX])*$/;
36668
36744
  const NPM_ALIAS_VERSION = /^npm:(?:@[^/]+\/[^@]+|[^@]+)@(.+)$/i;
@@ -36795,6 +36871,16 @@ const getLowestDependencyMajor = (version) => {
36795
36871
  }
36796
36872
  return lowestMajor;
36797
36873
  };
36874
+ const getDependencyMajorWithinSupportedRange = (version, latestSupportedMajor) => {
36875
+ const normalizedVersion = normalizeDependencyVersion(version);
36876
+ if (normalizedVersion === null) return null;
36877
+ const validRange = import_semver.validRange(normalizedVersion);
36878
+ if (validRange === null) return null;
36879
+ const minimumVersion = import_semver.minVersion(validRange);
36880
+ if (minimumVersion === null || minimumVersion.major > latestSupportedMajor) return null;
36881
+ if (import_semver.intersects(validRange, `>=${latestSupportedMajor + 1}.0.0`)) return null;
36882
+ return minimumVersion.major;
36883
+ };
36798
36884
  const isConcreteDependencyVersion = (version) => {
36799
36885
  const normalizedVersion = normalizeDependencyVersion(version);
36800
36886
  return normalizedVersion !== null && /\d/.test(normalizedVersion);
@@ -36838,9 +36924,18 @@ const parseReactMajorMinor = (reactVersion) => {
36838
36924
  };
36839
36925
  };
36840
36926
  const parseLowerBoundVersion = (versionSpec) => import_semver.validRange(versionSpec) !== null ? import_semver.minVersion(versionSpec) : import_semver.coerce(versionSpec);
36841
- const parseTailwindMajorMinor = (tailwindVersion) => {
36842
- if (typeof tailwindVersion !== "string") return null;
36843
- const trimmed = tailwindVersion.trim();
36927
+ const parseThreeRelease = (threeVersion) => {
36928
+ if (typeof threeVersion !== "string") return null;
36929
+ const normalizedVersion = normalizeDependencyVersion(threeVersion);
36930
+ if (normalizedVersion === null) return null;
36931
+ const lowerBound = parseLowerBoundVersion(normalizedVersion);
36932
+ if (lowerBound === null) return null;
36933
+ if (lowerBound.major > 0) return Number.MAX_SAFE_INTEGER;
36934
+ return lowerBound.minor > 0 ? lowerBound.minor : null;
36935
+ };
36936
+ const parseDependencyMajorMinor = (dependencyVersion) => {
36937
+ if (typeof dependencyVersion !== "string") return null;
36938
+ const trimmed = dependencyVersion.trim();
36844
36939
  if (trimmed.length === 0) return null;
36845
36940
  const lowerBound = parseLowerBoundVersion(trimmed);
36846
36941
  if (lowerBound === null || lowerBound.major <= 0) return null;
@@ -36849,6 +36944,7 @@ const parseTailwindMajorMinor = (tailwindVersion) => {
36849
36944
  minor: lowerBound.minor
36850
36945
  };
36851
36946
  };
36947
+ const parseTailwindMajorMinor = (tailwindVersion) => parseDependencyMajorMinor(tailwindVersion);
36852
36948
  const hasUpperBoundOnlyPeerRange = (range) => {
36853
36949
  if (typeof range !== "string") return false;
36854
36950
  const normalizedRange = normalizeDependencyVersion(range);
@@ -36870,7 +36966,7 @@ const resolveEffectiveReactMajor = (reactVersion, packageJson) => {
36870
36966
  if (peerFloor === null) return hasUpperBoundOnlyPeerRange(peerReactRange) ? null : installedReactMajor;
36871
36967
  return installedReactMajor !== null ? Math.min(installedReactMajor, peerFloor) : peerFloor;
36872
36968
  };
36873
- const isCatalogReference = (version) => version.startsWith("catalog:");
36969
+ const isCatalogReference = (version) => typeof version === "string" && version.startsWith("catalog:");
36874
36970
  const extractCatalogName = (version) => {
36875
36971
  if (!isCatalogReference(version)) return null;
36876
36972
  const name = version.slice(8).trim();
@@ -37020,6 +37116,12 @@ const TAILWIND_ZOD_SECTIONS = [
37020
37116
  "devDependencies",
37021
37117
  "peerDependencies"
37022
37118
  ];
37119
+ const DEPENDENCY_SPEC_SECTIONS = [
37120
+ "dependencies",
37121
+ "devDependencies",
37122
+ "peerDependencies",
37123
+ "optionalDependencies"
37124
+ ];
37023
37125
  const EMPTY_DEPENDENCY_INFO = {
37024
37126
  reactVersion: null,
37025
37127
  tailwindVersion: null,
@@ -37029,7 +37131,7 @@ const EMPTY_DEPENDENCY_INFO = {
37029
37131
  const pickConcreteVersion = (packageJson, packageName, sections) => {
37030
37132
  for (const section of sections) {
37031
37133
  const version = packageJson[section]?.[packageName];
37032
- if (version === void 0) continue;
37134
+ if (typeof version !== "string") continue;
37033
37135
  if (isCatalogReference(version)) return null;
37034
37136
  if (isConcreteDependencyVersion(version)) return version;
37035
37137
  }
@@ -37061,13 +37163,16 @@ const extractDependencyInfo = (packageJson) => {
37061
37163
  };
37062
37164
  };
37063
37165
  const getDependencySpec = (packageJson, packageName) => {
37064
- const spec = packageJson.dependencies?.[packageName] ?? packageJson.devDependencies?.[packageName] ?? packageJson.peerDependencies?.[packageName] ?? packageJson.optionalDependencies?.[packageName];
37065
- return typeof spec === "string" ? spec : null;
37166
+ for (const section of DEPENDENCY_SPEC_SECTIONS) {
37167
+ const spec = packageJson[section]?.[packageName];
37168
+ if (typeof spec === "string") return spec;
37169
+ }
37170
+ return null;
37066
37171
  };
37067
37172
  const getDependencyDeclaration = ({ packageJson, packageName, sections }) => {
37068
37173
  for (const section of sections) {
37069
37174
  const version = packageJson[section]?.[packageName];
37070
- if (version === void 0) continue;
37175
+ if (typeof version !== "string") continue;
37071
37176
  return {
37072
37177
  catalogReference: extractCatalogName(version) ?? null,
37073
37178
  hasDeclaration: true,
@@ -37101,24 +37206,15 @@ const getPreactVersion = (packageJson) => {
37101
37206
  ...packageJson.devDependencies
37102
37207
  }.preact ?? null;
37103
37208
  };
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
- };
37117
- const resolveCatalogBackedDependencyVersion = ({ rootDirectory, rootPackageJson, packageName, version }) => {
37209
+ const resolveCatalogBackedDependencyVersion = ({ rootDirectory, rootPackageJson, packageName, sourceDirectory = rootDirectory, sourcePackageJson = rootPackageJson, version }) => {
37118
37210
  if (version === null || !isCatalogReference(version)) return version;
37119
37211
  const catalogName = extractCatalogName(version);
37120
- const resolvedLocalVersion = resolveCatalogVersion(rootPackageJson, packageName, rootDirectory, catalogName);
37121
- if (resolvedLocalVersion) return resolvedLocalVersion;
37212
+ const resolvedSourceVersion = resolveCatalogVersion(sourcePackageJson, packageName, sourceDirectory, catalogName);
37213
+ if (resolvedSourceVersion) return resolvedSourceVersion;
37214
+ if (sourceDirectory !== rootDirectory || sourcePackageJson !== rootPackageJson) {
37215
+ const resolvedRootVersion = resolveCatalogVersion(rootPackageJson, packageName, rootDirectory, catalogName);
37216
+ if (resolvedRootVersion) return resolvedRootVersion;
37217
+ }
37122
37218
  const monorepoRoot = findMonorepoRoot(rootDirectory);
37123
37219
  if (!monorepoRoot) return version;
37124
37220
  const monorepoPackageJsonPath = Path.join(monorepoRoot, "package.json");
@@ -37316,7 +37412,84 @@ const listWorkspacePackages = (rootDirectory) => {
37316
37412
  }
37317
37413
  return packages;
37318
37414
  };
37415
+ const PREFERRED_DEPENDENCY_SECTIONS = [
37416
+ "dependencies",
37417
+ "peerDependencies",
37418
+ "devDependencies"
37419
+ ];
37420
+ const getPreferredDependencyVersion = ({ packageJson, packageNames }) => {
37421
+ for (const packageName of packageNames) {
37422
+ const declaration = getDependencyDeclaration({
37423
+ packageJson,
37424
+ packageName,
37425
+ sections: PREFERRED_DEPENDENCY_SECTIONS
37426
+ });
37427
+ if (declaration.version !== null) return declaration.version;
37428
+ }
37429
+ return null;
37430
+ };
37431
+ const TANSTACK_REACT_QUERY_PACKAGES = ["@tanstack/react-query", "react-query"];
37432
+ const getTanStackQueryVersion = (packageJson) => {
37433
+ return getPreferredDependencyVersion({
37434
+ packageJson,
37435
+ packageNames: TANSTACK_REACT_QUERY_PACKAGES
37436
+ });
37437
+ };
37438
+ const STYLED_COMPONENTS_PACKAGES = ["styled-components"];
37439
+ const getStyledComponentsVersion = (packageJson) => {
37440
+ return getPreferredDependencyVersion({
37441
+ packageJson,
37442
+ packageNames: STYLED_COMPONENTS_PACKAGES
37443
+ });
37444
+ };
37445
+ const I18N_PACKAGES = [
37446
+ "i18next",
37447
+ "react-i18next",
37448
+ "next-i18next",
37449
+ "react-intl",
37450
+ "next-intl",
37451
+ "use-intl",
37452
+ "@formatjs/intl",
37453
+ "@lingui/core",
37454
+ "@lingui/react",
37455
+ "typesafe-i18n",
37456
+ "@tolgee/react",
37457
+ "react-intl-universal"
37458
+ ];
37459
+ const hasI18nDependency = (packageJson) => {
37460
+ const allDependencies = {
37461
+ ...packageJson.peerDependencies,
37462
+ ...packageJson.dependencies,
37463
+ ...packageJson.devDependencies,
37464
+ ...packageJson.optionalDependencies
37465
+ };
37466
+ return I18N_PACKAGES.some((packageName) => allDependencies[packageName] !== void 0);
37467
+ };
37319
37468
  const REANIMATED_DEPENDENCY_NAME = "react-native-reanimated";
37469
+ const MOBX_REACT_PACKAGE_NAME = "mobx-react";
37470
+ const MOBX_REACT_LITE_PACKAGE_NAME = "mobx-react-lite";
37471
+ const MOBX_STATE_TREE_PACKAGE_NAME = "mobx-state-tree";
37472
+ const MOBX_REACT_OBSERVER_PACKAGE_NAME = "mobx-react-observer";
37473
+ const REACT_THREE_FIBER_DEPENDENCY_NAMES = ["@react-three/fiber", "react-three-fiber"];
37474
+ const REACT_THREE_FIBER_SECTIONS = [
37475
+ "dependencies",
37476
+ "peerDependencies",
37477
+ "optionalDependencies",
37478
+ "devDependencies"
37479
+ ];
37480
+ const THREE_DEPENDENCY_SECTIONS = [
37481
+ "dependencies",
37482
+ "peerDependencies",
37483
+ "optionalDependencies",
37484
+ "devDependencies"
37485
+ ];
37486
+ const REACT_THREE_FIBER_ECOSYSTEM_DEPENDENCY_NAMES = [...REACT_THREE_FIBER_DEPENDENCY_NAMES, "@react-three/drei"];
37487
+ const THREE_DEPENDENCY_NAMES = [...REACT_THREE_FIBER_ECOSYSTEM_DEPENDENCY_NAMES, "three"];
37488
+ const REACT_ROUTER_DEPENDENCY_NAMES = [
37489
+ "@react-router/dev",
37490
+ "react-router-dom",
37491
+ "react-router"
37492
+ ];
37320
37493
  const SHOPIFY_FLASH_LIST_PACKAGE_NAME = "@shopify/flash-list";
37321
37494
  const resolveWorkspaceDependencyVersion = ({ concreteVersion, packageName, rootDirectory, rootPackageJson, sections, workspaceDirectory, workspacePackageJson }) => {
37322
37495
  const dependencyDeclaration = getDependencyDeclaration({
@@ -37327,7 +37500,7 @@ const resolveWorkspaceDependencyVersion = ({ concreteVersion, packageName, rootD
37327
37500
  if (!dependencyDeclaration.hasDeclaration) return null;
37328
37501
  return concreteVersion ?? resolveCatalogVersion(workspacePackageJson, packageName, workspaceDirectory, dependencyDeclaration.catalogReference) ?? resolveCatalogVersion(rootPackageJson, packageName, rootDirectory, dependencyDeclaration.catalogReference);
37329
37502
  };
37330
- const shouldReplaceReactVersion = (currentVersion, nextVersion) => {
37503
+ const shouldReplaceWithLowerMajor = (currentVersion, nextVersion) => {
37331
37504
  if (!currentVersion) return true;
37332
37505
  const currentMajor = parseReactMajor(currentVersion);
37333
37506
  const nextMajor = parseReactMajor(nextVersion);
@@ -37335,6 +37508,70 @@ const shouldReplaceReactVersion = (currentVersion, nextVersion) => {
37335
37508
  if (nextMajor === null) return false;
37336
37509
  return nextMajor < currentMajor;
37337
37510
  };
37511
+ const shouldReplaceSupportedDependencyFact = (currentFact, nextFact, latestSupportedMajor) => {
37512
+ if (currentFact.version === null) return true;
37513
+ if (nextFact.version === null) return false;
37514
+ const currentMajor = getLowestDependencyMajor(currentFact.version);
37515
+ const nextMajor = getLowestDependencyMajor(nextFact.version);
37516
+ if (currentMajor === null) return false;
37517
+ if (nextMajor === null) return true;
37518
+ if (currentMajor > latestSupportedMajor) return false;
37519
+ if (nextMajor > latestSupportedMajor) return true;
37520
+ return nextMajor < currentMajor;
37521
+ };
37522
+ const shouldReplaceStyledComponentsVersion = (currentVersion, nextVersion) => {
37523
+ if (!currentVersion) return true;
37524
+ const currentMajor = getLowestDependencyMajor(currentVersion);
37525
+ const nextMajor = getLowestDependencyMajor(nextVersion);
37526
+ if (currentMajor === null) return nextMajor !== null && nextMajor < 6;
37527
+ if (nextMajor === null) return currentMajor >= 6;
37528
+ return nextMajor < currentMajor;
37529
+ };
37530
+ const selectOldestDependencyVersion = (currentVersion, nextVersion) => {
37531
+ if (currentVersion === null || nextVersion === null) return null;
37532
+ const current = parseDependencyMajorMinor(currentVersion);
37533
+ const next = parseDependencyMajorMinor(nextVersion);
37534
+ if (current === null) return currentVersion;
37535
+ if (next === null) return nextVersion;
37536
+ if (next.major !== current.major) return next.major < current.major ? nextVersion : currentVersion;
37537
+ return next.minor < current.minor ? nextVersion : currentVersion;
37538
+ };
37539
+ const shouldReplaceMobxFact = (currentFact, nextFact) => {
37540
+ if (currentFact.sourceDirectory === null) return true;
37541
+ if (currentFact.version === null) return false;
37542
+ if (nextFact.version === null) return true;
37543
+ const currentMajor = getDependencyMajorWithinSupportedRange(currentFact.version, 6);
37544
+ const nextMajor = getDependencyMajorWithinSupportedRange(nextFact.version, 6);
37545
+ if (currentMajor === null) return false;
37546
+ if (nextMajor === null) return true;
37547
+ return selectOldestDependencyVersion(currentFact.version, nextFact.version) === nextFact.version;
37548
+ };
37549
+ const collectBindingVersion = (facts, packageJson, directory, packageName) => {
37550
+ const version = getDependencySpec(packageJson, packageName);
37551
+ if (version === null) return;
37552
+ const resolvedVersion = resolveCatalogBackedDependencyVersion({
37553
+ rootDirectory: directory,
37554
+ rootPackageJson: packageJson,
37555
+ packageName,
37556
+ version
37557
+ });
37558
+ if (packageName === MOBX_REACT_PACKAGE_NAME) {
37559
+ facts.mobxReactVersion = facts.hasMobxReact ? selectOldestDependencyVersion(facts.mobxReactVersion, resolvedVersion) : resolvedVersion;
37560
+ facts.hasMobxReact = true;
37561
+ return;
37562
+ }
37563
+ facts.mobxReactLiteVersion = facts.hasMobxReactLite ? selectOldestDependencyVersion(facts.mobxReactLiteVersion, resolvedVersion) : resolvedVersion;
37564
+ facts.hasMobxReactLite = true;
37565
+ };
37566
+ const shouldReplaceReactRouterVersion = (currentVersion, nextVersion) => {
37567
+ if (currentVersion === null) return true;
37568
+ const current = parseReactMajorMinor(currentVersion);
37569
+ const next = parseReactMajorMinor(nextVersion);
37570
+ if (current === null) return next !== null;
37571
+ if (next === null) return false;
37572
+ if (next.major !== current.major) return next.major < current.major;
37573
+ return next.minor < current.minor;
37574
+ };
37338
37575
  const evaluateManifestFacts = (facts, packageJson, directory, rootDirectory, rootPackageJson) => {
37339
37576
  if (facts.expo.version === null) {
37340
37577
  const spec = getDependencySpec(packageJson, "expo");
@@ -37350,6 +37587,23 @@ const evaluateManifestFacts = (facts, packageJson, directory, rootDirectory, roo
37350
37587
  sourceDirectory: directory
37351
37588
  };
37352
37589
  }
37590
+ for (const packageName of REACT_ROUTER_DEPENDENCY_NAMES) {
37591
+ const resolvedSpec = resolveCatalogBackedDependencyVersion({
37592
+ rootDirectory,
37593
+ rootPackageJson,
37594
+ sourceDirectory: directory,
37595
+ sourcePackageJson: packageJson,
37596
+ packageName,
37597
+ version: getDependencySpec(packageJson, packageName)
37598
+ });
37599
+ if (resolvedSpec === null || !shouldReplaceReactRouterVersion(facts.reactRouter.version, resolvedSpec)) continue;
37600
+ facts.reactRouter = {
37601
+ version: resolvedSpec,
37602
+ sourceDirectory: directory,
37603
+ packageName
37604
+ };
37605
+ }
37606
+ facts.hasReactRouterFramework = facts.hasReactRouterFramework || getDependencySpec(packageJson, "@react-router/dev") !== null;
37353
37607
  if (facts.shopifyFlashList.version === null) {
37354
37608
  const spec = getDependencySpec(packageJson, SHOPIFY_FLASH_LIST_PACKAGE_NAME);
37355
37609
  if (spec !== null) facts.shopifyFlashList = {
@@ -37357,6 +37611,36 @@ const evaluateManifestFacts = (facts, packageJson, directory, rootDirectory, roo
37357
37611
  sourceDirectory: directory
37358
37612
  };
37359
37613
  }
37614
+ const mobxSpec = getDependencySpec(packageJson, "mobx");
37615
+ if (mobxSpec !== null) {
37616
+ const nextMobxFact = {
37617
+ version: resolveCatalogBackedDependencyVersion({
37618
+ rootDirectory: directory,
37619
+ rootPackageJson: packageJson,
37620
+ packageName: "mobx",
37621
+ version: mobxSpec
37622
+ }),
37623
+ sourceDirectory: directory
37624
+ };
37625
+ if (shouldReplaceMobxFact(facts.mobx, nextMobxFact)) facts.mobx = nextMobxFact;
37626
+ }
37627
+ collectBindingVersion(facts, packageJson, directory, MOBX_REACT_PACKAGE_NAME);
37628
+ collectBindingVersion(facts, packageJson, directory, MOBX_REACT_LITE_PACKAGE_NAME);
37629
+ facts.hasMobxStateTree = facts.hasMobxStateTree || getDependencySpec(packageJson, MOBX_STATE_TREE_PACKAGE_NAME) !== null;
37630
+ facts.hasMobxReactObserver = facts.hasMobxReactObserver || getDependencySpec(packageJson, MOBX_REACT_OBSERVER_PACKAGE_NAME) !== null;
37631
+ const zustandSpec = getDependencySpec(packageJson, "zustand");
37632
+ if (zustandSpec !== null) {
37633
+ const nextZustandFact = {
37634
+ version: resolveCatalogBackedDependencyVersion({
37635
+ rootDirectory: directory,
37636
+ rootPackageJson: packageJson,
37637
+ packageName: "zustand",
37638
+ version: zustandSpec
37639
+ }),
37640
+ sourceDirectory: directory
37641
+ };
37642
+ if (shouldReplaceSupportedDependencyFact(facts.zustand, nextZustandFact, 5)) facts.zustand = nextZustandFact;
37643
+ }
37360
37644
  if (facts.reanimatedVersion === null) {
37361
37645
  const spec = getDependencySpec(packageJson, REANIMATED_DEPENDENCY_NAME);
37362
37646
  if (spec !== null) facts.reanimatedVersion = spec;
@@ -37365,6 +37649,52 @@ const evaluateManifestFacts = (facts, packageJson, directory, rootDirectory, roo
37365
37649
  const spec = getDependencySpec(packageJson, "valtio");
37366
37650
  if (spec !== null) facts.valtioVersion = spec;
37367
37651
  }
37652
+ facts.tanstackQueryVersion ??= getTanStackQueryVersion(packageJson);
37653
+ const styledComponentsVersion = resolveCatalogBackedDependencyVersion({
37654
+ rootDirectory: directory,
37655
+ rootPackageJson: packageJson,
37656
+ packageName: "styled-components",
37657
+ version: getStyledComponentsVersion(packageJson)
37658
+ });
37659
+ if (styledComponentsVersion && shouldReplaceStyledComponentsVersion(facts.styledComponentsVersion, styledComponentsVersion)) facts.styledComponentsVersion = styledComponentsVersion;
37660
+ facts.hasI18nLibrary = facts.hasI18nLibrary || hasI18nDependency(packageJson);
37661
+ for (const packageName of REACT_THREE_FIBER_DEPENDENCY_NAMES) {
37662
+ const version = resolveCatalogBackedDependencyVersion({
37663
+ rootDirectory,
37664
+ rootPackageJson,
37665
+ sourceDirectory: directory,
37666
+ sourcePackageJson: packageJson,
37667
+ packageName,
37668
+ version: getDependencyDeclaration({
37669
+ packageName,
37670
+ packageJson,
37671
+ sections: REACT_THREE_FIBER_SECTIONS
37672
+ }).version
37673
+ });
37674
+ if (version === null) continue;
37675
+ if (shouldReplaceWithLowerMajor(facts.reactThreeFiber.version, version)) facts.reactThreeFiber = {
37676
+ packageName,
37677
+ version,
37678
+ sourceDirectory: directory
37679
+ };
37680
+ }
37681
+ const threeVersion = resolveCatalogBackedDependencyVersion({
37682
+ rootDirectory,
37683
+ rootPackageJson,
37684
+ sourceDirectory: directory,
37685
+ sourcePackageJson: packageJson,
37686
+ packageName: "three",
37687
+ version: getDependencyDeclaration({
37688
+ packageName: "three",
37689
+ packageJson,
37690
+ sections: THREE_DEPENDENCY_SECTIONS
37691
+ }).version
37692
+ });
37693
+ if (threeVersion !== null) {
37694
+ const currentRelease = parseThreeRelease(facts.threeVersion);
37695
+ const nextRelease = parseThreeRelease(threeVersion);
37696
+ if (facts.threeVersion === null || nextRelease !== null && (currentRelease === null || nextRelease < currentRelease)) facts.threeVersion = threeVersion;
37697
+ }
37368
37698
  facts.hasReactNativeAwarePackage = facts.hasReactNativeAwarePackage || isPackageJsonReactNativeAware(packageJson);
37369
37699
  facts.hasReanimatedAwarePackage = facts.hasReanimatedAwarePackage || isPackageJsonReanimatedAware(packageJson);
37370
37700
  facts.hasSsrDependency = facts.hasSsrDependency || isPackageJsonSsrAware(packageJson);
@@ -37386,6 +37716,8 @@ const evaluateManifestFacts = (facts, packageJson, directory, rootDirectory, roo
37386
37716
  if (currentRemotionMajorVersion === null || remotionMajorVersion < currentRemotionMajorVersion) facts.remotionVersion = resolvedRemotionVersion;
37387
37717
  }
37388
37718
  }
37719
+ facts.hasThree = facts.hasThree || THREE_DEPENDENCY_NAMES.some((dependencyName) => getDependencySpec(packageJson, dependencyName) !== null);
37720
+ facts.hasReactThreeFiber = facts.hasReactThreeFiber || REACT_THREE_FIBER_ECOSYSTEM_DEPENDENCY_NAMES.some((dependencyName) => getDependencySpec(packageJson, dependencyName) !== null);
37389
37721
  };
37390
37722
  const collectWorkspaceFacts = (rootDirectory, rootPackageJson, { collectReactGroup }) => {
37391
37723
  const facts = {
@@ -37401,24 +37733,55 @@ const collectWorkspaceFacts = (rootDirectory, rootPackageJson, { collectReactGro
37401
37733
  version: null,
37402
37734
  sourceDirectory: null
37403
37735
  },
37736
+ reactRouter: {
37737
+ version: null,
37738
+ sourceDirectory: null,
37739
+ packageName: null
37740
+ },
37404
37741
  shopifyFlashList: {
37405
37742
  version: null,
37406
37743
  sourceDirectory: null
37407
37744
  },
37408
37745
  valtioVersion: null,
37746
+ mobx: {
37747
+ version: null,
37748
+ sourceDirectory: null
37749
+ },
37750
+ hasMobxReact: false,
37751
+ mobxReactVersion: null,
37752
+ hasMobxReactLite: false,
37753
+ mobxReactLiteVersion: null,
37754
+ hasMobxStateTree: false,
37755
+ hasMobxReactObserver: false,
37756
+ zustand: {
37757
+ version: null,
37758
+ sourceDirectory: null
37759
+ },
37760
+ tanstackQueryVersion: null,
37761
+ styledComponentsVersion: null,
37762
+ hasI18nLibrary: false,
37409
37763
  hasReactNativeAwarePackage: false,
37410
37764
  hasReanimatedAwarePackage: false,
37411
37765
  hasSsrDependency: false,
37412
37766
  hasRemotionDependency: false,
37413
37767
  hasUnknownRemotionVersion: false,
37414
37768
  remotionVersion: null,
37769
+ hasThree: false,
37770
+ threeVersion: null,
37771
+ hasReactThreeFiber: false,
37772
+ reactThreeFiber: {
37773
+ packageName: null,
37774
+ version: null,
37775
+ sourceDirectory: null
37776
+ },
37777
+ hasReactRouterFramework: false,
37415
37778
  reanimatedVersion: null
37416
37779
  };
37417
37780
  evaluateManifestFacts(facts, rootPackageJson, rootDirectory, rootDirectory, rootPackageJson);
37418
37781
  let isReactGroupSettled = !collectReactGroup;
37419
37782
  const visitedDirectories = /* @__PURE__ */ new Set();
37420
37783
  for (const pattern of getWorkspacePatterns(rootDirectory, rootPackageJson)) {
37421
- const directories = [...resolveWorkspaceDirectories(rootDirectory, pattern)].sort();
37784
+ const directories = resolveWorkspaceDirectories(rootDirectory, pattern).toSorted();
37422
37785
  for (const workspaceDirectory of directories) {
37423
37786
  if (visitedDirectories.has(workspaceDirectory)) continue;
37424
37787
  visitedDirectories.add(workspaceDirectory);
@@ -37454,7 +37817,7 @@ const collectWorkspaceFacts = (rootDirectory, rootPackageJson, { collectReactGro
37454
37817
  workspaceDirectory,
37455
37818
  workspacePackageJson
37456
37819
  });
37457
- if (reactVersion && shouldReplaceReactVersion(facts.reactVersion, reactVersion)) facts.reactVersion = reactVersion;
37820
+ if (reactVersion && shouldReplaceWithLowerMajor(facts.reactVersion, reactVersion)) facts.reactVersion = reactVersion;
37458
37821
  if (tailwindVersion && !facts.tailwindVersion) facts.tailwindVersion = tailwindVersion;
37459
37822
  if (zodVersion && !facts.zodVersion) facts.zodVersion = zodVersion;
37460
37823
  const settledReactMajor = parseReactMajor(facts.reactVersion);
@@ -37644,6 +38007,16 @@ const discoverProjectWithoutPackageJson = (directory) => {
37644
38007
  tailwindVersion: null,
37645
38008
  zodVersion: null,
37646
38009
  zodMajorVersion: null,
38010
+ mobxVersion: null,
38011
+ mobxMajorVersion: null,
38012
+ hasMobxReact: false,
38013
+ mobxReactVersion: null,
38014
+ hasMobxReactLite: false,
38015
+ mobxReactLiteVersion: null,
38016
+ hasMobxStateTree: false,
38017
+ hasMobxReactObserver: false,
38018
+ zustandVersion: null,
38019
+ zustandMajorVersion: null,
37647
38020
  framework: "unknown",
37648
38021
  hasTypeScript: hasOwnTsConfig,
37649
38022
  hasReactCompiler: false,
@@ -37654,12 +38027,23 @@ const discoverProjectWithoutPackageJson = (directory) => {
37654
38027
  hasRemotion: false,
37655
38028
  remotionVersion: null,
37656
38029
  remotionMajorVersion: null,
38030
+ hasI18nLibrary: false,
38031
+ tanstackQueryVersion: null,
38032
+ styledComponentsVersion: null,
38033
+ hasThree: false,
38034
+ threeVersion: null,
38035
+ threeRelease: null,
38036
+ hasReactThreeFiber: false,
38037
+ reactThreeFiberVersion: null,
38038
+ reactThreeFiberMajorVersion: null,
37657
38039
  hasSsrDependency: false,
37658
38040
  preactVersion: null,
37659
38041
  preactMajorVersion: null,
37660
38042
  hasReactNativeWorkspace: false,
37661
38043
  nextjsVersion: null,
37662
38044
  nextjsMajorVersion: null,
38045
+ reactRouterVersion: null,
38046
+ hasReactRouterFramework: false,
37663
38047
  expoVersion: null,
37664
38048
  shopifyFlashListVersion: null,
37665
38049
  shopifyFlashListMajorVersion: null,
@@ -37752,6 +38136,12 @@ const discoverProject = (directory) => {
37752
38136
  packageName: SHOPIFY_FLASH_LIST_PACKAGE_NAME,
37753
38137
  version: workspaceFacts.shopifyFlashList.version
37754
38138
  }) : null;
38139
+ const zustandVersion = resolveCatalogBackedDependencyVersion({
38140
+ rootDirectory: directory,
38141
+ rootPackageJson: packageJson,
38142
+ packageName: "zustand",
38143
+ version: workspaceFacts.zustand.version
38144
+ });
37755
38145
  const hasReanimated = hasReactNativeWorkspace && workspaceFacts.hasReanimatedAwarePackage;
37756
38146
  const reanimatedVersion = hasReanimated ? workspaceFacts.reanimatedVersion : null;
37757
38147
  const nextjsVersion = framework === "nextjs" ? resolveCatalogBackedDependencyVersion({
@@ -37766,8 +38156,33 @@ const discoverProject = (directory) => {
37766
38156
  packageName: "valtio",
37767
38157
  version: workspaceFacts.valtioVersion
37768
38158
  });
38159
+ const mobxVersion = resolveCatalogBackedDependencyVersion({
38160
+ rootDirectory: directory,
38161
+ rootPackageJson: packageJson,
38162
+ packageName: "mobx",
38163
+ version: workspaceFacts.mobx.version
38164
+ });
38165
+ const reactRouterVersion = workspaceFacts.reactRouter.packageName === null ? null : resolveCatalogBackedDependencyVersion({
38166
+ rootDirectory: directory,
38167
+ rootPackageJson: packageJson,
38168
+ packageName: workspaceFacts.reactRouter.packageName,
38169
+ version: workspaceFacts.reactRouter.version
38170
+ });
37769
38171
  const preactVersion = getPreactVersion(packageJson);
37770
38172
  const remotionVersion = workspaceFacts.remotionVersion;
38173
+ const tanstackQueryVersion = getTanStackQueryVersion(packageJson) ?? workspaceFacts.tanstackQueryVersion;
38174
+ const reactThreeFiberVersion = workspaceFacts.reactThreeFiber.packageName ? resolveCatalogBackedDependencyVersion({
38175
+ rootDirectory: directory,
38176
+ rootPackageJson: packageJson,
38177
+ packageName: workspaceFacts.reactThreeFiber.packageName,
38178
+ version: workspaceFacts.reactThreeFiber.version
38179
+ }) : null;
38180
+ const threeVersion = resolveCatalogBackedDependencyVersion({
38181
+ rootDirectory: directory,
38182
+ rootPackageJson: packageJson,
38183
+ packageName: "three",
38184
+ version: workspaceFacts.threeVersion
38185
+ });
37771
38186
  const isPreES2023Target = hasTypeScript && detectPreES2023Target(directory);
37772
38187
  const projectInfo = {
37773
38188
  rootDirectory: directory,
@@ -37777,22 +38192,43 @@ const discoverProject = (directory) => {
37777
38192
  tailwindVersion,
37778
38193
  zodVersion,
37779
38194
  zodMajorVersion: zodVersion === null ? null : getLowestDependencyMajor(zodVersion),
38195
+ mobxVersion,
38196
+ mobxMajorVersion: mobxVersion === null ? null : getDependencyMajorWithinSupportedRange(mobxVersion, 6),
38197
+ hasMobxReact: workspaceFacts.hasMobxReact,
38198
+ mobxReactVersion: workspaceFacts.mobxReactVersion,
38199
+ hasMobxReactLite: workspaceFacts.hasMobxReactLite,
38200
+ mobxReactLiteVersion: workspaceFacts.mobxReactLiteVersion,
38201
+ hasMobxStateTree: workspaceFacts.hasMobxStateTree,
38202
+ hasMobxReactObserver: workspaceFacts.hasMobxReactObserver,
38203
+ zustandVersion,
38204
+ zustandMajorVersion: zustandVersion === null ? null : getLowestDependencyMajor(zustandVersion),
37780
38205
  framework,
37781
38206
  hasTypeScript,
37782
38207
  hasReactCompiler: detectReactCompiler(directory, packageJson),
37783
38208
  hasReactCompilerLintPlugin: detectReactCompilerLintPlugin(directory, packageJson),
37784
- hasTanStackQuery: hasTanStackQuery(packageJson),
38209
+ hasTanStackQuery: tanstackQueryVersion !== null,
38210
+ hasI18nLibrary: workspaceFacts.hasI18nLibrary,
38211
+ tanstackQueryVersion,
38212
+ styledComponentsVersion: workspaceFacts.styledComponentsVersion,
37785
38213
  valtioVersion,
37786
38214
  valtioMajorVersion: valtioVersion === null ? null : getLowestDependencyMajor(valtioVersion),
37787
38215
  hasRemotion: workspaceFacts.hasRemotionDependency,
37788
38216
  remotionVersion,
37789
38217
  remotionMajorVersion: remotionVersion === null ? null : getLowestDependencyMajor(remotionVersion),
38218
+ hasThree: workspaceFacts.hasThree,
38219
+ threeVersion,
38220
+ threeRelease: parseThreeRelease(threeVersion),
38221
+ hasReactThreeFiber: workspaceFacts.hasReactThreeFiber,
38222
+ reactThreeFiberVersion,
38223
+ reactThreeFiberMajorVersion: reactThreeFiberVersion === null ? null : getLowestDependencyMajor(reactThreeFiberVersion),
37790
38224
  hasSsrDependency: workspaceFacts.hasSsrDependency,
37791
38225
  preactVersion,
37792
38226
  preactMajorVersion: parseReactMajor(preactVersion),
37793
38227
  hasReactNativeWorkspace,
37794
38228
  nextjsVersion,
37795
38229
  nextjsMajorVersion: nextjsVersion === null ? null : getLowestDependencyMajor(nextjsVersion),
38230
+ reactRouterVersion,
38231
+ hasReactRouterFramework: workspaceFacts.hasReactRouterFramework,
37796
38232
  expoVersion,
37797
38233
  shopifyFlashListVersion,
37798
38234
  shopifyFlashListMajorVersion: shopifyFlashListVersion === null ? null : getLowestDependencyMajor(shopifyFlashListVersion),
@@ -41096,10 +41532,10 @@ const SSR_FRAMEWORKS = new Set([
41096
41532
  "gatsby",
41097
41533
  "tanstack-start"
41098
41534
  ]);
41099
- const addMajorLadder = (capabilities, name, major, earliest, latest) => {
41100
- if (major === null) return;
41101
- const cappedMajor = Math.min(major, latest);
41102
- for (let candidate = earliest; candidate <= cappedMajor; candidate += 1) capabilities.add(`${name}:${candidate}`);
41535
+ const addVersionCapabilityLadder = (capabilities, name, detectedVersion, earliest, latest) => {
41536
+ if (detectedVersion === null) return;
41537
+ const cappedVersion = Math.min(detectedVersion, latest);
41538
+ for (let candidate = earliest; candidate <= cappedVersion; candidate += 1) capabilities.add(`${name}:${candidate}`);
41103
41539
  };
41104
41540
  const buildCapabilities = (project) => {
41105
41541
  const capabilities = /* @__PURE__ */ new Set();
@@ -41112,30 +41548,86 @@ const buildCapabilities = (project) => {
41112
41548
  if (CLIENT_ONLY_FRAMEWORKS.has(project.framework)) capabilities.add("client-only");
41113
41549
  if (project.isStaticExport) capabilities.add("nextjs:static-export");
41114
41550
  if (project.nextjsMajorVersion !== null && project.nextjsMajorVersion >= 15) capabilities.add("nextjs:15");
41115
- addMajorLadder(capabilities, "react", project.reactMajorVersion, 17, 30);
41551
+ if (project.nextjsMajorVersion !== null && project.nextjsMajorVersion >= 16) capabilities.add("nextjs:16");
41552
+ const reactRouterVersion = project.reactRouterVersion ?? null;
41553
+ if (reactRouterVersion !== null) {
41554
+ capabilities.add("react-router");
41555
+ if (project.hasReactRouterFramework === true) capabilities.add("react-router-framework");
41556
+ const detectedVersion = parseReactMajorMinor(reactRouterVersion);
41557
+ if (detectedVersion !== null) {
41558
+ for (const threshold of REACT_ROUTER_CAPABILITY_THRESHOLDS) if (isMajorMinorAtLeast(detectedVersion, threshold)) capabilities.add(threshold.capability);
41559
+ }
41560
+ }
41561
+ addVersionCapabilityLadder(capabilities, "react", project.reactMajorVersion, 17, 30);
41116
41562
  if (project.reactMajorVersion !== null && project.reactMajorVersion >= 19 && isMajorMinorAtLeast(parseReactMajorMinor(project.reactVersion), {
41117
41563
  major: 19,
41118
41564
  minor: 2
41119
41565
  })) capabilities.add("react:19.2");
41120
- if (project.tailwindVersion !== null) capabilities.add("tailwind");
41121
- if (project.tailwindVersion !== null && isMajorMinorAtLeast(parseTailwindMajorMinor(project.tailwindVersion), {
41122
- major: 3,
41123
- minor: 4
41124
- })) capabilities.add("tailwind:3.4");
41566
+ if (project.tailwindVersion !== null) {
41567
+ capabilities.add("tailwind");
41568
+ const tailwindVersion = parseTailwindMajorMinor(project.tailwindVersion);
41569
+ if (isMajorMinorAtLeast(tailwindVersion, {
41570
+ major: 3,
41571
+ minor: 4
41572
+ })) capabilities.add("tailwind:3.4");
41573
+ if (tailwindVersion !== null && isMajorMinorAtLeast(tailwindVersion, {
41574
+ major: 4,
41575
+ minor: 0
41576
+ })) capabilities.add("tailwind:4");
41577
+ }
41125
41578
  if (project.zodVersion !== null) capabilities.add("zod");
41126
41579
  if (project.zodMajorVersion !== null && project.zodMajorVersion >= 4) capabilities.add("zod:4");
41580
+ if (project.mobxVersion !== void 0 && project.mobxVersion !== null || project.hasMobxReact === true || project.hasMobxReactLite === true || project.hasMobxStateTree === true || project.hasMobxReactObserver === true) capabilities.add("mobx");
41581
+ if (project.hasMobxReact === true) capabilities.add("mobx-react");
41582
+ if (project.hasMobxReactLite === true) capabilities.add("mobx-react-lite");
41583
+ if (project.hasMobxReact === true || project.hasMobxReactLite === true) capabilities.add("mobx-react-binding");
41584
+ const mobxReactVersion = parseDependencyMajorMinor(project.mobxReactVersion);
41585
+ const mobxReactLiteVersion = parseDependencyMajorMinor(project.mobxReactLiteVersion);
41586
+ const hasMobxReactObserverMemoGuard = mobxReactVersion !== null && isMajorMinorAtLeast(mobxReactVersion, {
41587
+ major: 7,
41588
+ minor: 3
41589
+ });
41590
+ const hasMobxReactLiteObserverMemoGuard = mobxReactLiteVersion !== null && isMajorMinorAtLeast(mobxReactLiteVersion, {
41591
+ major: 3,
41592
+ minor: 3
41593
+ });
41594
+ if (hasMobxReactObserverMemoGuard) capabilities.add("mobx-react-observer-memo-guard");
41595
+ if (hasMobxReactLiteObserverMemoGuard) capabilities.add("mobx-react-lite-observer-memo-guard");
41596
+ if (hasMobxReactObserverMemoGuard || hasMobxReactLiteObserverMemoGuard) capabilities.add("mobx-react-binding-observer-memo-guard");
41597
+ if (project.hasMobxStateTree === true) capabilities.add("mobx-state-tree");
41598
+ if (project.hasMobxReactObserver === true) capabilities.add("mobx-react-observer");
41599
+ if (project.mobxMajorVersion !== void 0 && project.mobxMajorVersion !== null && project.mobxMajorVersion >= 4 && project.mobxMajorVersion <= 6) addVersionCapabilityLadder(capabilities, "mobx", project.mobxMajorVersion, 4, 6);
41600
+ const mobxVersion = parseDependencyMajorMinor(project.mobxVersion);
41601
+ if (project.mobxMajorVersion === 6 && mobxVersion !== null && isMajorMinorAtLeast(mobxVersion, {
41602
+ major: 6,
41603
+ minor: 10
41604
+ })) capabilities.add("mobx:6.10");
41605
+ if (project.zustandVersion !== void 0 && project.zustandVersion !== null) capabilities.add("zustand");
41606
+ if (project.zustandMajorVersion !== void 0 && project.zustandMajorVersion !== null && project.zustandMajorVersion >= 1 && project.zustandMajorVersion <= 5) addVersionCapabilityLadder(capabilities, "zustand", project.zustandMajorVersion, 1, 5);
41127
41607
  if (project.isPreES2023Target) capabilities.add("pre-es2023");
41128
41608
  if (project.hasReactCompiler) capabilities.add("react-compiler");
41129
- if (project.hasTanStackQuery) capabilities.add("tanstack-query");
41609
+ if (Boolean(project.hasTanStackQuery) || Boolean(project.tanstackQueryVersion)) capabilities.add("tanstack-query");
41610
+ if (project.styledComponentsVersion) {
41611
+ capabilities.add("styled-components");
41612
+ const styledComponentsMajor = getLowestDependencyMajor(project.styledComponentsVersion);
41613
+ if (styledComponentsMajor !== null && styledComponentsMajor >= 6) capabilities.add("styled-components:6");
41614
+ }
41615
+ if (project.hasI18nLibrary) capabilities.add("i18n");
41130
41616
  if (project.valtioVersion !== null) capabilities.add("valtio");
41131
- addMajorLadder(capabilities, "valtio", project.valtioMajorVersion, 1, 10);
41617
+ addVersionCapabilityLadder(capabilities, "valtio", project.valtioMajorVersion, 1, 10);
41132
41618
  if (project.hasRemotion) {
41133
41619
  capabilities.add("remotion");
41134
- addMajorLadder(capabilities, "remotion", project.remotionMajorVersion ?? null, 4, 30);
41620
+ addVersionCapabilityLadder(capabilities, "remotion", project.remotionMajorVersion ?? null, 4, 30);
41621
+ }
41622
+ if (project.hasThree || project.hasReactThreeFiber) capabilities.add("three");
41623
+ addVersionCapabilityLadder(capabilities, "three", project.threeRelease ?? null, 145, 250);
41624
+ if (project.hasReactThreeFiber) {
41625
+ capabilities.add("r3f");
41626
+ addVersionCapabilityLadder(capabilities, "r3f", project.reactThreeFiberMajorVersion ?? null, 3, 10);
41135
41627
  }
41136
41628
  if (project.hasTypeScript) capabilities.add("typescript");
41137
41629
  if (project.preactVersion !== null) capabilities.add("preact");
41138
- addMajorLadder(capabilities, "preact", project.preactMajorVersion, 10, 20);
41630
+ addVersionCapabilityLadder(capabilities, "preact", project.preactMajorVersion, 10, 20);
41139
41631
  if (project.preactVersion !== null && project.reactVersion === null) capabilities.add("pure-preact");
41140
41632
  return capabilities;
41141
41633
  };
@@ -41147,7 +41639,7 @@ const getCapabilities = (project) => {
41147
41639
  capabilitiesByProject.set(project, capabilities);
41148
41640
  return capabilities;
41149
41641
  };
41150
- const shouldEnableRule = (requires, tags, capabilities, ignoredTags, disabledWhen) => {
41642
+ const shouldEnableRule = (requires, tags, capabilities, ignoredTags, disabledWhen, includedTags) => {
41151
41643
  if (requires) {
41152
41644
  for (const capability of requires) if (!capabilities.has(capability)) return false;
41153
41645
  }
@@ -41158,20 +41650,29 @@ const shouldEnableRule = (requires, tags, capabilities, ignoredTags, disabledWhe
41158
41650
  if (tags) {
41159
41651
  for (const tag of tags) if (ignoredTags.has(tag)) return false;
41160
41652
  }
41653
+ if (includedTags && includedTags.size > 0) {
41654
+ if (!tags?.some((tag) => includedTags.has(tag))) return false;
41655
+ }
41161
41656
  return true;
41162
41657
  };
41658
+ const shouldEnableRuleByDefaultStatus = (options) => options.defaultEnabled !== false || options.hasExplicitOverride === true || options.includeTagDefaults && options.hasIncludedTags;
41163
41659
  const yieldToEventLoop = () => new Promise((resolve) => {
41164
41660
  setImmediate(resolve);
41165
41661
  });
41166
41662
  const createSecurityScanSession = (rootDirectory, options) => {
41167
41663
  const capabilities = options.project ? getCapabilities(options.project) : /* @__PURE__ */ new Set();
41168
41664
  const ignoredTags = options.ignoredTags ?? /* @__PURE__ */ new Set();
41665
+ const includedTags = options.includedTags ?? /* @__PURE__ */ new Set();
41169
41666
  const enabledScanRules = REACT_DOCTOR_RULES.flatMap((entry) => {
41170
41667
  const rule = entry.rule;
41171
41668
  const scan = rule.scan;
41172
41669
  if (typeof scan !== "function") return [];
41173
- if (rule.defaultEnabled === false) return [];
41174
- if (!shouldEnableRule(rule.requires, rule.tags, capabilities, ignoredTags, rule.disabledWhen)) return [];
41670
+ if (!shouldEnableRuleByDefaultStatus({
41671
+ defaultEnabled: rule.defaultEnabled,
41672
+ includeTagDefaults: options.includeTagDefaults === true,
41673
+ hasIncludedTags: includedTags.size > 0
41674
+ })) return [];
41675
+ if (!shouldEnableRule(rule.requires, rule.tags, capabilities, ignoredTags, rule.disabledWhen, includedTags)) return [];
41175
41676
  return [{
41176
41677
  entry,
41177
41678
  scan,
@@ -43173,8 +43674,9 @@ const buildUserPluginRules = (userPlugin, severityControls) => {
43173
43674
  }
43174
43675
  return enabled;
43175
43676
  };
43176
- const createOxlintConfig = ({ pluginPath, project, customRulesOnly = false, extendsPaths = [], ignoredTags = /* @__PURE__ */ new Set(), serverAuthFunctionNames, severityControls, userPlugins = [], disableReactHooksJsPlugin = false, ruleSelection, sidecarRuleIdFilter }) => {
43177
- const reactHooksJsPlugin = disableReactHooksJsPlugin || ruleSelection === "sidecar" ? null : resolveReactHooksJsPlugin(project.hasReactCompiler || project.hasReactCompilerLintPlugin === true, customRulesOnly);
43677
+ const createOxlintConfig = ({ pluginPath, project, customRulesOnly = false, extendsPaths = [], ignoredTags = /* @__PURE__ */ new Set(), includedTags = /* @__PURE__ */ new Set(), includeTagDefaults = false, serverAuthFunctionNames, severityControls, userPlugins = [], disableReactHooksJsPlugin = false, ruleSelection, sidecarRuleIdFilter }) => {
43678
+ const hasIncludedTags = includedTags.size > 0;
43679
+ const reactHooksJsPlugin = disableReactHooksJsPlugin || ruleSelection === "sidecar" || hasIncludedTags ? null : resolveReactHooksJsPlugin(project.hasReactCompiler || project.hasReactCompilerLintPlugin === true, customRulesOnly);
43178
43680
  const reactCompilerRules = reactHooksJsPlugin ? applyRuleSeverityControls(filterRulesToAvailable(REACT_COMPILER_RULES, "react-hooks-js", reactHooksJsPlugin.availableRuleNames), severityControls) : {};
43179
43681
  const jsPlugins = [];
43180
43682
  if (reactHooksJsPlugin) jsPlugins.push(reactHooksJsPlugin.entry);
@@ -43189,9 +43691,14 @@ const createOxlintConfig = ({ pluginPath, project, customRulesOnly = false, exte
43189
43691
  if (rule.scan !== void 0) continue;
43190
43692
  if (customRulesOnly && registryEntry.originallyExternal) continue;
43191
43693
  if (rule.framework !== "global" && !rule.requires) continue;
43192
- if (!shouldEnableRule(rule.requires, rule.tags, capabilities, ignoredTags, rule.disabledWhen)) continue;
43694
+ if (!shouldEnableRule(rule.requires, rule.tags, capabilities, ignoredTags, rule.disabledWhen, includedTags)) continue;
43193
43695
  const explicitRuleOverride = resolveRuleSeverityOverride({ ruleKey: registryEntry.key }, severityControls);
43194
- if (rule.defaultEnabled === false && explicitRuleOverride === void 0) continue;
43696
+ if (!shouldEnableRuleByDefaultStatus({
43697
+ defaultEnabled: rule.defaultEnabled,
43698
+ includeTagDefaults,
43699
+ hasIncludedTags,
43700
+ hasExplicitOverride: explicitRuleOverride !== void 0
43701
+ })) continue;
43195
43702
  const severity = resolveRuleSeverityOverride({
43196
43703
  ruleKey: registryEntry.key,
43197
43704
  category: rule.category
@@ -43200,7 +43707,7 @@ const createOxlintConfig = ({ pluginPath, project, customRulesOnly = false, exte
43200
43707
  enabledReactDoctorRules[registryEntry.key] = severity;
43201
43708
  }
43202
43709
  const userPluginRules = {};
43203
- if (ruleSelection !== "sidecar") for (const userPlugin of userPlugins) {
43710
+ if (ruleSelection !== "sidecar" && !hasIncludedTags) for (const userPlugin of userPlugins) {
43204
43711
  Object.assign(userPluginRules, buildUserPluginRules(userPlugin, severityControls));
43205
43712
  jsPlugins.push(userPlugin.entry);
43206
43713
  }
@@ -43417,6 +43924,19 @@ const createSidecarLintCache = (cacheDirectory, rulesetHash) => {
43417
43924
  }
43418
43925
  };
43419
43926
  };
43927
+ const fingerprintCacheByFilePath = /* @__PURE__ */ new Map();
43928
+ const fingerprintFileContents = (filePath, fingerprintLength) => {
43929
+ const fileStats = NFS.statSync(filePath, { bigint: true });
43930
+ const cachedFingerprint = fingerprintCacheByFilePath.get(filePath);
43931
+ if (cachedFingerprint?.modifiedTimeNanoseconds === fileStats.mtimeNs && cachedFingerprint.sizeBytes === fileStats.size) return cachedFingerprint.fingerprint;
43932
+ const fingerprint = crypto.createHash("sha256").update(NFS.readFileSync(filePath)).digest("hex").slice(0, fingerprintLength);
43933
+ fingerprintCacheByFilePath.set(filePath, {
43934
+ fingerprint,
43935
+ modifiedTimeNanoseconds: fileStats.mtimeNs,
43936
+ sizeBytes: fileStats.size
43937
+ });
43938
+ return fingerprint;
43939
+ };
43420
43940
  const bundledRequire$3 = createRequire(import.meta.url);
43421
43941
  const childNodeVersionByBinaryPath = /* @__PURE__ */ new Map();
43422
43942
  const resolveChildNodeVersion = (nodeBinaryPath) => {
@@ -43440,6 +43960,13 @@ const TOOLCHAIN_PACKAGE_SPECIFIERS$1 = [
43440
43960
  "oxlint-plugin-react-doctor/package.json",
43441
43961
  "eslint-plugin-react-hooks/package.json"
43442
43962
  ];
43963
+ const resolvePluginFingerprint = () => {
43964
+ try {
43965
+ return fingerprintFileContents(bundledRequire$3.resolve("oxlint-plugin-react-doctor"), 16);
43966
+ } catch {
43967
+ return "unresolved";
43968
+ }
43969
+ };
43443
43970
  const resolveOxlintToolchainVersions = (nodeBinaryPath = process.execPath) => {
43444
43971
  const versions = [`node=${resolveChildNodeVersion(nodeBinaryPath)}`];
43445
43972
  for (const specifier of TOOLCHAIN_PACKAGE_SPECIFIERS$1) try {
@@ -43449,6 +43976,7 @@ const resolveOxlintToolchainVersions = (nodeBinaryPath = process.execPath) => {
43449
43976
  } catch {
43450
43977
  versions.push(`${specifier}=missing`);
43451
43978
  }
43979
+ versions.push(`oxlint-plugin-react-doctor#fingerprint=${resolvePluginFingerprint()}`);
43452
43980
  return versions;
43453
43981
  };
43454
43982
  const esmRequire = createRequire(import.meta.url);
@@ -44924,7 +45452,7 @@ const reactHooksJsPluginDropNote = (error) => {
44924
45452
  * 6. always restore disable directives + clean up the temp dir
44925
45453
  */
44926
45454
  const runOxlint = async (options) => {
44927
- const { rootDirectory, project, includePaths, nodeBinaryPath = process.execPath, customRulesOnly = false, respectInlineDisables = true, adoptExistingLintConfig = true, ignoredTags = /* @__PURE__ */ new Set(), userConfig, configSourceDirectory = rootDirectory, onPartialFailure, onFileCoverage, perFileLintCacheEnabled = false, sidecarLintCacheEnabled = false, onCacheStats, onSidecarStats, spawnTimeoutMs, outputMaxBytes, lintBatchOrdering = "cost" } = options;
45455
+ const { rootDirectory, project, includePaths, nodeBinaryPath = process.execPath, customRulesOnly = false, respectInlineDisables = true, adoptExistingLintConfig = true, ignoredTags = /* @__PURE__ */ new Set(), includedTags = /* @__PURE__ */ new Set(), includeTagDefaults = false, userConfig, configSourceDirectory = rootDirectory, onPartialFailure, onFileCoverage, perFileLintCacheEnabled = false, sidecarLintCacheEnabled = false, onCacheStats, onSidecarStats, spawnTimeoutMs, outputMaxBytes, lintBatchOrdering = "cost" } = options;
44928
45456
  const serverAuthFunctionNames = Array.isArray(userConfig?.serverAuthFunctionNames) ? userConfig.serverAuthFunctionNames.filter((entry) => typeof entry === "string" && entry.length > 0) : void 0;
44929
45457
  const severityControls = buildRuleSeverityControls(userConfig);
44930
45458
  validateRuleRegistration();
@@ -44938,13 +45466,15 @@ const runOxlint = async (options) => {
44938
45466
  }
44939
45467
  const pluginPath = resolvePluginPath();
44940
45468
  const extendsPaths = (adoptExistingLintConfig && !customRulesOnly ? detectUserLintConfigPaths(rootDirectory) : []).filter(canOxlintExtendConfig);
44941
- const userPlugins = resolveUserPlugins(userConfig?.plugins, configSourceDirectory);
45469
+ const userPlugins = includedTags.size > 0 ? [] : resolveUserPlugins(userConfig?.plugins, configSourceDirectory);
44942
45470
  const buildConfig = (overrides) => createOxlintConfig({
44943
45471
  pluginPath,
44944
45472
  project,
44945
45473
  customRulesOnly,
44946
45474
  extendsPaths: overrides.extendsPaths,
44947
45475
  ignoredTags,
45476
+ includedTags,
45477
+ includeTagDefaults,
44948
45478
  serverAuthFunctionNames,
44949
45479
  severityControls,
44950
45480
  userPlugins,
@@ -45333,6 +45863,8 @@ var Linter = class Linter extends Service()("react-doctor/Linter") {
45333
45863
  respectInlineDisables: input.respectInlineDisables,
45334
45864
  adoptExistingLintConfig: input.adoptExistingLintConfig,
45335
45865
  ignoredTags: input.ignoredTags,
45866
+ includedTags: input.includedTags,
45867
+ includeTagDefaults: input.includeTagDefaults,
45336
45868
  userConfig: input.userConfig ?? null,
45337
45869
  configSourceDirectory: input.configSourceDirectory,
45338
45870
  onPartialFailure: (reason) => {
@@ -46181,7 +46713,9 @@ const runInspect = (input, hooks = {}) => gen(function* () {
46181
46713
  const securityScanFailedRef = yield* make$13(false);
46182
46714
  const securityScanFiber = yield* forkChild(runCollect(applyPerElementPipeline(isDiffMode ? empty$4 : unwrap(tryPromise(() => checkSecurityScanCooperative(scanDirectory, {
46183
46715
  project,
46184
- ignoredTags: input.ignoredTags
46716
+ ignoredTags: input.ignoredTags,
46717
+ includedTags: input.includedTags,
46718
+ includeTagDefaults: input.includeTagDefaults
46185
46719
  })).pipe(map$3((diagnostics) => fromIterable$1(diagnostics)), catch_$1(() => set(securityScanFailedRef, true).pipe(as(empty$4))))))).pipe(withSpan("SecurityScan.run")));
46186
46720
  const shouldRunSupplyChain = !isDiffMode || (input.supplyChainManifestChanged ?? false);
46187
46721
  const supplyChainOverlapTimeout = yield* SupplyChainOverlapTimeoutMs;
@@ -46272,6 +46806,8 @@ const runInspect = (input, hooks = {}) => gen(function* () {
46272
46806
  respectInlineDisables: input.respectInlineDisables,
46273
46807
  adoptExistingLintConfig: input.adoptExistingLintConfig,
46274
46808
  ignoredTags: input.ignoredTags,
46809
+ includedTags: input.includedTags,
46810
+ includeTagDefaults: input.includeTagDefaults,
46275
46811
  userConfig: resolvedConfig.config ?? void 0,
46276
46812
  configSourceDirectory: resolvedConfig.configSourceDirectory ?? void 0,
46277
46813
  onFileProgress: (scannedFileCount, totalFileCount) => {
@@ -47416,7 +47952,7 @@ const makeNoopConsole = () => ({
47416
47952
  });
47417
47953
  //#endregion
47418
47954
  //#region src/cli/utils/version.ts
47419
- const VERSION = "0.8.1-dev.f4aa821";
47955
+ const VERSION = "0.8.1-dev.f5f13b8";
47420
47956
  //#endregion
47421
47957
  //#region src/cli/utils/json-mode.ts
47422
47958
  let context = null;
@@ -47503,7 +48039,11 @@ const getRunId = () => {
47503
48039
  };
47504
48040
  //#endregion
47505
48041
  //#region src/cli/utils/build-run-context.ts
47506
- const ROOT_SUBCOMMANDS = new Set(["install", "setup"]);
48042
+ const ROOT_SUBCOMMANDS = new Set([
48043
+ "design",
48044
+ "install",
48045
+ "setup"
48046
+ ]);
47507
48047
  const detectInvokedVia = () => {
47508
48048
  const userAgent = process.env.npm_config_user_agent;
47509
48049
  if (!userAgent) return "unknown";
@@ -47587,7 +48127,9 @@ const buildSentryProjectContext = (projectInfo) => ({
47587
48127
  reactMajorVersion: projectInfo.reactMajorVersion,
47588
48128
  hasTypeScript: projectInfo.hasTypeScript,
47589
48129
  hasReactCompiler: projectInfo.hasReactCompiler,
47590
- hasTanStackQuery: projectInfo.hasTanStackQuery,
48130
+ tanstackQueryVersion: projectInfo.tanstackQueryVersion,
48131
+ mobxVersion: projectInfo.mobxVersion,
48132
+ styledComponentsVersion: projectInfo.styledComponentsVersion,
47591
48133
  tailwindVersion: projectInfo.tailwindVersion,
47592
48134
  zodVersion: projectInfo.zodVersion,
47593
48135
  preactVersion: projectInfo.preactVersion,
@@ -47768,13 +48310,13 @@ const isDevVersion = (version) => version === "0.0.0" || version.includes("-");
47768
48310
  * uploads source-map artifacts under, so stack frames symbolicate. Honors the
47769
48311
  * standard `SENTRY_RELEASE` override.
47770
48312
  */
47771
- const resolveSentryRelease = () => process.env.SENTRY_RELEASE || `react-doctor@0.8.1-dev.f4aa821`;
48313
+ const resolveSentryRelease = () => process.env.SENTRY_RELEASE || `react-doctor@0.8.1-dev.f5f13b8`;
47772
48314
  /**
47773
48315
  * Deployment environment shown in Sentry's environment filter. Defaults to
47774
48316
  * `production` for tagged releases and `development` for dev/unbuilt versions,
47775
48317
  * overridable via the standard `SENTRY_ENVIRONMENT` env var.
47776
48318
  */
47777
- const resolveSentryEnvironment = () => process.env.SENTRY_ENVIRONMENT || (isDevVersion("0.8.1-dev.f4aa821") ? "development" : "production");
48319
+ const resolveSentryEnvironment = () => process.env.SENTRY_ENVIRONMENT || (isDevVersion("0.8.1-dev.f5f13b8") ? "development" : "production");
47778
48320
  /**
47779
48321
  * Performance-tracing sample rate in `[0, 1]`. Reads `SENTRY_TRACES_SAMPLE_RATE`
47780
48322
  * (set to `0` to disable tracing) and falls back to
@@ -60100,6 +60642,8 @@ const buildScanResultCacheKey = (input) => {
60100
60642
  warnings: input.options.warnings,
60101
60643
  adoptExistingLintConfig: input.options.adoptExistingLintConfig,
60102
60644
  ignoredTags: [...input.options.ignoredTags].sort(),
60645
+ includedTags: [...input.options.includedTags].sort(),
60646
+ includeTagDefaults: input.options.includeTagDefaults,
60103
60647
  concurrency: input.options.concurrency,
60104
60648
  lintBatchOrdering: resolveLintBatchOrdering(),
60105
60649
  baselineRef: input.options.baseline?.ref,
@@ -60926,8 +61470,8 @@ const createDiagnosticEvidenceReader = (rootDirectory, options = {}) => {
60926
61470
  //#endregion
60927
61471
  //#region src/cli/utils/build-no-score-message.ts
60928
61472
  const ENTERPRISE_CONTACT_HINT = `Want something custom to your company? Contact us at ${ENTERPRISE_CONTACT_URL}.`;
60929
- const buildNoScoreMessage = (isScoreDisabled) => {
60930
- return `${isScoreDisabled ? "Score disabled by --no-score." : "Score unavailable (could not reach the score API)."} ${ENTERPRISE_CONTACT_HINT}`;
61473
+ const buildNoScoreMessage = (isScoreDisabled, disabledMessage) => {
61474
+ return `${isScoreDisabled ? disabledMessage ?? "Score disabled by --no-score." : "Score unavailable (could not reach the score API)."} ${ENTERPRISE_CONTACT_HINT}`;
60931
61475
  };
60932
61476
  //#endregion
60933
61477
  //#region src/cli/utils/render-agent-guidance.ts
@@ -62052,40 +62596,47 @@ const buildChangedLineMatcher = (directory, changedLineRanges) => {
62052
62596
  return diagnosticIntersectsLineRanges(diagnostic, ranges);
62053
62597
  };
62054
62598
  };
62055
- const buildIgnoredTags = (userConfig) => {
62599
+ const buildIgnoredTags = (userConfig, includedTags) => {
62056
62600
  const tags = /* @__PURE__ */ new Set();
62057
62601
  if (userConfig?.ignore?.tags) for (const tag of userConfig.ignore.tags) tags.add(tag);
62602
+ for (const tag of includedTags) tags.delete(tag);
62058
62603
  return tags;
62059
62604
  };
62060
- const mergeInspectOptions = (inputOptions, userConfig) => ({
62061
- lint: inputOptions.lint ?? userConfig?.lint ?? true,
62062
- deadCode: inputOptions.deadCode ?? userConfig?.deadCode ?? true,
62063
- supplyChain: inputOptions.supplyChain ?? userConfig?.supplyChain?.enabled ?? true,
62064
- verbose: inputOptions.verbose ?? userConfig?.verbose ?? false,
62065
- outputDirectory: inputOptions.outputDirectory || null,
62066
- scoreOnly: inputOptions.scoreOnly ?? false,
62067
- noScore: inputOptions.noScore ?? userConfig?.noScore ?? false,
62068
- isCi: inputOptions.isCi ?? false,
62069
- isCiOrCodingAgentEnvironment: isCiOrCodingAgentEnvironment(),
62070
- isNonInteractiveEnvironment: isNonInteractiveEnvironment(),
62071
- silent: inputOptions.silent ?? false,
62072
- includePaths: inputOptions.includePaths ?? [],
62073
- customRulesOnly: userConfig?.customRulesOnly ?? false,
62074
- share: userConfig?.share ?? true,
62075
- respectInlineDisables: inputOptions.respectInlineDisables ?? userConfig?.respectInlineDisables ?? true,
62076
- warnings: inputOptions.warnings ?? userConfig?.warnings ?? true,
62077
- categoryFilters: new Set(resolveCliCategories(inputOptions.categoryFilters) ?? []),
62078
- adoptExistingLintConfig: userConfig?.adoptExistingLintConfig ?? true,
62079
- ignoredTags: buildIgnoredTags(userConfig),
62080
- outputSurface: inputOptions.outputSurface ?? "cli",
62081
- suppressRendering: inputOptions.suppressRendering ?? false,
62082
- concurrentScan: inputOptions.concurrentScan ?? false,
62083
- concurrency: inputOptions.concurrency,
62084
- maxDurationMs: inputOptions.maxDurationMs ?? null,
62085
- baseline: inputOptions.baseline ?? null,
62086
- changedLineRanges: inputOptions.changedLineRanges ?? null,
62087
- supplyChainManifestChanged: inputOptions.supplyChainManifestChanged ?? false
62088
- });
62605
+ const mergeInspectOptions = (inputOptions, userConfig) => {
62606
+ const includedTags = inputOptions.includedTags ?? /* @__PURE__ */ new Set();
62607
+ return {
62608
+ lint: inputOptions.lint ?? userConfig?.lint ?? true,
62609
+ deadCode: inputOptions.deadCode ?? userConfig?.deadCode ?? true,
62610
+ supplyChain: inputOptions.supplyChain ?? userConfig?.supplyChain?.enabled ?? true,
62611
+ verbose: inputOptions.verbose ?? userConfig?.verbose ?? false,
62612
+ outputDirectory: inputOptions.outputDirectory || null,
62613
+ scoreOnly: inputOptions.scoreOnly ?? false,
62614
+ noScore: inputOptions.noScore ?? userConfig?.noScore ?? false,
62615
+ isCi: inputOptions.isCi ?? false,
62616
+ isCiOrCodingAgentEnvironment: isCiOrCodingAgentEnvironment(),
62617
+ isNonInteractiveEnvironment: isNonInteractiveEnvironment(),
62618
+ silent: inputOptions.silent ?? false,
62619
+ includePaths: inputOptions.includePaths ?? [],
62620
+ customRulesOnly: includedTags.size > 0 ? false : userConfig?.customRulesOnly ?? false,
62621
+ share: userConfig?.share ?? true,
62622
+ respectInlineDisables: inputOptions.respectInlineDisables ?? userConfig?.respectInlineDisables ?? true,
62623
+ warnings: inputOptions.warnings ?? userConfig?.warnings ?? true,
62624
+ categoryFilters: new Set(resolveCliCategories(inputOptions.categoryFilters) ?? []),
62625
+ adoptExistingLintConfig: includedTags.size > 0 ? false : userConfig?.adoptExistingLintConfig ?? true,
62626
+ ignoredTags: buildIgnoredTags(userConfig, includedTags),
62627
+ includedTags,
62628
+ includeTagDefaults: inputOptions.includeTagDefaults ?? false,
62629
+ scoreDisabledMessage: inputOptions.scoreDisabledMessage,
62630
+ outputSurface: inputOptions.outputSurface ?? "cli",
62631
+ suppressRendering: inputOptions.suppressRendering ?? false,
62632
+ concurrentScan: inputOptions.concurrentScan ?? false,
62633
+ concurrency: inputOptions.concurrency,
62634
+ maxDurationMs: inputOptions.maxDurationMs ?? null,
62635
+ baseline: inputOptions.baseline ?? null,
62636
+ changedLineRanges: inputOptions.changedLineRanges ?? null,
62637
+ supplyChainManifestChanged: inputOptions.supplyChainManifestChanged ?? false
62638
+ };
62639
+ };
62089
62640
  const deriveScope = (options) => {
62090
62641
  if (options.baseline) return "changed";
62091
62642
  if (options.changedLineRanges !== null) return "lines";
@@ -62216,6 +62767,8 @@ const runBaselineComparison = async (params) => {
62216
62767
  warnings: params.options.warnings,
62217
62768
  adoptExistingLintConfig: params.options.adoptExistingLintConfig,
62218
62769
  ignoredTags: params.options.ignoredTags,
62770
+ includedTags: params.options.includedTags,
62771
+ includeTagDefaults: params.options.includeTagDefaults,
62219
62772
  nodeBinaryPath: params.resolvedNodeBinaryPath ?? void 0,
62220
62773
  runDeadCode: false,
62221
62774
  isCi: params.options.isCi,
@@ -62309,6 +62862,8 @@ const runInspectWithRuntime = async (directory, options, userConfig, hasConfigOv
62309
62862
  warnings: options.warnings,
62310
62863
  adoptExistingLintConfig: options.adoptExistingLintConfig,
62311
62864
  ignoredTags: options.ignoredTags,
62865
+ includedTags: options.includedTags,
62866
+ includeTagDefaults: options.includeTagDefaults,
62312
62867
  nodeBinaryPath: resolvedNodeBinaryPath ?? void 0,
62313
62868
  runDeadCode: options.deadCode,
62314
62869
  isCi: options.isCi,
@@ -62497,7 +63052,7 @@ const finalizeAndRender = (input) => gen(function* () {
62497
63052
  securityScanFailed
62498
63053
  });
62499
63054
  const hasSkippedChecks = skippedChecks.length > 0;
62500
- const noScoreMessage = buildNoScoreMessage(options.noScore);
63055
+ const noScoreMessage = buildNoScoreMessage(options.noScore, options.scoreDisabledMessage);
62501
63056
  const buildResult = () => ({
62502
63057
  diagnostics: [...diagnostics],
62503
63058
  score,
@@ -64602,21 +65157,25 @@ const resolveParallelFlag = (parallel) => parallel === false ? 1 : void 0;
64602
65157
  */
64603
65158
  const resolveCliInspectOptions = (flags, userConfig) => {
64604
65159
  const wantsWarningGate = pickBlockingLevel(flags, userConfig) === "warning";
65160
+ const isDesignScan = flags.design === true;
64605
65161
  return {
64606
65162
  lint: flags.lint,
64607
- deadCode: flags.deadCode,
64608
- supplyChain: flags.supplyChain,
65163
+ deadCode: isDesignScan ? false : flags.deadCode,
65164
+ supplyChain: isDesignScan ? false : flags.supplyChain,
64609
65165
  verbose: flags.verbose,
64610
65166
  outputDirectory: flags.outputDir,
64611
65167
  respectInlineDisables: flags.respectInlineDisables === false ? false : void 0,
64612
65168
  warnings: wantsWarningGate ? true : flags.warnings,
64613
65169
  scoreOnly: flags.score === true,
64614
- noScore: flags.score === false || flags.telemetry === false ? true : void 0,
65170
+ noScore: isDesignScan || flags.score === false || flags.telemetry === false ? true : void 0,
64615
65171
  isCi: isCiEnvironment(),
64616
65172
  silent: Boolean(flags.json),
64617
65173
  concurrency: resolveParallelFlag(flags.parallel),
64618
65174
  maxDurationMs: resolveMaxDurationFlag(flags.maxDuration),
64619
- categoryFilters: resolveCliCategories(flags.category)
65175
+ categoryFilters: resolveCliCategories(flags.category),
65176
+ includedTags: isDesignScan ? new Set(["design"]) : void 0,
65177
+ includeTagDefaults: isDesignScan ? true : void 0,
65178
+ scoreDisabledMessage: isDesignScan ? "Design scans do not affect the React health score." : void 0
64620
65179
  };
64621
65180
  };
64622
65181
  //#endregion
@@ -65034,7 +65593,7 @@ const maybeMigrateLegacyConfig = async (requestedDirectory, { isQuiet, isStaged
65034
65593
  if (!(!isQuiet && !isStaged && process.stdout.isTTY === true && !isCiOrCodingAgentEnvironment())) return;
65035
65594
  await runProjectMigrations(requestedDirectory);
65036
65595
  };
65037
- const inspectAction = async (directory, flags) => {
65596
+ const inspectAction = async (directory, flags, invocationCommand = "inspect") => {
65038
65597
  const isScoreOnly = Boolean(flags.score);
65039
65598
  const isJsonMode = Boolean(flags.json);
65040
65599
  const isQuiet = isScoreOnly || isJsonMode;
@@ -65048,7 +65607,7 @@ const inspectAction = async (directory, flags) => {
65048
65607
  });
65049
65608
  if (flags.jsonOut) recordCount(METRIC.jsonOutUsed, 1);
65050
65609
  }
65051
- recordCount(METRIC.cliInvoked, 1, { command: "inspect" });
65610
+ recordCount(METRIC.cliInvoked, 1, { command: invocationCommand });
65052
65611
  try {
65053
65612
  validateModeFlags(flags);
65054
65613
  if (flags.staged) setJsonReportMode("staged");
@@ -65360,6 +65919,13 @@ const inspectAction = async (directory, flags) => {
65360
65919
  }
65361
65920
  };
65362
65921
  //#endregion
65922
+ //#region src/cli/commands/design.ts
65923
+ const designAction = async (directory, flags) => inspectAction(directory, {
65924
+ ...flags,
65925
+ design: true,
65926
+ lint: flags.lint ?? true
65927
+ }, "design");
65928
+ //#endregion
65363
65929
  //#region src/cli/commands/install.ts
65364
65930
  const installAction = async (options, command) => {
65365
65931
  recordCount(METRIC.cliInvoked, 1, { command: "install" });
@@ -66196,6 +66762,7 @@ const INSTALL_FLAG_SPEC = {
66196
66762
  shortOptionsWithRequiredValues: new Set(["-c"])
66197
66763
  };
66198
66764
  const COMMAND_FLAG_SPECS = new Map([
66765
+ ["design", ROOT_FLAG_SPEC],
66199
66766
  ["install", INSTALL_FLAG_SPEC],
66200
66767
  ["setup", INSTALL_FLAG_SPEC],
66201
66768
  ["version", {
@@ -66352,6 +66919,7 @@ ${formatExampleLines([
66352
66919
  ["react-doctor --scope changed --base main", "scan only new issues vs. main"],
66353
66920
  ["react-doctor --project modules/a,modules/b", "score each module separately (names or paths)"],
66354
66921
  ["react-doctor --staged", "scan staged files (pre-commit hook)"],
66922
+ ["react-doctor design", "run the focused UI design audit"],
66355
66923
  ["react-doctor --category Security", "show only one diagnostic category"],
66356
66924
  ["react-doctor --blocking warning", "fail CI on warnings too (default: error)"],
66357
66925
  ["react-doctor --json > report.json", "write a machine-readable report"],
@@ -66385,6 +66953,20 @@ ${highlighter.dim("Managing CI:")}
66385
66953
  ${highlighter.dim("Learn more:")}
66386
66954
  ${highlighter.info(CANONICAL_GITHUB_URL)}
66387
66955
  `;
66956
+ const renderDesignHelpEpilog = () => `
66957
+ ${highlighter.dim("Examples:")}
66958
+ ${formatExampleLines([
66959
+ ["react-doctor design", "audit UI design in the current project"],
66960
+ ["react-doctor design ./apps/web", "audit one application"],
66961
+ ["react-doctor design --verbose", "show every design finding"],
66962
+ ["react-doctor design --json", "write a design-only JSON report"]
66963
+ ])}
66964
+
66965
+ ${highlighter.dim("Scope:")}
66966
+ Runs only rules tagged ${highlighter.info("design")}, including focused rules that stay opt-in during a general health scan.
66967
+ Dead-code, supply-chain, external lint-config, custom-plugin, and health-score passes are skipped.
66968
+ Standard scan flags such as ${highlighter.info("--scope")}, ${highlighter.info("--project")}, ${highlighter.info("--verbose")}, and ${highlighter.info("--json")} still work.
66969
+ `;
66388
66970
  const renderCiHelpEpilog = () => `
66389
66971
  ${highlighter.dim("Examples:")}
66390
66972
  ${formatExampleLines([
@@ -66406,6 +66988,7 @@ ${highlighter.dim("Learn more:")}
66406
66988
  const collectCategoryOption = (value, previousValues) => [...previousValues ?? [], value];
66407
66989
  const program = new Command().name("react-doctor").description("Diagnose React codebase health").version(VERSION, "-v, --version", "display the version number").argument("[directory]", "project directory to scan", ".").option("--lint", "enable linting").option("--no-lint", "skip linting").option("--dead-code", "enable dead-code analysis (default)").option("--no-dead-code", "skip dead-code analysis (unused files / exports / dependencies, circular imports)").option("--supply-chain", "enable the dependency supply-chain scan (default)").option("--no-supply-chain", "skip the dependency supply-chain scan (Socket.dev dependency health checks)").option("--verbose", "show every rule and per-file details (default shows top 3 rules)").option("--debug", "force a Sentry trace and print its id at the end (paste it into a bug report)").option("--output-dir <dir>", "directory for the full diagnostics dump (default: a temp folder)").option("--score", "output only the score").option("--json", "output a single structured JSON report (suppresses other output)").option("--json-compact", "with --json, emit compact JSON (no indentation)").option("--json-out <path>", "with --json, write the report to a file instead of stdout").option("-y, --yes", "skip prompts, scan all workspace projects").option("--no-parallel", "lint serially with one worker (default: parallel across CPU cores; set the worker count with REACT_DOCTOR_PARALLEL)").option("--project <name>", "select projects: workspace names or directory paths (comma-separated for multiple); overrides the `projects` config field").option("--scope <value>", "how much supported JS/TS source to scan/report: full (default), files, changed (only new issues vs base), or lines (issues whose source spans touch changed lines)").option("--base <ref>", "base git ref for files/changed/lines scope (auto-detected when omitted)").option("--include-untracked", "with --scope files/changed/lines, also scan ordinary untracked files (respects .gitignore)").addOption(new Option("--diff [base]", "[deprecated] alias for --scope changed (pass `false` to force a full scan)").hideHelp()).addOption(new Option("--changed-files-from <file>", "scan source files listed in a newline-delimited changed-files file").hideHelp()).option("--no-score", "skip the score API, the share URL, and crash reporting").addOption(new Option("--category <category>", "only show diagnostics in a category (repeatable; e.g. Security)").argParser(collectCategoryOption)).option("--no-telemetry", "alias for --no-score (skip the score API, share URL, and crash reporting)").option("--staged", "scan only staged (git index) files for pre-commit hooks").option("--max-duration <seconds>", "scan time budget for the whole run, shared across workspace projects: past it, remaining lint batches and dead-code are skipped and partial results are reported (skipped files are listed in the JSON report)").option("--blocking <level>", "severity that fails CI: error (default), warning, or none (advisory)").addOption(new Option("--fail-on <level>", "[deprecated] alias for --blocking <level>").hideHelp()).option("--no-respect-inline-disables", "audit mode: neutralize inline lint suppressions before scanning").option("--warnings", "show warning-severity diagnostics (default)").option("--no-warnings", "hide warning-severity diagnostics (errors only)").option("--color", "force colored output").option("--no-color", "disable colored output (also honors NO_COLOR)").addHelpText("after", renderRootHelpEpilog);
66408
66990
  program.action(inspectAction);
66991
+ program.command("design [directory]").description("Run only the focused UI design diagnostics").addHelpText("after", renderDesignHelpEpilog).action((directory, _options, command) => designAction(directory ?? ".", command.optsWithGlobals()));
66409
66992
  program.command("why <location>").description("Explain why a rule fired (or why a suppression didn't apply) at a file:line").option("--project <name>", "select projects: workspace names or directory paths (comma-separated for multiple)").option("-c, --cwd <cwd>", "working directory", process.cwd()).option("--color", "force colored output").option("--no-color", "disable colored output (also honors NO_COLOR)").action((location, options) => whyAction(location, options));
66410
66993
  program.command("install").alias("setup").description("Install the react-doctor skill into your coding agents and optional git hook").option("-y, --yes", "skip prompts, install for all detected agents").option("--dry-run", "show what would be installed without writing files").option("--agent-hooks", "install native non-blocking agent hooks for Claude Code and Cursor").option("-c, --cwd <cwd>", "working directory", process.cwd()).option("--color", "force colored output").option("--no-color", "disable colored output (also honors NO_COLOR)").addHelpText("after", renderInstallHelpEpilog).action(installAction);
66411
66994
  const providerOption = ["--provider <name>", "ci provider: github-actions or gitlab-ci (auto-detected by default)"];
@@ -66454,4 +67037,4 @@ Promise.resolve().then(() => assertNoRemovedFlags(process.argv)).then(() => prog
66454
67037
  export {};
66455
67038
 
66456
67039
  //# sourceMappingURL=cli.js.map
66457
- //# debugId=1b59ca76-9135-54e6-9391-ce7fec27b699
67040
+ //# debugId=87efffda-8fc4-5b52-80e1-7ec503c85206