react-doctor 0.8.1-dev.7c9dbed → 0.8.1-dev.7eca0ee
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cli.js +169 -23
- package/dist/index.d.ts +24 -0
- package/dist/index.js +166 -20
- package/dist/lsp.js +166 -20
- package/package.json +5 -5
package/dist/cli.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
|
|
2
|
-
!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="
|
|
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]="81bdc95e-12f2-565f-a05c-7b8a60a98f81")}catch(e){}}();
|
|
3
3
|
import { createRequire } from "node:module";
|
|
4
4
|
import * as NodeChildProcess from "node:child_process";
|
|
5
5
|
import { execFile, execFileSync, spawn, spawnSync } from "node:child_process";
|
|
@@ -37317,6 +37317,10 @@ const listWorkspacePackages = (rootDirectory) => {
|
|
|
37317
37317
|
return packages;
|
|
37318
37318
|
};
|
|
37319
37319
|
const REANIMATED_DEPENDENCY_NAME = "react-native-reanimated";
|
|
37320
|
+
const MOBX_REACT_PACKAGE_NAME = "mobx-react";
|
|
37321
|
+
const MOBX_REACT_LITE_PACKAGE_NAME = "mobx-react-lite";
|
|
37322
|
+
const MOBX_STATE_TREE_PACKAGE_NAME = "mobx-state-tree";
|
|
37323
|
+
const MOBX_REACT_OBSERVER_PACKAGE_NAME = "mobx-react-observer";
|
|
37320
37324
|
const SHOPIFY_FLASH_LIST_PACKAGE_NAME = "@shopify/flash-list";
|
|
37321
37325
|
const resolveWorkspaceDependencyVersion = ({ concreteVersion, packageName, rootDirectory, rootPackageJson, sections, workspaceDirectory, workspacePackageJson }) => {
|
|
37322
37326
|
const dependencyDeclaration = getDependencyDeclaration({
|
|
@@ -37335,7 +37339,18 @@ const shouldReplaceReactVersion = (currentVersion, nextVersion) => {
|
|
|
37335
37339
|
if (nextMajor === null) return false;
|
|
37336
37340
|
return nextMajor < currentMajor;
|
|
37337
37341
|
};
|
|
37338
|
-
const
|
|
37342
|
+
const shouldReplaceSupportedDependencyFact = (currentFact, nextFact, latestSupportedMajor) => {
|
|
37343
|
+
if (currentFact.version === null) return true;
|
|
37344
|
+
if (nextFact.version === null) return false;
|
|
37345
|
+
const currentMajor = getLowestDependencyMajor(currentFact.version);
|
|
37346
|
+
const nextMajor = getLowestDependencyMajor(nextFact.version);
|
|
37347
|
+
if (currentMajor === null) return false;
|
|
37348
|
+
if (nextMajor === null) return true;
|
|
37349
|
+
if (currentMajor > latestSupportedMajor) return false;
|
|
37350
|
+
if (nextMajor > latestSupportedMajor) return true;
|
|
37351
|
+
return nextMajor < currentMajor;
|
|
37352
|
+
};
|
|
37353
|
+
const evaluateManifestFacts = (facts, packageJson, directory, rootDirectory, rootPackageJson) => {
|
|
37339
37354
|
if (facts.expo.version === null) {
|
|
37340
37355
|
const spec = getDependencySpec(packageJson, "expo");
|
|
37341
37356
|
if (spec !== null) facts.expo = {
|
|
@@ -37357,13 +37372,65 @@ const evaluateManifestFacts = (facts, packageJson, directory) => {
|
|
|
37357
37372
|
sourceDirectory: directory
|
|
37358
37373
|
};
|
|
37359
37374
|
}
|
|
37375
|
+
const mobxSpec = getDependencySpec(packageJson, "mobx");
|
|
37376
|
+
if (mobxSpec !== null) {
|
|
37377
|
+
const nextMobxFact = {
|
|
37378
|
+
version: resolveCatalogBackedDependencyVersion({
|
|
37379
|
+
rootDirectory: directory,
|
|
37380
|
+
rootPackageJson: packageJson,
|
|
37381
|
+
packageName: "mobx",
|
|
37382
|
+
version: mobxSpec
|
|
37383
|
+
}),
|
|
37384
|
+
sourceDirectory: directory
|
|
37385
|
+
};
|
|
37386
|
+
if (shouldReplaceSupportedDependencyFact(facts.mobx, nextMobxFact, 6)) facts.mobx = nextMobxFact;
|
|
37387
|
+
}
|
|
37388
|
+
facts.hasMobxReact = facts.hasMobxReact || getDependencySpec(packageJson, MOBX_REACT_PACKAGE_NAME) !== null;
|
|
37389
|
+
facts.hasMobxReactLite = facts.hasMobxReactLite || getDependencySpec(packageJson, MOBX_REACT_LITE_PACKAGE_NAME) !== null;
|
|
37390
|
+
facts.hasMobxStateTree = facts.hasMobxStateTree || getDependencySpec(packageJson, MOBX_STATE_TREE_PACKAGE_NAME) !== null;
|
|
37391
|
+
facts.hasMobxReactObserver = facts.hasMobxReactObserver || getDependencySpec(packageJson, MOBX_REACT_OBSERVER_PACKAGE_NAME) !== null;
|
|
37392
|
+
const zustandSpec = getDependencySpec(packageJson, "zustand");
|
|
37393
|
+
if (zustandSpec !== null) {
|
|
37394
|
+
const nextZustandFact = {
|
|
37395
|
+
version: resolveCatalogBackedDependencyVersion({
|
|
37396
|
+
rootDirectory: directory,
|
|
37397
|
+
rootPackageJson: packageJson,
|
|
37398
|
+
packageName: "zustand",
|
|
37399
|
+
version: zustandSpec
|
|
37400
|
+
}),
|
|
37401
|
+
sourceDirectory: directory
|
|
37402
|
+
};
|
|
37403
|
+
if (shouldReplaceSupportedDependencyFact(facts.zustand, nextZustandFact, 5)) facts.zustand = nextZustandFact;
|
|
37404
|
+
}
|
|
37360
37405
|
if (facts.reanimatedVersion === null) {
|
|
37361
37406
|
const spec = getDependencySpec(packageJson, REANIMATED_DEPENDENCY_NAME);
|
|
37362
37407
|
if (spec !== null) facts.reanimatedVersion = spec;
|
|
37363
37408
|
}
|
|
37409
|
+
if (facts.valtioVersion === null) {
|
|
37410
|
+
const spec = getDependencySpec(packageJson, "valtio");
|
|
37411
|
+
if (spec !== null) facts.valtioVersion = spec;
|
|
37412
|
+
}
|
|
37364
37413
|
facts.hasReactNativeAwarePackage = facts.hasReactNativeAwarePackage || isPackageJsonReactNativeAware(packageJson);
|
|
37365
37414
|
facts.hasReanimatedAwarePackage = facts.hasReanimatedAwarePackage || isPackageJsonReanimatedAware(packageJson);
|
|
37366
37415
|
facts.hasSsrDependency = facts.hasSsrDependency || isPackageJsonSsrAware(packageJson);
|
|
37416
|
+
const remotionSpec = getDependencySpec(packageJson, "remotion");
|
|
37417
|
+
if (remotionSpec !== null) {
|
|
37418
|
+
facts.hasRemotionDependency = true;
|
|
37419
|
+
const resolvedRemotionVersion = resolveCatalogBackedDependencyVersion({
|
|
37420
|
+
rootDirectory,
|
|
37421
|
+
rootPackageJson,
|
|
37422
|
+
packageName: "remotion",
|
|
37423
|
+
version: remotionSpec
|
|
37424
|
+
});
|
|
37425
|
+
const remotionMajorVersion = resolvedRemotionVersion === null ? null : getLowestDependencyMajor(resolvedRemotionVersion);
|
|
37426
|
+
if (remotionMajorVersion === null) {
|
|
37427
|
+
facts.hasUnknownRemotionVersion = true;
|
|
37428
|
+
facts.remotionVersion = null;
|
|
37429
|
+
} else if (!facts.hasUnknownRemotionVersion) {
|
|
37430
|
+
const currentRemotionMajorVersion = facts.remotionVersion === null ? null : getLowestDependencyMajor(facts.remotionVersion);
|
|
37431
|
+
if (currentRemotionMajorVersion === null || remotionMajorVersion < currentRemotionMajorVersion) facts.remotionVersion = resolvedRemotionVersion;
|
|
37432
|
+
}
|
|
37433
|
+
}
|
|
37367
37434
|
};
|
|
37368
37435
|
const collectWorkspaceFacts = (rootDirectory, rootPackageJson, { collectReactGroup }) => {
|
|
37369
37436
|
const facts = {
|
|
@@ -37383,12 +37450,28 @@ const collectWorkspaceFacts = (rootDirectory, rootPackageJson, { collectReactGro
|
|
|
37383
37450
|
version: null,
|
|
37384
37451
|
sourceDirectory: null
|
|
37385
37452
|
},
|
|
37453
|
+
valtioVersion: null,
|
|
37454
|
+
mobx: {
|
|
37455
|
+
version: null,
|
|
37456
|
+
sourceDirectory: null
|
|
37457
|
+
},
|
|
37458
|
+
hasMobxReact: false,
|
|
37459
|
+
hasMobxReactLite: false,
|
|
37460
|
+
hasMobxStateTree: false,
|
|
37461
|
+
hasMobxReactObserver: false,
|
|
37462
|
+
zustand: {
|
|
37463
|
+
version: null,
|
|
37464
|
+
sourceDirectory: null
|
|
37465
|
+
},
|
|
37386
37466
|
hasReactNativeAwarePackage: false,
|
|
37387
37467
|
hasReanimatedAwarePackage: false,
|
|
37388
37468
|
hasSsrDependency: false,
|
|
37469
|
+
hasRemotionDependency: false,
|
|
37470
|
+
hasUnknownRemotionVersion: false,
|
|
37471
|
+
remotionVersion: null,
|
|
37389
37472
|
reanimatedVersion: null
|
|
37390
37473
|
};
|
|
37391
|
-
evaluateManifestFacts(facts, rootPackageJson, rootDirectory);
|
|
37474
|
+
evaluateManifestFacts(facts, rootPackageJson, rootDirectory, rootDirectory, rootPackageJson);
|
|
37392
37475
|
let isReactGroupSettled = !collectReactGroup;
|
|
37393
37476
|
const visitedDirectories = /* @__PURE__ */ new Set();
|
|
37394
37477
|
for (const pattern of getWorkspacePatterns(rootDirectory, rootPackageJson)) {
|
|
@@ -37397,7 +37480,7 @@ const collectWorkspaceFacts = (rootDirectory, rootPackageJson, { collectReactGro
|
|
|
37397
37480
|
if (visitedDirectories.has(workspaceDirectory)) continue;
|
|
37398
37481
|
visitedDirectories.add(workspaceDirectory);
|
|
37399
37482
|
const workspacePackageJson = readPackageJson$1(Path.join(workspaceDirectory, "package.json"));
|
|
37400
|
-
evaluateManifestFacts(facts, workspacePackageJson, workspaceDirectory);
|
|
37483
|
+
evaluateManifestFacts(facts, workspacePackageJson, workspaceDirectory, rootDirectory, rootPackageJson);
|
|
37401
37484
|
const info = extractDependencyInfo(workspacePackageJson);
|
|
37402
37485
|
if (info.framework !== "unknown" && frameworkMergeRank(info.framework) < frameworkMergeRank(facts.framework)) facts.framework = info.framework;
|
|
37403
37486
|
if (isReactGroupSettled) continue;
|
|
@@ -37618,11 +37701,24 @@ const discoverProjectWithoutPackageJson = (directory) => {
|
|
|
37618
37701
|
tailwindVersion: null,
|
|
37619
37702
|
zodVersion: null,
|
|
37620
37703
|
zodMajorVersion: null,
|
|
37704
|
+
mobxVersion: null,
|
|
37705
|
+
mobxMajorVersion: null,
|
|
37706
|
+
hasMobxReact: false,
|
|
37707
|
+
hasMobxReactLite: false,
|
|
37708
|
+
hasMobxStateTree: false,
|
|
37709
|
+
hasMobxReactObserver: false,
|
|
37710
|
+
zustandVersion: null,
|
|
37711
|
+
zustandMajorVersion: null,
|
|
37621
37712
|
framework: "unknown",
|
|
37622
37713
|
hasTypeScript: hasOwnTsConfig,
|
|
37623
37714
|
hasReactCompiler: false,
|
|
37624
37715
|
hasReactCompilerLintPlugin: false,
|
|
37625
37716
|
hasTanStackQuery: false,
|
|
37717
|
+
valtioVersion: null,
|
|
37718
|
+
valtioMajorVersion: null,
|
|
37719
|
+
hasRemotion: false,
|
|
37720
|
+
remotionVersion: null,
|
|
37721
|
+
remotionMajorVersion: null,
|
|
37626
37722
|
hasSsrDependency: false,
|
|
37627
37723
|
preactVersion: null,
|
|
37628
37724
|
preactMajorVersion: null,
|
|
@@ -37721,6 +37817,12 @@ const discoverProject = (directory) => {
|
|
|
37721
37817
|
packageName: SHOPIFY_FLASH_LIST_PACKAGE_NAME,
|
|
37722
37818
|
version: workspaceFacts.shopifyFlashList.version
|
|
37723
37819
|
}) : null;
|
|
37820
|
+
const zustandVersion = resolveCatalogBackedDependencyVersion({
|
|
37821
|
+
rootDirectory: directory,
|
|
37822
|
+
rootPackageJson: packageJson,
|
|
37823
|
+
packageName: "zustand",
|
|
37824
|
+
version: workspaceFacts.zustand.version
|
|
37825
|
+
});
|
|
37724
37826
|
const hasReanimated = hasReactNativeWorkspace && workspaceFacts.hasReanimatedAwarePackage;
|
|
37725
37827
|
const reanimatedVersion = hasReanimated ? workspaceFacts.reanimatedVersion : null;
|
|
37726
37828
|
const nextjsVersion = framework === "nextjs" ? resolveCatalogBackedDependencyVersion({
|
|
@@ -37729,7 +37831,20 @@ const discoverProject = (directory) => {
|
|
|
37729
37831
|
packageName: "next",
|
|
37730
37832
|
version: workspaceFacts.next.version
|
|
37731
37833
|
}) : null;
|
|
37834
|
+
const valtioVersion = resolveCatalogBackedDependencyVersion({
|
|
37835
|
+
rootDirectory: directory,
|
|
37836
|
+
rootPackageJson: packageJson,
|
|
37837
|
+
packageName: "valtio",
|
|
37838
|
+
version: workspaceFacts.valtioVersion
|
|
37839
|
+
});
|
|
37840
|
+
const mobxVersion = resolveCatalogBackedDependencyVersion({
|
|
37841
|
+
rootDirectory: directory,
|
|
37842
|
+
rootPackageJson: packageJson,
|
|
37843
|
+
packageName: "mobx",
|
|
37844
|
+
version: workspaceFacts.mobx.version
|
|
37845
|
+
});
|
|
37732
37846
|
const preactVersion = getPreactVersion(packageJson);
|
|
37847
|
+
const remotionVersion = workspaceFacts.remotionVersion;
|
|
37733
37848
|
const isPreES2023Target = hasTypeScript && detectPreES2023Target(directory);
|
|
37734
37849
|
const projectInfo = {
|
|
37735
37850
|
rootDirectory: directory,
|
|
@@ -37739,11 +37854,24 @@ const discoverProject = (directory) => {
|
|
|
37739
37854
|
tailwindVersion,
|
|
37740
37855
|
zodVersion,
|
|
37741
37856
|
zodMajorVersion: zodVersion === null ? null : getLowestDependencyMajor(zodVersion),
|
|
37857
|
+
mobxVersion,
|
|
37858
|
+
mobxMajorVersion: mobxVersion === null ? null : getLowestDependencyMajor(mobxVersion),
|
|
37859
|
+
hasMobxReact: workspaceFacts.hasMobxReact,
|
|
37860
|
+
hasMobxReactLite: workspaceFacts.hasMobxReactLite,
|
|
37861
|
+
hasMobxStateTree: workspaceFacts.hasMobxStateTree,
|
|
37862
|
+
hasMobxReactObserver: workspaceFacts.hasMobxReactObserver,
|
|
37863
|
+
zustandVersion,
|
|
37864
|
+
zustandMajorVersion: zustandVersion === null ? null : getLowestDependencyMajor(zustandVersion),
|
|
37742
37865
|
framework,
|
|
37743
37866
|
hasTypeScript,
|
|
37744
37867
|
hasReactCompiler: detectReactCompiler(directory, packageJson),
|
|
37745
37868
|
hasReactCompilerLintPlugin: detectReactCompilerLintPlugin(directory, packageJson),
|
|
37746
37869
|
hasTanStackQuery: hasTanStackQuery(packageJson),
|
|
37870
|
+
valtioVersion,
|
|
37871
|
+
valtioMajorVersion: valtioVersion === null ? null : getLowestDependencyMajor(valtioVersion),
|
|
37872
|
+
hasRemotion: workspaceFacts.hasRemotionDependency,
|
|
37873
|
+
remotionVersion,
|
|
37874
|
+
remotionMajorVersion: remotionVersion === null ? null : getLowestDependencyMajor(remotionVersion),
|
|
37747
37875
|
hasSsrDependency: workspaceFacts.hasSsrDependency,
|
|
37748
37876
|
preactVersion,
|
|
37749
37877
|
preactMajorVersion: parseReactMajor(preactVersion),
|
|
@@ -40298,9 +40426,25 @@ const BABEL_CONFIG_FILE_NAMES = [
|
|
|
40298
40426
|
".babelrc.json"
|
|
40299
40427
|
];
|
|
40300
40428
|
const LEGACY_PRESET_SPEC = "module:metro-react-native-babel-preset";
|
|
40429
|
+
const LEGACY_PRESET_PACKAGE = "metro-react-native-babel-preset";
|
|
40430
|
+
const REACT_NATIVE_PACKAGE = "react-native";
|
|
40431
|
+
const PRESET_RENAME_MINIMUM_REACT_NATIVE_VERSION = "0.73.0";
|
|
40432
|
+
const LEGACY_PRESET_REFERENCE = new RegExp(`['"]${LEGACY_PRESET_SPEC}['"]`);
|
|
40301
40433
|
const MODERN_PRESET_REFERENCE = new RegExp(`['"]module:@react-native/babel-preset['"]`);
|
|
40302
40434
|
const ENABLE_BABEL_RUNTIME_VERSION = /enableBabelRuntime["']?\s*:\s*['"]/;
|
|
40435
|
+
const isReactNativeVersionAtLeastPresetRename = (rootDirectory, packageJson) => {
|
|
40436
|
+
const installedReactNativeManifestPath = Path.join(rootDirectory, "node_modules", REACT_NATIVE_PACKAGE, "package.json");
|
|
40437
|
+
const reactNativeVersionSpec = (isFile(installedReactNativeManifestPath) ? readPackageJson$1(installedReactNativeManifestPath).version : void 0) ?? getDependencySpec(packageJson, REACT_NATIVE_PACKAGE);
|
|
40438
|
+
if (reactNativeVersionSpec === null || reactNativeVersionSpec === void 0) return false;
|
|
40439
|
+
const normalizedVersionRange = import_semver.validRange(reactNativeVersionSpec);
|
|
40440
|
+
if (normalizedVersionRange === null) return false;
|
|
40441
|
+
const minimumVersion = import_semver.minVersion(normalizedVersionRange);
|
|
40442
|
+
return minimumVersion !== null && import_semver.gte(minimumVersion, PRESET_RENAME_MINIMUM_REACT_NATIVE_VERSION);
|
|
40443
|
+
};
|
|
40444
|
+
const canResolveLegacyPreset = (rootDirectory, packageJson) => getDependencySpec(packageJson, LEGACY_PRESET_PACKAGE) !== null || isFile(Path.join(rootDirectory, "node_modules", LEGACY_PRESET_PACKAGE, "package.json"));
|
|
40303
40445
|
const checkReactNativeMetroBabelPreset = (rootDirectory) => {
|
|
40446
|
+
const packageJson = readPackageJson$1(Path.join(rootDirectory, "package.json"));
|
|
40447
|
+
const shouldReportLegacyPreset = isReactNativeVersionAtLeastPresetRename(rootDirectory, packageJson) && !canResolveLegacyPreset(rootDirectory, packageJson);
|
|
40304
40448
|
for (const fileName of BABEL_CONFIG_FILE_NAMES) {
|
|
40305
40449
|
const filePath = Path.join(rootDirectory, fileName);
|
|
40306
40450
|
if (!isFile(filePath)) continue;
|
|
@@ -40310,7 +40454,7 @@ const checkReactNativeMetroBabelPreset = (rootDirectory) => {
|
|
|
40310
40454
|
} catch {
|
|
40311
40455
|
continue;
|
|
40312
40456
|
}
|
|
40313
|
-
if (
|
|
40457
|
+
if (shouldReportLegacyPreset && LEGACY_PRESET_REFERENCE.test(contents)) return [buildReactNativeDiagnostic({
|
|
40314
40458
|
filePath: fileName,
|
|
40315
40459
|
rule: "rn-no-metro-babel-preset",
|
|
40316
40460
|
severity: "error",
|
|
@@ -40333,12 +40477,6 @@ const checkReactNativeProject = (rootDirectory, project) => {
|
|
|
40333
40477
|
return [...checkReactNativeMetroBabelPreset(rootDirectory), ...checkReactNativeLibraryDependencies(rootDirectory)];
|
|
40334
40478
|
};
|
|
40335
40479
|
const RULE_KEY = "no-vulnerable-react-server-components";
|
|
40336
|
-
const DEPENDENCY_SECTIONS = [
|
|
40337
|
-
"dependencies",
|
|
40338
|
-
"devDependencies",
|
|
40339
|
-
"peerDependencies",
|
|
40340
|
-
"optionalDependencies"
|
|
40341
|
-
];
|
|
40342
40480
|
const REACT_RSC_ADVISORIES_BY_MINOR = {
|
|
40343
40481
|
"19.0": {
|
|
40344
40482
|
rceFixedVersion: "19.0.1",
|
|
@@ -40385,20 +40523,13 @@ const enumerateWorkspaceDirectories = (workspaceRoot) => {
|
|
|
40385
40523
|
for (const pattern of patterns) for (const directory of resolveWorkspaceDirectories(workspaceRoot, pattern)) directories.add(directory);
|
|
40386
40524
|
return [...directories];
|
|
40387
40525
|
};
|
|
40388
|
-
const readDeclaredSpec = (packageJson, packageName) => {
|
|
40389
|
-
for (const section of DEPENDENCY_SECTIONS) {
|
|
40390
|
-
const spec = packageJson[section]?.[packageName];
|
|
40391
|
-
if (typeof spec === "string") return spec;
|
|
40392
|
-
}
|
|
40393
|
-
return null;
|
|
40394
|
-
};
|
|
40395
40526
|
const resolveVersionInDirectory = (directory, packageName, declaredSpecOverride) => {
|
|
40396
40527
|
const manifestPath = Path.join(directory, "node_modules", packageName, "package.json");
|
|
40397
40528
|
if (isFile(manifestPath)) {
|
|
40398
40529
|
const installedVersion = import_semver.valid(readPackageJson$1(manifestPath).version ?? null);
|
|
40399
40530
|
if (installedVersion !== null) return installedVersion;
|
|
40400
40531
|
}
|
|
40401
|
-
const candidateSpecs = [
|
|
40532
|
+
const candidateSpecs = [getDependencySpec(readPackageJson$1(Path.join(directory, "package.json")), packageName), declaredSpecOverride];
|
|
40402
40533
|
for (const spec of candidateSpecs) {
|
|
40403
40534
|
const pinnedVersion = spec === null ? null : import_semver.valid(spec);
|
|
40404
40535
|
if (pinnedVersion !== null) return pinnedVersion;
|
|
@@ -41078,9 +41209,24 @@ const buildCapabilities = (project) => {
|
|
|
41078
41209
|
})) capabilities.add("tailwind:3.4");
|
|
41079
41210
|
if (project.zodVersion !== null) capabilities.add("zod");
|
|
41080
41211
|
if (project.zodMajorVersion !== null && project.zodMajorVersion >= 4) capabilities.add("zod:4");
|
|
41212
|
+
if (project.mobxVersion !== void 0 && project.mobxVersion !== null || project.hasMobxReact === true || project.hasMobxReactLite === true || project.hasMobxStateTree === true || project.hasMobxReactObserver === true) capabilities.add("mobx");
|
|
41213
|
+
if (project.hasMobxReact === true) capabilities.add("mobx-react");
|
|
41214
|
+
if (project.hasMobxReactLite === true) capabilities.add("mobx-react-lite");
|
|
41215
|
+
if (project.hasMobxReact === true || project.hasMobxReactLite === true) capabilities.add("mobx-react-binding");
|
|
41216
|
+
if (project.hasMobxStateTree === true) capabilities.add("mobx-state-tree");
|
|
41217
|
+
if (project.hasMobxReactObserver === true) capabilities.add("mobx-react-observer");
|
|
41218
|
+
if (project.mobxMajorVersion !== void 0 && project.mobxMajorVersion !== null && project.mobxMajorVersion >= 4 && project.mobxMajorVersion <= 6) addMajorLadder(capabilities, "mobx", project.mobxMajorVersion, 4, 6);
|
|
41219
|
+
if (project.zustandVersion !== void 0 && project.zustandVersion !== null) capabilities.add("zustand");
|
|
41220
|
+
if (project.zustandMajorVersion !== void 0 && project.zustandMajorVersion !== null && project.zustandMajorVersion >= 1 && project.zustandMajorVersion <= 5) addMajorLadder(capabilities, "zustand", project.zustandMajorVersion, 1, 5);
|
|
41081
41221
|
if (project.isPreES2023Target) capabilities.add("pre-es2023");
|
|
41082
41222
|
if (project.hasReactCompiler) capabilities.add("react-compiler");
|
|
41083
41223
|
if (project.hasTanStackQuery) capabilities.add("tanstack-query");
|
|
41224
|
+
if (project.valtioVersion !== null) capabilities.add("valtio");
|
|
41225
|
+
addMajorLadder(capabilities, "valtio", project.valtioMajorVersion, 1, 10);
|
|
41226
|
+
if (project.hasRemotion) {
|
|
41227
|
+
capabilities.add("remotion");
|
|
41228
|
+
addMajorLadder(capabilities, "remotion", project.remotionMajorVersion ?? null, 4, 30);
|
|
41229
|
+
}
|
|
41084
41230
|
if (project.hasTypeScript) capabilities.add("typescript");
|
|
41085
41231
|
if (project.preactVersion !== null) capabilities.add("preact");
|
|
41086
41232
|
addMajorLadder(capabilities, "preact", project.preactMajorVersion, 10, 20);
|
|
@@ -47364,7 +47510,7 @@ const makeNoopConsole = () => ({
|
|
|
47364
47510
|
});
|
|
47365
47511
|
//#endregion
|
|
47366
47512
|
//#region src/cli/utils/version.ts
|
|
47367
|
-
const VERSION = "0.8.1-dev.
|
|
47513
|
+
const VERSION = "0.8.1-dev.7eca0ee";
|
|
47368
47514
|
//#endregion
|
|
47369
47515
|
//#region src/cli/utils/json-mode.ts
|
|
47370
47516
|
let context = null;
|
|
@@ -47716,13 +47862,13 @@ const isDevVersion = (version) => version === "0.0.0" || version.includes("-");
|
|
|
47716
47862
|
* uploads source-map artifacts under, so stack frames symbolicate. Honors the
|
|
47717
47863
|
* standard `SENTRY_RELEASE` override.
|
|
47718
47864
|
*/
|
|
47719
|
-
const resolveSentryRelease = () => process.env.SENTRY_RELEASE || `react-doctor@0.8.1-dev.
|
|
47865
|
+
const resolveSentryRelease = () => process.env.SENTRY_RELEASE || `react-doctor@0.8.1-dev.7eca0ee`;
|
|
47720
47866
|
/**
|
|
47721
47867
|
* Deployment environment shown in Sentry's environment filter. Defaults to
|
|
47722
47868
|
* `production` for tagged releases and `development` for dev/unbuilt versions,
|
|
47723
47869
|
* overridable via the standard `SENTRY_ENVIRONMENT` env var.
|
|
47724
47870
|
*/
|
|
47725
|
-
const resolveSentryEnvironment = () => process.env.SENTRY_ENVIRONMENT || (isDevVersion("0.8.1-dev.
|
|
47871
|
+
const resolveSentryEnvironment = () => process.env.SENTRY_ENVIRONMENT || (isDevVersion("0.8.1-dev.7eca0ee") ? "development" : "production");
|
|
47726
47872
|
/**
|
|
47727
47873
|
* Performance-tracing sample rate in `[0, 1]`. Reads `SENTRY_TRACES_SAMPLE_RATE`
|
|
47728
47874
|
* (set to `0` to disable tracing) and falls back to
|
|
@@ -66402,4 +66548,4 @@ Promise.resolve().then(() => assertNoRemovedFlags(process.argv)).then(() => prog
|
|
|
66402
66548
|
export {};
|
|
66403
66549
|
|
|
66404
66550
|
//# sourceMappingURL=cli.js.map
|
|
66405
|
-
//# debugId=
|
|
66551
|
+
//# debugId=81bdc95e-12f2-565f-a05c-7b8a60a98f81
|
package/dist/index.d.ts
CHANGED
|
@@ -9543,11 +9543,35 @@ interface ProjectInfo {
|
|
|
9543
9543
|
zodVersion: string | null;
|
|
9544
9544
|
/** Parsed major from `zodVersion`, or `null` when absent/unparseable. Mirrors `reactMajorVersion`. */
|
|
9545
9545
|
zodMajorVersion: number | null;
|
|
9546
|
+
/** Declared MobX core version spec. Optional so existing `ProjectInfo` consumers remain source-compatible. */
|
|
9547
|
+
mobxVersion?: string | null;
|
|
9548
|
+
/** Parsed major from `mobxVersion`, or `null` when absent/unparseable. */
|
|
9549
|
+
mobxMajorVersion?: number | null;
|
|
9550
|
+
hasMobxReact?: boolean;
|
|
9551
|
+
hasMobxReactLite?: boolean;
|
|
9552
|
+
hasMobxStateTree?: boolean;
|
|
9553
|
+
hasMobxReactObserver?: boolean;
|
|
9554
|
+
/** Declared Zustand version spec. Optional so existing `ProjectInfo` consumers remain source-compatible. */
|
|
9555
|
+
zustandVersion?: string | null;
|
|
9556
|
+
/** Parsed major from `zustandVersion`, or `null` when absent/unparseable. */
|
|
9557
|
+
zustandMajorVersion?: number | null;
|
|
9546
9558
|
framework: Framework;
|
|
9547
9559
|
hasTypeScript: boolean;
|
|
9548
9560
|
hasReactCompiler: boolean;
|
|
9549
9561
|
hasReactCompilerLintPlugin?: boolean;
|
|
9550
9562
|
hasTanStackQuery: boolean;
|
|
9563
|
+
hasRemotion?: boolean;
|
|
9564
|
+
remotionVersion?: string | null;
|
|
9565
|
+
remotionMajorVersion?: number | null;
|
|
9566
|
+
/**
|
|
9567
|
+
* The declared `valtio` version spec, or `null` when no package in the
|
|
9568
|
+
* analyzed project declares Valtio. `useSnapshot` has kept the same
|
|
9569
|
+
* render-read contract across Valtio 1 and 2, so presence alone drives the
|
|
9570
|
+
* `valtio` capability and its parsed major-version ladder.
|
|
9571
|
+
*/
|
|
9572
|
+
valtioVersion: string | null;
|
|
9573
|
+
/** Parsed major from `valtioVersion`, or `null` when absent/unparseable. */
|
|
9574
|
+
valtioMajorVersion: number | null;
|
|
9551
9575
|
/**
|
|
9552
9576
|
* `true` when the project or a workspace declares a Vite-based SSR runtime
|
|
9553
9577
|
* such as React Router's Node adapter, Vike, or vite-plugin-ssr.
|
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]="
|
|
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]="6aa1c6e1-8fcc-50d4-a076-3e864425bdc5")}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";
|
|
@@ -34121,6 +34121,10 @@ const listWorkspacePackages = (rootDirectory) => {
|
|
|
34121
34121
|
return packages;
|
|
34122
34122
|
};
|
|
34123
34123
|
const REANIMATED_DEPENDENCY_NAME = "react-native-reanimated";
|
|
34124
|
+
const MOBX_REACT_PACKAGE_NAME = "mobx-react";
|
|
34125
|
+
const MOBX_REACT_LITE_PACKAGE_NAME = "mobx-react-lite";
|
|
34126
|
+
const MOBX_STATE_TREE_PACKAGE_NAME = "mobx-state-tree";
|
|
34127
|
+
const MOBX_REACT_OBSERVER_PACKAGE_NAME = "mobx-react-observer";
|
|
34124
34128
|
const SHOPIFY_FLASH_LIST_PACKAGE_NAME = "@shopify/flash-list";
|
|
34125
34129
|
const resolveWorkspaceDependencyVersion = ({ concreteVersion, packageName, rootDirectory, rootPackageJson, sections, workspaceDirectory, workspacePackageJson }) => {
|
|
34126
34130
|
const dependencyDeclaration = getDependencyDeclaration({
|
|
@@ -34139,7 +34143,18 @@ const shouldReplaceReactVersion = (currentVersion, nextVersion) => {
|
|
|
34139
34143
|
if (nextMajor === null) return false;
|
|
34140
34144
|
return nextMajor < currentMajor;
|
|
34141
34145
|
};
|
|
34142
|
-
const
|
|
34146
|
+
const shouldReplaceSupportedDependencyFact = (currentFact, nextFact, latestSupportedMajor) => {
|
|
34147
|
+
if (currentFact.version === null) return true;
|
|
34148
|
+
if (nextFact.version === null) return false;
|
|
34149
|
+
const currentMajor = getLowestDependencyMajor(currentFact.version);
|
|
34150
|
+
const nextMajor = getLowestDependencyMajor(nextFact.version);
|
|
34151
|
+
if (currentMajor === null) return false;
|
|
34152
|
+
if (nextMajor === null) return true;
|
|
34153
|
+
if (currentMajor > latestSupportedMajor) return false;
|
|
34154
|
+
if (nextMajor > latestSupportedMajor) return true;
|
|
34155
|
+
return nextMajor < currentMajor;
|
|
34156
|
+
};
|
|
34157
|
+
const evaluateManifestFacts = (facts, packageJson, directory, rootDirectory, rootPackageJson) => {
|
|
34143
34158
|
if (facts.expo.version === null) {
|
|
34144
34159
|
const spec = getDependencySpec(packageJson, "expo");
|
|
34145
34160
|
if (spec !== null) facts.expo = {
|
|
@@ -34161,13 +34176,65 @@ const evaluateManifestFacts = (facts, packageJson, directory) => {
|
|
|
34161
34176
|
sourceDirectory: directory
|
|
34162
34177
|
};
|
|
34163
34178
|
}
|
|
34179
|
+
const mobxSpec = getDependencySpec(packageJson, "mobx");
|
|
34180
|
+
if (mobxSpec !== null) {
|
|
34181
|
+
const nextMobxFact = {
|
|
34182
|
+
version: resolveCatalogBackedDependencyVersion({
|
|
34183
|
+
rootDirectory: directory,
|
|
34184
|
+
rootPackageJson: packageJson,
|
|
34185
|
+
packageName: "mobx",
|
|
34186
|
+
version: mobxSpec
|
|
34187
|
+
}),
|
|
34188
|
+
sourceDirectory: directory
|
|
34189
|
+
};
|
|
34190
|
+
if (shouldReplaceSupportedDependencyFact(facts.mobx, nextMobxFact, 6)) facts.mobx = nextMobxFact;
|
|
34191
|
+
}
|
|
34192
|
+
facts.hasMobxReact = facts.hasMobxReact || getDependencySpec(packageJson, MOBX_REACT_PACKAGE_NAME) !== null;
|
|
34193
|
+
facts.hasMobxReactLite = facts.hasMobxReactLite || getDependencySpec(packageJson, MOBX_REACT_LITE_PACKAGE_NAME) !== null;
|
|
34194
|
+
facts.hasMobxStateTree = facts.hasMobxStateTree || getDependencySpec(packageJson, MOBX_STATE_TREE_PACKAGE_NAME) !== null;
|
|
34195
|
+
facts.hasMobxReactObserver = facts.hasMobxReactObserver || getDependencySpec(packageJson, MOBX_REACT_OBSERVER_PACKAGE_NAME) !== null;
|
|
34196
|
+
const zustandSpec = getDependencySpec(packageJson, "zustand");
|
|
34197
|
+
if (zustandSpec !== null) {
|
|
34198
|
+
const nextZustandFact = {
|
|
34199
|
+
version: resolveCatalogBackedDependencyVersion({
|
|
34200
|
+
rootDirectory: directory,
|
|
34201
|
+
rootPackageJson: packageJson,
|
|
34202
|
+
packageName: "zustand",
|
|
34203
|
+
version: zustandSpec
|
|
34204
|
+
}),
|
|
34205
|
+
sourceDirectory: directory
|
|
34206
|
+
};
|
|
34207
|
+
if (shouldReplaceSupportedDependencyFact(facts.zustand, nextZustandFact, 5)) facts.zustand = nextZustandFact;
|
|
34208
|
+
}
|
|
34164
34209
|
if (facts.reanimatedVersion === null) {
|
|
34165
34210
|
const spec = getDependencySpec(packageJson, REANIMATED_DEPENDENCY_NAME);
|
|
34166
34211
|
if (spec !== null) facts.reanimatedVersion = spec;
|
|
34167
34212
|
}
|
|
34213
|
+
if (facts.valtioVersion === null) {
|
|
34214
|
+
const spec = getDependencySpec(packageJson, "valtio");
|
|
34215
|
+
if (spec !== null) facts.valtioVersion = spec;
|
|
34216
|
+
}
|
|
34168
34217
|
facts.hasReactNativeAwarePackage = facts.hasReactNativeAwarePackage || isPackageJsonReactNativeAware(packageJson);
|
|
34169
34218
|
facts.hasReanimatedAwarePackage = facts.hasReanimatedAwarePackage || isPackageJsonReanimatedAware(packageJson);
|
|
34170
34219
|
facts.hasSsrDependency = facts.hasSsrDependency || isPackageJsonSsrAware(packageJson);
|
|
34220
|
+
const remotionSpec = getDependencySpec(packageJson, "remotion");
|
|
34221
|
+
if (remotionSpec !== null) {
|
|
34222
|
+
facts.hasRemotionDependency = true;
|
|
34223
|
+
const resolvedRemotionVersion = resolveCatalogBackedDependencyVersion({
|
|
34224
|
+
rootDirectory,
|
|
34225
|
+
rootPackageJson,
|
|
34226
|
+
packageName: "remotion",
|
|
34227
|
+
version: remotionSpec
|
|
34228
|
+
});
|
|
34229
|
+
const remotionMajorVersion = resolvedRemotionVersion === null ? null : getLowestDependencyMajor(resolvedRemotionVersion);
|
|
34230
|
+
if (remotionMajorVersion === null) {
|
|
34231
|
+
facts.hasUnknownRemotionVersion = true;
|
|
34232
|
+
facts.remotionVersion = null;
|
|
34233
|
+
} else if (!facts.hasUnknownRemotionVersion) {
|
|
34234
|
+
const currentRemotionMajorVersion = facts.remotionVersion === null ? null : getLowestDependencyMajor(facts.remotionVersion);
|
|
34235
|
+
if (currentRemotionMajorVersion === null || remotionMajorVersion < currentRemotionMajorVersion) facts.remotionVersion = resolvedRemotionVersion;
|
|
34236
|
+
}
|
|
34237
|
+
}
|
|
34171
34238
|
};
|
|
34172
34239
|
const collectWorkspaceFacts = (rootDirectory, rootPackageJson, { collectReactGroup }) => {
|
|
34173
34240
|
const facts = {
|
|
@@ -34187,12 +34254,28 @@ const collectWorkspaceFacts = (rootDirectory, rootPackageJson, { collectReactGro
|
|
|
34187
34254
|
version: null,
|
|
34188
34255
|
sourceDirectory: null
|
|
34189
34256
|
},
|
|
34257
|
+
valtioVersion: null,
|
|
34258
|
+
mobx: {
|
|
34259
|
+
version: null,
|
|
34260
|
+
sourceDirectory: null
|
|
34261
|
+
},
|
|
34262
|
+
hasMobxReact: false,
|
|
34263
|
+
hasMobxReactLite: false,
|
|
34264
|
+
hasMobxStateTree: false,
|
|
34265
|
+
hasMobxReactObserver: false,
|
|
34266
|
+
zustand: {
|
|
34267
|
+
version: null,
|
|
34268
|
+
sourceDirectory: null
|
|
34269
|
+
},
|
|
34190
34270
|
hasReactNativeAwarePackage: false,
|
|
34191
34271
|
hasReanimatedAwarePackage: false,
|
|
34192
34272
|
hasSsrDependency: false,
|
|
34273
|
+
hasRemotionDependency: false,
|
|
34274
|
+
hasUnknownRemotionVersion: false,
|
|
34275
|
+
remotionVersion: null,
|
|
34193
34276
|
reanimatedVersion: null
|
|
34194
34277
|
};
|
|
34195
|
-
evaluateManifestFacts(facts, rootPackageJson, rootDirectory);
|
|
34278
|
+
evaluateManifestFacts(facts, rootPackageJson, rootDirectory, rootDirectory, rootPackageJson);
|
|
34196
34279
|
let isReactGroupSettled = !collectReactGroup;
|
|
34197
34280
|
const visitedDirectories = /* @__PURE__ */ new Set();
|
|
34198
34281
|
for (const pattern of getWorkspacePatterns(rootDirectory, rootPackageJson)) {
|
|
@@ -34201,7 +34284,7 @@ const collectWorkspaceFacts = (rootDirectory, rootPackageJson, { collectReactGro
|
|
|
34201
34284
|
if (visitedDirectories.has(workspaceDirectory)) continue;
|
|
34202
34285
|
visitedDirectories.add(workspaceDirectory);
|
|
34203
34286
|
const workspacePackageJson = readPackageJson(Path.join(workspaceDirectory, "package.json"));
|
|
34204
|
-
evaluateManifestFacts(facts, workspacePackageJson, workspaceDirectory);
|
|
34287
|
+
evaluateManifestFacts(facts, workspacePackageJson, workspaceDirectory, rootDirectory, rootPackageJson);
|
|
34205
34288
|
const info = extractDependencyInfo(workspacePackageJson);
|
|
34206
34289
|
if (info.framework !== "unknown" && frameworkMergeRank(info.framework) < frameworkMergeRank(facts.framework)) facts.framework = info.framework;
|
|
34207
34290
|
if (isReactGroupSettled) continue;
|
|
@@ -34425,11 +34508,24 @@ const discoverProjectWithoutPackageJson = (directory) => {
|
|
|
34425
34508
|
tailwindVersion: null,
|
|
34426
34509
|
zodVersion: null,
|
|
34427
34510
|
zodMajorVersion: null,
|
|
34511
|
+
mobxVersion: null,
|
|
34512
|
+
mobxMajorVersion: null,
|
|
34513
|
+
hasMobxReact: false,
|
|
34514
|
+
hasMobxReactLite: false,
|
|
34515
|
+
hasMobxStateTree: false,
|
|
34516
|
+
hasMobxReactObserver: false,
|
|
34517
|
+
zustandVersion: null,
|
|
34518
|
+
zustandMajorVersion: null,
|
|
34428
34519
|
framework: "unknown",
|
|
34429
34520
|
hasTypeScript: hasOwnTsConfig,
|
|
34430
34521
|
hasReactCompiler: false,
|
|
34431
34522
|
hasReactCompilerLintPlugin: false,
|
|
34432
34523
|
hasTanStackQuery: false,
|
|
34524
|
+
valtioVersion: null,
|
|
34525
|
+
valtioMajorVersion: null,
|
|
34526
|
+
hasRemotion: false,
|
|
34527
|
+
remotionVersion: null,
|
|
34528
|
+
remotionMajorVersion: null,
|
|
34433
34529
|
hasSsrDependency: false,
|
|
34434
34530
|
preactVersion: null,
|
|
34435
34531
|
preactMajorVersion: null,
|
|
@@ -34528,6 +34624,12 @@ const discoverProject = (directory) => {
|
|
|
34528
34624
|
packageName: SHOPIFY_FLASH_LIST_PACKAGE_NAME,
|
|
34529
34625
|
version: workspaceFacts.shopifyFlashList.version
|
|
34530
34626
|
}) : null;
|
|
34627
|
+
const zustandVersion = resolveCatalogBackedDependencyVersion({
|
|
34628
|
+
rootDirectory: directory,
|
|
34629
|
+
rootPackageJson: packageJson,
|
|
34630
|
+
packageName: "zustand",
|
|
34631
|
+
version: workspaceFacts.zustand.version
|
|
34632
|
+
});
|
|
34531
34633
|
const hasReanimated = hasReactNativeWorkspace && workspaceFacts.hasReanimatedAwarePackage;
|
|
34532
34634
|
const reanimatedVersion = hasReanimated ? workspaceFacts.reanimatedVersion : null;
|
|
34533
34635
|
const nextjsVersion = framework === "nextjs" ? resolveCatalogBackedDependencyVersion({
|
|
@@ -34536,7 +34638,20 @@ const discoverProject = (directory) => {
|
|
|
34536
34638
|
packageName: "next",
|
|
34537
34639
|
version: workspaceFacts.next.version
|
|
34538
34640
|
}) : null;
|
|
34641
|
+
const valtioVersion = resolveCatalogBackedDependencyVersion({
|
|
34642
|
+
rootDirectory: directory,
|
|
34643
|
+
rootPackageJson: packageJson,
|
|
34644
|
+
packageName: "valtio",
|
|
34645
|
+
version: workspaceFacts.valtioVersion
|
|
34646
|
+
});
|
|
34647
|
+
const mobxVersion = resolveCatalogBackedDependencyVersion({
|
|
34648
|
+
rootDirectory: directory,
|
|
34649
|
+
rootPackageJson: packageJson,
|
|
34650
|
+
packageName: "mobx",
|
|
34651
|
+
version: workspaceFacts.mobx.version
|
|
34652
|
+
});
|
|
34539
34653
|
const preactVersion = getPreactVersion(packageJson);
|
|
34654
|
+
const remotionVersion = workspaceFacts.remotionVersion;
|
|
34540
34655
|
const isPreES2023Target = hasTypeScript && detectPreES2023Target(directory);
|
|
34541
34656
|
const projectInfo = {
|
|
34542
34657
|
rootDirectory: directory,
|
|
@@ -34546,11 +34661,24 @@ const discoverProject = (directory) => {
|
|
|
34546
34661
|
tailwindVersion,
|
|
34547
34662
|
zodVersion,
|
|
34548
34663
|
zodMajorVersion: zodVersion === null ? null : getLowestDependencyMajor(zodVersion),
|
|
34664
|
+
mobxVersion,
|
|
34665
|
+
mobxMajorVersion: mobxVersion === null ? null : getLowestDependencyMajor(mobxVersion),
|
|
34666
|
+
hasMobxReact: workspaceFacts.hasMobxReact,
|
|
34667
|
+
hasMobxReactLite: workspaceFacts.hasMobxReactLite,
|
|
34668
|
+
hasMobxStateTree: workspaceFacts.hasMobxStateTree,
|
|
34669
|
+
hasMobxReactObserver: workspaceFacts.hasMobxReactObserver,
|
|
34670
|
+
zustandVersion,
|
|
34671
|
+
zustandMajorVersion: zustandVersion === null ? null : getLowestDependencyMajor(zustandVersion),
|
|
34549
34672
|
framework,
|
|
34550
34673
|
hasTypeScript,
|
|
34551
34674
|
hasReactCompiler: detectReactCompiler(directory, packageJson),
|
|
34552
34675
|
hasReactCompilerLintPlugin: detectReactCompilerLintPlugin(directory, packageJson),
|
|
34553
34676
|
hasTanStackQuery: hasTanStackQuery(packageJson),
|
|
34677
|
+
valtioVersion,
|
|
34678
|
+
valtioMajorVersion: valtioVersion === null ? null : getLowestDependencyMajor(valtioVersion),
|
|
34679
|
+
hasRemotion: workspaceFacts.hasRemotionDependency,
|
|
34680
|
+
remotionVersion,
|
|
34681
|
+
remotionMajorVersion: remotionVersion === null ? null : getLowestDependencyMajor(remotionVersion),
|
|
34554
34682
|
hasSsrDependency: workspaceFacts.hasSsrDependency,
|
|
34555
34683
|
preactVersion,
|
|
34556
34684
|
preactMajorVersion: parseReactMajor(preactVersion),
|
|
@@ -37070,9 +37198,25 @@ const BABEL_CONFIG_FILE_NAMES = [
|
|
|
37070
37198
|
".babelrc.json"
|
|
37071
37199
|
];
|
|
37072
37200
|
const LEGACY_PRESET_SPEC = "module:metro-react-native-babel-preset";
|
|
37201
|
+
const LEGACY_PRESET_PACKAGE = "metro-react-native-babel-preset";
|
|
37202
|
+
const REACT_NATIVE_PACKAGE = "react-native";
|
|
37203
|
+
const PRESET_RENAME_MINIMUM_REACT_NATIVE_VERSION = "0.73.0";
|
|
37204
|
+
const LEGACY_PRESET_REFERENCE = new RegExp(`['"]${LEGACY_PRESET_SPEC}['"]`);
|
|
37073
37205
|
const MODERN_PRESET_REFERENCE = new RegExp(`['"]module:@react-native/babel-preset['"]`);
|
|
37074
37206
|
const ENABLE_BABEL_RUNTIME_VERSION = /enableBabelRuntime["']?\s*:\s*['"]/;
|
|
37207
|
+
const isReactNativeVersionAtLeastPresetRename = (rootDirectory, packageJson) => {
|
|
37208
|
+
const installedReactNativeManifestPath = Path.join(rootDirectory, "node_modules", REACT_NATIVE_PACKAGE, "package.json");
|
|
37209
|
+
const reactNativeVersionSpec = (isFile(installedReactNativeManifestPath) ? readPackageJson(installedReactNativeManifestPath).version : void 0) ?? getDependencySpec(packageJson, REACT_NATIVE_PACKAGE);
|
|
37210
|
+
if (reactNativeVersionSpec === null || reactNativeVersionSpec === void 0) return false;
|
|
37211
|
+
const normalizedVersionRange = import_semver.validRange(reactNativeVersionSpec);
|
|
37212
|
+
if (normalizedVersionRange === null) return false;
|
|
37213
|
+
const minimumVersion = import_semver.minVersion(normalizedVersionRange);
|
|
37214
|
+
return minimumVersion !== null && import_semver.gte(minimumVersion, PRESET_RENAME_MINIMUM_REACT_NATIVE_VERSION);
|
|
37215
|
+
};
|
|
37216
|
+
const canResolveLegacyPreset = (rootDirectory, packageJson) => getDependencySpec(packageJson, LEGACY_PRESET_PACKAGE) !== null || isFile(Path.join(rootDirectory, "node_modules", LEGACY_PRESET_PACKAGE, "package.json"));
|
|
37075
37217
|
const checkReactNativeMetroBabelPreset = (rootDirectory) => {
|
|
37218
|
+
const packageJson = readPackageJson(Path.join(rootDirectory, "package.json"));
|
|
37219
|
+
const shouldReportLegacyPreset = isReactNativeVersionAtLeastPresetRename(rootDirectory, packageJson) && !canResolveLegacyPreset(rootDirectory, packageJson);
|
|
37076
37220
|
for (const fileName of BABEL_CONFIG_FILE_NAMES) {
|
|
37077
37221
|
const filePath = Path.join(rootDirectory, fileName);
|
|
37078
37222
|
if (!isFile(filePath)) continue;
|
|
@@ -37082,7 +37226,7 @@ const checkReactNativeMetroBabelPreset = (rootDirectory) => {
|
|
|
37082
37226
|
} catch {
|
|
37083
37227
|
continue;
|
|
37084
37228
|
}
|
|
37085
|
-
if (
|
|
37229
|
+
if (shouldReportLegacyPreset && LEGACY_PRESET_REFERENCE.test(contents)) return [buildReactNativeDiagnostic({
|
|
37086
37230
|
filePath: fileName,
|
|
37087
37231
|
rule: "rn-no-metro-babel-preset",
|
|
37088
37232
|
severity: "error",
|
|
@@ -37105,12 +37249,6 @@ const checkReactNativeProject = (rootDirectory, project) => {
|
|
|
37105
37249
|
return [...checkReactNativeMetroBabelPreset(rootDirectory), ...checkReactNativeLibraryDependencies(rootDirectory)];
|
|
37106
37250
|
};
|
|
37107
37251
|
const RULE_KEY = "no-vulnerable-react-server-components";
|
|
37108
|
-
const DEPENDENCY_SECTIONS = [
|
|
37109
|
-
"dependencies",
|
|
37110
|
-
"devDependencies",
|
|
37111
|
-
"peerDependencies",
|
|
37112
|
-
"optionalDependencies"
|
|
37113
|
-
];
|
|
37114
37252
|
const REACT_RSC_ADVISORIES_BY_MINOR = {
|
|
37115
37253
|
"19.0": {
|
|
37116
37254
|
rceFixedVersion: "19.0.1",
|
|
@@ -37157,20 +37295,13 @@ const enumerateWorkspaceDirectories = (workspaceRoot) => {
|
|
|
37157
37295
|
for (const pattern of patterns) for (const directory of resolveWorkspaceDirectories(workspaceRoot, pattern)) directories.add(directory);
|
|
37158
37296
|
return [...directories];
|
|
37159
37297
|
};
|
|
37160
|
-
const readDeclaredSpec = (packageJson, packageName) => {
|
|
37161
|
-
for (const section of DEPENDENCY_SECTIONS) {
|
|
37162
|
-
const spec = packageJson[section]?.[packageName];
|
|
37163
|
-
if (typeof spec === "string") return spec;
|
|
37164
|
-
}
|
|
37165
|
-
return null;
|
|
37166
|
-
};
|
|
37167
37298
|
const resolveVersionInDirectory = (directory, packageName, declaredSpecOverride) => {
|
|
37168
37299
|
const manifestPath = Path.join(directory, "node_modules", packageName, "package.json");
|
|
37169
37300
|
if (isFile(manifestPath)) {
|
|
37170
37301
|
const installedVersion = import_semver.valid(readPackageJson(manifestPath).version ?? null);
|
|
37171
37302
|
if (installedVersion !== null) return installedVersion;
|
|
37172
37303
|
}
|
|
37173
|
-
const candidateSpecs = [
|
|
37304
|
+
const candidateSpecs = [getDependencySpec(readPackageJson(Path.join(directory, "package.json")), packageName), declaredSpecOverride];
|
|
37174
37305
|
for (const spec of candidateSpecs) {
|
|
37175
37306
|
const pinnedVersion = spec === null ? null : import_semver.valid(spec);
|
|
37176
37307
|
if (pinnedVersion !== null) return pinnedVersion;
|
|
@@ -37850,9 +37981,24 @@ const buildCapabilities = (project) => {
|
|
|
37850
37981
|
})) capabilities.add("tailwind:3.4");
|
|
37851
37982
|
if (project.zodVersion !== null) capabilities.add("zod");
|
|
37852
37983
|
if (project.zodMajorVersion !== null && project.zodMajorVersion >= 4) capabilities.add("zod:4");
|
|
37984
|
+
if (project.mobxVersion !== void 0 && project.mobxVersion !== null || project.hasMobxReact === true || project.hasMobxReactLite === true || project.hasMobxStateTree === true || project.hasMobxReactObserver === true) capabilities.add("mobx");
|
|
37985
|
+
if (project.hasMobxReact === true) capabilities.add("mobx-react");
|
|
37986
|
+
if (project.hasMobxReactLite === true) capabilities.add("mobx-react-lite");
|
|
37987
|
+
if (project.hasMobxReact === true || project.hasMobxReactLite === true) capabilities.add("mobx-react-binding");
|
|
37988
|
+
if (project.hasMobxStateTree === true) capabilities.add("mobx-state-tree");
|
|
37989
|
+
if (project.hasMobxReactObserver === true) capabilities.add("mobx-react-observer");
|
|
37990
|
+
if (project.mobxMajorVersion !== void 0 && project.mobxMajorVersion !== null && project.mobxMajorVersion >= 4 && project.mobxMajorVersion <= 6) addMajorLadder(capabilities, "mobx", project.mobxMajorVersion, 4, 6);
|
|
37991
|
+
if (project.zustandVersion !== void 0 && project.zustandVersion !== null) capabilities.add("zustand");
|
|
37992
|
+
if (project.zustandMajorVersion !== void 0 && project.zustandMajorVersion !== null && project.zustandMajorVersion >= 1 && project.zustandMajorVersion <= 5) addMajorLadder(capabilities, "zustand", project.zustandMajorVersion, 1, 5);
|
|
37853
37993
|
if (project.isPreES2023Target) capabilities.add("pre-es2023");
|
|
37854
37994
|
if (project.hasReactCompiler) capabilities.add("react-compiler");
|
|
37855
37995
|
if (project.hasTanStackQuery) capabilities.add("tanstack-query");
|
|
37996
|
+
if (project.valtioVersion !== null) capabilities.add("valtio");
|
|
37997
|
+
addMajorLadder(capabilities, "valtio", project.valtioMajorVersion, 1, 10);
|
|
37998
|
+
if (project.hasRemotion) {
|
|
37999
|
+
capabilities.add("remotion");
|
|
38000
|
+
addMajorLadder(capabilities, "remotion", project.remotionMajorVersion ?? null, 4, 30);
|
|
38001
|
+
}
|
|
37856
38002
|
if (project.hasTypeScript) capabilities.add("typescript");
|
|
37857
38003
|
if (project.preactVersion !== null) capabilities.add("preact");
|
|
37858
38004
|
addMajorLadder(capabilities, "preact", project.preactMajorVersion, 10, 20);
|
|
@@ -43836,4 +43982,4 @@ const toJsonReport = (result, options) => buildJsonReport({
|
|
|
43836
43982
|
export { AmbiguousProjectError, NoReactDependencyError, NotADirectoryError, PackageJsonNotFoundError, ProjectNotFoundError, ReactDoctorError, buildJsonReport, buildJsonReportError, clearCaches, defineConfig, diagnose, filterSourceFiles, getDiffInfo, hasReactRuntime, isProjectDiscoveryError, isReactDoctorError, summarizeDiagnostics, toJsonReport };
|
|
43837
43983
|
|
|
43838
43984
|
//# sourceMappingURL=index.js.map
|
|
43839
|
-
//# debugId=
|
|
43985
|
+
//# debugId=6aa1c6e1-8fcc-50d4-a076-3e864425bdc5
|
package/dist/lsp.js
CHANGED
|
@@ -34173,6 +34173,10 @@ const listWorkspacePackages = (rootDirectory) => {
|
|
|
34173
34173
|
return packages;
|
|
34174
34174
|
};
|
|
34175
34175
|
const REANIMATED_DEPENDENCY_NAME = "react-native-reanimated";
|
|
34176
|
+
const MOBX_REACT_PACKAGE_NAME = "mobx-react";
|
|
34177
|
+
const MOBX_REACT_LITE_PACKAGE_NAME = "mobx-react-lite";
|
|
34178
|
+
const MOBX_STATE_TREE_PACKAGE_NAME = "mobx-state-tree";
|
|
34179
|
+
const MOBX_REACT_OBSERVER_PACKAGE_NAME = "mobx-react-observer";
|
|
34176
34180
|
const SHOPIFY_FLASH_LIST_PACKAGE_NAME = "@shopify/flash-list";
|
|
34177
34181
|
const resolveWorkspaceDependencyVersion = ({ concreteVersion, packageName, rootDirectory, rootPackageJson, sections, workspaceDirectory, workspacePackageJson }) => {
|
|
34178
34182
|
const dependencyDeclaration = getDependencyDeclaration({
|
|
@@ -34191,7 +34195,18 @@ const shouldReplaceReactVersion = (currentVersion, nextVersion) => {
|
|
|
34191
34195
|
if (nextMajor === null) return false;
|
|
34192
34196
|
return nextMajor < currentMajor;
|
|
34193
34197
|
};
|
|
34194
|
-
const
|
|
34198
|
+
const shouldReplaceSupportedDependencyFact = (currentFact, nextFact, latestSupportedMajor) => {
|
|
34199
|
+
if (currentFact.version === null) return true;
|
|
34200
|
+
if (nextFact.version === null) return false;
|
|
34201
|
+
const currentMajor = getLowestDependencyMajor(currentFact.version);
|
|
34202
|
+
const nextMajor = getLowestDependencyMajor(nextFact.version);
|
|
34203
|
+
if (currentMajor === null) return false;
|
|
34204
|
+
if (nextMajor === null) return true;
|
|
34205
|
+
if (currentMajor > latestSupportedMajor) return false;
|
|
34206
|
+
if (nextMajor > latestSupportedMajor) return true;
|
|
34207
|
+
return nextMajor < currentMajor;
|
|
34208
|
+
};
|
|
34209
|
+
const evaluateManifestFacts = (facts, packageJson, directory, rootDirectory, rootPackageJson) => {
|
|
34195
34210
|
if (facts.expo.version === null) {
|
|
34196
34211
|
const spec = getDependencySpec(packageJson, "expo");
|
|
34197
34212
|
if (spec !== null) facts.expo = {
|
|
@@ -34213,13 +34228,65 @@ const evaluateManifestFacts = (facts, packageJson, directory) => {
|
|
|
34213
34228
|
sourceDirectory: directory
|
|
34214
34229
|
};
|
|
34215
34230
|
}
|
|
34231
|
+
const mobxSpec = getDependencySpec(packageJson, "mobx");
|
|
34232
|
+
if (mobxSpec !== null) {
|
|
34233
|
+
const nextMobxFact = {
|
|
34234
|
+
version: resolveCatalogBackedDependencyVersion({
|
|
34235
|
+
rootDirectory: directory,
|
|
34236
|
+
rootPackageJson: packageJson,
|
|
34237
|
+
packageName: "mobx",
|
|
34238
|
+
version: mobxSpec
|
|
34239
|
+
}),
|
|
34240
|
+
sourceDirectory: directory
|
|
34241
|
+
};
|
|
34242
|
+
if (shouldReplaceSupportedDependencyFact(facts.mobx, nextMobxFact, 6)) facts.mobx = nextMobxFact;
|
|
34243
|
+
}
|
|
34244
|
+
facts.hasMobxReact = facts.hasMobxReact || getDependencySpec(packageJson, MOBX_REACT_PACKAGE_NAME) !== null;
|
|
34245
|
+
facts.hasMobxReactLite = facts.hasMobxReactLite || getDependencySpec(packageJson, MOBX_REACT_LITE_PACKAGE_NAME) !== null;
|
|
34246
|
+
facts.hasMobxStateTree = facts.hasMobxStateTree || getDependencySpec(packageJson, MOBX_STATE_TREE_PACKAGE_NAME) !== null;
|
|
34247
|
+
facts.hasMobxReactObserver = facts.hasMobxReactObserver || getDependencySpec(packageJson, MOBX_REACT_OBSERVER_PACKAGE_NAME) !== null;
|
|
34248
|
+
const zustandSpec = getDependencySpec(packageJson, "zustand");
|
|
34249
|
+
if (zustandSpec !== null) {
|
|
34250
|
+
const nextZustandFact = {
|
|
34251
|
+
version: resolveCatalogBackedDependencyVersion({
|
|
34252
|
+
rootDirectory: directory,
|
|
34253
|
+
rootPackageJson: packageJson,
|
|
34254
|
+
packageName: "zustand",
|
|
34255
|
+
version: zustandSpec
|
|
34256
|
+
}),
|
|
34257
|
+
sourceDirectory: directory
|
|
34258
|
+
};
|
|
34259
|
+
if (shouldReplaceSupportedDependencyFact(facts.zustand, nextZustandFact, 5)) facts.zustand = nextZustandFact;
|
|
34260
|
+
}
|
|
34216
34261
|
if (facts.reanimatedVersion === null) {
|
|
34217
34262
|
const spec = getDependencySpec(packageJson, REANIMATED_DEPENDENCY_NAME);
|
|
34218
34263
|
if (spec !== null) facts.reanimatedVersion = spec;
|
|
34219
34264
|
}
|
|
34265
|
+
if (facts.valtioVersion === null) {
|
|
34266
|
+
const spec = getDependencySpec(packageJson, "valtio");
|
|
34267
|
+
if (spec !== null) facts.valtioVersion = spec;
|
|
34268
|
+
}
|
|
34220
34269
|
facts.hasReactNativeAwarePackage = facts.hasReactNativeAwarePackage || isPackageJsonReactNativeAware(packageJson);
|
|
34221
34270
|
facts.hasReanimatedAwarePackage = facts.hasReanimatedAwarePackage || isPackageJsonReanimatedAware(packageJson);
|
|
34222
34271
|
facts.hasSsrDependency = facts.hasSsrDependency || isPackageJsonSsrAware(packageJson);
|
|
34272
|
+
const remotionSpec = getDependencySpec(packageJson, "remotion");
|
|
34273
|
+
if (remotionSpec !== null) {
|
|
34274
|
+
facts.hasRemotionDependency = true;
|
|
34275
|
+
const resolvedRemotionVersion = resolveCatalogBackedDependencyVersion({
|
|
34276
|
+
rootDirectory,
|
|
34277
|
+
rootPackageJson,
|
|
34278
|
+
packageName: "remotion",
|
|
34279
|
+
version: remotionSpec
|
|
34280
|
+
});
|
|
34281
|
+
const remotionMajorVersion = resolvedRemotionVersion === null ? null : getLowestDependencyMajor(resolvedRemotionVersion);
|
|
34282
|
+
if (remotionMajorVersion === null) {
|
|
34283
|
+
facts.hasUnknownRemotionVersion = true;
|
|
34284
|
+
facts.remotionVersion = null;
|
|
34285
|
+
} else if (!facts.hasUnknownRemotionVersion) {
|
|
34286
|
+
const currentRemotionMajorVersion = facts.remotionVersion === null ? null : getLowestDependencyMajor(facts.remotionVersion);
|
|
34287
|
+
if (currentRemotionMajorVersion === null || remotionMajorVersion < currentRemotionMajorVersion) facts.remotionVersion = resolvedRemotionVersion;
|
|
34288
|
+
}
|
|
34289
|
+
}
|
|
34223
34290
|
};
|
|
34224
34291
|
const collectWorkspaceFacts = (rootDirectory, rootPackageJson, { collectReactGroup }) => {
|
|
34225
34292
|
const facts = {
|
|
@@ -34239,12 +34306,28 @@ const collectWorkspaceFacts = (rootDirectory, rootPackageJson, { collectReactGro
|
|
|
34239
34306
|
version: null,
|
|
34240
34307
|
sourceDirectory: null
|
|
34241
34308
|
},
|
|
34309
|
+
valtioVersion: null,
|
|
34310
|
+
mobx: {
|
|
34311
|
+
version: null,
|
|
34312
|
+
sourceDirectory: null
|
|
34313
|
+
},
|
|
34314
|
+
hasMobxReact: false,
|
|
34315
|
+
hasMobxReactLite: false,
|
|
34316
|
+
hasMobxStateTree: false,
|
|
34317
|
+
hasMobxReactObserver: false,
|
|
34318
|
+
zustand: {
|
|
34319
|
+
version: null,
|
|
34320
|
+
sourceDirectory: null
|
|
34321
|
+
},
|
|
34242
34322
|
hasReactNativeAwarePackage: false,
|
|
34243
34323
|
hasReanimatedAwarePackage: false,
|
|
34244
34324
|
hasSsrDependency: false,
|
|
34325
|
+
hasRemotionDependency: false,
|
|
34326
|
+
hasUnknownRemotionVersion: false,
|
|
34327
|
+
remotionVersion: null,
|
|
34245
34328
|
reanimatedVersion: null
|
|
34246
34329
|
};
|
|
34247
|
-
evaluateManifestFacts(facts, rootPackageJson, rootDirectory);
|
|
34330
|
+
evaluateManifestFacts(facts, rootPackageJson, rootDirectory, rootDirectory, rootPackageJson);
|
|
34248
34331
|
let isReactGroupSettled = !collectReactGroup;
|
|
34249
34332
|
const visitedDirectories = /* @__PURE__ */ new Set();
|
|
34250
34333
|
for (const pattern of getWorkspacePatterns(rootDirectory, rootPackageJson)) {
|
|
@@ -34253,7 +34336,7 @@ const collectWorkspaceFacts = (rootDirectory, rootPackageJson, { collectReactGro
|
|
|
34253
34336
|
if (visitedDirectories.has(workspaceDirectory)) continue;
|
|
34254
34337
|
visitedDirectories.add(workspaceDirectory);
|
|
34255
34338
|
const workspacePackageJson = readPackageJson(Path.join(workspaceDirectory, "package.json"));
|
|
34256
|
-
evaluateManifestFacts(facts, workspacePackageJson, workspaceDirectory);
|
|
34339
|
+
evaluateManifestFacts(facts, workspacePackageJson, workspaceDirectory, rootDirectory, rootPackageJson);
|
|
34257
34340
|
const info = extractDependencyInfo(workspacePackageJson);
|
|
34258
34341
|
if (info.framework !== "unknown" && frameworkMergeRank(info.framework) < frameworkMergeRank(facts.framework)) facts.framework = info.framework;
|
|
34259
34342
|
if (isReactGroupSettled) continue;
|
|
@@ -34477,11 +34560,24 @@ const discoverProjectWithoutPackageJson = (directory) => {
|
|
|
34477
34560
|
tailwindVersion: null,
|
|
34478
34561
|
zodVersion: null,
|
|
34479
34562
|
zodMajorVersion: null,
|
|
34563
|
+
mobxVersion: null,
|
|
34564
|
+
mobxMajorVersion: null,
|
|
34565
|
+
hasMobxReact: false,
|
|
34566
|
+
hasMobxReactLite: false,
|
|
34567
|
+
hasMobxStateTree: false,
|
|
34568
|
+
hasMobxReactObserver: false,
|
|
34569
|
+
zustandVersion: null,
|
|
34570
|
+
zustandMajorVersion: null,
|
|
34480
34571
|
framework: "unknown",
|
|
34481
34572
|
hasTypeScript: hasOwnTsConfig,
|
|
34482
34573
|
hasReactCompiler: false,
|
|
34483
34574
|
hasReactCompilerLintPlugin: false,
|
|
34484
34575
|
hasTanStackQuery: false,
|
|
34576
|
+
valtioVersion: null,
|
|
34577
|
+
valtioMajorVersion: null,
|
|
34578
|
+
hasRemotion: false,
|
|
34579
|
+
remotionVersion: null,
|
|
34580
|
+
remotionMajorVersion: null,
|
|
34485
34581
|
hasSsrDependency: false,
|
|
34486
34582
|
preactVersion: null,
|
|
34487
34583
|
preactMajorVersion: null,
|
|
@@ -34580,6 +34676,12 @@ const discoverProject = (directory) => {
|
|
|
34580
34676
|
packageName: SHOPIFY_FLASH_LIST_PACKAGE_NAME,
|
|
34581
34677
|
version: workspaceFacts.shopifyFlashList.version
|
|
34582
34678
|
}) : null;
|
|
34679
|
+
const zustandVersion = resolveCatalogBackedDependencyVersion({
|
|
34680
|
+
rootDirectory: directory,
|
|
34681
|
+
rootPackageJson: packageJson,
|
|
34682
|
+
packageName: "zustand",
|
|
34683
|
+
version: workspaceFacts.zustand.version
|
|
34684
|
+
});
|
|
34583
34685
|
const hasReanimated = hasReactNativeWorkspace && workspaceFacts.hasReanimatedAwarePackage;
|
|
34584
34686
|
const reanimatedVersion = hasReanimated ? workspaceFacts.reanimatedVersion : null;
|
|
34585
34687
|
const nextjsVersion = framework === "nextjs" ? resolveCatalogBackedDependencyVersion({
|
|
@@ -34588,7 +34690,20 @@ const discoverProject = (directory) => {
|
|
|
34588
34690
|
packageName: "next",
|
|
34589
34691
|
version: workspaceFacts.next.version
|
|
34590
34692
|
}) : null;
|
|
34693
|
+
const valtioVersion = resolveCatalogBackedDependencyVersion({
|
|
34694
|
+
rootDirectory: directory,
|
|
34695
|
+
rootPackageJson: packageJson,
|
|
34696
|
+
packageName: "valtio",
|
|
34697
|
+
version: workspaceFacts.valtioVersion
|
|
34698
|
+
});
|
|
34699
|
+
const mobxVersion = resolveCatalogBackedDependencyVersion({
|
|
34700
|
+
rootDirectory: directory,
|
|
34701
|
+
rootPackageJson: packageJson,
|
|
34702
|
+
packageName: "mobx",
|
|
34703
|
+
version: workspaceFacts.mobx.version
|
|
34704
|
+
});
|
|
34591
34705
|
const preactVersion = getPreactVersion(packageJson);
|
|
34706
|
+
const remotionVersion = workspaceFacts.remotionVersion;
|
|
34592
34707
|
const isPreES2023Target = hasTypeScript && detectPreES2023Target(directory);
|
|
34593
34708
|
const projectInfo = {
|
|
34594
34709
|
rootDirectory: directory,
|
|
@@ -34598,11 +34713,24 @@ const discoverProject = (directory) => {
|
|
|
34598
34713
|
tailwindVersion,
|
|
34599
34714
|
zodVersion,
|
|
34600
34715
|
zodMajorVersion: zodVersion === null ? null : getLowestDependencyMajor(zodVersion),
|
|
34716
|
+
mobxVersion,
|
|
34717
|
+
mobxMajorVersion: mobxVersion === null ? null : getLowestDependencyMajor(mobxVersion),
|
|
34718
|
+
hasMobxReact: workspaceFacts.hasMobxReact,
|
|
34719
|
+
hasMobxReactLite: workspaceFacts.hasMobxReactLite,
|
|
34720
|
+
hasMobxStateTree: workspaceFacts.hasMobxStateTree,
|
|
34721
|
+
hasMobxReactObserver: workspaceFacts.hasMobxReactObserver,
|
|
34722
|
+
zustandVersion,
|
|
34723
|
+
zustandMajorVersion: zustandVersion === null ? null : getLowestDependencyMajor(zustandVersion),
|
|
34601
34724
|
framework,
|
|
34602
34725
|
hasTypeScript,
|
|
34603
34726
|
hasReactCompiler: detectReactCompiler(directory, packageJson),
|
|
34604
34727
|
hasReactCompilerLintPlugin: detectReactCompilerLintPlugin(directory, packageJson),
|
|
34605
34728
|
hasTanStackQuery: hasTanStackQuery(packageJson),
|
|
34729
|
+
valtioVersion,
|
|
34730
|
+
valtioMajorVersion: valtioVersion === null ? null : getLowestDependencyMajor(valtioVersion),
|
|
34731
|
+
hasRemotion: workspaceFacts.hasRemotionDependency,
|
|
34732
|
+
remotionVersion,
|
|
34733
|
+
remotionMajorVersion: remotionVersion === null ? null : getLowestDependencyMajor(remotionVersion),
|
|
34606
34734
|
hasSsrDependency: workspaceFacts.hasSsrDependency,
|
|
34607
34735
|
preactVersion,
|
|
34608
34736
|
preactMajorVersion: parseReactMajor(preactVersion),
|
|
@@ -37048,9 +37176,25 @@ const BABEL_CONFIG_FILE_NAMES = [
|
|
|
37048
37176
|
".babelrc.json"
|
|
37049
37177
|
];
|
|
37050
37178
|
const LEGACY_PRESET_SPEC = "module:metro-react-native-babel-preset";
|
|
37179
|
+
const LEGACY_PRESET_PACKAGE = "metro-react-native-babel-preset";
|
|
37180
|
+
const REACT_NATIVE_PACKAGE = "react-native";
|
|
37181
|
+
const PRESET_RENAME_MINIMUM_REACT_NATIVE_VERSION = "0.73.0";
|
|
37182
|
+
const LEGACY_PRESET_REFERENCE = new RegExp(`['"]${LEGACY_PRESET_SPEC}['"]`);
|
|
37051
37183
|
const MODERN_PRESET_REFERENCE = new RegExp(`['"]module:@react-native/babel-preset['"]`);
|
|
37052
37184
|
const ENABLE_BABEL_RUNTIME_VERSION = /enableBabelRuntime["']?\s*:\s*['"]/;
|
|
37185
|
+
const isReactNativeVersionAtLeastPresetRename = (rootDirectory, packageJson) => {
|
|
37186
|
+
const installedReactNativeManifestPath = Path.join(rootDirectory, "node_modules", REACT_NATIVE_PACKAGE, "package.json");
|
|
37187
|
+
const reactNativeVersionSpec = (isFile(installedReactNativeManifestPath) ? readPackageJson(installedReactNativeManifestPath).version : void 0) ?? getDependencySpec(packageJson, REACT_NATIVE_PACKAGE);
|
|
37188
|
+
if (reactNativeVersionSpec === null || reactNativeVersionSpec === void 0) return false;
|
|
37189
|
+
const normalizedVersionRange = import_semver.validRange(reactNativeVersionSpec);
|
|
37190
|
+
if (normalizedVersionRange === null) return false;
|
|
37191
|
+
const minimumVersion = import_semver.minVersion(normalizedVersionRange);
|
|
37192
|
+
return minimumVersion !== null && import_semver.gte(minimumVersion, PRESET_RENAME_MINIMUM_REACT_NATIVE_VERSION);
|
|
37193
|
+
};
|
|
37194
|
+
const canResolveLegacyPreset = (rootDirectory, packageJson) => getDependencySpec(packageJson, LEGACY_PRESET_PACKAGE) !== null || isFile(Path.join(rootDirectory, "node_modules", LEGACY_PRESET_PACKAGE, "package.json"));
|
|
37053
37195
|
const checkReactNativeMetroBabelPreset = (rootDirectory) => {
|
|
37196
|
+
const packageJson = readPackageJson(Path.join(rootDirectory, "package.json"));
|
|
37197
|
+
const shouldReportLegacyPreset = isReactNativeVersionAtLeastPresetRename(rootDirectory, packageJson) && !canResolveLegacyPreset(rootDirectory, packageJson);
|
|
37054
37198
|
for (const fileName of BABEL_CONFIG_FILE_NAMES) {
|
|
37055
37199
|
const filePath = Path.join(rootDirectory, fileName);
|
|
37056
37200
|
if (!isFile(filePath)) continue;
|
|
@@ -37060,7 +37204,7 @@ const checkReactNativeMetroBabelPreset = (rootDirectory) => {
|
|
|
37060
37204
|
} catch {
|
|
37061
37205
|
continue;
|
|
37062
37206
|
}
|
|
37063
|
-
if (
|
|
37207
|
+
if (shouldReportLegacyPreset && LEGACY_PRESET_REFERENCE.test(contents)) return [buildReactNativeDiagnostic({
|
|
37064
37208
|
filePath: fileName,
|
|
37065
37209
|
rule: "rn-no-metro-babel-preset",
|
|
37066
37210
|
severity: "error",
|
|
@@ -37083,12 +37227,6 @@ const checkReactNativeProject = (rootDirectory, project) => {
|
|
|
37083
37227
|
return [...checkReactNativeMetroBabelPreset(rootDirectory), ...checkReactNativeLibraryDependencies(rootDirectory)];
|
|
37084
37228
|
};
|
|
37085
37229
|
const RULE_KEY = "no-vulnerable-react-server-components";
|
|
37086
|
-
const DEPENDENCY_SECTIONS = [
|
|
37087
|
-
"dependencies",
|
|
37088
|
-
"devDependencies",
|
|
37089
|
-
"peerDependencies",
|
|
37090
|
-
"optionalDependencies"
|
|
37091
|
-
];
|
|
37092
37230
|
const REACT_RSC_ADVISORIES_BY_MINOR = {
|
|
37093
37231
|
"19.0": {
|
|
37094
37232
|
rceFixedVersion: "19.0.1",
|
|
@@ -37135,20 +37273,13 @@ const enumerateWorkspaceDirectories = (workspaceRoot) => {
|
|
|
37135
37273
|
for (const pattern of patterns) for (const directory of resolveWorkspaceDirectories(workspaceRoot, pattern)) directories.add(directory);
|
|
37136
37274
|
return [...directories];
|
|
37137
37275
|
};
|
|
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
|
-
};
|
|
37145
37276
|
const resolveVersionInDirectory = (directory, packageName, declaredSpecOverride) => {
|
|
37146
37277
|
const manifestPath = Path.join(directory, "node_modules", packageName, "package.json");
|
|
37147
37278
|
if (isFile(manifestPath)) {
|
|
37148
37279
|
const installedVersion = import_semver.valid(readPackageJson(manifestPath).version ?? null);
|
|
37149
37280
|
if (installedVersion !== null) return installedVersion;
|
|
37150
37281
|
}
|
|
37151
|
-
const candidateSpecs = [
|
|
37282
|
+
const candidateSpecs = [getDependencySpec(readPackageJson(Path.join(directory, "package.json")), packageName), declaredSpecOverride];
|
|
37152
37283
|
for (const spec of candidateSpecs) {
|
|
37153
37284
|
const pinnedVersion = spec === null ? null : import_semver.valid(spec);
|
|
37154
37285
|
if (pinnedVersion !== null) return pinnedVersion;
|
|
@@ -37828,9 +37959,24 @@ const buildCapabilities = (project) => {
|
|
|
37828
37959
|
})) capabilities.add("tailwind:3.4");
|
|
37829
37960
|
if (project.zodVersion !== null) capabilities.add("zod");
|
|
37830
37961
|
if (project.zodMajorVersion !== null && project.zodMajorVersion >= 4) capabilities.add("zod:4");
|
|
37962
|
+
if (project.mobxVersion !== void 0 && project.mobxVersion !== null || project.hasMobxReact === true || project.hasMobxReactLite === true || project.hasMobxStateTree === true || project.hasMobxReactObserver === true) capabilities.add("mobx");
|
|
37963
|
+
if (project.hasMobxReact === true) capabilities.add("mobx-react");
|
|
37964
|
+
if (project.hasMobxReactLite === true) capabilities.add("mobx-react-lite");
|
|
37965
|
+
if (project.hasMobxReact === true || project.hasMobxReactLite === true) capabilities.add("mobx-react-binding");
|
|
37966
|
+
if (project.hasMobxStateTree === true) capabilities.add("mobx-state-tree");
|
|
37967
|
+
if (project.hasMobxReactObserver === true) capabilities.add("mobx-react-observer");
|
|
37968
|
+
if (project.mobxMajorVersion !== void 0 && project.mobxMajorVersion !== null && project.mobxMajorVersion >= 4 && project.mobxMajorVersion <= 6) addMajorLadder(capabilities, "mobx", project.mobxMajorVersion, 4, 6);
|
|
37969
|
+
if (project.zustandVersion !== void 0 && project.zustandVersion !== null) capabilities.add("zustand");
|
|
37970
|
+
if (project.zustandMajorVersion !== void 0 && project.zustandMajorVersion !== null && project.zustandMajorVersion >= 1 && project.zustandMajorVersion <= 5) addMajorLadder(capabilities, "zustand", project.zustandMajorVersion, 1, 5);
|
|
37831
37971
|
if (project.isPreES2023Target) capabilities.add("pre-es2023");
|
|
37832
37972
|
if (project.hasReactCompiler) capabilities.add("react-compiler");
|
|
37833
37973
|
if (project.hasTanStackQuery) capabilities.add("tanstack-query");
|
|
37974
|
+
if (project.valtioVersion !== null) capabilities.add("valtio");
|
|
37975
|
+
addMajorLadder(capabilities, "valtio", project.valtioMajorVersion, 1, 10);
|
|
37976
|
+
if (project.hasRemotion) {
|
|
37977
|
+
capabilities.add("remotion");
|
|
37978
|
+
addMajorLadder(capabilities, "remotion", project.remotionMajorVersion ?? null, 4, 30);
|
|
37979
|
+
}
|
|
37834
37980
|
if (project.hasTypeScript) capabilities.add("typescript");
|
|
37835
37981
|
if (project.preactVersion !== null) capabilities.add("preact");
|
|
37836
37982
|
addMajorLadder(capabilities, "preact", project.preactMajorVersion, 10, 20);
|
|
@@ -45456,5 +45602,5 @@ const startLanguageServer = () => {
|
|
|
45456
45602
|
};
|
|
45457
45603
|
//#endregion
|
|
45458
45604
|
export { startLanguageServer };
|
|
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]="
|
|
45460
|
-
//# debugId=
|
|
45605
|
+
!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]="f2369b82-a22a-50e5-b71b-2ceb30eaee9f")}catch(e){}}();
|
|
45606
|
+
//# debugId=f2369b82-a22a-50e5-b71b-2ceb30eaee9f
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "react-doctor",
|
|
3
|
-
"version": "0.8.1-dev.
|
|
3
|
+
"version": "0.8.1-dev.7eca0ee",
|
|
4
4
|
"description": "Your agent writes bad React. This catches it",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"accessibility",
|
|
@@ -65,8 +65,8 @@
|
|
|
65
65
|
"vscode-languageserver-textdocument": "^1.0.12",
|
|
66
66
|
"vscode-uri": "^3.1.0",
|
|
67
67
|
"yaml": "^2.9.0",
|
|
68
|
-
"
|
|
69
|
-
"
|
|
68
|
+
"deslop-js": "0.8.1",
|
|
69
|
+
"oxlint-plugin-react-doctor": "0.8.1-dev.7eca0ee"
|
|
70
70
|
},
|
|
71
71
|
"devDependencies": {
|
|
72
72
|
"@types/babel__code-frame": "^7.27.0",
|
|
@@ -75,8 +75,8 @@
|
|
|
75
75
|
"commander": "^14.0.3",
|
|
76
76
|
"ora": "^9.4.0",
|
|
77
77
|
"@react-doctor/api": "0.8.1",
|
|
78
|
-
"@react-doctor/
|
|
79
|
-
"@react-doctor/
|
|
78
|
+
"@react-doctor/language-server": "0.8.1",
|
|
79
|
+
"@react-doctor/core": "0.8.1"
|
|
80
80
|
},
|
|
81
81
|
"engines": {
|
|
82
82
|
"node": "^20.19.0 || >=22.13.0"
|