react-doctor 0.8.1-dev.412377e → 0.8.1-dev.5774353
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 +144 -759
- package/dist/index.d.ts +0 -36
- package/dist/index.js +100 -668
- package/dist/lsp.js +100 -668
- package/dist/skills/react-doctor/SKILL.md +0 -5
- package/package.json +2 -2
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__\//;
|
|
@@ -32923,58 +32961,6 @@ const IGNORED_DIRECTORIES = new Set([
|
|
|
32923
32961
|
"storybook-static"
|
|
32924
32962
|
]);
|
|
32925
32963
|
const MILLISECONDS_PER_SECOND = 1e3;
|
|
32926
|
-
const REACT_ROUTER_CAPABILITY_THRESHOLDS = [
|
|
32927
|
-
{
|
|
32928
|
-
capability: "react-router:6.4",
|
|
32929
|
-
major: 6,
|
|
32930
|
-
minor: 4
|
|
32931
|
-
},
|
|
32932
|
-
{
|
|
32933
|
-
capability: "react-router:6.7",
|
|
32934
|
-
major: 6,
|
|
32935
|
-
minor: 7
|
|
32936
|
-
},
|
|
32937
|
-
{
|
|
32938
|
-
capability: "react-router:6.9",
|
|
32939
|
-
major: 6,
|
|
32940
|
-
minor: 9
|
|
32941
|
-
},
|
|
32942
|
-
{
|
|
32943
|
-
capability: "react-router:6.19",
|
|
32944
|
-
major: 6,
|
|
32945
|
-
minor: 19
|
|
32946
|
-
},
|
|
32947
|
-
{
|
|
32948
|
-
capability: "react-router:7",
|
|
32949
|
-
major: 7,
|
|
32950
|
-
minor: 0
|
|
32951
|
-
},
|
|
32952
|
-
{
|
|
32953
|
-
capability: "react-router:7.8",
|
|
32954
|
-
major: 7,
|
|
32955
|
-
minor: 8
|
|
32956
|
-
},
|
|
32957
|
-
{
|
|
32958
|
-
capability: "react-router:7.9",
|
|
32959
|
-
major: 7,
|
|
32960
|
-
minor: 9
|
|
32961
|
-
},
|
|
32962
|
-
{
|
|
32963
|
-
capability: "react-router:7.10",
|
|
32964
|
-
major: 7,
|
|
32965
|
-
minor: 10
|
|
32966
|
-
},
|
|
32967
|
-
{
|
|
32968
|
-
capability: "react-router:7.15",
|
|
32969
|
-
major: 7,
|
|
32970
|
-
minor: 15
|
|
32971
|
-
},
|
|
32972
|
-
{
|
|
32973
|
-
capability: "react-router:8",
|
|
32974
|
-
major: 8,
|
|
32975
|
-
minor: 0
|
|
32976
|
-
}
|
|
32977
|
-
];
|
|
32978
32964
|
const SCORE_API_URL = "https://www.react.doctor/api/score";
|
|
32979
32965
|
const FETCH_TIMEOUT_MS = 1e4;
|
|
32980
32966
|
const GITHUB_VIEWER_PERMISSION_TIMEOUT_MS = 2e3;
|
|
@@ -33116,44 +33102,6 @@ const SUPPLY_CHAIN_OVERLAP_TIMEOUT_MS = 9e4;
|
|
|
33116
33102
|
const SUPPLY_CHAIN_CACHE_TTL_MS = 864e5;
|
|
33117
33103
|
const SUPPLY_CHAIN_CACHE_SUBDIR = "supply-chain";
|
|
33118
33104
|
const SUPPLY_CHAIN_IGNORED_PACKAGES = new Set(["next"]);
|
|
33119
|
-
const isErrnoException = (error) => error instanceof Error && "code" in error;
|
|
33120
|
-
const IGNORABLE_READDIR_ERROR_CODES = new Set([
|
|
33121
|
-
"EACCES",
|
|
33122
|
-
"EPERM",
|
|
33123
|
-
"ENOENT",
|
|
33124
|
-
"ENOTDIR",
|
|
33125
|
-
"EINVAL",
|
|
33126
|
-
"ELOOP",
|
|
33127
|
-
"ENAMETOOLONG"
|
|
33128
|
-
]);
|
|
33129
|
-
const isIgnorableReaddirError = (error) => isErrnoException(error) && typeof error.code === "string" && IGNORABLE_READDIR_ERROR_CODES.has(error.code);
|
|
33130
|
-
const readDirectoryEntries = (directoryPath) => {
|
|
33131
|
-
try {
|
|
33132
|
-
return NFS.readdirSync(directoryPath, { withFileTypes: true });
|
|
33133
|
-
} catch (error) {
|
|
33134
|
-
if (isIgnorableReaddirError(error)) return [];
|
|
33135
|
-
throw error;
|
|
33136
|
-
}
|
|
33137
|
-
};
|
|
33138
|
-
const isFile = (filePath) => {
|
|
33139
|
-
try {
|
|
33140
|
-
return NFS.statSync(filePath).isFile();
|
|
33141
|
-
} catch {
|
|
33142
|
-
return false;
|
|
33143
|
-
}
|
|
33144
|
-
};
|
|
33145
|
-
const isDirectory = (directoryPath) => {
|
|
33146
|
-
try {
|
|
33147
|
-
return NFS.statSync(directoryPath).isDirectory();
|
|
33148
|
-
} catch {
|
|
33149
|
-
return false;
|
|
33150
|
-
}
|
|
33151
|
-
};
|
|
33152
|
-
const isPlainObject = (value) => {
|
|
33153
|
-
if (typeof value !== "object" || value === null || Array.isArray(value)) return false;
|
|
33154
|
-
const prototype = Object.getPrototypeOf(value);
|
|
33155
|
-
return prototype === null || prototype === Object.prototype;
|
|
33156
|
-
};
|
|
33157
33105
|
const lastSourceMappingUrl = (fileContent) => {
|
|
33158
33106
|
const lastReference = [...fileContent.matchAll(/\/\/# sourceMappingURL=(\S+)/g)].at(-1);
|
|
33159
33107
|
return lastReference ? lastReference[1] : null;
|
|
@@ -33479,10 +33427,10 @@ const FALLBACK_TSCONFIG_FILENAMES = ["tsconfig.app.json", "tsconfig.build.json"]
|
|
|
33479
33427
|
const FRAMEWORK_PACKAGES = {
|
|
33480
33428
|
next: "nextjs",
|
|
33481
33429
|
"@tanstack/react-start": "tanstack-start",
|
|
33482
|
-
"@remix-run/react": "remix",
|
|
33483
|
-
gatsby: "gatsby",
|
|
33484
33430
|
vite: "vite",
|
|
33485
33431
|
"react-scripts": "cra",
|
|
33432
|
+
"@remix-run/react": "remix",
|
|
33433
|
+
gatsby: "gatsby",
|
|
33486
33434
|
expo: "expo",
|
|
33487
33435
|
"react-native": "react-native"
|
|
33488
33436
|
};
|
|
@@ -33506,17 +33454,11 @@ const NEXT_CONFIG_FILENAMES = [
|
|
|
33506
33454
|
];
|
|
33507
33455
|
const BABEL_CONFIG_FILENAMES = [
|
|
33508
33456
|
".babelrc",
|
|
33509
|
-
".babelrc.js",
|
|
33510
33457
|
".babelrc.json",
|
|
33511
|
-
".babelrc.cjs",
|
|
33512
|
-
".babelrc.mjs",
|
|
33513
|
-
".babelrc.cts",
|
|
33514
33458
|
"babel.config.js",
|
|
33515
33459
|
"babel.config.json",
|
|
33516
33460
|
"babel.config.cjs",
|
|
33517
|
-
"babel.config.mjs"
|
|
33518
|
-
"babel.config.ts",
|
|
33519
|
-
"babel.config.cts"
|
|
33461
|
+
"babel.config.mjs"
|
|
33520
33462
|
];
|
|
33521
33463
|
const VITE_CONFIG_FILENAMES = [
|
|
33522
33464
|
"vite.config.js",
|
|
@@ -33528,28 +33470,12 @@ const VITE_CONFIG_FILENAMES = [
|
|
|
33528
33470
|
"vitest.config.ts",
|
|
33529
33471
|
"vitest.config.js"
|
|
33530
33472
|
];
|
|
33531
|
-
const RSBUILD_CONFIG_FILENAMES = [
|
|
33532
|
-
"rsbuild.config.ts",
|
|
33533
|
-
"rsbuild.config.js",
|
|
33534
|
-
"rsbuild.config.mts",
|
|
33535
|
-
"rsbuild.config.mjs",
|
|
33536
|
-
"rsbuild.config.cts",
|
|
33537
|
-
"rsbuild.config.cjs"
|
|
33538
|
-
];
|
|
33539
|
-
const RSPACK_CONFIG_FILENAMES = [
|
|
33540
|
-
"rspack.config.ts",
|
|
33541
|
-
"rspack.config.js",
|
|
33542
|
-
"rspack.config.mts",
|
|
33543
|
-
"rspack.config.mjs",
|
|
33544
|
-
"rspack.config.cts",
|
|
33545
|
-
"rspack.config.cjs"
|
|
33546
|
-
];
|
|
33547
33473
|
const EXPO_APP_CONFIG_FILENAMES = [
|
|
33548
33474
|
"app.json",
|
|
33549
33475
|
"app.config.js",
|
|
33550
33476
|
"app.config.ts"
|
|
33551
33477
|
];
|
|
33552
|
-
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["']/;
|
|
33553
33479
|
const REACT_COMPILER_ENABLED_FLAG_PATTERN = /["']?reactCompiler["']?\s*:\s*(?:true\b|\{)/;
|
|
33554
33480
|
const STATIC_EXPORT_OUTPUT_PATTERN = /(?:^|[^.\w])["']?output["']?\s*:\s*["']export["']/m;
|
|
33555
33481
|
const hasCompilerPackage = (packageJson, compilerPackages) => {
|
|
@@ -33584,8 +33510,6 @@ const detectReactCompiler = (directory, packageJson) => {
|
|
|
33584
33510
|
if (hasCompilerInConfigFiles(directory, NEXT_CONFIG_FILENAMES)) return true;
|
|
33585
33511
|
if (hasCompilerInConfigFiles(directory, BABEL_CONFIG_FILENAMES)) return true;
|
|
33586
33512
|
if (hasCompilerInConfigFiles(directory, VITE_CONFIG_FILENAMES)) return true;
|
|
33587
|
-
if (hasCompilerInConfigFiles(directory, RSBUILD_CONFIG_FILENAMES)) return true;
|
|
33588
|
-
if (hasCompilerInConfigFiles(directory, RSPACK_CONFIG_FILENAMES)) return true;
|
|
33589
33513
|
if (hasCompilerInConfigFiles(directory, EXPO_APP_CONFIG_FILENAMES)) return true;
|
|
33590
33514
|
return hasCompilerPackageInAncestors(directory, REACT_COMPILER_TRANSFORM_PACKAGES);
|
|
33591
33515
|
};
|
|
@@ -33594,7 +33518,7 @@ const detectNextjsStaticExport = (directory) => NEXT_CONFIG_FILENAMES.some((file
|
|
|
33594
33518
|
const filePath = Path.join(directory, filename);
|
|
33595
33519
|
return isFile(filePath) && STATIC_EXPORT_OUTPUT_PATTERN.test(NFS.readFileSync(filePath, "utf-8"));
|
|
33596
33520
|
});
|
|
33597
|
-
const UNRESOLVABLE_PROTOCOL_VERSION = /^(?:
|
|
33521
|
+
const UNRESOLVABLE_PROTOCOL_VERSION = /^(?:file|git|github|https?|link|patch|portal|workspace|npm):/i;
|
|
33598
33522
|
const DIST_TAG_VERSION = /^[a-z][a-z0-9._-]*$/i;
|
|
33599
33523
|
const WILDCARD_VERSION = /^[*xX](?:\.[*xX])*$/;
|
|
33600
33524
|
const NPM_ALIAS_VERSION = /^npm:(?:@[^/]+\/[^@]+|[^@]+)@(.+)$/i;
|
|
@@ -33727,16 +33651,6 @@ const getLowestDependencyMajor = (version) => {
|
|
|
33727
33651
|
}
|
|
33728
33652
|
return lowestMajor;
|
|
33729
33653
|
};
|
|
33730
|
-
const getDependencyMajorWithinSupportedRange = (version, latestSupportedMajor) => {
|
|
33731
|
-
const normalizedVersion = normalizeDependencyVersion(version);
|
|
33732
|
-
if (normalizedVersion === null) return null;
|
|
33733
|
-
const validRange = import_semver.validRange(normalizedVersion);
|
|
33734
|
-
if (validRange === null) return null;
|
|
33735
|
-
const minimumVersion = import_semver.minVersion(validRange);
|
|
33736
|
-
if (minimumVersion === null || minimumVersion.major > latestSupportedMajor) return null;
|
|
33737
|
-
if (import_semver.intersects(validRange, `>=${latestSupportedMajor + 1}.0.0`)) return null;
|
|
33738
|
-
return minimumVersion.major;
|
|
33739
|
-
};
|
|
33740
33654
|
const isConcreteDependencyVersion = (version) => {
|
|
33741
33655
|
const normalizedVersion = normalizeDependencyVersion(version);
|
|
33742
33656
|
return normalizedVersion !== null && /\d/.test(normalizedVersion);
|
|
@@ -33780,18 +33694,9 @@ const parseReactMajorMinor = (reactVersion) => {
|
|
|
33780
33694
|
};
|
|
33781
33695
|
};
|
|
33782
33696
|
const parseLowerBoundVersion = (versionSpec) => import_semver.validRange(versionSpec) !== null ? import_semver.minVersion(versionSpec) : import_semver.coerce(versionSpec);
|
|
33783
|
-
const
|
|
33784
|
-
if (typeof
|
|
33785
|
-
const
|
|
33786
|
-
if (normalizedVersion === null) return null;
|
|
33787
|
-
const lowerBound = parseLowerBoundVersion(normalizedVersion);
|
|
33788
|
-
if (lowerBound === null) return null;
|
|
33789
|
-
if (lowerBound.major > 0) return Number.MAX_SAFE_INTEGER;
|
|
33790
|
-
return lowerBound.minor > 0 ? lowerBound.minor : null;
|
|
33791
|
-
};
|
|
33792
|
-
const parseDependencyMajorMinor = (dependencyVersion) => {
|
|
33793
|
-
if (typeof dependencyVersion !== "string") return null;
|
|
33794
|
-
const trimmed = dependencyVersion.trim();
|
|
33697
|
+
const parseTailwindMajorMinor = (tailwindVersion) => {
|
|
33698
|
+
if (typeof tailwindVersion !== "string") return null;
|
|
33699
|
+
const trimmed = tailwindVersion.trim();
|
|
33795
33700
|
if (trimmed.length === 0) return null;
|
|
33796
33701
|
const lowerBound = parseLowerBoundVersion(trimmed);
|
|
33797
33702
|
if (lowerBound === null || lowerBound.major <= 0) return null;
|
|
@@ -33800,7 +33705,6 @@ const parseDependencyMajorMinor = (dependencyVersion) => {
|
|
|
33800
33705
|
minor: lowerBound.minor
|
|
33801
33706
|
};
|
|
33802
33707
|
};
|
|
33803
|
-
const parseTailwindMajorMinor = (tailwindVersion) => parseDependencyMajorMinor(tailwindVersion);
|
|
33804
33708
|
const hasUpperBoundOnlyPeerRange = (range) => {
|
|
33805
33709
|
if (typeof range !== "string") return false;
|
|
33806
33710
|
const normalizedRange = normalizeDependencyVersion(range);
|
|
@@ -33822,7 +33726,7 @@ const resolveEffectiveReactMajor = (reactVersion, packageJson) => {
|
|
|
33822
33726
|
if (peerFloor === null) return hasUpperBoundOnlyPeerRange(peerReactRange) ? null : installedReactMajor;
|
|
33823
33727
|
return installedReactMajor !== null ? Math.min(installedReactMajor, peerFloor) : peerFloor;
|
|
33824
33728
|
};
|
|
33825
|
-
const isCatalogReference = (version) =>
|
|
33729
|
+
const isCatalogReference = (version) => version.startsWith("catalog:");
|
|
33826
33730
|
const extractCatalogName = (version) => {
|
|
33827
33731
|
if (!isCatalogReference(version)) return null;
|
|
33828
33732
|
const name = version.slice(8).trim();
|
|
@@ -33972,12 +33876,6 @@ const TAILWIND_ZOD_SECTIONS = [
|
|
|
33972
33876
|
"devDependencies",
|
|
33973
33877
|
"peerDependencies"
|
|
33974
33878
|
];
|
|
33975
|
-
const DEPENDENCY_SPEC_SECTIONS = [
|
|
33976
|
-
"dependencies",
|
|
33977
|
-
"devDependencies",
|
|
33978
|
-
"peerDependencies",
|
|
33979
|
-
"optionalDependencies"
|
|
33980
|
-
];
|
|
33981
33879
|
const EMPTY_DEPENDENCY_INFO = {
|
|
33982
33880
|
reactVersion: null,
|
|
33983
33881
|
tailwindVersion: null,
|
|
@@ -33987,7 +33885,7 @@ const EMPTY_DEPENDENCY_INFO = {
|
|
|
33987
33885
|
const pickConcreteVersion = (packageJson, packageName, sections) => {
|
|
33988
33886
|
for (const section of sections) {
|
|
33989
33887
|
const version = packageJson[section]?.[packageName];
|
|
33990
|
-
if (
|
|
33888
|
+
if (version === void 0) continue;
|
|
33991
33889
|
if (isCatalogReference(version)) return null;
|
|
33992
33890
|
if (isConcreteDependencyVersion(version)) return version;
|
|
33993
33891
|
}
|
|
@@ -34019,16 +33917,13 @@ const extractDependencyInfo = (packageJson) => {
|
|
|
34019
33917
|
};
|
|
34020
33918
|
};
|
|
34021
33919
|
const getDependencySpec = (packageJson, packageName) => {
|
|
34022
|
-
|
|
34023
|
-
|
|
34024
|
-
if (typeof spec === "string") return spec;
|
|
34025
|
-
}
|
|
34026
|
-
return null;
|
|
33920
|
+
const spec = packageJson.dependencies?.[packageName] ?? packageJson.devDependencies?.[packageName] ?? packageJson.peerDependencies?.[packageName] ?? packageJson.optionalDependencies?.[packageName];
|
|
33921
|
+
return typeof spec === "string" ? spec : null;
|
|
34027
33922
|
};
|
|
34028
33923
|
const getDependencyDeclaration = ({ packageJson, packageName, sections }) => {
|
|
34029
33924
|
for (const section of sections) {
|
|
34030
33925
|
const version = packageJson[section]?.[packageName];
|
|
34031
|
-
if (
|
|
33926
|
+
if (version === void 0) continue;
|
|
34032
33927
|
return {
|
|
34033
33928
|
catalogReference: extractCatalogName(version) ?? null,
|
|
34034
33929
|
hasDeclaration: true,
|
|
@@ -34062,15 +33957,24 @@ const getPreactVersion = (packageJson) => {
|
|
|
34062
33957
|
...packageJson.devDependencies
|
|
34063
33958
|
}.preact ?? null;
|
|
34064
33959
|
};
|
|
34065
|
-
const
|
|
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
|
+
};
|
|
33973
|
+
const resolveCatalogBackedDependencyVersion = ({ rootDirectory, rootPackageJson, packageName, version }) => {
|
|
34066
33974
|
if (version === null || !isCatalogReference(version)) return version;
|
|
34067
33975
|
const catalogName = extractCatalogName(version);
|
|
34068
|
-
const
|
|
34069
|
-
if (
|
|
34070
|
-
if (sourceDirectory !== rootDirectory || sourcePackageJson !== rootPackageJson) {
|
|
34071
|
-
const resolvedRootVersion = resolveCatalogVersion(rootPackageJson, packageName, rootDirectory, catalogName);
|
|
34072
|
-
if (resolvedRootVersion) return resolvedRootVersion;
|
|
34073
|
-
}
|
|
33976
|
+
const resolvedLocalVersion = resolveCatalogVersion(rootPackageJson, packageName, rootDirectory, catalogName);
|
|
33977
|
+
if (resolvedLocalVersion) return resolvedLocalVersion;
|
|
34074
33978
|
const monorepoRoot = findMonorepoRoot(rootDirectory);
|
|
34075
33979
|
if (!monorepoRoot) return version;
|
|
34076
33980
|
const monorepoPackageJsonPath = Path.join(monorepoRoot, "package.json");
|
|
@@ -34268,84 +34172,7 @@ const listWorkspacePackages = (rootDirectory) => {
|
|
|
34268
34172
|
}
|
|
34269
34173
|
return packages;
|
|
34270
34174
|
};
|
|
34271
|
-
const PREFERRED_DEPENDENCY_SECTIONS = [
|
|
34272
|
-
"dependencies",
|
|
34273
|
-
"peerDependencies",
|
|
34274
|
-
"devDependencies"
|
|
34275
|
-
];
|
|
34276
|
-
const getPreferredDependencyVersion = ({ packageJson, packageNames }) => {
|
|
34277
|
-
for (const packageName of packageNames) {
|
|
34278
|
-
const declaration = getDependencyDeclaration({
|
|
34279
|
-
packageJson,
|
|
34280
|
-
packageName,
|
|
34281
|
-
sections: PREFERRED_DEPENDENCY_SECTIONS
|
|
34282
|
-
});
|
|
34283
|
-
if (declaration.version !== null) return declaration.version;
|
|
34284
|
-
}
|
|
34285
|
-
return null;
|
|
34286
|
-
};
|
|
34287
|
-
const TANSTACK_REACT_QUERY_PACKAGES = ["@tanstack/react-query", "react-query"];
|
|
34288
|
-
const getTanStackQueryVersion = (packageJson) => {
|
|
34289
|
-
return getPreferredDependencyVersion({
|
|
34290
|
-
packageJson,
|
|
34291
|
-
packageNames: TANSTACK_REACT_QUERY_PACKAGES
|
|
34292
|
-
});
|
|
34293
|
-
};
|
|
34294
|
-
const STYLED_COMPONENTS_PACKAGES = ["styled-components"];
|
|
34295
|
-
const getStyledComponentsVersion = (packageJson) => {
|
|
34296
|
-
return getPreferredDependencyVersion({
|
|
34297
|
-
packageJson,
|
|
34298
|
-
packageNames: STYLED_COMPONENTS_PACKAGES
|
|
34299
|
-
});
|
|
34300
|
-
};
|
|
34301
|
-
const I18N_PACKAGES = [
|
|
34302
|
-
"i18next",
|
|
34303
|
-
"react-i18next",
|
|
34304
|
-
"next-i18next",
|
|
34305
|
-
"react-intl",
|
|
34306
|
-
"next-intl",
|
|
34307
|
-
"use-intl",
|
|
34308
|
-
"@formatjs/intl",
|
|
34309
|
-
"@lingui/core",
|
|
34310
|
-
"@lingui/react",
|
|
34311
|
-
"typesafe-i18n",
|
|
34312
|
-
"@tolgee/react",
|
|
34313
|
-
"react-intl-universal"
|
|
34314
|
-
];
|
|
34315
|
-
const hasI18nDependency = (packageJson) => {
|
|
34316
|
-
const allDependencies = {
|
|
34317
|
-
...packageJson.peerDependencies,
|
|
34318
|
-
...packageJson.dependencies,
|
|
34319
|
-
...packageJson.devDependencies,
|
|
34320
|
-
...packageJson.optionalDependencies
|
|
34321
|
-
};
|
|
34322
|
-
return I18N_PACKAGES.some((packageName) => allDependencies[packageName] !== void 0);
|
|
34323
|
-
};
|
|
34324
34175
|
const REANIMATED_DEPENDENCY_NAME = "react-native-reanimated";
|
|
34325
|
-
const MOBX_REACT_PACKAGE_NAME = "mobx-react";
|
|
34326
|
-
const MOBX_REACT_LITE_PACKAGE_NAME = "mobx-react-lite";
|
|
34327
|
-
const MOBX_STATE_TREE_PACKAGE_NAME = "mobx-state-tree";
|
|
34328
|
-
const MOBX_REACT_OBSERVER_PACKAGE_NAME = "mobx-react-observer";
|
|
34329
|
-
const REACT_THREE_FIBER_DEPENDENCY_NAMES = ["@react-three/fiber", "react-three-fiber"];
|
|
34330
|
-
const REACT_THREE_FIBER_SECTIONS = [
|
|
34331
|
-
"dependencies",
|
|
34332
|
-
"peerDependencies",
|
|
34333
|
-
"optionalDependencies",
|
|
34334
|
-
"devDependencies"
|
|
34335
|
-
];
|
|
34336
|
-
const THREE_DEPENDENCY_SECTIONS = [
|
|
34337
|
-
"dependencies",
|
|
34338
|
-
"peerDependencies",
|
|
34339
|
-
"optionalDependencies",
|
|
34340
|
-
"devDependencies"
|
|
34341
|
-
];
|
|
34342
|
-
const REACT_THREE_FIBER_ECOSYSTEM_DEPENDENCY_NAMES = [...REACT_THREE_FIBER_DEPENDENCY_NAMES, "@react-three/drei"];
|
|
34343
|
-
const THREE_DEPENDENCY_NAMES = [...REACT_THREE_FIBER_ECOSYSTEM_DEPENDENCY_NAMES, "three"];
|
|
34344
|
-
const REACT_ROUTER_DEPENDENCY_NAMES = [
|
|
34345
|
-
"@react-router/dev",
|
|
34346
|
-
"react-router-dom",
|
|
34347
|
-
"react-router"
|
|
34348
|
-
];
|
|
34349
34176
|
const SHOPIFY_FLASH_LIST_PACKAGE_NAME = "@shopify/flash-list";
|
|
34350
34177
|
const resolveWorkspaceDependencyVersion = ({ concreteVersion, packageName, rootDirectory, rootPackageJson, sections, workspaceDirectory, workspacePackageJson }) => {
|
|
34351
34178
|
const dependencyDeclaration = getDependencyDeclaration({
|
|
@@ -34356,7 +34183,7 @@ const resolveWorkspaceDependencyVersion = ({ concreteVersion, packageName, rootD
|
|
|
34356
34183
|
if (!dependencyDeclaration.hasDeclaration) return null;
|
|
34357
34184
|
return concreteVersion ?? resolveCatalogVersion(workspacePackageJson, packageName, workspaceDirectory, dependencyDeclaration.catalogReference) ?? resolveCatalogVersion(rootPackageJson, packageName, rootDirectory, dependencyDeclaration.catalogReference);
|
|
34358
34185
|
};
|
|
34359
|
-
const
|
|
34186
|
+
const shouldReplaceReactVersion = (currentVersion, nextVersion) => {
|
|
34360
34187
|
if (!currentVersion) return true;
|
|
34361
34188
|
const currentMajor = parseReactMajor(currentVersion);
|
|
34362
34189
|
const nextMajor = parseReactMajor(nextVersion);
|
|
@@ -34364,71 +34191,7 @@ const shouldReplaceWithLowerMajor = (currentVersion, nextVersion) => {
|
|
|
34364
34191
|
if (nextMajor === null) return false;
|
|
34365
34192
|
return nextMajor < currentMajor;
|
|
34366
34193
|
};
|
|
34367
|
-
const
|
|
34368
|
-
if (currentFact.version === null) return true;
|
|
34369
|
-
if (nextFact.version === null) return false;
|
|
34370
|
-
const currentMajor = getLowestDependencyMajor(currentFact.version);
|
|
34371
|
-
const nextMajor = getLowestDependencyMajor(nextFact.version);
|
|
34372
|
-
if (currentMajor === null) return false;
|
|
34373
|
-
if (nextMajor === null) return true;
|
|
34374
|
-
if (currentMajor > latestSupportedMajor) return false;
|
|
34375
|
-
if (nextMajor > latestSupportedMajor) return true;
|
|
34376
|
-
return nextMajor < currentMajor;
|
|
34377
|
-
};
|
|
34378
|
-
const shouldReplaceStyledComponentsVersion = (currentVersion, nextVersion) => {
|
|
34379
|
-
if (!currentVersion) return true;
|
|
34380
|
-
const currentMajor = getLowestDependencyMajor(currentVersion);
|
|
34381
|
-
const nextMajor = getLowestDependencyMajor(nextVersion);
|
|
34382
|
-
if (currentMajor === null) return nextMajor !== null && nextMajor < 6;
|
|
34383
|
-
if (nextMajor === null) return currentMajor >= 6;
|
|
34384
|
-
return nextMajor < currentMajor;
|
|
34385
|
-
};
|
|
34386
|
-
const selectOldestDependencyVersion = (currentVersion, nextVersion) => {
|
|
34387
|
-
if (currentVersion === null || nextVersion === null) return null;
|
|
34388
|
-
const current = parseDependencyMajorMinor(currentVersion);
|
|
34389
|
-
const next = parseDependencyMajorMinor(nextVersion);
|
|
34390
|
-
if (current === null) return currentVersion;
|
|
34391
|
-
if (next === null) return nextVersion;
|
|
34392
|
-
if (next.major !== current.major) return next.major < current.major ? nextVersion : currentVersion;
|
|
34393
|
-
return next.minor < current.minor ? nextVersion : currentVersion;
|
|
34394
|
-
};
|
|
34395
|
-
const shouldReplaceMobxFact = (currentFact, nextFact) => {
|
|
34396
|
-
if (currentFact.sourceDirectory === null) return true;
|
|
34397
|
-
if (currentFact.version === null) return false;
|
|
34398
|
-
if (nextFact.version === null) return true;
|
|
34399
|
-
const currentMajor = getDependencyMajorWithinSupportedRange(currentFact.version, 6);
|
|
34400
|
-
const nextMajor = getDependencyMajorWithinSupportedRange(nextFact.version, 6);
|
|
34401
|
-
if (currentMajor === null) return false;
|
|
34402
|
-
if (nextMajor === null) return true;
|
|
34403
|
-
return selectOldestDependencyVersion(currentFact.version, nextFact.version) === nextFact.version;
|
|
34404
|
-
};
|
|
34405
|
-
const collectBindingVersion = (facts, packageJson, directory, packageName) => {
|
|
34406
|
-
const version = getDependencySpec(packageJson, packageName);
|
|
34407
|
-
if (version === null) return;
|
|
34408
|
-
const resolvedVersion = resolveCatalogBackedDependencyVersion({
|
|
34409
|
-
rootDirectory: directory,
|
|
34410
|
-
rootPackageJson: packageJson,
|
|
34411
|
-
packageName,
|
|
34412
|
-
version
|
|
34413
|
-
});
|
|
34414
|
-
if (packageName === MOBX_REACT_PACKAGE_NAME) {
|
|
34415
|
-
facts.mobxReactVersion = facts.hasMobxReact ? selectOldestDependencyVersion(facts.mobxReactVersion, resolvedVersion) : resolvedVersion;
|
|
34416
|
-
facts.hasMobxReact = true;
|
|
34417
|
-
return;
|
|
34418
|
-
}
|
|
34419
|
-
facts.mobxReactLiteVersion = facts.hasMobxReactLite ? selectOldestDependencyVersion(facts.mobxReactLiteVersion, resolvedVersion) : resolvedVersion;
|
|
34420
|
-
facts.hasMobxReactLite = true;
|
|
34421
|
-
};
|
|
34422
|
-
const shouldReplaceReactRouterVersion = (currentVersion, nextVersion) => {
|
|
34423
|
-
if (currentVersion === null) return true;
|
|
34424
|
-
const current = parseReactMajorMinor(currentVersion);
|
|
34425
|
-
const next = parseReactMajorMinor(nextVersion);
|
|
34426
|
-
if (current === null) return next !== null;
|
|
34427
|
-
if (next === null) return false;
|
|
34428
|
-
if (next.major !== current.major) return next.major < current.major;
|
|
34429
|
-
return next.minor < current.minor;
|
|
34430
|
-
};
|
|
34431
|
-
const evaluateManifestFacts = (facts, packageJson, directory, rootDirectory, rootPackageJson) => {
|
|
34194
|
+
const evaluateManifestFacts = (facts, packageJson, directory) => {
|
|
34432
34195
|
if (facts.expo.version === null) {
|
|
34433
34196
|
const spec = getDependencySpec(packageJson, "expo");
|
|
34434
34197
|
if (spec !== null) facts.expo = {
|
|
@@ -34443,23 +34206,6 @@ const evaluateManifestFacts = (facts, packageJson, directory, rootDirectory, roo
|
|
|
34443
34206
|
sourceDirectory: directory
|
|
34444
34207
|
};
|
|
34445
34208
|
}
|
|
34446
|
-
for (const packageName of REACT_ROUTER_DEPENDENCY_NAMES) {
|
|
34447
|
-
const resolvedSpec = resolveCatalogBackedDependencyVersion({
|
|
34448
|
-
rootDirectory,
|
|
34449
|
-
rootPackageJson,
|
|
34450
|
-
sourceDirectory: directory,
|
|
34451
|
-
sourcePackageJson: packageJson,
|
|
34452
|
-
packageName,
|
|
34453
|
-
version: getDependencySpec(packageJson, packageName)
|
|
34454
|
-
});
|
|
34455
|
-
if (resolvedSpec === null || !shouldReplaceReactRouterVersion(facts.reactRouter.version, resolvedSpec)) continue;
|
|
34456
|
-
facts.reactRouter = {
|
|
34457
|
-
version: resolvedSpec,
|
|
34458
|
-
sourceDirectory: directory,
|
|
34459
|
-
packageName
|
|
34460
|
-
};
|
|
34461
|
-
}
|
|
34462
|
-
facts.hasReactRouterFramework = facts.hasReactRouterFramework || getDependencySpec(packageJson, "@react-router/dev") !== null;
|
|
34463
34209
|
if (facts.shopifyFlashList.version === null) {
|
|
34464
34210
|
const spec = getDependencySpec(packageJson, SHOPIFY_FLASH_LIST_PACKAGE_NAME);
|
|
34465
34211
|
if (spec !== null) facts.shopifyFlashList = {
|
|
@@ -34467,36 +34213,6 @@ const evaluateManifestFacts = (facts, packageJson, directory, rootDirectory, roo
|
|
|
34467
34213
|
sourceDirectory: directory
|
|
34468
34214
|
};
|
|
34469
34215
|
}
|
|
34470
|
-
const mobxSpec = getDependencySpec(packageJson, "mobx");
|
|
34471
|
-
if (mobxSpec !== null) {
|
|
34472
|
-
const nextMobxFact = {
|
|
34473
|
-
version: resolveCatalogBackedDependencyVersion({
|
|
34474
|
-
rootDirectory: directory,
|
|
34475
|
-
rootPackageJson: packageJson,
|
|
34476
|
-
packageName: "mobx",
|
|
34477
|
-
version: mobxSpec
|
|
34478
|
-
}),
|
|
34479
|
-
sourceDirectory: directory
|
|
34480
|
-
};
|
|
34481
|
-
if (shouldReplaceMobxFact(facts.mobx, nextMobxFact)) facts.mobx = nextMobxFact;
|
|
34482
|
-
}
|
|
34483
|
-
collectBindingVersion(facts, packageJson, directory, MOBX_REACT_PACKAGE_NAME);
|
|
34484
|
-
collectBindingVersion(facts, packageJson, directory, MOBX_REACT_LITE_PACKAGE_NAME);
|
|
34485
|
-
facts.hasMobxStateTree = facts.hasMobxStateTree || getDependencySpec(packageJson, MOBX_STATE_TREE_PACKAGE_NAME) !== null;
|
|
34486
|
-
facts.hasMobxReactObserver = facts.hasMobxReactObserver || getDependencySpec(packageJson, MOBX_REACT_OBSERVER_PACKAGE_NAME) !== null;
|
|
34487
|
-
const zustandSpec = getDependencySpec(packageJson, "zustand");
|
|
34488
|
-
if (zustandSpec !== null) {
|
|
34489
|
-
const nextZustandFact = {
|
|
34490
|
-
version: resolveCatalogBackedDependencyVersion({
|
|
34491
|
-
rootDirectory: directory,
|
|
34492
|
-
rootPackageJson: packageJson,
|
|
34493
|
-
packageName: "zustand",
|
|
34494
|
-
version: zustandSpec
|
|
34495
|
-
}),
|
|
34496
|
-
sourceDirectory: directory
|
|
34497
|
-
};
|
|
34498
|
-
if (shouldReplaceSupportedDependencyFact(facts.zustand, nextZustandFact, 5)) facts.zustand = nextZustandFact;
|
|
34499
|
-
}
|
|
34500
34216
|
if (facts.reanimatedVersion === null) {
|
|
34501
34217
|
const spec = getDependencySpec(packageJson, REANIMATED_DEPENDENCY_NAME);
|
|
34502
34218
|
if (spec !== null) facts.reanimatedVersion = spec;
|
|
@@ -34505,75 +34221,9 @@ const evaluateManifestFacts = (facts, packageJson, directory, rootDirectory, roo
|
|
|
34505
34221
|
const spec = getDependencySpec(packageJson, "valtio");
|
|
34506
34222
|
if (spec !== null) facts.valtioVersion = spec;
|
|
34507
34223
|
}
|
|
34508
|
-
facts.tanstackQueryVersion ??= getTanStackQueryVersion(packageJson);
|
|
34509
|
-
const styledComponentsVersion = resolveCatalogBackedDependencyVersion({
|
|
34510
|
-
rootDirectory: directory,
|
|
34511
|
-
rootPackageJson: packageJson,
|
|
34512
|
-
packageName: "styled-components",
|
|
34513
|
-
version: getStyledComponentsVersion(packageJson)
|
|
34514
|
-
});
|
|
34515
|
-
if (styledComponentsVersion && shouldReplaceStyledComponentsVersion(facts.styledComponentsVersion, styledComponentsVersion)) facts.styledComponentsVersion = styledComponentsVersion;
|
|
34516
|
-
facts.hasI18nLibrary = facts.hasI18nLibrary || hasI18nDependency(packageJson);
|
|
34517
|
-
for (const packageName of REACT_THREE_FIBER_DEPENDENCY_NAMES) {
|
|
34518
|
-
const version = resolveCatalogBackedDependencyVersion({
|
|
34519
|
-
rootDirectory,
|
|
34520
|
-
rootPackageJson,
|
|
34521
|
-
sourceDirectory: directory,
|
|
34522
|
-
sourcePackageJson: packageJson,
|
|
34523
|
-
packageName,
|
|
34524
|
-
version: getDependencyDeclaration({
|
|
34525
|
-
packageName,
|
|
34526
|
-
packageJson,
|
|
34527
|
-
sections: REACT_THREE_FIBER_SECTIONS
|
|
34528
|
-
}).version
|
|
34529
|
-
});
|
|
34530
|
-
if (version === null) continue;
|
|
34531
|
-
if (shouldReplaceWithLowerMajor(facts.reactThreeFiber.version, version)) facts.reactThreeFiber = {
|
|
34532
|
-
packageName,
|
|
34533
|
-
version,
|
|
34534
|
-
sourceDirectory: directory
|
|
34535
|
-
};
|
|
34536
|
-
}
|
|
34537
|
-
const threeVersion = resolveCatalogBackedDependencyVersion({
|
|
34538
|
-
rootDirectory,
|
|
34539
|
-
rootPackageJson,
|
|
34540
|
-
sourceDirectory: directory,
|
|
34541
|
-
sourcePackageJson: packageJson,
|
|
34542
|
-
packageName: "three",
|
|
34543
|
-
version: getDependencyDeclaration({
|
|
34544
|
-
packageName: "three",
|
|
34545
|
-
packageJson,
|
|
34546
|
-
sections: THREE_DEPENDENCY_SECTIONS
|
|
34547
|
-
}).version
|
|
34548
|
-
});
|
|
34549
|
-
if (threeVersion !== null) {
|
|
34550
|
-
const currentRelease = parseThreeRelease(facts.threeVersion);
|
|
34551
|
-
const nextRelease = parseThreeRelease(threeVersion);
|
|
34552
|
-
if (facts.threeVersion === null || nextRelease !== null && (currentRelease === null || nextRelease < currentRelease)) facts.threeVersion = threeVersion;
|
|
34553
|
-
}
|
|
34554
34224
|
facts.hasReactNativeAwarePackage = facts.hasReactNativeAwarePackage || isPackageJsonReactNativeAware(packageJson);
|
|
34555
34225
|
facts.hasReanimatedAwarePackage = facts.hasReanimatedAwarePackage || isPackageJsonReanimatedAware(packageJson);
|
|
34556
34226
|
facts.hasSsrDependency = facts.hasSsrDependency || isPackageJsonSsrAware(packageJson);
|
|
34557
|
-
const remotionSpec = getDependencySpec(packageJson, "remotion");
|
|
34558
|
-
if (remotionSpec !== null) {
|
|
34559
|
-
facts.hasRemotionDependency = true;
|
|
34560
|
-
const resolvedRemotionVersion = resolveCatalogBackedDependencyVersion({
|
|
34561
|
-
rootDirectory,
|
|
34562
|
-
rootPackageJson,
|
|
34563
|
-
packageName: "remotion",
|
|
34564
|
-
version: remotionSpec
|
|
34565
|
-
});
|
|
34566
|
-
const remotionMajorVersion = resolvedRemotionVersion === null ? null : getLowestDependencyMajor(resolvedRemotionVersion);
|
|
34567
|
-
if (remotionMajorVersion === null) {
|
|
34568
|
-
facts.hasUnknownRemotionVersion = true;
|
|
34569
|
-
facts.remotionVersion = null;
|
|
34570
|
-
} else if (!facts.hasUnknownRemotionVersion) {
|
|
34571
|
-
const currentRemotionMajorVersion = facts.remotionVersion === null ? null : getLowestDependencyMajor(facts.remotionVersion);
|
|
34572
|
-
if (currentRemotionMajorVersion === null || remotionMajorVersion < currentRemotionMajorVersion) facts.remotionVersion = resolvedRemotionVersion;
|
|
34573
|
-
}
|
|
34574
|
-
}
|
|
34575
|
-
facts.hasThree = facts.hasThree || THREE_DEPENDENCY_NAMES.some((dependencyName) => getDependencySpec(packageJson, dependencyName) !== null);
|
|
34576
|
-
facts.hasReactThreeFiber = facts.hasReactThreeFiber || REACT_THREE_FIBER_ECOSYSTEM_DEPENDENCY_NAMES.some((dependencyName) => getDependencySpec(packageJson, dependencyName) !== null);
|
|
34577
34227
|
};
|
|
34578
34228
|
const collectWorkspaceFacts = (rootDirectory, rootPackageJson, { collectReactGroup }) => {
|
|
34579
34229
|
const facts = {
|
|
@@ -34589,60 +34239,26 @@ const collectWorkspaceFacts = (rootDirectory, rootPackageJson, { collectReactGro
|
|
|
34589
34239
|
version: null,
|
|
34590
34240
|
sourceDirectory: null
|
|
34591
34241
|
},
|
|
34592
|
-
reactRouter: {
|
|
34593
|
-
version: null,
|
|
34594
|
-
sourceDirectory: null,
|
|
34595
|
-
packageName: null
|
|
34596
|
-
},
|
|
34597
34242
|
shopifyFlashList: {
|
|
34598
34243
|
version: null,
|
|
34599
34244
|
sourceDirectory: null
|
|
34600
34245
|
},
|
|
34601
34246
|
valtioVersion: null,
|
|
34602
|
-
mobx: {
|
|
34603
|
-
version: null,
|
|
34604
|
-
sourceDirectory: null
|
|
34605
|
-
},
|
|
34606
|
-
hasMobxReact: false,
|
|
34607
|
-
mobxReactVersion: null,
|
|
34608
|
-
hasMobxReactLite: false,
|
|
34609
|
-
mobxReactLiteVersion: null,
|
|
34610
|
-
hasMobxStateTree: false,
|
|
34611
|
-
hasMobxReactObserver: false,
|
|
34612
|
-
zustand: {
|
|
34613
|
-
version: null,
|
|
34614
|
-
sourceDirectory: null
|
|
34615
|
-
},
|
|
34616
|
-
tanstackQueryVersion: null,
|
|
34617
|
-
styledComponentsVersion: null,
|
|
34618
|
-
hasI18nLibrary: false,
|
|
34619
34247
|
hasReactNativeAwarePackage: false,
|
|
34620
34248
|
hasReanimatedAwarePackage: false,
|
|
34621
34249
|
hasSsrDependency: false,
|
|
34622
|
-
hasRemotionDependency: false,
|
|
34623
|
-
hasUnknownRemotionVersion: false,
|
|
34624
|
-
remotionVersion: null,
|
|
34625
|
-
hasThree: false,
|
|
34626
|
-
threeVersion: null,
|
|
34627
|
-
hasReactThreeFiber: false,
|
|
34628
|
-
reactThreeFiber: {
|
|
34629
|
-
packageName: null,
|
|
34630
|
-
version: null,
|
|
34631
|
-
sourceDirectory: null
|
|
34632
|
-
},
|
|
34633
|
-
hasReactRouterFramework: false,
|
|
34634
34250
|
reanimatedVersion: null
|
|
34635
34251
|
};
|
|
34636
|
-
evaluateManifestFacts(facts, rootPackageJson, rootDirectory
|
|
34252
|
+
evaluateManifestFacts(facts, rootPackageJson, rootDirectory);
|
|
34637
34253
|
let isReactGroupSettled = !collectReactGroup;
|
|
34638
34254
|
const visitedDirectories = /* @__PURE__ */ new Set();
|
|
34639
34255
|
for (const pattern of getWorkspacePatterns(rootDirectory, rootPackageJson)) {
|
|
34640
|
-
const directories = resolveWorkspaceDirectories(rootDirectory, pattern).
|
|
34256
|
+
const directories = [...resolveWorkspaceDirectories(rootDirectory, pattern)].sort();
|
|
34641
34257
|
for (const workspaceDirectory of directories) {
|
|
34642
34258
|
if (visitedDirectories.has(workspaceDirectory)) continue;
|
|
34643
34259
|
visitedDirectories.add(workspaceDirectory);
|
|
34644
34260
|
const workspacePackageJson = readPackageJson(Path.join(workspaceDirectory, "package.json"));
|
|
34645
|
-
evaluateManifestFacts(facts, workspacePackageJson, workspaceDirectory
|
|
34261
|
+
evaluateManifestFacts(facts, workspacePackageJson, workspaceDirectory);
|
|
34646
34262
|
const info = extractDependencyInfo(workspacePackageJson);
|
|
34647
34263
|
if (info.framework !== "unknown" && frameworkMergeRank(info.framework) < frameworkMergeRank(facts.framework)) facts.framework = info.framework;
|
|
34648
34264
|
if (isReactGroupSettled) continue;
|
|
@@ -34673,7 +34289,7 @@ const collectWorkspaceFacts = (rootDirectory, rootPackageJson, { collectReactGro
|
|
|
34673
34289
|
workspaceDirectory,
|
|
34674
34290
|
workspacePackageJson
|
|
34675
34291
|
});
|
|
34676
|
-
if (reactVersion &&
|
|
34292
|
+
if (reactVersion && shouldReplaceReactVersion(facts.reactVersion, reactVersion)) facts.reactVersion = reactVersion;
|
|
34677
34293
|
if (tailwindVersion && !facts.tailwindVersion) facts.tailwindVersion = tailwindVersion;
|
|
34678
34294
|
if (zodVersion && !facts.zodVersion) facts.zodVersion = zodVersion;
|
|
34679
34295
|
const settledReactMajor = parseReactMajor(facts.reactVersion);
|
|
@@ -34866,16 +34482,6 @@ const discoverProjectWithoutPackageJson = (directory) => {
|
|
|
34866
34482
|
tailwindVersion: null,
|
|
34867
34483
|
zodVersion: null,
|
|
34868
34484
|
zodMajorVersion: null,
|
|
34869
|
-
mobxVersion: null,
|
|
34870
|
-
mobxMajorVersion: null,
|
|
34871
|
-
hasMobxReact: false,
|
|
34872
|
-
mobxReactVersion: null,
|
|
34873
|
-
hasMobxReactLite: false,
|
|
34874
|
-
mobxReactLiteVersion: null,
|
|
34875
|
-
hasMobxStateTree: false,
|
|
34876
|
-
hasMobxReactObserver: false,
|
|
34877
|
-
zustandVersion: null,
|
|
34878
|
-
zustandMajorVersion: null,
|
|
34879
34485
|
framework: "unknown",
|
|
34880
34486
|
hasTypeScript: hasOwnTsConfig,
|
|
34881
34487
|
hasReactCompiler: false,
|
|
@@ -34883,26 +34489,12 @@ const discoverProjectWithoutPackageJson = (directory) => {
|
|
|
34883
34489
|
hasTanStackQuery: false,
|
|
34884
34490
|
valtioVersion: null,
|
|
34885
34491
|
valtioMajorVersion: null,
|
|
34886
|
-
hasRemotion: false,
|
|
34887
|
-
remotionVersion: null,
|
|
34888
|
-
remotionMajorVersion: null,
|
|
34889
|
-
hasI18nLibrary: false,
|
|
34890
|
-
tanstackQueryVersion: null,
|
|
34891
|
-
styledComponentsVersion: null,
|
|
34892
|
-
hasThree: false,
|
|
34893
|
-
threeVersion: null,
|
|
34894
|
-
threeRelease: null,
|
|
34895
|
-
hasReactThreeFiber: false,
|
|
34896
|
-
reactThreeFiberVersion: null,
|
|
34897
|
-
reactThreeFiberMajorVersion: null,
|
|
34898
34492
|
hasSsrDependency: false,
|
|
34899
34493
|
preactVersion: null,
|
|
34900
34494
|
preactMajorVersion: null,
|
|
34901
34495
|
hasReactNativeWorkspace: false,
|
|
34902
34496
|
nextjsVersion: null,
|
|
34903
34497
|
nextjsMajorVersion: null,
|
|
34904
|
-
reactRouterVersion: null,
|
|
34905
|
-
hasReactRouterFramework: false,
|
|
34906
34498
|
expoVersion: null,
|
|
34907
34499
|
shopifyFlashListVersion: null,
|
|
34908
34500
|
shopifyFlashListMajorVersion: null,
|
|
@@ -34995,12 +34587,6 @@ const discoverProject = (directory) => {
|
|
|
34995
34587
|
packageName: SHOPIFY_FLASH_LIST_PACKAGE_NAME,
|
|
34996
34588
|
version: workspaceFacts.shopifyFlashList.version
|
|
34997
34589
|
}) : null;
|
|
34998
|
-
const zustandVersion = resolveCatalogBackedDependencyVersion({
|
|
34999
|
-
rootDirectory: directory,
|
|
35000
|
-
rootPackageJson: packageJson,
|
|
35001
|
-
packageName: "zustand",
|
|
35002
|
-
version: workspaceFacts.zustand.version
|
|
35003
|
-
});
|
|
35004
34590
|
const hasReanimated = hasReactNativeWorkspace && workspaceFacts.hasReanimatedAwarePackage;
|
|
35005
34591
|
const reanimatedVersion = hasReanimated ? workspaceFacts.reanimatedVersion : null;
|
|
35006
34592
|
const nextjsVersion = framework === "nextjs" ? resolveCatalogBackedDependencyVersion({
|
|
@@ -35015,33 +34601,7 @@ const discoverProject = (directory) => {
|
|
|
35015
34601
|
packageName: "valtio",
|
|
35016
34602
|
version: workspaceFacts.valtioVersion
|
|
35017
34603
|
});
|
|
35018
|
-
const mobxVersion = resolveCatalogBackedDependencyVersion({
|
|
35019
|
-
rootDirectory: directory,
|
|
35020
|
-
rootPackageJson: packageJson,
|
|
35021
|
-
packageName: "mobx",
|
|
35022
|
-
version: workspaceFacts.mobx.version
|
|
35023
|
-
});
|
|
35024
|
-
const reactRouterVersion = workspaceFacts.reactRouter.packageName === null ? null : resolveCatalogBackedDependencyVersion({
|
|
35025
|
-
rootDirectory: directory,
|
|
35026
|
-
rootPackageJson: packageJson,
|
|
35027
|
-
packageName: workspaceFacts.reactRouter.packageName,
|
|
35028
|
-
version: workspaceFacts.reactRouter.version
|
|
35029
|
-
});
|
|
35030
34604
|
const preactVersion = getPreactVersion(packageJson);
|
|
35031
|
-
const remotionVersion = workspaceFacts.remotionVersion;
|
|
35032
|
-
const tanstackQueryVersion = getTanStackQueryVersion(packageJson) ?? workspaceFacts.tanstackQueryVersion;
|
|
35033
|
-
const reactThreeFiberVersion = workspaceFacts.reactThreeFiber.packageName ? resolveCatalogBackedDependencyVersion({
|
|
35034
|
-
rootDirectory: directory,
|
|
35035
|
-
rootPackageJson: packageJson,
|
|
35036
|
-
packageName: workspaceFacts.reactThreeFiber.packageName,
|
|
35037
|
-
version: workspaceFacts.reactThreeFiber.version
|
|
35038
|
-
}) : null;
|
|
35039
|
-
const threeVersion = resolveCatalogBackedDependencyVersion({
|
|
35040
|
-
rootDirectory: directory,
|
|
35041
|
-
rootPackageJson: packageJson,
|
|
35042
|
-
packageName: "three",
|
|
35043
|
-
version: workspaceFacts.threeVersion
|
|
35044
|
-
});
|
|
35045
34605
|
const isPreES2023Target = hasTypeScript && detectPreES2023Target(directory);
|
|
35046
34606
|
const projectInfo = {
|
|
35047
34607
|
rootDirectory: directory,
|
|
@@ -35051,43 +34611,19 @@ const discoverProject = (directory) => {
|
|
|
35051
34611
|
tailwindVersion,
|
|
35052
34612
|
zodVersion,
|
|
35053
34613
|
zodMajorVersion: zodVersion === null ? null : getLowestDependencyMajor(zodVersion),
|
|
35054
|
-
mobxVersion,
|
|
35055
|
-
mobxMajorVersion: mobxVersion === null ? null : getDependencyMajorWithinSupportedRange(mobxVersion, 6),
|
|
35056
|
-
hasMobxReact: workspaceFacts.hasMobxReact,
|
|
35057
|
-
mobxReactVersion: workspaceFacts.mobxReactVersion,
|
|
35058
|
-
hasMobxReactLite: workspaceFacts.hasMobxReactLite,
|
|
35059
|
-
mobxReactLiteVersion: workspaceFacts.mobxReactLiteVersion,
|
|
35060
|
-
hasMobxStateTree: workspaceFacts.hasMobxStateTree,
|
|
35061
|
-
hasMobxReactObserver: workspaceFacts.hasMobxReactObserver,
|
|
35062
|
-
zustandVersion,
|
|
35063
|
-
zustandMajorVersion: zustandVersion === null ? null : getLowestDependencyMajor(zustandVersion),
|
|
35064
34614
|
framework,
|
|
35065
34615
|
hasTypeScript,
|
|
35066
34616
|
hasReactCompiler: detectReactCompiler(directory, packageJson),
|
|
35067
34617
|
hasReactCompilerLintPlugin: detectReactCompilerLintPlugin(directory, packageJson),
|
|
35068
|
-
hasTanStackQuery:
|
|
35069
|
-
hasI18nLibrary: workspaceFacts.hasI18nLibrary,
|
|
35070
|
-
tanstackQueryVersion,
|
|
35071
|
-
styledComponentsVersion: workspaceFacts.styledComponentsVersion,
|
|
34618
|
+
hasTanStackQuery: hasTanStackQuery(packageJson),
|
|
35072
34619
|
valtioVersion,
|
|
35073
34620
|
valtioMajorVersion: valtioVersion === null ? null : getLowestDependencyMajor(valtioVersion),
|
|
35074
|
-
hasRemotion: workspaceFacts.hasRemotionDependency,
|
|
35075
|
-
remotionVersion,
|
|
35076
|
-
remotionMajorVersion: remotionVersion === null ? null : getLowestDependencyMajor(remotionVersion),
|
|
35077
|
-
hasThree: workspaceFacts.hasThree,
|
|
35078
|
-
threeVersion,
|
|
35079
|
-
threeRelease: parseThreeRelease(threeVersion),
|
|
35080
|
-
hasReactThreeFiber: workspaceFacts.hasReactThreeFiber,
|
|
35081
|
-
reactThreeFiberVersion,
|
|
35082
|
-
reactThreeFiberMajorVersion: reactThreeFiberVersion === null ? null : getLowestDependencyMajor(reactThreeFiberVersion),
|
|
35083
34621
|
hasSsrDependency: workspaceFacts.hasSsrDependency,
|
|
35084
34622
|
preactVersion,
|
|
35085
34623
|
preactMajorVersion: parseReactMajor(preactVersion),
|
|
35086
34624
|
hasReactNativeWorkspace,
|
|
35087
34625
|
nextjsVersion,
|
|
35088
34626
|
nextjsMajorVersion: nextjsVersion === null ? null : getLowestDependencyMajor(nextjsVersion),
|
|
35089
|
-
reactRouterVersion,
|
|
35090
|
-
hasReactRouterFramework: workspaceFacts.hasReactRouterFramework,
|
|
35091
34627
|
expoVersion,
|
|
35092
34628
|
shopifyFlashListVersion,
|
|
35093
34629
|
shopifyFlashListMajorVersion: shopifyFlashListVersion === null ? null : getLowestDependencyMajor(shopifyFlashListVersion),
|
|
@@ -38282,10 +37818,10 @@ const SSR_FRAMEWORKS = new Set([
|
|
|
38282
37818
|
"gatsby",
|
|
38283
37819
|
"tanstack-start"
|
|
38284
37820
|
]);
|
|
38285
|
-
const
|
|
38286
|
-
if (
|
|
38287
|
-
const
|
|
38288
|
-
for (let candidate = earliest; candidate <=
|
|
37821
|
+
const addMajorLadder = (capabilities, name, major, earliest, latest) => {
|
|
37822
|
+
if (major === null) return;
|
|
37823
|
+
const cappedMajor = Math.min(major, latest);
|
|
37824
|
+
for (let candidate = earliest; candidate <= cappedMajor; candidate += 1) capabilities.add(`${name}:${candidate}`);
|
|
38289
37825
|
};
|
|
38290
37826
|
const buildCapabilities = (project) => {
|
|
38291
37827
|
const capabilities = /* @__PURE__ */ new Set();
|
|
@@ -38298,86 +37834,26 @@ const buildCapabilities = (project) => {
|
|
|
38298
37834
|
if (CLIENT_ONLY_FRAMEWORKS.has(project.framework)) capabilities.add("client-only");
|
|
38299
37835
|
if (project.isStaticExport) capabilities.add("nextjs:static-export");
|
|
38300
37836
|
if (project.nextjsMajorVersion !== null && project.nextjsMajorVersion >= 15) capabilities.add("nextjs:15");
|
|
38301
|
-
|
|
38302
|
-
const reactRouterVersion = project.reactRouterVersion ?? null;
|
|
38303
|
-
if (reactRouterVersion !== null) {
|
|
38304
|
-
capabilities.add("react-router");
|
|
38305
|
-
if (project.hasReactRouterFramework === true) capabilities.add("react-router-framework");
|
|
38306
|
-
const detectedVersion = parseReactMajorMinor(reactRouterVersion);
|
|
38307
|
-
if (detectedVersion !== null) {
|
|
38308
|
-
for (const threshold of REACT_ROUTER_CAPABILITY_THRESHOLDS) if (isMajorMinorAtLeast(detectedVersion, threshold)) capabilities.add(threshold.capability);
|
|
38309
|
-
}
|
|
38310
|
-
}
|
|
38311
|
-
addVersionCapabilityLadder(capabilities, "react", project.reactMajorVersion, 17, 30);
|
|
37837
|
+
addMajorLadder(capabilities, "react", project.reactMajorVersion, 17, 30);
|
|
38312
37838
|
if (project.reactMajorVersion !== null && project.reactMajorVersion >= 19 && isMajorMinorAtLeast(parseReactMajorMinor(project.reactVersion), {
|
|
38313
37839
|
major: 19,
|
|
38314
37840
|
minor: 2
|
|
38315
37841
|
})) capabilities.add("react:19.2");
|
|
38316
|
-
if (project.tailwindVersion !== null)
|
|
38317
|
-
|
|
38318
|
-
|
|
38319
|
-
|
|
38320
|
-
|
|
38321
|
-
minor: 4
|
|
38322
|
-
})) capabilities.add("tailwind:3.4");
|
|
38323
|
-
if (tailwindVersion !== null && isMajorMinorAtLeast(tailwindVersion, {
|
|
38324
|
-
major: 4,
|
|
38325
|
-
minor: 0
|
|
38326
|
-
})) capabilities.add("tailwind:4");
|
|
38327
|
-
}
|
|
37842
|
+
if (project.tailwindVersion !== null) capabilities.add("tailwind");
|
|
37843
|
+
if (project.tailwindVersion !== null && isMajorMinorAtLeast(parseTailwindMajorMinor(project.tailwindVersion), {
|
|
37844
|
+
major: 3,
|
|
37845
|
+
minor: 4
|
|
37846
|
+
})) capabilities.add("tailwind:3.4");
|
|
38328
37847
|
if (project.zodVersion !== null) capabilities.add("zod");
|
|
38329
37848
|
if (project.zodMajorVersion !== null && project.zodMajorVersion >= 4) capabilities.add("zod:4");
|
|
38330
|
-
if (project.mobxVersion !== void 0 && project.mobxVersion !== null || project.hasMobxReact === true || project.hasMobxReactLite === true || project.hasMobxStateTree === true || project.hasMobxReactObserver === true) capabilities.add("mobx");
|
|
38331
|
-
if (project.hasMobxReact === true) capabilities.add("mobx-react");
|
|
38332
|
-
if (project.hasMobxReactLite === true) capabilities.add("mobx-react-lite");
|
|
38333
|
-
if (project.hasMobxReact === true || project.hasMobxReactLite === true) capabilities.add("mobx-react-binding");
|
|
38334
|
-
const mobxReactVersion = parseDependencyMajorMinor(project.mobxReactVersion);
|
|
38335
|
-
const mobxReactLiteVersion = parseDependencyMajorMinor(project.mobxReactLiteVersion);
|
|
38336
|
-
const hasMobxReactObserverMemoGuard = mobxReactVersion !== null && isMajorMinorAtLeast(mobxReactVersion, {
|
|
38337
|
-
major: 7,
|
|
38338
|
-
minor: 3
|
|
38339
|
-
});
|
|
38340
|
-
const hasMobxReactLiteObserverMemoGuard = mobxReactLiteVersion !== null && isMajorMinorAtLeast(mobxReactLiteVersion, {
|
|
38341
|
-
major: 3,
|
|
38342
|
-
minor: 3
|
|
38343
|
-
});
|
|
38344
|
-
if (hasMobxReactObserverMemoGuard) capabilities.add("mobx-react-observer-memo-guard");
|
|
38345
|
-
if (hasMobxReactLiteObserverMemoGuard) capabilities.add("mobx-react-lite-observer-memo-guard");
|
|
38346
|
-
if (hasMobxReactObserverMemoGuard || hasMobxReactLiteObserverMemoGuard) capabilities.add("mobx-react-binding-observer-memo-guard");
|
|
38347
|
-
if (project.hasMobxStateTree === true) capabilities.add("mobx-state-tree");
|
|
38348
|
-
if (project.hasMobxReactObserver === true) capabilities.add("mobx-react-observer");
|
|
38349
|
-
if (project.mobxMajorVersion !== void 0 && project.mobxMajorVersion !== null && project.mobxMajorVersion >= 4 && project.mobxMajorVersion <= 6) addVersionCapabilityLadder(capabilities, "mobx", project.mobxMajorVersion, 4, 6);
|
|
38350
|
-
const mobxVersion = parseDependencyMajorMinor(project.mobxVersion);
|
|
38351
|
-
if (project.mobxMajorVersion === 6 && mobxVersion !== null && isMajorMinorAtLeast(mobxVersion, {
|
|
38352
|
-
major: 6,
|
|
38353
|
-
minor: 10
|
|
38354
|
-
})) capabilities.add("mobx:6.10");
|
|
38355
|
-
if (project.zustandVersion !== void 0 && project.zustandVersion !== null) capabilities.add("zustand");
|
|
38356
|
-
if (project.zustandMajorVersion !== void 0 && project.zustandMajorVersion !== null && project.zustandMajorVersion >= 1 && project.zustandMajorVersion <= 5) addVersionCapabilityLadder(capabilities, "zustand", project.zustandMajorVersion, 1, 5);
|
|
38357
37849
|
if (project.isPreES2023Target) capabilities.add("pre-es2023");
|
|
38358
37850
|
if (project.hasReactCompiler) capabilities.add("react-compiler");
|
|
38359
|
-
if (
|
|
38360
|
-
if (project.styledComponentsVersion) {
|
|
38361
|
-
capabilities.add("styled-components");
|
|
38362
|
-
const styledComponentsMajor = getLowestDependencyMajor(project.styledComponentsVersion);
|
|
38363
|
-
if (styledComponentsMajor !== null && styledComponentsMajor >= 6) capabilities.add("styled-components:6");
|
|
38364
|
-
}
|
|
38365
|
-
if (project.hasI18nLibrary) capabilities.add("i18n");
|
|
37851
|
+
if (project.hasTanStackQuery) capabilities.add("tanstack-query");
|
|
38366
37852
|
if (project.valtioVersion !== null) capabilities.add("valtio");
|
|
38367
|
-
|
|
38368
|
-
if (project.hasRemotion) {
|
|
38369
|
-
capabilities.add("remotion");
|
|
38370
|
-
addVersionCapabilityLadder(capabilities, "remotion", project.remotionMajorVersion ?? null, 4, 30);
|
|
38371
|
-
}
|
|
38372
|
-
if (project.hasThree || project.hasReactThreeFiber) capabilities.add("three");
|
|
38373
|
-
addVersionCapabilityLadder(capabilities, "three", project.threeRelease ?? null, 145, 250);
|
|
38374
|
-
if (project.hasReactThreeFiber) {
|
|
38375
|
-
capabilities.add("r3f");
|
|
38376
|
-
addVersionCapabilityLadder(capabilities, "r3f", project.reactThreeFiberMajorVersion ?? null, 3, 10);
|
|
38377
|
-
}
|
|
37853
|
+
addMajorLadder(capabilities, "valtio", project.valtioMajorVersion, 1, 10);
|
|
38378
37854
|
if (project.hasTypeScript) capabilities.add("typescript");
|
|
38379
37855
|
if (project.preactVersion !== null) capabilities.add("preact");
|
|
38380
|
-
|
|
37856
|
+
addMajorLadder(capabilities, "preact", project.preactMajorVersion, 10, 20);
|
|
38381
37857
|
if (project.preactVersion !== null && project.reactVersion === null) capabilities.add("pure-preact");
|
|
38382
37858
|
return capabilities;
|
|
38383
37859
|
};
|
|
@@ -38389,7 +37865,7 @@ const getCapabilities = (project) => {
|
|
|
38389
37865
|
capabilitiesByProject.set(project, capabilities);
|
|
38390
37866
|
return capabilities;
|
|
38391
37867
|
};
|
|
38392
|
-
const shouldEnableRule = (requires, tags, capabilities, ignoredTags, disabledWhen
|
|
37868
|
+
const shouldEnableRule = (requires, tags, capabilities, ignoredTags, disabledWhen) => {
|
|
38393
37869
|
if (requires) {
|
|
38394
37870
|
for (const capability of requires) if (!capabilities.has(capability)) return false;
|
|
38395
37871
|
}
|
|
@@ -38400,29 +37876,20 @@ const shouldEnableRule = (requires, tags, capabilities, ignoredTags, disabledWhe
|
|
|
38400
37876
|
if (tags) {
|
|
38401
37877
|
for (const tag of tags) if (ignoredTags.has(tag)) return false;
|
|
38402
37878
|
}
|
|
38403
|
-
if (includedTags && includedTags.size > 0) {
|
|
38404
|
-
if (!tags?.some((tag) => includedTags.has(tag))) return false;
|
|
38405
|
-
}
|
|
38406
37879
|
return true;
|
|
38407
37880
|
};
|
|
38408
|
-
const shouldEnableRuleByDefaultStatus = (options) => options.defaultEnabled !== false || options.hasExplicitOverride === true || options.includeTagDefaults && options.hasIncludedTags;
|
|
38409
37881
|
const yieldToEventLoop = () => new Promise((resolve) => {
|
|
38410
37882
|
setImmediate(resolve);
|
|
38411
37883
|
});
|
|
38412
37884
|
const createSecurityScanSession = (rootDirectory, options) => {
|
|
38413
37885
|
const capabilities = options.project ? getCapabilities(options.project) : /* @__PURE__ */ new Set();
|
|
38414
37886
|
const ignoredTags = options.ignoredTags ?? /* @__PURE__ */ new Set();
|
|
38415
|
-
const includedTags = options.includedTags ?? /* @__PURE__ */ new Set();
|
|
38416
37887
|
const enabledScanRules = REACT_DOCTOR_RULES.flatMap((entry) => {
|
|
38417
37888
|
const rule = entry.rule;
|
|
38418
37889
|
const scan = rule.scan;
|
|
38419
37890
|
if (typeof scan !== "function") return [];
|
|
38420
|
-
if (
|
|
38421
|
-
|
|
38422
|
-
includeTagDefaults: options.includeTagDefaults === true,
|
|
38423
|
-
hasIncludedTags: includedTags.size > 0
|
|
38424
|
-
})) return [];
|
|
38425
|
-
if (!shouldEnableRule(rule.requires, rule.tags, capabilities, ignoredTags, rule.disabledWhen, includedTags)) return [];
|
|
37891
|
+
if (rule.defaultEnabled === false) return [];
|
|
37892
|
+
if (!shouldEnableRule(rule.requires, rule.tags, capabilities, ignoredTags, rule.disabledWhen)) return [];
|
|
38426
37893
|
return [{
|
|
38427
37894
|
entry,
|
|
38428
37895
|
scan,
|
|
@@ -40408,9 +39875,8 @@ const buildUserPluginRules = (userPlugin, severityControls) => {
|
|
|
40408
39875
|
}
|
|
40409
39876
|
return enabled;
|
|
40410
39877
|
};
|
|
40411
|
-
const createOxlintConfig = ({ pluginPath, project, customRulesOnly = false, extendsPaths = [], ignoredTags = /* @__PURE__ */ new Set(),
|
|
40412
|
-
const
|
|
40413
|
-
const reactHooksJsPlugin = disableReactHooksJsPlugin || ruleSelection === "sidecar" || hasIncludedTags ? null : resolveReactHooksJsPlugin(project.hasReactCompiler || project.hasReactCompilerLintPlugin === true, customRulesOnly);
|
|
39878
|
+
const createOxlintConfig = ({ pluginPath, project, customRulesOnly = false, extendsPaths = [], ignoredTags = /* @__PURE__ */ new Set(), serverAuthFunctionNames, severityControls, userPlugins = [], disableReactHooksJsPlugin = false, ruleSelection, sidecarRuleIdFilter }) => {
|
|
39879
|
+
const reactHooksJsPlugin = disableReactHooksJsPlugin || ruleSelection === "sidecar" ? null : resolveReactHooksJsPlugin(project.hasReactCompiler || project.hasReactCompilerLintPlugin === true, customRulesOnly);
|
|
40414
39880
|
const reactCompilerRules = reactHooksJsPlugin ? applyRuleSeverityControls(filterRulesToAvailable(REACT_COMPILER_RULES, "react-hooks-js", reactHooksJsPlugin.availableRuleNames), severityControls) : {};
|
|
40415
39881
|
const jsPlugins = [];
|
|
40416
39882
|
if (reactHooksJsPlugin) jsPlugins.push(reactHooksJsPlugin.entry);
|
|
@@ -40425,14 +39891,9 @@ const createOxlintConfig = ({ pluginPath, project, customRulesOnly = false, exte
|
|
|
40425
39891
|
if (rule.scan !== void 0) continue;
|
|
40426
39892
|
if (customRulesOnly && registryEntry.originallyExternal) continue;
|
|
40427
39893
|
if (rule.framework !== "global" && !rule.requires) continue;
|
|
40428
|
-
if (!shouldEnableRule(rule.requires, rule.tags, capabilities, ignoredTags, rule.disabledWhen
|
|
39894
|
+
if (!shouldEnableRule(rule.requires, rule.tags, capabilities, ignoredTags, rule.disabledWhen)) continue;
|
|
40429
39895
|
const explicitRuleOverride = resolveRuleSeverityOverride({ ruleKey: registryEntry.key }, severityControls);
|
|
40430
|
-
if (
|
|
40431
|
-
defaultEnabled: rule.defaultEnabled,
|
|
40432
|
-
includeTagDefaults,
|
|
40433
|
-
hasIncludedTags,
|
|
40434
|
-
hasExplicitOverride: explicitRuleOverride !== void 0
|
|
40435
|
-
})) continue;
|
|
39896
|
+
if (rule.defaultEnabled === false && explicitRuleOverride === void 0) continue;
|
|
40436
39897
|
const severity = resolveRuleSeverityOverride({
|
|
40437
39898
|
ruleKey: registryEntry.key,
|
|
40438
39899
|
category: rule.category
|
|
@@ -40441,7 +39902,7 @@ const createOxlintConfig = ({ pluginPath, project, customRulesOnly = false, exte
|
|
|
40441
39902
|
enabledReactDoctorRules[registryEntry.key] = severity;
|
|
40442
39903
|
}
|
|
40443
39904
|
const userPluginRules = {};
|
|
40444
|
-
if (ruleSelection !== "sidecar"
|
|
39905
|
+
if (ruleSelection !== "sidecar") for (const userPlugin of userPlugins) {
|
|
40445
39906
|
Object.assign(userPluginRules, buildUserPluginRules(userPlugin, severityControls));
|
|
40446
39907
|
jsPlugins.push(userPlugin.entry);
|
|
40447
39908
|
}
|
|
@@ -40658,19 +40119,6 @@ const createSidecarLintCache = (cacheDirectory, rulesetHash) => {
|
|
|
40658
40119
|
}
|
|
40659
40120
|
};
|
|
40660
40121
|
};
|
|
40661
|
-
const fingerprintCacheByFilePath = /* @__PURE__ */ new Map();
|
|
40662
|
-
const fingerprintFileContents = (filePath, fingerprintLength) => {
|
|
40663
|
-
const fileStats = NFS.statSync(filePath, { bigint: true });
|
|
40664
|
-
const cachedFingerprint = fingerprintCacheByFilePath.get(filePath);
|
|
40665
|
-
if (cachedFingerprint?.modifiedTimeNanoseconds === fileStats.mtimeNs && cachedFingerprint.sizeBytes === fileStats.size) return cachedFingerprint.fingerprint;
|
|
40666
|
-
const fingerprint = crypto.createHash("sha256").update(NFS.readFileSync(filePath)).digest("hex").slice(0, fingerprintLength);
|
|
40667
|
-
fingerprintCacheByFilePath.set(filePath, {
|
|
40668
|
-
fingerprint,
|
|
40669
|
-
modifiedTimeNanoseconds: fileStats.mtimeNs,
|
|
40670
|
-
sizeBytes: fileStats.size
|
|
40671
|
-
});
|
|
40672
|
-
return fingerprint;
|
|
40673
|
-
};
|
|
40674
40122
|
const bundledRequire = createRequire(import.meta.url);
|
|
40675
40123
|
const childNodeVersionByBinaryPath = /* @__PURE__ */ new Map();
|
|
40676
40124
|
const resolveChildNodeVersion = (nodeBinaryPath) => {
|
|
@@ -40694,13 +40142,6 @@ const TOOLCHAIN_PACKAGE_SPECIFIERS = [
|
|
|
40694
40142
|
"oxlint-plugin-react-doctor/package.json",
|
|
40695
40143
|
"eslint-plugin-react-hooks/package.json"
|
|
40696
40144
|
];
|
|
40697
|
-
const resolvePluginFingerprint = () => {
|
|
40698
|
-
try {
|
|
40699
|
-
return fingerprintFileContents(bundledRequire.resolve("oxlint-plugin-react-doctor"), 16);
|
|
40700
|
-
} catch {
|
|
40701
|
-
return "unresolved";
|
|
40702
|
-
}
|
|
40703
|
-
};
|
|
40704
40145
|
const resolveOxlintToolchainVersions = (nodeBinaryPath = process.execPath) => {
|
|
40705
40146
|
const versions = [`node=${resolveChildNodeVersion(nodeBinaryPath)}`];
|
|
40706
40147
|
for (const specifier of TOOLCHAIN_PACKAGE_SPECIFIERS) try {
|
|
@@ -40710,7 +40151,6 @@ const resolveOxlintToolchainVersions = (nodeBinaryPath = process.execPath) => {
|
|
|
40710
40151
|
} catch {
|
|
40711
40152
|
versions.push(`${specifier}=missing`);
|
|
40712
40153
|
}
|
|
40713
|
-
versions.push(`oxlint-plugin-react-doctor#fingerprint=${resolvePluginFingerprint()}`);
|
|
40714
40154
|
return versions;
|
|
40715
40155
|
};
|
|
40716
40156
|
const esmRequire = createRequire(import.meta.url);
|
|
@@ -42186,7 +41626,7 @@ const reactHooksJsPluginDropNote = (error) => {
|
|
|
42186
41626
|
* 6. always restore disable directives + clean up the temp dir
|
|
42187
41627
|
*/
|
|
42188
41628
|
const runOxlint = async (options) => {
|
|
42189
|
-
const { rootDirectory, project, includePaths, nodeBinaryPath = process.execPath, customRulesOnly = false, respectInlineDisables = true, adoptExistingLintConfig = true, ignoredTags = /* @__PURE__ */ new Set(),
|
|
41629
|
+
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;
|
|
42190
41630
|
const serverAuthFunctionNames = Array.isArray(userConfig?.serverAuthFunctionNames) ? userConfig.serverAuthFunctionNames.filter((entry) => typeof entry === "string" && entry.length > 0) : void 0;
|
|
42191
41631
|
const severityControls = buildRuleSeverityControls(userConfig);
|
|
42192
41632
|
validateRuleRegistration();
|
|
@@ -42200,15 +41640,13 @@ const runOxlint = async (options) => {
|
|
|
42200
41640
|
}
|
|
42201
41641
|
const pluginPath = resolvePluginPath();
|
|
42202
41642
|
const extendsPaths = (adoptExistingLintConfig && !customRulesOnly ? detectUserLintConfigPaths(rootDirectory) : []).filter(canOxlintExtendConfig);
|
|
42203
|
-
const userPlugins =
|
|
41643
|
+
const userPlugins = resolveUserPlugins(userConfig?.plugins, configSourceDirectory);
|
|
42204
41644
|
const buildConfig = (overrides) => createOxlintConfig({
|
|
42205
41645
|
pluginPath,
|
|
42206
41646
|
project,
|
|
42207
41647
|
customRulesOnly,
|
|
42208
41648
|
extendsPaths: overrides.extendsPaths,
|
|
42209
41649
|
ignoredTags,
|
|
42210
|
-
includedTags,
|
|
42211
|
-
includeTagDefaults,
|
|
42212
41650
|
serverAuthFunctionNames,
|
|
42213
41651
|
severityControls,
|
|
42214
41652
|
userPlugins,
|
|
@@ -42597,8 +42035,6 @@ var Linter = class Linter extends Service()("react-doctor/Linter") {
|
|
|
42597
42035
|
respectInlineDisables: input.respectInlineDisables,
|
|
42598
42036
|
adoptExistingLintConfig: input.adoptExistingLintConfig,
|
|
42599
42037
|
ignoredTags: input.ignoredTags,
|
|
42600
|
-
includedTags: input.includedTags,
|
|
42601
|
-
includeTagDefaults: input.includeTagDefaults,
|
|
42602
42038
|
userConfig: input.userConfig ?? null,
|
|
42603
42039
|
configSourceDirectory: input.configSourceDirectory,
|
|
42604
42040
|
onPartialFailure: (reason) => {
|
|
@@ -43447,9 +42883,7 @@ const runInspect = (input, hooks = {}) => gen(function* () {
|
|
|
43447
42883
|
const securityScanFailedRef = yield* make$13(false);
|
|
43448
42884
|
const securityScanFiber = yield* forkChild(runCollect(applyPerElementPipeline(isDiffMode ? empty$4 : unwrap(tryPromise(() => checkSecurityScanCooperative(scanDirectory, {
|
|
43449
42885
|
project,
|
|
43450
|
-
ignoredTags: input.ignoredTags
|
|
43451
|
-
includedTags: input.includedTags,
|
|
43452
|
-
includeTagDefaults: input.includeTagDefaults
|
|
42886
|
+
ignoredTags: input.ignoredTags
|
|
43453
42887
|
})).pipe(map$3((diagnostics) => fromIterable$1(diagnostics)), catch_$1(() => set(securityScanFailedRef, true).pipe(as(empty$4))))))).pipe(withSpan("SecurityScan.run")));
|
|
43454
42888
|
const shouldRunSupplyChain = !isDiffMode || (input.supplyChainManifestChanged ?? false);
|
|
43455
42889
|
const supplyChainOverlapTimeout = yield* SupplyChainOverlapTimeoutMs;
|
|
@@ -43540,8 +42974,6 @@ const runInspect = (input, hooks = {}) => gen(function* () {
|
|
|
43540
42974
|
respectInlineDisables: input.respectInlineDisables,
|
|
43541
42975
|
adoptExistingLintConfig: input.adoptExistingLintConfig,
|
|
43542
42976
|
ignoredTags: input.ignoredTags,
|
|
43543
|
-
includedTags: input.includedTags,
|
|
43544
|
-
includeTagDefaults: input.includeTagDefaults,
|
|
43545
42977
|
userConfig: resolvedConfig.config ?? void 0,
|
|
43546
42978
|
configSourceDirectory: resolvedConfig.configSourceDirectory ?? void 0,
|
|
43547
42979
|
onFileProgress: (scannedFileCount, totalFileCount) => {
|
|
@@ -46044,5 +45476,5 @@ const startLanguageServer = () => {
|
|
|
46044
45476
|
};
|
|
46045
45477
|
//#endregion
|
|
46046
45478
|
export { startLanguageServer };
|
|
46047
|
-
!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]="
|
|
46048
|
-
//# debugId=
|
|
45479
|
+
!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]="a257778d-cb0a-54d7-909d-889a64e8698c")}catch(e){}}();
|
|
45480
|
+
//# debugId=a257778d-cb0a-54d7-909d-889a64e8698c
|