react-doctor 0.8.1-dev.284b4e4 → 0.8.1-dev.3598138

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/index.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]="137db449-e390-5d6c-9d14-a8803909eea3")}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]="ba0e3885-0c68-5322-b382-578d3d89d5c5")}catch(e){}}();
3
3
  import { r as __toESM$1, t as __commonJSMin$1 } from "./chunk-N93fKeF6.js";
4
4
  import { createRequire } from "node:module";
5
5
  import reactDoctorPlugin, { ALL_REACT_DOCTOR_RULE_KEYS, CROSS_FILE_DEPENDENCY_COLLECTORS, CROSS_FILE_RULE_IDS, FRAMEWORK_SPECIFIC_RULE_KEYS, FRAMEWORK_TOKENS, MOTION_LIBRARY_PACKAGES, REACT_COMPILER_RULES, REACT_DOCTOR_RULES, classifySecurityScanFile, collectCrossFileDependencyProbes, resetManifestCaches, shouldReadSecurityScanContent } from "oxlint-plugin-react-doctor";
@@ -32854,6 +32854,44 @@ var AmbiguousProjectError = class extends Error {
32854
32854
  }
32855
32855
  };
32856
32856
  const isProjectDiscoveryError = (value) => value instanceof ProjectNotFoundError || value instanceof NoReactDependencyError || value instanceof PackageJsonNotFoundError || value instanceof NotADirectoryError || value instanceof AmbiguousProjectError;
32857
+ const isErrnoException = (error) => error instanceof Error && "code" in error;
32858
+ const IGNORABLE_READDIR_ERROR_CODES = new Set([
32859
+ "EACCES",
32860
+ "EPERM",
32861
+ "ENOENT",
32862
+ "ENOTDIR",
32863
+ "EINVAL",
32864
+ "ELOOP",
32865
+ "ENAMETOOLONG"
32866
+ ]);
32867
+ const isIgnorableReaddirError = (error) => isErrnoException(error) && typeof error.code === "string" && IGNORABLE_READDIR_ERROR_CODES.has(error.code);
32868
+ const readDirectoryEntries = (directoryPath) => {
32869
+ try {
32870
+ return NFS.readdirSync(directoryPath, { withFileTypes: true });
32871
+ } catch (error) {
32872
+ if (isIgnorableReaddirError(error)) return [];
32873
+ throw error;
32874
+ }
32875
+ };
32876
+ const isFile = (filePath) => {
32877
+ try {
32878
+ return NFS.statSync(filePath).isFile();
32879
+ } catch {
32880
+ return false;
32881
+ }
32882
+ };
32883
+ const isDirectory = (directoryPath) => {
32884
+ try {
32885
+ return NFS.statSync(directoryPath).isDirectory();
32886
+ } catch {
32887
+ return false;
32888
+ }
32889
+ };
32890
+ const isPlainObject = (value) => {
32891
+ if (typeof value !== "object" || value === null || Array.isArray(value)) return false;
32892
+ const prototype = Object.getPrototypeOf(value);
32893
+ return prototype === null || prototype === Object.prototype;
32894
+ };
32857
32895
  const SOURCE_FILE_PATTERN = /\.(tsx?|jsx?|mts|mjs)$/;
32858
32896
  const GENERATED_BUNDLE_FILE_PATTERN = /\.(iife|umd|global|min)\.m?js$/i;
32859
32897
  const GENERATED_SOURCE_DIRECTORY_PATTERN = /(?:^|\/)__generated__\//;
@@ -33012,44 +33050,6 @@ const SUPPLY_CHAIN_OVERLAP_TIMEOUT_MS = 9e4;
33012
33050
  const SUPPLY_CHAIN_CACHE_TTL_MS = 864e5;
33013
33051
  const SUPPLY_CHAIN_CACHE_SUBDIR = "supply-chain";
33014
33052
  const SUPPLY_CHAIN_IGNORED_PACKAGES = new Set(["next"]);
33015
- const isErrnoException = (error) => error instanceof Error && "code" in error;
33016
- const IGNORABLE_READDIR_ERROR_CODES = new Set([
33017
- "EACCES",
33018
- "EPERM",
33019
- "ENOENT",
33020
- "ENOTDIR",
33021
- "EINVAL",
33022
- "ELOOP",
33023
- "ENAMETOOLONG"
33024
- ]);
33025
- const isIgnorableReaddirError = (error) => isErrnoException(error) && typeof error.code === "string" && IGNORABLE_READDIR_ERROR_CODES.has(error.code);
33026
- const readDirectoryEntries = (directoryPath) => {
33027
- try {
33028
- return NFS.readdirSync(directoryPath, { withFileTypes: true });
33029
- } catch (error) {
33030
- if (isIgnorableReaddirError(error)) return [];
33031
- throw error;
33032
- }
33033
- };
33034
- const isFile = (filePath) => {
33035
- try {
33036
- return NFS.statSync(filePath).isFile();
33037
- } catch {
33038
- return false;
33039
- }
33040
- };
33041
- const isDirectory = (directoryPath) => {
33042
- try {
33043
- return NFS.statSync(directoryPath).isDirectory();
33044
- } catch {
33045
- return false;
33046
- }
33047
- };
33048
- const isPlainObject = (value) => {
33049
- if (typeof value !== "object" || value === null || Array.isArray(value)) return false;
33050
- const prototype = Object.getPrototypeOf(value);
33051
- return prototype === null || prototype === Object.prototype;
33052
- };
33053
33053
  const lastSourceMappingUrl = (fileContent) => {
33054
33054
  const lastReference = [...fileContent.matchAll(/\/\/# sourceMappingURL=(\S+)/g)].at(-1);
33055
33055
  return lastReference ? lastReference[1] : null;
@@ -33375,10 +33375,10 @@ const FALLBACK_TSCONFIG_FILENAMES = ["tsconfig.app.json", "tsconfig.build.json"]
33375
33375
  const FRAMEWORK_PACKAGES = {
33376
33376
  next: "nextjs",
33377
33377
  "@tanstack/react-start": "tanstack-start",
33378
- "@remix-run/react": "remix",
33379
- gatsby: "gatsby",
33380
33378
  vite: "vite",
33381
33379
  "react-scripts": "cra",
33380
+ "@remix-run/react": "remix",
33381
+ gatsby: "gatsby",
33382
33382
  expo: "expo",
33383
33383
  "react-native": "react-native"
33384
33384
  };
@@ -33402,17 +33402,11 @@ const NEXT_CONFIG_FILENAMES = [
33402
33402
  ];
33403
33403
  const BABEL_CONFIG_FILENAMES = [
33404
33404
  ".babelrc",
33405
- ".babelrc.js",
33406
33405
  ".babelrc.json",
33407
- ".babelrc.cjs",
33408
- ".babelrc.mjs",
33409
- ".babelrc.cts",
33410
33406
  "babel.config.js",
33411
33407
  "babel.config.json",
33412
33408
  "babel.config.cjs",
33413
- "babel.config.mjs",
33414
- "babel.config.ts",
33415
- "babel.config.cts"
33409
+ "babel.config.mjs"
33416
33410
  ];
33417
33411
  const VITE_CONFIG_FILENAMES = [
33418
33412
  "vite.config.js",
@@ -33424,28 +33418,12 @@ const VITE_CONFIG_FILENAMES = [
33424
33418
  "vitest.config.ts",
33425
33419
  "vitest.config.js"
33426
33420
  ];
33427
- const RSBUILD_CONFIG_FILENAMES = [
33428
- "rsbuild.config.ts",
33429
- "rsbuild.config.js",
33430
- "rsbuild.config.mts",
33431
- "rsbuild.config.mjs",
33432
- "rsbuild.config.cts",
33433
- "rsbuild.config.cjs"
33434
- ];
33435
- const RSPACK_CONFIG_FILENAMES = [
33436
- "rspack.config.ts",
33437
- "rspack.config.js",
33438
- "rspack.config.mts",
33439
- "rspack.config.mjs",
33440
- "rspack.config.cts",
33441
- "rspack.config.cjs"
33442
- ];
33443
33421
  const EXPO_APP_CONFIG_FILENAMES = [
33444
33422
  "app.json",
33445
33423
  "app.config.js",
33446
33424
  "app.config.ts"
33447
33425
  ];
33448
- const REACT_COMPILER_PACKAGE_REFERENCE_PATTERN = /babel-plugin-react-compiler|react-compiler-runtime|reactCompilerPreset\s*\(|["']react-compiler["']/;
33426
+ const REACT_COMPILER_PACKAGE_REFERENCE_PATTERN = /babel-plugin-react-compiler|react-compiler-runtime|["']react-compiler["']/;
33449
33427
  const REACT_COMPILER_ENABLED_FLAG_PATTERN = /["']?reactCompiler["']?\s*:\s*(?:true\b|\{)/;
33450
33428
  const STATIC_EXPORT_OUTPUT_PATTERN = /(?:^|[^.\w])["']?output["']?\s*:\s*["']export["']/m;
33451
33429
  const hasCompilerPackage = (packageJson, compilerPackages) => {
@@ -33480,8 +33458,6 @@ const detectReactCompiler = (directory, packageJson) => {
33480
33458
  if (hasCompilerInConfigFiles(directory, NEXT_CONFIG_FILENAMES)) return true;
33481
33459
  if (hasCompilerInConfigFiles(directory, BABEL_CONFIG_FILENAMES)) return true;
33482
33460
  if (hasCompilerInConfigFiles(directory, VITE_CONFIG_FILENAMES)) return true;
33483
- if (hasCompilerInConfigFiles(directory, RSBUILD_CONFIG_FILENAMES)) return true;
33484
- if (hasCompilerInConfigFiles(directory, RSPACK_CONFIG_FILENAMES)) return true;
33485
33461
  if (hasCompilerInConfigFiles(directory, EXPO_APP_CONFIG_FILENAMES)) return true;
33486
33462
  return hasCompilerPackageInAncestors(directory, REACT_COMPILER_TRANSFORM_PACKAGES);
33487
33463
  };
@@ -33490,7 +33466,7 @@ const detectNextjsStaticExport = (directory) => NEXT_CONFIG_FILENAMES.some((file
33490
33466
  const filePath = Path.join(directory, filename);
33491
33467
  return isFile(filePath) && STATIC_EXPORT_OUTPUT_PATTERN.test(NFS.readFileSync(filePath, "utf-8"));
33492
33468
  });
33493
- const UNRESOLVABLE_PROTOCOL_VERSION = /^(?:catalog|file|git|github|https?|link|patch|portal|workspace|npm):/i;
33469
+ const UNRESOLVABLE_PROTOCOL_VERSION = /^(?:file|git|github|https?|link|patch|portal|workspace|npm):/i;
33494
33470
  const DIST_TAG_VERSION = /^[a-z][a-z0-9._-]*$/i;
33495
33471
  const WILDCARD_VERSION = /^[*xX](?:\.[*xX])*$/;
33496
33472
  const NPM_ALIAS_VERSION = /^npm:(?:@[^/]+\/[^@]+|[^@]+)@(.+)$/i;
@@ -33623,16 +33599,6 @@ const getLowestDependencyMajor = (version) => {
33623
33599
  }
33624
33600
  return lowestMajor;
33625
33601
  };
33626
- const getDependencyMajorWithinSupportedRange = (version, latestSupportedMajor) => {
33627
- const normalizedVersion = normalizeDependencyVersion(version);
33628
- if (normalizedVersion === null) return null;
33629
- const validRange = import_semver.validRange(normalizedVersion);
33630
- if (validRange === null) return null;
33631
- const minimumVersion = import_semver.minVersion(validRange);
33632
- if (minimumVersion === null || minimumVersion.major > latestSupportedMajor) return null;
33633
- if (import_semver.intersects(validRange, `>=${latestSupportedMajor + 1}.0.0`)) return null;
33634
- return minimumVersion.major;
33635
- };
33636
33602
  const isConcreteDependencyVersion = (version) => {
33637
33603
  const normalizedVersion = normalizeDependencyVersion(version);
33638
33604
  return normalizedVersion !== null && /\d/.test(normalizedVersion);
@@ -33676,18 +33642,9 @@ const parseReactMajorMinor = (reactVersion) => {
33676
33642
  };
33677
33643
  };
33678
33644
  const parseLowerBoundVersion = (versionSpec) => import_semver.validRange(versionSpec) !== null ? import_semver.minVersion(versionSpec) : import_semver.coerce(versionSpec);
33679
- const parseThreeRelease = (threeVersion) => {
33680
- if (typeof threeVersion !== "string") return null;
33681
- const normalizedVersion = normalizeDependencyVersion(threeVersion);
33682
- if (normalizedVersion === null) return null;
33683
- const lowerBound = parseLowerBoundVersion(normalizedVersion);
33684
- if (lowerBound === null) return null;
33685
- if (lowerBound.major > 0) return Number.MAX_SAFE_INTEGER;
33686
- return lowerBound.minor > 0 ? lowerBound.minor : null;
33687
- };
33688
- const parseDependencyMajorMinor = (dependencyVersion) => {
33689
- if (typeof dependencyVersion !== "string") return null;
33690
- const trimmed = dependencyVersion.trim();
33645
+ const parseTailwindMajorMinor = (tailwindVersion) => {
33646
+ if (typeof tailwindVersion !== "string") return null;
33647
+ const trimmed = tailwindVersion.trim();
33691
33648
  if (trimmed.length === 0) return null;
33692
33649
  const lowerBound = parseLowerBoundVersion(trimmed);
33693
33650
  if (lowerBound === null || lowerBound.major <= 0) return null;
@@ -33696,7 +33653,6 @@ const parseDependencyMajorMinor = (dependencyVersion) => {
33696
33653
  minor: lowerBound.minor
33697
33654
  };
33698
33655
  };
33699
- const parseTailwindMajorMinor = (tailwindVersion) => parseDependencyMajorMinor(tailwindVersion);
33700
33656
  const hasUpperBoundOnlyPeerRange = (range) => {
33701
33657
  if (typeof range !== "string") return false;
33702
33658
  const normalizedRange = normalizeDependencyVersion(range);
@@ -33718,7 +33674,7 @@ const resolveEffectiveReactMajor = (reactVersion, packageJson) => {
33718
33674
  if (peerFloor === null) return hasUpperBoundOnlyPeerRange(peerReactRange) ? null : installedReactMajor;
33719
33675
  return installedReactMajor !== null ? Math.min(installedReactMajor, peerFloor) : peerFloor;
33720
33676
  };
33721
- const isCatalogReference = (version) => typeof version === "string" && version.startsWith("catalog:");
33677
+ const isCatalogReference = (version) => version.startsWith("catalog:");
33722
33678
  const extractCatalogName = (version) => {
33723
33679
  if (!isCatalogReference(version)) return null;
33724
33680
  const name = version.slice(8).trim();
@@ -33868,12 +33824,6 @@ const TAILWIND_ZOD_SECTIONS = [
33868
33824
  "devDependencies",
33869
33825
  "peerDependencies"
33870
33826
  ];
33871
- const DEPENDENCY_SPEC_SECTIONS = [
33872
- "dependencies",
33873
- "devDependencies",
33874
- "peerDependencies",
33875
- "optionalDependencies"
33876
- ];
33877
33827
  const EMPTY_DEPENDENCY_INFO = {
33878
33828
  reactVersion: null,
33879
33829
  tailwindVersion: null,
@@ -33883,7 +33833,7 @@ const EMPTY_DEPENDENCY_INFO = {
33883
33833
  const pickConcreteVersion = (packageJson, packageName, sections) => {
33884
33834
  for (const section of sections) {
33885
33835
  const version = packageJson[section]?.[packageName];
33886
- if (typeof version !== "string") continue;
33836
+ if (version === void 0) continue;
33887
33837
  if (isCatalogReference(version)) return null;
33888
33838
  if (isConcreteDependencyVersion(version)) return version;
33889
33839
  }
@@ -33915,16 +33865,13 @@ const extractDependencyInfo = (packageJson) => {
33915
33865
  };
33916
33866
  };
33917
33867
  const getDependencySpec = (packageJson, packageName) => {
33918
- for (const section of DEPENDENCY_SPEC_SECTIONS) {
33919
- const spec = packageJson[section]?.[packageName];
33920
- if (typeof spec === "string") return spec;
33921
- }
33922
- return null;
33868
+ const spec = packageJson.dependencies?.[packageName] ?? packageJson.devDependencies?.[packageName] ?? packageJson.peerDependencies?.[packageName] ?? packageJson.optionalDependencies?.[packageName];
33869
+ return typeof spec === "string" ? spec : null;
33923
33870
  };
33924
33871
  const getDependencyDeclaration = ({ packageJson, packageName, sections }) => {
33925
33872
  for (const section of sections) {
33926
33873
  const version = packageJson[section]?.[packageName];
33927
- if (typeof version !== "string") continue;
33874
+ if (version === void 0) continue;
33928
33875
  return {
33929
33876
  catalogReference: extractCatalogName(version) ?? null,
33930
33877
  hasDeclaration: true,
@@ -33958,15 +33905,24 @@ const getPreactVersion = (packageJson) => {
33958
33905
  ...packageJson.devDependencies
33959
33906
  }.preact ?? null;
33960
33907
  };
33961
- const resolveCatalogBackedDependencyVersion = ({ rootDirectory, rootPackageJson, packageName, sourceDirectory = rootDirectory, sourcePackageJson = rootPackageJson, version }) => {
33908
+ const TANSTACK_QUERY_PACKAGES = new Set([
33909
+ "@tanstack/react-query",
33910
+ "@tanstack/query-core",
33911
+ "react-query"
33912
+ ]);
33913
+ const hasTanStackQuery = (packageJson) => {
33914
+ const allDependencies = {
33915
+ ...packageJson.peerDependencies,
33916
+ ...packageJson.dependencies,
33917
+ ...packageJson.devDependencies
33918
+ };
33919
+ return Object.keys(allDependencies).some((packageName) => TANSTACK_QUERY_PACKAGES.has(packageName));
33920
+ };
33921
+ const resolveCatalogBackedDependencyVersion = ({ rootDirectory, rootPackageJson, packageName, version }) => {
33962
33922
  if (version === null || !isCatalogReference(version)) return version;
33963
33923
  const catalogName = extractCatalogName(version);
33964
- const resolvedSourceVersion = resolveCatalogVersion(sourcePackageJson, packageName, sourceDirectory, catalogName);
33965
- if (resolvedSourceVersion) return resolvedSourceVersion;
33966
- if (sourceDirectory !== rootDirectory || sourcePackageJson !== rootPackageJson) {
33967
- const resolvedRootVersion = resolveCatalogVersion(rootPackageJson, packageName, rootDirectory, catalogName);
33968
- if (resolvedRootVersion) return resolvedRootVersion;
33969
- }
33924
+ const resolvedLocalVersion = resolveCatalogVersion(rootPackageJson, packageName, rootDirectory, catalogName);
33925
+ if (resolvedLocalVersion) return resolvedLocalVersion;
33970
33926
  const monorepoRoot = findMonorepoRoot(rootDirectory);
33971
33927
  if (!monorepoRoot) return version;
33972
33928
  const monorepoPackageJsonPath = Path.join(monorepoRoot, "package.json");
@@ -34164,79 +34120,7 @@ const listWorkspacePackages = (rootDirectory) => {
34164
34120
  }
34165
34121
  return packages;
34166
34122
  };
34167
- const PREFERRED_DEPENDENCY_SECTIONS = [
34168
- "dependencies",
34169
- "peerDependencies",
34170
- "devDependencies"
34171
- ];
34172
- const getPreferredDependencyVersion = ({ packageJson, packageNames }) => {
34173
- for (const packageName of packageNames) {
34174
- const declaration = getDependencyDeclaration({
34175
- packageJson,
34176
- packageName,
34177
- sections: PREFERRED_DEPENDENCY_SECTIONS
34178
- });
34179
- if (declaration.version !== null) return declaration.version;
34180
- }
34181
- return null;
34182
- };
34183
- const TANSTACK_REACT_QUERY_PACKAGES = ["@tanstack/react-query", "react-query"];
34184
- const getTanStackQueryVersion = (packageJson) => {
34185
- return getPreferredDependencyVersion({
34186
- packageJson,
34187
- packageNames: TANSTACK_REACT_QUERY_PACKAGES
34188
- });
34189
- };
34190
- const STYLED_COMPONENTS_PACKAGES = ["styled-components"];
34191
- const getStyledComponentsVersion = (packageJson) => {
34192
- return getPreferredDependencyVersion({
34193
- packageJson,
34194
- packageNames: STYLED_COMPONENTS_PACKAGES
34195
- });
34196
- };
34197
- const I18N_PACKAGES = [
34198
- "i18next",
34199
- "react-i18next",
34200
- "next-i18next",
34201
- "react-intl",
34202
- "next-intl",
34203
- "use-intl",
34204
- "@formatjs/intl",
34205
- "@lingui/core",
34206
- "@lingui/react",
34207
- "typesafe-i18n",
34208
- "@tolgee/react",
34209
- "react-intl-universal"
34210
- ];
34211
- const hasI18nDependency = (packageJson) => {
34212
- const allDependencies = {
34213
- ...packageJson.peerDependencies,
34214
- ...packageJson.dependencies,
34215
- ...packageJson.devDependencies,
34216
- ...packageJson.optionalDependencies
34217
- };
34218
- return I18N_PACKAGES.some((packageName) => allDependencies[packageName] !== void 0);
34219
- };
34220
34123
  const REANIMATED_DEPENDENCY_NAME = "react-native-reanimated";
34221
- const MOBX_REACT_PACKAGE_NAME = "mobx-react";
34222
- const MOBX_REACT_LITE_PACKAGE_NAME = "mobx-react-lite";
34223
- const MOBX_STATE_TREE_PACKAGE_NAME = "mobx-state-tree";
34224
- const MOBX_REACT_OBSERVER_PACKAGE_NAME = "mobx-react-observer";
34225
- const REACT_THREE_FIBER_DEPENDENCY_NAMES = ["@react-three/fiber", "react-three-fiber"];
34226
- const REACT_THREE_FIBER_SECTIONS = [
34227
- "dependencies",
34228
- "peerDependencies",
34229
- "optionalDependencies",
34230
- "devDependencies"
34231
- ];
34232
- const THREE_DEPENDENCY_SECTIONS = [
34233
- "dependencies",
34234
- "peerDependencies",
34235
- "optionalDependencies",
34236
- "devDependencies"
34237
- ];
34238
- const REACT_THREE_FIBER_ECOSYSTEM_DEPENDENCY_NAMES = [...REACT_THREE_FIBER_DEPENDENCY_NAMES, "@react-three/drei"];
34239
- const THREE_DEPENDENCY_NAMES = [...REACT_THREE_FIBER_ECOSYSTEM_DEPENDENCY_NAMES, "three"];
34240
34124
  const SHOPIFY_FLASH_LIST_PACKAGE_NAME = "@shopify/flash-list";
34241
34125
  const resolveWorkspaceDependencyVersion = ({ concreteVersion, packageName, rootDirectory, rootPackageJson, sections, workspaceDirectory, workspacePackageJson }) => {
34242
34126
  const dependencyDeclaration = getDependencyDeclaration({
@@ -34247,7 +34131,7 @@ const resolveWorkspaceDependencyVersion = ({ concreteVersion, packageName, rootD
34247
34131
  if (!dependencyDeclaration.hasDeclaration) return null;
34248
34132
  return concreteVersion ?? resolveCatalogVersion(workspacePackageJson, packageName, workspaceDirectory, dependencyDeclaration.catalogReference) ?? resolveCatalogVersion(rootPackageJson, packageName, rootDirectory, dependencyDeclaration.catalogReference);
34249
34133
  };
34250
- const shouldReplaceWithLowerMajor = (currentVersion, nextVersion) => {
34134
+ const shouldReplaceReactVersion = (currentVersion, nextVersion) => {
34251
34135
  if (!currentVersion) return true;
34252
34136
  const currentMajor = parseReactMajor(currentVersion);
34253
34137
  const nextMajor = parseReactMajor(nextVersion);
@@ -34255,62 +34139,7 @@ const shouldReplaceWithLowerMajor = (currentVersion, nextVersion) => {
34255
34139
  if (nextMajor === null) return false;
34256
34140
  return nextMajor < currentMajor;
34257
34141
  };
34258
- const shouldReplaceSupportedDependencyFact = (currentFact, nextFact, latestSupportedMajor) => {
34259
- if (currentFact.version === null) return true;
34260
- if (nextFact.version === null) return false;
34261
- const currentMajor = getLowestDependencyMajor(currentFact.version);
34262
- const nextMajor = getLowestDependencyMajor(nextFact.version);
34263
- if (currentMajor === null) return false;
34264
- if (nextMajor === null) return true;
34265
- if (currentMajor > latestSupportedMajor) return false;
34266
- if (nextMajor > latestSupportedMajor) return true;
34267
- return nextMajor < currentMajor;
34268
- };
34269
- const shouldReplaceStyledComponentsVersion = (currentVersion, nextVersion) => {
34270
- if (!currentVersion) return true;
34271
- const currentMajor = getLowestDependencyMajor(currentVersion);
34272
- const nextMajor = getLowestDependencyMajor(nextVersion);
34273
- if (currentMajor === null) return nextMajor !== null && nextMajor < 6;
34274
- if (nextMajor === null) return currentMajor >= 6;
34275
- return nextMajor < currentMajor;
34276
- };
34277
- const selectOldestDependencyVersion = (currentVersion, nextVersion) => {
34278
- if (currentVersion === null || nextVersion === null) return null;
34279
- const current = parseDependencyMajorMinor(currentVersion);
34280
- const next = parseDependencyMajorMinor(nextVersion);
34281
- if (current === null) return currentVersion;
34282
- if (next === null) return nextVersion;
34283
- if (next.major !== current.major) return next.major < current.major ? nextVersion : currentVersion;
34284
- return next.minor < current.minor ? nextVersion : currentVersion;
34285
- };
34286
- const shouldReplaceMobxFact = (currentFact, nextFact) => {
34287
- if (currentFact.sourceDirectory === null) return true;
34288
- if (currentFact.version === null) return false;
34289
- if (nextFact.version === null) return true;
34290
- const currentMajor = getDependencyMajorWithinSupportedRange(currentFact.version, 6);
34291
- const nextMajor = getDependencyMajorWithinSupportedRange(nextFact.version, 6);
34292
- if (currentMajor === null) return false;
34293
- if (nextMajor === null) return true;
34294
- return selectOldestDependencyVersion(currentFact.version, nextFact.version) === nextFact.version;
34295
- };
34296
- const collectBindingVersion = (facts, packageJson, directory, packageName) => {
34297
- const version = getDependencySpec(packageJson, packageName);
34298
- if (version === null) return;
34299
- const resolvedVersion = resolveCatalogBackedDependencyVersion({
34300
- rootDirectory: directory,
34301
- rootPackageJson: packageJson,
34302
- packageName,
34303
- version
34304
- });
34305
- if (packageName === MOBX_REACT_PACKAGE_NAME) {
34306
- facts.mobxReactVersion = facts.hasMobxReact ? selectOldestDependencyVersion(facts.mobxReactVersion, resolvedVersion) : resolvedVersion;
34307
- facts.hasMobxReact = true;
34308
- return;
34309
- }
34310
- facts.mobxReactLiteVersion = facts.hasMobxReactLite ? selectOldestDependencyVersion(facts.mobxReactLiteVersion, resolvedVersion) : resolvedVersion;
34311
- facts.hasMobxReactLite = true;
34312
- };
34313
- const evaluateManifestFacts = (facts, packageJson, directory, rootDirectory, rootPackageJson) => {
34142
+ const evaluateManifestFacts = (facts, packageJson, directory) => {
34314
34143
  if (facts.expo.version === null) {
34315
34144
  const spec = getDependencySpec(packageJson, "expo");
34316
34145
  if (spec !== null) facts.expo = {
@@ -34332,113 +34161,13 @@ const evaluateManifestFacts = (facts, packageJson, directory, rootDirectory, roo
34332
34161
  sourceDirectory: directory
34333
34162
  };
34334
34163
  }
34335
- const mobxSpec = getDependencySpec(packageJson, "mobx");
34336
- if (mobxSpec !== null) {
34337
- const nextMobxFact = {
34338
- version: resolveCatalogBackedDependencyVersion({
34339
- rootDirectory: directory,
34340
- rootPackageJson: packageJson,
34341
- packageName: "mobx",
34342
- version: mobxSpec
34343
- }),
34344
- sourceDirectory: directory
34345
- };
34346
- if (shouldReplaceMobxFact(facts.mobx, nextMobxFact)) facts.mobx = nextMobxFact;
34347
- }
34348
- collectBindingVersion(facts, packageJson, directory, MOBX_REACT_PACKAGE_NAME);
34349
- collectBindingVersion(facts, packageJson, directory, MOBX_REACT_LITE_PACKAGE_NAME);
34350
- facts.hasMobxStateTree = facts.hasMobxStateTree || getDependencySpec(packageJson, MOBX_STATE_TREE_PACKAGE_NAME) !== null;
34351
- facts.hasMobxReactObserver = facts.hasMobxReactObserver || getDependencySpec(packageJson, MOBX_REACT_OBSERVER_PACKAGE_NAME) !== null;
34352
- const zustandSpec = getDependencySpec(packageJson, "zustand");
34353
- if (zustandSpec !== null) {
34354
- const nextZustandFact = {
34355
- version: resolveCatalogBackedDependencyVersion({
34356
- rootDirectory: directory,
34357
- rootPackageJson: packageJson,
34358
- packageName: "zustand",
34359
- version: zustandSpec
34360
- }),
34361
- sourceDirectory: directory
34362
- };
34363
- if (shouldReplaceSupportedDependencyFact(facts.zustand, nextZustandFact, 5)) facts.zustand = nextZustandFact;
34364
- }
34365
34164
  if (facts.reanimatedVersion === null) {
34366
34165
  const spec = getDependencySpec(packageJson, REANIMATED_DEPENDENCY_NAME);
34367
34166
  if (spec !== null) facts.reanimatedVersion = spec;
34368
34167
  }
34369
- if (facts.valtioVersion === null) {
34370
- const spec = getDependencySpec(packageJson, "valtio");
34371
- if (spec !== null) facts.valtioVersion = spec;
34372
- }
34373
- facts.tanstackQueryVersion ??= getTanStackQueryVersion(packageJson);
34374
- const styledComponentsVersion = resolveCatalogBackedDependencyVersion({
34375
- rootDirectory: directory,
34376
- rootPackageJson: packageJson,
34377
- packageName: "styled-components",
34378
- version: getStyledComponentsVersion(packageJson)
34379
- });
34380
- if (styledComponentsVersion && shouldReplaceStyledComponentsVersion(facts.styledComponentsVersion, styledComponentsVersion)) facts.styledComponentsVersion = styledComponentsVersion;
34381
- facts.hasI18nLibrary = facts.hasI18nLibrary || hasI18nDependency(packageJson);
34382
- for (const packageName of REACT_THREE_FIBER_DEPENDENCY_NAMES) {
34383
- const version = resolveCatalogBackedDependencyVersion({
34384
- rootDirectory,
34385
- rootPackageJson,
34386
- sourceDirectory: directory,
34387
- sourcePackageJson: packageJson,
34388
- packageName,
34389
- version: getDependencyDeclaration({
34390
- packageName,
34391
- packageJson,
34392
- sections: REACT_THREE_FIBER_SECTIONS
34393
- }).version
34394
- });
34395
- if (version === null) continue;
34396
- if (shouldReplaceWithLowerMajor(facts.reactThreeFiber.version, version)) facts.reactThreeFiber = {
34397
- packageName,
34398
- version,
34399
- sourceDirectory: directory
34400
- };
34401
- }
34402
- const threeVersion = resolveCatalogBackedDependencyVersion({
34403
- rootDirectory,
34404
- rootPackageJson,
34405
- sourceDirectory: directory,
34406
- sourcePackageJson: packageJson,
34407
- packageName: "three",
34408
- version: getDependencyDeclaration({
34409
- packageName: "three",
34410
- packageJson,
34411
- sections: THREE_DEPENDENCY_SECTIONS
34412
- }).version
34413
- });
34414
- if (threeVersion !== null) {
34415
- const currentRelease = parseThreeRelease(facts.threeVersion);
34416
- const nextRelease = parseThreeRelease(threeVersion);
34417
- if (facts.threeVersion === null || nextRelease !== null && (currentRelease === null || nextRelease < currentRelease)) facts.threeVersion = threeVersion;
34418
- }
34419
34168
  facts.hasReactNativeAwarePackage = facts.hasReactNativeAwarePackage || isPackageJsonReactNativeAware(packageJson);
34420
34169
  facts.hasReanimatedAwarePackage = facts.hasReanimatedAwarePackage || isPackageJsonReanimatedAware(packageJson);
34421
34170
  facts.hasSsrDependency = facts.hasSsrDependency || isPackageJsonSsrAware(packageJson);
34422
- const remotionSpec = getDependencySpec(packageJson, "remotion");
34423
- if (remotionSpec !== null) {
34424
- facts.hasRemotionDependency = true;
34425
- const resolvedRemotionVersion = resolveCatalogBackedDependencyVersion({
34426
- rootDirectory,
34427
- rootPackageJson,
34428
- packageName: "remotion",
34429
- version: remotionSpec
34430
- });
34431
- const remotionMajorVersion = resolvedRemotionVersion === null ? null : getLowestDependencyMajor(resolvedRemotionVersion);
34432
- if (remotionMajorVersion === null) {
34433
- facts.hasUnknownRemotionVersion = true;
34434
- facts.remotionVersion = null;
34435
- } else if (!facts.hasUnknownRemotionVersion) {
34436
- const currentRemotionMajorVersion = facts.remotionVersion === null ? null : getLowestDependencyMajor(facts.remotionVersion);
34437
- if (currentRemotionMajorVersion === null || remotionMajorVersion < currentRemotionMajorVersion) facts.remotionVersion = resolvedRemotionVersion;
34438
- }
34439
- }
34440
- facts.hasThree = facts.hasThree || THREE_DEPENDENCY_NAMES.some((dependencyName) => getDependencySpec(packageJson, dependencyName) !== null);
34441
- facts.hasReactThreeFiber = facts.hasReactThreeFiber || REACT_THREE_FIBER_ECOSYSTEM_DEPENDENCY_NAMES.some((dependencyName) => getDependencySpec(packageJson, dependencyName) !== null);
34442
34171
  };
34443
34172
  const collectWorkspaceFacts = (rootDirectory, rootPackageJson, { collectReactGroup }) => {
34444
34173
  const facts = {
@@ -34458,41 +34187,12 @@ const collectWorkspaceFacts = (rootDirectory, rootPackageJson, { collectReactGro
34458
34187
  version: null,
34459
34188
  sourceDirectory: null
34460
34189
  },
34461
- valtioVersion: null,
34462
- mobx: {
34463
- version: null,
34464
- sourceDirectory: null
34465
- },
34466
- hasMobxReact: false,
34467
- mobxReactVersion: null,
34468
- hasMobxReactLite: false,
34469
- mobxReactLiteVersion: null,
34470
- hasMobxStateTree: false,
34471
- hasMobxReactObserver: false,
34472
- zustand: {
34473
- version: null,
34474
- sourceDirectory: null
34475
- },
34476
- tanstackQueryVersion: null,
34477
- styledComponentsVersion: null,
34478
- hasI18nLibrary: false,
34479
34190
  hasReactNativeAwarePackage: false,
34480
34191
  hasReanimatedAwarePackage: false,
34481
34192
  hasSsrDependency: false,
34482
- hasRemotionDependency: false,
34483
- hasUnknownRemotionVersion: false,
34484
- remotionVersion: null,
34485
- hasThree: false,
34486
- threeVersion: null,
34487
- hasReactThreeFiber: false,
34488
- reactThreeFiber: {
34489
- packageName: null,
34490
- version: null,
34491
- sourceDirectory: null
34492
- },
34493
34193
  reanimatedVersion: null
34494
34194
  };
34495
- evaluateManifestFacts(facts, rootPackageJson, rootDirectory, rootDirectory, rootPackageJson);
34195
+ evaluateManifestFacts(facts, rootPackageJson, rootDirectory);
34496
34196
  let isReactGroupSettled = !collectReactGroup;
34497
34197
  const visitedDirectories = /* @__PURE__ */ new Set();
34498
34198
  for (const pattern of getWorkspacePatterns(rootDirectory, rootPackageJson)) {
@@ -34501,7 +34201,7 @@ const collectWorkspaceFacts = (rootDirectory, rootPackageJson, { collectReactGro
34501
34201
  if (visitedDirectories.has(workspaceDirectory)) continue;
34502
34202
  visitedDirectories.add(workspaceDirectory);
34503
34203
  const workspacePackageJson = readPackageJson(Path.join(workspaceDirectory, "package.json"));
34504
- evaluateManifestFacts(facts, workspacePackageJson, workspaceDirectory, rootDirectory, rootPackageJson);
34204
+ evaluateManifestFacts(facts, workspacePackageJson, workspaceDirectory);
34505
34205
  const info = extractDependencyInfo(workspacePackageJson);
34506
34206
  if (info.framework !== "unknown" && frameworkMergeRank(info.framework) < frameworkMergeRank(facts.framework)) facts.framework = info.framework;
34507
34207
  if (isReactGroupSettled) continue;
@@ -34532,7 +34232,7 @@ const collectWorkspaceFacts = (rootDirectory, rootPackageJson, { collectReactGro
34532
34232
  workspaceDirectory,
34533
34233
  workspacePackageJson
34534
34234
  });
34535
- if (reactVersion && shouldReplaceWithLowerMajor(facts.reactVersion, reactVersion)) facts.reactVersion = reactVersion;
34235
+ if (reactVersion && shouldReplaceReactVersion(facts.reactVersion, reactVersion)) facts.reactVersion = reactVersion;
34536
34236
  if (tailwindVersion && !facts.tailwindVersion) facts.tailwindVersion = tailwindVersion;
34537
34237
  if (zodVersion && !facts.zodVersion) facts.zodVersion = zodVersion;
34538
34238
  const settledReactMajor = parseReactMajor(facts.reactVersion);
@@ -34725,35 +34425,11 @@ const discoverProjectWithoutPackageJson = (directory) => {
34725
34425
  tailwindVersion: null,
34726
34426
  zodVersion: null,
34727
34427
  zodMajorVersion: null,
34728
- mobxVersion: null,
34729
- mobxMajorVersion: null,
34730
- hasMobxReact: false,
34731
- mobxReactVersion: null,
34732
- hasMobxReactLite: false,
34733
- mobxReactLiteVersion: null,
34734
- hasMobxStateTree: false,
34735
- hasMobxReactObserver: false,
34736
- zustandVersion: null,
34737
- zustandMajorVersion: null,
34738
34428
  framework: "unknown",
34739
34429
  hasTypeScript: hasOwnTsConfig,
34740
34430
  hasReactCompiler: false,
34741
34431
  hasReactCompilerLintPlugin: false,
34742
34432
  hasTanStackQuery: false,
34743
- valtioVersion: null,
34744
- valtioMajorVersion: null,
34745
- hasRemotion: false,
34746
- remotionVersion: null,
34747
- remotionMajorVersion: null,
34748
- hasI18nLibrary: false,
34749
- tanstackQueryVersion: null,
34750
- styledComponentsVersion: null,
34751
- hasThree: false,
34752
- threeVersion: null,
34753
- threeRelease: null,
34754
- hasReactThreeFiber: false,
34755
- reactThreeFiberVersion: null,
34756
- reactThreeFiberMajorVersion: null,
34757
34433
  hasSsrDependency: false,
34758
34434
  preactVersion: null,
34759
34435
  preactMajorVersion: null,
@@ -34852,12 +34528,6 @@ const discoverProject = (directory) => {
34852
34528
  packageName: SHOPIFY_FLASH_LIST_PACKAGE_NAME,
34853
34529
  version: workspaceFacts.shopifyFlashList.version
34854
34530
  }) : null;
34855
- const zustandVersion = resolveCatalogBackedDependencyVersion({
34856
- rootDirectory: directory,
34857
- rootPackageJson: packageJson,
34858
- packageName: "zustand",
34859
- version: workspaceFacts.zustand.version
34860
- });
34861
34531
  const hasReanimated = hasReactNativeWorkspace && workspaceFacts.hasReanimatedAwarePackage;
34862
34532
  const reanimatedVersion = hasReanimated ? workspaceFacts.reanimatedVersion : null;
34863
34533
  const nextjsVersion = framework === "nextjs" ? resolveCatalogBackedDependencyVersion({
@@ -34866,33 +34536,7 @@ const discoverProject = (directory) => {
34866
34536
  packageName: "next",
34867
34537
  version: workspaceFacts.next.version
34868
34538
  }) : null;
34869
- const valtioVersion = resolveCatalogBackedDependencyVersion({
34870
- rootDirectory: directory,
34871
- rootPackageJson: packageJson,
34872
- packageName: "valtio",
34873
- version: workspaceFacts.valtioVersion
34874
- });
34875
- const mobxVersion = resolveCatalogBackedDependencyVersion({
34876
- rootDirectory: directory,
34877
- rootPackageJson: packageJson,
34878
- packageName: "mobx",
34879
- version: workspaceFacts.mobx.version
34880
- });
34881
34539
  const preactVersion = getPreactVersion(packageJson);
34882
- const remotionVersion = workspaceFacts.remotionVersion;
34883
- const tanstackQueryVersion = getTanStackQueryVersion(packageJson) ?? workspaceFacts.tanstackQueryVersion;
34884
- const reactThreeFiberVersion = workspaceFacts.reactThreeFiber.packageName ? resolveCatalogBackedDependencyVersion({
34885
- rootDirectory: directory,
34886
- rootPackageJson: packageJson,
34887
- packageName: workspaceFacts.reactThreeFiber.packageName,
34888
- version: workspaceFacts.reactThreeFiber.version
34889
- }) : null;
34890
- const threeVersion = resolveCatalogBackedDependencyVersion({
34891
- rootDirectory: directory,
34892
- rootPackageJson: packageJson,
34893
- packageName: "three",
34894
- version: workspaceFacts.threeVersion
34895
- });
34896
34540
  const isPreES2023Target = hasTypeScript && detectPreES2023Target(directory);
34897
34541
  const projectInfo = {
34898
34542
  rootDirectory: directory,
@@ -34902,35 +34546,11 @@ const discoverProject = (directory) => {
34902
34546
  tailwindVersion,
34903
34547
  zodVersion,
34904
34548
  zodMajorVersion: zodVersion === null ? null : getLowestDependencyMajor(zodVersion),
34905
- mobxVersion,
34906
- mobxMajorVersion: mobxVersion === null ? null : getDependencyMajorWithinSupportedRange(mobxVersion, 6),
34907
- hasMobxReact: workspaceFacts.hasMobxReact,
34908
- mobxReactVersion: workspaceFacts.mobxReactVersion,
34909
- hasMobxReactLite: workspaceFacts.hasMobxReactLite,
34910
- mobxReactLiteVersion: workspaceFacts.mobxReactLiteVersion,
34911
- hasMobxStateTree: workspaceFacts.hasMobxStateTree,
34912
- hasMobxReactObserver: workspaceFacts.hasMobxReactObserver,
34913
- zustandVersion,
34914
- zustandMajorVersion: zustandVersion === null ? null : getLowestDependencyMajor(zustandVersion),
34915
34549
  framework,
34916
34550
  hasTypeScript,
34917
34551
  hasReactCompiler: detectReactCompiler(directory, packageJson),
34918
34552
  hasReactCompilerLintPlugin: detectReactCompilerLintPlugin(directory, packageJson),
34919
- hasTanStackQuery: tanstackQueryVersion !== null,
34920
- hasI18nLibrary: workspaceFacts.hasI18nLibrary,
34921
- tanstackQueryVersion,
34922
- styledComponentsVersion: workspaceFacts.styledComponentsVersion,
34923
- valtioVersion,
34924
- valtioMajorVersion: valtioVersion === null ? null : getLowestDependencyMajor(valtioVersion),
34925
- hasRemotion: workspaceFacts.hasRemotionDependency,
34926
- remotionVersion,
34927
- remotionMajorVersion: remotionVersion === null ? null : getLowestDependencyMajor(remotionVersion),
34928
- hasThree: workspaceFacts.hasThree,
34929
- threeVersion,
34930
- threeRelease: parseThreeRelease(threeVersion),
34931
- hasReactThreeFiber: workspaceFacts.hasReactThreeFiber,
34932
- reactThreeFiberVersion,
34933
- reactThreeFiberMajorVersion: reactThreeFiberVersion === null ? null : getLowestDependencyMajor(reactThreeFiberVersion),
34553
+ hasTanStackQuery: hasTanStackQuery(packageJson),
34934
34554
  hasSsrDependency: workspaceFacts.hasSsrDependency,
34935
34555
  preactVersion,
34936
34556
  preactMajorVersion: parseReactMajor(preactVersion),
@@ -38205,10 +37825,10 @@ const SSR_FRAMEWORKS = new Set([
38205
37825
  "gatsby",
38206
37826
  "tanstack-start"
38207
37827
  ]);
38208
- const addVersionCapabilityLadder = (capabilities, name, detectedVersion, earliest, latest) => {
38209
- if (detectedVersion === null) return;
38210
- const cappedVersion = Math.min(detectedVersion, latest);
38211
- for (let candidate = earliest; candidate <= cappedVersion; candidate += 1) capabilities.add(`${name}:${candidate}`);
37828
+ const addMajorLadder = (capabilities, name, major, earliest, latest) => {
37829
+ if (major === null) return;
37830
+ const cappedMajor = Math.min(major, latest);
37831
+ for (let candidate = earliest; candidate <= cappedMajor; candidate += 1) capabilities.add(`${name}:${candidate}`);
38212
37832
  };
38213
37833
  const buildCapabilities = (project) => {
38214
37834
  const capabilities = /* @__PURE__ */ new Set();
@@ -38221,77 +37841,24 @@ const buildCapabilities = (project) => {
38221
37841
  if (CLIENT_ONLY_FRAMEWORKS.has(project.framework)) capabilities.add("client-only");
38222
37842
  if (project.isStaticExport) capabilities.add("nextjs:static-export");
38223
37843
  if (project.nextjsMajorVersion !== null && project.nextjsMajorVersion >= 15) capabilities.add("nextjs:15");
38224
- if (project.nextjsMajorVersion !== null && project.nextjsMajorVersion >= 16) capabilities.add("nextjs:16");
38225
- addVersionCapabilityLadder(capabilities, "react", project.reactMajorVersion, 17, 30);
37844
+ addMajorLadder(capabilities, "react", project.reactMajorVersion, 17, 30);
38226
37845
  if (project.reactMajorVersion !== null && project.reactMajorVersion >= 19 && isMajorMinorAtLeast(parseReactMajorMinor(project.reactVersion), {
38227
37846
  major: 19,
38228
37847
  minor: 2
38229
37848
  })) capabilities.add("react:19.2");
38230
- if (project.tailwindVersion !== null) {
38231
- capabilities.add("tailwind");
38232
- const tailwindVersion = parseTailwindMajorMinor(project.tailwindVersion);
38233
- if (isMajorMinorAtLeast(tailwindVersion, {
38234
- major: 3,
38235
- minor: 4
38236
- })) capabilities.add("tailwind:3.4");
38237
- if (tailwindVersion !== null && isMajorMinorAtLeast(tailwindVersion, {
38238
- major: 4,
38239
- minor: 0
38240
- })) capabilities.add("tailwind:4");
38241
- }
37849
+ if (project.tailwindVersion !== null) capabilities.add("tailwind");
37850
+ if (project.tailwindVersion !== null && isMajorMinorAtLeast(parseTailwindMajorMinor(project.tailwindVersion), {
37851
+ major: 3,
37852
+ minor: 4
37853
+ })) capabilities.add("tailwind:3.4");
38242
37854
  if (project.zodVersion !== null) capabilities.add("zod");
38243
37855
  if (project.zodMajorVersion !== null && project.zodMajorVersion >= 4) capabilities.add("zod:4");
38244
- if (project.mobxVersion !== void 0 && project.mobxVersion !== null || project.hasMobxReact === true || project.hasMobxReactLite === true || project.hasMobxStateTree === true || project.hasMobxReactObserver === true) capabilities.add("mobx");
38245
- if (project.hasMobxReact === true) capabilities.add("mobx-react");
38246
- if (project.hasMobxReactLite === true) capabilities.add("mobx-react-lite");
38247
- if (project.hasMobxReact === true || project.hasMobxReactLite === true) capabilities.add("mobx-react-binding");
38248
- const mobxReactVersion = parseDependencyMajorMinor(project.mobxReactVersion);
38249
- const mobxReactLiteVersion = parseDependencyMajorMinor(project.mobxReactLiteVersion);
38250
- const hasMobxReactObserverMemoGuard = mobxReactVersion !== null && isMajorMinorAtLeast(mobxReactVersion, {
38251
- major: 7,
38252
- minor: 3
38253
- });
38254
- const hasMobxReactLiteObserverMemoGuard = mobxReactLiteVersion !== null && isMajorMinorAtLeast(mobxReactLiteVersion, {
38255
- major: 3,
38256
- minor: 3
38257
- });
38258
- if (hasMobxReactObserverMemoGuard) capabilities.add("mobx-react-observer-memo-guard");
38259
- if (hasMobxReactLiteObserverMemoGuard) capabilities.add("mobx-react-lite-observer-memo-guard");
38260
- if (hasMobxReactObserverMemoGuard || hasMobxReactLiteObserverMemoGuard) capabilities.add("mobx-react-binding-observer-memo-guard");
38261
- if (project.hasMobxStateTree === true) capabilities.add("mobx-state-tree");
38262
- if (project.hasMobxReactObserver === true) capabilities.add("mobx-react-observer");
38263
- if (project.mobxMajorVersion !== void 0 && project.mobxMajorVersion !== null && project.mobxMajorVersion >= 4 && project.mobxMajorVersion <= 6) addVersionCapabilityLadder(capabilities, "mobx", project.mobxMajorVersion, 4, 6);
38264
- const mobxVersion = parseDependencyMajorMinor(project.mobxVersion);
38265
- if (project.mobxMajorVersion === 6 && mobxVersion !== null && isMajorMinorAtLeast(mobxVersion, {
38266
- major: 6,
38267
- minor: 10
38268
- })) capabilities.add("mobx:6.10");
38269
- if (project.zustandVersion !== void 0 && project.zustandVersion !== null) capabilities.add("zustand");
38270
- if (project.zustandMajorVersion !== void 0 && project.zustandMajorVersion !== null && project.zustandMajorVersion >= 1 && project.zustandMajorVersion <= 5) addVersionCapabilityLadder(capabilities, "zustand", project.zustandMajorVersion, 1, 5);
38271
37856
  if (project.isPreES2023Target) capabilities.add("pre-es2023");
38272
37857
  if (project.hasReactCompiler) capabilities.add("react-compiler");
38273
- if (Boolean(project.hasTanStackQuery) || Boolean(project.tanstackQueryVersion)) capabilities.add("tanstack-query");
38274
- if (project.styledComponentsVersion) {
38275
- capabilities.add("styled-components");
38276
- const styledComponentsMajor = getLowestDependencyMajor(project.styledComponentsVersion);
38277
- if (styledComponentsMajor !== null && styledComponentsMajor >= 6) capabilities.add("styled-components:6");
38278
- }
38279
- if (project.hasI18nLibrary) capabilities.add("i18n");
38280
- if (project.valtioVersion !== null) capabilities.add("valtio");
38281
- addVersionCapabilityLadder(capabilities, "valtio", project.valtioMajorVersion, 1, 10);
38282
- if (project.hasRemotion) {
38283
- capabilities.add("remotion");
38284
- addVersionCapabilityLadder(capabilities, "remotion", project.remotionMajorVersion ?? null, 4, 30);
38285
- }
38286
- if (project.hasThree || project.hasReactThreeFiber) capabilities.add("three");
38287
- addVersionCapabilityLadder(capabilities, "three", project.threeRelease ?? null, 145, 250);
38288
- if (project.hasReactThreeFiber) {
38289
- capabilities.add("r3f");
38290
- addVersionCapabilityLadder(capabilities, "r3f", project.reactThreeFiberMajorVersion ?? null, 3, 10);
38291
- }
37858
+ if (project.hasTanStackQuery) capabilities.add("tanstack-query");
38292
37859
  if (project.hasTypeScript) capabilities.add("typescript");
38293
37860
  if (project.preactVersion !== null) capabilities.add("preact");
38294
- addVersionCapabilityLadder(capabilities, "preact", project.preactMajorVersion, 10, 20);
37861
+ addMajorLadder(capabilities, "preact", project.preactMajorVersion, 10, 20);
38295
37862
  if (project.preactVersion !== null && project.reactVersion === null) capabilities.add("pure-preact");
38296
37863
  return capabilities;
38297
37864
  };
@@ -38303,7 +37870,7 @@ const getCapabilities = (project) => {
38303
37870
  capabilitiesByProject.set(project, capabilities);
38304
37871
  return capabilities;
38305
37872
  };
38306
- const shouldEnableRule = (requires, tags, capabilities, ignoredTags, disabledWhen, includedTags) => {
37873
+ const shouldEnableRule = (requires, tags, capabilities, ignoredTags, disabledWhen) => {
38307
37874
  if (requires) {
38308
37875
  for (const capability of requires) if (!capabilities.has(capability)) return false;
38309
37876
  }
@@ -38314,29 +37881,20 @@ const shouldEnableRule = (requires, tags, capabilities, ignoredTags, disabledWhe
38314
37881
  if (tags) {
38315
37882
  for (const tag of tags) if (ignoredTags.has(tag)) return false;
38316
37883
  }
38317
- if (includedTags && includedTags.size > 0) {
38318
- if (!tags?.some((tag) => includedTags.has(tag))) return false;
38319
- }
38320
37884
  return true;
38321
37885
  };
38322
- const shouldEnableRuleByDefaultStatus = (options) => options.defaultEnabled !== false || options.hasExplicitOverride === true || options.includeTagDefaults && options.hasIncludedTags;
38323
37886
  const yieldToEventLoop = () => new Promise((resolve) => {
38324
37887
  setImmediate(resolve);
38325
37888
  });
38326
37889
  const createSecurityScanSession = (rootDirectory, options) => {
38327
37890
  const capabilities = options.project ? getCapabilities(options.project) : /* @__PURE__ */ new Set();
38328
37891
  const ignoredTags = options.ignoredTags ?? /* @__PURE__ */ new Set();
38329
- const includedTags = options.includedTags ?? /* @__PURE__ */ new Set();
38330
37892
  const enabledScanRules = REACT_DOCTOR_RULES.flatMap((entry) => {
38331
37893
  const rule = entry.rule;
38332
37894
  const scan = rule.scan;
38333
37895
  if (typeof scan !== "function") return [];
38334
- if (!shouldEnableRuleByDefaultStatus({
38335
- defaultEnabled: rule.defaultEnabled,
38336
- includeTagDefaults: options.includeTagDefaults === true,
38337
- hasIncludedTags: includedTags.size > 0
38338
- })) return [];
38339
- if (!shouldEnableRule(rule.requires, rule.tags, capabilities, ignoredTags, rule.disabledWhen, includedTags)) return [];
37896
+ if (rule.defaultEnabled === false) return [];
37897
+ if (!shouldEnableRule(rule.requires, rule.tags, capabilities, ignoredTags, rule.disabledWhen)) return [];
38340
37898
  return [{
38341
37899
  entry,
38342
37900
  scan,
@@ -40322,9 +39880,8 @@ const buildUserPluginRules = (userPlugin, severityControls) => {
40322
39880
  }
40323
39881
  return enabled;
40324
39882
  };
40325
- const createOxlintConfig = ({ pluginPath, project, customRulesOnly = false, extendsPaths = [], ignoredTags = /* @__PURE__ */ new Set(), includedTags = /* @__PURE__ */ new Set(), includeTagDefaults = false, serverAuthFunctionNames, severityControls, userPlugins = [], disableReactHooksJsPlugin = false, ruleSelection, sidecarRuleIdFilter }) => {
40326
- const hasIncludedTags = includedTags.size > 0;
40327
- const reactHooksJsPlugin = disableReactHooksJsPlugin || ruleSelection === "sidecar" || hasIncludedTags ? null : resolveReactHooksJsPlugin(project.hasReactCompiler || project.hasReactCompilerLintPlugin === true, customRulesOnly);
39883
+ const createOxlintConfig = ({ pluginPath, project, customRulesOnly = false, extendsPaths = [], ignoredTags = /* @__PURE__ */ new Set(), serverAuthFunctionNames, severityControls, userPlugins = [], disableReactHooksJsPlugin = false, ruleSelection, sidecarRuleIdFilter }) => {
39884
+ const reactHooksJsPlugin = disableReactHooksJsPlugin || ruleSelection === "sidecar" ? null : resolveReactHooksJsPlugin(project.hasReactCompiler || project.hasReactCompilerLintPlugin === true, customRulesOnly);
40328
39885
  const reactCompilerRules = reactHooksJsPlugin ? applyRuleSeverityControls(filterRulesToAvailable(REACT_COMPILER_RULES, "react-hooks-js", reactHooksJsPlugin.availableRuleNames), severityControls) : {};
40329
39886
  const jsPlugins = [];
40330
39887
  if (reactHooksJsPlugin) jsPlugins.push(reactHooksJsPlugin.entry);
@@ -40339,14 +39896,9 @@ const createOxlintConfig = ({ pluginPath, project, customRulesOnly = false, exte
40339
39896
  if (rule.scan !== void 0) continue;
40340
39897
  if (customRulesOnly && registryEntry.originallyExternal) continue;
40341
39898
  if (rule.framework !== "global" && !rule.requires) continue;
40342
- if (!shouldEnableRule(rule.requires, rule.tags, capabilities, ignoredTags, rule.disabledWhen, includedTags)) continue;
39899
+ if (!shouldEnableRule(rule.requires, rule.tags, capabilities, ignoredTags, rule.disabledWhen)) continue;
40343
39900
  const explicitRuleOverride = resolveRuleSeverityOverride({ ruleKey: registryEntry.key }, severityControls);
40344
- if (!shouldEnableRuleByDefaultStatus({
40345
- defaultEnabled: rule.defaultEnabled,
40346
- includeTagDefaults,
40347
- hasIncludedTags,
40348
- hasExplicitOverride: explicitRuleOverride !== void 0
40349
- })) continue;
39901
+ if (rule.defaultEnabled === false && explicitRuleOverride === void 0) continue;
40350
39902
  const severity = resolveRuleSeverityOverride({
40351
39903
  ruleKey: registryEntry.key,
40352
39904
  category: rule.category
@@ -40355,7 +39907,7 @@ const createOxlintConfig = ({ pluginPath, project, customRulesOnly = false, exte
40355
39907
  enabledReactDoctorRules[registryEntry.key] = severity;
40356
39908
  }
40357
39909
  const userPluginRules = {};
40358
- if (ruleSelection !== "sidecar" && !hasIncludedTags) for (const userPlugin of userPlugins) {
39910
+ if (ruleSelection !== "sidecar") for (const userPlugin of userPlugins) {
40359
39911
  Object.assign(userPluginRules, buildUserPluginRules(userPlugin, severityControls));
40360
39912
  jsPlugins.push(userPlugin.entry);
40361
39913
  }
@@ -40572,19 +40124,6 @@ const createSidecarLintCache = (cacheDirectory, rulesetHash) => {
40572
40124
  }
40573
40125
  };
40574
40126
  };
40575
- const fingerprintCacheByFilePath = /* @__PURE__ */ new Map();
40576
- const fingerprintFileContents = (filePath, fingerprintLength) => {
40577
- const fileStats = NFS.statSync(filePath, { bigint: true });
40578
- const cachedFingerprint = fingerprintCacheByFilePath.get(filePath);
40579
- if (cachedFingerprint?.modifiedTimeNanoseconds === fileStats.mtimeNs && cachedFingerprint.sizeBytes === fileStats.size) return cachedFingerprint.fingerprint;
40580
- const fingerprint = crypto.createHash("sha256").update(NFS.readFileSync(filePath)).digest("hex").slice(0, fingerprintLength);
40581
- fingerprintCacheByFilePath.set(filePath, {
40582
- fingerprint,
40583
- modifiedTimeNanoseconds: fileStats.mtimeNs,
40584
- sizeBytes: fileStats.size
40585
- });
40586
- return fingerprint;
40587
- };
40588
40127
  const bundledRequire = createRequire(import.meta.url);
40589
40128
  const childNodeVersionByBinaryPath = /* @__PURE__ */ new Map();
40590
40129
  const resolveChildNodeVersion = (nodeBinaryPath) => {
@@ -40608,13 +40147,6 @@ const TOOLCHAIN_PACKAGE_SPECIFIERS = [
40608
40147
  "oxlint-plugin-react-doctor/package.json",
40609
40148
  "eslint-plugin-react-hooks/package.json"
40610
40149
  ];
40611
- const resolvePluginFingerprint = () => {
40612
- try {
40613
- return fingerprintFileContents(bundledRequire.resolve("oxlint-plugin-react-doctor"), 16);
40614
- } catch {
40615
- return "unresolved";
40616
- }
40617
- };
40618
40150
  const resolveOxlintToolchainVersions = (nodeBinaryPath = process.execPath) => {
40619
40151
  const versions = [`node=${resolveChildNodeVersion(nodeBinaryPath)}`];
40620
40152
  for (const specifier of TOOLCHAIN_PACKAGE_SPECIFIERS) try {
@@ -40624,7 +40156,6 @@ const resolveOxlintToolchainVersions = (nodeBinaryPath = process.execPath) => {
40624
40156
  } catch {
40625
40157
  versions.push(`${specifier}=missing`);
40626
40158
  }
40627
- versions.push(`oxlint-plugin-react-doctor#fingerprint=${resolvePluginFingerprint()}`);
40628
40159
  return versions;
40629
40160
  };
40630
40161
  const esmRequire = createRequire(import.meta.url);
@@ -42100,7 +41631,7 @@ const reactHooksJsPluginDropNote = (error) => {
42100
41631
  * 6. always restore disable directives + clean up the temp dir
42101
41632
  */
42102
41633
  const runOxlint = async (options) => {
42103
- 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;
41634
+ 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;
42104
41635
  const serverAuthFunctionNames = Array.isArray(userConfig?.serverAuthFunctionNames) ? userConfig.serverAuthFunctionNames.filter((entry) => typeof entry === "string" && entry.length > 0) : void 0;
42105
41636
  const severityControls = buildRuleSeverityControls(userConfig);
42106
41637
  validateRuleRegistration();
@@ -42114,15 +41645,13 @@ const runOxlint = async (options) => {
42114
41645
  }
42115
41646
  const pluginPath = resolvePluginPath();
42116
41647
  const extendsPaths = (adoptExistingLintConfig && !customRulesOnly ? detectUserLintConfigPaths(rootDirectory) : []).filter(canOxlintExtendConfig);
42117
- const userPlugins = includedTags.size > 0 ? [] : resolveUserPlugins(userConfig?.plugins, configSourceDirectory);
41648
+ const userPlugins = resolveUserPlugins(userConfig?.plugins, configSourceDirectory);
42118
41649
  const buildConfig = (overrides) => createOxlintConfig({
42119
41650
  pluginPath,
42120
41651
  project,
42121
41652
  customRulesOnly,
42122
41653
  extendsPaths: overrides.extendsPaths,
42123
41654
  ignoredTags,
42124
- includedTags,
42125
- includeTagDefaults,
42126
41655
  serverAuthFunctionNames,
42127
41656
  severityControls,
42128
41657
  userPlugins,
@@ -42511,8 +42040,6 @@ var Linter = class Linter extends Service()("react-doctor/Linter") {
42511
42040
  respectInlineDisables: input.respectInlineDisables,
42512
42041
  adoptExistingLintConfig: input.adoptExistingLintConfig,
42513
42042
  ignoredTags: input.ignoredTags,
42514
- includedTags: input.includedTags,
42515
- includeTagDefaults: input.includeTagDefaults,
42516
42043
  userConfig: input.userConfig ?? null,
42517
42044
  configSourceDirectory: input.configSourceDirectory,
42518
42045
  onPartialFailure: (reason) => {
@@ -43361,9 +42888,7 @@ const runInspect = (input, hooks = {}) => gen(function* () {
43361
42888
  const securityScanFailedRef = yield* make$13(false);
43362
42889
  const securityScanFiber = yield* forkChild(runCollect(applyPerElementPipeline(isDiffMode ? empty$4 : unwrap(tryPromise(() => checkSecurityScanCooperative(scanDirectory, {
43363
42890
  project,
43364
- ignoredTags: input.ignoredTags,
43365
- includedTags: input.includedTags,
43366
- includeTagDefaults: input.includeTagDefaults
42891
+ ignoredTags: input.ignoredTags
43367
42892
  })).pipe(map$3((diagnostics) => fromIterable$1(diagnostics)), catch_$1(() => set(securityScanFailedRef, true).pipe(as(empty$4))))))).pipe(withSpan("SecurityScan.run")));
43368
42893
  const shouldRunSupplyChain = !isDiffMode || (input.supplyChainManifestChanged ?? false);
43369
42894
  const supplyChainOverlapTimeout = yield* SupplyChainOverlapTimeoutMs;
@@ -43454,8 +42979,6 @@ const runInspect = (input, hooks = {}) => gen(function* () {
43454
42979
  respectInlineDisables: input.respectInlineDisables,
43455
42980
  adoptExistingLintConfig: input.adoptExistingLintConfig,
43456
42981
  ignoredTags: input.ignoredTags,
43457
- includedTags: input.includedTags,
43458
- includeTagDefaults: input.includeTagDefaults,
43459
42982
  userConfig: resolvedConfig.config ?? void 0,
43460
42983
  configSourceDirectory: resolvedConfig.configSourceDirectory ?? void 0,
43461
42984
  onFileProgress: (scannedFileCount, totalFileCount) => {
@@ -44316,4 +43839,4 @@ const toJsonReport = (result, options) => buildJsonReport({
44316
43839
  export { AmbiguousProjectError, NoReactDependencyError, NotADirectoryError, PackageJsonNotFoundError, ProjectNotFoundError, ReactDoctorError, buildJsonReport, buildJsonReportError, clearCaches, defineConfig, diagnose, filterSourceFiles, getDiffInfo, hasReactRuntime, isProjectDiscoveryError, isReactDoctorError, summarizeDiagnostics, toJsonReport };
44317
43840
 
44318
43841
  //# sourceMappingURL=index.js.map
44319
- //# debugId=137db449-e390-5d6c-9d14-a8803909eea3
43842
+ //# debugId=ba0e3885-0c68-5322-b382-578d3d89d5c5