react-doctor 0.8.1-dev.5774353 → 0.8.1-dev.5b468f8
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 +14 -4
- package/dist/cli.js +646 -143
- package/dist/index.d.ts +32 -0
- package/dist/index.js +555 -99
- package/dist/lsp.js +555 -99
- package/dist/skills/react-doctor/SKILL.md +5 -0
- package/package.json +3 -3
package/dist/lsp.js
CHANGED
|
@@ -32883,44 +32883,6 @@ 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
|
-
};
|
|
32924
32886
|
const SOURCE_FILE_PATTERN = /\.(tsx?|jsx?|mts|mjs)$/;
|
|
32925
32887
|
const GENERATED_BUNDLE_FILE_PATTERN = /\.(iife|umd|global|min)\.m?js$/i;
|
|
32926
32888
|
const GENERATED_SOURCE_DIRECTORY_PATTERN = /(?:^|\/)__generated__\//;
|
|
@@ -33102,6 +33064,44 @@ const SUPPLY_CHAIN_OVERLAP_TIMEOUT_MS = 9e4;
|
|
|
33102
33064
|
const SUPPLY_CHAIN_CACHE_TTL_MS = 864e5;
|
|
33103
33065
|
const SUPPLY_CHAIN_CACHE_SUBDIR = "supply-chain";
|
|
33104
33066
|
const SUPPLY_CHAIN_IGNORED_PACKAGES = new Set(["next"]);
|
|
33067
|
+
const isErrnoException = (error) => error instanceof Error && "code" in error;
|
|
33068
|
+
const IGNORABLE_READDIR_ERROR_CODES = new Set([
|
|
33069
|
+
"EACCES",
|
|
33070
|
+
"EPERM",
|
|
33071
|
+
"ENOENT",
|
|
33072
|
+
"ENOTDIR",
|
|
33073
|
+
"EINVAL",
|
|
33074
|
+
"ELOOP",
|
|
33075
|
+
"ENAMETOOLONG"
|
|
33076
|
+
]);
|
|
33077
|
+
const isIgnorableReaddirError = (error) => isErrnoException(error) && typeof error.code === "string" && IGNORABLE_READDIR_ERROR_CODES.has(error.code);
|
|
33078
|
+
const readDirectoryEntries = (directoryPath) => {
|
|
33079
|
+
try {
|
|
33080
|
+
return NFS.readdirSync(directoryPath, { withFileTypes: true });
|
|
33081
|
+
} catch (error) {
|
|
33082
|
+
if (isIgnorableReaddirError(error)) return [];
|
|
33083
|
+
throw error;
|
|
33084
|
+
}
|
|
33085
|
+
};
|
|
33086
|
+
const isFile = (filePath) => {
|
|
33087
|
+
try {
|
|
33088
|
+
return NFS.statSync(filePath).isFile();
|
|
33089
|
+
} catch {
|
|
33090
|
+
return false;
|
|
33091
|
+
}
|
|
33092
|
+
};
|
|
33093
|
+
const isDirectory = (directoryPath) => {
|
|
33094
|
+
try {
|
|
33095
|
+
return NFS.statSync(directoryPath).isDirectory();
|
|
33096
|
+
} catch {
|
|
33097
|
+
return false;
|
|
33098
|
+
}
|
|
33099
|
+
};
|
|
33100
|
+
const isPlainObject = (value) => {
|
|
33101
|
+
if (typeof value !== "object" || value === null || Array.isArray(value)) return false;
|
|
33102
|
+
const prototype = Object.getPrototypeOf(value);
|
|
33103
|
+
return prototype === null || prototype === Object.prototype;
|
|
33104
|
+
};
|
|
33105
33105
|
const lastSourceMappingUrl = (fileContent) => {
|
|
33106
33106
|
const lastReference = [...fileContent.matchAll(/\/\/# sourceMappingURL=(\S+)/g)].at(-1);
|
|
33107
33107
|
return lastReference ? lastReference[1] : null;
|
|
@@ -33427,10 +33427,10 @@ const FALLBACK_TSCONFIG_FILENAMES = ["tsconfig.app.json", "tsconfig.build.json"]
|
|
|
33427
33427
|
const FRAMEWORK_PACKAGES = {
|
|
33428
33428
|
next: "nextjs",
|
|
33429
33429
|
"@tanstack/react-start": "tanstack-start",
|
|
33430
|
-
vite: "vite",
|
|
33431
|
-
"react-scripts": "cra",
|
|
33432
33430
|
"@remix-run/react": "remix",
|
|
33433
33431
|
gatsby: "gatsby",
|
|
33432
|
+
vite: "vite",
|
|
33433
|
+
"react-scripts": "cra",
|
|
33434
33434
|
expo: "expo",
|
|
33435
33435
|
"react-native": "react-native"
|
|
33436
33436
|
};
|
|
@@ -33454,11 +33454,17 @@ const NEXT_CONFIG_FILENAMES = [
|
|
|
33454
33454
|
];
|
|
33455
33455
|
const BABEL_CONFIG_FILENAMES = [
|
|
33456
33456
|
".babelrc",
|
|
33457
|
+
".babelrc.js",
|
|
33457
33458
|
".babelrc.json",
|
|
33459
|
+
".babelrc.cjs",
|
|
33460
|
+
".babelrc.mjs",
|
|
33461
|
+
".babelrc.cts",
|
|
33458
33462
|
"babel.config.js",
|
|
33459
33463
|
"babel.config.json",
|
|
33460
33464
|
"babel.config.cjs",
|
|
33461
|
-
"babel.config.mjs"
|
|
33465
|
+
"babel.config.mjs",
|
|
33466
|
+
"babel.config.ts",
|
|
33467
|
+
"babel.config.cts"
|
|
33462
33468
|
];
|
|
33463
33469
|
const VITE_CONFIG_FILENAMES = [
|
|
33464
33470
|
"vite.config.js",
|
|
@@ -33470,12 +33476,28 @@ const VITE_CONFIG_FILENAMES = [
|
|
|
33470
33476
|
"vitest.config.ts",
|
|
33471
33477
|
"vitest.config.js"
|
|
33472
33478
|
];
|
|
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
|
+
];
|
|
33473
33495
|
const EXPO_APP_CONFIG_FILENAMES = [
|
|
33474
33496
|
"app.json",
|
|
33475
33497
|
"app.config.js",
|
|
33476
33498
|
"app.config.ts"
|
|
33477
33499
|
];
|
|
33478
|
-
const REACT_COMPILER_PACKAGE_REFERENCE_PATTERN = /babel-plugin-react-compiler|react-compiler-runtime|["']react-compiler["']/;
|
|
33500
|
+
const REACT_COMPILER_PACKAGE_REFERENCE_PATTERN = /babel-plugin-react-compiler|react-compiler-runtime|reactCompilerPreset\s*\(|["']react-compiler["']/;
|
|
33479
33501
|
const REACT_COMPILER_ENABLED_FLAG_PATTERN = /["']?reactCompiler["']?\s*:\s*(?:true\b|\{)/;
|
|
33480
33502
|
const STATIC_EXPORT_OUTPUT_PATTERN = /(?:^|[^.\w])["']?output["']?\s*:\s*["']export["']/m;
|
|
33481
33503
|
const hasCompilerPackage = (packageJson, compilerPackages) => {
|
|
@@ -33510,6 +33532,8 @@ const detectReactCompiler = (directory, packageJson) => {
|
|
|
33510
33532
|
if (hasCompilerInConfigFiles(directory, NEXT_CONFIG_FILENAMES)) return true;
|
|
33511
33533
|
if (hasCompilerInConfigFiles(directory, BABEL_CONFIG_FILENAMES)) return true;
|
|
33512
33534
|
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;
|
|
33513
33537
|
if (hasCompilerInConfigFiles(directory, EXPO_APP_CONFIG_FILENAMES)) return true;
|
|
33514
33538
|
return hasCompilerPackageInAncestors(directory, REACT_COMPILER_TRANSFORM_PACKAGES);
|
|
33515
33539
|
};
|
|
@@ -33518,7 +33542,7 @@ const detectNextjsStaticExport = (directory) => NEXT_CONFIG_FILENAMES.some((file
|
|
|
33518
33542
|
const filePath = Path.join(directory, filename);
|
|
33519
33543
|
return isFile(filePath) && STATIC_EXPORT_OUTPUT_PATTERN.test(NFS.readFileSync(filePath, "utf-8"));
|
|
33520
33544
|
});
|
|
33521
|
-
const UNRESOLVABLE_PROTOCOL_VERSION = /^(?:file|git|github|https?|link|patch|portal|workspace|npm):/i;
|
|
33545
|
+
const UNRESOLVABLE_PROTOCOL_VERSION = /^(?:catalog|file|git|github|https?|link|patch|portal|workspace|npm):/i;
|
|
33522
33546
|
const DIST_TAG_VERSION = /^[a-z][a-z0-9._-]*$/i;
|
|
33523
33547
|
const WILDCARD_VERSION = /^[*xX](?:\.[*xX])*$/;
|
|
33524
33548
|
const NPM_ALIAS_VERSION = /^npm:(?:@[^/]+\/[^@]+|[^@]+)@(.+)$/i;
|
|
@@ -33651,6 +33675,16 @@ const getLowestDependencyMajor = (version) => {
|
|
|
33651
33675
|
}
|
|
33652
33676
|
return lowestMajor;
|
|
33653
33677
|
};
|
|
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
|
+
};
|
|
33654
33688
|
const isConcreteDependencyVersion = (version) => {
|
|
33655
33689
|
const normalizedVersion = normalizeDependencyVersion(version);
|
|
33656
33690
|
return normalizedVersion !== null && /\d/.test(normalizedVersion);
|
|
@@ -33694,9 +33728,18 @@ const parseReactMajorMinor = (reactVersion) => {
|
|
|
33694
33728
|
};
|
|
33695
33729
|
};
|
|
33696
33730
|
const parseLowerBoundVersion = (versionSpec) => import_semver.validRange(versionSpec) !== null ? import_semver.minVersion(versionSpec) : import_semver.coerce(versionSpec);
|
|
33697
|
-
const
|
|
33698
|
-
if (typeof
|
|
33699
|
-
const
|
|
33731
|
+
const parseThreeRelease = (threeVersion) => {
|
|
33732
|
+
if (typeof threeVersion !== "string") return null;
|
|
33733
|
+
const normalizedVersion = normalizeDependencyVersion(threeVersion);
|
|
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();
|
|
33700
33743
|
if (trimmed.length === 0) return null;
|
|
33701
33744
|
const lowerBound = parseLowerBoundVersion(trimmed);
|
|
33702
33745
|
if (lowerBound === null || lowerBound.major <= 0) return null;
|
|
@@ -33705,6 +33748,7 @@ const parseTailwindMajorMinor = (tailwindVersion) => {
|
|
|
33705
33748
|
minor: lowerBound.minor
|
|
33706
33749
|
};
|
|
33707
33750
|
};
|
|
33751
|
+
const parseTailwindMajorMinor = (tailwindVersion) => parseDependencyMajorMinor(tailwindVersion);
|
|
33708
33752
|
const hasUpperBoundOnlyPeerRange = (range) => {
|
|
33709
33753
|
if (typeof range !== "string") return false;
|
|
33710
33754
|
const normalizedRange = normalizeDependencyVersion(range);
|
|
@@ -33726,7 +33770,7 @@ const resolveEffectiveReactMajor = (reactVersion, packageJson) => {
|
|
|
33726
33770
|
if (peerFloor === null) return hasUpperBoundOnlyPeerRange(peerReactRange) ? null : installedReactMajor;
|
|
33727
33771
|
return installedReactMajor !== null ? Math.min(installedReactMajor, peerFloor) : peerFloor;
|
|
33728
33772
|
};
|
|
33729
|
-
const isCatalogReference = (version) => version.startsWith("catalog:");
|
|
33773
|
+
const isCatalogReference = (version) => typeof version === "string" && version.startsWith("catalog:");
|
|
33730
33774
|
const extractCatalogName = (version) => {
|
|
33731
33775
|
if (!isCatalogReference(version)) return null;
|
|
33732
33776
|
const name = version.slice(8).trim();
|
|
@@ -33876,6 +33920,12 @@ const TAILWIND_ZOD_SECTIONS = [
|
|
|
33876
33920
|
"devDependencies",
|
|
33877
33921
|
"peerDependencies"
|
|
33878
33922
|
];
|
|
33923
|
+
const DEPENDENCY_SPEC_SECTIONS = [
|
|
33924
|
+
"dependencies",
|
|
33925
|
+
"devDependencies",
|
|
33926
|
+
"peerDependencies",
|
|
33927
|
+
"optionalDependencies"
|
|
33928
|
+
];
|
|
33879
33929
|
const EMPTY_DEPENDENCY_INFO = {
|
|
33880
33930
|
reactVersion: null,
|
|
33881
33931
|
tailwindVersion: null,
|
|
@@ -33885,7 +33935,7 @@ const EMPTY_DEPENDENCY_INFO = {
|
|
|
33885
33935
|
const pickConcreteVersion = (packageJson, packageName, sections) => {
|
|
33886
33936
|
for (const section of sections) {
|
|
33887
33937
|
const version = packageJson[section]?.[packageName];
|
|
33888
|
-
if (version
|
|
33938
|
+
if (typeof version !== "string") continue;
|
|
33889
33939
|
if (isCatalogReference(version)) return null;
|
|
33890
33940
|
if (isConcreteDependencyVersion(version)) return version;
|
|
33891
33941
|
}
|
|
@@ -33917,13 +33967,16 @@ const extractDependencyInfo = (packageJson) => {
|
|
|
33917
33967
|
};
|
|
33918
33968
|
};
|
|
33919
33969
|
const getDependencySpec = (packageJson, packageName) => {
|
|
33920
|
-
const
|
|
33921
|
-
|
|
33970
|
+
for (const section of DEPENDENCY_SPEC_SECTIONS) {
|
|
33971
|
+
const spec = packageJson[section]?.[packageName];
|
|
33972
|
+
if (typeof spec === "string") return spec;
|
|
33973
|
+
}
|
|
33974
|
+
return null;
|
|
33922
33975
|
};
|
|
33923
33976
|
const getDependencyDeclaration = ({ packageJson, packageName, sections }) => {
|
|
33924
33977
|
for (const section of sections) {
|
|
33925
33978
|
const version = packageJson[section]?.[packageName];
|
|
33926
|
-
if (version
|
|
33979
|
+
if (typeof version !== "string") continue;
|
|
33927
33980
|
return {
|
|
33928
33981
|
catalogReference: extractCatalogName(version) ?? null,
|
|
33929
33982
|
hasDeclaration: true,
|
|
@@ -33957,24 +34010,15 @@ const getPreactVersion = (packageJson) => {
|
|
|
33957
34010
|
...packageJson.devDependencies
|
|
33958
34011
|
}.preact ?? null;
|
|
33959
34012
|
};
|
|
33960
|
-
const
|
|
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 }) => {
|
|
34013
|
+
const resolveCatalogBackedDependencyVersion = ({ rootDirectory, rootPackageJson, packageName, sourceDirectory = rootDirectory, sourcePackageJson = rootPackageJson, version }) => {
|
|
33974
34014
|
if (version === null || !isCatalogReference(version)) return version;
|
|
33975
34015
|
const catalogName = extractCatalogName(version);
|
|
33976
|
-
const
|
|
33977
|
-
if (
|
|
34016
|
+
const resolvedSourceVersion = resolveCatalogVersion(sourcePackageJson, packageName, sourceDirectory, catalogName);
|
|
34017
|
+
if (resolvedSourceVersion) return resolvedSourceVersion;
|
|
34018
|
+
if (sourceDirectory !== rootDirectory || sourcePackageJson !== rootPackageJson) {
|
|
34019
|
+
const resolvedRootVersion = resolveCatalogVersion(rootPackageJson, packageName, rootDirectory, catalogName);
|
|
34020
|
+
if (resolvedRootVersion) return resolvedRootVersion;
|
|
34021
|
+
}
|
|
33978
34022
|
const monorepoRoot = findMonorepoRoot(rootDirectory);
|
|
33979
34023
|
if (!monorepoRoot) return version;
|
|
33980
34024
|
const monorepoPackageJsonPath = Path.join(monorepoRoot, "package.json");
|
|
@@ -34172,7 +34216,75 @@ const listWorkspacePackages = (rootDirectory) => {
|
|
|
34172
34216
|
}
|
|
34173
34217
|
return packages;
|
|
34174
34218
|
};
|
|
34219
|
+
const getPreferredDependencyVersion = ({ packageJson, packageNames }) => {
|
|
34220
|
+
const allDependencies = {
|
|
34221
|
+
...packageJson.devDependencies,
|
|
34222
|
+
...packageJson.peerDependencies,
|
|
34223
|
+
...packageJson.dependencies
|
|
34224
|
+
};
|
|
34225
|
+
for (const packageName of packageNames) {
|
|
34226
|
+
const version = allDependencies[packageName];
|
|
34227
|
+
if (version !== void 0) return version;
|
|
34228
|
+
}
|
|
34229
|
+
return null;
|
|
34230
|
+
};
|
|
34231
|
+
const TANSTACK_REACT_QUERY_PACKAGES = ["@tanstack/react-query", "react-query"];
|
|
34232
|
+
const getTanStackQueryVersion = (packageJson) => {
|
|
34233
|
+
return getPreferredDependencyVersion({
|
|
34234
|
+
packageJson,
|
|
34235
|
+
packageNames: TANSTACK_REACT_QUERY_PACKAGES
|
|
34236
|
+
});
|
|
34237
|
+
};
|
|
34238
|
+
const STYLED_COMPONENTS_PACKAGES = ["styled-components"];
|
|
34239
|
+
const getStyledComponentsVersion = (packageJson) => {
|
|
34240
|
+
return getPreferredDependencyVersion({
|
|
34241
|
+
packageJson,
|
|
34242
|
+
packageNames: STYLED_COMPONENTS_PACKAGES
|
|
34243
|
+
});
|
|
34244
|
+
};
|
|
34245
|
+
const I18N_PACKAGES = [
|
|
34246
|
+
"i18next",
|
|
34247
|
+
"react-i18next",
|
|
34248
|
+
"next-i18next",
|
|
34249
|
+
"react-intl",
|
|
34250
|
+
"next-intl",
|
|
34251
|
+
"use-intl",
|
|
34252
|
+
"@formatjs/intl",
|
|
34253
|
+
"@lingui/core",
|
|
34254
|
+
"@lingui/react",
|
|
34255
|
+
"typesafe-i18n",
|
|
34256
|
+
"@tolgee/react",
|
|
34257
|
+
"react-intl-universal"
|
|
34258
|
+
];
|
|
34259
|
+
const hasI18nDependency = (packageJson) => {
|
|
34260
|
+
const allDependencies = {
|
|
34261
|
+
...packageJson.peerDependencies,
|
|
34262
|
+
...packageJson.dependencies,
|
|
34263
|
+
...packageJson.devDependencies,
|
|
34264
|
+
...packageJson.optionalDependencies
|
|
34265
|
+
};
|
|
34266
|
+
return I18N_PACKAGES.some((packageName) => allDependencies[packageName] !== void 0);
|
|
34267
|
+
};
|
|
34175
34268
|
const REANIMATED_DEPENDENCY_NAME = "react-native-reanimated";
|
|
34269
|
+
const MOBX_REACT_PACKAGE_NAME = "mobx-react";
|
|
34270
|
+
const MOBX_REACT_LITE_PACKAGE_NAME = "mobx-react-lite";
|
|
34271
|
+
const MOBX_STATE_TREE_PACKAGE_NAME = "mobx-state-tree";
|
|
34272
|
+
const MOBX_REACT_OBSERVER_PACKAGE_NAME = "mobx-react-observer";
|
|
34273
|
+
const REACT_THREE_FIBER_DEPENDENCY_NAMES = ["@react-three/fiber", "react-three-fiber"];
|
|
34274
|
+
const REACT_THREE_FIBER_SECTIONS = [
|
|
34275
|
+
"dependencies",
|
|
34276
|
+
"peerDependencies",
|
|
34277
|
+
"optionalDependencies",
|
|
34278
|
+
"devDependencies"
|
|
34279
|
+
];
|
|
34280
|
+
const THREE_DEPENDENCY_SECTIONS = [
|
|
34281
|
+
"dependencies",
|
|
34282
|
+
"peerDependencies",
|
|
34283
|
+
"optionalDependencies",
|
|
34284
|
+
"devDependencies"
|
|
34285
|
+
];
|
|
34286
|
+
const REACT_THREE_FIBER_ECOSYSTEM_DEPENDENCY_NAMES = [...REACT_THREE_FIBER_DEPENDENCY_NAMES, "@react-three/drei"];
|
|
34287
|
+
const THREE_DEPENDENCY_NAMES = [...REACT_THREE_FIBER_ECOSYSTEM_DEPENDENCY_NAMES, "three"];
|
|
34176
34288
|
const SHOPIFY_FLASH_LIST_PACKAGE_NAME = "@shopify/flash-list";
|
|
34177
34289
|
const resolveWorkspaceDependencyVersion = ({ concreteVersion, packageName, rootDirectory, rootPackageJson, sections, workspaceDirectory, workspacePackageJson }) => {
|
|
34178
34290
|
const dependencyDeclaration = getDependencyDeclaration({
|
|
@@ -34183,7 +34295,7 @@ const resolveWorkspaceDependencyVersion = ({ concreteVersion, packageName, rootD
|
|
|
34183
34295
|
if (!dependencyDeclaration.hasDeclaration) return null;
|
|
34184
34296
|
return concreteVersion ?? resolveCatalogVersion(workspacePackageJson, packageName, workspaceDirectory, dependencyDeclaration.catalogReference) ?? resolveCatalogVersion(rootPackageJson, packageName, rootDirectory, dependencyDeclaration.catalogReference);
|
|
34185
34297
|
};
|
|
34186
|
-
const
|
|
34298
|
+
const shouldReplaceWithLowerMajor = (currentVersion, nextVersion) => {
|
|
34187
34299
|
if (!currentVersion) return true;
|
|
34188
34300
|
const currentMajor = parseReactMajor(currentVersion);
|
|
34189
34301
|
const nextMajor = parseReactMajor(nextVersion);
|
|
@@ -34191,7 +34303,62 @@ const shouldReplaceReactVersion = (currentVersion, nextVersion) => {
|
|
|
34191
34303
|
if (nextMajor === null) return false;
|
|
34192
34304
|
return nextMajor < currentMajor;
|
|
34193
34305
|
};
|
|
34194
|
-
const
|
|
34306
|
+
const shouldReplaceSupportedDependencyFact = (currentFact, nextFact, latestSupportedMajor) => {
|
|
34307
|
+
if (currentFact.version === null) return true;
|
|
34308
|
+
if (nextFact.version === null) return false;
|
|
34309
|
+
const currentMajor = getLowestDependencyMajor(currentFact.version);
|
|
34310
|
+
const nextMajor = getLowestDependencyMajor(nextFact.version);
|
|
34311
|
+
if (currentMajor === null) return false;
|
|
34312
|
+
if (nextMajor === null) return true;
|
|
34313
|
+
if (currentMajor > latestSupportedMajor) return false;
|
|
34314
|
+
if (nextMajor > latestSupportedMajor) return true;
|
|
34315
|
+
return nextMajor < currentMajor;
|
|
34316
|
+
};
|
|
34317
|
+
const shouldReplaceStyledComponentsVersion = (currentVersion, nextVersion) => {
|
|
34318
|
+
if (!currentVersion) return true;
|
|
34319
|
+
const currentMajor = getLowestDependencyMajor(currentVersion);
|
|
34320
|
+
const nextMajor = getLowestDependencyMajor(nextVersion);
|
|
34321
|
+
if (currentMajor === null) return nextMajor !== null && nextMajor < 6;
|
|
34322
|
+
if (nextMajor === null) return currentMajor >= 6;
|
|
34323
|
+
return nextMajor < currentMajor;
|
|
34324
|
+
};
|
|
34325
|
+
const selectOldestDependencyVersion = (currentVersion, nextVersion) => {
|
|
34326
|
+
if (currentVersion === null || nextVersion === null) return null;
|
|
34327
|
+
const current = parseDependencyMajorMinor(currentVersion);
|
|
34328
|
+
const next = parseDependencyMajorMinor(nextVersion);
|
|
34329
|
+
if (current === null) return currentVersion;
|
|
34330
|
+
if (next === null) return nextVersion;
|
|
34331
|
+
if (next.major !== current.major) return next.major < current.major ? nextVersion : currentVersion;
|
|
34332
|
+
return next.minor < current.minor ? nextVersion : currentVersion;
|
|
34333
|
+
};
|
|
34334
|
+
const shouldReplaceMobxFact = (currentFact, nextFact) => {
|
|
34335
|
+
if (currentFact.sourceDirectory === null) return true;
|
|
34336
|
+
if (currentFact.version === null) return false;
|
|
34337
|
+
if (nextFact.version === null) return true;
|
|
34338
|
+
const currentMajor = getDependencyMajorWithinSupportedRange(currentFact.version, 6);
|
|
34339
|
+
const nextMajor = getDependencyMajorWithinSupportedRange(nextFact.version, 6);
|
|
34340
|
+
if (currentMajor === null) return false;
|
|
34341
|
+
if (nextMajor === null) return true;
|
|
34342
|
+
return selectOldestDependencyVersion(currentFact.version, nextFact.version) === nextFact.version;
|
|
34343
|
+
};
|
|
34344
|
+
const collectBindingVersion = (facts, packageJson, directory, packageName) => {
|
|
34345
|
+
const version = getDependencySpec(packageJson, packageName);
|
|
34346
|
+
if (version === null) return;
|
|
34347
|
+
const resolvedVersion = resolveCatalogBackedDependencyVersion({
|
|
34348
|
+
rootDirectory: directory,
|
|
34349
|
+
rootPackageJson: packageJson,
|
|
34350
|
+
packageName,
|
|
34351
|
+
version
|
|
34352
|
+
});
|
|
34353
|
+
if (packageName === MOBX_REACT_PACKAGE_NAME) {
|
|
34354
|
+
facts.mobxReactVersion = facts.hasMobxReact ? selectOldestDependencyVersion(facts.mobxReactVersion, resolvedVersion) : resolvedVersion;
|
|
34355
|
+
facts.hasMobxReact = true;
|
|
34356
|
+
return;
|
|
34357
|
+
}
|
|
34358
|
+
facts.mobxReactLiteVersion = facts.hasMobxReactLite ? selectOldestDependencyVersion(facts.mobxReactLiteVersion, resolvedVersion) : resolvedVersion;
|
|
34359
|
+
facts.hasMobxReactLite = true;
|
|
34360
|
+
};
|
|
34361
|
+
const evaluateManifestFacts = (facts, packageJson, directory, rootDirectory, rootPackageJson) => {
|
|
34195
34362
|
if (facts.expo.version === null) {
|
|
34196
34363
|
const spec = getDependencySpec(packageJson, "expo");
|
|
34197
34364
|
if (spec !== null) facts.expo = {
|
|
@@ -34213,6 +34380,36 @@ const evaluateManifestFacts = (facts, packageJson, directory) => {
|
|
|
34213
34380
|
sourceDirectory: directory
|
|
34214
34381
|
};
|
|
34215
34382
|
}
|
|
34383
|
+
const mobxSpec = getDependencySpec(packageJson, "mobx");
|
|
34384
|
+
if (mobxSpec !== null) {
|
|
34385
|
+
const nextMobxFact = {
|
|
34386
|
+
version: resolveCatalogBackedDependencyVersion({
|
|
34387
|
+
rootDirectory: directory,
|
|
34388
|
+
rootPackageJson: packageJson,
|
|
34389
|
+
packageName: "mobx",
|
|
34390
|
+
version: mobxSpec
|
|
34391
|
+
}),
|
|
34392
|
+
sourceDirectory: directory
|
|
34393
|
+
};
|
|
34394
|
+
if (shouldReplaceMobxFact(facts.mobx, nextMobxFact)) facts.mobx = nextMobxFact;
|
|
34395
|
+
}
|
|
34396
|
+
collectBindingVersion(facts, packageJson, directory, MOBX_REACT_PACKAGE_NAME);
|
|
34397
|
+
collectBindingVersion(facts, packageJson, directory, MOBX_REACT_LITE_PACKAGE_NAME);
|
|
34398
|
+
facts.hasMobxStateTree = facts.hasMobxStateTree || getDependencySpec(packageJson, MOBX_STATE_TREE_PACKAGE_NAME) !== null;
|
|
34399
|
+
facts.hasMobxReactObserver = facts.hasMobxReactObserver || getDependencySpec(packageJson, MOBX_REACT_OBSERVER_PACKAGE_NAME) !== null;
|
|
34400
|
+
const zustandSpec = getDependencySpec(packageJson, "zustand");
|
|
34401
|
+
if (zustandSpec !== null) {
|
|
34402
|
+
const nextZustandFact = {
|
|
34403
|
+
version: resolveCatalogBackedDependencyVersion({
|
|
34404
|
+
rootDirectory: directory,
|
|
34405
|
+
rootPackageJson: packageJson,
|
|
34406
|
+
packageName: "zustand",
|
|
34407
|
+
version: zustandSpec
|
|
34408
|
+
}),
|
|
34409
|
+
sourceDirectory: directory
|
|
34410
|
+
};
|
|
34411
|
+
if (shouldReplaceSupportedDependencyFact(facts.zustand, nextZustandFact, 5)) facts.zustand = nextZustandFact;
|
|
34412
|
+
}
|
|
34216
34413
|
if (facts.reanimatedVersion === null) {
|
|
34217
34414
|
const spec = getDependencySpec(packageJson, REANIMATED_DEPENDENCY_NAME);
|
|
34218
34415
|
if (spec !== null) facts.reanimatedVersion = spec;
|
|
@@ -34221,9 +34418,75 @@ const evaluateManifestFacts = (facts, packageJson, directory) => {
|
|
|
34221
34418
|
const spec = getDependencySpec(packageJson, "valtio");
|
|
34222
34419
|
if (spec !== null) facts.valtioVersion = spec;
|
|
34223
34420
|
}
|
|
34421
|
+
facts.tanstackQueryVersion ??= getTanStackQueryVersion(packageJson);
|
|
34422
|
+
const styledComponentsVersion = resolveCatalogBackedDependencyVersion({
|
|
34423
|
+
rootDirectory: directory,
|
|
34424
|
+
rootPackageJson: packageJson,
|
|
34425
|
+
packageName: "styled-components",
|
|
34426
|
+
version: getStyledComponentsVersion(packageJson)
|
|
34427
|
+
});
|
|
34428
|
+
if (styledComponentsVersion && shouldReplaceStyledComponentsVersion(facts.styledComponentsVersion, styledComponentsVersion)) facts.styledComponentsVersion = styledComponentsVersion;
|
|
34429
|
+
facts.hasI18nLibrary = facts.hasI18nLibrary || hasI18nDependency(packageJson);
|
|
34430
|
+
for (const packageName of REACT_THREE_FIBER_DEPENDENCY_NAMES) {
|
|
34431
|
+
const version = resolveCatalogBackedDependencyVersion({
|
|
34432
|
+
rootDirectory,
|
|
34433
|
+
rootPackageJson,
|
|
34434
|
+
sourceDirectory: directory,
|
|
34435
|
+
sourcePackageJson: packageJson,
|
|
34436
|
+
packageName,
|
|
34437
|
+
version: getDependencyDeclaration({
|
|
34438
|
+
packageName,
|
|
34439
|
+
packageJson,
|
|
34440
|
+
sections: REACT_THREE_FIBER_SECTIONS
|
|
34441
|
+
}).version
|
|
34442
|
+
});
|
|
34443
|
+
if (version === null) continue;
|
|
34444
|
+
if (shouldReplaceWithLowerMajor(facts.reactThreeFiber.version, version)) facts.reactThreeFiber = {
|
|
34445
|
+
packageName,
|
|
34446
|
+
version,
|
|
34447
|
+
sourceDirectory: directory
|
|
34448
|
+
};
|
|
34449
|
+
}
|
|
34450
|
+
const threeVersion = resolveCatalogBackedDependencyVersion({
|
|
34451
|
+
rootDirectory,
|
|
34452
|
+
rootPackageJson,
|
|
34453
|
+
sourceDirectory: directory,
|
|
34454
|
+
sourcePackageJson: packageJson,
|
|
34455
|
+
packageName: "three",
|
|
34456
|
+
version: getDependencyDeclaration({
|
|
34457
|
+
packageName: "three",
|
|
34458
|
+
packageJson,
|
|
34459
|
+
sections: THREE_DEPENDENCY_SECTIONS
|
|
34460
|
+
}).version
|
|
34461
|
+
});
|
|
34462
|
+
if (threeVersion !== null) {
|
|
34463
|
+
const currentRelease = parseThreeRelease(facts.threeVersion);
|
|
34464
|
+
const nextRelease = parseThreeRelease(threeVersion);
|
|
34465
|
+
if (facts.threeVersion === null || nextRelease !== null && (currentRelease === null || nextRelease < currentRelease)) facts.threeVersion = threeVersion;
|
|
34466
|
+
}
|
|
34224
34467
|
facts.hasReactNativeAwarePackage = facts.hasReactNativeAwarePackage || isPackageJsonReactNativeAware(packageJson);
|
|
34225
34468
|
facts.hasReanimatedAwarePackage = facts.hasReanimatedAwarePackage || isPackageJsonReanimatedAware(packageJson);
|
|
34226
34469
|
facts.hasSsrDependency = facts.hasSsrDependency || isPackageJsonSsrAware(packageJson);
|
|
34470
|
+
const remotionSpec = getDependencySpec(packageJson, "remotion");
|
|
34471
|
+
if (remotionSpec !== null) {
|
|
34472
|
+
facts.hasRemotionDependency = true;
|
|
34473
|
+
const resolvedRemotionVersion = resolveCatalogBackedDependencyVersion({
|
|
34474
|
+
rootDirectory,
|
|
34475
|
+
rootPackageJson,
|
|
34476
|
+
packageName: "remotion",
|
|
34477
|
+
version: remotionSpec
|
|
34478
|
+
});
|
|
34479
|
+
const remotionMajorVersion = resolvedRemotionVersion === null ? null : getLowestDependencyMajor(resolvedRemotionVersion);
|
|
34480
|
+
if (remotionMajorVersion === null) {
|
|
34481
|
+
facts.hasUnknownRemotionVersion = true;
|
|
34482
|
+
facts.remotionVersion = null;
|
|
34483
|
+
} else if (!facts.hasUnknownRemotionVersion) {
|
|
34484
|
+
const currentRemotionMajorVersion = facts.remotionVersion === null ? null : getLowestDependencyMajor(facts.remotionVersion);
|
|
34485
|
+
if (currentRemotionMajorVersion === null || remotionMajorVersion < currentRemotionMajorVersion) facts.remotionVersion = resolvedRemotionVersion;
|
|
34486
|
+
}
|
|
34487
|
+
}
|
|
34488
|
+
facts.hasThree = facts.hasThree || THREE_DEPENDENCY_NAMES.some((dependencyName) => getDependencySpec(packageJson, dependencyName) !== null);
|
|
34489
|
+
facts.hasReactThreeFiber = facts.hasReactThreeFiber || REACT_THREE_FIBER_ECOSYSTEM_DEPENDENCY_NAMES.some((dependencyName) => getDependencySpec(packageJson, dependencyName) !== null);
|
|
34227
34490
|
};
|
|
34228
34491
|
const collectWorkspaceFacts = (rootDirectory, rootPackageJson, { collectReactGroup }) => {
|
|
34229
34492
|
const facts = {
|
|
@@ -34244,12 +34507,40 @@ const collectWorkspaceFacts = (rootDirectory, rootPackageJson, { collectReactGro
|
|
|
34244
34507
|
sourceDirectory: null
|
|
34245
34508
|
},
|
|
34246
34509
|
valtioVersion: null,
|
|
34510
|
+
mobx: {
|
|
34511
|
+
version: null,
|
|
34512
|
+
sourceDirectory: null
|
|
34513
|
+
},
|
|
34514
|
+
hasMobxReact: false,
|
|
34515
|
+
mobxReactVersion: null,
|
|
34516
|
+
hasMobxReactLite: false,
|
|
34517
|
+
mobxReactLiteVersion: null,
|
|
34518
|
+
hasMobxStateTree: false,
|
|
34519
|
+
hasMobxReactObserver: false,
|
|
34520
|
+
zustand: {
|
|
34521
|
+
version: null,
|
|
34522
|
+
sourceDirectory: null
|
|
34523
|
+
},
|
|
34524
|
+
tanstackQueryVersion: null,
|
|
34525
|
+
styledComponentsVersion: null,
|
|
34526
|
+
hasI18nLibrary: false,
|
|
34247
34527
|
hasReactNativeAwarePackage: false,
|
|
34248
34528
|
hasReanimatedAwarePackage: false,
|
|
34249
34529
|
hasSsrDependency: false,
|
|
34530
|
+
hasRemotionDependency: false,
|
|
34531
|
+
hasUnknownRemotionVersion: false,
|
|
34532
|
+
remotionVersion: null,
|
|
34533
|
+
hasThree: false,
|
|
34534
|
+
threeVersion: null,
|
|
34535
|
+
hasReactThreeFiber: false,
|
|
34536
|
+
reactThreeFiber: {
|
|
34537
|
+
packageName: null,
|
|
34538
|
+
version: null,
|
|
34539
|
+
sourceDirectory: null
|
|
34540
|
+
},
|
|
34250
34541
|
reanimatedVersion: null
|
|
34251
34542
|
};
|
|
34252
|
-
evaluateManifestFacts(facts, rootPackageJson, rootDirectory);
|
|
34543
|
+
evaluateManifestFacts(facts, rootPackageJson, rootDirectory, rootDirectory, rootPackageJson);
|
|
34253
34544
|
let isReactGroupSettled = !collectReactGroup;
|
|
34254
34545
|
const visitedDirectories = /* @__PURE__ */ new Set();
|
|
34255
34546
|
for (const pattern of getWorkspacePatterns(rootDirectory, rootPackageJson)) {
|
|
@@ -34258,7 +34549,7 @@ const collectWorkspaceFacts = (rootDirectory, rootPackageJson, { collectReactGro
|
|
|
34258
34549
|
if (visitedDirectories.has(workspaceDirectory)) continue;
|
|
34259
34550
|
visitedDirectories.add(workspaceDirectory);
|
|
34260
34551
|
const workspacePackageJson = readPackageJson(Path.join(workspaceDirectory, "package.json"));
|
|
34261
|
-
evaluateManifestFacts(facts, workspacePackageJson, workspaceDirectory);
|
|
34552
|
+
evaluateManifestFacts(facts, workspacePackageJson, workspaceDirectory, rootDirectory, rootPackageJson);
|
|
34262
34553
|
const info = extractDependencyInfo(workspacePackageJson);
|
|
34263
34554
|
if (info.framework !== "unknown" && frameworkMergeRank(info.framework) < frameworkMergeRank(facts.framework)) facts.framework = info.framework;
|
|
34264
34555
|
if (isReactGroupSettled) continue;
|
|
@@ -34289,7 +34580,7 @@ const collectWorkspaceFacts = (rootDirectory, rootPackageJson, { collectReactGro
|
|
|
34289
34580
|
workspaceDirectory,
|
|
34290
34581
|
workspacePackageJson
|
|
34291
34582
|
});
|
|
34292
|
-
if (reactVersion &&
|
|
34583
|
+
if (reactVersion && shouldReplaceWithLowerMajor(facts.reactVersion, reactVersion)) facts.reactVersion = reactVersion;
|
|
34293
34584
|
if (tailwindVersion && !facts.tailwindVersion) facts.tailwindVersion = tailwindVersion;
|
|
34294
34585
|
if (zodVersion && !facts.zodVersion) facts.zodVersion = zodVersion;
|
|
34295
34586
|
const settledReactMajor = parseReactMajor(facts.reactVersion);
|
|
@@ -34482,6 +34773,16 @@ const discoverProjectWithoutPackageJson = (directory) => {
|
|
|
34482
34773
|
tailwindVersion: null,
|
|
34483
34774
|
zodVersion: null,
|
|
34484
34775
|
zodMajorVersion: null,
|
|
34776
|
+
mobxVersion: null,
|
|
34777
|
+
mobxMajorVersion: null,
|
|
34778
|
+
hasMobxReact: false,
|
|
34779
|
+
mobxReactVersion: null,
|
|
34780
|
+
hasMobxReactLite: false,
|
|
34781
|
+
mobxReactLiteVersion: null,
|
|
34782
|
+
hasMobxStateTree: false,
|
|
34783
|
+
hasMobxReactObserver: false,
|
|
34784
|
+
zustandVersion: null,
|
|
34785
|
+
zustandMajorVersion: null,
|
|
34485
34786
|
framework: "unknown",
|
|
34486
34787
|
hasTypeScript: hasOwnTsConfig,
|
|
34487
34788
|
hasReactCompiler: false,
|
|
@@ -34489,6 +34790,18 @@ const discoverProjectWithoutPackageJson = (directory) => {
|
|
|
34489
34790
|
hasTanStackQuery: false,
|
|
34490
34791
|
valtioVersion: null,
|
|
34491
34792
|
valtioMajorVersion: null,
|
|
34793
|
+
hasRemotion: false,
|
|
34794
|
+
remotionVersion: null,
|
|
34795
|
+
remotionMajorVersion: null,
|
|
34796
|
+
hasI18nLibrary: false,
|
|
34797
|
+
tanstackQueryVersion: null,
|
|
34798
|
+
styledComponentsVersion: null,
|
|
34799
|
+
hasThree: false,
|
|
34800
|
+
threeVersion: null,
|
|
34801
|
+
threeRelease: null,
|
|
34802
|
+
hasReactThreeFiber: false,
|
|
34803
|
+
reactThreeFiberVersion: null,
|
|
34804
|
+
reactThreeFiberMajorVersion: null,
|
|
34492
34805
|
hasSsrDependency: false,
|
|
34493
34806
|
preactVersion: null,
|
|
34494
34807
|
preactMajorVersion: null,
|
|
@@ -34587,6 +34900,12 @@ const discoverProject = (directory) => {
|
|
|
34587
34900
|
packageName: SHOPIFY_FLASH_LIST_PACKAGE_NAME,
|
|
34588
34901
|
version: workspaceFacts.shopifyFlashList.version
|
|
34589
34902
|
}) : null;
|
|
34903
|
+
const zustandVersion = resolveCatalogBackedDependencyVersion({
|
|
34904
|
+
rootDirectory: directory,
|
|
34905
|
+
rootPackageJson: packageJson,
|
|
34906
|
+
packageName: "zustand",
|
|
34907
|
+
version: workspaceFacts.zustand.version
|
|
34908
|
+
});
|
|
34590
34909
|
const hasReanimated = hasReactNativeWorkspace && workspaceFacts.hasReanimatedAwarePackage;
|
|
34591
34910
|
const reanimatedVersion = hasReanimated ? workspaceFacts.reanimatedVersion : null;
|
|
34592
34911
|
const nextjsVersion = framework === "nextjs" ? resolveCatalogBackedDependencyVersion({
|
|
@@ -34601,7 +34920,27 @@ const discoverProject = (directory) => {
|
|
|
34601
34920
|
packageName: "valtio",
|
|
34602
34921
|
version: workspaceFacts.valtioVersion
|
|
34603
34922
|
});
|
|
34923
|
+
const mobxVersion = resolveCatalogBackedDependencyVersion({
|
|
34924
|
+
rootDirectory: directory,
|
|
34925
|
+
rootPackageJson: packageJson,
|
|
34926
|
+
packageName: "mobx",
|
|
34927
|
+
version: workspaceFacts.mobx.version
|
|
34928
|
+
});
|
|
34604
34929
|
const preactVersion = getPreactVersion(packageJson);
|
|
34930
|
+
const remotionVersion = workspaceFacts.remotionVersion;
|
|
34931
|
+
const tanstackQueryVersion = getTanStackQueryVersion(packageJson) ?? workspaceFacts.tanstackQueryVersion;
|
|
34932
|
+
const reactThreeFiberVersion = workspaceFacts.reactThreeFiber.packageName ? resolveCatalogBackedDependencyVersion({
|
|
34933
|
+
rootDirectory: directory,
|
|
34934
|
+
rootPackageJson: packageJson,
|
|
34935
|
+
packageName: workspaceFacts.reactThreeFiber.packageName,
|
|
34936
|
+
version: workspaceFacts.reactThreeFiber.version
|
|
34937
|
+
}) : null;
|
|
34938
|
+
const threeVersion = resolveCatalogBackedDependencyVersion({
|
|
34939
|
+
rootDirectory: directory,
|
|
34940
|
+
rootPackageJson: packageJson,
|
|
34941
|
+
packageName: "three",
|
|
34942
|
+
version: workspaceFacts.threeVersion
|
|
34943
|
+
});
|
|
34605
34944
|
const isPreES2023Target = hasTypeScript && detectPreES2023Target(directory);
|
|
34606
34945
|
const projectInfo = {
|
|
34607
34946
|
rootDirectory: directory,
|
|
@@ -34611,13 +34950,35 @@ const discoverProject = (directory) => {
|
|
|
34611
34950
|
tailwindVersion,
|
|
34612
34951
|
zodVersion,
|
|
34613
34952
|
zodMajorVersion: zodVersion === null ? null : getLowestDependencyMajor(zodVersion),
|
|
34953
|
+
mobxVersion,
|
|
34954
|
+
mobxMajorVersion: mobxVersion === null ? null : getDependencyMajorWithinSupportedRange(mobxVersion, 6),
|
|
34955
|
+
hasMobxReact: workspaceFacts.hasMobxReact,
|
|
34956
|
+
mobxReactVersion: workspaceFacts.mobxReactVersion,
|
|
34957
|
+
hasMobxReactLite: workspaceFacts.hasMobxReactLite,
|
|
34958
|
+
mobxReactLiteVersion: workspaceFacts.mobxReactLiteVersion,
|
|
34959
|
+
hasMobxStateTree: workspaceFacts.hasMobxStateTree,
|
|
34960
|
+
hasMobxReactObserver: workspaceFacts.hasMobxReactObserver,
|
|
34961
|
+
zustandVersion,
|
|
34962
|
+
zustandMajorVersion: zustandVersion === null ? null : getLowestDependencyMajor(zustandVersion),
|
|
34614
34963
|
framework,
|
|
34615
34964
|
hasTypeScript,
|
|
34616
34965
|
hasReactCompiler: detectReactCompiler(directory, packageJson),
|
|
34617
34966
|
hasReactCompilerLintPlugin: detectReactCompilerLintPlugin(directory, packageJson),
|
|
34618
|
-
hasTanStackQuery:
|
|
34967
|
+
hasTanStackQuery: tanstackQueryVersion !== null,
|
|
34968
|
+
hasI18nLibrary: workspaceFacts.hasI18nLibrary,
|
|
34969
|
+
tanstackQueryVersion,
|
|
34970
|
+
styledComponentsVersion: workspaceFacts.styledComponentsVersion,
|
|
34619
34971
|
valtioVersion,
|
|
34620
34972
|
valtioMajorVersion: valtioVersion === null ? null : getLowestDependencyMajor(valtioVersion),
|
|
34973
|
+
hasRemotion: workspaceFacts.hasRemotionDependency,
|
|
34974
|
+
remotionVersion,
|
|
34975
|
+
remotionMajorVersion: remotionVersion === null ? null : getLowestDependencyMajor(remotionVersion),
|
|
34976
|
+
hasThree: workspaceFacts.hasThree,
|
|
34977
|
+
threeVersion,
|
|
34978
|
+
threeRelease: parseThreeRelease(threeVersion),
|
|
34979
|
+
hasReactThreeFiber: workspaceFacts.hasReactThreeFiber,
|
|
34980
|
+
reactThreeFiberVersion,
|
|
34981
|
+
reactThreeFiberMajorVersion: reactThreeFiberVersion === null ? null : getLowestDependencyMajor(reactThreeFiberVersion),
|
|
34621
34982
|
hasSsrDependency: workspaceFacts.hasSsrDependency,
|
|
34622
34983
|
preactVersion,
|
|
34623
34984
|
preactMajorVersion: parseReactMajor(preactVersion),
|
|
@@ -37818,10 +38179,10 @@ const SSR_FRAMEWORKS = new Set([
|
|
|
37818
38179
|
"gatsby",
|
|
37819
38180
|
"tanstack-start"
|
|
37820
38181
|
]);
|
|
37821
|
-
const
|
|
37822
|
-
if (
|
|
37823
|
-
const
|
|
37824
|
-
for (let candidate = earliest; candidate <=
|
|
38182
|
+
const addVersionCapabilityLadder = (capabilities, name, detectedVersion, earliest, latest) => {
|
|
38183
|
+
if (detectedVersion === null) return;
|
|
38184
|
+
const cappedVersion = Math.min(detectedVersion, latest);
|
|
38185
|
+
for (let candidate = earliest; candidate <= cappedVersion; candidate += 1) capabilities.add(`${name}:${candidate}`);
|
|
37825
38186
|
};
|
|
37826
38187
|
const buildCapabilities = (project) => {
|
|
37827
38188
|
const capabilities = /* @__PURE__ */ new Set();
|
|
@@ -37834,26 +38195,77 @@ const buildCapabilities = (project) => {
|
|
|
37834
38195
|
if (CLIENT_ONLY_FRAMEWORKS.has(project.framework)) capabilities.add("client-only");
|
|
37835
38196
|
if (project.isStaticExport) capabilities.add("nextjs:static-export");
|
|
37836
38197
|
if (project.nextjsMajorVersion !== null && project.nextjsMajorVersion >= 15) capabilities.add("nextjs:15");
|
|
37837
|
-
|
|
38198
|
+
if (project.nextjsMajorVersion !== null && project.nextjsMajorVersion >= 16) capabilities.add("nextjs:16");
|
|
38199
|
+
addVersionCapabilityLadder(capabilities, "react", project.reactMajorVersion, 17, 30);
|
|
37838
38200
|
if (project.reactMajorVersion !== null && project.reactMajorVersion >= 19 && isMajorMinorAtLeast(parseReactMajorMinor(project.reactVersion), {
|
|
37839
38201
|
major: 19,
|
|
37840
38202
|
minor: 2
|
|
37841
38203
|
})) capabilities.add("react:19.2");
|
|
37842
|
-
if (project.tailwindVersion !== null)
|
|
37843
|
-
|
|
37844
|
-
|
|
37845
|
-
|
|
37846
|
-
|
|
38204
|
+
if (project.tailwindVersion !== null) {
|
|
38205
|
+
capabilities.add("tailwind");
|
|
38206
|
+
const tailwindVersion = parseTailwindMajorMinor(project.tailwindVersion);
|
|
38207
|
+
if (isMajorMinorAtLeast(tailwindVersion, {
|
|
38208
|
+
major: 3,
|
|
38209
|
+
minor: 4
|
|
38210
|
+
})) capabilities.add("tailwind:3.4");
|
|
38211
|
+
if (tailwindVersion !== null && isMajorMinorAtLeast(tailwindVersion, {
|
|
38212
|
+
major: 4,
|
|
38213
|
+
minor: 0
|
|
38214
|
+
})) capabilities.add("tailwind:4");
|
|
38215
|
+
}
|
|
37847
38216
|
if (project.zodVersion !== null) capabilities.add("zod");
|
|
37848
38217
|
if (project.zodMajorVersion !== null && project.zodMajorVersion >= 4) capabilities.add("zod:4");
|
|
38218
|
+
if (project.mobxVersion !== void 0 && project.mobxVersion !== null || project.hasMobxReact === true || project.hasMobxReactLite === true || project.hasMobxStateTree === true || project.hasMobxReactObserver === true) capabilities.add("mobx");
|
|
38219
|
+
if (project.hasMobxReact === true) capabilities.add("mobx-react");
|
|
38220
|
+
if (project.hasMobxReactLite === true) capabilities.add("mobx-react-lite");
|
|
38221
|
+
if (project.hasMobxReact === true || project.hasMobxReactLite === true) capabilities.add("mobx-react-binding");
|
|
38222
|
+
const mobxReactVersion = parseDependencyMajorMinor(project.mobxReactVersion);
|
|
38223
|
+
const mobxReactLiteVersion = parseDependencyMajorMinor(project.mobxReactLiteVersion);
|
|
38224
|
+
const hasMobxReactObserverMemoGuard = mobxReactVersion !== null && isMajorMinorAtLeast(mobxReactVersion, {
|
|
38225
|
+
major: 7,
|
|
38226
|
+
minor: 3
|
|
38227
|
+
});
|
|
38228
|
+
const hasMobxReactLiteObserverMemoGuard = mobxReactLiteVersion !== null && isMajorMinorAtLeast(mobxReactLiteVersion, {
|
|
38229
|
+
major: 3,
|
|
38230
|
+
minor: 3
|
|
38231
|
+
});
|
|
38232
|
+
if (hasMobxReactObserverMemoGuard) capabilities.add("mobx-react-observer-memo-guard");
|
|
38233
|
+
if (hasMobxReactLiteObserverMemoGuard) capabilities.add("mobx-react-lite-observer-memo-guard");
|
|
38234
|
+
if (hasMobxReactObserverMemoGuard || hasMobxReactLiteObserverMemoGuard) capabilities.add("mobx-react-binding-observer-memo-guard");
|
|
38235
|
+
if (project.hasMobxStateTree === true) capabilities.add("mobx-state-tree");
|
|
38236
|
+
if (project.hasMobxReactObserver === true) capabilities.add("mobx-react-observer");
|
|
38237
|
+
if (project.mobxMajorVersion !== void 0 && project.mobxMajorVersion !== null && project.mobxMajorVersion >= 4 && project.mobxMajorVersion <= 6) addVersionCapabilityLadder(capabilities, "mobx", project.mobxMajorVersion, 4, 6);
|
|
38238
|
+
const mobxVersion = parseDependencyMajorMinor(project.mobxVersion);
|
|
38239
|
+
if (project.mobxMajorVersion === 6 && mobxVersion !== null && isMajorMinorAtLeast(mobxVersion, {
|
|
38240
|
+
major: 6,
|
|
38241
|
+
minor: 10
|
|
38242
|
+
})) capabilities.add("mobx:6.10");
|
|
38243
|
+
if (project.zustandVersion !== void 0 && project.zustandVersion !== null) capabilities.add("zustand");
|
|
38244
|
+
if (project.zustandMajorVersion !== void 0 && project.zustandMajorVersion !== null && project.zustandMajorVersion >= 1 && project.zustandMajorVersion <= 5) addVersionCapabilityLadder(capabilities, "zustand", project.zustandMajorVersion, 1, 5);
|
|
37849
38245
|
if (project.isPreES2023Target) capabilities.add("pre-es2023");
|
|
37850
38246
|
if (project.hasReactCompiler) capabilities.add("react-compiler");
|
|
37851
|
-
if (project.hasTanStackQuery) capabilities.add("tanstack-query");
|
|
38247
|
+
if (Boolean(project.hasTanStackQuery) || Boolean(project.tanstackQueryVersion)) capabilities.add("tanstack-query");
|
|
38248
|
+
if (project.styledComponentsVersion) {
|
|
38249
|
+
capabilities.add("styled-components");
|
|
38250
|
+
const styledComponentsMajor = getLowestDependencyMajor(project.styledComponentsVersion);
|
|
38251
|
+
if (styledComponentsMajor !== null && styledComponentsMajor >= 6) capabilities.add("styled-components:6");
|
|
38252
|
+
}
|
|
38253
|
+
if (project.hasI18nLibrary) capabilities.add("i18n");
|
|
37852
38254
|
if (project.valtioVersion !== null) capabilities.add("valtio");
|
|
37853
|
-
|
|
38255
|
+
addVersionCapabilityLadder(capabilities, "valtio", project.valtioMajorVersion, 1, 10);
|
|
38256
|
+
if (project.hasRemotion) {
|
|
38257
|
+
capabilities.add("remotion");
|
|
38258
|
+
addVersionCapabilityLadder(capabilities, "remotion", project.remotionMajorVersion ?? null, 4, 30);
|
|
38259
|
+
}
|
|
38260
|
+
if (project.hasThree || project.hasReactThreeFiber) capabilities.add("three");
|
|
38261
|
+
addVersionCapabilityLadder(capabilities, "three", project.threeRelease ?? null, 145, 250);
|
|
38262
|
+
if (project.hasReactThreeFiber) {
|
|
38263
|
+
capabilities.add("r3f");
|
|
38264
|
+
addVersionCapabilityLadder(capabilities, "r3f", project.reactThreeFiberMajorVersion ?? null, 3, 10);
|
|
38265
|
+
}
|
|
37854
38266
|
if (project.hasTypeScript) capabilities.add("typescript");
|
|
37855
38267
|
if (project.preactVersion !== null) capabilities.add("preact");
|
|
37856
|
-
|
|
38268
|
+
addVersionCapabilityLadder(capabilities, "preact", project.preactMajorVersion, 10, 20);
|
|
37857
38269
|
if (project.preactVersion !== null && project.reactVersion === null) capabilities.add("pure-preact");
|
|
37858
38270
|
return capabilities;
|
|
37859
38271
|
};
|
|
@@ -37865,7 +38277,7 @@ const getCapabilities = (project) => {
|
|
|
37865
38277
|
capabilitiesByProject.set(project, capabilities);
|
|
37866
38278
|
return capabilities;
|
|
37867
38279
|
};
|
|
37868
|
-
const shouldEnableRule = (requires, tags, capabilities, ignoredTags, disabledWhen) => {
|
|
38280
|
+
const shouldEnableRule = (requires, tags, capabilities, ignoredTags, disabledWhen, includedTags) => {
|
|
37869
38281
|
if (requires) {
|
|
37870
38282
|
for (const capability of requires) if (!capabilities.has(capability)) return false;
|
|
37871
38283
|
}
|
|
@@ -37876,20 +38288,29 @@ const shouldEnableRule = (requires, tags, capabilities, ignoredTags, disabledWhe
|
|
|
37876
38288
|
if (tags) {
|
|
37877
38289
|
for (const tag of tags) if (ignoredTags.has(tag)) return false;
|
|
37878
38290
|
}
|
|
38291
|
+
if (includedTags && includedTags.size > 0) {
|
|
38292
|
+
if (!tags?.some((tag) => includedTags.has(tag))) return false;
|
|
38293
|
+
}
|
|
37879
38294
|
return true;
|
|
37880
38295
|
};
|
|
38296
|
+
const shouldEnableRuleByDefaultStatus = (options) => options.defaultEnabled !== false || options.hasExplicitOverride === true || options.includeTagDefaults && options.hasIncludedTags;
|
|
37881
38297
|
const yieldToEventLoop = () => new Promise((resolve) => {
|
|
37882
38298
|
setImmediate(resolve);
|
|
37883
38299
|
});
|
|
37884
38300
|
const createSecurityScanSession = (rootDirectory, options) => {
|
|
37885
38301
|
const capabilities = options.project ? getCapabilities(options.project) : /* @__PURE__ */ new Set();
|
|
37886
38302
|
const ignoredTags = options.ignoredTags ?? /* @__PURE__ */ new Set();
|
|
38303
|
+
const includedTags = options.includedTags ?? /* @__PURE__ */ new Set();
|
|
37887
38304
|
const enabledScanRules = REACT_DOCTOR_RULES.flatMap((entry) => {
|
|
37888
38305
|
const rule = entry.rule;
|
|
37889
38306
|
const scan = rule.scan;
|
|
37890
38307
|
if (typeof scan !== "function") return [];
|
|
37891
|
-
if (
|
|
37892
|
-
|
|
38308
|
+
if (!shouldEnableRuleByDefaultStatus({
|
|
38309
|
+
defaultEnabled: rule.defaultEnabled,
|
|
38310
|
+
includeTagDefaults: options.includeTagDefaults === true,
|
|
38311
|
+
hasIncludedTags: includedTags.size > 0
|
|
38312
|
+
})) return [];
|
|
38313
|
+
if (!shouldEnableRule(rule.requires, rule.tags, capabilities, ignoredTags, rule.disabledWhen, includedTags)) return [];
|
|
37893
38314
|
return [{
|
|
37894
38315
|
entry,
|
|
37895
38316
|
scan,
|
|
@@ -39875,8 +40296,9 @@ const buildUserPluginRules = (userPlugin, severityControls) => {
|
|
|
39875
40296
|
}
|
|
39876
40297
|
return enabled;
|
|
39877
40298
|
};
|
|
39878
|
-
const createOxlintConfig = ({ pluginPath, project, customRulesOnly = false, extendsPaths = [], ignoredTags = /* @__PURE__ */ new Set(), serverAuthFunctionNames, severityControls, userPlugins = [], disableReactHooksJsPlugin = false, ruleSelection, sidecarRuleIdFilter }) => {
|
|
39879
|
-
const
|
|
40299
|
+
const createOxlintConfig = ({ pluginPath, project, customRulesOnly = false, extendsPaths = [], ignoredTags = /* @__PURE__ */ new Set(), includedTags = /* @__PURE__ */ new Set(), includeTagDefaults = false, serverAuthFunctionNames, severityControls, userPlugins = [], disableReactHooksJsPlugin = false, ruleSelection, sidecarRuleIdFilter }) => {
|
|
40300
|
+
const hasIncludedTags = includedTags.size > 0;
|
|
40301
|
+
const reactHooksJsPlugin = disableReactHooksJsPlugin || ruleSelection === "sidecar" || hasIncludedTags ? null : resolveReactHooksJsPlugin(project.hasReactCompiler || project.hasReactCompilerLintPlugin === true, customRulesOnly);
|
|
39880
40302
|
const reactCompilerRules = reactHooksJsPlugin ? applyRuleSeverityControls(filterRulesToAvailable(REACT_COMPILER_RULES, "react-hooks-js", reactHooksJsPlugin.availableRuleNames), severityControls) : {};
|
|
39881
40303
|
const jsPlugins = [];
|
|
39882
40304
|
if (reactHooksJsPlugin) jsPlugins.push(reactHooksJsPlugin.entry);
|
|
@@ -39891,9 +40313,14 @@ const createOxlintConfig = ({ pluginPath, project, customRulesOnly = false, exte
|
|
|
39891
40313
|
if (rule.scan !== void 0) continue;
|
|
39892
40314
|
if (customRulesOnly && registryEntry.originallyExternal) continue;
|
|
39893
40315
|
if (rule.framework !== "global" && !rule.requires) continue;
|
|
39894
|
-
if (!shouldEnableRule(rule.requires, rule.tags, capabilities, ignoredTags, rule.disabledWhen)) continue;
|
|
40316
|
+
if (!shouldEnableRule(rule.requires, rule.tags, capabilities, ignoredTags, rule.disabledWhen, includedTags)) continue;
|
|
39895
40317
|
const explicitRuleOverride = resolveRuleSeverityOverride({ ruleKey: registryEntry.key }, severityControls);
|
|
39896
|
-
if (
|
|
40318
|
+
if (!shouldEnableRuleByDefaultStatus({
|
|
40319
|
+
defaultEnabled: rule.defaultEnabled,
|
|
40320
|
+
includeTagDefaults,
|
|
40321
|
+
hasIncludedTags,
|
|
40322
|
+
hasExplicitOverride: explicitRuleOverride !== void 0
|
|
40323
|
+
})) continue;
|
|
39897
40324
|
const severity = resolveRuleSeverityOverride({
|
|
39898
40325
|
ruleKey: registryEntry.key,
|
|
39899
40326
|
category: rule.category
|
|
@@ -39902,7 +40329,7 @@ const createOxlintConfig = ({ pluginPath, project, customRulesOnly = false, exte
|
|
|
39902
40329
|
enabledReactDoctorRules[registryEntry.key] = severity;
|
|
39903
40330
|
}
|
|
39904
40331
|
const userPluginRules = {};
|
|
39905
|
-
if (ruleSelection !== "sidecar") for (const userPlugin of userPlugins) {
|
|
40332
|
+
if (ruleSelection !== "sidecar" && !hasIncludedTags) for (const userPlugin of userPlugins) {
|
|
39906
40333
|
Object.assign(userPluginRules, buildUserPluginRules(userPlugin, severityControls));
|
|
39907
40334
|
jsPlugins.push(userPlugin.entry);
|
|
39908
40335
|
}
|
|
@@ -40119,6 +40546,19 @@ const createSidecarLintCache = (cacheDirectory, rulesetHash) => {
|
|
|
40119
40546
|
}
|
|
40120
40547
|
};
|
|
40121
40548
|
};
|
|
40549
|
+
const fingerprintCacheByFilePath = /* @__PURE__ */ new Map();
|
|
40550
|
+
const fingerprintFileContents = (filePath, fingerprintLength) => {
|
|
40551
|
+
const fileStats = NFS.statSync(filePath, { bigint: true });
|
|
40552
|
+
const cachedFingerprint = fingerprintCacheByFilePath.get(filePath);
|
|
40553
|
+
if (cachedFingerprint?.modifiedTimeNanoseconds === fileStats.mtimeNs && cachedFingerprint.sizeBytes === fileStats.size) return cachedFingerprint.fingerprint;
|
|
40554
|
+
const fingerprint = crypto.createHash("sha256").update(NFS.readFileSync(filePath)).digest("hex").slice(0, fingerprintLength);
|
|
40555
|
+
fingerprintCacheByFilePath.set(filePath, {
|
|
40556
|
+
fingerprint,
|
|
40557
|
+
modifiedTimeNanoseconds: fileStats.mtimeNs,
|
|
40558
|
+
sizeBytes: fileStats.size
|
|
40559
|
+
});
|
|
40560
|
+
return fingerprint;
|
|
40561
|
+
};
|
|
40122
40562
|
const bundledRequire = createRequire(import.meta.url);
|
|
40123
40563
|
const childNodeVersionByBinaryPath = /* @__PURE__ */ new Map();
|
|
40124
40564
|
const resolveChildNodeVersion = (nodeBinaryPath) => {
|
|
@@ -40142,6 +40582,13 @@ const TOOLCHAIN_PACKAGE_SPECIFIERS = [
|
|
|
40142
40582
|
"oxlint-plugin-react-doctor/package.json",
|
|
40143
40583
|
"eslint-plugin-react-hooks/package.json"
|
|
40144
40584
|
];
|
|
40585
|
+
const resolvePluginFingerprint = () => {
|
|
40586
|
+
try {
|
|
40587
|
+
return fingerprintFileContents(bundledRequire.resolve("oxlint-plugin-react-doctor"), 16);
|
|
40588
|
+
} catch {
|
|
40589
|
+
return "unresolved";
|
|
40590
|
+
}
|
|
40591
|
+
};
|
|
40145
40592
|
const resolveOxlintToolchainVersions = (nodeBinaryPath = process.execPath) => {
|
|
40146
40593
|
const versions = [`node=${resolveChildNodeVersion(nodeBinaryPath)}`];
|
|
40147
40594
|
for (const specifier of TOOLCHAIN_PACKAGE_SPECIFIERS) try {
|
|
@@ -40151,6 +40598,7 @@ const resolveOxlintToolchainVersions = (nodeBinaryPath = process.execPath) => {
|
|
|
40151
40598
|
} catch {
|
|
40152
40599
|
versions.push(`${specifier}=missing`);
|
|
40153
40600
|
}
|
|
40601
|
+
versions.push(`oxlint-plugin-react-doctor#fingerprint=${resolvePluginFingerprint()}`);
|
|
40154
40602
|
return versions;
|
|
40155
40603
|
};
|
|
40156
40604
|
const esmRequire = createRequire(import.meta.url);
|
|
@@ -41626,7 +42074,7 @@ const reactHooksJsPluginDropNote = (error) => {
|
|
|
41626
42074
|
* 6. always restore disable directives + clean up the temp dir
|
|
41627
42075
|
*/
|
|
41628
42076
|
const runOxlint = async (options) => {
|
|
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;
|
|
42077
|
+
const { rootDirectory, project, includePaths, nodeBinaryPath = process.execPath, customRulesOnly = false, respectInlineDisables = true, adoptExistingLintConfig = true, ignoredTags = /* @__PURE__ */ new Set(), includedTags = /* @__PURE__ */ new Set(), includeTagDefaults = false, userConfig, configSourceDirectory = rootDirectory, onPartialFailure, onFileCoverage, perFileLintCacheEnabled = false, sidecarLintCacheEnabled = false, onCacheStats, onSidecarStats, spawnTimeoutMs, outputMaxBytes, lintBatchOrdering = "cost" } = options;
|
|
41630
42078
|
const serverAuthFunctionNames = Array.isArray(userConfig?.serverAuthFunctionNames) ? userConfig.serverAuthFunctionNames.filter((entry) => typeof entry === "string" && entry.length > 0) : void 0;
|
|
41631
42079
|
const severityControls = buildRuleSeverityControls(userConfig);
|
|
41632
42080
|
validateRuleRegistration();
|
|
@@ -41640,13 +42088,15 @@ const runOxlint = async (options) => {
|
|
|
41640
42088
|
}
|
|
41641
42089
|
const pluginPath = resolvePluginPath();
|
|
41642
42090
|
const extendsPaths = (adoptExistingLintConfig && !customRulesOnly ? detectUserLintConfigPaths(rootDirectory) : []).filter(canOxlintExtendConfig);
|
|
41643
|
-
const userPlugins = resolveUserPlugins(userConfig?.plugins, configSourceDirectory);
|
|
42091
|
+
const userPlugins = includedTags.size > 0 ? [] : resolveUserPlugins(userConfig?.plugins, configSourceDirectory);
|
|
41644
42092
|
const buildConfig = (overrides) => createOxlintConfig({
|
|
41645
42093
|
pluginPath,
|
|
41646
42094
|
project,
|
|
41647
42095
|
customRulesOnly,
|
|
41648
42096
|
extendsPaths: overrides.extendsPaths,
|
|
41649
42097
|
ignoredTags,
|
|
42098
|
+
includedTags,
|
|
42099
|
+
includeTagDefaults,
|
|
41650
42100
|
serverAuthFunctionNames,
|
|
41651
42101
|
severityControls,
|
|
41652
42102
|
userPlugins,
|
|
@@ -42035,6 +42485,8 @@ var Linter = class Linter extends Service()("react-doctor/Linter") {
|
|
|
42035
42485
|
respectInlineDisables: input.respectInlineDisables,
|
|
42036
42486
|
adoptExistingLintConfig: input.adoptExistingLintConfig,
|
|
42037
42487
|
ignoredTags: input.ignoredTags,
|
|
42488
|
+
includedTags: input.includedTags,
|
|
42489
|
+
includeTagDefaults: input.includeTagDefaults,
|
|
42038
42490
|
userConfig: input.userConfig ?? null,
|
|
42039
42491
|
configSourceDirectory: input.configSourceDirectory,
|
|
42040
42492
|
onPartialFailure: (reason) => {
|
|
@@ -42883,7 +43335,9 @@ const runInspect = (input, hooks = {}) => gen(function* () {
|
|
|
42883
43335
|
const securityScanFailedRef = yield* make$13(false);
|
|
42884
43336
|
const securityScanFiber = yield* forkChild(runCollect(applyPerElementPipeline(isDiffMode ? empty$4 : unwrap(tryPromise(() => checkSecurityScanCooperative(scanDirectory, {
|
|
42885
43337
|
project,
|
|
42886
|
-
ignoredTags: input.ignoredTags
|
|
43338
|
+
ignoredTags: input.ignoredTags,
|
|
43339
|
+
includedTags: input.includedTags,
|
|
43340
|
+
includeTagDefaults: input.includeTagDefaults
|
|
42887
43341
|
})).pipe(map$3((diagnostics) => fromIterable$1(diagnostics)), catch_$1(() => set(securityScanFailedRef, true).pipe(as(empty$4))))))).pipe(withSpan("SecurityScan.run")));
|
|
42888
43342
|
const shouldRunSupplyChain = !isDiffMode || (input.supplyChainManifestChanged ?? false);
|
|
42889
43343
|
const supplyChainOverlapTimeout = yield* SupplyChainOverlapTimeoutMs;
|
|
@@ -42974,6 +43428,8 @@ const runInspect = (input, hooks = {}) => gen(function* () {
|
|
|
42974
43428
|
respectInlineDisables: input.respectInlineDisables,
|
|
42975
43429
|
adoptExistingLintConfig: input.adoptExistingLintConfig,
|
|
42976
43430
|
ignoredTags: input.ignoredTags,
|
|
43431
|
+
includedTags: input.includedTags,
|
|
43432
|
+
includeTagDefaults: input.includeTagDefaults,
|
|
42977
43433
|
userConfig: resolvedConfig.config ?? void 0,
|
|
42978
43434
|
configSourceDirectory: resolvedConfig.configSourceDirectory ?? void 0,
|
|
42979
43435
|
onFileProgress: (scannedFileCount, totalFileCount) => {
|
|
@@ -45476,5 +45932,5 @@ const startLanguageServer = () => {
|
|
|
45476
45932
|
};
|
|
45477
45933
|
//#endregion
|
|
45478
45934
|
export { startLanguageServer };
|
|
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]="
|
|
45480
|
-
//# debugId=
|
|
45935
|
+
!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]="51dfb658-30e2-586b-8f8e-5eaa86b6350a")}catch(e){}}();
|
|
45936
|
+
//# debugId=51dfb658-30e2-586b-8f8e-5eaa86b6350a
|