react-doctor 0.8.1-dev.af33723 → 0.8.1-dev.b852961
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/README.md +4 -14
- package/dist/cli.js +141 -549
- package/dist/index.d.ts +0 -29
- package/dist/index.js +97 -458
- package/dist/lsp.js +97 -458
- package/dist/skills/react-doctor/SKILL.md +0 -5
- package/package.json +4 -4
package/dist/lsp.js
CHANGED
|
@@ -32883,6 +32883,44 @@ var AmbiguousProjectError = class extends Error {
|
|
|
32883
32883
|
}
|
|
32884
32884
|
};
|
|
32885
32885
|
const isProjectDiscoveryError = (value) => value instanceof ProjectNotFoundError || value instanceof NoReactDependencyError || value instanceof PackageJsonNotFoundError || value instanceof NotADirectoryError || value instanceof AmbiguousProjectError;
|
|
32886
|
+
const isErrnoException = (error) => error instanceof Error && "code" in error;
|
|
32887
|
+
const IGNORABLE_READDIR_ERROR_CODES = new Set([
|
|
32888
|
+
"EACCES",
|
|
32889
|
+
"EPERM",
|
|
32890
|
+
"ENOENT",
|
|
32891
|
+
"ENOTDIR",
|
|
32892
|
+
"EINVAL",
|
|
32893
|
+
"ELOOP",
|
|
32894
|
+
"ENAMETOOLONG"
|
|
32895
|
+
]);
|
|
32896
|
+
const isIgnorableReaddirError = (error) => isErrnoException(error) && typeof error.code === "string" && IGNORABLE_READDIR_ERROR_CODES.has(error.code);
|
|
32897
|
+
const readDirectoryEntries = (directoryPath) => {
|
|
32898
|
+
try {
|
|
32899
|
+
return NFS.readdirSync(directoryPath, { withFileTypes: true });
|
|
32900
|
+
} catch (error) {
|
|
32901
|
+
if (isIgnorableReaddirError(error)) return [];
|
|
32902
|
+
throw error;
|
|
32903
|
+
}
|
|
32904
|
+
};
|
|
32905
|
+
const isFile = (filePath) => {
|
|
32906
|
+
try {
|
|
32907
|
+
return NFS.statSync(filePath).isFile();
|
|
32908
|
+
} catch {
|
|
32909
|
+
return false;
|
|
32910
|
+
}
|
|
32911
|
+
};
|
|
32912
|
+
const isDirectory = (directoryPath) => {
|
|
32913
|
+
try {
|
|
32914
|
+
return NFS.statSync(directoryPath).isDirectory();
|
|
32915
|
+
} catch {
|
|
32916
|
+
return false;
|
|
32917
|
+
}
|
|
32918
|
+
};
|
|
32919
|
+
const isPlainObject = (value) => {
|
|
32920
|
+
if (typeof value !== "object" || value === null || Array.isArray(value)) return false;
|
|
32921
|
+
const prototype = Object.getPrototypeOf(value);
|
|
32922
|
+
return prototype === null || prototype === Object.prototype;
|
|
32923
|
+
};
|
|
32886
32924
|
const SOURCE_FILE_PATTERN = /\.(tsx?|jsx?|mts|mjs)$/;
|
|
32887
32925
|
const GENERATED_BUNDLE_FILE_PATTERN = /\.(iife|umd|global|min)\.m?js$/i;
|
|
32888
32926
|
const GENERATED_SOURCE_DIRECTORY_PATTERN = /(?:^|\/)__generated__\//;
|
|
@@ -33064,44 +33102,6 @@ const SUPPLY_CHAIN_OVERLAP_TIMEOUT_MS = 9e4;
|
|
|
33064
33102
|
const SUPPLY_CHAIN_CACHE_TTL_MS = 864e5;
|
|
33065
33103
|
const SUPPLY_CHAIN_CACHE_SUBDIR = "supply-chain";
|
|
33066
33104
|
const SUPPLY_CHAIN_IGNORED_PACKAGES = new Set(["next"]);
|
|
33067
|
-
const isErrnoException = (error) => error instanceof Error && "code" in error;
|
|
33068
|
-
const IGNORABLE_READDIR_ERROR_CODES = new Set([
|
|
33069
|
-
"EACCES",
|
|
33070
|
-
"EPERM",
|
|
33071
|
-
"ENOENT",
|
|
33072
|
-
"ENOTDIR",
|
|
33073
|
-
"EINVAL",
|
|
33074
|
-
"ELOOP",
|
|
33075
|
-
"ENAMETOOLONG"
|
|
33076
|
-
]);
|
|
33077
|
-
const isIgnorableReaddirError = (error) => isErrnoException(error) && typeof error.code === "string" && IGNORABLE_READDIR_ERROR_CODES.has(error.code);
|
|
33078
|
-
const readDirectoryEntries = (directoryPath) => {
|
|
33079
|
-
try {
|
|
33080
|
-
return NFS.readdirSync(directoryPath, { withFileTypes: true });
|
|
33081
|
-
} catch (error) {
|
|
33082
|
-
if (isIgnorableReaddirError(error)) return [];
|
|
33083
|
-
throw error;
|
|
33084
|
-
}
|
|
33085
|
-
};
|
|
33086
|
-
const isFile = (filePath) => {
|
|
33087
|
-
try {
|
|
33088
|
-
return NFS.statSync(filePath).isFile();
|
|
33089
|
-
} catch {
|
|
33090
|
-
return false;
|
|
33091
|
-
}
|
|
33092
|
-
};
|
|
33093
|
-
const isDirectory = (directoryPath) => {
|
|
33094
|
-
try {
|
|
33095
|
-
return NFS.statSync(directoryPath).isDirectory();
|
|
33096
|
-
} catch {
|
|
33097
|
-
return false;
|
|
33098
|
-
}
|
|
33099
|
-
};
|
|
33100
|
-
const isPlainObject = (value) => {
|
|
33101
|
-
if (typeof value !== "object" || value === null || Array.isArray(value)) return false;
|
|
33102
|
-
const prototype = Object.getPrototypeOf(value);
|
|
33103
|
-
return prototype === null || prototype === Object.prototype;
|
|
33104
|
-
};
|
|
33105
33105
|
const lastSourceMappingUrl = (fileContent) => {
|
|
33106
33106
|
const lastReference = [...fileContent.matchAll(/\/\/# sourceMappingURL=(\S+)/g)].at(-1);
|
|
33107
33107
|
return lastReference ? lastReference[1] : null;
|
|
@@ -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|
|
|
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
|
};
|
|
@@ -33675,16 +33651,6 @@ const getLowestDependencyMajor = (version) => {
|
|
|
33675
33651
|
}
|
|
33676
33652
|
return lowestMajor;
|
|
33677
33653
|
};
|
|
33678
|
-
const getDependencyMajorWithinSupportedRange = (version, latestSupportedMajor) => {
|
|
33679
|
-
const normalizedVersion = normalizeDependencyVersion(version);
|
|
33680
|
-
if (normalizedVersion === null) return null;
|
|
33681
|
-
const validRange = import_semver.validRange(normalizedVersion);
|
|
33682
|
-
if (validRange === null) return null;
|
|
33683
|
-
const minimumVersion = import_semver.minVersion(validRange);
|
|
33684
|
-
if (minimumVersion === null || minimumVersion.major > latestSupportedMajor) return null;
|
|
33685
|
-
if (import_semver.intersects(validRange, `>=${latestSupportedMajor + 1}.0.0`)) return null;
|
|
33686
|
-
return minimumVersion.major;
|
|
33687
|
-
};
|
|
33688
33654
|
const isConcreteDependencyVersion = (version) => {
|
|
33689
33655
|
const normalizedVersion = normalizeDependencyVersion(version);
|
|
33690
33656
|
return normalizedVersion !== null && /\d/.test(normalizedVersion);
|
|
@@ -33728,9 +33694,9 @@ const parseReactMajorMinor = (reactVersion) => {
|
|
|
33728
33694
|
};
|
|
33729
33695
|
};
|
|
33730
33696
|
const parseLowerBoundVersion = (versionSpec) => import_semver.validRange(versionSpec) !== null ? import_semver.minVersion(versionSpec) : import_semver.coerce(versionSpec);
|
|
33731
|
-
const
|
|
33732
|
-
if (typeof
|
|
33733
|
-
const trimmed =
|
|
33697
|
+
const parseTailwindMajorMinor = (tailwindVersion) => {
|
|
33698
|
+
if (typeof tailwindVersion !== "string") return null;
|
|
33699
|
+
const trimmed = tailwindVersion.trim();
|
|
33734
33700
|
if (trimmed.length === 0) return null;
|
|
33735
33701
|
const lowerBound = parseLowerBoundVersion(trimmed);
|
|
33736
33702
|
if (lowerBound === null || lowerBound.major <= 0) return null;
|
|
@@ -33739,7 +33705,6 @@ const parseDependencyMajorMinor = (dependencyVersion) => {
|
|
|
33739
33705
|
minor: lowerBound.minor
|
|
33740
33706
|
};
|
|
33741
33707
|
};
|
|
33742
|
-
const parseTailwindMajorMinor = (tailwindVersion) => parseDependencyMajorMinor(tailwindVersion);
|
|
33743
33708
|
const hasUpperBoundOnlyPeerRange = (range) => {
|
|
33744
33709
|
if (typeof range !== "string") return false;
|
|
33745
33710
|
const normalizedRange = normalizeDependencyVersion(range);
|
|
@@ -33992,6 +33957,19 @@ const getPreactVersion = (packageJson) => {
|
|
|
33992
33957
|
...packageJson.devDependencies
|
|
33993
33958
|
}.preact ?? null;
|
|
33994
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
|
+
};
|
|
33995
33973
|
const resolveCatalogBackedDependencyVersion = ({ rootDirectory, rootPackageJson, packageName, version }) => {
|
|
33996
33974
|
if (version === null || !isCatalogReference(version)) return version;
|
|
33997
33975
|
const catalogName = extractCatalogName(version);
|
|
@@ -34194,60 +34172,7 @@ const listWorkspacePackages = (rootDirectory) => {
|
|
|
34194
34172
|
}
|
|
34195
34173
|
return packages;
|
|
34196
34174
|
};
|
|
34197
|
-
const getPreferredDependencyVersion = ({ packageJson, packageNames }) => {
|
|
34198
|
-
const allDependencies = {
|
|
34199
|
-
...packageJson.devDependencies,
|
|
34200
|
-
...packageJson.peerDependencies,
|
|
34201
|
-
...packageJson.dependencies
|
|
34202
|
-
};
|
|
34203
|
-
for (const packageName of packageNames) {
|
|
34204
|
-
const version = allDependencies[packageName];
|
|
34205
|
-
if (version !== void 0) return version;
|
|
34206
|
-
}
|
|
34207
|
-
return null;
|
|
34208
|
-
};
|
|
34209
|
-
const TANSTACK_REACT_QUERY_PACKAGES = ["@tanstack/react-query", "react-query"];
|
|
34210
|
-
const getTanStackQueryVersion = (packageJson) => {
|
|
34211
|
-
return getPreferredDependencyVersion({
|
|
34212
|
-
packageJson,
|
|
34213
|
-
packageNames: TANSTACK_REACT_QUERY_PACKAGES
|
|
34214
|
-
});
|
|
34215
|
-
};
|
|
34216
|
-
const STYLED_COMPONENTS_PACKAGES = ["styled-components"];
|
|
34217
|
-
const getStyledComponentsVersion = (packageJson) => {
|
|
34218
|
-
return getPreferredDependencyVersion({
|
|
34219
|
-
packageJson,
|
|
34220
|
-
packageNames: STYLED_COMPONENTS_PACKAGES
|
|
34221
|
-
});
|
|
34222
|
-
};
|
|
34223
|
-
const I18N_PACKAGES = [
|
|
34224
|
-
"i18next",
|
|
34225
|
-
"react-i18next",
|
|
34226
|
-
"next-i18next",
|
|
34227
|
-
"react-intl",
|
|
34228
|
-
"next-intl",
|
|
34229
|
-
"use-intl",
|
|
34230
|
-
"@formatjs/intl",
|
|
34231
|
-
"@lingui/core",
|
|
34232
|
-
"@lingui/react",
|
|
34233
|
-
"typesafe-i18n",
|
|
34234
|
-
"@tolgee/react",
|
|
34235
|
-
"react-intl-universal"
|
|
34236
|
-
];
|
|
34237
|
-
const hasI18nDependency = (packageJson) => {
|
|
34238
|
-
const allDependencies = {
|
|
34239
|
-
...packageJson.peerDependencies,
|
|
34240
|
-
...packageJson.dependencies,
|
|
34241
|
-
...packageJson.devDependencies,
|
|
34242
|
-
...packageJson.optionalDependencies
|
|
34243
|
-
};
|
|
34244
|
-
return I18N_PACKAGES.some((packageName) => allDependencies[packageName] !== void 0);
|
|
34245
|
-
};
|
|
34246
34175
|
const REANIMATED_DEPENDENCY_NAME = "react-native-reanimated";
|
|
34247
|
-
const MOBX_REACT_PACKAGE_NAME = "mobx-react";
|
|
34248
|
-
const MOBX_REACT_LITE_PACKAGE_NAME = "mobx-react-lite";
|
|
34249
|
-
const MOBX_STATE_TREE_PACKAGE_NAME = "mobx-state-tree";
|
|
34250
|
-
const MOBX_REACT_OBSERVER_PACKAGE_NAME = "mobx-react-observer";
|
|
34251
34176
|
const SHOPIFY_FLASH_LIST_PACKAGE_NAME = "@shopify/flash-list";
|
|
34252
34177
|
const resolveWorkspaceDependencyVersion = ({ concreteVersion, packageName, rootDirectory, rootPackageJson, sections, workspaceDirectory, workspacePackageJson }) => {
|
|
34253
34178
|
const dependencyDeclaration = getDependencyDeclaration({
|
|
@@ -34266,62 +34191,7 @@ const shouldReplaceReactVersion = (currentVersion, nextVersion) => {
|
|
|
34266
34191
|
if (nextMajor === null) return false;
|
|
34267
34192
|
return nextMajor < currentMajor;
|
|
34268
34193
|
};
|
|
34269
|
-
const
|
|
34270
|
-
if (currentFact.version === null) return true;
|
|
34271
|
-
if (nextFact.version === null) return false;
|
|
34272
|
-
const currentMajor = getLowestDependencyMajor(currentFact.version);
|
|
34273
|
-
const nextMajor = getLowestDependencyMajor(nextFact.version);
|
|
34274
|
-
if (currentMajor === null) return false;
|
|
34275
|
-
if (nextMajor === null) return true;
|
|
34276
|
-
if (currentMajor > latestSupportedMajor) return false;
|
|
34277
|
-
if (nextMajor > latestSupportedMajor) return true;
|
|
34278
|
-
return nextMajor < currentMajor;
|
|
34279
|
-
};
|
|
34280
|
-
const shouldReplaceStyledComponentsVersion = (currentVersion, nextVersion) => {
|
|
34281
|
-
if (!currentVersion) return true;
|
|
34282
|
-
const currentMajor = getLowestDependencyMajor(currentVersion);
|
|
34283
|
-
const nextMajor = getLowestDependencyMajor(nextVersion);
|
|
34284
|
-
if (currentMajor === null) return nextMajor !== null && nextMajor < 6;
|
|
34285
|
-
if (nextMajor === null) return currentMajor >= 6;
|
|
34286
|
-
return nextMajor < currentMajor;
|
|
34287
|
-
};
|
|
34288
|
-
const selectOldestDependencyVersion = (currentVersion, nextVersion) => {
|
|
34289
|
-
if (currentVersion === null || nextVersion === null) return null;
|
|
34290
|
-
const current = parseDependencyMajorMinor(currentVersion);
|
|
34291
|
-
const next = parseDependencyMajorMinor(nextVersion);
|
|
34292
|
-
if (current === null) return currentVersion;
|
|
34293
|
-
if (next === null) return nextVersion;
|
|
34294
|
-
if (next.major !== current.major) return next.major < current.major ? nextVersion : currentVersion;
|
|
34295
|
-
return next.minor < current.minor ? nextVersion : currentVersion;
|
|
34296
|
-
};
|
|
34297
|
-
const shouldReplaceMobxFact = (currentFact, nextFact) => {
|
|
34298
|
-
if (currentFact.sourceDirectory === null) return true;
|
|
34299
|
-
if (currentFact.version === null) return false;
|
|
34300
|
-
if (nextFact.version === null) return true;
|
|
34301
|
-
const currentMajor = getDependencyMajorWithinSupportedRange(currentFact.version, 6);
|
|
34302
|
-
const nextMajor = getDependencyMajorWithinSupportedRange(nextFact.version, 6);
|
|
34303
|
-
if (currentMajor === null) return false;
|
|
34304
|
-
if (nextMajor === null) return true;
|
|
34305
|
-
return selectOldestDependencyVersion(currentFact.version, nextFact.version) === nextFact.version;
|
|
34306
|
-
};
|
|
34307
|
-
const collectBindingVersion = (facts, packageJson, directory, packageName) => {
|
|
34308
|
-
const version = getDependencySpec(packageJson, packageName);
|
|
34309
|
-
if (version === null) return;
|
|
34310
|
-
const resolvedVersion = resolveCatalogBackedDependencyVersion({
|
|
34311
|
-
rootDirectory: directory,
|
|
34312
|
-
rootPackageJson: packageJson,
|
|
34313
|
-
packageName,
|
|
34314
|
-
version
|
|
34315
|
-
});
|
|
34316
|
-
if (packageName === MOBX_REACT_PACKAGE_NAME) {
|
|
34317
|
-
facts.mobxReactVersion = facts.hasMobxReact ? selectOldestDependencyVersion(facts.mobxReactVersion, resolvedVersion) : resolvedVersion;
|
|
34318
|
-
facts.hasMobxReact = true;
|
|
34319
|
-
return;
|
|
34320
|
-
}
|
|
34321
|
-
facts.mobxReactLiteVersion = facts.hasMobxReactLite ? selectOldestDependencyVersion(facts.mobxReactLiteVersion, resolvedVersion) : resolvedVersion;
|
|
34322
|
-
facts.hasMobxReactLite = true;
|
|
34323
|
-
};
|
|
34324
|
-
const evaluateManifestFacts = (facts, packageJson, directory, rootDirectory, rootPackageJson) => {
|
|
34194
|
+
const evaluateManifestFacts = (facts, packageJson, directory) => {
|
|
34325
34195
|
if (facts.expo.version === null) {
|
|
34326
34196
|
const spec = getDependencySpec(packageJson, "expo");
|
|
34327
34197
|
if (spec !== null) facts.expo = {
|
|
@@ -34343,74 +34213,13 @@ const evaluateManifestFacts = (facts, packageJson, directory, rootDirectory, roo
|
|
|
34343
34213
|
sourceDirectory: directory
|
|
34344
34214
|
};
|
|
34345
34215
|
}
|
|
34346
|
-
const mobxSpec = getDependencySpec(packageJson, "mobx");
|
|
34347
|
-
if (mobxSpec !== null) {
|
|
34348
|
-
const nextMobxFact = {
|
|
34349
|
-
version: resolveCatalogBackedDependencyVersion({
|
|
34350
|
-
rootDirectory: directory,
|
|
34351
|
-
rootPackageJson: packageJson,
|
|
34352
|
-
packageName: "mobx",
|
|
34353
|
-
version: mobxSpec
|
|
34354
|
-
}),
|
|
34355
|
-
sourceDirectory: directory
|
|
34356
|
-
};
|
|
34357
|
-
if (shouldReplaceMobxFact(facts.mobx, nextMobxFact)) facts.mobx = nextMobxFact;
|
|
34358
|
-
}
|
|
34359
|
-
collectBindingVersion(facts, packageJson, directory, MOBX_REACT_PACKAGE_NAME);
|
|
34360
|
-
collectBindingVersion(facts, packageJson, directory, MOBX_REACT_LITE_PACKAGE_NAME);
|
|
34361
|
-
facts.hasMobxStateTree = facts.hasMobxStateTree || getDependencySpec(packageJson, MOBX_STATE_TREE_PACKAGE_NAME) !== null;
|
|
34362
|
-
facts.hasMobxReactObserver = facts.hasMobxReactObserver || getDependencySpec(packageJson, MOBX_REACT_OBSERVER_PACKAGE_NAME) !== null;
|
|
34363
|
-
const zustandSpec = getDependencySpec(packageJson, "zustand");
|
|
34364
|
-
if (zustandSpec !== null) {
|
|
34365
|
-
const nextZustandFact = {
|
|
34366
|
-
version: resolveCatalogBackedDependencyVersion({
|
|
34367
|
-
rootDirectory: directory,
|
|
34368
|
-
rootPackageJson: packageJson,
|
|
34369
|
-
packageName: "zustand",
|
|
34370
|
-
version: zustandSpec
|
|
34371
|
-
}),
|
|
34372
|
-
sourceDirectory: directory
|
|
34373
|
-
};
|
|
34374
|
-
if (shouldReplaceSupportedDependencyFact(facts.zustand, nextZustandFact, 5)) facts.zustand = nextZustandFact;
|
|
34375
|
-
}
|
|
34376
34216
|
if (facts.reanimatedVersion === null) {
|
|
34377
34217
|
const spec = getDependencySpec(packageJson, REANIMATED_DEPENDENCY_NAME);
|
|
34378
34218
|
if (spec !== null) facts.reanimatedVersion = spec;
|
|
34379
34219
|
}
|
|
34380
|
-
if (facts.valtioVersion === null) {
|
|
34381
|
-
const spec = getDependencySpec(packageJson, "valtio");
|
|
34382
|
-
if (spec !== null) facts.valtioVersion = spec;
|
|
34383
|
-
}
|
|
34384
|
-
facts.tanstackQueryVersion ??= getTanStackQueryVersion(packageJson);
|
|
34385
|
-
const styledComponentsVersion = resolveCatalogBackedDependencyVersion({
|
|
34386
|
-
rootDirectory: directory,
|
|
34387
|
-
rootPackageJson: packageJson,
|
|
34388
|
-
packageName: "styled-components",
|
|
34389
|
-
version: getStyledComponentsVersion(packageJson)
|
|
34390
|
-
});
|
|
34391
|
-
if (styledComponentsVersion && shouldReplaceStyledComponentsVersion(facts.styledComponentsVersion, styledComponentsVersion)) facts.styledComponentsVersion = styledComponentsVersion;
|
|
34392
|
-
facts.hasI18nLibrary = facts.hasI18nLibrary || hasI18nDependency(packageJson);
|
|
34393
34220
|
facts.hasReactNativeAwarePackage = facts.hasReactNativeAwarePackage || isPackageJsonReactNativeAware(packageJson);
|
|
34394
34221
|
facts.hasReanimatedAwarePackage = facts.hasReanimatedAwarePackage || isPackageJsonReanimatedAware(packageJson);
|
|
34395
34222
|
facts.hasSsrDependency = facts.hasSsrDependency || isPackageJsonSsrAware(packageJson);
|
|
34396
|
-
const remotionSpec = getDependencySpec(packageJson, "remotion");
|
|
34397
|
-
if (remotionSpec !== null) {
|
|
34398
|
-
facts.hasRemotionDependency = true;
|
|
34399
|
-
const resolvedRemotionVersion = resolveCatalogBackedDependencyVersion({
|
|
34400
|
-
rootDirectory,
|
|
34401
|
-
rootPackageJson,
|
|
34402
|
-
packageName: "remotion",
|
|
34403
|
-
version: remotionSpec
|
|
34404
|
-
});
|
|
34405
|
-
const remotionMajorVersion = resolvedRemotionVersion === null ? null : getLowestDependencyMajor(resolvedRemotionVersion);
|
|
34406
|
-
if (remotionMajorVersion === null) {
|
|
34407
|
-
facts.hasUnknownRemotionVersion = true;
|
|
34408
|
-
facts.remotionVersion = null;
|
|
34409
|
-
} else if (!facts.hasUnknownRemotionVersion) {
|
|
34410
|
-
const currentRemotionMajorVersion = facts.remotionVersion === null ? null : getLowestDependencyMajor(facts.remotionVersion);
|
|
34411
|
-
if (currentRemotionMajorVersion === null || remotionMajorVersion < currentRemotionMajorVersion) facts.remotionVersion = resolvedRemotionVersion;
|
|
34412
|
-
}
|
|
34413
|
-
}
|
|
34414
34223
|
};
|
|
34415
34224
|
const collectWorkspaceFacts = (rootDirectory, rootPackageJson, { collectReactGroup }) => {
|
|
34416
34225
|
const facts = {
|
|
@@ -34430,33 +34239,12 @@ const collectWorkspaceFacts = (rootDirectory, rootPackageJson, { collectReactGro
|
|
|
34430
34239
|
version: null,
|
|
34431
34240
|
sourceDirectory: null
|
|
34432
34241
|
},
|
|
34433
|
-
valtioVersion: null,
|
|
34434
|
-
mobx: {
|
|
34435
|
-
version: null,
|
|
34436
|
-
sourceDirectory: null
|
|
34437
|
-
},
|
|
34438
|
-
hasMobxReact: false,
|
|
34439
|
-
mobxReactVersion: null,
|
|
34440
|
-
hasMobxReactLite: false,
|
|
34441
|
-
mobxReactLiteVersion: null,
|
|
34442
|
-
hasMobxStateTree: false,
|
|
34443
|
-
hasMobxReactObserver: false,
|
|
34444
|
-
zustand: {
|
|
34445
|
-
version: null,
|
|
34446
|
-
sourceDirectory: null
|
|
34447
|
-
},
|
|
34448
|
-
tanstackQueryVersion: null,
|
|
34449
|
-
styledComponentsVersion: null,
|
|
34450
|
-
hasI18nLibrary: false,
|
|
34451
34242
|
hasReactNativeAwarePackage: false,
|
|
34452
34243
|
hasReanimatedAwarePackage: false,
|
|
34453
34244
|
hasSsrDependency: false,
|
|
34454
|
-
hasRemotionDependency: false,
|
|
34455
|
-
hasUnknownRemotionVersion: false,
|
|
34456
|
-
remotionVersion: null,
|
|
34457
34245
|
reanimatedVersion: null
|
|
34458
34246
|
};
|
|
34459
|
-
evaluateManifestFacts(facts, rootPackageJson, rootDirectory
|
|
34247
|
+
evaluateManifestFacts(facts, rootPackageJson, rootDirectory);
|
|
34460
34248
|
let isReactGroupSettled = !collectReactGroup;
|
|
34461
34249
|
const visitedDirectories = /* @__PURE__ */ new Set();
|
|
34462
34250
|
for (const pattern of getWorkspacePatterns(rootDirectory, rootPackageJson)) {
|
|
@@ -34465,7 +34253,7 @@ const collectWorkspaceFacts = (rootDirectory, rootPackageJson, { collectReactGro
|
|
|
34465
34253
|
if (visitedDirectories.has(workspaceDirectory)) continue;
|
|
34466
34254
|
visitedDirectories.add(workspaceDirectory);
|
|
34467
34255
|
const workspacePackageJson = readPackageJson(Path.join(workspaceDirectory, "package.json"));
|
|
34468
|
-
evaluateManifestFacts(facts, workspacePackageJson, workspaceDirectory
|
|
34256
|
+
evaluateManifestFacts(facts, workspacePackageJson, workspaceDirectory);
|
|
34469
34257
|
const info = extractDependencyInfo(workspacePackageJson);
|
|
34470
34258
|
if (info.framework !== "unknown" && frameworkMergeRank(info.framework) < frameworkMergeRank(facts.framework)) facts.framework = info.framework;
|
|
34471
34259
|
if (isReactGroupSettled) continue;
|
|
@@ -34689,29 +34477,11 @@ const discoverProjectWithoutPackageJson = (directory) => {
|
|
|
34689
34477
|
tailwindVersion: null,
|
|
34690
34478
|
zodVersion: null,
|
|
34691
34479
|
zodMajorVersion: null,
|
|
34692
|
-
mobxVersion: null,
|
|
34693
|
-
mobxMajorVersion: null,
|
|
34694
|
-
hasMobxReact: false,
|
|
34695
|
-
mobxReactVersion: null,
|
|
34696
|
-
hasMobxReactLite: false,
|
|
34697
|
-
mobxReactLiteVersion: null,
|
|
34698
|
-
hasMobxStateTree: false,
|
|
34699
|
-
hasMobxReactObserver: false,
|
|
34700
|
-
zustandVersion: null,
|
|
34701
|
-
zustandMajorVersion: null,
|
|
34702
34480
|
framework: "unknown",
|
|
34703
34481
|
hasTypeScript: hasOwnTsConfig,
|
|
34704
34482
|
hasReactCompiler: false,
|
|
34705
34483
|
hasReactCompilerLintPlugin: false,
|
|
34706
34484
|
hasTanStackQuery: false,
|
|
34707
|
-
valtioVersion: null,
|
|
34708
|
-
valtioMajorVersion: null,
|
|
34709
|
-
hasRemotion: false,
|
|
34710
|
-
remotionVersion: null,
|
|
34711
|
-
remotionMajorVersion: null,
|
|
34712
|
-
hasI18nLibrary: false,
|
|
34713
|
-
tanstackQueryVersion: null,
|
|
34714
|
-
styledComponentsVersion: null,
|
|
34715
34485
|
hasSsrDependency: false,
|
|
34716
34486
|
preactVersion: null,
|
|
34717
34487
|
preactMajorVersion: null,
|
|
@@ -34810,12 +34580,6 @@ const discoverProject = (directory) => {
|
|
|
34810
34580
|
packageName: SHOPIFY_FLASH_LIST_PACKAGE_NAME,
|
|
34811
34581
|
version: workspaceFacts.shopifyFlashList.version
|
|
34812
34582
|
}) : null;
|
|
34813
|
-
const zustandVersion = resolveCatalogBackedDependencyVersion({
|
|
34814
|
-
rootDirectory: directory,
|
|
34815
|
-
rootPackageJson: packageJson,
|
|
34816
|
-
packageName: "zustand",
|
|
34817
|
-
version: workspaceFacts.zustand.version
|
|
34818
|
-
});
|
|
34819
34583
|
const hasReanimated = hasReactNativeWorkspace && workspaceFacts.hasReanimatedAwarePackage;
|
|
34820
34584
|
const reanimatedVersion = hasReanimated ? workspaceFacts.reanimatedVersion : null;
|
|
34821
34585
|
const nextjsVersion = framework === "nextjs" ? resolveCatalogBackedDependencyVersion({
|
|
@@ -34824,21 +34588,7 @@ const discoverProject = (directory) => {
|
|
|
34824
34588
|
packageName: "next",
|
|
34825
34589
|
version: workspaceFacts.next.version
|
|
34826
34590
|
}) : null;
|
|
34827
|
-
const valtioVersion = resolveCatalogBackedDependencyVersion({
|
|
34828
|
-
rootDirectory: directory,
|
|
34829
|
-
rootPackageJson: packageJson,
|
|
34830
|
-
packageName: "valtio",
|
|
34831
|
-
version: workspaceFacts.valtioVersion
|
|
34832
|
-
});
|
|
34833
|
-
const mobxVersion = resolveCatalogBackedDependencyVersion({
|
|
34834
|
-
rootDirectory: directory,
|
|
34835
|
-
rootPackageJson: packageJson,
|
|
34836
|
-
packageName: "mobx",
|
|
34837
|
-
version: workspaceFacts.mobx.version
|
|
34838
|
-
});
|
|
34839
34591
|
const preactVersion = getPreactVersion(packageJson);
|
|
34840
|
-
const remotionVersion = workspaceFacts.remotionVersion;
|
|
34841
|
-
const tanstackQueryVersion = getTanStackQueryVersion(packageJson) ?? workspaceFacts.tanstackQueryVersion;
|
|
34842
34592
|
const isPreES2023Target = hasTypeScript && detectPreES2023Target(directory);
|
|
34843
34593
|
const projectInfo = {
|
|
34844
34594
|
rootDirectory: directory,
|
|
@@ -34848,29 +34598,11 @@ const discoverProject = (directory) => {
|
|
|
34848
34598
|
tailwindVersion,
|
|
34849
34599
|
zodVersion,
|
|
34850
34600
|
zodMajorVersion: zodVersion === null ? null : getLowestDependencyMajor(zodVersion),
|
|
34851
|
-
mobxVersion,
|
|
34852
|
-
mobxMajorVersion: mobxVersion === null ? null : getDependencyMajorWithinSupportedRange(mobxVersion, 6),
|
|
34853
|
-
hasMobxReact: workspaceFacts.hasMobxReact,
|
|
34854
|
-
mobxReactVersion: workspaceFacts.mobxReactVersion,
|
|
34855
|
-
hasMobxReactLite: workspaceFacts.hasMobxReactLite,
|
|
34856
|
-
mobxReactLiteVersion: workspaceFacts.mobxReactLiteVersion,
|
|
34857
|
-
hasMobxStateTree: workspaceFacts.hasMobxStateTree,
|
|
34858
|
-
hasMobxReactObserver: workspaceFacts.hasMobxReactObserver,
|
|
34859
|
-
zustandVersion,
|
|
34860
|
-
zustandMajorVersion: zustandVersion === null ? null : getLowestDependencyMajor(zustandVersion),
|
|
34861
34601
|
framework,
|
|
34862
34602
|
hasTypeScript,
|
|
34863
34603
|
hasReactCompiler: detectReactCompiler(directory, packageJson),
|
|
34864
34604
|
hasReactCompilerLintPlugin: detectReactCompilerLintPlugin(directory, packageJson),
|
|
34865
|
-
hasTanStackQuery:
|
|
34866
|
-
hasI18nLibrary: workspaceFacts.hasI18nLibrary,
|
|
34867
|
-
tanstackQueryVersion,
|
|
34868
|
-
styledComponentsVersion: workspaceFacts.styledComponentsVersion,
|
|
34869
|
-
valtioVersion,
|
|
34870
|
-
valtioMajorVersion: valtioVersion === null ? null : getLowestDependencyMajor(valtioVersion),
|
|
34871
|
-
hasRemotion: workspaceFacts.hasRemotionDependency,
|
|
34872
|
-
remotionVersion,
|
|
34873
|
-
remotionMajorVersion: remotionVersion === null ? null : getLowestDependencyMajor(remotionVersion),
|
|
34605
|
+
hasTanStackQuery: hasTanStackQuery(packageJson),
|
|
34874
34606
|
hasSsrDependency: workspaceFacts.hasSsrDependency,
|
|
34875
34607
|
preactVersion,
|
|
34876
34608
|
preactMajorVersion: parseReactMajor(preactVersion),
|
|
@@ -35104,6 +34836,7 @@ const LEGACY_RULE_KEY_TO_NATIVE_RULE_KEY = {
|
|
|
35104
34836
|
"react/jsx-no-new-function-as-prop": "react-doctor/jsx-no-new-function-as-prop",
|
|
35105
34837
|
"react/jsx-no-new-object-as-prop": "react-doctor/jsx-no-new-object-as-prop",
|
|
35106
34838
|
"react/jsx-no-script-url": "react-doctor/jsx-no-script-url",
|
|
34839
|
+
"react/jsx-no-target-blank": "react-doctor/jsx-no-target-blank",
|
|
35107
34840
|
"react/jsx-no-undef": "react-doctor/jsx-no-undef",
|
|
35108
34841
|
"react/jsx-no-useless-fragment": "react-doctor/jsx-no-useless-fragment",
|
|
35109
34842
|
"react/jsx-pascal-case": "react-doctor/jsx-pascal-case",
|
|
@@ -37316,25 +37049,9 @@ const BABEL_CONFIG_FILE_NAMES = [
|
|
|
37316
37049
|
".babelrc.json"
|
|
37317
37050
|
];
|
|
37318
37051
|
const LEGACY_PRESET_SPEC = "module:metro-react-native-babel-preset";
|
|
37319
|
-
const LEGACY_PRESET_PACKAGE = "metro-react-native-babel-preset";
|
|
37320
|
-
const REACT_NATIVE_PACKAGE = "react-native";
|
|
37321
|
-
const PRESET_RENAME_MINIMUM_REACT_NATIVE_VERSION = "0.73.0";
|
|
37322
|
-
const LEGACY_PRESET_REFERENCE = new RegExp(`['"]${LEGACY_PRESET_SPEC}['"]`);
|
|
37323
37052
|
const MODERN_PRESET_REFERENCE = new RegExp(`['"]module:@react-native/babel-preset['"]`);
|
|
37324
37053
|
const ENABLE_BABEL_RUNTIME_VERSION = /enableBabelRuntime["']?\s*:\s*['"]/;
|
|
37325
|
-
const isReactNativeVersionAtLeastPresetRename = (rootDirectory, packageJson) => {
|
|
37326
|
-
const installedReactNativeManifestPath = Path.join(rootDirectory, "node_modules", REACT_NATIVE_PACKAGE, "package.json");
|
|
37327
|
-
const reactNativeVersionSpec = (isFile(installedReactNativeManifestPath) ? readPackageJson(installedReactNativeManifestPath).version : void 0) ?? getDependencySpec(packageJson, REACT_NATIVE_PACKAGE);
|
|
37328
|
-
if (reactNativeVersionSpec === null || reactNativeVersionSpec === void 0) return false;
|
|
37329
|
-
const normalizedVersionRange = import_semver.validRange(reactNativeVersionSpec);
|
|
37330
|
-
if (normalizedVersionRange === null) return false;
|
|
37331
|
-
const minimumVersion = import_semver.minVersion(normalizedVersionRange);
|
|
37332
|
-
return minimumVersion !== null && import_semver.gte(minimumVersion, PRESET_RENAME_MINIMUM_REACT_NATIVE_VERSION);
|
|
37333
|
-
};
|
|
37334
|
-
const canResolveLegacyPreset = (rootDirectory, packageJson) => getDependencySpec(packageJson, LEGACY_PRESET_PACKAGE) !== null || isFile(Path.join(rootDirectory, "node_modules", LEGACY_PRESET_PACKAGE, "package.json"));
|
|
37335
37054
|
const checkReactNativeMetroBabelPreset = (rootDirectory) => {
|
|
37336
|
-
const packageJson = readPackageJson(Path.join(rootDirectory, "package.json"));
|
|
37337
|
-
const shouldReportLegacyPreset = isReactNativeVersionAtLeastPresetRename(rootDirectory, packageJson) && !canResolveLegacyPreset(rootDirectory, packageJson);
|
|
37338
37055
|
for (const fileName of BABEL_CONFIG_FILE_NAMES) {
|
|
37339
37056
|
const filePath = Path.join(rootDirectory, fileName);
|
|
37340
37057
|
if (!isFile(filePath)) continue;
|
|
@@ -37344,7 +37061,7 @@ const checkReactNativeMetroBabelPreset = (rootDirectory) => {
|
|
|
37344
37061
|
} catch {
|
|
37345
37062
|
continue;
|
|
37346
37063
|
}
|
|
37347
|
-
if (
|
|
37064
|
+
if (contents.includes(LEGACY_PRESET_SPEC)) return [buildReactNativeDiagnostic({
|
|
37348
37065
|
filePath: fileName,
|
|
37349
37066
|
rule: "rn-no-metro-babel-preset",
|
|
37350
37067
|
severity: "error",
|
|
@@ -37367,6 +37084,12 @@ const checkReactNativeProject = (rootDirectory, project) => {
|
|
|
37367
37084
|
return [...checkReactNativeMetroBabelPreset(rootDirectory), ...checkReactNativeLibraryDependencies(rootDirectory)];
|
|
37368
37085
|
};
|
|
37369
37086
|
const RULE_KEY = "no-vulnerable-react-server-components";
|
|
37087
|
+
const DEPENDENCY_SECTIONS = [
|
|
37088
|
+
"dependencies",
|
|
37089
|
+
"devDependencies",
|
|
37090
|
+
"peerDependencies",
|
|
37091
|
+
"optionalDependencies"
|
|
37092
|
+
];
|
|
37370
37093
|
const REACT_RSC_ADVISORIES_BY_MINOR = {
|
|
37371
37094
|
"19.0": {
|
|
37372
37095
|
rceFixedVersion: "19.0.1",
|
|
@@ -37413,13 +37136,20 @@ const enumerateWorkspaceDirectories = (workspaceRoot) => {
|
|
|
37413
37136
|
for (const pattern of patterns) for (const directory of resolveWorkspaceDirectories(workspaceRoot, pattern)) directories.add(directory);
|
|
37414
37137
|
return [...directories];
|
|
37415
37138
|
};
|
|
37139
|
+
const readDeclaredSpec = (packageJson, packageName) => {
|
|
37140
|
+
for (const section of DEPENDENCY_SECTIONS) {
|
|
37141
|
+
const spec = packageJson[section]?.[packageName];
|
|
37142
|
+
if (typeof spec === "string") return spec;
|
|
37143
|
+
}
|
|
37144
|
+
return null;
|
|
37145
|
+
};
|
|
37416
37146
|
const resolveVersionInDirectory = (directory, packageName, declaredSpecOverride) => {
|
|
37417
37147
|
const manifestPath = Path.join(directory, "node_modules", packageName, "package.json");
|
|
37418
37148
|
if (isFile(manifestPath)) {
|
|
37419
37149
|
const installedVersion = import_semver.valid(readPackageJson(manifestPath).version ?? null);
|
|
37420
37150
|
if (installedVersion !== null) return installedVersion;
|
|
37421
37151
|
}
|
|
37422
|
-
const candidateSpecs = [
|
|
37152
|
+
const candidateSpecs = [readDeclaredSpec(readPackageJson(Path.join(directory, "package.json")), packageName), declaredSpecOverride];
|
|
37423
37153
|
for (const spec of candidateSpecs) {
|
|
37424
37154
|
const pinnedVersion = spec === null ? null : import_semver.valid(spec);
|
|
37425
37155
|
if (pinnedVersion !== null) return pinnedVersion;
|
|
@@ -38087,68 +37817,21 @@ const buildCapabilities = (project) => {
|
|
|
38087
37817
|
if (CLIENT_ONLY_FRAMEWORKS.has(project.framework)) capabilities.add("client-only");
|
|
38088
37818
|
if (project.isStaticExport) capabilities.add("nextjs:static-export");
|
|
38089
37819
|
if (project.nextjsMajorVersion !== null && project.nextjsMajorVersion >= 15) capabilities.add("nextjs:15");
|
|
38090
|
-
if (project.nextjsMajorVersion !== null && project.nextjsMajorVersion >= 16) capabilities.add("nextjs:16");
|
|
38091
37820
|
addMajorLadder(capabilities, "react", project.reactMajorVersion, 17, 30);
|
|
38092
37821
|
if (project.reactMajorVersion !== null && project.reactMajorVersion >= 19 && isMajorMinorAtLeast(parseReactMajorMinor(project.reactVersion), {
|
|
38093
37822
|
major: 19,
|
|
38094
37823
|
minor: 2
|
|
38095
37824
|
})) capabilities.add("react:19.2");
|
|
38096
|
-
if (project.tailwindVersion !== null)
|
|
38097
|
-
|
|
38098
|
-
|
|
38099
|
-
|
|
38100
|
-
|
|
38101
|
-
minor: 4
|
|
38102
|
-
})) capabilities.add("tailwind:3.4");
|
|
38103
|
-
if (tailwindVersion !== null && isMajorMinorAtLeast(tailwindVersion, {
|
|
38104
|
-
major: 4,
|
|
38105
|
-
minor: 0
|
|
38106
|
-
})) capabilities.add("tailwind:4");
|
|
38107
|
-
}
|
|
37825
|
+
if (project.tailwindVersion !== null) capabilities.add("tailwind");
|
|
37826
|
+
if (project.tailwindVersion !== null && isMajorMinorAtLeast(parseTailwindMajorMinor(project.tailwindVersion), {
|
|
37827
|
+
major: 3,
|
|
37828
|
+
minor: 4
|
|
37829
|
+
})) capabilities.add("tailwind:3.4");
|
|
38108
37830
|
if (project.zodVersion !== null) capabilities.add("zod");
|
|
38109
37831
|
if (project.zodMajorVersion !== null && project.zodMajorVersion >= 4) capabilities.add("zod:4");
|
|
38110
|
-
if (project.mobxVersion !== void 0 && project.mobxVersion !== null || project.hasMobxReact === true || project.hasMobxReactLite === true || project.hasMobxStateTree === true || project.hasMobxReactObserver === true) capabilities.add("mobx");
|
|
38111
|
-
if (project.hasMobxReact === true) capabilities.add("mobx-react");
|
|
38112
|
-
if (project.hasMobxReactLite === true) capabilities.add("mobx-react-lite");
|
|
38113
|
-
if (project.hasMobxReact === true || project.hasMobxReactLite === true) capabilities.add("mobx-react-binding");
|
|
38114
|
-
const mobxReactVersion = parseDependencyMajorMinor(project.mobxReactVersion);
|
|
38115
|
-
const mobxReactLiteVersion = parseDependencyMajorMinor(project.mobxReactLiteVersion);
|
|
38116
|
-
const hasMobxReactObserverMemoGuard = mobxReactVersion !== null && isMajorMinorAtLeast(mobxReactVersion, {
|
|
38117
|
-
major: 7,
|
|
38118
|
-
minor: 3
|
|
38119
|
-
});
|
|
38120
|
-
const hasMobxReactLiteObserverMemoGuard = mobxReactLiteVersion !== null && isMajorMinorAtLeast(mobxReactLiteVersion, {
|
|
38121
|
-
major: 3,
|
|
38122
|
-
minor: 3
|
|
38123
|
-
});
|
|
38124
|
-
if (hasMobxReactObserverMemoGuard) capabilities.add("mobx-react-observer-memo-guard");
|
|
38125
|
-
if (hasMobxReactLiteObserverMemoGuard) capabilities.add("mobx-react-lite-observer-memo-guard");
|
|
38126
|
-
if (hasMobxReactObserverMemoGuard || hasMobxReactLiteObserverMemoGuard) capabilities.add("mobx-react-binding-observer-memo-guard");
|
|
38127
|
-
if (project.hasMobxStateTree === true) capabilities.add("mobx-state-tree");
|
|
38128
|
-
if (project.hasMobxReactObserver === true) capabilities.add("mobx-react-observer");
|
|
38129
|
-
if (project.mobxMajorVersion !== void 0 && project.mobxMajorVersion !== null && project.mobxMajorVersion >= 4 && project.mobxMajorVersion <= 6) addMajorLadder(capabilities, "mobx", project.mobxMajorVersion, 4, 6);
|
|
38130
|
-
const mobxVersion = parseDependencyMajorMinor(project.mobxVersion);
|
|
38131
|
-
if (project.mobxMajorVersion === 6 && mobxVersion !== null && isMajorMinorAtLeast(mobxVersion, {
|
|
38132
|
-
major: 6,
|
|
38133
|
-
minor: 10
|
|
38134
|
-
})) capabilities.add("mobx:6.10");
|
|
38135
|
-
if (project.zustandVersion !== void 0 && project.zustandVersion !== null) capabilities.add("zustand");
|
|
38136
|
-
if (project.zustandMajorVersion !== void 0 && project.zustandMajorVersion !== null && project.zustandMajorVersion >= 1 && project.zustandMajorVersion <= 5) addMajorLadder(capabilities, "zustand", project.zustandMajorVersion, 1, 5);
|
|
38137
37832
|
if (project.isPreES2023Target) capabilities.add("pre-es2023");
|
|
38138
37833
|
if (project.hasReactCompiler) capabilities.add("react-compiler");
|
|
38139
|
-
if (
|
|
38140
|
-
if (project.styledComponentsVersion) {
|
|
38141
|
-
capabilities.add("styled-components");
|
|
38142
|
-
const styledComponentsMajor = getLowestDependencyMajor(project.styledComponentsVersion);
|
|
38143
|
-
if (styledComponentsMajor !== null && styledComponentsMajor >= 6) capabilities.add("styled-components:6");
|
|
38144
|
-
}
|
|
38145
|
-
if (project.hasI18nLibrary) capabilities.add("i18n");
|
|
38146
|
-
if (project.valtioVersion !== null) capabilities.add("valtio");
|
|
38147
|
-
addMajorLadder(capabilities, "valtio", project.valtioMajorVersion, 1, 10);
|
|
38148
|
-
if (project.hasRemotion) {
|
|
38149
|
-
capabilities.add("remotion");
|
|
38150
|
-
addMajorLadder(capabilities, "remotion", project.remotionMajorVersion ?? null, 4, 30);
|
|
38151
|
-
}
|
|
37834
|
+
if (project.hasTanStackQuery) capabilities.add("tanstack-query");
|
|
38152
37835
|
if (project.hasTypeScript) capabilities.add("typescript");
|
|
38153
37836
|
if (project.preactVersion !== null) capabilities.add("preact");
|
|
38154
37837
|
addMajorLadder(capabilities, "preact", project.preactMajorVersion, 10, 20);
|
|
@@ -38163,7 +37846,7 @@ const getCapabilities = (project) => {
|
|
|
38163
37846
|
capabilitiesByProject.set(project, capabilities);
|
|
38164
37847
|
return capabilities;
|
|
38165
37848
|
};
|
|
38166
|
-
const shouldEnableRule = (requires, tags, capabilities, ignoredTags, disabledWhen
|
|
37849
|
+
const shouldEnableRule = (requires, tags, capabilities, ignoredTags, disabledWhen) => {
|
|
38167
37850
|
if (requires) {
|
|
38168
37851
|
for (const capability of requires) if (!capabilities.has(capability)) return false;
|
|
38169
37852
|
}
|
|
@@ -38174,29 +37857,20 @@ const shouldEnableRule = (requires, tags, capabilities, ignoredTags, disabledWhe
|
|
|
38174
37857
|
if (tags) {
|
|
38175
37858
|
for (const tag of tags) if (ignoredTags.has(tag)) return false;
|
|
38176
37859
|
}
|
|
38177
|
-
if (includedTags && includedTags.size > 0) {
|
|
38178
|
-
if (!tags?.some((tag) => includedTags.has(tag))) return false;
|
|
38179
|
-
}
|
|
38180
37860
|
return true;
|
|
38181
37861
|
};
|
|
38182
|
-
const shouldEnableRuleByDefaultStatus = (options) => options.defaultEnabled !== false || options.hasExplicitOverride === true || options.includeTagDefaults && options.hasIncludedTags;
|
|
38183
37862
|
const yieldToEventLoop = () => new Promise((resolve) => {
|
|
38184
37863
|
setImmediate(resolve);
|
|
38185
37864
|
});
|
|
38186
37865
|
const createSecurityScanSession = (rootDirectory, options) => {
|
|
38187
37866
|
const capabilities = options.project ? getCapabilities(options.project) : /* @__PURE__ */ new Set();
|
|
38188
37867
|
const ignoredTags = options.ignoredTags ?? /* @__PURE__ */ new Set();
|
|
38189
|
-
const includedTags = options.includedTags ?? /* @__PURE__ */ new Set();
|
|
38190
37868
|
const enabledScanRules = REACT_DOCTOR_RULES.flatMap((entry) => {
|
|
38191
37869
|
const rule = entry.rule;
|
|
38192
37870
|
const scan = rule.scan;
|
|
38193
37871
|
if (typeof scan !== "function") return [];
|
|
38194
|
-
if (
|
|
38195
|
-
|
|
38196
|
-
includeTagDefaults: options.includeTagDefaults === true,
|
|
38197
|
-
hasIncludedTags: includedTags.size > 0
|
|
38198
|
-
})) return [];
|
|
38199
|
-
if (!shouldEnableRule(rule.requires, rule.tags, capabilities, ignoredTags, rule.disabledWhen, includedTags)) return [];
|
|
37872
|
+
if (rule.defaultEnabled === false) return [];
|
|
37873
|
+
if (!shouldEnableRule(rule.requires, rule.tags, capabilities, ignoredTags, rule.disabledWhen)) return [];
|
|
38200
37874
|
return [{
|
|
38201
37875
|
entry,
|
|
38202
37876
|
scan,
|
|
@@ -40182,9 +39856,8 @@ const buildUserPluginRules = (userPlugin, severityControls) => {
|
|
|
40182
39856
|
}
|
|
40183
39857
|
return enabled;
|
|
40184
39858
|
};
|
|
40185
|
-
const createOxlintConfig = ({ pluginPath, project, customRulesOnly = false, extendsPaths = [], ignoredTags = /* @__PURE__ */ new Set(),
|
|
40186
|
-
const
|
|
40187
|
-
const reactHooksJsPlugin = disableReactHooksJsPlugin || ruleSelection === "sidecar" || hasIncludedTags ? null : resolveReactHooksJsPlugin(project.hasReactCompiler || project.hasReactCompilerLintPlugin === true, customRulesOnly);
|
|
39859
|
+
const createOxlintConfig = ({ pluginPath, project, customRulesOnly = false, extendsPaths = [], ignoredTags = /* @__PURE__ */ new Set(), serverAuthFunctionNames, severityControls, userPlugins = [], disableReactHooksJsPlugin = false, ruleSelection, sidecarRuleIdFilter }) => {
|
|
39860
|
+
const reactHooksJsPlugin = disableReactHooksJsPlugin || ruleSelection === "sidecar" ? null : resolveReactHooksJsPlugin(project.hasReactCompiler || project.hasReactCompilerLintPlugin === true, customRulesOnly);
|
|
40188
39861
|
const reactCompilerRules = reactHooksJsPlugin ? applyRuleSeverityControls(filterRulesToAvailable(REACT_COMPILER_RULES, "react-hooks-js", reactHooksJsPlugin.availableRuleNames), severityControls) : {};
|
|
40189
39862
|
const jsPlugins = [];
|
|
40190
39863
|
if (reactHooksJsPlugin) jsPlugins.push(reactHooksJsPlugin.entry);
|
|
@@ -40199,14 +39872,9 @@ const createOxlintConfig = ({ pluginPath, project, customRulesOnly = false, exte
|
|
|
40199
39872
|
if (rule.scan !== void 0) continue;
|
|
40200
39873
|
if (customRulesOnly && registryEntry.originallyExternal) continue;
|
|
40201
39874
|
if (rule.framework !== "global" && !rule.requires) continue;
|
|
40202
|
-
if (!shouldEnableRule(rule.requires, rule.tags, capabilities, ignoredTags, rule.disabledWhen
|
|
39875
|
+
if (!shouldEnableRule(rule.requires, rule.tags, capabilities, ignoredTags, rule.disabledWhen)) continue;
|
|
40203
39876
|
const explicitRuleOverride = resolveRuleSeverityOverride({ ruleKey: registryEntry.key }, severityControls);
|
|
40204
|
-
if (
|
|
40205
|
-
defaultEnabled: rule.defaultEnabled,
|
|
40206
|
-
includeTagDefaults,
|
|
40207
|
-
hasIncludedTags,
|
|
40208
|
-
hasExplicitOverride: explicitRuleOverride !== void 0
|
|
40209
|
-
})) continue;
|
|
39877
|
+
if (rule.defaultEnabled === false && explicitRuleOverride === void 0) continue;
|
|
40210
39878
|
const severity = resolveRuleSeverityOverride({
|
|
40211
39879
|
ruleKey: registryEntry.key,
|
|
40212
39880
|
category: rule.category
|
|
@@ -40215,7 +39883,7 @@ const createOxlintConfig = ({ pluginPath, project, customRulesOnly = false, exte
|
|
|
40215
39883
|
enabledReactDoctorRules[registryEntry.key] = severity;
|
|
40216
39884
|
}
|
|
40217
39885
|
const userPluginRules = {};
|
|
40218
|
-
if (ruleSelection !== "sidecar"
|
|
39886
|
+
if (ruleSelection !== "sidecar") for (const userPlugin of userPlugins) {
|
|
40219
39887
|
Object.assign(userPluginRules, buildUserPluginRules(userPlugin, severityControls));
|
|
40220
39888
|
jsPlugins.push(userPlugin.entry);
|
|
40221
39889
|
}
|
|
@@ -40432,19 +40100,6 @@ const createSidecarLintCache = (cacheDirectory, rulesetHash) => {
|
|
|
40432
40100
|
}
|
|
40433
40101
|
};
|
|
40434
40102
|
};
|
|
40435
|
-
const fingerprintCacheByFilePath = /* @__PURE__ */ new Map();
|
|
40436
|
-
const fingerprintFileContents = (filePath, fingerprintLength) => {
|
|
40437
|
-
const fileStats = NFS.statSync(filePath, { bigint: true });
|
|
40438
|
-
const cachedFingerprint = fingerprintCacheByFilePath.get(filePath);
|
|
40439
|
-
if (cachedFingerprint?.modifiedTimeNanoseconds === fileStats.mtimeNs && cachedFingerprint.sizeBytes === fileStats.size) return cachedFingerprint.fingerprint;
|
|
40440
|
-
const fingerprint = crypto.createHash("sha256").update(NFS.readFileSync(filePath)).digest("hex").slice(0, fingerprintLength);
|
|
40441
|
-
fingerprintCacheByFilePath.set(filePath, {
|
|
40442
|
-
fingerprint,
|
|
40443
|
-
modifiedTimeNanoseconds: fileStats.mtimeNs,
|
|
40444
|
-
sizeBytes: fileStats.size
|
|
40445
|
-
});
|
|
40446
|
-
return fingerprint;
|
|
40447
|
-
};
|
|
40448
40103
|
const bundledRequire = createRequire(import.meta.url);
|
|
40449
40104
|
const childNodeVersionByBinaryPath = /* @__PURE__ */ new Map();
|
|
40450
40105
|
const resolveChildNodeVersion = (nodeBinaryPath) => {
|
|
@@ -40468,13 +40123,6 @@ const TOOLCHAIN_PACKAGE_SPECIFIERS = [
|
|
|
40468
40123
|
"oxlint-plugin-react-doctor/package.json",
|
|
40469
40124
|
"eslint-plugin-react-hooks/package.json"
|
|
40470
40125
|
];
|
|
40471
|
-
const resolvePluginFingerprint = () => {
|
|
40472
|
-
try {
|
|
40473
|
-
return fingerprintFileContents(bundledRequire.resolve("oxlint-plugin-react-doctor"), 16);
|
|
40474
|
-
} catch {
|
|
40475
|
-
return "unresolved";
|
|
40476
|
-
}
|
|
40477
|
-
};
|
|
40478
40126
|
const resolveOxlintToolchainVersions = (nodeBinaryPath = process.execPath) => {
|
|
40479
40127
|
const versions = [`node=${resolveChildNodeVersion(nodeBinaryPath)}`];
|
|
40480
40128
|
for (const specifier of TOOLCHAIN_PACKAGE_SPECIFIERS) try {
|
|
@@ -40484,7 +40132,6 @@ const resolveOxlintToolchainVersions = (nodeBinaryPath = process.execPath) => {
|
|
|
40484
40132
|
} catch {
|
|
40485
40133
|
versions.push(`${specifier}=missing`);
|
|
40486
40134
|
}
|
|
40487
|
-
versions.push(`oxlint-plugin-react-doctor#fingerprint=${resolvePluginFingerprint()}`);
|
|
40488
40135
|
return versions;
|
|
40489
40136
|
};
|
|
40490
40137
|
const esmRequire = createRequire(import.meta.url);
|
|
@@ -41960,7 +41607,7 @@ const reactHooksJsPluginDropNote = (error) => {
|
|
|
41960
41607
|
* 6. always restore disable directives + clean up the temp dir
|
|
41961
41608
|
*/
|
|
41962
41609
|
const runOxlint = async (options) => {
|
|
41963
|
-
const { rootDirectory, project, includePaths, nodeBinaryPath = process.execPath, customRulesOnly = false, respectInlineDisables = true, adoptExistingLintConfig = true, ignoredTags = /* @__PURE__ */ new Set(),
|
|
41610
|
+
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;
|
|
41964
41611
|
const serverAuthFunctionNames = Array.isArray(userConfig?.serverAuthFunctionNames) ? userConfig.serverAuthFunctionNames.filter((entry) => typeof entry === "string" && entry.length > 0) : void 0;
|
|
41965
41612
|
const severityControls = buildRuleSeverityControls(userConfig);
|
|
41966
41613
|
validateRuleRegistration();
|
|
@@ -41974,15 +41621,13 @@ const runOxlint = async (options) => {
|
|
|
41974
41621
|
}
|
|
41975
41622
|
const pluginPath = resolvePluginPath();
|
|
41976
41623
|
const extendsPaths = (adoptExistingLintConfig && !customRulesOnly ? detectUserLintConfigPaths(rootDirectory) : []).filter(canOxlintExtendConfig);
|
|
41977
|
-
const userPlugins =
|
|
41624
|
+
const userPlugins = resolveUserPlugins(userConfig?.plugins, configSourceDirectory);
|
|
41978
41625
|
const buildConfig = (overrides) => createOxlintConfig({
|
|
41979
41626
|
pluginPath,
|
|
41980
41627
|
project,
|
|
41981
41628
|
customRulesOnly,
|
|
41982
41629
|
extendsPaths: overrides.extendsPaths,
|
|
41983
41630
|
ignoredTags,
|
|
41984
|
-
includedTags,
|
|
41985
|
-
includeTagDefaults,
|
|
41986
41631
|
serverAuthFunctionNames,
|
|
41987
41632
|
severityControls,
|
|
41988
41633
|
userPlugins,
|
|
@@ -42371,8 +42016,6 @@ var Linter = class Linter extends Service()("react-doctor/Linter") {
|
|
|
42371
42016
|
respectInlineDisables: input.respectInlineDisables,
|
|
42372
42017
|
adoptExistingLintConfig: input.adoptExistingLintConfig,
|
|
42373
42018
|
ignoredTags: input.ignoredTags,
|
|
42374
|
-
includedTags: input.includedTags,
|
|
42375
|
-
includeTagDefaults: input.includeTagDefaults,
|
|
42376
42019
|
userConfig: input.userConfig ?? null,
|
|
42377
42020
|
configSourceDirectory: input.configSourceDirectory,
|
|
42378
42021
|
onPartialFailure: (reason) => {
|
|
@@ -43221,9 +42864,7 @@ const runInspect = (input, hooks = {}) => gen(function* () {
|
|
|
43221
42864
|
const securityScanFailedRef = yield* make$13(false);
|
|
43222
42865
|
const securityScanFiber = yield* forkChild(runCollect(applyPerElementPipeline(isDiffMode ? empty$4 : unwrap(tryPromise(() => checkSecurityScanCooperative(scanDirectory, {
|
|
43223
42866
|
project,
|
|
43224
|
-
ignoredTags: input.ignoredTags
|
|
43225
|
-
includedTags: input.includedTags,
|
|
43226
|
-
includeTagDefaults: input.includeTagDefaults
|
|
42867
|
+
ignoredTags: input.ignoredTags
|
|
43227
42868
|
})).pipe(map$3((diagnostics) => fromIterable$1(diagnostics)), catch_$1(() => set(securityScanFailedRef, true).pipe(as(empty$4))))))).pipe(withSpan("SecurityScan.run")));
|
|
43228
42869
|
const shouldRunSupplyChain = !isDiffMode || (input.supplyChainManifestChanged ?? false);
|
|
43229
42870
|
const supplyChainOverlapTimeout = yield* SupplyChainOverlapTimeoutMs;
|
|
@@ -43314,8 +42955,6 @@ const runInspect = (input, hooks = {}) => gen(function* () {
|
|
|
43314
42955
|
respectInlineDisables: input.respectInlineDisables,
|
|
43315
42956
|
adoptExistingLintConfig: input.adoptExistingLintConfig,
|
|
43316
42957
|
ignoredTags: input.ignoredTags,
|
|
43317
|
-
includedTags: input.includedTags,
|
|
43318
|
-
includeTagDefaults: input.includeTagDefaults,
|
|
43319
42958
|
userConfig: resolvedConfig.config ?? void 0,
|
|
43320
42959
|
configSourceDirectory: resolvedConfig.configSourceDirectory ?? void 0,
|
|
43321
42960
|
onFileProgress: (scannedFileCount, totalFileCount) => {
|
|
@@ -45818,5 +45457,5 @@ const startLanguageServer = () => {
|
|
|
45818
45457
|
};
|
|
45819
45458
|
//#endregion
|
|
45820
45459
|
export { startLanguageServer };
|
|
45821
|
-
!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]="
|
|
45822
|
-
//# debugId=
|
|
45460
|
+
!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]="ecc1704a-4f8c-583e-93b2-78c6feb9cfd6")}catch(e){}}();
|
|
45461
|
+
//# debugId=ecc1704a-4f8c-583e-93b2-78c6feb9cfd6
|