react-doctor 0.8.1-dev.0b0b5ac → 0.8.1-dev.21221c2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/lsp.js CHANGED
@@ -33427,10 +33427,10 @@ const FALLBACK_TSCONFIG_FILENAMES = ["tsconfig.app.json", "tsconfig.build.json"]
33427
33427
  const FRAMEWORK_PACKAGES = {
33428
33428
  next: "nextjs",
33429
33429
  "@tanstack/react-start": "tanstack-start",
33430
- "@remix-run/react": "remix",
33431
- gatsby: "gatsby",
33432
33430
  vite: "vite",
33433
33431
  "react-scripts": "cra",
33432
+ "@remix-run/react": "remix",
33433
+ gatsby: "gatsby",
33434
33434
  expo: "expo",
33435
33435
  "react-native": "react-native"
33436
33436
  };
@@ -33454,17 +33454,11 @@ const NEXT_CONFIG_FILENAMES = [
33454
33454
  ];
33455
33455
  const BABEL_CONFIG_FILENAMES = [
33456
33456
  ".babelrc",
33457
- ".babelrc.js",
33458
33457
  ".babelrc.json",
33459
- ".babelrc.cjs",
33460
- ".babelrc.mjs",
33461
- ".babelrc.cts",
33462
33458
  "babel.config.js",
33463
33459
  "babel.config.json",
33464
33460
  "babel.config.cjs",
33465
- "babel.config.mjs",
33466
- "babel.config.ts",
33467
- "babel.config.cts"
33461
+ "babel.config.mjs"
33468
33462
  ];
33469
33463
  const VITE_CONFIG_FILENAMES = [
33470
33464
  "vite.config.js",
@@ -33476,28 +33470,12 @@ const VITE_CONFIG_FILENAMES = [
33476
33470
  "vitest.config.ts",
33477
33471
  "vitest.config.js"
33478
33472
  ];
33479
- const RSBUILD_CONFIG_FILENAMES = [
33480
- "rsbuild.config.ts",
33481
- "rsbuild.config.js",
33482
- "rsbuild.config.mts",
33483
- "rsbuild.config.mjs",
33484
- "rsbuild.config.cts",
33485
- "rsbuild.config.cjs"
33486
- ];
33487
- const RSPACK_CONFIG_FILENAMES = [
33488
- "rspack.config.ts",
33489
- "rspack.config.js",
33490
- "rspack.config.mts",
33491
- "rspack.config.mjs",
33492
- "rspack.config.cts",
33493
- "rspack.config.cjs"
33494
- ];
33495
33473
  const EXPO_APP_CONFIG_FILENAMES = [
33496
33474
  "app.json",
33497
33475
  "app.config.js",
33498
33476
  "app.config.ts"
33499
33477
  ];
33500
- const REACT_COMPILER_PACKAGE_REFERENCE_PATTERN = /babel-plugin-react-compiler|react-compiler-runtime|reactCompilerPreset\s*\(|["']react-compiler["']/;
33478
+ const REACT_COMPILER_PACKAGE_REFERENCE_PATTERN = /babel-plugin-react-compiler|react-compiler-runtime|["']react-compiler["']/;
33501
33479
  const REACT_COMPILER_ENABLED_FLAG_PATTERN = /["']?reactCompiler["']?\s*:\s*(?:true\b|\{)/;
33502
33480
  const STATIC_EXPORT_OUTPUT_PATTERN = /(?:^|[^.\w])["']?output["']?\s*:\s*["']export["']/m;
33503
33481
  const hasCompilerPackage = (packageJson, compilerPackages) => {
@@ -33532,8 +33510,6 @@ const detectReactCompiler = (directory, packageJson) => {
33532
33510
  if (hasCompilerInConfigFiles(directory, NEXT_CONFIG_FILENAMES)) return true;
33533
33511
  if (hasCompilerInConfigFiles(directory, BABEL_CONFIG_FILENAMES)) return true;
33534
33512
  if (hasCompilerInConfigFiles(directory, VITE_CONFIG_FILENAMES)) return true;
33535
- if (hasCompilerInConfigFiles(directory, RSBUILD_CONFIG_FILENAMES)) return true;
33536
- if (hasCompilerInConfigFiles(directory, RSPACK_CONFIG_FILENAMES)) return true;
33537
33513
  if (hasCompilerInConfigFiles(directory, EXPO_APP_CONFIG_FILENAMES)) return true;
33538
33514
  return hasCompilerPackageInAncestors(directory, REACT_COMPILER_TRANSFORM_PACKAGES);
33539
33515
  };
@@ -33981,6 +33957,19 @@ const getPreactVersion = (packageJson) => {
33981
33957
  ...packageJson.devDependencies
33982
33958
  }.preact ?? null;
33983
33959
  };
33960
+ const TANSTACK_QUERY_PACKAGES = new Set([
33961
+ "@tanstack/react-query",
33962
+ "@tanstack/query-core",
33963
+ "react-query"
33964
+ ]);
33965
+ const hasTanStackQuery = (packageJson) => {
33966
+ const allDependencies = {
33967
+ ...packageJson.peerDependencies,
33968
+ ...packageJson.dependencies,
33969
+ ...packageJson.devDependencies
33970
+ };
33971
+ return Object.keys(allDependencies).some((packageName) => TANSTACK_QUERY_PACKAGES.has(packageName));
33972
+ };
33984
33973
  const resolveCatalogBackedDependencyVersion = ({ rootDirectory, rootPackageJson, packageName, version }) => {
33985
33974
  if (version === null || !isCatalogReference(version)) return version;
33986
33975
  const catalogName = extractCatalogName(version);
@@ -34183,60 +34172,7 @@ const listWorkspacePackages = (rootDirectory) => {
34183
34172
  }
34184
34173
  return packages;
34185
34174
  };
34186
- const getPreferredDependencyVersion = ({ packageJson, packageNames }) => {
34187
- const allDependencies = {
34188
- ...packageJson.devDependencies,
34189
- ...packageJson.peerDependencies,
34190
- ...packageJson.dependencies
34191
- };
34192
- for (const packageName of packageNames) {
34193
- const version = allDependencies[packageName];
34194
- if (version !== void 0) return version;
34195
- }
34196
- return null;
34197
- };
34198
- const TANSTACK_REACT_QUERY_PACKAGES = ["@tanstack/react-query", "react-query"];
34199
- const getTanStackQueryVersion = (packageJson) => {
34200
- return getPreferredDependencyVersion({
34201
- packageJson,
34202
- packageNames: TANSTACK_REACT_QUERY_PACKAGES
34203
- });
34204
- };
34205
- const STYLED_COMPONENTS_PACKAGES = ["styled-components"];
34206
- const getStyledComponentsVersion = (packageJson) => {
34207
- return getPreferredDependencyVersion({
34208
- packageJson,
34209
- packageNames: STYLED_COMPONENTS_PACKAGES
34210
- });
34211
- };
34212
- const I18N_PACKAGES = [
34213
- "i18next",
34214
- "react-i18next",
34215
- "next-i18next",
34216
- "react-intl",
34217
- "next-intl",
34218
- "use-intl",
34219
- "@formatjs/intl",
34220
- "@lingui/core",
34221
- "@lingui/react",
34222
- "typesafe-i18n",
34223
- "@tolgee/react",
34224
- "react-intl-universal"
34225
- ];
34226
- const hasI18nDependency = (packageJson) => {
34227
- const allDependencies = {
34228
- ...packageJson.peerDependencies,
34229
- ...packageJson.dependencies,
34230
- ...packageJson.devDependencies,
34231
- ...packageJson.optionalDependencies
34232
- };
34233
- return I18N_PACKAGES.some((packageName) => allDependencies[packageName] !== void 0);
34234
- };
34235
34175
  const REANIMATED_DEPENDENCY_NAME = "react-native-reanimated";
34236
- const MOBX_REACT_PACKAGE_NAME = "mobx-react";
34237
- const MOBX_REACT_LITE_PACKAGE_NAME = "mobx-react-lite";
34238
- const MOBX_STATE_TREE_PACKAGE_NAME = "mobx-state-tree";
34239
- const MOBX_REACT_OBSERVER_PACKAGE_NAME = "mobx-react-observer";
34240
34176
  const SHOPIFY_FLASH_LIST_PACKAGE_NAME = "@shopify/flash-list";
34241
34177
  const resolveWorkspaceDependencyVersion = ({ concreteVersion, packageName, rootDirectory, rootPackageJson, sections, workspaceDirectory, workspacePackageJson }) => {
34242
34178
  const dependencyDeclaration = getDependencyDeclaration({
@@ -34255,26 +34191,7 @@ const shouldReplaceReactVersion = (currentVersion, nextVersion) => {
34255
34191
  if (nextMajor === null) return false;
34256
34192
  return nextMajor < currentMajor;
34257
34193
  };
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 evaluateManifestFacts = (facts, packageJson, directory, rootDirectory, rootPackageJson) => {
34194
+ const evaluateManifestFacts = (facts, packageJson, directory) => {
34278
34195
  if (facts.expo.version === null) {
34279
34196
  const spec = getDependencySpec(packageJson, "expo");
34280
34197
  if (spec !== null) facts.expo = {
@@ -34296,74 +34213,13 @@ const evaluateManifestFacts = (facts, packageJson, directory, rootDirectory, roo
34296
34213
  sourceDirectory: directory
34297
34214
  };
34298
34215
  }
34299
- const mobxSpec = getDependencySpec(packageJson, "mobx");
34300
- if (mobxSpec !== null) {
34301
- const nextMobxFact = {
34302
- version: resolveCatalogBackedDependencyVersion({
34303
- rootDirectory: directory,
34304
- rootPackageJson: packageJson,
34305
- packageName: "mobx",
34306
- version: mobxSpec
34307
- }),
34308
- sourceDirectory: directory
34309
- };
34310
- if (shouldReplaceSupportedDependencyFact(facts.mobx, nextMobxFact, 6)) facts.mobx = nextMobxFact;
34311
- }
34312
- facts.hasMobxReact = facts.hasMobxReact || getDependencySpec(packageJson, MOBX_REACT_PACKAGE_NAME) !== null;
34313
- facts.hasMobxReactLite = facts.hasMobxReactLite || getDependencySpec(packageJson, MOBX_REACT_LITE_PACKAGE_NAME) !== null;
34314
- facts.hasMobxStateTree = facts.hasMobxStateTree || getDependencySpec(packageJson, MOBX_STATE_TREE_PACKAGE_NAME) !== null;
34315
- facts.hasMobxReactObserver = facts.hasMobxReactObserver || getDependencySpec(packageJson, MOBX_REACT_OBSERVER_PACKAGE_NAME) !== null;
34316
- const zustandSpec = getDependencySpec(packageJson, "zustand");
34317
- if (zustandSpec !== null) {
34318
- const nextZustandFact = {
34319
- version: resolveCatalogBackedDependencyVersion({
34320
- rootDirectory: directory,
34321
- rootPackageJson: packageJson,
34322
- packageName: "zustand",
34323
- version: zustandSpec
34324
- }),
34325
- sourceDirectory: directory
34326
- };
34327
- if (shouldReplaceSupportedDependencyFact(facts.zustand, nextZustandFact, 5)) facts.zustand = nextZustandFact;
34328
- }
34329
34216
  if (facts.reanimatedVersion === null) {
34330
34217
  const spec = getDependencySpec(packageJson, REANIMATED_DEPENDENCY_NAME);
34331
34218
  if (spec !== null) facts.reanimatedVersion = spec;
34332
34219
  }
34333
- if (facts.valtioVersion === null) {
34334
- const spec = getDependencySpec(packageJson, "valtio");
34335
- if (spec !== null) facts.valtioVersion = spec;
34336
- }
34337
- facts.tanstackQueryVersion ??= getTanStackQueryVersion(packageJson);
34338
- const styledComponentsVersion = resolveCatalogBackedDependencyVersion({
34339
- rootDirectory: directory,
34340
- rootPackageJson: packageJson,
34341
- packageName: "styled-components",
34342
- version: getStyledComponentsVersion(packageJson)
34343
- });
34344
- if (styledComponentsVersion && shouldReplaceStyledComponentsVersion(facts.styledComponentsVersion, styledComponentsVersion)) facts.styledComponentsVersion = styledComponentsVersion;
34345
- facts.hasI18nLibrary = facts.hasI18nLibrary || hasI18nDependency(packageJson);
34346
34220
  facts.hasReactNativeAwarePackage = facts.hasReactNativeAwarePackage || isPackageJsonReactNativeAware(packageJson);
34347
34221
  facts.hasReanimatedAwarePackage = facts.hasReanimatedAwarePackage || isPackageJsonReanimatedAware(packageJson);
34348
34222
  facts.hasSsrDependency = facts.hasSsrDependency || isPackageJsonSsrAware(packageJson);
34349
- const remotionSpec = getDependencySpec(packageJson, "remotion");
34350
- if (remotionSpec !== null) {
34351
- facts.hasRemotionDependency = true;
34352
- const resolvedRemotionVersion = resolveCatalogBackedDependencyVersion({
34353
- rootDirectory,
34354
- rootPackageJson,
34355
- packageName: "remotion",
34356
- version: remotionSpec
34357
- });
34358
- const remotionMajorVersion = resolvedRemotionVersion === null ? null : getLowestDependencyMajor(resolvedRemotionVersion);
34359
- if (remotionMajorVersion === null) {
34360
- facts.hasUnknownRemotionVersion = true;
34361
- facts.remotionVersion = null;
34362
- } else if (!facts.hasUnknownRemotionVersion) {
34363
- const currentRemotionMajorVersion = facts.remotionVersion === null ? null : getLowestDependencyMajor(facts.remotionVersion);
34364
- if (currentRemotionMajorVersion === null || remotionMajorVersion < currentRemotionMajorVersion) facts.remotionVersion = resolvedRemotionVersion;
34365
- }
34366
- }
34367
34223
  };
34368
34224
  const collectWorkspaceFacts = (rootDirectory, rootPackageJson, { collectReactGroup }) => {
34369
34225
  const facts = {
@@ -34383,31 +34239,12 @@ const collectWorkspaceFacts = (rootDirectory, rootPackageJson, { collectReactGro
34383
34239
  version: null,
34384
34240
  sourceDirectory: null
34385
34241
  },
34386
- valtioVersion: null,
34387
- mobx: {
34388
- version: null,
34389
- sourceDirectory: null
34390
- },
34391
- hasMobxReact: false,
34392
- hasMobxReactLite: false,
34393
- hasMobxStateTree: false,
34394
- hasMobxReactObserver: false,
34395
- zustand: {
34396
- version: null,
34397
- sourceDirectory: null
34398
- },
34399
- tanstackQueryVersion: null,
34400
- styledComponentsVersion: null,
34401
- hasI18nLibrary: false,
34402
34242
  hasReactNativeAwarePackage: false,
34403
34243
  hasReanimatedAwarePackage: false,
34404
34244
  hasSsrDependency: false,
34405
- hasRemotionDependency: false,
34406
- hasUnknownRemotionVersion: false,
34407
- remotionVersion: null,
34408
34245
  reanimatedVersion: null
34409
34246
  };
34410
- evaluateManifestFacts(facts, rootPackageJson, rootDirectory, rootDirectory, rootPackageJson);
34247
+ evaluateManifestFacts(facts, rootPackageJson, rootDirectory);
34411
34248
  let isReactGroupSettled = !collectReactGroup;
34412
34249
  const visitedDirectories = /* @__PURE__ */ new Set();
34413
34250
  for (const pattern of getWorkspacePatterns(rootDirectory, rootPackageJson)) {
@@ -34416,7 +34253,7 @@ const collectWorkspaceFacts = (rootDirectory, rootPackageJson, { collectReactGro
34416
34253
  if (visitedDirectories.has(workspaceDirectory)) continue;
34417
34254
  visitedDirectories.add(workspaceDirectory);
34418
34255
  const workspacePackageJson = readPackageJson(Path.join(workspaceDirectory, "package.json"));
34419
- evaluateManifestFacts(facts, workspacePackageJson, workspaceDirectory, rootDirectory, rootPackageJson);
34256
+ evaluateManifestFacts(facts, workspacePackageJson, workspaceDirectory);
34420
34257
  const info = extractDependencyInfo(workspacePackageJson);
34421
34258
  if (info.framework !== "unknown" && frameworkMergeRank(info.framework) < frameworkMergeRank(facts.framework)) facts.framework = info.framework;
34422
34259
  if (isReactGroupSettled) continue;
@@ -34640,27 +34477,11 @@ const discoverProjectWithoutPackageJson = (directory) => {
34640
34477
  tailwindVersion: null,
34641
34478
  zodVersion: null,
34642
34479
  zodMajorVersion: null,
34643
- mobxVersion: null,
34644
- mobxMajorVersion: null,
34645
- hasMobxReact: false,
34646
- hasMobxReactLite: false,
34647
- hasMobxStateTree: false,
34648
- hasMobxReactObserver: false,
34649
- zustandVersion: null,
34650
- zustandMajorVersion: null,
34651
34480
  framework: "unknown",
34652
34481
  hasTypeScript: hasOwnTsConfig,
34653
34482
  hasReactCompiler: false,
34654
34483
  hasReactCompilerLintPlugin: false,
34655
34484
  hasTanStackQuery: false,
34656
- valtioVersion: null,
34657
- valtioMajorVersion: null,
34658
- hasRemotion: false,
34659
- remotionVersion: null,
34660
- remotionMajorVersion: null,
34661
- hasI18nLibrary: false,
34662
- tanstackQueryVersion: null,
34663
- styledComponentsVersion: null,
34664
34485
  hasSsrDependency: false,
34665
34486
  preactVersion: null,
34666
34487
  preactMajorVersion: null,
@@ -34759,12 +34580,6 @@ const discoverProject = (directory) => {
34759
34580
  packageName: SHOPIFY_FLASH_LIST_PACKAGE_NAME,
34760
34581
  version: workspaceFacts.shopifyFlashList.version
34761
34582
  }) : null;
34762
- const zustandVersion = resolveCatalogBackedDependencyVersion({
34763
- rootDirectory: directory,
34764
- rootPackageJson: packageJson,
34765
- packageName: "zustand",
34766
- version: workspaceFacts.zustand.version
34767
- });
34768
34583
  const hasReanimated = hasReactNativeWorkspace && workspaceFacts.hasReanimatedAwarePackage;
34769
34584
  const reanimatedVersion = hasReanimated ? workspaceFacts.reanimatedVersion : null;
34770
34585
  const nextjsVersion = framework === "nextjs" ? resolveCatalogBackedDependencyVersion({
@@ -34773,21 +34588,7 @@ const discoverProject = (directory) => {
34773
34588
  packageName: "next",
34774
34589
  version: workspaceFacts.next.version
34775
34590
  }) : null;
34776
- const valtioVersion = resolveCatalogBackedDependencyVersion({
34777
- rootDirectory: directory,
34778
- rootPackageJson: packageJson,
34779
- packageName: "valtio",
34780
- version: workspaceFacts.valtioVersion
34781
- });
34782
- const mobxVersion = resolveCatalogBackedDependencyVersion({
34783
- rootDirectory: directory,
34784
- rootPackageJson: packageJson,
34785
- packageName: "mobx",
34786
- version: workspaceFacts.mobx.version
34787
- });
34788
34591
  const preactVersion = getPreactVersion(packageJson);
34789
- const remotionVersion = workspaceFacts.remotionVersion;
34790
- const tanstackQueryVersion = getTanStackQueryVersion(packageJson) ?? workspaceFacts.tanstackQueryVersion;
34791
34592
  const isPreES2023Target = hasTypeScript && detectPreES2023Target(directory);
34792
34593
  const projectInfo = {
34793
34594
  rootDirectory: directory,
@@ -34797,27 +34598,11 @@ const discoverProject = (directory) => {
34797
34598
  tailwindVersion,
34798
34599
  zodVersion,
34799
34600
  zodMajorVersion: zodVersion === null ? null : getLowestDependencyMajor(zodVersion),
34800
- mobxVersion,
34801
- mobxMajorVersion: mobxVersion === null ? null : getLowestDependencyMajor(mobxVersion),
34802
- hasMobxReact: workspaceFacts.hasMobxReact,
34803
- hasMobxReactLite: workspaceFacts.hasMobxReactLite,
34804
- hasMobxStateTree: workspaceFacts.hasMobxStateTree,
34805
- hasMobxReactObserver: workspaceFacts.hasMobxReactObserver,
34806
- zustandVersion,
34807
- zustandMajorVersion: zustandVersion === null ? null : getLowestDependencyMajor(zustandVersion),
34808
34601
  framework,
34809
34602
  hasTypeScript,
34810
34603
  hasReactCompiler: detectReactCompiler(directory, packageJson),
34811
34604
  hasReactCompilerLintPlugin: detectReactCompilerLintPlugin(directory, packageJson),
34812
- hasTanStackQuery: tanstackQueryVersion !== null,
34813
- hasI18nLibrary: workspaceFacts.hasI18nLibrary,
34814
- tanstackQueryVersion,
34815
- styledComponentsVersion: workspaceFacts.styledComponentsVersion,
34816
- valtioVersion,
34817
- valtioMajorVersion: valtioVersion === null ? null : getLowestDependencyMajor(valtioVersion),
34818
- hasRemotion: workspaceFacts.hasRemotionDependency,
34819
- remotionVersion,
34820
- remotionMajorVersion: remotionVersion === null ? null : getLowestDependencyMajor(remotionVersion),
34605
+ hasTanStackQuery: hasTanStackQuery(packageJson),
34821
34606
  hasSsrDependency: workspaceFacts.hasSsrDependency,
34822
34607
  preactVersion,
34823
34608
  preactMajorVersion: parseReactMajor(preactVersion),
@@ -37263,25 +37048,9 @@ const BABEL_CONFIG_FILE_NAMES = [
37263
37048
  ".babelrc.json"
37264
37049
  ];
37265
37050
  const LEGACY_PRESET_SPEC = "module:metro-react-native-babel-preset";
37266
- const LEGACY_PRESET_PACKAGE = "metro-react-native-babel-preset";
37267
- const REACT_NATIVE_PACKAGE = "react-native";
37268
- const PRESET_RENAME_MINIMUM_REACT_NATIVE_VERSION = "0.73.0";
37269
- const LEGACY_PRESET_REFERENCE = new RegExp(`['"]${LEGACY_PRESET_SPEC}['"]`);
37270
37051
  const MODERN_PRESET_REFERENCE = new RegExp(`['"]module:@react-native/babel-preset['"]`);
37271
37052
  const ENABLE_BABEL_RUNTIME_VERSION = /enableBabelRuntime["']?\s*:\s*['"]/;
37272
- const isReactNativeVersionAtLeastPresetRename = (rootDirectory, packageJson) => {
37273
- const installedReactNativeManifestPath = Path.join(rootDirectory, "node_modules", REACT_NATIVE_PACKAGE, "package.json");
37274
- const reactNativeVersionSpec = (isFile(installedReactNativeManifestPath) ? readPackageJson(installedReactNativeManifestPath).version : void 0) ?? getDependencySpec(packageJson, REACT_NATIVE_PACKAGE);
37275
- if (reactNativeVersionSpec === null || reactNativeVersionSpec === void 0) return false;
37276
- const normalizedVersionRange = import_semver.validRange(reactNativeVersionSpec);
37277
- if (normalizedVersionRange === null) return false;
37278
- const minimumVersion = import_semver.minVersion(normalizedVersionRange);
37279
- return minimumVersion !== null && import_semver.gte(minimumVersion, PRESET_RENAME_MINIMUM_REACT_NATIVE_VERSION);
37280
- };
37281
- const canResolveLegacyPreset = (rootDirectory, packageJson) => getDependencySpec(packageJson, LEGACY_PRESET_PACKAGE) !== null || isFile(Path.join(rootDirectory, "node_modules", LEGACY_PRESET_PACKAGE, "package.json"));
37282
37053
  const checkReactNativeMetroBabelPreset = (rootDirectory) => {
37283
- const packageJson = readPackageJson(Path.join(rootDirectory, "package.json"));
37284
- const shouldReportLegacyPreset = isReactNativeVersionAtLeastPresetRename(rootDirectory, packageJson) && !canResolveLegacyPreset(rootDirectory, packageJson);
37285
37054
  for (const fileName of BABEL_CONFIG_FILE_NAMES) {
37286
37055
  const filePath = Path.join(rootDirectory, fileName);
37287
37056
  if (!isFile(filePath)) continue;
@@ -37291,7 +37060,7 @@ const checkReactNativeMetroBabelPreset = (rootDirectory) => {
37291
37060
  } catch {
37292
37061
  continue;
37293
37062
  }
37294
- if (shouldReportLegacyPreset && LEGACY_PRESET_REFERENCE.test(contents)) return [buildReactNativeDiagnostic({
37063
+ if (contents.includes(LEGACY_PRESET_SPEC)) return [buildReactNativeDiagnostic({
37295
37064
  filePath: fileName,
37296
37065
  rule: "rn-no-metro-babel-preset",
37297
37066
  severity: "error",
@@ -37314,6 +37083,12 @@ const checkReactNativeProject = (rootDirectory, project) => {
37314
37083
  return [...checkReactNativeMetroBabelPreset(rootDirectory), ...checkReactNativeLibraryDependencies(rootDirectory)];
37315
37084
  };
37316
37085
  const RULE_KEY = "no-vulnerable-react-server-components";
37086
+ const DEPENDENCY_SECTIONS = [
37087
+ "dependencies",
37088
+ "devDependencies",
37089
+ "peerDependencies",
37090
+ "optionalDependencies"
37091
+ ];
37317
37092
  const REACT_RSC_ADVISORIES_BY_MINOR = {
37318
37093
  "19.0": {
37319
37094
  rceFixedVersion: "19.0.1",
@@ -37360,13 +37135,20 @@ const enumerateWorkspaceDirectories = (workspaceRoot) => {
37360
37135
  for (const pattern of patterns) for (const directory of resolveWorkspaceDirectories(workspaceRoot, pattern)) directories.add(directory);
37361
37136
  return [...directories];
37362
37137
  };
37138
+ const readDeclaredSpec = (packageJson, packageName) => {
37139
+ for (const section of DEPENDENCY_SECTIONS) {
37140
+ const spec = packageJson[section]?.[packageName];
37141
+ if (typeof spec === "string") return spec;
37142
+ }
37143
+ return null;
37144
+ };
37363
37145
  const resolveVersionInDirectory = (directory, packageName, declaredSpecOverride) => {
37364
37146
  const manifestPath = Path.join(directory, "node_modules", packageName, "package.json");
37365
37147
  if (isFile(manifestPath)) {
37366
37148
  const installedVersion = import_semver.valid(readPackageJson(manifestPath).version ?? null);
37367
37149
  if (installedVersion !== null) return installedVersion;
37368
37150
  }
37369
- const candidateSpecs = [getDependencySpec(readPackageJson(Path.join(directory, "package.json")), packageName), declaredSpecOverride];
37151
+ const candidateSpecs = [readDeclaredSpec(readPackageJson(Path.join(directory, "package.json")), packageName), declaredSpecOverride];
37370
37152
  for (const spec of candidateSpecs) {
37371
37153
  const pinnedVersion = spec === null ? null : import_semver.valid(spec);
37372
37154
  if (pinnedVersion !== null) return pinnedVersion;
@@ -38034,50 +37816,21 @@ const buildCapabilities = (project) => {
38034
37816
  if (CLIENT_ONLY_FRAMEWORKS.has(project.framework)) capabilities.add("client-only");
38035
37817
  if (project.isStaticExport) capabilities.add("nextjs:static-export");
38036
37818
  if (project.nextjsMajorVersion !== null && project.nextjsMajorVersion >= 15) capabilities.add("nextjs:15");
38037
- if (project.nextjsMajorVersion !== null && project.nextjsMajorVersion >= 16) capabilities.add("nextjs:16");
38038
37819
  addMajorLadder(capabilities, "react", project.reactMajorVersion, 17, 30);
38039
37820
  if (project.reactMajorVersion !== null && project.reactMajorVersion >= 19 && isMajorMinorAtLeast(parseReactMajorMinor(project.reactVersion), {
38040
37821
  major: 19,
38041
37822
  minor: 2
38042
37823
  })) capabilities.add("react:19.2");
38043
- if (project.tailwindVersion !== null) {
38044
- capabilities.add("tailwind");
38045
- const tailwindVersion = parseTailwindMajorMinor(project.tailwindVersion);
38046
- if (isMajorMinorAtLeast(tailwindVersion, {
38047
- major: 3,
38048
- minor: 4
38049
- })) capabilities.add("tailwind:3.4");
38050
- if (tailwindVersion !== null && isMajorMinorAtLeast(tailwindVersion, {
38051
- major: 4,
38052
- minor: 0
38053
- })) capabilities.add("tailwind:4");
38054
- }
37824
+ if (project.tailwindVersion !== null) capabilities.add("tailwind");
37825
+ if (project.tailwindVersion !== null && isMajorMinorAtLeast(parseTailwindMajorMinor(project.tailwindVersion), {
37826
+ major: 3,
37827
+ minor: 4
37828
+ })) capabilities.add("tailwind:3.4");
38055
37829
  if (project.zodVersion !== null) capabilities.add("zod");
38056
37830
  if (project.zodMajorVersion !== null && project.zodMajorVersion >= 4) capabilities.add("zod:4");
38057
- if (project.mobxVersion !== void 0 && project.mobxVersion !== null || project.hasMobxReact === true || project.hasMobxReactLite === true || project.hasMobxStateTree === true || project.hasMobxReactObserver === true) capabilities.add("mobx");
38058
- if (project.hasMobxReact === true) capabilities.add("mobx-react");
38059
- if (project.hasMobxReactLite === true) capabilities.add("mobx-react-lite");
38060
- if (project.hasMobxReact === true || project.hasMobxReactLite === true) capabilities.add("mobx-react-binding");
38061
- if (project.hasMobxStateTree === true) capabilities.add("mobx-state-tree");
38062
- if (project.hasMobxReactObserver === true) capabilities.add("mobx-react-observer");
38063
- if (project.mobxMajorVersion !== void 0 && project.mobxMajorVersion !== null && project.mobxMajorVersion >= 4 && project.mobxMajorVersion <= 6) addMajorLadder(capabilities, "mobx", project.mobxMajorVersion, 4, 6);
38064
- if (project.zustandVersion !== void 0 && project.zustandVersion !== null) capabilities.add("zustand");
38065
- if (project.zustandMajorVersion !== void 0 && project.zustandMajorVersion !== null && project.zustandMajorVersion >= 1 && project.zustandMajorVersion <= 5) addMajorLadder(capabilities, "zustand", project.zustandMajorVersion, 1, 5);
38066
37831
  if (project.isPreES2023Target) capabilities.add("pre-es2023");
38067
37832
  if (project.hasReactCompiler) capabilities.add("react-compiler");
38068
- if (Boolean(project.hasTanStackQuery) || Boolean(project.tanstackQueryVersion)) capabilities.add("tanstack-query");
38069
- if (project.styledComponentsVersion) {
38070
- capabilities.add("styled-components");
38071
- const styledComponentsMajor = getLowestDependencyMajor(project.styledComponentsVersion);
38072
- if (styledComponentsMajor !== null && styledComponentsMajor >= 6) capabilities.add("styled-components:6");
38073
- }
38074
- if (project.hasI18nLibrary) capabilities.add("i18n");
38075
- if (project.valtioVersion !== null) capabilities.add("valtio");
38076
- addMajorLadder(capabilities, "valtio", project.valtioMajorVersion, 1, 10);
38077
- if (project.hasRemotion) {
38078
- capabilities.add("remotion");
38079
- addMajorLadder(capabilities, "remotion", project.remotionMajorVersion ?? null, 4, 30);
38080
- }
37833
+ if (project.hasTanStackQuery) capabilities.add("tanstack-query");
38081
37834
  if (project.hasTypeScript) capabilities.add("typescript");
38082
37835
  if (project.preactVersion !== null) capabilities.add("preact");
38083
37836
  addMajorLadder(capabilities, "preact", project.preactMajorVersion, 10, 20);
@@ -38092,7 +37845,7 @@ const getCapabilities = (project) => {
38092
37845
  capabilitiesByProject.set(project, capabilities);
38093
37846
  return capabilities;
38094
37847
  };
38095
- const shouldEnableRule = (requires, tags, capabilities, ignoredTags, disabledWhen, includedTags) => {
37848
+ const shouldEnableRule = (requires, tags, capabilities, ignoredTags, disabledWhen) => {
38096
37849
  if (requires) {
38097
37850
  for (const capability of requires) if (!capabilities.has(capability)) return false;
38098
37851
  }
@@ -38103,29 +37856,20 @@ const shouldEnableRule = (requires, tags, capabilities, ignoredTags, disabledWhe
38103
37856
  if (tags) {
38104
37857
  for (const tag of tags) if (ignoredTags.has(tag)) return false;
38105
37858
  }
38106
- if (includedTags && includedTags.size > 0) {
38107
- if (!tags?.some((tag) => includedTags.has(tag))) return false;
38108
- }
38109
37859
  return true;
38110
37860
  };
38111
- const shouldEnableRuleByDefaultStatus = (options) => options.defaultEnabled !== false || options.hasExplicitOverride === true || options.includeTagDefaults && options.hasIncludedTags;
38112
37861
  const yieldToEventLoop = () => new Promise((resolve) => {
38113
37862
  setImmediate(resolve);
38114
37863
  });
38115
37864
  const createSecurityScanSession = (rootDirectory, options) => {
38116
37865
  const capabilities = options.project ? getCapabilities(options.project) : /* @__PURE__ */ new Set();
38117
37866
  const ignoredTags = options.ignoredTags ?? /* @__PURE__ */ new Set();
38118
- const includedTags = options.includedTags ?? /* @__PURE__ */ new Set();
38119
37867
  const enabledScanRules = REACT_DOCTOR_RULES.flatMap((entry) => {
38120
37868
  const rule = entry.rule;
38121
37869
  const scan = rule.scan;
38122
37870
  if (typeof scan !== "function") return [];
38123
- if (!shouldEnableRuleByDefaultStatus({
38124
- defaultEnabled: rule.defaultEnabled,
38125
- includeTagDefaults: options.includeTagDefaults === true,
38126
- hasIncludedTags: includedTags.size > 0
38127
- })) return [];
38128
- if (!shouldEnableRule(rule.requires, rule.tags, capabilities, ignoredTags, rule.disabledWhen, includedTags)) return [];
37871
+ if (rule.defaultEnabled === false) return [];
37872
+ if (!shouldEnableRule(rule.requires, rule.tags, capabilities, ignoredTags, rule.disabledWhen)) return [];
38129
37873
  return [{
38130
37874
  entry,
38131
37875
  scan,
@@ -40111,9 +39855,8 @@ const buildUserPluginRules = (userPlugin, severityControls) => {
40111
39855
  }
40112
39856
  return enabled;
40113
39857
  };
40114
- const createOxlintConfig = ({ pluginPath, project, customRulesOnly = false, extendsPaths = [], ignoredTags = /* @__PURE__ */ new Set(), includedTags = /* @__PURE__ */ new Set(), includeTagDefaults = false, serverAuthFunctionNames, severityControls, userPlugins = [], disableReactHooksJsPlugin = false, ruleSelection, sidecarRuleIdFilter }) => {
40115
- const hasIncludedTags = includedTags.size > 0;
40116
- const reactHooksJsPlugin = disableReactHooksJsPlugin || ruleSelection === "sidecar" || hasIncludedTags ? null : resolveReactHooksJsPlugin(project.hasReactCompiler || project.hasReactCompilerLintPlugin === true, customRulesOnly);
39858
+ const createOxlintConfig = ({ pluginPath, project, customRulesOnly = false, extendsPaths = [], ignoredTags = /* @__PURE__ */ new Set(), serverAuthFunctionNames, severityControls, userPlugins = [], disableReactHooksJsPlugin = false, ruleSelection, sidecarRuleIdFilter }) => {
39859
+ const reactHooksJsPlugin = disableReactHooksJsPlugin || ruleSelection === "sidecar" ? null : resolveReactHooksJsPlugin(project.hasReactCompiler || project.hasReactCompilerLintPlugin === true, customRulesOnly);
40117
39860
  const reactCompilerRules = reactHooksJsPlugin ? applyRuleSeverityControls(filterRulesToAvailable(REACT_COMPILER_RULES, "react-hooks-js", reactHooksJsPlugin.availableRuleNames), severityControls) : {};
40118
39861
  const jsPlugins = [];
40119
39862
  if (reactHooksJsPlugin) jsPlugins.push(reactHooksJsPlugin.entry);
@@ -40128,14 +39871,9 @@ const createOxlintConfig = ({ pluginPath, project, customRulesOnly = false, exte
40128
39871
  if (rule.scan !== void 0) continue;
40129
39872
  if (customRulesOnly && registryEntry.originallyExternal) continue;
40130
39873
  if (rule.framework !== "global" && !rule.requires) continue;
40131
- if (!shouldEnableRule(rule.requires, rule.tags, capabilities, ignoredTags, rule.disabledWhen, includedTags)) continue;
39874
+ if (!shouldEnableRule(rule.requires, rule.tags, capabilities, ignoredTags, rule.disabledWhen)) continue;
40132
39875
  const explicitRuleOverride = resolveRuleSeverityOverride({ ruleKey: registryEntry.key }, severityControls);
40133
- if (!shouldEnableRuleByDefaultStatus({
40134
- defaultEnabled: rule.defaultEnabled,
40135
- includeTagDefaults,
40136
- hasIncludedTags,
40137
- hasExplicitOverride: explicitRuleOverride !== void 0
40138
- })) continue;
39876
+ if (rule.defaultEnabled === false && explicitRuleOverride === void 0) continue;
40139
39877
  const severity = resolveRuleSeverityOverride({
40140
39878
  ruleKey: registryEntry.key,
40141
39879
  category: rule.category
@@ -40144,7 +39882,7 @@ const createOxlintConfig = ({ pluginPath, project, customRulesOnly = false, exte
40144
39882
  enabledReactDoctorRules[registryEntry.key] = severity;
40145
39883
  }
40146
39884
  const userPluginRules = {};
40147
- if (ruleSelection !== "sidecar" && !hasIncludedTags) for (const userPlugin of userPlugins) {
39885
+ if (ruleSelection !== "sidecar") for (const userPlugin of userPlugins) {
40148
39886
  Object.assign(userPluginRules, buildUserPluginRules(userPlugin, severityControls));
40149
39887
  jsPlugins.push(userPlugin.entry);
40150
39888
  }
@@ -40361,19 +40099,6 @@ const createSidecarLintCache = (cacheDirectory, rulesetHash) => {
40361
40099
  }
40362
40100
  };
40363
40101
  };
40364
- const fingerprintCacheByFilePath = /* @__PURE__ */ new Map();
40365
- const fingerprintFileContents = (filePath, fingerprintLength) => {
40366
- const fileStats = NFS.statSync(filePath, { bigint: true });
40367
- const cachedFingerprint = fingerprintCacheByFilePath.get(filePath);
40368
- if (cachedFingerprint?.modifiedTimeNanoseconds === fileStats.mtimeNs && cachedFingerprint.sizeBytes === fileStats.size) return cachedFingerprint.fingerprint;
40369
- const fingerprint = crypto.createHash("sha256").update(NFS.readFileSync(filePath)).digest("hex").slice(0, fingerprintLength);
40370
- fingerprintCacheByFilePath.set(filePath, {
40371
- fingerprint,
40372
- modifiedTimeNanoseconds: fileStats.mtimeNs,
40373
- sizeBytes: fileStats.size
40374
- });
40375
- return fingerprint;
40376
- };
40377
40102
  const bundledRequire = createRequire(import.meta.url);
40378
40103
  const childNodeVersionByBinaryPath = /* @__PURE__ */ new Map();
40379
40104
  const resolveChildNodeVersion = (nodeBinaryPath) => {
@@ -40397,13 +40122,6 @@ const TOOLCHAIN_PACKAGE_SPECIFIERS = [
40397
40122
  "oxlint-plugin-react-doctor/package.json",
40398
40123
  "eslint-plugin-react-hooks/package.json"
40399
40124
  ];
40400
- const resolvePluginFingerprint = () => {
40401
- try {
40402
- return fingerprintFileContents(bundledRequire.resolve("oxlint-plugin-react-doctor"), 16);
40403
- } catch {
40404
- return "unresolved";
40405
- }
40406
- };
40407
40125
  const resolveOxlintToolchainVersions = (nodeBinaryPath = process.execPath) => {
40408
40126
  const versions = [`node=${resolveChildNodeVersion(nodeBinaryPath)}`];
40409
40127
  for (const specifier of TOOLCHAIN_PACKAGE_SPECIFIERS) try {
@@ -40413,7 +40131,6 @@ const resolveOxlintToolchainVersions = (nodeBinaryPath = process.execPath) => {
40413
40131
  } catch {
40414
40132
  versions.push(`${specifier}=missing`);
40415
40133
  }
40416
- versions.push(`oxlint-plugin-react-doctor#fingerprint=${resolvePluginFingerprint()}`);
40417
40134
  return versions;
40418
40135
  };
40419
40136
  const esmRequire = createRequire(import.meta.url);
@@ -41889,7 +41606,7 @@ const reactHooksJsPluginDropNote = (error) => {
41889
41606
  * 6. always restore disable directives + clean up the temp dir
41890
41607
  */
41891
41608
  const runOxlint = async (options) => {
41892
- 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;
41609
+ 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;
41893
41610
  const serverAuthFunctionNames = Array.isArray(userConfig?.serverAuthFunctionNames) ? userConfig.serverAuthFunctionNames.filter((entry) => typeof entry === "string" && entry.length > 0) : void 0;
41894
41611
  const severityControls = buildRuleSeverityControls(userConfig);
41895
41612
  validateRuleRegistration();
@@ -41903,15 +41620,13 @@ const runOxlint = async (options) => {
41903
41620
  }
41904
41621
  const pluginPath = resolvePluginPath();
41905
41622
  const extendsPaths = (adoptExistingLintConfig && !customRulesOnly ? detectUserLintConfigPaths(rootDirectory) : []).filter(canOxlintExtendConfig);
41906
- const userPlugins = includedTags.size > 0 ? [] : resolveUserPlugins(userConfig?.plugins, configSourceDirectory);
41623
+ const userPlugins = resolveUserPlugins(userConfig?.plugins, configSourceDirectory);
41907
41624
  const buildConfig = (overrides) => createOxlintConfig({
41908
41625
  pluginPath,
41909
41626
  project,
41910
41627
  customRulesOnly,
41911
41628
  extendsPaths: overrides.extendsPaths,
41912
41629
  ignoredTags,
41913
- includedTags,
41914
- includeTagDefaults,
41915
41630
  serverAuthFunctionNames,
41916
41631
  severityControls,
41917
41632
  userPlugins,
@@ -42300,8 +42015,6 @@ var Linter = class Linter extends Service()("react-doctor/Linter") {
42300
42015
  respectInlineDisables: input.respectInlineDisables,
42301
42016
  adoptExistingLintConfig: input.adoptExistingLintConfig,
42302
42017
  ignoredTags: input.ignoredTags,
42303
- includedTags: input.includedTags,
42304
- includeTagDefaults: input.includeTagDefaults,
42305
42018
  userConfig: input.userConfig ?? null,
42306
42019
  configSourceDirectory: input.configSourceDirectory,
42307
42020
  onPartialFailure: (reason) => {
@@ -43150,9 +42863,7 @@ const runInspect = (input, hooks = {}) => gen(function* () {
43150
42863
  const securityScanFailedRef = yield* make$13(false);
43151
42864
  const securityScanFiber = yield* forkChild(runCollect(applyPerElementPipeline(isDiffMode ? empty$4 : unwrap(tryPromise(() => checkSecurityScanCooperative(scanDirectory, {
43152
42865
  project,
43153
- ignoredTags: input.ignoredTags,
43154
- includedTags: input.includedTags,
43155
- includeTagDefaults: input.includeTagDefaults
42866
+ ignoredTags: input.ignoredTags
43156
42867
  })).pipe(map$3((diagnostics) => fromIterable$1(diagnostics)), catch_$1(() => set(securityScanFailedRef, true).pipe(as(empty$4))))))).pipe(withSpan("SecurityScan.run")));
43157
42868
  const shouldRunSupplyChain = !isDiffMode || (input.supplyChainManifestChanged ?? false);
43158
42869
  const supplyChainOverlapTimeout = yield* SupplyChainOverlapTimeoutMs;
@@ -43243,8 +42954,6 @@ const runInspect = (input, hooks = {}) => gen(function* () {
43243
42954
  respectInlineDisables: input.respectInlineDisables,
43244
42955
  adoptExistingLintConfig: input.adoptExistingLintConfig,
43245
42956
  ignoredTags: input.ignoredTags,
43246
- includedTags: input.includedTags,
43247
- includeTagDefaults: input.includeTagDefaults,
43248
42957
  userConfig: resolvedConfig.config ?? void 0,
43249
42958
  configSourceDirectory: resolvedConfig.configSourceDirectory ?? void 0,
43250
42959
  onFileProgress: (scannedFileCount, totalFileCount) => {
@@ -45747,5 +45456,5 @@ const startLanguageServer = () => {
45747
45456
  };
45748
45457
  //#endregion
45749
45458
  export { startLanguageServer };
45750
- !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]="6c3f6717-c00e-5081-bb66-501f2fd8a0d1")}catch(e){}}();
45751
- //# debugId=6c3f6717-c00e-5081-bb66-501f2fd8a0d1
45459
+ !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]="2e6fca06-4d93-5b9e-86fd-92bfb63393e0")}catch(e){}}();
45460
+ //# debugId=2e6fca06-4d93-5b9e-86fd-92bfb63393e0