react-doctor 0.8.1-dev.412377e → 0.8.1-dev.5332cb6
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 +159 -793
- package/dist/index.d.ts +0 -45
- package/dist/index.js +115 -702
- package/dist/lsp.js +115 -702
- package/dist/skills/react-doctor/SKILL.md +0 -5
- package/package.json +3 -3
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]="14f17993-c8fc-5c43-a518-2b2055f5d836")}catch(e){}}();
|
|
3
3
|
import { r as __toESM$1, t as __commonJSMin$1 } from "./chunk-N93fKeF6.js";
|
|
4
4
|
import { createRequire } from "node:module";
|
|
5
5
|
import reactDoctorPlugin, { ALL_REACT_DOCTOR_RULE_KEYS, CROSS_FILE_DEPENDENCY_COLLECTORS, CROSS_FILE_RULE_IDS, FRAMEWORK_SPECIFIC_RULE_KEYS, FRAMEWORK_TOKENS, MOTION_LIBRARY_PACKAGES, REACT_COMPILER_RULES, REACT_DOCTOR_RULES, classifySecurityScanFile, collectCrossFileDependencyProbes, resetManifestCaches, shouldReadSecurityScanContent } from "oxlint-plugin-react-doctor";
|
|
@@ -32854,6 +32854,44 @@ var AmbiguousProjectError = class extends Error {
|
|
|
32854
32854
|
}
|
|
32855
32855
|
};
|
|
32856
32856
|
const isProjectDiscoveryError = (value) => value instanceof ProjectNotFoundError || value instanceof NoReactDependencyError || value instanceof PackageJsonNotFoundError || value instanceof NotADirectoryError || value instanceof AmbiguousProjectError;
|
|
32857
|
+
const isErrnoException = (error) => error instanceof Error && "code" in error;
|
|
32858
|
+
const IGNORABLE_READDIR_ERROR_CODES = new Set([
|
|
32859
|
+
"EACCES",
|
|
32860
|
+
"EPERM",
|
|
32861
|
+
"ENOENT",
|
|
32862
|
+
"ENOTDIR",
|
|
32863
|
+
"EINVAL",
|
|
32864
|
+
"ELOOP",
|
|
32865
|
+
"ENAMETOOLONG"
|
|
32866
|
+
]);
|
|
32867
|
+
const isIgnorableReaddirError = (error) => isErrnoException(error) && typeof error.code === "string" && IGNORABLE_READDIR_ERROR_CODES.has(error.code);
|
|
32868
|
+
const readDirectoryEntries = (directoryPath) => {
|
|
32869
|
+
try {
|
|
32870
|
+
return NFS.readdirSync(directoryPath, { withFileTypes: true });
|
|
32871
|
+
} catch (error) {
|
|
32872
|
+
if (isIgnorableReaddirError(error)) return [];
|
|
32873
|
+
throw error;
|
|
32874
|
+
}
|
|
32875
|
+
};
|
|
32876
|
+
const isFile = (filePath) => {
|
|
32877
|
+
try {
|
|
32878
|
+
return NFS.statSync(filePath).isFile();
|
|
32879
|
+
} catch {
|
|
32880
|
+
return false;
|
|
32881
|
+
}
|
|
32882
|
+
};
|
|
32883
|
+
const isDirectory = (directoryPath) => {
|
|
32884
|
+
try {
|
|
32885
|
+
return NFS.statSync(directoryPath).isDirectory();
|
|
32886
|
+
} catch {
|
|
32887
|
+
return false;
|
|
32888
|
+
}
|
|
32889
|
+
};
|
|
32890
|
+
const isPlainObject = (value) => {
|
|
32891
|
+
if (typeof value !== "object" || value === null || Array.isArray(value)) return false;
|
|
32892
|
+
const prototype = Object.getPrototypeOf(value);
|
|
32893
|
+
return prototype === null || prototype === Object.prototype;
|
|
32894
|
+
};
|
|
32857
32895
|
const SOURCE_FILE_PATTERN = /\.(tsx?|jsx?|mts|mjs)$/;
|
|
32858
32896
|
const GENERATED_BUNDLE_FILE_PATTERN = /\.(iife|umd|global|min)\.m?js$/i;
|
|
32859
32897
|
const GENERATED_SOURCE_DIRECTORY_PATTERN = /(?:^|\/)__generated__\//;
|
|
@@ -32894,58 +32932,6 @@ const IGNORED_DIRECTORIES = new Set([
|
|
|
32894
32932
|
"storybook-static"
|
|
32895
32933
|
]);
|
|
32896
32934
|
const MILLISECONDS_PER_SECOND = 1e3;
|
|
32897
|
-
const REACT_ROUTER_CAPABILITY_THRESHOLDS = [
|
|
32898
|
-
{
|
|
32899
|
-
capability: "react-router:6.4",
|
|
32900
|
-
major: 6,
|
|
32901
|
-
minor: 4
|
|
32902
|
-
},
|
|
32903
|
-
{
|
|
32904
|
-
capability: "react-router:6.7",
|
|
32905
|
-
major: 6,
|
|
32906
|
-
minor: 7
|
|
32907
|
-
},
|
|
32908
|
-
{
|
|
32909
|
-
capability: "react-router:6.9",
|
|
32910
|
-
major: 6,
|
|
32911
|
-
minor: 9
|
|
32912
|
-
},
|
|
32913
|
-
{
|
|
32914
|
-
capability: "react-router:6.19",
|
|
32915
|
-
major: 6,
|
|
32916
|
-
minor: 19
|
|
32917
|
-
},
|
|
32918
|
-
{
|
|
32919
|
-
capability: "react-router:7",
|
|
32920
|
-
major: 7,
|
|
32921
|
-
minor: 0
|
|
32922
|
-
},
|
|
32923
|
-
{
|
|
32924
|
-
capability: "react-router:7.8",
|
|
32925
|
-
major: 7,
|
|
32926
|
-
minor: 8
|
|
32927
|
-
},
|
|
32928
|
-
{
|
|
32929
|
-
capability: "react-router:7.9",
|
|
32930
|
-
major: 7,
|
|
32931
|
-
minor: 9
|
|
32932
|
-
},
|
|
32933
|
-
{
|
|
32934
|
-
capability: "react-router:7.10",
|
|
32935
|
-
major: 7,
|
|
32936
|
-
minor: 10
|
|
32937
|
-
},
|
|
32938
|
-
{
|
|
32939
|
-
capability: "react-router:7.15",
|
|
32940
|
-
major: 7,
|
|
32941
|
-
minor: 15
|
|
32942
|
-
},
|
|
32943
|
-
{
|
|
32944
|
-
capability: "react-router:8",
|
|
32945
|
-
major: 8,
|
|
32946
|
-
minor: 0
|
|
32947
|
-
}
|
|
32948
|
-
];
|
|
32949
32935
|
const SCORE_API_URL = "https://www.react.doctor/api/score";
|
|
32950
32936
|
const FETCH_TIMEOUT_MS = 1e4;
|
|
32951
32937
|
const GITHUB_VIEWER_PERMISSION_TIMEOUT_MS = 2e3;
|
|
@@ -33064,44 +33050,6 @@ const SUPPLY_CHAIN_OVERLAP_TIMEOUT_MS = 9e4;
|
|
|
33064
33050
|
const SUPPLY_CHAIN_CACHE_TTL_MS = 864e5;
|
|
33065
33051
|
const SUPPLY_CHAIN_CACHE_SUBDIR = "supply-chain";
|
|
33066
33052
|
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
33053
|
const lastSourceMappingUrl = (fileContent) => {
|
|
33106
33054
|
const lastReference = [...fileContent.matchAll(/\/\/# sourceMappingURL=(\S+)/g)].at(-1);
|
|
33107
33055
|
return lastReference ? lastReference[1] : null;
|
|
@@ -33427,10 +33375,10 @@ const FALLBACK_TSCONFIG_FILENAMES = ["tsconfig.app.json", "tsconfig.build.json"]
|
|
|
33427
33375
|
const FRAMEWORK_PACKAGES = {
|
|
33428
33376
|
next: "nextjs",
|
|
33429
33377
|
"@tanstack/react-start": "tanstack-start",
|
|
33430
|
-
"@remix-run/react": "remix",
|
|
33431
|
-
gatsby: "gatsby",
|
|
33432
33378
|
vite: "vite",
|
|
33433
33379
|
"react-scripts": "cra",
|
|
33380
|
+
"@remix-run/react": "remix",
|
|
33381
|
+
gatsby: "gatsby",
|
|
33434
33382
|
expo: "expo",
|
|
33435
33383
|
"react-native": "react-native"
|
|
33436
33384
|
};
|
|
@@ -33454,17 +33402,11 @@ const NEXT_CONFIG_FILENAMES = [
|
|
|
33454
33402
|
];
|
|
33455
33403
|
const BABEL_CONFIG_FILENAMES = [
|
|
33456
33404
|
".babelrc",
|
|
33457
|
-
".babelrc.js",
|
|
33458
33405
|
".babelrc.json",
|
|
33459
|
-
".babelrc.cjs",
|
|
33460
|
-
".babelrc.mjs",
|
|
33461
|
-
".babelrc.cts",
|
|
33462
33406
|
"babel.config.js",
|
|
33463
33407
|
"babel.config.json",
|
|
33464
33408
|
"babel.config.cjs",
|
|
33465
|
-
"babel.config.mjs"
|
|
33466
|
-
"babel.config.ts",
|
|
33467
|
-
"babel.config.cts"
|
|
33409
|
+
"babel.config.mjs"
|
|
33468
33410
|
];
|
|
33469
33411
|
const VITE_CONFIG_FILENAMES = [
|
|
33470
33412
|
"vite.config.js",
|
|
@@ -33476,28 +33418,12 @@ const VITE_CONFIG_FILENAMES = [
|
|
|
33476
33418
|
"vitest.config.ts",
|
|
33477
33419
|
"vitest.config.js"
|
|
33478
33420
|
];
|
|
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
33421
|
const EXPO_APP_CONFIG_FILENAMES = [
|
|
33496
33422
|
"app.json",
|
|
33497
33423
|
"app.config.js",
|
|
33498
33424
|
"app.config.ts"
|
|
33499
33425
|
];
|
|
33500
|
-
const REACT_COMPILER_PACKAGE_REFERENCE_PATTERN = /babel-plugin-react-compiler|react-compiler-runtime|
|
|
33426
|
+
const REACT_COMPILER_PACKAGE_REFERENCE_PATTERN = /babel-plugin-react-compiler|react-compiler-runtime|["']react-compiler["']/;
|
|
33501
33427
|
const REACT_COMPILER_ENABLED_FLAG_PATTERN = /["']?reactCompiler["']?\s*:\s*(?:true\b|\{)/;
|
|
33502
33428
|
const STATIC_EXPORT_OUTPUT_PATTERN = /(?:^|[^.\w])["']?output["']?\s*:\s*["']export["']/m;
|
|
33503
33429
|
const hasCompilerPackage = (packageJson, compilerPackages) => {
|
|
@@ -33532,8 +33458,6 @@ const detectReactCompiler = (directory, packageJson) => {
|
|
|
33532
33458
|
if (hasCompilerInConfigFiles(directory, NEXT_CONFIG_FILENAMES)) return true;
|
|
33533
33459
|
if (hasCompilerInConfigFiles(directory, BABEL_CONFIG_FILENAMES)) return true;
|
|
33534
33460
|
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
33461
|
if (hasCompilerInConfigFiles(directory, EXPO_APP_CONFIG_FILENAMES)) return true;
|
|
33538
33462
|
return hasCompilerPackageInAncestors(directory, REACT_COMPILER_TRANSFORM_PACKAGES);
|
|
33539
33463
|
};
|
|
@@ -33542,7 +33466,7 @@ const detectNextjsStaticExport = (directory) => NEXT_CONFIG_FILENAMES.some((file
|
|
|
33542
33466
|
const filePath = Path.join(directory, filename);
|
|
33543
33467
|
return isFile(filePath) && STATIC_EXPORT_OUTPUT_PATTERN.test(NFS.readFileSync(filePath, "utf-8"));
|
|
33544
33468
|
});
|
|
33545
|
-
const UNRESOLVABLE_PROTOCOL_VERSION = /^(?:
|
|
33469
|
+
const UNRESOLVABLE_PROTOCOL_VERSION = /^(?:file|git|github|https?|link|patch|portal|workspace|npm):/i;
|
|
33546
33470
|
const DIST_TAG_VERSION = /^[a-z][a-z0-9._-]*$/i;
|
|
33547
33471
|
const WILDCARD_VERSION = /^[*xX](?:\.[*xX])*$/;
|
|
33548
33472
|
const NPM_ALIAS_VERSION = /^npm:(?:@[^/]+\/[^@]+|[^@]+)@(.+)$/i;
|
|
@@ -33675,16 +33599,6 @@ const getLowestDependencyMajor = (version) => {
|
|
|
33675
33599
|
}
|
|
33676
33600
|
return lowestMajor;
|
|
33677
33601
|
};
|
|
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
33602
|
const isConcreteDependencyVersion = (version) => {
|
|
33689
33603
|
const normalizedVersion = normalizeDependencyVersion(version);
|
|
33690
33604
|
return normalizedVersion !== null && /\d/.test(normalizedVersion);
|
|
@@ -33728,18 +33642,9 @@ const parseReactMajorMinor = (reactVersion) => {
|
|
|
33728
33642
|
};
|
|
33729
33643
|
};
|
|
33730
33644
|
const parseLowerBoundVersion = (versionSpec) => import_semver.validRange(versionSpec) !== null ? import_semver.minVersion(versionSpec) : import_semver.coerce(versionSpec);
|
|
33731
|
-
const
|
|
33732
|
-
if (typeof
|
|
33733
|
-
const
|
|
33734
|
-
if (normalizedVersion === null) return null;
|
|
33735
|
-
const lowerBound = parseLowerBoundVersion(normalizedVersion);
|
|
33736
|
-
if (lowerBound === null) return null;
|
|
33737
|
-
if (lowerBound.major > 0) return Number.MAX_SAFE_INTEGER;
|
|
33738
|
-
return lowerBound.minor > 0 ? lowerBound.minor : null;
|
|
33739
|
-
};
|
|
33740
|
-
const parseDependencyMajorMinor = (dependencyVersion) => {
|
|
33741
|
-
if (typeof dependencyVersion !== "string") return null;
|
|
33742
|
-
const trimmed = dependencyVersion.trim();
|
|
33645
|
+
const parseTailwindMajorMinor = (tailwindVersion) => {
|
|
33646
|
+
if (typeof tailwindVersion !== "string") return null;
|
|
33647
|
+
const trimmed = tailwindVersion.trim();
|
|
33743
33648
|
if (trimmed.length === 0) return null;
|
|
33744
33649
|
const lowerBound = parseLowerBoundVersion(trimmed);
|
|
33745
33650
|
if (lowerBound === null || lowerBound.major <= 0) return null;
|
|
@@ -33748,7 +33653,6 @@ const parseDependencyMajorMinor = (dependencyVersion) => {
|
|
|
33748
33653
|
minor: lowerBound.minor
|
|
33749
33654
|
};
|
|
33750
33655
|
};
|
|
33751
|
-
const parseTailwindMajorMinor = (tailwindVersion) => parseDependencyMajorMinor(tailwindVersion);
|
|
33752
33656
|
const hasUpperBoundOnlyPeerRange = (range) => {
|
|
33753
33657
|
if (typeof range !== "string") return false;
|
|
33754
33658
|
const normalizedRange = normalizeDependencyVersion(range);
|
|
@@ -33770,7 +33674,7 @@ const resolveEffectiveReactMajor = (reactVersion, packageJson) => {
|
|
|
33770
33674
|
if (peerFloor === null) return hasUpperBoundOnlyPeerRange(peerReactRange) ? null : installedReactMajor;
|
|
33771
33675
|
return installedReactMajor !== null ? Math.min(installedReactMajor, peerFloor) : peerFloor;
|
|
33772
33676
|
};
|
|
33773
|
-
const isCatalogReference = (version) =>
|
|
33677
|
+
const isCatalogReference = (version) => version.startsWith("catalog:");
|
|
33774
33678
|
const extractCatalogName = (version) => {
|
|
33775
33679
|
if (!isCatalogReference(version)) return null;
|
|
33776
33680
|
const name = version.slice(8).trim();
|
|
@@ -33920,12 +33824,6 @@ const TAILWIND_ZOD_SECTIONS = [
|
|
|
33920
33824
|
"devDependencies",
|
|
33921
33825
|
"peerDependencies"
|
|
33922
33826
|
];
|
|
33923
|
-
const DEPENDENCY_SPEC_SECTIONS = [
|
|
33924
|
-
"dependencies",
|
|
33925
|
-
"devDependencies",
|
|
33926
|
-
"peerDependencies",
|
|
33927
|
-
"optionalDependencies"
|
|
33928
|
-
];
|
|
33929
33827
|
const EMPTY_DEPENDENCY_INFO = {
|
|
33930
33828
|
reactVersion: null,
|
|
33931
33829
|
tailwindVersion: null,
|
|
@@ -33935,7 +33833,7 @@ const EMPTY_DEPENDENCY_INFO = {
|
|
|
33935
33833
|
const pickConcreteVersion = (packageJson, packageName, sections) => {
|
|
33936
33834
|
for (const section of sections) {
|
|
33937
33835
|
const version = packageJson[section]?.[packageName];
|
|
33938
|
-
if (
|
|
33836
|
+
if (version === void 0) continue;
|
|
33939
33837
|
if (isCatalogReference(version)) return null;
|
|
33940
33838
|
if (isConcreteDependencyVersion(version)) return version;
|
|
33941
33839
|
}
|
|
@@ -33967,16 +33865,13 @@ const extractDependencyInfo = (packageJson) => {
|
|
|
33967
33865
|
};
|
|
33968
33866
|
};
|
|
33969
33867
|
const getDependencySpec = (packageJson, packageName) => {
|
|
33970
|
-
|
|
33971
|
-
|
|
33972
|
-
if (typeof spec === "string") return spec;
|
|
33973
|
-
}
|
|
33974
|
-
return null;
|
|
33868
|
+
const spec = packageJson.dependencies?.[packageName] ?? packageJson.devDependencies?.[packageName] ?? packageJson.peerDependencies?.[packageName] ?? packageJson.optionalDependencies?.[packageName];
|
|
33869
|
+
return typeof spec === "string" ? spec : null;
|
|
33975
33870
|
};
|
|
33976
33871
|
const getDependencyDeclaration = ({ packageJson, packageName, sections }) => {
|
|
33977
33872
|
for (const section of sections) {
|
|
33978
33873
|
const version = packageJson[section]?.[packageName];
|
|
33979
|
-
if (
|
|
33874
|
+
if (version === void 0) continue;
|
|
33980
33875
|
return {
|
|
33981
33876
|
catalogReference: extractCatalogName(version) ?? null,
|
|
33982
33877
|
hasDeclaration: true,
|
|
@@ -34010,15 +33905,24 @@ const getPreactVersion = (packageJson) => {
|
|
|
34010
33905
|
...packageJson.devDependencies
|
|
34011
33906
|
}.preact ?? null;
|
|
34012
33907
|
};
|
|
34013
|
-
const
|
|
33908
|
+
const TANSTACK_QUERY_PACKAGES = new Set([
|
|
33909
|
+
"@tanstack/react-query",
|
|
33910
|
+
"@tanstack/query-core",
|
|
33911
|
+
"react-query"
|
|
33912
|
+
]);
|
|
33913
|
+
const hasTanStackQuery = (packageJson) => {
|
|
33914
|
+
const allDependencies = {
|
|
33915
|
+
...packageJson.peerDependencies,
|
|
33916
|
+
...packageJson.dependencies,
|
|
33917
|
+
...packageJson.devDependencies
|
|
33918
|
+
};
|
|
33919
|
+
return Object.keys(allDependencies).some((packageName) => TANSTACK_QUERY_PACKAGES.has(packageName));
|
|
33920
|
+
};
|
|
33921
|
+
const resolveCatalogBackedDependencyVersion = ({ rootDirectory, rootPackageJson, packageName, version }) => {
|
|
34014
33922
|
if (version === null || !isCatalogReference(version)) return version;
|
|
34015
33923
|
const catalogName = extractCatalogName(version);
|
|
34016
|
-
const
|
|
34017
|
-
if (
|
|
34018
|
-
if (sourceDirectory !== rootDirectory || sourcePackageJson !== rootPackageJson) {
|
|
34019
|
-
const resolvedRootVersion = resolveCatalogVersion(rootPackageJson, packageName, rootDirectory, catalogName);
|
|
34020
|
-
if (resolvedRootVersion) return resolvedRootVersion;
|
|
34021
|
-
}
|
|
33924
|
+
const resolvedLocalVersion = resolveCatalogVersion(rootPackageJson, packageName, rootDirectory, catalogName);
|
|
33925
|
+
if (resolvedLocalVersion) return resolvedLocalVersion;
|
|
34022
33926
|
const monorepoRoot = findMonorepoRoot(rootDirectory);
|
|
34023
33927
|
if (!monorepoRoot) return version;
|
|
34024
33928
|
const monorepoPackageJsonPath = Path.join(monorepoRoot, "package.json");
|
|
@@ -34216,84 +34120,7 @@ const listWorkspacePackages = (rootDirectory) => {
|
|
|
34216
34120
|
}
|
|
34217
34121
|
return packages;
|
|
34218
34122
|
};
|
|
34219
|
-
const PREFERRED_DEPENDENCY_SECTIONS = [
|
|
34220
|
-
"dependencies",
|
|
34221
|
-
"peerDependencies",
|
|
34222
|
-
"devDependencies"
|
|
34223
|
-
];
|
|
34224
|
-
const getPreferredDependencyVersion = ({ packageJson, packageNames }) => {
|
|
34225
|
-
for (const packageName of packageNames) {
|
|
34226
|
-
const declaration = getDependencyDeclaration({
|
|
34227
|
-
packageJson,
|
|
34228
|
-
packageName,
|
|
34229
|
-
sections: PREFERRED_DEPENDENCY_SECTIONS
|
|
34230
|
-
});
|
|
34231
|
-
if (declaration.version !== null) return declaration.version;
|
|
34232
|
-
}
|
|
34233
|
-
return null;
|
|
34234
|
-
};
|
|
34235
|
-
const TANSTACK_REACT_QUERY_PACKAGES = ["@tanstack/react-query", "react-query"];
|
|
34236
|
-
const getTanStackQueryVersion = (packageJson) => {
|
|
34237
|
-
return getPreferredDependencyVersion({
|
|
34238
|
-
packageJson,
|
|
34239
|
-
packageNames: TANSTACK_REACT_QUERY_PACKAGES
|
|
34240
|
-
});
|
|
34241
|
-
};
|
|
34242
|
-
const STYLED_COMPONENTS_PACKAGES = ["styled-components"];
|
|
34243
|
-
const getStyledComponentsVersion = (packageJson) => {
|
|
34244
|
-
return getPreferredDependencyVersion({
|
|
34245
|
-
packageJson,
|
|
34246
|
-
packageNames: STYLED_COMPONENTS_PACKAGES
|
|
34247
|
-
});
|
|
34248
|
-
};
|
|
34249
|
-
const I18N_PACKAGES = [
|
|
34250
|
-
"i18next",
|
|
34251
|
-
"react-i18next",
|
|
34252
|
-
"next-i18next",
|
|
34253
|
-
"react-intl",
|
|
34254
|
-
"next-intl",
|
|
34255
|
-
"use-intl",
|
|
34256
|
-
"@formatjs/intl",
|
|
34257
|
-
"@lingui/core",
|
|
34258
|
-
"@lingui/react",
|
|
34259
|
-
"typesafe-i18n",
|
|
34260
|
-
"@tolgee/react",
|
|
34261
|
-
"react-intl-universal"
|
|
34262
|
-
];
|
|
34263
|
-
const hasI18nDependency = (packageJson) => {
|
|
34264
|
-
const allDependencies = {
|
|
34265
|
-
...packageJson.peerDependencies,
|
|
34266
|
-
...packageJson.dependencies,
|
|
34267
|
-
...packageJson.devDependencies,
|
|
34268
|
-
...packageJson.optionalDependencies
|
|
34269
|
-
};
|
|
34270
|
-
return I18N_PACKAGES.some((packageName) => allDependencies[packageName] !== void 0);
|
|
34271
|
-
};
|
|
34272
34123
|
const REANIMATED_DEPENDENCY_NAME = "react-native-reanimated";
|
|
34273
|
-
const MOBX_REACT_PACKAGE_NAME = "mobx-react";
|
|
34274
|
-
const MOBX_REACT_LITE_PACKAGE_NAME = "mobx-react-lite";
|
|
34275
|
-
const MOBX_STATE_TREE_PACKAGE_NAME = "mobx-state-tree";
|
|
34276
|
-
const MOBX_REACT_OBSERVER_PACKAGE_NAME = "mobx-react-observer";
|
|
34277
|
-
const REACT_THREE_FIBER_DEPENDENCY_NAMES = ["@react-three/fiber", "react-three-fiber"];
|
|
34278
|
-
const REACT_THREE_FIBER_SECTIONS = [
|
|
34279
|
-
"dependencies",
|
|
34280
|
-
"peerDependencies",
|
|
34281
|
-
"optionalDependencies",
|
|
34282
|
-
"devDependencies"
|
|
34283
|
-
];
|
|
34284
|
-
const THREE_DEPENDENCY_SECTIONS = [
|
|
34285
|
-
"dependencies",
|
|
34286
|
-
"peerDependencies",
|
|
34287
|
-
"optionalDependencies",
|
|
34288
|
-
"devDependencies"
|
|
34289
|
-
];
|
|
34290
|
-
const REACT_THREE_FIBER_ECOSYSTEM_DEPENDENCY_NAMES = [...REACT_THREE_FIBER_DEPENDENCY_NAMES, "@react-three/drei"];
|
|
34291
|
-
const THREE_DEPENDENCY_NAMES = [...REACT_THREE_FIBER_ECOSYSTEM_DEPENDENCY_NAMES, "three"];
|
|
34292
|
-
const REACT_ROUTER_DEPENDENCY_NAMES = [
|
|
34293
|
-
"@react-router/dev",
|
|
34294
|
-
"react-router-dom",
|
|
34295
|
-
"react-router"
|
|
34296
|
-
];
|
|
34297
34124
|
const SHOPIFY_FLASH_LIST_PACKAGE_NAME = "@shopify/flash-list";
|
|
34298
34125
|
const resolveWorkspaceDependencyVersion = ({ concreteVersion, packageName, rootDirectory, rootPackageJson, sections, workspaceDirectory, workspacePackageJson }) => {
|
|
34299
34126
|
const dependencyDeclaration = getDependencyDeclaration({
|
|
@@ -34304,7 +34131,7 @@ const resolveWorkspaceDependencyVersion = ({ concreteVersion, packageName, rootD
|
|
|
34304
34131
|
if (!dependencyDeclaration.hasDeclaration) return null;
|
|
34305
34132
|
return concreteVersion ?? resolveCatalogVersion(workspacePackageJson, packageName, workspaceDirectory, dependencyDeclaration.catalogReference) ?? resolveCatalogVersion(rootPackageJson, packageName, rootDirectory, dependencyDeclaration.catalogReference);
|
|
34306
34133
|
};
|
|
34307
|
-
const
|
|
34134
|
+
const shouldReplaceReactVersion = (currentVersion, nextVersion) => {
|
|
34308
34135
|
if (!currentVersion) return true;
|
|
34309
34136
|
const currentMajor = parseReactMajor(currentVersion);
|
|
34310
34137
|
const nextMajor = parseReactMajor(nextVersion);
|
|
@@ -34312,71 +34139,7 @@ const shouldReplaceWithLowerMajor = (currentVersion, nextVersion) => {
|
|
|
34312
34139
|
if (nextMajor === null) return false;
|
|
34313
34140
|
return nextMajor < currentMajor;
|
|
34314
34141
|
};
|
|
34315
|
-
const
|
|
34316
|
-
if (currentFact.version === null) return true;
|
|
34317
|
-
if (nextFact.version === null) return false;
|
|
34318
|
-
const currentMajor = getLowestDependencyMajor(currentFact.version);
|
|
34319
|
-
const nextMajor = getLowestDependencyMajor(nextFact.version);
|
|
34320
|
-
if (currentMajor === null) return false;
|
|
34321
|
-
if (nextMajor === null) return true;
|
|
34322
|
-
if (currentMajor > latestSupportedMajor) return false;
|
|
34323
|
-
if (nextMajor > latestSupportedMajor) return true;
|
|
34324
|
-
return nextMajor < currentMajor;
|
|
34325
|
-
};
|
|
34326
|
-
const shouldReplaceStyledComponentsVersion = (currentVersion, nextVersion) => {
|
|
34327
|
-
if (!currentVersion) return true;
|
|
34328
|
-
const currentMajor = getLowestDependencyMajor(currentVersion);
|
|
34329
|
-
const nextMajor = getLowestDependencyMajor(nextVersion);
|
|
34330
|
-
if (currentMajor === null) return nextMajor !== null && nextMajor < 6;
|
|
34331
|
-
if (nextMajor === null) return currentMajor >= 6;
|
|
34332
|
-
return nextMajor < currentMajor;
|
|
34333
|
-
};
|
|
34334
|
-
const selectOldestDependencyVersion = (currentVersion, nextVersion) => {
|
|
34335
|
-
if (currentVersion === null || nextVersion === null) return null;
|
|
34336
|
-
const current = parseDependencyMajorMinor(currentVersion);
|
|
34337
|
-
const next = parseDependencyMajorMinor(nextVersion);
|
|
34338
|
-
if (current === null) return currentVersion;
|
|
34339
|
-
if (next === null) return nextVersion;
|
|
34340
|
-
if (next.major !== current.major) return next.major < current.major ? nextVersion : currentVersion;
|
|
34341
|
-
return next.minor < current.minor ? nextVersion : currentVersion;
|
|
34342
|
-
};
|
|
34343
|
-
const shouldReplaceMobxFact = (currentFact, nextFact) => {
|
|
34344
|
-
if (currentFact.sourceDirectory === null) return true;
|
|
34345
|
-
if (currentFact.version === null) return false;
|
|
34346
|
-
if (nextFact.version === null) return true;
|
|
34347
|
-
const currentMajor = getDependencyMajorWithinSupportedRange(currentFact.version, 6);
|
|
34348
|
-
const nextMajor = getDependencyMajorWithinSupportedRange(nextFact.version, 6);
|
|
34349
|
-
if (currentMajor === null) return false;
|
|
34350
|
-
if (nextMajor === null) return true;
|
|
34351
|
-
return selectOldestDependencyVersion(currentFact.version, nextFact.version) === nextFact.version;
|
|
34352
|
-
};
|
|
34353
|
-
const collectBindingVersion = (facts, packageJson, directory, packageName) => {
|
|
34354
|
-
const version = getDependencySpec(packageJson, packageName);
|
|
34355
|
-
if (version === null) return;
|
|
34356
|
-
const resolvedVersion = resolveCatalogBackedDependencyVersion({
|
|
34357
|
-
rootDirectory: directory,
|
|
34358
|
-
rootPackageJson: packageJson,
|
|
34359
|
-
packageName,
|
|
34360
|
-
version
|
|
34361
|
-
});
|
|
34362
|
-
if (packageName === MOBX_REACT_PACKAGE_NAME) {
|
|
34363
|
-
facts.mobxReactVersion = facts.hasMobxReact ? selectOldestDependencyVersion(facts.mobxReactVersion, resolvedVersion) : resolvedVersion;
|
|
34364
|
-
facts.hasMobxReact = true;
|
|
34365
|
-
return;
|
|
34366
|
-
}
|
|
34367
|
-
facts.mobxReactLiteVersion = facts.hasMobxReactLite ? selectOldestDependencyVersion(facts.mobxReactLiteVersion, resolvedVersion) : resolvedVersion;
|
|
34368
|
-
facts.hasMobxReactLite = true;
|
|
34369
|
-
};
|
|
34370
|
-
const shouldReplaceReactRouterVersion = (currentVersion, nextVersion) => {
|
|
34371
|
-
if (currentVersion === null) return true;
|
|
34372
|
-
const current = parseReactMajorMinor(currentVersion);
|
|
34373
|
-
const next = parseReactMajorMinor(nextVersion);
|
|
34374
|
-
if (current === null) return next !== null;
|
|
34375
|
-
if (next === null) return false;
|
|
34376
|
-
if (next.major !== current.major) return next.major < current.major;
|
|
34377
|
-
return next.minor < current.minor;
|
|
34378
|
-
};
|
|
34379
|
-
const evaluateManifestFacts = (facts, packageJson, directory, rootDirectory, rootPackageJson) => {
|
|
34142
|
+
const evaluateManifestFacts = (facts, packageJson, directory) => {
|
|
34380
34143
|
if (facts.expo.version === null) {
|
|
34381
34144
|
const spec = getDependencySpec(packageJson, "expo");
|
|
34382
34145
|
if (spec !== null) facts.expo = {
|
|
@@ -34391,23 +34154,6 @@ const evaluateManifestFacts = (facts, packageJson, directory, rootDirectory, roo
|
|
|
34391
34154
|
sourceDirectory: directory
|
|
34392
34155
|
};
|
|
34393
34156
|
}
|
|
34394
|
-
for (const packageName of REACT_ROUTER_DEPENDENCY_NAMES) {
|
|
34395
|
-
const resolvedSpec = resolveCatalogBackedDependencyVersion({
|
|
34396
|
-
rootDirectory,
|
|
34397
|
-
rootPackageJson,
|
|
34398
|
-
sourceDirectory: directory,
|
|
34399
|
-
sourcePackageJson: packageJson,
|
|
34400
|
-
packageName,
|
|
34401
|
-
version: getDependencySpec(packageJson, packageName)
|
|
34402
|
-
});
|
|
34403
|
-
if (resolvedSpec === null || !shouldReplaceReactRouterVersion(facts.reactRouter.version, resolvedSpec)) continue;
|
|
34404
|
-
facts.reactRouter = {
|
|
34405
|
-
version: resolvedSpec,
|
|
34406
|
-
sourceDirectory: directory,
|
|
34407
|
-
packageName
|
|
34408
|
-
};
|
|
34409
|
-
}
|
|
34410
|
-
facts.hasReactRouterFramework = facts.hasReactRouterFramework || getDependencySpec(packageJson, "@react-router/dev") !== null;
|
|
34411
34157
|
if (facts.shopifyFlashList.version === null) {
|
|
34412
34158
|
const spec = getDependencySpec(packageJson, SHOPIFY_FLASH_LIST_PACKAGE_NAME);
|
|
34413
34159
|
if (spec !== null) facts.shopifyFlashList = {
|
|
@@ -34415,113 +34161,13 @@ const evaluateManifestFacts = (facts, packageJson, directory, rootDirectory, roo
|
|
|
34415
34161
|
sourceDirectory: directory
|
|
34416
34162
|
};
|
|
34417
34163
|
}
|
|
34418
|
-
const mobxSpec = getDependencySpec(packageJson, "mobx");
|
|
34419
|
-
if (mobxSpec !== null) {
|
|
34420
|
-
const nextMobxFact = {
|
|
34421
|
-
version: resolveCatalogBackedDependencyVersion({
|
|
34422
|
-
rootDirectory: directory,
|
|
34423
|
-
rootPackageJson: packageJson,
|
|
34424
|
-
packageName: "mobx",
|
|
34425
|
-
version: mobxSpec
|
|
34426
|
-
}),
|
|
34427
|
-
sourceDirectory: directory
|
|
34428
|
-
};
|
|
34429
|
-
if (shouldReplaceMobxFact(facts.mobx, nextMobxFact)) facts.mobx = nextMobxFact;
|
|
34430
|
-
}
|
|
34431
|
-
collectBindingVersion(facts, packageJson, directory, MOBX_REACT_PACKAGE_NAME);
|
|
34432
|
-
collectBindingVersion(facts, packageJson, directory, MOBX_REACT_LITE_PACKAGE_NAME);
|
|
34433
|
-
facts.hasMobxStateTree = facts.hasMobxStateTree || getDependencySpec(packageJson, MOBX_STATE_TREE_PACKAGE_NAME) !== null;
|
|
34434
|
-
facts.hasMobxReactObserver = facts.hasMobxReactObserver || getDependencySpec(packageJson, MOBX_REACT_OBSERVER_PACKAGE_NAME) !== null;
|
|
34435
|
-
const zustandSpec = getDependencySpec(packageJson, "zustand");
|
|
34436
|
-
if (zustandSpec !== null) {
|
|
34437
|
-
const nextZustandFact = {
|
|
34438
|
-
version: resolveCatalogBackedDependencyVersion({
|
|
34439
|
-
rootDirectory: directory,
|
|
34440
|
-
rootPackageJson: packageJson,
|
|
34441
|
-
packageName: "zustand",
|
|
34442
|
-
version: zustandSpec
|
|
34443
|
-
}),
|
|
34444
|
-
sourceDirectory: directory
|
|
34445
|
-
};
|
|
34446
|
-
if (shouldReplaceSupportedDependencyFact(facts.zustand, nextZustandFact, 5)) facts.zustand = nextZustandFact;
|
|
34447
|
-
}
|
|
34448
34164
|
if (facts.reanimatedVersion === null) {
|
|
34449
34165
|
const spec = getDependencySpec(packageJson, REANIMATED_DEPENDENCY_NAME);
|
|
34450
34166
|
if (spec !== null) facts.reanimatedVersion = spec;
|
|
34451
34167
|
}
|
|
34452
|
-
if (facts.valtioVersion === null) {
|
|
34453
|
-
const spec = getDependencySpec(packageJson, "valtio");
|
|
34454
|
-
if (spec !== null) facts.valtioVersion = spec;
|
|
34455
|
-
}
|
|
34456
|
-
facts.tanstackQueryVersion ??= getTanStackQueryVersion(packageJson);
|
|
34457
|
-
const styledComponentsVersion = resolveCatalogBackedDependencyVersion({
|
|
34458
|
-
rootDirectory: directory,
|
|
34459
|
-
rootPackageJson: packageJson,
|
|
34460
|
-
packageName: "styled-components",
|
|
34461
|
-
version: getStyledComponentsVersion(packageJson)
|
|
34462
|
-
});
|
|
34463
|
-
if (styledComponentsVersion && shouldReplaceStyledComponentsVersion(facts.styledComponentsVersion, styledComponentsVersion)) facts.styledComponentsVersion = styledComponentsVersion;
|
|
34464
|
-
facts.hasI18nLibrary = facts.hasI18nLibrary || hasI18nDependency(packageJson);
|
|
34465
|
-
for (const packageName of REACT_THREE_FIBER_DEPENDENCY_NAMES) {
|
|
34466
|
-
const version = resolveCatalogBackedDependencyVersion({
|
|
34467
|
-
rootDirectory,
|
|
34468
|
-
rootPackageJson,
|
|
34469
|
-
sourceDirectory: directory,
|
|
34470
|
-
sourcePackageJson: packageJson,
|
|
34471
|
-
packageName,
|
|
34472
|
-
version: getDependencyDeclaration({
|
|
34473
|
-
packageName,
|
|
34474
|
-
packageJson,
|
|
34475
|
-
sections: REACT_THREE_FIBER_SECTIONS
|
|
34476
|
-
}).version
|
|
34477
|
-
});
|
|
34478
|
-
if (version === null) continue;
|
|
34479
|
-
if (shouldReplaceWithLowerMajor(facts.reactThreeFiber.version, version)) facts.reactThreeFiber = {
|
|
34480
|
-
packageName,
|
|
34481
|
-
version,
|
|
34482
|
-
sourceDirectory: directory
|
|
34483
|
-
};
|
|
34484
|
-
}
|
|
34485
|
-
const threeVersion = resolveCatalogBackedDependencyVersion({
|
|
34486
|
-
rootDirectory,
|
|
34487
|
-
rootPackageJson,
|
|
34488
|
-
sourceDirectory: directory,
|
|
34489
|
-
sourcePackageJson: packageJson,
|
|
34490
|
-
packageName: "three",
|
|
34491
|
-
version: getDependencyDeclaration({
|
|
34492
|
-
packageName: "three",
|
|
34493
|
-
packageJson,
|
|
34494
|
-
sections: THREE_DEPENDENCY_SECTIONS
|
|
34495
|
-
}).version
|
|
34496
|
-
});
|
|
34497
|
-
if (threeVersion !== null) {
|
|
34498
|
-
const currentRelease = parseThreeRelease(facts.threeVersion);
|
|
34499
|
-
const nextRelease = parseThreeRelease(threeVersion);
|
|
34500
|
-
if (facts.threeVersion === null || nextRelease !== null && (currentRelease === null || nextRelease < currentRelease)) facts.threeVersion = threeVersion;
|
|
34501
|
-
}
|
|
34502
34168
|
facts.hasReactNativeAwarePackage = facts.hasReactNativeAwarePackage || isPackageJsonReactNativeAware(packageJson);
|
|
34503
34169
|
facts.hasReanimatedAwarePackage = facts.hasReanimatedAwarePackage || isPackageJsonReanimatedAware(packageJson);
|
|
34504
34170
|
facts.hasSsrDependency = facts.hasSsrDependency || isPackageJsonSsrAware(packageJson);
|
|
34505
|
-
const remotionSpec = getDependencySpec(packageJson, "remotion");
|
|
34506
|
-
if (remotionSpec !== null) {
|
|
34507
|
-
facts.hasRemotionDependency = true;
|
|
34508
|
-
const resolvedRemotionVersion = resolveCatalogBackedDependencyVersion({
|
|
34509
|
-
rootDirectory,
|
|
34510
|
-
rootPackageJson,
|
|
34511
|
-
packageName: "remotion",
|
|
34512
|
-
version: remotionSpec
|
|
34513
|
-
});
|
|
34514
|
-
const remotionMajorVersion = resolvedRemotionVersion === null ? null : getLowestDependencyMajor(resolvedRemotionVersion);
|
|
34515
|
-
if (remotionMajorVersion === null) {
|
|
34516
|
-
facts.hasUnknownRemotionVersion = true;
|
|
34517
|
-
facts.remotionVersion = null;
|
|
34518
|
-
} else if (!facts.hasUnknownRemotionVersion) {
|
|
34519
|
-
const currentRemotionMajorVersion = facts.remotionVersion === null ? null : getLowestDependencyMajor(facts.remotionVersion);
|
|
34520
|
-
if (currentRemotionMajorVersion === null || remotionMajorVersion < currentRemotionMajorVersion) facts.remotionVersion = resolvedRemotionVersion;
|
|
34521
|
-
}
|
|
34522
|
-
}
|
|
34523
|
-
facts.hasThree = facts.hasThree || THREE_DEPENDENCY_NAMES.some((dependencyName) => getDependencySpec(packageJson, dependencyName) !== null);
|
|
34524
|
-
facts.hasReactThreeFiber = facts.hasReactThreeFiber || REACT_THREE_FIBER_ECOSYSTEM_DEPENDENCY_NAMES.some((dependencyName) => getDependencySpec(packageJson, dependencyName) !== null);
|
|
34525
34171
|
};
|
|
34526
34172
|
const collectWorkspaceFacts = (rootDirectory, rootPackageJson, { collectReactGroup }) => {
|
|
34527
34173
|
const facts = {
|
|
@@ -34537,60 +34183,25 @@ const collectWorkspaceFacts = (rootDirectory, rootPackageJson, { collectReactGro
|
|
|
34537
34183
|
version: null,
|
|
34538
34184
|
sourceDirectory: null
|
|
34539
34185
|
},
|
|
34540
|
-
reactRouter: {
|
|
34541
|
-
version: null,
|
|
34542
|
-
sourceDirectory: null,
|
|
34543
|
-
packageName: null
|
|
34544
|
-
},
|
|
34545
34186
|
shopifyFlashList: {
|
|
34546
34187
|
version: null,
|
|
34547
34188
|
sourceDirectory: null
|
|
34548
34189
|
},
|
|
34549
|
-
valtioVersion: null,
|
|
34550
|
-
mobx: {
|
|
34551
|
-
version: null,
|
|
34552
|
-
sourceDirectory: null
|
|
34553
|
-
},
|
|
34554
|
-
hasMobxReact: false,
|
|
34555
|
-
mobxReactVersion: null,
|
|
34556
|
-
hasMobxReactLite: false,
|
|
34557
|
-
mobxReactLiteVersion: null,
|
|
34558
|
-
hasMobxStateTree: false,
|
|
34559
|
-
hasMobxReactObserver: false,
|
|
34560
|
-
zustand: {
|
|
34561
|
-
version: null,
|
|
34562
|
-
sourceDirectory: null
|
|
34563
|
-
},
|
|
34564
|
-
tanstackQueryVersion: null,
|
|
34565
|
-
styledComponentsVersion: null,
|
|
34566
|
-
hasI18nLibrary: false,
|
|
34567
34190
|
hasReactNativeAwarePackage: false,
|
|
34568
34191
|
hasReanimatedAwarePackage: false,
|
|
34569
34192
|
hasSsrDependency: false,
|
|
34570
|
-
hasRemotionDependency: false,
|
|
34571
|
-
hasUnknownRemotionVersion: false,
|
|
34572
|
-
remotionVersion: null,
|
|
34573
|
-
hasThree: false,
|
|
34574
|
-
threeVersion: null,
|
|
34575
|
-
hasReactThreeFiber: false,
|
|
34576
|
-
reactThreeFiber: {
|
|
34577
|
-
packageName: null,
|
|
34578
|
-
version: null,
|
|
34579
|
-
sourceDirectory: null
|
|
34580
|
-
},
|
|
34581
|
-
hasReactRouterFramework: false,
|
|
34582
34193
|
reanimatedVersion: null
|
|
34583
34194
|
};
|
|
34584
|
-
evaluateManifestFacts(facts, rootPackageJson, rootDirectory
|
|
34195
|
+
evaluateManifestFacts(facts, rootPackageJson, rootDirectory);
|
|
34585
34196
|
let isReactGroupSettled = !collectReactGroup;
|
|
34586
34197
|
const visitedDirectories = /* @__PURE__ */ new Set();
|
|
34587
34198
|
for (const pattern of getWorkspacePatterns(rootDirectory, rootPackageJson)) {
|
|
34588
|
-
const directories = resolveWorkspaceDirectories(rootDirectory, pattern).
|
|
34199
|
+
const directories = [...resolveWorkspaceDirectories(rootDirectory, pattern)].sort();
|
|
34589
34200
|
for (const workspaceDirectory of directories) {
|
|
34590
34201
|
if (visitedDirectories.has(workspaceDirectory)) continue;
|
|
34591
34202
|
visitedDirectories.add(workspaceDirectory);
|
|
34592
34203
|
const workspacePackageJson = readPackageJson(Path.join(workspaceDirectory, "package.json"));
|
|
34593
|
-
evaluateManifestFacts(facts, workspacePackageJson, workspaceDirectory
|
|
34204
|
+
evaluateManifestFacts(facts, workspacePackageJson, workspaceDirectory);
|
|
34594
34205
|
const info = extractDependencyInfo(workspacePackageJson);
|
|
34595
34206
|
if (info.framework !== "unknown" && frameworkMergeRank(info.framework) < frameworkMergeRank(facts.framework)) facts.framework = info.framework;
|
|
34596
34207
|
if (isReactGroupSettled) continue;
|
|
@@ -34621,7 +34232,7 @@ const collectWorkspaceFacts = (rootDirectory, rootPackageJson, { collectReactGro
|
|
|
34621
34232
|
workspaceDirectory,
|
|
34622
34233
|
workspacePackageJson
|
|
34623
34234
|
});
|
|
34624
|
-
if (reactVersion &&
|
|
34235
|
+
if (reactVersion && shouldReplaceReactVersion(facts.reactVersion, reactVersion)) facts.reactVersion = reactVersion;
|
|
34625
34236
|
if (tailwindVersion && !facts.tailwindVersion) facts.tailwindVersion = tailwindVersion;
|
|
34626
34237
|
if (zodVersion && !facts.zodVersion) facts.zodVersion = zodVersion;
|
|
34627
34238
|
const settledReactMajor = parseReactMajor(facts.reactVersion);
|
|
@@ -34814,43 +34425,17 @@ const discoverProjectWithoutPackageJson = (directory) => {
|
|
|
34814
34425
|
tailwindVersion: null,
|
|
34815
34426
|
zodVersion: null,
|
|
34816
34427
|
zodMajorVersion: null,
|
|
34817
|
-
mobxVersion: null,
|
|
34818
|
-
mobxMajorVersion: null,
|
|
34819
|
-
hasMobxReact: false,
|
|
34820
|
-
mobxReactVersion: null,
|
|
34821
|
-
hasMobxReactLite: false,
|
|
34822
|
-
mobxReactLiteVersion: null,
|
|
34823
|
-
hasMobxStateTree: false,
|
|
34824
|
-
hasMobxReactObserver: false,
|
|
34825
|
-
zustandVersion: null,
|
|
34826
|
-
zustandMajorVersion: null,
|
|
34827
34428
|
framework: "unknown",
|
|
34828
34429
|
hasTypeScript: hasOwnTsConfig,
|
|
34829
34430
|
hasReactCompiler: false,
|
|
34830
34431
|
hasReactCompilerLintPlugin: false,
|
|
34831
34432
|
hasTanStackQuery: false,
|
|
34832
|
-
valtioVersion: null,
|
|
34833
|
-
valtioMajorVersion: null,
|
|
34834
|
-
hasRemotion: false,
|
|
34835
|
-
remotionVersion: null,
|
|
34836
|
-
remotionMajorVersion: null,
|
|
34837
|
-
hasI18nLibrary: false,
|
|
34838
|
-
tanstackQueryVersion: null,
|
|
34839
|
-
styledComponentsVersion: null,
|
|
34840
|
-
hasThree: false,
|
|
34841
|
-
threeVersion: null,
|
|
34842
|
-
threeRelease: null,
|
|
34843
|
-
hasReactThreeFiber: false,
|
|
34844
|
-
reactThreeFiberVersion: null,
|
|
34845
|
-
reactThreeFiberMajorVersion: null,
|
|
34846
34433
|
hasSsrDependency: false,
|
|
34847
34434
|
preactVersion: null,
|
|
34848
34435
|
preactMajorVersion: null,
|
|
34849
34436
|
hasReactNativeWorkspace: false,
|
|
34850
34437
|
nextjsVersion: null,
|
|
34851
34438
|
nextjsMajorVersion: null,
|
|
34852
|
-
reactRouterVersion: null,
|
|
34853
|
-
hasReactRouterFramework: false,
|
|
34854
34439
|
expoVersion: null,
|
|
34855
34440
|
shopifyFlashListVersion: null,
|
|
34856
34441
|
shopifyFlashListMajorVersion: null,
|
|
@@ -34943,12 +34528,6 @@ const discoverProject = (directory) => {
|
|
|
34943
34528
|
packageName: SHOPIFY_FLASH_LIST_PACKAGE_NAME,
|
|
34944
34529
|
version: workspaceFacts.shopifyFlashList.version
|
|
34945
34530
|
}) : null;
|
|
34946
|
-
const zustandVersion = resolveCatalogBackedDependencyVersion({
|
|
34947
|
-
rootDirectory: directory,
|
|
34948
|
-
rootPackageJson: packageJson,
|
|
34949
|
-
packageName: "zustand",
|
|
34950
|
-
version: workspaceFacts.zustand.version
|
|
34951
|
-
});
|
|
34952
34531
|
const hasReanimated = hasReactNativeWorkspace && workspaceFacts.hasReanimatedAwarePackage;
|
|
34953
34532
|
const reanimatedVersion = hasReanimated ? workspaceFacts.reanimatedVersion : null;
|
|
34954
34533
|
const nextjsVersion = framework === "nextjs" ? resolveCatalogBackedDependencyVersion({
|
|
@@ -34957,39 +34536,7 @@ const discoverProject = (directory) => {
|
|
|
34957
34536
|
packageName: "next",
|
|
34958
34537
|
version: workspaceFacts.next.version
|
|
34959
34538
|
}) : null;
|
|
34960
|
-
const valtioVersion = resolveCatalogBackedDependencyVersion({
|
|
34961
|
-
rootDirectory: directory,
|
|
34962
|
-
rootPackageJson: packageJson,
|
|
34963
|
-
packageName: "valtio",
|
|
34964
|
-
version: workspaceFacts.valtioVersion
|
|
34965
|
-
});
|
|
34966
|
-
const mobxVersion = resolveCatalogBackedDependencyVersion({
|
|
34967
|
-
rootDirectory: directory,
|
|
34968
|
-
rootPackageJson: packageJson,
|
|
34969
|
-
packageName: "mobx",
|
|
34970
|
-
version: workspaceFacts.mobx.version
|
|
34971
|
-
});
|
|
34972
|
-
const reactRouterVersion = workspaceFacts.reactRouter.packageName === null ? null : resolveCatalogBackedDependencyVersion({
|
|
34973
|
-
rootDirectory: directory,
|
|
34974
|
-
rootPackageJson: packageJson,
|
|
34975
|
-
packageName: workspaceFacts.reactRouter.packageName,
|
|
34976
|
-
version: workspaceFacts.reactRouter.version
|
|
34977
|
-
});
|
|
34978
34539
|
const preactVersion = getPreactVersion(packageJson);
|
|
34979
|
-
const remotionVersion = workspaceFacts.remotionVersion;
|
|
34980
|
-
const tanstackQueryVersion = getTanStackQueryVersion(packageJson) ?? workspaceFacts.tanstackQueryVersion;
|
|
34981
|
-
const reactThreeFiberVersion = workspaceFacts.reactThreeFiber.packageName ? resolveCatalogBackedDependencyVersion({
|
|
34982
|
-
rootDirectory: directory,
|
|
34983
|
-
rootPackageJson: packageJson,
|
|
34984
|
-
packageName: workspaceFacts.reactThreeFiber.packageName,
|
|
34985
|
-
version: workspaceFacts.reactThreeFiber.version
|
|
34986
|
-
}) : null;
|
|
34987
|
-
const threeVersion = resolveCatalogBackedDependencyVersion({
|
|
34988
|
-
rootDirectory: directory,
|
|
34989
|
-
rootPackageJson: packageJson,
|
|
34990
|
-
packageName: "three",
|
|
34991
|
-
version: workspaceFacts.threeVersion
|
|
34992
|
-
});
|
|
34993
34540
|
const isPreES2023Target = hasTypeScript && detectPreES2023Target(directory);
|
|
34994
34541
|
const projectInfo = {
|
|
34995
34542
|
rootDirectory: directory,
|
|
@@ -34999,43 +34546,17 @@ const discoverProject = (directory) => {
|
|
|
34999
34546
|
tailwindVersion,
|
|
35000
34547
|
zodVersion,
|
|
35001
34548
|
zodMajorVersion: zodVersion === null ? null : getLowestDependencyMajor(zodVersion),
|
|
35002
|
-
mobxVersion,
|
|
35003
|
-
mobxMajorVersion: mobxVersion === null ? null : getDependencyMajorWithinSupportedRange(mobxVersion, 6),
|
|
35004
|
-
hasMobxReact: workspaceFacts.hasMobxReact,
|
|
35005
|
-
mobxReactVersion: workspaceFacts.mobxReactVersion,
|
|
35006
|
-
hasMobxReactLite: workspaceFacts.hasMobxReactLite,
|
|
35007
|
-
mobxReactLiteVersion: workspaceFacts.mobxReactLiteVersion,
|
|
35008
|
-
hasMobxStateTree: workspaceFacts.hasMobxStateTree,
|
|
35009
|
-
hasMobxReactObserver: workspaceFacts.hasMobxReactObserver,
|
|
35010
|
-
zustandVersion,
|
|
35011
|
-
zustandMajorVersion: zustandVersion === null ? null : getLowestDependencyMajor(zustandVersion),
|
|
35012
34549
|
framework,
|
|
35013
34550
|
hasTypeScript,
|
|
35014
34551
|
hasReactCompiler: detectReactCompiler(directory, packageJson),
|
|
35015
34552
|
hasReactCompilerLintPlugin: detectReactCompilerLintPlugin(directory, packageJson),
|
|
35016
|
-
hasTanStackQuery:
|
|
35017
|
-
hasI18nLibrary: workspaceFacts.hasI18nLibrary,
|
|
35018
|
-
tanstackQueryVersion,
|
|
35019
|
-
styledComponentsVersion: workspaceFacts.styledComponentsVersion,
|
|
35020
|
-
valtioVersion,
|
|
35021
|
-
valtioMajorVersion: valtioVersion === null ? null : getLowestDependencyMajor(valtioVersion),
|
|
35022
|
-
hasRemotion: workspaceFacts.hasRemotionDependency,
|
|
35023
|
-
remotionVersion,
|
|
35024
|
-
remotionMajorVersion: remotionVersion === null ? null : getLowestDependencyMajor(remotionVersion),
|
|
35025
|
-
hasThree: workspaceFacts.hasThree,
|
|
35026
|
-
threeVersion,
|
|
35027
|
-
threeRelease: parseThreeRelease(threeVersion),
|
|
35028
|
-
hasReactThreeFiber: workspaceFacts.hasReactThreeFiber,
|
|
35029
|
-
reactThreeFiberVersion,
|
|
35030
|
-
reactThreeFiberMajorVersion: reactThreeFiberVersion === null ? null : getLowestDependencyMajor(reactThreeFiberVersion),
|
|
34553
|
+
hasTanStackQuery: hasTanStackQuery(packageJson),
|
|
35031
34554
|
hasSsrDependency: workspaceFacts.hasSsrDependency,
|
|
35032
34555
|
preactVersion,
|
|
35033
34556
|
preactMajorVersion: parseReactMajor(preactVersion),
|
|
35034
34557
|
hasReactNativeWorkspace,
|
|
35035
34558
|
nextjsVersion,
|
|
35036
34559
|
nextjsMajorVersion: nextjsVersion === null ? null : getLowestDependencyMajor(nextjsVersion),
|
|
35037
|
-
reactRouterVersion,
|
|
35038
|
-
hasReactRouterFramework: workspaceFacts.hasReactRouterFramework,
|
|
35039
34560
|
expoVersion,
|
|
35040
34561
|
shopifyFlashListVersion,
|
|
35041
34562
|
shopifyFlashListMajorVersion: shopifyFlashListVersion === null ? null : getLowestDependencyMajor(shopifyFlashListVersion),
|
|
@@ -35263,6 +34784,7 @@ const LEGACY_RULE_KEY_TO_NATIVE_RULE_KEY = {
|
|
|
35263
34784
|
"react/jsx-no-new-function-as-prop": "react-doctor/jsx-no-new-function-as-prop",
|
|
35264
34785
|
"react/jsx-no-new-object-as-prop": "react-doctor/jsx-no-new-object-as-prop",
|
|
35265
34786
|
"react/jsx-no-script-url": "react-doctor/jsx-no-script-url",
|
|
34787
|
+
"react/jsx-no-target-blank": "react-doctor/jsx-no-target-blank",
|
|
35266
34788
|
"react/jsx-no-undef": "react-doctor/jsx-no-undef",
|
|
35267
34789
|
"react/jsx-no-useless-fragment": "react-doctor/jsx-no-useless-fragment",
|
|
35268
34790
|
"react/jsx-pascal-case": "react-doctor/jsx-pascal-case",
|
|
@@ -37549,25 +37071,9 @@ const BABEL_CONFIG_FILE_NAMES = [
|
|
|
37549
37071
|
".babelrc.json"
|
|
37550
37072
|
];
|
|
37551
37073
|
const LEGACY_PRESET_SPEC = "module:metro-react-native-babel-preset";
|
|
37552
|
-
const LEGACY_PRESET_PACKAGE = "metro-react-native-babel-preset";
|
|
37553
|
-
const REACT_NATIVE_PACKAGE = "react-native";
|
|
37554
|
-
const PRESET_RENAME_MINIMUM_REACT_NATIVE_VERSION = "0.73.0";
|
|
37555
|
-
const LEGACY_PRESET_REFERENCE = new RegExp(`['"]${LEGACY_PRESET_SPEC}['"]`);
|
|
37556
37074
|
const MODERN_PRESET_REFERENCE = new RegExp(`['"]module:@react-native/babel-preset['"]`);
|
|
37557
37075
|
const ENABLE_BABEL_RUNTIME_VERSION = /enableBabelRuntime["']?\s*:\s*['"]/;
|
|
37558
|
-
const isReactNativeVersionAtLeastPresetRename = (rootDirectory, packageJson) => {
|
|
37559
|
-
const installedReactNativeManifestPath = Path.join(rootDirectory, "node_modules", REACT_NATIVE_PACKAGE, "package.json");
|
|
37560
|
-
const reactNativeVersionSpec = (isFile(installedReactNativeManifestPath) ? readPackageJson(installedReactNativeManifestPath).version : void 0) ?? getDependencySpec(packageJson, REACT_NATIVE_PACKAGE);
|
|
37561
|
-
if (reactNativeVersionSpec === null || reactNativeVersionSpec === void 0) return false;
|
|
37562
|
-
const normalizedVersionRange = import_semver.validRange(reactNativeVersionSpec);
|
|
37563
|
-
if (normalizedVersionRange === null) return false;
|
|
37564
|
-
const minimumVersion = import_semver.minVersion(normalizedVersionRange);
|
|
37565
|
-
return minimumVersion !== null && import_semver.gte(minimumVersion, PRESET_RENAME_MINIMUM_REACT_NATIVE_VERSION);
|
|
37566
|
-
};
|
|
37567
|
-
const canResolveLegacyPreset = (rootDirectory, packageJson) => getDependencySpec(packageJson, LEGACY_PRESET_PACKAGE) !== null || isFile(Path.join(rootDirectory, "node_modules", LEGACY_PRESET_PACKAGE, "package.json"));
|
|
37568
37076
|
const checkReactNativeMetroBabelPreset = (rootDirectory) => {
|
|
37569
|
-
const packageJson = readPackageJson(Path.join(rootDirectory, "package.json"));
|
|
37570
|
-
const shouldReportLegacyPreset = isReactNativeVersionAtLeastPresetRename(rootDirectory, packageJson) && !canResolveLegacyPreset(rootDirectory, packageJson);
|
|
37571
37077
|
for (const fileName of BABEL_CONFIG_FILE_NAMES) {
|
|
37572
37078
|
const filePath = Path.join(rootDirectory, fileName);
|
|
37573
37079
|
if (!isFile(filePath)) continue;
|
|
@@ -37577,7 +37083,7 @@ const checkReactNativeMetroBabelPreset = (rootDirectory) => {
|
|
|
37577
37083
|
} catch {
|
|
37578
37084
|
continue;
|
|
37579
37085
|
}
|
|
37580
|
-
if (
|
|
37086
|
+
if (contents.includes(LEGACY_PRESET_SPEC)) return [buildReactNativeDiagnostic({
|
|
37581
37087
|
filePath: fileName,
|
|
37582
37088
|
rule: "rn-no-metro-babel-preset",
|
|
37583
37089
|
severity: "error",
|
|
@@ -37600,6 +37106,12 @@ const checkReactNativeProject = (rootDirectory, project) => {
|
|
|
37600
37106
|
return [...checkReactNativeMetroBabelPreset(rootDirectory), ...checkReactNativeLibraryDependencies(rootDirectory)];
|
|
37601
37107
|
};
|
|
37602
37108
|
const RULE_KEY = "no-vulnerable-react-server-components";
|
|
37109
|
+
const DEPENDENCY_SECTIONS = [
|
|
37110
|
+
"dependencies",
|
|
37111
|
+
"devDependencies",
|
|
37112
|
+
"peerDependencies",
|
|
37113
|
+
"optionalDependencies"
|
|
37114
|
+
];
|
|
37603
37115
|
const REACT_RSC_ADVISORIES_BY_MINOR = {
|
|
37604
37116
|
"19.0": {
|
|
37605
37117
|
rceFixedVersion: "19.0.1",
|
|
@@ -37646,13 +37158,20 @@ const enumerateWorkspaceDirectories = (workspaceRoot) => {
|
|
|
37646
37158
|
for (const pattern of patterns) for (const directory of resolveWorkspaceDirectories(workspaceRoot, pattern)) directories.add(directory);
|
|
37647
37159
|
return [...directories];
|
|
37648
37160
|
};
|
|
37161
|
+
const readDeclaredSpec = (packageJson, packageName) => {
|
|
37162
|
+
for (const section of DEPENDENCY_SECTIONS) {
|
|
37163
|
+
const spec = packageJson[section]?.[packageName];
|
|
37164
|
+
if (typeof spec === "string") return spec;
|
|
37165
|
+
}
|
|
37166
|
+
return null;
|
|
37167
|
+
};
|
|
37649
37168
|
const resolveVersionInDirectory = (directory, packageName, declaredSpecOverride) => {
|
|
37650
37169
|
const manifestPath = Path.join(directory, "node_modules", packageName, "package.json");
|
|
37651
37170
|
if (isFile(manifestPath)) {
|
|
37652
37171
|
const installedVersion = import_semver.valid(readPackageJson(manifestPath).version ?? null);
|
|
37653
37172
|
if (installedVersion !== null) return installedVersion;
|
|
37654
37173
|
}
|
|
37655
|
-
const candidateSpecs = [
|
|
37174
|
+
const candidateSpecs = [readDeclaredSpec(readPackageJson(Path.join(directory, "package.json")), packageName), declaredSpecOverride];
|
|
37656
37175
|
for (const spec of candidateSpecs) {
|
|
37657
37176
|
const pinnedVersion = spec === null ? null : import_semver.valid(spec);
|
|
37658
37177
|
if (pinnedVersion !== null) return pinnedVersion;
|
|
@@ -38304,10 +37823,10 @@ const SSR_FRAMEWORKS = new Set([
|
|
|
38304
37823
|
"gatsby",
|
|
38305
37824
|
"tanstack-start"
|
|
38306
37825
|
]);
|
|
38307
|
-
const
|
|
38308
|
-
if (
|
|
38309
|
-
const
|
|
38310
|
-
for (let candidate = earliest; candidate <=
|
|
37826
|
+
const addMajorLadder = (capabilities, name, major, earliest, latest) => {
|
|
37827
|
+
if (major === null) return;
|
|
37828
|
+
const cappedMajor = Math.min(major, latest);
|
|
37829
|
+
for (let candidate = earliest; candidate <= cappedMajor; candidate += 1) capabilities.add(`${name}:${candidate}`);
|
|
38311
37830
|
};
|
|
38312
37831
|
const buildCapabilities = (project) => {
|
|
38313
37832
|
const capabilities = /* @__PURE__ */ new Set();
|
|
@@ -38320,86 +37839,24 @@ const buildCapabilities = (project) => {
|
|
|
38320
37839
|
if (CLIENT_ONLY_FRAMEWORKS.has(project.framework)) capabilities.add("client-only");
|
|
38321
37840
|
if (project.isStaticExport) capabilities.add("nextjs:static-export");
|
|
38322
37841
|
if (project.nextjsMajorVersion !== null && project.nextjsMajorVersion >= 15) capabilities.add("nextjs:15");
|
|
38323
|
-
|
|
38324
|
-
const reactRouterVersion = project.reactRouterVersion ?? null;
|
|
38325
|
-
if (reactRouterVersion !== null) {
|
|
38326
|
-
capabilities.add("react-router");
|
|
38327
|
-
if (project.hasReactRouterFramework === true) capabilities.add("react-router-framework");
|
|
38328
|
-
const detectedVersion = parseReactMajorMinor(reactRouterVersion);
|
|
38329
|
-
if (detectedVersion !== null) {
|
|
38330
|
-
for (const threshold of REACT_ROUTER_CAPABILITY_THRESHOLDS) if (isMajorMinorAtLeast(detectedVersion, threshold)) capabilities.add(threshold.capability);
|
|
38331
|
-
}
|
|
38332
|
-
}
|
|
38333
|
-
addVersionCapabilityLadder(capabilities, "react", project.reactMajorVersion, 17, 30);
|
|
37842
|
+
addMajorLadder(capabilities, "react", project.reactMajorVersion, 17, 30);
|
|
38334
37843
|
if (project.reactMajorVersion !== null && project.reactMajorVersion >= 19 && isMajorMinorAtLeast(parseReactMajorMinor(project.reactVersion), {
|
|
38335
37844
|
major: 19,
|
|
38336
37845
|
minor: 2
|
|
38337
37846
|
})) capabilities.add("react:19.2");
|
|
38338
|
-
if (project.tailwindVersion !== null)
|
|
38339
|
-
|
|
38340
|
-
|
|
38341
|
-
|
|
38342
|
-
|
|
38343
|
-
minor: 4
|
|
38344
|
-
})) capabilities.add("tailwind:3.4");
|
|
38345
|
-
if (tailwindVersion !== null && isMajorMinorAtLeast(tailwindVersion, {
|
|
38346
|
-
major: 4,
|
|
38347
|
-
minor: 0
|
|
38348
|
-
})) capabilities.add("tailwind:4");
|
|
38349
|
-
}
|
|
37847
|
+
if (project.tailwindVersion !== null) capabilities.add("tailwind");
|
|
37848
|
+
if (project.tailwindVersion !== null && isMajorMinorAtLeast(parseTailwindMajorMinor(project.tailwindVersion), {
|
|
37849
|
+
major: 3,
|
|
37850
|
+
minor: 4
|
|
37851
|
+
})) capabilities.add("tailwind:3.4");
|
|
38350
37852
|
if (project.zodVersion !== null) capabilities.add("zod");
|
|
38351
37853
|
if (project.zodMajorVersion !== null && project.zodMajorVersion >= 4) capabilities.add("zod:4");
|
|
38352
|
-
if (project.mobxVersion !== void 0 && project.mobxVersion !== null || project.hasMobxReact === true || project.hasMobxReactLite === true || project.hasMobxStateTree === true || project.hasMobxReactObserver === true) capabilities.add("mobx");
|
|
38353
|
-
if (project.hasMobxReact === true) capabilities.add("mobx-react");
|
|
38354
|
-
if (project.hasMobxReactLite === true) capabilities.add("mobx-react-lite");
|
|
38355
|
-
if (project.hasMobxReact === true || project.hasMobxReactLite === true) capabilities.add("mobx-react-binding");
|
|
38356
|
-
const mobxReactVersion = parseDependencyMajorMinor(project.mobxReactVersion);
|
|
38357
|
-
const mobxReactLiteVersion = parseDependencyMajorMinor(project.mobxReactLiteVersion);
|
|
38358
|
-
const hasMobxReactObserverMemoGuard = mobxReactVersion !== null && isMajorMinorAtLeast(mobxReactVersion, {
|
|
38359
|
-
major: 7,
|
|
38360
|
-
minor: 3
|
|
38361
|
-
});
|
|
38362
|
-
const hasMobxReactLiteObserverMemoGuard = mobxReactLiteVersion !== null && isMajorMinorAtLeast(mobxReactLiteVersion, {
|
|
38363
|
-
major: 3,
|
|
38364
|
-
minor: 3
|
|
38365
|
-
});
|
|
38366
|
-
if (hasMobxReactObserverMemoGuard) capabilities.add("mobx-react-observer-memo-guard");
|
|
38367
|
-
if (hasMobxReactLiteObserverMemoGuard) capabilities.add("mobx-react-lite-observer-memo-guard");
|
|
38368
|
-
if (hasMobxReactObserverMemoGuard || hasMobxReactLiteObserverMemoGuard) capabilities.add("mobx-react-binding-observer-memo-guard");
|
|
38369
|
-
if (project.hasMobxStateTree === true) capabilities.add("mobx-state-tree");
|
|
38370
|
-
if (project.hasMobxReactObserver === true) capabilities.add("mobx-react-observer");
|
|
38371
|
-
if (project.mobxMajorVersion !== void 0 && project.mobxMajorVersion !== null && project.mobxMajorVersion >= 4 && project.mobxMajorVersion <= 6) addVersionCapabilityLadder(capabilities, "mobx", project.mobxMajorVersion, 4, 6);
|
|
38372
|
-
const mobxVersion = parseDependencyMajorMinor(project.mobxVersion);
|
|
38373
|
-
if (project.mobxMajorVersion === 6 && mobxVersion !== null && isMajorMinorAtLeast(mobxVersion, {
|
|
38374
|
-
major: 6,
|
|
38375
|
-
minor: 10
|
|
38376
|
-
})) capabilities.add("mobx:6.10");
|
|
38377
|
-
if (project.zustandVersion !== void 0 && project.zustandVersion !== null) capabilities.add("zustand");
|
|
38378
|
-
if (project.zustandMajorVersion !== void 0 && project.zustandMajorVersion !== null && project.zustandMajorVersion >= 1 && project.zustandMajorVersion <= 5) addVersionCapabilityLadder(capabilities, "zustand", project.zustandMajorVersion, 1, 5);
|
|
38379
37854
|
if (project.isPreES2023Target) capabilities.add("pre-es2023");
|
|
38380
37855
|
if (project.hasReactCompiler) capabilities.add("react-compiler");
|
|
38381
|
-
if (
|
|
38382
|
-
if (project.styledComponentsVersion) {
|
|
38383
|
-
capabilities.add("styled-components");
|
|
38384
|
-
const styledComponentsMajor = getLowestDependencyMajor(project.styledComponentsVersion);
|
|
38385
|
-
if (styledComponentsMajor !== null && styledComponentsMajor >= 6) capabilities.add("styled-components:6");
|
|
38386
|
-
}
|
|
38387
|
-
if (project.hasI18nLibrary) capabilities.add("i18n");
|
|
38388
|
-
if (project.valtioVersion !== null) capabilities.add("valtio");
|
|
38389
|
-
addVersionCapabilityLadder(capabilities, "valtio", project.valtioMajorVersion, 1, 10);
|
|
38390
|
-
if (project.hasRemotion) {
|
|
38391
|
-
capabilities.add("remotion");
|
|
38392
|
-
addVersionCapabilityLadder(capabilities, "remotion", project.remotionMajorVersion ?? null, 4, 30);
|
|
38393
|
-
}
|
|
38394
|
-
if (project.hasThree || project.hasReactThreeFiber) capabilities.add("three");
|
|
38395
|
-
addVersionCapabilityLadder(capabilities, "three", project.threeRelease ?? null, 145, 250);
|
|
38396
|
-
if (project.hasReactThreeFiber) {
|
|
38397
|
-
capabilities.add("r3f");
|
|
38398
|
-
addVersionCapabilityLadder(capabilities, "r3f", project.reactThreeFiberMajorVersion ?? null, 3, 10);
|
|
38399
|
-
}
|
|
37856
|
+
if (project.hasTanStackQuery) capabilities.add("tanstack-query");
|
|
38400
37857
|
if (project.hasTypeScript) capabilities.add("typescript");
|
|
38401
37858
|
if (project.preactVersion !== null) capabilities.add("preact");
|
|
38402
|
-
|
|
37859
|
+
addMajorLadder(capabilities, "preact", project.preactMajorVersion, 10, 20);
|
|
38403
37860
|
if (project.preactVersion !== null && project.reactVersion === null) capabilities.add("pure-preact");
|
|
38404
37861
|
return capabilities;
|
|
38405
37862
|
};
|
|
@@ -38411,7 +37868,7 @@ const getCapabilities = (project) => {
|
|
|
38411
37868
|
capabilitiesByProject.set(project, capabilities);
|
|
38412
37869
|
return capabilities;
|
|
38413
37870
|
};
|
|
38414
|
-
const shouldEnableRule = (requires, tags, capabilities, ignoredTags, disabledWhen
|
|
37871
|
+
const shouldEnableRule = (requires, tags, capabilities, ignoredTags, disabledWhen) => {
|
|
38415
37872
|
if (requires) {
|
|
38416
37873
|
for (const capability of requires) if (!capabilities.has(capability)) return false;
|
|
38417
37874
|
}
|
|
@@ -38422,29 +37879,20 @@ const shouldEnableRule = (requires, tags, capabilities, ignoredTags, disabledWhe
|
|
|
38422
37879
|
if (tags) {
|
|
38423
37880
|
for (const tag of tags) if (ignoredTags.has(tag)) return false;
|
|
38424
37881
|
}
|
|
38425
|
-
if (includedTags && includedTags.size > 0) {
|
|
38426
|
-
if (!tags?.some((tag) => includedTags.has(tag))) return false;
|
|
38427
|
-
}
|
|
38428
37882
|
return true;
|
|
38429
37883
|
};
|
|
38430
|
-
const shouldEnableRuleByDefaultStatus = (options) => options.defaultEnabled !== false || options.hasExplicitOverride === true || options.includeTagDefaults && options.hasIncludedTags;
|
|
38431
37884
|
const yieldToEventLoop = () => new Promise((resolve) => {
|
|
38432
37885
|
setImmediate(resolve);
|
|
38433
37886
|
});
|
|
38434
37887
|
const createSecurityScanSession = (rootDirectory, options) => {
|
|
38435
37888
|
const capabilities = options.project ? getCapabilities(options.project) : /* @__PURE__ */ new Set();
|
|
38436
37889
|
const ignoredTags = options.ignoredTags ?? /* @__PURE__ */ new Set();
|
|
38437
|
-
const includedTags = options.includedTags ?? /* @__PURE__ */ new Set();
|
|
38438
37890
|
const enabledScanRules = REACT_DOCTOR_RULES.flatMap((entry) => {
|
|
38439
37891
|
const rule = entry.rule;
|
|
38440
37892
|
const scan = rule.scan;
|
|
38441
37893
|
if (typeof scan !== "function") return [];
|
|
38442
|
-
if (
|
|
38443
|
-
|
|
38444
|
-
includeTagDefaults: options.includeTagDefaults === true,
|
|
38445
|
-
hasIncludedTags: includedTags.size > 0
|
|
38446
|
-
})) return [];
|
|
38447
|
-
if (!shouldEnableRule(rule.requires, rule.tags, capabilities, ignoredTags, rule.disabledWhen, includedTags)) return [];
|
|
37894
|
+
if (rule.defaultEnabled === false) return [];
|
|
37895
|
+
if (!shouldEnableRule(rule.requires, rule.tags, capabilities, ignoredTags, rule.disabledWhen)) return [];
|
|
38448
37896
|
return [{
|
|
38449
37897
|
entry,
|
|
38450
37898
|
scan,
|
|
@@ -40430,9 +39878,8 @@ const buildUserPluginRules = (userPlugin, severityControls) => {
|
|
|
40430
39878
|
}
|
|
40431
39879
|
return enabled;
|
|
40432
39880
|
};
|
|
40433
|
-
const createOxlintConfig = ({ pluginPath, project, customRulesOnly = false, extendsPaths = [], ignoredTags = /* @__PURE__ */ new Set(),
|
|
40434
|
-
const
|
|
40435
|
-
const reactHooksJsPlugin = disableReactHooksJsPlugin || ruleSelection === "sidecar" || hasIncludedTags ? null : resolveReactHooksJsPlugin(project.hasReactCompiler || project.hasReactCompilerLintPlugin === true, customRulesOnly);
|
|
39881
|
+
const createOxlintConfig = ({ pluginPath, project, customRulesOnly = false, extendsPaths = [], ignoredTags = /* @__PURE__ */ new Set(), serverAuthFunctionNames, severityControls, userPlugins = [], disableReactHooksJsPlugin = false, ruleSelection, sidecarRuleIdFilter }) => {
|
|
39882
|
+
const reactHooksJsPlugin = disableReactHooksJsPlugin || ruleSelection === "sidecar" ? null : resolveReactHooksJsPlugin(project.hasReactCompiler || project.hasReactCompilerLintPlugin === true, customRulesOnly);
|
|
40436
39883
|
const reactCompilerRules = reactHooksJsPlugin ? applyRuleSeverityControls(filterRulesToAvailable(REACT_COMPILER_RULES, "react-hooks-js", reactHooksJsPlugin.availableRuleNames), severityControls) : {};
|
|
40437
39884
|
const jsPlugins = [];
|
|
40438
39885
|
if (reactHooksJsPlugin) jsPlugins.push(reactHooksJsPlugin.entry);
|
|
@@ -40447,14 +39894,9 @@ const createOxlintConfig = ({ pluginPath, project, customRulesOnly = false, exte
|
|
|
40447
39894
|
if (rule.scan !== void 0) continue;
|
|
40448
39895
|
if (customRulesOnly && registryEntry.originallyExternal) continue;
|
|
40449
39896
|
if (rule.framework !== "global" && !rule.requires) continue;
|
|
40450
|
-
if (!shouldEnableRule(rule.requires, rule.tags, capabilities, ignoredTags, rule.disabledWhen
|
|
39897
|
+
if (!shouldEnableRule(rule.requires, rule.tags, capabilities, ignoredTags, rule.disabledWhen)) continue;
|
|
40451
39898
|
const explicitRuleOverride = resolveRuleSeverityOverride({ ruleKey: registryEntry.key }, severityControls);
|
|
40452
|
-
if (
|
|
40453
|
-
defaultEnabled: rule.defaultEnabled,
|
|
40454
|
-
includeTagDefaults,
|
|
40455
|
-
hasIncludedTags,
|
|
40456
|
-
hasExplicitOverride: explicitRuleOverride !== void 0
|
|
40457
|
-
})) continue;
|
|
39899
|
+
if (rule.defaultEnabled === false && explicitRuleOverride === void 0) continue;
|
|
40458
39900
|
const severity = resolveRuleSeverityOverride({
|
|
40459
39901
|
ruleKey: registryEntry.key,
|
|
40460
39902
|
category: rule.category
|
|
@@ -40463,7 +39905,7 @@ const createOxlintConfig = ({ pluginPath, project, customRulesOnly = false, exte
|
|
|
40463
39905
|
enabledReactDoctorRules[registryEntry.key] = severity;
|
|
40464
39906
|
}
|
|
40465
39907
|
const userPluginRules = {};
|
|
40466
|
-
if (ruleSelection !== "sidecar"
|
|
39908
|
+
if (ruleSelection !== "sidecar") for (const userPlugin of userPlugins) {
|
|
40467
39909
|
Object.assign(userPluginRules, buildUserPluginRules(userPlugin, severityControls));
|
|
40468
39910
|
jsPlugins.push(userPlugin.entry);
|
|
40469
39911
|
}
|
|
@@ -40680,19 +40122,6 @@ const createSidecarLintCache = (cacheDirectory, rulesetHash) => {
|
|
|
40680
40122
|
}
|
|
40681
40123
|
};
|
|
40682
40124
|
};
|
|
40683
|
-
const fingerprintCacheByFilePath = /* @__PURE__ */ new Map();
|
|
40684
|
-
const fingerprintFileContents = (filePath, fingerprintLength) => {
|
|
40685
|
-
const fileStats = NFS.statSync(filePath, { bigint: true });
|
|
40686
|
-
const cachedFingerprint = fingerprintCacheByFilePath.get(filePath);
|
|
40687
|
-
if (cachedFingerprint?.modifiedTimeNanoseconds === fileStats.mtimeNs && cachedFingerprint.sizeBytes === fileStats.size) return cachedFingerprint.fingerprint;
|
|
40688
|
-
const fingerprint = crypto.createHash("sha256").update(NFS.readFileSync(filePath)).digest("hex").slice(0, fingerprintLength);
|
|
40689
|
-
fingerprintCacheByFilePath.set(filePath, {
|
|
40690
|
-
fingerprint,
|
|
40691
|
-
modifiedTimeNanoseconds: fileStats.mtimeNs,
|
|
40692
|
-
sizeBytes: fileStats.size
|
|
40693
|
-
});
|
|
40694
|
-
return fingerprint;
|
|
40695
|
-
};
|
|
40696
40125
|
const bundledRequire = createRequire(import.meta.url);
|
|
40697
40126
|
const childNodeVersionByBinaryPath = /* @__PURE__ */ new Map();
|
|
40698
40127
|
const resolveChildNodeVersion = (nodeBinaryPath) => {
|
|
@@ -40716,13 +40145,6 @@ const TOOLCHAIN_PACKAGE_SPECIFIERS = [
|
|
|
40716
40145
|
"oxlint-plugin-react-doctor/package.json",
|
|
40717
40146
|
"eslint-plugin-react-hooks/package.json"
|
|
40718
40147
|
];
|
|
40719
|
-
const resolvePluginFingerprint = () => {
|
|
40720
|
-
try {
|
|
40721
|
-
return fingerprintFileContents(bundledRequire.resolve("oxlint-plugin-react-doctor"), 16);
|
|
40722
|
-
} catch {
|
|
40723
|
-
return "unresolved";
|
|
40724
|
-
}
|
|
40725
|
-
};
|
|
40726
40148
|
const resolveOxlintToolchainVersions = (nodeBinaryPath = process.execPath) => {
|
|
40727
40149
|
const versions = [`node=${resolveChildNodeVersion(nodeBinaryPath)}`];
|
|
40728
40150
|
for (const specifier of TOOLCHAIN_PACKAGE_SPECIFIERS) try {
|
|
@@ -40732,7 +40154,6 @@ const resolveOxlintToolchainVersions = (nodeBinaryPath = process.execPath) => {
|
|
|
40732
40154
|
} catch {
|
|
40733
40155
|
versions.push(`${specifier}=missing`);
|
|
40734
40156
|
}
|
|
40735
|
-
versions.push(`oxlint-plugin-react-doctor#fingerprint=${resolvePluginFingerprint()}`);
|
|
40736
40157
|
return versions;
|
|
40737
40158
|
};
|
|
40738
40159
|
const esmRequire = createRequire(import.meta.url);
|
|
@@ -42208,7 +41629,7 @@ const reactHooksJsPluginDropNote = (error) => {
|
|
|
42208
41629
|
* 6. always restore disable directives + clean up the temp dir
|
|
42209
41630
|
*/
|
|
42210
41631
|
const runOxlint = async (options) => {
|
|
42211
|
-
const { rootDirectory, project, includePaths, nodeBinaryPath = process.execPath, customRulesOnly = false, respectInlineDisables = true, adoptExistingLintConfig = true, ignoredTags = /* @__PURE__ */ new Set(),
|
|
41632
|
+
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;
|
|
42212
41633
|
const serverAuthFunctionNames = Array.isArray(userConfig?.serverAuthFunctionNames) ? userConfig.serverAuthFunctionNames.filter((entry) => typeof entry === "string" && entry.length > 0) : void 0;
|
|
42213
41634
|
const severityControls = buildRuleSeverityControls(userConfig);
|
|
42214
41635
|
validateRuleRegistration();
|
|
@@ -42222,15 +41643,13 @@ const runOxlint = async (options) => {
|
|
|
42222
41643
|
}
|
|
42223
41644
|
const pluginPath = resolvePluginPath();
|
|
42224
41645
|
const extendsPaths = (adoptExistingLintConfig && !customRulesOnly ? detectUserLintConfigPaths(rootDirectory) : []).filter(canOxlintExtendConfig);
|
|
42225
|
-
const userPlugins =
|
|
41646
|
+
const userPlugins = resolveUserPlugins(userConfig?.plugins, configSourceDirectory);
|
|
42226
41647
|
const buildConfig = (overrides) => createOxlintConfig({
|
|
42227
41648
|
pluginPath,
|
|
42228
41649
|
project,
|
|
42229
41650
|
customRulesOnly,
|
|
42230
41651
|
extendsPaths: overrides.extendsPaths,
|
|
42231
41652
|
ignoredTags,
|
|
42232
|
-
includedTags,
|
|
42233
|
-
includeTagDefaults,
|
|
42234
41653
|
serverAuthFunctionNames,
|
|
42235
41654
|
severityControls,
|
|
42236
41655
|
userPlugins,
|
|
@@ -42619,8 +42038,6 @@ var Linter = class Linter extends Service()("react-doctor/Linter") {
|
|
|
42619
42038
|
respectInlineDisables: input.respectInlineDisables,
|
|
42620
42039
|
adoptExistingLintConfig: input.adoptExistingLintConfig,
|
|
42621
42040
|
ignoredTags: input.ignoredTags,
|
|
42622
|
-
includedTags: input.includedTags,
|
|
42623
|
-
includeTagDefaults: input.includeTagDefaults,
|
|
42624
42041
|
userConfig: input.userConfig ?? null,
|
|
42625
42042
|
configSourceDirectory: input.configSourceDirectory,
|
|
42626
42043
|
onPartialFailure: (reason) => {
|
|
@@ -43469,9 +42886,7 @@ const runInspect = (input, hooks = {}) => gen(function* () {
|
|
|
43469
42886
|
const securityScanFailedRef = yield* make$13(false);
|
|
43470
42887
|
const securityScanFiber = yield* forkChild(runCollect(applyPerElementPipeline(isDiffMode ? empty$4 : unwrap(tryPromise(() => checkSecurityScanCooperative(scanDirectory, {
|
|
43471
42888
|
project,
|
|
43472
|
-
ignoredTags: input.ignoredTags
|
|
43473
|
-
includedTags: input.includedTags,
|
|
43474
|
-
includeTagDefaults: input.includeTagDefaults
|
|
42889
|
+
ignoredTags: input.ignoredTags
|
|
43475
42890
|
})).pipe(map$3((diagnostics) => fromIterable$1(diagnostics)), catch_$1(() => set(securityScanFailedRef, true).pipe(as(empty$4))))))).pipe(withSpan("SecurityScan.run")));
|
|
43476
42891
|
const shouldRunSupplyChain = !isDiffMode || (input.supplyChainManifestChanged ?? false);
|
|
43477
42892
|
const supplyChainOverlapTimeout = yield* SupplyChainOverlapTimeoutMs;
|
|
@@ -43562,8 +42977,6 @@ const runInspect = (input, hooks = {}) => gen(function* () {
|
|
|
43562
42977
|
respectInlineDisables: input.respectInlineDisables,
|
|
43563
42978
|
adoptExistingLintConfig: input.adoptExistingLintConfig,
|
|
43564
42979
|
ignoredTags: input.ignoredTags,
|
|
43565
|
-
includedTags: input.includedTags,
|
|
43566
|
-
includeTagDefaults: input.includeTagDefaults,
|
|
43567
42980
|
userConfig: resolvedConfig.config ?? void 0,
|
|
43568
42981
|
configSourceDirectory: resolvedConfig.configSourceDirectory ?? void 0,
|
|
43569
42982
|
onFileProgress: (scannedFileCount, totalFileCount) => {
|
|
@@ -44424,4 +43837,4 @@ const toJsonReport = (result, options) => buildJsonReport({
|
|
|
44424
43837
|
export { AmbiguousProjectError, NoReactDependencyError, NotADirectoryError, PackageJsonNotFoundError, ProjectNotFoundError, ReactDoctorError, buildJsonReport, buildJsonReportError, clearCaches, defineConfig, diagnose, filterSourceFiles, getDiffInfo, hasReactRuntime, isProjectDiscoveryError, isReactDoctorError, summarizeDiagnostics, toJsonReport };
|
|
44425
43838
|
|
|
44426
43839
|
//# sourceMappingURL=index.js.map
|
|
44427
|
-
//# debugId=
|
|
43840
|
+
//# debugId=14f17993-c8fc-5c43-a518-2b2055f5d836
|