react-doctor 0.8.1-dev.3018538 → 0.8.1-dev.359d9b3

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]="263a3384-e99c-5526-89f9-c7e1a6bd4e76")}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;
@@ -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,11 +37206,15 @@ const getPreactVersion = (packageJson) => {
37101
37206
  ...packageJson.devDependencies
37102
37207
  }.preact ?? null;
37103
37208
  };
37104
- const resolveCatalogBackedDependencyVersion = ({ rootDirectory, rootPackageJson, packageName, version }) => {
37209
+ const resolveCatalogBackedDependencyVersion = ({ rootDirectory, rootPackageJson, packageName, sourceDirectory = rootDirectory, sourcePackageJson = rootPackageJson, version }) => {
37105
37210
  if (version === null || !isCatalogReference(version)) return version;
37106
37211
  const catalogName = extractCatalogName(version);
37107
- const resolvedLocalVersion = resolveCatalogVersion(rootPackageJson, packageName, rootDirectory, catalogName);
37108
- 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
+ }
37109
37218
  const monorepoRoot = findMonorepoRoot(rootDirectory);
37110
37219
  if (!monorepoRoot) return version;
37111
37220
  const monorepoPackageJsonPath = Path.join(monorepoRoot, "package.json");
@@ -37303,15 +37412,19 @@ const listWorkspacePackages = (rootDirectory) => {
37303
37412
  }
37304
37413
  return packages;
37305
37414
  };
37415
+ const PREFERRED_DEPENDENCY_SECTIONS = [
37416
+ "dependencies",
37417
+ "peerDependencies",
37418
+ "devDependencies"
37419
+ ];
37306
37420
  const getPreferredDependencyVersion = ({ packageJson, packageNames }) => {
37307
- const allDependencies = {
37308
- ...packageJson.devDependencies,
37309
- ...packageJson.peerDependencies,
37310
- ...packageJson.dependencies
37311
- };
37312
37421
  for (const packageName of packageNames) {
37313
- const version = allDependencies[packageName];
37314
- if (version !== void 0) return version;
37422
+ const declaration = getDependencyDeclaration({
37423
+ packageJson,
37424
+ packageName,
37425
+ sections: PREFERRED_DEPENDENCY_SECTIONS
37426
+ });
37427
+ if (declaration.version !== null) return declaration.version;
37315
37428
  }
37316
37429
  return null;
37317
37430
  };
@@ -37322,18 +37435,6 @@ const getTanStackQueryVersion = (packageJson) => {
37322
37435
  packageNames: TANSTACK_REACT_QUERY_PACKAGES
37323
37436
  });
37324
37437
  };
37325
- const MOBX_PACKAGES = [
37326
- "mobx",
37327
- "mobx-react",
37328
- "mobx-react-lite",
37329
- "mobx-state-tree"
37330
- ];
37331
- const getMobxVersion = (packageJson) => {
37332
- return getPreferredDependencyVersion({
37333
- packageJson,
37334
- packageNames: MOBX_PACKAGES
37335
- });
37336
- };
37337
37438
  const STYLED_COMPONENTS_PACKAGES = ["styled-components"];
37338
37439
  const getStyledComponentsVersion = (packageJson) => {
37339
37440
  return getPreferredDependencyVersion({
@@ -37365,6 +37466,30 @@ const hasI18nDependency = (packageJson) => {
37365
37466
  return I18N_PACKAGES.some((packageName) => allDependencies[packageName] !== void 0);
37366
37467
  };
37367
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
+ ];
37368
37493
  const SHOPIFY_FLASH_LIST_PACKAGE_NAME = "@shopify/flash-list";
37369
37494
  const resolveWorkspaceDependencyVersion = ({ concreteVersion, packageName, rootDirectory, rootPackageJson, sections, workspaceDirectory, workspacePackageJson }) => {
37370
37495
  const dependencyDeclaration = getDependencyDeclaration({
@@ -37375,7 +37500,7 @@ const resolveWorkspaceDependencyVersion = ({ concreteVersion, packageName, rootD
37375
37500
  if (!dependencyDeclaration.hasDeclaration) return null;
37376
37501
  return concreteVersion ?? resolveCatalogVersion(workspacePackageJson, packageName, workspaceDirectory, dependencyDeclaration.catalogReference) ?? resolveCatalogVersion(rootPackageJson, packageName, rootDirectory, dependencyDeclaration.catalogReference);
37377
37502
  };
37378
- const shouldReplaceReactVersion = (currentVersion, nextVersion) => {
37503
+ const shouldReplaceWithLowerMajor = (currentVersion, nextVersion) => {
37379
37504
  if (!currentVersion) return true;
37380
37505
  const currentMajor = parseReactMajor(currentVersion);
37381
37506
  const nextMajor = parseReactMajor(nextVersion);
@@ -37383,15 +37508,71 @@ const shouldReplaceReactVersion = (currentVersion, nextVersion) => {
37383
37508
  if (nextMajor === null) return false;
37384
37509
  return nextMajor < currentMajor;
37385
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
+ };
37386
37522
  const shouldReplaceStyledComponentsVersion = (currentVersion, nextVersion) => {
37387
37523
  if (!currentVersion) return true;
37388
37524
  const currentMajor = getLowestDependencyMajor(currentVersion);
37389
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);
37390
37545
  if (currentMajor === null) return false;
37391
37546
  if (nextMajor === null) return true;
37392
- return nextMajor < currentMajor;
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;
37393
37565
  };
37394
- const evaluateManifestFacts = (facts, packageJson, directory) => {
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
+ };
37575
+ const evaluateManifestFacts = (facts, packageJson, directory, rootDirectory, rootPackageJson) => {
37395
37576
  if (facts.expo.version === null) {
37396
37577
  const spec = getDependencySpec(packageJson, "expo");
37397
37578
  if (spec !== null) facts.expo = {
@@ -37406,6 +37587,23 @@ const evaluateManifestFacts = (facts, packageJson, directory) => {
37406
37587
  sourceDirectory: directory
37407
37588
  };
37408
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;
37409
37607
  if (facts.shopifyFlashList.version === null) {
37410
37608
  const spec = getDependencySpec(packageJson, SHOPIFY_FLASH_LIST_PACKAGE_NAME);
37411
37609
  if (spec !== null) facts.shopifyFlashList = {
@@ -37413,18 +37611,113 @@ const evaluateManifestFacts = (facts, packageJson, directory) => {
37413
37611
  sourceDirectory: directory
37414
37612
  };
37415
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
+ }
37416
37644
  if (facts.reanimatedVersion === null) {
37417
37645
  const spec = getDependencySpec(packageJson, REANIMATED_DEPENDENCY_NAME);
37418
37646
  if (spec !== null) facts.reanimatedVersion = spec;
37419
37647
  }
37648
+ if (facts.valtioVersion === null) {
37649
+ const spec = getDependencySpec(packageJson, "valtio");
37650
+ if (spec !== null) facts.valtioVersion = spec;
37651
+ }
37420
37652
  facts.tanstackQueryVersion ??= getTanStackQueryVersion(packageJson);
37421
- facts.mobxVersion ??= getMobxVersion(packageJson);
37422
- const styledComponentsVersion = getStyledComponentsVersion(packageJson);
37653
+ const styledComponentsVersion = resolveCatalogBackedDependencyVersion({
37654
+ rootDirectory: directory,
37655
+ rootPackageJson: packageJson,
37656
+ packageName: "styled-components",
37657
+ version: getStyledComponentsVersion(packageJson)
37658
+ });
37423
37659
  if (styledComponentsVersion && shouldReplaceStyledComponentsVersion(facts.styledComponentsVersion, styledComponentsVersion)) facts.styledComponentsVersion = styledComponentsVersion;
37424
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
+ }
37425
37698
  facts.hasReactNativeAwarePackage = facts.hasReactNativeAwarePackage || isPackageJsonReactNativeAware(packageJson);
37426
37699
  facts.hasReanimatedAwarePackage = facts.hasReanimatedAwarePackage || isPackageJsonReanimatedAware(packageJson);
37427
37700
  facts.hasSsrDependency = facts.hasSsrDependency || isPackageJsonSsrAware(packageJson);
37701
+ const remotionSpec = getDependencySpec(packageJson, "remotion");
37702
+ if (remotionSpec !== null) {
37703
+ facts.hasRemotionDependency = true;
37704
+ const resolvedRemotionVersion = resolveCatalogBackedDependencyVersion({
37705
+ rootDirectory,
37706
+ rootPackageJson,
37707
+ packageName: "remotion",
37708
+ version: remotionSpec
37709
+ });
37710
+ const remotionMajorVersion = resolvedRemotionVersion === null ? null : getLowestDependencyMajor(resolvedRemotionVersion);
37711
+ if (remotionMajorVersion === null) {
37712
+ facts.hasUnknownRemotionVersion = true;
37713
+ facts.remotionVersion = null;
37714
+ } else if (!facts.hasUnknownRemotionVersion) {
37715
+ const currentRemotionMajorVersion = facts.remotionVersion === null ? null : getLowestDependencyMajor(facts.remotionVersion);
37716
+ if (currentRemotionMajorVersion === null || remotionMajorVersion < currentRemotionMajorVersion) facts.remotionVersion = resolvedRemotionVersion;
37717
+ }
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);
37428
37721
  };
37429
37722
  const collectWorkspaceFacts = (rootDirectory, rootPackageJson, { collectReactGroup }) => {
37430
37723
  const facts = {
@@ -37440,29 +37733,60 @@ const collectWorkspaceFacts = (rootDirectory, rootPackageJson, { collectReactGro
37440
37733
  version: null,
37441
37734
  sourceDirectory: null
37442
37735
  },
37736
+ reactRouter: {
37737
+ version: null,
37738
+ sourceDirectory: null,
37739
+ packageName: null
37740
+ },
37443
37741
  shopifyFlashList: {
37444
37742
  version: null,
37445
37743
  sourceDirectory: null
37446
37744
  },
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
+ },
37447
37760
  tanstackQueryVersion: null,
37448
- mobxVersion: null,
37449
37761
  styledComponentsVersion: null,
37450
37762
  hasI18nLibrary: false,
37451
37763
  hasReactNativeAwarePackage: false,
37452
37764
  hasReanimatedAwarePackage: false,
37453
37765
  hasSsrDependency: false,
37766
+ hasRemotionDependency: false,
37767
+ hasUnknownRemotionVersion: false,
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,
37454
37778
  reanimatedVersion: null
37455
37779
  };
37456
- evaluateManifestFacts(facts, rootPackageJson, rootDirectory);
37780
+ evaluateManifestFacts(facts, rootPackageJson, rootDirectory, rootDirectory, rootPackageJson);
37457
37781
  let isReactGroupSettled = !collectReactGroup;
37458
37782
  const visitedDirectories = /* @__PURE__ */ new Set();
37459
37783
  for (const pattern of getWorkspacePatterns(rootDirectory, rootPackageJson)) {
37460
- const directories = [...resolveWorkspaceDirectories(rootDirectory, pattern)].sort();
37784
+ const directories = resolveWorkspaceDirectories(rootDirectory, pattern).toSorted();
37461
37785
  for (const workspaceDirectory of directories) {
37462
37786
  if (visitedDirectories.has(workspaceDirectory)) continue;
37463
37787
  visitedDirectories.add(workspaceDirectory);
37464
37788
  const workspacePackageJson = readPackageJson$1(Path.join(workspaceDirectory, "package.json"));
37465
- evaluateManifestFacts(facts, workspacePackageJson, workspaceDirectory);
37789
+ evaluateManifestFacts(facts, workspacePackageJson, workspaceDirectory, rootDirectory, rootPackageJson);
37466
37790
  const info = extractDependencyInfo(workspacePackageJson);
37467
37791
  if (info.framework !== "unknown" && frameworkMergeRank(info.framework) < frameworkMergeRank(facts.framework)) facts.framework = info.framework;
37468
37792
  if (isReactGroupSettled) continue;
@@ -37493,7 +37817,7 @@ const collectWorkspaceFacts = (rootDirectory, rootPackageJson, { collectReactGro
37493
37817
  workspaceDirectory,
37494
37818
  workspacePackageJson
37495
37819
  });
37496
- if (reactVersion && shouldReplaceReactVersion(facts.reactVersion, reactVersion)) facts.reactVersion = reactVersion;
37820
+ if (reactVersion && shouldReplaceWithLowerMajor(facts.reactVersion, reactVersion)) facts.reactVersion = reactVersion;
37497
37821
  if (tailwindVersion && !facts.tailwindVersion) facts.tailwindVersion = tailwindVersion;
37498
37822
  if (zodVersion && !facts.zodVersion) facts.zodVersion = zodVersion;
37499
37823
  const settledReactMajor = parseReactMajor(facts.reactVersion);
@@ -37683,21 +38007,43 @@ const discoverProjectWithoutPackageJson = (directory) => {
37683
38007
  tailwindVersion: null,
37684
38008
  zodVersion: null,
37685
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,
37686
38020
  framework: "unknown",
37687
38021
  hasTypeScript: hasOwnTsConfig,
37688
38022
  hasReactCompiler: false,
37689
38023
  hasReactCompilerLintPlugin: false,
37690
38024
  hasTanStackQuery: false,
38025
+ valtioVersion: null,
38026
+ valtioMajorVersion: null,
38027
+ hasRemotion: false,
38028
+ remotionVersion: null,
38029
+ remotionMajorVersion: null,
37691
38030
  hasI18nLibrary: false,
37692
38031
  tanstackQueryVersion: null,
37693
- mobxVersion: null,
37694
38032
  styledComponentsVersion: null,
38033
+ hasThree: false,
38034
+ threeVersion: null,
38035
+ threeRelease: null,
38036
+ hasReactThreeFiber: false,
38037
+ reactThreeFiberVersion: null,
38038
+ reactThreeFiberMajorVersion: null,
37695
38039
  hasSsrDependency: false,
37696
38040
  preactVersion: null,
37697
38041
  preactMajorVersion: null,
37698
38042
  hasReactNativeWorkspace: false,
37699
38043
  nextjsVersion: null,
37700
38044
  nextjsMajorVersion: null,
38045
+ reactRouterVersion: null,
38046
+ hasReactRouterFramework: false,
37701
38047
  expoVersion: null,
37702
38048
  shopifyFlashListVersion: null,
37703
38049
  shopifyFlashListMajorVersion: null,
@@ -37790,6 +38136,12 @@ const discoverProject = (directory) => {
37790
38136
  packageName: SHOPIFY_FLASH_LIST_PACKAGE_NAME,
37791
38137
  version: workspaceFacts.shopifyFlashList.version
37792
38138
  }) : null;
38139
+ const zustandVersion = resolveCatalogBackedDependencyVersion({
38140
+ rootDirectory: directory,
38141
+ rootPackageJson: packageJson,
38142
+ packageName: "zustand",
38143
+ version: workspaceFacts.zustand.version
38144
+ });
37793
38145
  const hasReanimated = hasReactNativeWorkspace && workspaceFacts.hasReanimatedAwarePackage;
37794
38146
  const reanimatedVersion = hasReanimated ? workspaceFacts.reanimatedVersion : null;
37795
38147
  const nextjsVersion = framework === "nextjs" ? resolveCatalogBackedDependencyVersion({
@@ -37798,8 +38150,39 @@ const discoverProject = (directory) => {
37798
38150
  packageName: "next",
37799
38151
  version: workspaceFacts.next.version
37800
38152
  }) : null;
38153
+ const valtioVersion = resolveCatalogBackedDependencyVersion({
38154
+ rootDirectory: directory,
38155
+ rootPackageJson: packageJson,
38156
+ packageName: "valtio",
38157
+ version: workspaceFacts.valtioVersion
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
+ });
37801
38171
  const preactVersion = getPreactVersion(packageJson);
38172
+ const remotionVersion = workspaceFacts.remotionVersion;
37802
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
+ });
37803
38186
  const isPreES2023Target = hasTypeScript && detectPreES2023Target(directory);
37804
38187
  const projectInfo = {
37805
38188
  rootDirectory: directory,
@@ -37809,6 +38192,16 @@ const discoverProject = (directory) => {
37809
38192
  tailwindVersion,
37810
38193
  zodVersion,
37811
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),
37812
38205
  framework,
37813
38206
  hasTypeScript,
37814
38207
  hasReactCompiler: detectReactCompiler(directory, packageJson),
@@ -37816,14 +38209,26 @@ const discoverProject = (directory) => {
37816
38209
  hasTanStackQuery: tanstackQueryVersion !== null,
37817
38210
  hasI18nLibrary: workspaceFacts.hasI18nLibrary,
37818
38211
  tanstackQueryVersion,
37819
- mobxVersion: workspaceFacts.mobxVersion,
37820
38212
  styledComponentsVersion: workspaceFacts.styledComponentsVersion,
38213
+ valtioVersion,
38214
+ valtioMajorVersion: valtioVersion === null ? null : getLowestDependencyMajor(valtioVersion),
38215
+ hasRemotion: workspaceFacts.hasRemotionDependency,
38216
+ remotionVersion,
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),
37821
38224
  hasSsrDependency: workspaceFacts.hasSsrDependency,
37822
38225
  preactVersion,
37823
38226
  preactMajorVersion: parseReactMajor(preactVersion),
37824
38227
  hasReactNativeWorkspace,
37825
38228
  nextjsVersion,
37826
38229
  nextjsMajorVersion: nextjsVersion === null ? null : getLowestDependencyMajor(nextjsVersion),
38230
+ reactRouterVersion,
38231
+ hasReactRouterFramework: workspaceFacts.hasReactRouterFramework,
37827
38232
  expoVersion,
37828
38233
  shopifyFlashListVersion,
37829
38234
  shopifyFlashListMajorVersion: shopifyFlashListVersion === null ? null : getLowestDependencyMajor(shopifyFlashListVersion),
@@ -40372,9 +40777,25 @@ const BABEL_CONFIG_FILE_NAMES = [
40372
40777
  ".babelrc.json"
40373
40778
  ];
40374
40779
  const LEGACY_PRESET_SPEC = "module:metro-react-native-babel-preset";
40780
+ const LEGACY_PRESET_PACKAGE = "metro-react-native-babel-preset";
40781
+ const REACT_NATIVE_PACKAGE = "react-native";
40782
+ const PRESET_RENAME_MINIMUM_REACT_NATIVE_VERSION = "0.73.0";
40783
+ const LEGACY_PRESET_REFERENCE = new RegExp(`['"]${LEGACY_PRESET_SPEC}['"]`);
40375
40784
  const MODERN_PRESET_REFERENCE = new RegExp(`['"]module:@react-native/babel-preset['"]`);
40376
40785
  const ENABLE_BABEL_RUNTIME_VERSION = /enableBabelRuntime["']?\s*:\s*['"]/;
40786
+ const isReactNativeVersionAtLeastPresetRename = (rootDirectory, packageJson) => {
40787
+ const installedReactNativeManifestPath = Path.join(rootDirectory, "node_modules", REACT_NATIVE_PACKAGE, "package.json");
40788
+ const reactNativeVersionSpec = (isFile(installedReactNativeManifestPath) ? readPackageJson$1(installedReactNativeManifestPath).version : void 0) ?? getDependencySpec(packageJson, REACT_NATIVE_PACKAGE);
40789
+ if (reactNativeVersionSpec === null || reactNativeVersionSpec === void 0) return false;
40790
+ const normalizedVersionRange = import_semver.validRange(reactNativeVersionSpec);
40791
+ if (normalizedVersionRange === null) return false;
40792
+ const minimumVersion = import_semver.minVersion(normalizedVersionRange);
40793
+ return minimumVersion !== null && import_semver.gte(minimumVersion, PRESET_RENAME_MINIMUM_REACT_NATIVE_VERSION);
40794
+ };
40795
+ const canResolveLegacyPreset = (rootDirectory, packageJson) => getDependencySpec(packageJson, LEGACY_PRESET_PACKAGE) !== null || isFile(Path.join(rootDirectory, "node_modules", LEGACY_PRESET_PACKAGE, "package.json"));
40377
40796
  const checkReactNativeMetroBabelPreset = (rootDirectory) => {
40797
+ const packageJson = readPackageJson$1(Path.join(rootDirectory, "package.json"));
40798
+ const shouldReportLegacyPreset = isReactNativeVersionAtLeastPresetRename(rootDirectory, packageJson) && !canResolveLegacyPreset(rootDirectory, packageJson);
40378
40799
  for (const fileName of BABEL_CONFIG_FILE_NAMES) {
40379
40800
  const filePath = Path.join(rootDirectory, fileName);
40380
40801
  if (!isFile(filePath)) continue;
@@ -40384,7 +40805,7 @@ const checkReactNativeMetroBabelPreset = (rootDirectory) => {
40384
40805
  } catch {
40385
40806
  continue;
40386
40807
  }
40387
- if (contents.includes(LEGACY_PRESET_SPEC)) return [buildReactNativeDiagnostic({
40808
+ if (shouldReportLegacyPreset && LEGACY_PRESET_REFERENCE.test(contents)) return [buildReactNativeDiagnostic({
40388
40809
  filePath: fileName,
40389
40810
  rule: "rn-no-metro-babel-preset",
40390
40811
  severity: "error",
@@ -40407,12 +40828,6 @@ const checkReactNativeProject = (rootDirectory, project) => {
40407
40828
  return [...checkReactNativeMetroBabelPreset(rootDirectory), ...checkReactNativeLibraryDependencies(rootDirectory)];
40408
40829
  };
40409
40830
  const RULE_KEY = "no-vulnerable-react-server-components";
40410
- const DEPENDENCY_SECTIONS = [
40411
- "dependencies",
40412
- "devDependencies",
40413
- "peerDependencies",
40414
- "optionalDependencies"
40415
- ];
40416
40831
  const REACT_RSC_ADVISORIES_BY_MINOR = {
40417
40832
  "19.0": {
40418
40833
  rceFixedVersion: "19.0.1",
@@ -40459,20 +40874,13 @@ const enumerateWorkspaceDirectories = (workspaceRoot) => {
40459
40874
  for (const pattern of patterns) for (const directory of resolveWorkspaceDirectories(workspaceRoot, pattern)) directories.add(directory);
40460
40875
  return [...directories];
40461
40876
  };
40462
- const readDeclaredSpec = (packageJson, packageName) => {
40463
- for (const section of DEPENDENCY_SECTIONS) {
40464
- const spec = packageJson[section]?.[packageName];
40465
- if (typeof spec === "string") return spec;
40466
- }
40467
- return null;
40468
- };
40469
40877
  const resolveVersionInDirectory = (directory, packageName, declaredSpecOverride) => {
40470
40878
  const manifestPath = Path.join(directory, "node_modules", packageName, "package.json");
40471
40879
  if (isFile(manifestPath)) {
40472
40880
  const installedVersion = import_semver.valid(readPackageJson$1(manifestPath).version ?? null);
40473
40881
  if (installedVersion !== null) return installedVersion;
40474
40882
  }
40475
- const candidateSpecs = [readDeclaredSpec(readPackageJson$1(Path.join(directory, "package.json")), packageName), declaredSpecOverride];
40883
+ const candidateSpecs = [getDependencySpec(readPackageJson$1(Path.join(directory, "package.json")), packageName), declaredSpecOverride];
40476
40884
  for (const spec of candidateSpecs) {
40477
40885
  const pinnedVersion = spec === null ? null : import_semver.valid(spec);
40478
40886
  if (pinnedVersion !== null) return pinnedVersion;
@@ -41124,10 +41532,10 @@ const SSR_FRAMEWORKS = new Set([
41124
41532
  "gatsby",
41125
41533
  "tanstack-start"
41126
41534
  ]);
41127
- const addMajorLadder = (capabilities, name, major, earliest, latest) => {
41128
- if (major === null) return;
41129
- const cappedMajor = Math.min(major, latest);
41130
- 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}`);
41131
41539
  };
41132
41540
  const buildCapabilities = (project) => {
41133
41541
  const capabilities = /* @__PURE__ */ new Set();
@@ -41141,31 +41549,85 @@ const buildCapabilities = (project) => {
41141
41549
  if (project.isStaticExport) capabilities.add("nextjs:static-export");
41142
41550
  if (project.nextjsMajorVersion !== null && project.nextjsMajorVersion >= 15) capabilities.add("nextjs:15");
41143
41551
  if (project.nextjsMajorVersion !== null && project.nextjsMajorVersion >= 16) capabilities.add("nextjs:16");
41144
- addMajorLadder(capabilities, "react", project.reactMajorVersion, 17, 30);
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);
41145
41562
  if (project.reactMajorVersion !== null && project.reactMajorVersion >= 19 && isMajorMinorAtLeast(parseReactMajorMinor(project.reactVersion), {
41146
41563
  major: 19,
41147
41564
  minor: 2
41148
41565
  })) capabilities.add("react:19.2");
41149
- if (project.tailwindVersion !== null) capabilities.add("tailwind");
41150
- if (project.tailwindVersion !== null && isMajorMinorAtLeast(parseTailwindMajorMinor(project.tailwindVersion), {
41151
- major: 3,
41152
- minor: 4
41153
- })) 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
+ }
41154
41578
  if (project.zodVersion !== null) capabilities.add("zod");
41155
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);
41156
41607
  if (project.isPreES2023Target) capabilities.add("pre-es2023");
41157
41608
  if (project.hasReactCompiler) capabilities.add("react-compiler");
41158
41609
  if (Boolean(project.hasTanStackQuery) || Boolean(project.tanstackQueryVersion)) capabilities.add("tanstack-query");
41159
- if (project.mobxVersion) capabilities.add("mobx");
41160
41610
  if (project.styledComponentsVersion) {
41161
41611
  capabilities.add("styled-components");
41162
41612
  const styledComponentsMajor = getLowestDependencyMajor(project.styledComponentsVersion);
41163
41613
  if (styledComponentsMajor !== null && styledComponentsMajor >= 6) capabilities.add("styled-components:6");
41164
41614
  }
41165
41615
  if (project.hasI18nLibrary) capabilities.add("i18n");
41616
+ if (project.valtioVersion !== null) capabilities.add("valtio");
41617
+ addVersionCapabilityLadder(capabilities, "valtio", project.valtioMajorVersion, 1, 10);
41618
+ if (project.hasRemotion) {
41619
+ capabilities.add("remotion");
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);
41627
+ }
41166
41628
  if (project.hasTypeScript) capabilities.add("typescript");
41167
41629
  if (project.preactVersion !== null) capabilities.add("preact");
41168
- addMajorLadder(capabilities, "preact", project.preactMajorVersion, 10, 20);
41630
+ addVersionCapabilityLadder(capabilities, "preact", project.preactMajorVersion, 10, 20);
41169
41631
  if (project.preactVersion !== null && project.reactVersion === null) capabilities.add("pure-preact");
41170
41632
  return capabilities;
41171
41633
  };
@@ -41177,7 +41639,7 @@ const getCapabilities = (project) => {
41177
41639
  capabilitiesByProject.set(project, capabilities);
41178
41640
  return capabilities;
41179
41641
  };
41180
- const shouldEnableRule = (requires, tags, capabilities, ignoredTags, disabledWhen) => {
41642
+ const shouldEnableRule = (requires, tags, capabilities, ignoredTags, disabledWhen, includedTags) => {
41181
41643
  if (requires) {
41182
41644
  for (const capability of requires) if (!capabilities.has(capability)) return false;
41183
41645
  }
@@ -41188,20 +41650,29 @@ const shouldEnableRule = (requires, tags, capabilities, ignoredTags, disabledWhe
41188
41650
  if (tags) {
41189
41651
  for (const tag of tags) if (ignoredTags.has(tag)) return false;
41190
41652
  }
41653
+ if (includedTags && includedTags.size > 0) {
41654
+ if (!tags?.some((tag) => includedTags.has(tag))) return false;
41655
+ }
41191
41656
  return true;
41192
41657
  };
41658
+ const shouldEnableRuleByDefaultStatus = (options) => options.defaultEnabled !== false || options.hasExplicitOverride === true || options.includeTagDefaults && options.hasIncludedTags;
41193
41659
  const yieldToEventLoop = () => new Promise((resolve) => {
41194
41660
  setImmediate(resolve);
41195
41661
  });
41196
41662
  const createSecurityScanSession = (rootDirectory, options) => {
41197
41663
  const capabilities = options.project ? getCapabilities(options.project) : /* @__PURE__ */ new Set();
41198
41664
  const ignoredTags = options.ignoredTags ?? /* @__PURE__ */ new Set();
41665
+ const includedTags = options.includedTags ?? /* @__PURE__ */ new Set();
41199
41666
  const enabledScanRules = REACT_DOCTOR_RULES.flatMap((entry) => {
41200
41667
  const rule = entry.rule;
41201
41668
  const scan = rule.scan;
41202
41669
  if (typeof scan !== "function") return [];
41203
- if (rule.defaultEnabled === false) return [];
41204
- 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 [];
41205
41676
  return [{
41206
41677
  entry,
41207
41678
  scan,
@@ -43203,8 +43674,9 @@ const buildUserPluginRules = (userPlugin, severityControls) => {
43203
43674
  }
43204
43675
  return enabled;
43205
43676
  };
43206
- const createOxlintConfig = ({ pluginPath, project, customRulesOnly = false, extendsPaths = [], ignoredTags = /* @__PURE__ */ new Set(), serverAuthFunctionNames, severityControls, userPlugins = [], disableReactHooksJsPlugin = false, ruleSelection, sidecarRuleIdFilter }) => {
43207
- 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);
43208
43680
  const reactCompilerRules = reactHooksJsPlugin ? applyRuleSeverityControls(filterRulesToAvailable(REACT_COMPILER_RULES, "react-hooks-js", reactHooksJsPlugin.availableRuleNames), severityControls) : {};
43209
43681
  const jsPlugins = [];
43210
43682
  if (reactHooksJsPlugin) jsPlugins.push(reactHooksJsPlugin.entry);
@@ -43219,9 +43691,14 @@ const createOxlintConfig = ({ pluginPath, project, customRulesOnly = false, exte
43219
43691
  if (rule.scan !== void 0) continue;
43220
43692
  if (customRulesOnly && registryEntry.originallyExternal) continue;
43221
43693
  if (rule.framework !== "global" && !rule.requires) continue;
43222
- if (!shouldEnableRule(rule.requires, rule.tags, capabilities, ignoredTags, rule.disabledWhen)) continue;
43694
+ if (!shouldEnableRule(rule.requires, rule.tags, capabilities, ignoredTags, rule.disabledWhen, includedTags)) continue;
43223
43695
  const explicitRuleOverride = resolveRuleSeverityOverride({ ruleKey: registryEntry.key }, severityControls);
43224
- 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;
43225
43702
  const severity = resolveRuleSeverityOverride({
43226
43703
  ruleKey: registryEntry.key,
43227
43704
  category: rule.category
@@ -43230,7 +43707,7 @@ const createOxlintConfig = ({ pluginPath, project, customRulesOnly = false, exte
43230
43707
  enabledReactDoctorRules[registryEntry.key] = severity;
43231
43708
  }
43232
43709
  const userPluginRules = {};
43233
- if (ruleSelection !== "sidecar") for (const userPlugin of userPlugins) {
43710
+ if (ruleSelection !== "sidecar" && !hasIncludedTags) for (const userPlugin of userPlugins) {
43234
43711
  Object.assign(userPluginRules, buildUserPluginRules(userPlugin, severityControls));
43235
43712
  jsPlugins.push(userPlugin.entry);
43236
43713
  }
@@ -44975,7 +45452,7 @@ const reactHooksJsPluginDropNote = (error) => {
44975
45452
  * 6. always restore disable directives + clean up the temp dir
44976
45453
  */
44977
45454
  const runOxlint = async (options) => {
44978
- 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;
44979
45456
  const serverAuthFunctionNames = Array.isArray(userConfig?.serverAuthFunctionNames) ? userConfig.serverAuthFunctionNames.filter((entry) => typeof entry === "string" && entry.length > 0) : void 0;
44980
45457
  const severityControls = buildRuleSeverityControls(userConfig);
44981
45458
  validateRuleRegistration();
@@ -44989,13 +45466,15 @@ const runOxlint = async (options) => {
44989
45466
  }
44990
45467
  const pluginPath = resolvePluginPath();
44991
45468
  const extendsPaths = (adoptExistingLintConfig && !customRulesOnly ? detectUserLintConfigPaths(rootDirectory) : []).filter(canOxlintExtendConfig);
44992
- const userPlugins = resolveUserPlugins(userConfig?.plugins, configSourceDirectory);
45469
+ const userPlugins = includedTags.size > 0 ? [] : resolveUserPlugins(userConfig?.plugins, configSourceDirectory);
44993
45470
  const buildConfig = (overrides) => createOxlintConfig({
44994
45471
  pluginPath,
44995
45472
  project,
44996
45473
  customRulesOnly,
44997
45474
  extendsPaths: overrides.extendsPaths,
44998
45475
  ignoredTags,
45476
+ includedTags,
45477
+ includeTagDefaults,
44999
45478
  serverAuthFunctionNames,
45000
45479
  severityControls,
45001
45480
  userPlugins,
@@ -45384,6 +45863,8 @@ var Linter = class Linter extends Service()("react-doctor/Linter") {
45384
45863
  respectInlineDisables: input.respectInlineDisables,
45385
45864
  adoptExistingLintConfig: input.adoptExistingLintConfig,
45386
45865
  ignoredTags: input.ignoredTags,
45866
+ includedTags: input.includedTags,
45867
+ includeTagDefaults: input.includeTagDefaults,
45387
45868
  userConfig: input.userConfig ?? null,
45388
45869
  configSourceDirectory: input.configSourceDirectory,
45389
45870
  onPartialFailure: (reason) => {
@@ -46232,7 +46713,9 @@ const runInspect = (input, hooks = {}) => gen(function* () {
46232
46713
  const securityScanFailedRef = yield* make$13(false);
46233
46714
  const securityScanFiber = yield* forkChild(runCollect(applyPerElementPipeline(isDiffMode ? empty$4 : unwrap(tryPromise(() => checkSecurityScanCooperative(scanDirectory, {
46234
46715
  project,
46235
- ignoredTags: input.ignoredTags
46716
+ ignoredTags: input.ignoredTags,
46717
+ includedTags: input.includedTags,
46718
+ includeTagDefaults: input.includeTagDefaults
46236
46719
  })).pipe(map$3((diagnostics) => fromIterable$1(diagnostics)), catch_$1(() => set(securityScanFailedRef, true).pipe(as(empty$4))))))).pipe(withSpan("SecurityScan.run")));
46237
46720
  const shouldRunSupplyChain = !isDiffMode || (input.supplyChainManifestChanged ?? false);
46238
46721
  const supplyChainOverlapTimeout = yield* SupplyChainOverlapTimeoutMs;
@@ -46323,6 +46806,8 @@ const runInspect = (input, hooks = {}) => gen(function* () {
46323
46806
  respectInlineDisables: input.respectInlineDisables,
46324
46807
  adoptExistingLintConfig: input.adoptExistingLintConfig,
46325
46808
  ignoredTags: input.ignoredTags,
46809
+ includedTags: input.includedTags,
46810
+ includeTagDefaults: input.includeTagDefaults,
46326
46811
  userConfig: resolvedConfig.config ?? void 0,
46327
46812
  configSourceDirectory: resolvedConfig.configSourceDirectory ?? void 0,
46328
46813
  onFileProgress: (scannedFileCount, totalFileCount) => {
@@ -47467,7 +47952,7 @@ const makeNoopConsole = () => ({
47467
47952
  });
47468
47953
  //#endregion
47469
47954
  //#region src/cli/utils/version.ts
47470
- const VERSION = "0.8.1-dev.3018538";
47955
+ const VERSION = "0.8.1-dev.359d9b3";
47471
47956
  //#endregion
47472
47957
  //#region src/cli/utils/json-mode.ts
47473
47958
  let context = null;
@@ -47554,7 +48039,11 @@ const getRunId = () => {
47554
48039
  };
47555
48040
  //#endregion
47556
48041
  //#region src/cli/utils/build-run-context.ts
47557
- const ROOT_SUBCOMMANDS = new Set(["install", "setup"]);
48042
+ const ROOT_SUBCOMMANDS = new Set([
48043
+ "design",
48044
+ "install",
48045
+ "setup"
48046
+ ]);
47558
48047
  const detectInvokedVia = () => {
47559
48048
  const userAgent = process.env.npm_config_user_agent;
47560
48049
  if (!userAgent) return "unknown";
@@ -47821,13 +48310,13 @@ const isDevVersion = (version) => version === "0.0.0" || version.includes("-");
47821
48310
  * uploads source-map artifacts under, so stack frames symbolicate. Honors the
47822
48311
  * standard `SENTRY_RELEASE` override.
47823
48312
  */
47824
- const resolveSentryRelease = () => process.env.SENTRY_RELEASE || `react-doctor@0.8.1-dev.3018538`;
48313
+ const resolveSentryRelease = () => process.env.SENTRY_RELEASE || `react-doctor@0.8.1-dev.359d9b3`;
47825
48314
  /**
47826
48315
  * Deployment environment shown in Sentry's environment filter. Defaults to
47827
48316
  * `production` for tagged releases and `development` for dev/unbuilt versions,
47828
48317
  * overridable via the standard `SENTRY_ENVIRONMENT` env var.
47829
48318
  */
47830
- const resolveSentryEnvironment = () => process.env.SENTRY_ENVIRONMENT || (isDevVersion("0.8.1-dev.3018538") ? "development" : "production");
48319
+ const resolveSentryEnvironment = () => process.env.SENTRY_ENVIRONMENT || (isDevVersion("0.8.1-dev.359d9b3") ? "development" : "production");
47831
48320
  /**
47832
48321
  * Performance-tracing sample rate in `[0, 1]`. Reads `SENTRY_TRACES_SAMPLE_RATE`
47833
48322
  * (set to `0` to disable tracing) and falls back to
@@ -60153,6 +60642,8 @@ const buildScanResultCacheKey = (input) => {
60153
60642
  warnings: input.options.warnings,
60154
60643
  adoptExistingLintConfig: input.options.adoptExistingLintConfig,
60155
60644
  ignoredTags: [...input.options.ignoredTags].sort(),
60645
+ includedTags: [...input.options.includedTags].sort(),
60646
+ includeTagDefaults: input.options.includeTagDefaults,
60156
60647
  concurrency: input.options.concurrency,
60157
60648
  lintBatchOrdering: resolveLintBatchOrdering(),
60158
60649
  baselineRef: input.options.baseline?.ref,
@@ -60979,8 +61470,8 @@ const createDiagnosticEvidenceReader = (rootDirectory, options = {}) => {
60979
61470
  //#endregion
60980
61471
  //#region src/cli/utils/build-no-score-message.ts
60981
61472
  const ENTERPRISE_CONTACT_HINT = `Want something custom to your company? Contact us at ${ENTERPRISE_CONTACT_URL}.`;
60982
- const buildNoScoreMessage = (isScoreDisabled) => {
60983
- 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}`;
60984
61475
  };
60985
61476
  //#endregion
60986
61477
  //#region src/cli/utils/render-agent-guidance.ts
@@ -62105,40 +62596,47 @@ const buildChangedLineMatcher = (directory, changedLineRanges) => {
62105
62596
  return diagnosticIntersectsLineRanges(diagnostic, ranges);
62106
62597
  };
62107
62598
  };
62108
- const buildIgnoredTags = (userConfig) => {
62599
+ const buildIgnoredTags = (userConfig, includedTags) => {
62109
62600
  const tags = /* @__PURE__ */ new Set();
62110
62601
  if (userConfig?.ignore?.tags) for (const tag of userConfig.ignore.tags) tags.add(tag);
62602
+ for (const tag of includedTags) tags.delete(tag);
62111
62603
  return tags;
62112
62604
  };
62113
- const mergeInspectOptions = (inputOptions, userConfig) => ({
62114
- lint: inputOptions.lint ?? userConfig?.lint ?? true,
62115
- deadCode: inputOptions.deadCode ?? userConfig?.deadCode ?? true,
62116
- supplyChain: inputOptions.supplyChain ?? userConfig?.supplyChain?.enabled ?? true,
62117
- verbose: inputOptions.verbose ?? userConfig?.verbose ?? false,
62118
- outputDirectory: inputOptions.outputDirectory || null,
62119
- scoreOnly: inputOptions.scoreOnly ?? false,
62120
- noScore: inputOptions.noScore ?? userConfig?.noScore ?? false,
62121
- isCi: inputOptions.isCi ?? false,
62122
- isCiOrCodingAgentEnvironment: isCiOrCodingAgentEnvironment(),
62123
- isNonInteractiveEnvironment: isNonInteractiveEnvironment(),
62124
- silent: inputOptions.silent ?? false,
62125
- includePaths: inputOptions.includePaths ?? [],
62126
- customRulesOnly: userConfig?.customRulesOnly ?? false,
62127
- share: userConfig?.share ?? true,
62128
- respectInlineDisables: inputOptions.respectInlineDisables ?? userConfig?.respectInlineDisables ?? true,
62129
- warnings: inputOptions.warnings ?? userConfig?.warnings ?? true,
62130
- categoryFilters: new Set(resolveCliCategories(inputOptions.categoryFilters) ?? []),
62131
- adoptExistingLintConfig: userConfig?.adoptExistingLintConfig ?? true,
62132
- ignoredTags: buildIgnoredTags(userConfig),
62133
- outputSurface: inputOptions.outputSurface ?? "cli",
62134
- suppressRendering: inputOptions.suppressRendering ?? false,
62135
- concurrentScan: inputOptions.concurrentScan ?? false,
62136
- concurrency: inputOptions.concurrency,
62137
- maxDurationMs: inputOptions.maxDurationMs ?? null,
62138
- baseline: inputOptions.baseline ?? null,
62139
- changedLineRanges: inputOptions.changedLineRanges ?? null,
62140
- supplyChainManifestChanged: inputOptions.supplyChainManifestChanged ?? false
62141
- });
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
+ };
62142
62640
  const deriveScope = (options) => {
62143
62641
  if (options.baseline) return "changed";
62144
62642
  if (options.changedLineRanges !== null) return "lines";
@@ -62269,6 +62767,8 @@ const runBaselineComparison = async (params) => {
62269
62767
  warnings: params.options.warnings,
62270
62768
  adoptExistingLintConfig: params.options.adoptExistingLintConfig,
62271
62769
  ignoredTags: params.options.ignoredTags,
62770
+ includedTags: params.options.includedTags,
62771
+ includeTagDefaults: params.options.includeTagDefaults,
62272
62772
  nodeBinaryPath: params.resolvedNodeBinaryPath ?? void 0,
62273
62773
  runDeadCode: false,
62274
62774
  isCi: params.options.isCi,
@@ -62362,6 +62862,8 @@ const runInspectWithRuntime = async (directory, options, userConfig, hasConfigOv
62362
62862
  warnings: options.warnings,
62363
62863
  adoptExistingLintConfig: options.adoptExistingLintConfig,
62364
62864
  ignoredTags: options.ignoredTags,
62865
+ includedTags: options.includedTags,
62866
+ includeTagDefaults: options.includeTagDefaults,
62365
62867
  nodeBinaryPath: resolvedNodeBinaryPath ?? void 0,
62366
62868
  runDeadCode: options.deadCode,
62367
62869
  isCi: options.isCi,
@@ -62550,7 +63052,7 @@ const finalizeAndRender = (input) => gen(function* () {
62550
63052
  securityScanFailed
62551
63053
  });
62552
63054
  const hasSkippedChecks = skippedChecks.length > 0;
62553
- const noScoreMessage = buildNoScoreMessage(options.noScore);
63055
+ const noScoreMessage = buildNoScoreMessage(options.noScore, options.scoreDisabledMessage);
62554
63056
  const buildResult = () => ({
62555
63057
  diagnostics: [...diagnostics],
62556
63058
  score,
@@ -64655,21 +65157,25 @@ const resolveParallelFlag = (parallel) => parallel === false ? 1 : void 0;
64655
65157
  */
64656
65158
  const resolveCliInspectOptions = (flags, userConfig) => {
64657
65159
  const wantsWarningGate = pickBlockingLevel(flags, userConfig) === "warning";
65160
+ const isDesignScan = flags.design === true;
64658
65161
  return {
64659
65162
  lint: flags.lint,
64660
- deadCode: flags.deadCode,
64661
- supplyChain: flags.supplyChain,
65163
+ deadCode: isDesignScan ? false : flags.deadCode,
65164
+ supplyChain: isDesignScan ? false : flags.supplyChain,
64662
65165
  verbose: flags.verbose,
64663
65166
  outputDirectory: flags.outputDir,
64664
65167
  respectInlineDisables: flags.respectInlineDisables === false ? false : void 0,
64665
65168
  warnings: wantsWarningGate ? true : flags.warnings,
64666
65169
  scoreOnly: flags.score === true,
64667
- noScore: flags.score === false || flags.telemetry === false ? true : void 0,
65170
+ noScore: isDesignScan || flags.score === false || flags.telemetry === false ? true : void 0,
64668
65171
  isCi: isCiEnvironment(),
64669
65172
  silent: Boolean(flags.json),
64670
65173
  concurrency: resolveParallelFlag(flags.parallel),
64671
65174
  maxDurationMs: resolveMaxDurationFlag(flags.maxDuration),
64672
- 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
64673
65179
  };
64674
65180
  };
64675
65181
  //#endregion
@@ -65087,7 +65593,7 @@ const maybeMigrateLegacyConfig = async (requestedDirectory, { isQuiet, isStaged
65087
65593
  if (!(!isQuiet && !isStaged && process.stdout.isTTY === true && !isCiOrCodingAgentEnvironment())) return;
65088
65594
  await runProjectMigrations(requestedDirectory);
65089
65595
  };
65090
- const inspectAction = async (directory, flags) => {
65596
+ const inspectAction = async (directory, flags, invocationCommand = "inspect") => {
65091
65597
  const isScoreOnly = Boolean(flags.score);
65092
65598
  const isJsonMode = Boolean(flags.json);
65093
65599
  const isQuiet = isScoreOnly || isJsonMode;
@@ -65101,7 +65607,7 @@ const inspectAction = async (directory, flags) => {
65101
65607
  });
65102
65608
  if (flags.jsonOut) recordCount(METRIC.jsonOutUsed, 1);
65103
65609
  }
65104
- recordCount(METRIC.cliInvoked, 1, { command: "inspect" });
65610
+ recordCount(METRIC.cliInvoked, 1, { command: invocationCommand });
65105
65611
  try {
65106
65612
  validateModeFlags(flags);
65107
65613
  if (flags.staged) setJsonReportMode("staged");
@@ -65413,6 +65919,13 @@ const inspectAction = async (directory, flags) => {
65413
65919
  }
65414
65920
  };
65415
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
65416
65929
  //#region src/cli/commands/install.ts
65417
65930
  const installAction = async (options, command) => {
65418
65931
  recordCount(METRIC.cliInvoked, 1, { command: "install" });
@@ -66249,6 +66762,7 @@ const INSTALL_FLAG_SPEC = {
66249
66762
  shortOptionsWithRequiredValues: new Set(["-c"])
66250
66763
  };
66251
66764
  const COMMAND_FLAG_SPECS = new Map([
66765
+ ["design", ROOT_FLAG_SPEC],
66252
66766
  ["install", INSTALL_FLAG_SPEC],
66253
66767
  ["setup", INSTALL_FLAG_SPEC],
66254
66768
  ["version", {
@@ -66405,6 +66919,7 @@ ${formatExampleLines([
66405
66919
  ["react-doctor --scope changed --base main", "scan only new issues vs. main"],
66406
66920
  ["react-doctor --project modules/a,modules/b", "score each module separately (names or paths)"],
66407
66921
  ["react-doctor --staged", "scan staged files (pre-commit hook)"],
66922
+ ["react-doctor design", "run the focused UI design audit"],
66408
66923
  ["react-doctor --category Security", "show only one diagnostic category"],
66409
66924
  ["react-doctor --blocking warning", "fail CI on warnings too (default: error)"],
66410
66925
  ["react-doctor --json > report.json", "write a machine-readable report"],
@@ -66438,6 +66953,20 @@ ${highlighter.dim("Managing CI:")}
66438
66953
  ${highlighter.dim("Learn more:")}
66439
66954
  ${highlighter.info(CANONICAL_GITHUB_URL)}
66440
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
+ `;
66441
66970
  const renderCiHelpEpilog = () => `
66442
66971
  ${highlighter.dim("Examples:")}
66443
66972
  ${formatExampleLines([
@@ -66459,6 +66988,7 @@ ${highlighter.dim("Learn more:")}
66459
66988
  const collectCategoryOption = (value, previousValues) => [...previousValues ?? [], value];
66460
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);
66461
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()));
66462
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));
66463
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);
66464
66994
  const providerOption = ["--provider <name>", "ci provider: github-actions or gitlab-ci (auto-detected by default)"];
@@ -66507,4 +67037,4 @@ Promise.resolve().then(() => assertNoRemovedFlags(process.argv)).then(() => prog
66507
67037
  export {};
66508
67038
 
66509
67039
  //# sourceMappingURL=cli.js.map
66510
- //# debugId=263a3384-e99c-5526-89f9-c7e1a6bd4e76
67040
+ //# debugId=87efffda-8fc4-5b52-80e1-7ec503c85206