react-doctor 0.8.1-dev.5b468f8 → 0.8.1-dev.6fcd9c9
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 +147 -524
- package/dist/index.d.ts +0 -17
- package/dist/index.js +103 -433
- package/dist/lsp.js +103 -433
- package/dist/skills/react-doctor/SKILL.md +0 -5
- package/package.json +5 -5
package/dist/lsp.js
CHANGED
|
@@ -32883,6 +32883,44 @@ var AmbiguousProjectError = class extends Error {
|
|
|
32883
32883
|
}
|
|
32884
32884
|
};
|
|
32885
32885
|
const isProjectDiscoveryError = (value) => value instanceof ProjectNotFoundError || value instanceof NoReactDependencyError || value instanceof PackageJsonNotFoundError || value instanceof NotADirectoryError || value instanceof AmbiguousProjectError;
|
|
32886
|
+
const isErrnoException = (error) => error instanceof Error && "code" in error;
|
|
32887
|
+
const IGNORABLE_READDIR_ERROR_CODES = new Set([
|
|
32888
|
+
"EACCES",
|
|
32889
|
+
"EPERM",
|
|
32890
|
+
"ENOENT",
|
|
32891
|
+
"ENOTDIR",
|
|
32892
|
+
"EINVAL",
|
|
32893
|
+
"ELOOP",
|
|
32894
|
+
"ENAMETOOLONG"
|
|
32895
|
+
]);
|
|
32896
|
+
const isIgnorableReaddirError = (error) => isErrnoException(error) && typeof error.code === "string" && IGNORABLE_READDIR_ERROR_CODES.has(error.code);
|
|
32897
|
+
const readDirectoryEntries = (directoryPath) => {
|
|
32898
|
+
try {
|
|
32899
|
+
return NFS.readdirSync(directoryPath, { withFileTypes: true });
|
|
32900
|
+
} catch (error) {
|
|
32901
|
+
if (isIgnorableReaddirError(error)) return [];
|
|
32902
|
+
throw error;
|
|
32903
|
+
}
|
|
32904
|
+
};
|
|
32905
|
+
const isFile = (filePath) => {
|
|
32906
|
+
try {
|
|
32907
|
+
return NFS.statSync(filePath).isFile();
|
|
32908
|
+
} catch {
|
|
32909
|
+
return false;
|
|
32910
|
+
}
|
|
32911
|
+
};
|
|
32912
|
+
const isDirectory = (directoryPath) => {
|
|
32913
|
+
try {
|
|
32914
|
+
return NFS.statSync(directoryPath).isDirectory();
|
|
32915
|
+
} catch {
|
|
32916
|
+
return false;
|
|
32917
|
+
}
|
|
32918
|
+
};
|
|
32919
|
+
const isPlainObject = (value) => {
|
|
32920
|
+
if (typeof value !== "object" || value === null || Array.isArray(value)) return false;
|
|
32921
|
+
const prototype = Object.getPrototypeOf(value);
|
|
32922
|
+
return prototype === null || prototype === Object.prototype;
|
|
32923
|
+
};
|
|
32886
32924
|
const SOURCE_FILE_PATTERN = /\.(tsx?|jsx?|mts|mjs)$/;
|
|
32887
32925
|
const GENERATED_BUNDLE_FILE_PATTERN = /\.(iife|umd|global|min)\.m?js$/i;
|
|
32888
32926
|
const GENERATED_SOURCE_DIRECTORY_PATTERN = /(?:^|\/)__generated__\//;
|
|
@@ -33064,44 +33102,6 @@ const SUPPLY_CHAIN_OVERLAP_TIMEOUT_MS = 9e4;
|
|
|
33064
33102
|
const SUPPLY_CHAIN_CACHE_TTL_MS = 864e5;
|
|
33065
33103
|
const SUPPLY_CHAIN_CACHE_SUBDIR = "supply-chain";
|
|
33066
33104
|
const SUPPLY_CHAIN_IGNORED_PACKAGES = new Set(["next"]);
|
|
33067
|
-
const isErrnoException = (error) => error instanceof Error && "code" in error;
|
|
33068
|
-
const IGNORABLE_READDIR_ERROR_CODES = new Set([
|
|
33069
|
-
"EACCES",
|
|
33070
|
-
"EPERM",
|
|
33071
|
-
"ENOENT",
|
|
33072
|
-
"ENOTDIR",
|
|
33073
|
-
"EINVAL",
|
|
33074
|
-
"ELOOP",
|
|
33075
|
-
"ENAMETOOLONG"
|
|
33076
|
-
]);
|
|
33077
|
-
const isIgnorableReaddirError = (error) => isErrnoException(error) && typeof error.code === "string" && IGNORABLE_READDIR_ERROR_CODES.has(error.code);
|
|
33078
|
-
const readDirectoryEntries = (directoryPath) => {
|
|
33079
|
-
try {
|
|
33080
|
-
return NFS.readdirSync(directoryPath, { withFileTypes: true });
|
|
33081
|
-
} catch (error) {
|
|
33082
|
-
if (isIgnorableReaddirError(error)) return [];
|
|
33083
|
-
throw error;
|
|
33084
|
-
}
|
|
33085
|
-
};
|
|
33086
|
-
const isFile = (filePath) => {
|
|
33087
|
-
try {
|
|
33088
|
-
return NFS.statSync(filePath).isFile();
|
|
33089
|
-
} catch {
|
|
33090
|
-
return false;
|
|
33091
|
-
}
|
|
33092
|
-
};
|
|
33093
|
-
const isDirectory = (directoryPath) => {
|
|
33094
|
-
try {
|
|
33095
|
-
return NFS.statSync(directoryPath).isDirectory();
|
|
33096
|
-
} catch {
|
|
33097
|
-
return false;
|
|
33098
|
-
}
|
|
33099
|
-
};
|
|
33100
|
-
const isPlainObject = (value) => {
|
|
33101
|
-
if (typeof value !== "object" || value === null || Array.isArray(value)) return false;
|
|
33102
|
-
const prototype = Object.getPrototypeOf(value);
|
|
33103
|
-
return prototype === null || prototype === Object.prototype;
|
|
33104
|
-
};
|
|
33105
33105
|
const lastSourceMappingUrl = (fileContent) => {
|
|
33106
33106
|
const lastReference = [...fileContent.matchAll(/\/\/# sourceMappingURL=(\S+)/g)].at(-1);
|
|
33107
33107
|
return lastReference ? lastReference[1] : null;
|
|
@@ -33427,10 +33427,10 @@ const FALLBACK_TSCONFIG_FILENAMES = ["tsconfig.app.json", "tsconfig.build.json"]
|
|
|
33427
33427
|
const FRAMEWORK_PACKAGES = {
|
|
33428
33428
|
next: "nextjs",
|
|
33429
33429
|
"@tanstack/react-start": "tanstack-start",
|
|
33430
|
-
"@remix-run/react": "remix",
|
|
33431
|
-
gatsby: "gatsby",
|
|
33432
33430
|
vite: "vite",
|
|
33433
33431
|
"react-scripts": "cra",
|
|
33432
|
+
"@remix-run/react": "remix",
|
|
33433
|
+
gatsby: "gatsby",
|
|
33434
33434
|
expo: "expo",
|
|
33435
33435
|
"react-native": "react-native"
|
|
33436
33436
|
};
|
|
@@ -33454,17 +33454,11 @@ const NEXT_CONFIG_FILENAMES = [
|
|
|
33454
33454
|
];
|
|
33455
33455
|
const BABEL_CONFIG_FILENAMES = [
|
|
33456
33456
|
".babelrc",
|
|
33457
|
-
".babelrc.js",
|
|
33458
33457
|
".babelrc.json",
|
|
33459
|
-
".babelrc.cjs",
|
|
33460
|
-
".babelrc.mjs",
|
|
33461
|
-
".babelrc.cts",
|
|
33462
33458
|
"babel.config.js",
|
|
33463
33459
|
"babel.config.json",
|
|
33464
33460
|
"babel.config.cjs",
|
|
33465
|
-
"babel.config.mjs"
|
|
33466
|
-
"babel.config.ts",
|
|
33467
|
-
"babel.config.cts"
|
|
33461
|
+
"babel.config.mjs"
|
|
33468
33462
|
];
|
|
33469
33463
|
const VITE_CONFIG_FILENAMES = [
|
|
33470
33464
|
"vite.config.js",
|
|
@@ -33476,28 +33470,12 @@ const VITE_CONFIG_FILENAMES = [
|
|
|
33476
33470
|
"vitest.config.ts",
|
|
33477
33471
|
"vitest.config.js"
|
|
33478
33472
|
];
|
|
33479
|
-
const RSBUILD_CONFIG_FILENAMES = [
|
|
33480
|
-
"rsbuild.config.ts",
|
|
33481
|
-
"rsbuild.config.js",
|
|
33482
|
-
"rsbuild.config.mts",
|
|
33483
|
-
"rsbuild.config.mjs",
|
|
33484
|
-
"rsbuild.config.cts",
|
|
33485
|
-
"rsbuild.config.cjs"
|
|
33486
|
-
];
|
|
33487
|
-
const RSPACK_CONFIG_FILENAMES = [
|
|
33488
|
-
"rspack.config.ts",
|
|
33489
|
-
"rspack.config.js",
|
|
33490
|
-
"rspack.config.mts",
|
|
33491
|
-
"rspack.config.mjs",
|
|
33492
|
-
"rspack.config.cts",
|
|
33493
|
-
"rspack.config.cjs"
|
|
33494
|
-
];
|
|
33495
33473
|
const EXPO_APP_CONFIG_FILENAMES = [
|
|
33496
33474
|
"app.json",
|
|
33497
33475
|
"app.config.js",
|
|
33498
33476
|
"app.config.ts"
|
|
33499
33477
|
];
|
|
33500
|
-
const REACT_COMPILER_PACKAGE_REFERENCE_PATTERN = /babel-plugin-react-compiler|react-compiler-runtime|
|
|
33478
|
+
const REACT_COMPILER_PACKAGE_REFERENCE_PATTERN = /babel-plugin-react-compiler|react-compiler-runtime|["']react-compiler["']/;
|
|
33501
33479
|
const REACT_COMPILER_ENABLED_FLAG_PATTERN = /["']?reactCompiler["']?\s*:\s*(?:true\b|\{)/;
|
|
33502
33480
|
const STATIC_EXPORT_OUTPUT_PATTERN = /(?:^|[^.\w])["']?output["']?\s*:\s*["']export["']/m;
|
|
33503
33481
|
const hasCompilerPackage = (packageJson, compilerPackages) => {
|
|
@@ -33532,8 +33510,6 @@ const detectReactCompiler = (directory, packageJson) => {
|
|
|
33532
33510
|
if (hasCompilerInConfigFiles(directory, NEXT_CONFIG_FILENAMES)) return true;
|
|
33533
33511
|
if (hasCompilerInConfigFiles(directory, BABEL_CONFIG_FILENAMES)) return true;
|
|
33534
33512
|
if (hasCompilerInConfigFiles(directory, VITE_CONFIG_FILENAMES)) return true;
|
|
33535
|
-
if (hasCompilerInConfigFiles(directory, RSBUILD_CONFIG_FILENAMES)) return true;
|
|
33536
|
-
if (hasCompilerInConfigFiles(directory, RSPACK_CONFIG_FILENAMES)) return true;
|
|
33537
33513
|
if (hasCompilerInConfigFiles(directory, EXPO_APP_CONFIG_FILENAMES)) return true;
|
|
33538
33514
|
return hasCompilerPackageInAncestors(directory, REACT_COMPILER_TRANSFORM_PACKAGES);
|
|
33539
33515
|
};
|
|
@@ -33542,7 +33518,7 @@ const detectNextjsStaticExport = (directory) => NEXT_CONFIG_FILENAMES.some((file
|
|
|
33542
33518
|
const filePath = Path.join(directory, filename);
|
|
33543
33519
|
return isFile(filePath) && STATIC_EXPORT_OUTPUT_PATTERN.test(NFS.readFileSync(filePath, "utf-8"));
|
|
33544
33520
|
});
|
|
33545
|
-
const UNRESOLVABLE_PROTOCOL_VERSION = /^(?:
|
|
33521
|
+
const UNRESOLVABLE_PROTOCOL_VERSION = /^(?:file|git|github|https?|link|patch|portal|workspace|npm):/i;
|
|
33546
33522
|
const DIST_TAG_VERSION = /^[a-z][a-z0-9._-]*$/i;
|
|
33547
33523
|
const WILDCARD_VERSION = /^[*xX](?:\.[*xX])*$/;
|
|
33548
33524
|
const NPM_ALIAS_VERSION = /^npm:(?:@[^/]+\/[^@]+|[^@]+)@(.+)$/i;
|
|
@@ -33675,16 +33651,6 @@ const getLowestDependencyMajor = (version) => {
|
|
|
33675
33651
|
}
|
|
33676
33652
|
return lowestMajor;
|
|
33677
33653
|
};
|
|
33678
|
-
const getDependencyMajorWithinSupportedRange = (version, latestSupportedMajor) => {
|
|
33679
|
-
const normalizedVersion = normalizeDependencyVersion(version);
|
|
33680
|
-
if (normalizedVersion === null) return null;
|
|
33681
|
-
const validRange = import_semver.validRange(normalizedVersion);
|
|
33682
|
-
if (validRange === null) return null;
|
|
33683
|
-
const minimumVersion = import_semver.minVersion(validRange);
|
|
33684
|
-
if (minimumVersion === null || minimumVersion.major > latestSupportedMajor) return null;
|
|
33685
|
-
if (import_semver.intersects(validRange, `>=${latestSupportedMajor + 1}.0.0`)) return null;
|
|
33686
|
-
return minimumVersion.major;
|
|
33687
|
-
};
|
|
33688
33654
|
const isConcreteDependencyVersion = (version) => {
|
|
33689
33655
|
const normalizedVersion = normalizeDependencyVersion(version);
|
|
33690
33656
|
return normalizedVersion !== null && /\d/.test(normalizedVersion);
|
|
@@ -33728,18 +33694,9 @@ const parseReactMajorMinor = (reactVersion) => {
|
|
|
33728
33694
|
};
|
|
33729
33695
|
};
|
|
33730
33696
|
const parseLowerBoundVersion = (versionSpec) => import_semver.validRange(versionSpec) !== null ? import_semver.minVersion(versionSpec) : import_semver.coerce(versionSpec);
|
|
33731
|
-
const
|
|
33732
|
-
if (typeof
|
|
33733
|
-
const
|
|
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();
|
|
33697
|
+
const parseTailwindMajorMinor = (tailwindVersion) => {
|
|
33698
|
+
if (typeof tailwindVersion !== "string") return null;
|
|
33699
|
+
const trimmed = tailwindVersion.trim();
|
|
33743
33700
|
if (trimmed.length === 0) return null;
|
|
33744
33701
|
const lowerBound = parseLowerBoundVersion(trimmed);
|
|
33745
33702
|
if (lowerBound === null || lowerBound.major <= 0) return null;
|
|
@@ -33748,7 +33705,6 @@ const parseDependencyMajorMinor = (dependencyVersion) => {
|
|
|
33748
33705
|
minor: lowerBound.minor
|
|
33749
33706
|
};
|
|
33750
33707
|
};
|
|
33751
|
-
const parseTailwindMajorMinor = (tailwindVersion) => parseDependencyMajorMinor(tailwindVersion);
|
|
33752
33708
|
const hasUpperBoundOnlyPeerRange = (range) => {
|
|
33753
33709
|
if (typeof range !== "string") return false;
|
|
33754
33710
|
const normalizedRange = normalizeDependencyVersion(range);
|
|
@@ -33770,7 +33726,7 @@ const resolveEffectiveReactMajor = (reactVersion, packageJson) => {
|
|
|
33770
33726
|
if (peerFloor === null) return hasUpperBoundOnlyPeerRange(peerReactRange) ? null : installedReactMajor;
|
|
33771
33727
|
return installedReactMajor !== null ? Math.min(installedReactMajor, peerFloor) : peerFloor;
|
|
33772
33728
|
};
|
|
33773
|
-
const isCatalogReference = (version) =>
|
|
33729
|
+
const isCatalogReference = (version) => version.startsWith("catalog:");
|
|
33774
33730
|
const extractCatalogName = (version) => {
|
|
33775
33731
|
if (!isCatalogReference(version)) return null;
|
|
33776
33732
|
const name = version.slice(8).trim();
|
|
@@ -33920,12 +33876,6 @@ const TAILWIND_ZOD_SECTIONS = [
|
|
|
33920
33876
|
"devDependencies",
|
|
33921
33877
|
"peerDependencies"
|
|
33922
33878
|
];
|
|
33923
|
-
const DEPENDENCY_SPEC_SECTIONS = [
|
|
33924
|
-
"dependencies",
|
|
33925
|
-
"devDependencies",
|
|
33926
|
-
"peerDependencies",
|
|
33927
|
-
"optionalDependencies"
|
|
33928
|
-
];
|
|
33929
33879
|
const EMPTY_DEPENDENCY_INFO = {
|
|
33930
33880
|
reactVersion: null,
|
|
33931
33881
|
tailwindVersion: null,
|
|
@@ -33935,7 +33885,7 @@ const EMPTY_DEPENDENCY_INFO = {
|
|
|
33935
33885
|
const pickConcreteVersion = (packageJson, packageName, sections) => {
|
|
33936
33886
|
for (const section of sections) {
|
|
33937
33887
|
const version = packageJson[section]?.[packageName];
|
|
33938
|
-
if (
|
|
33888
|
+
if (version === void 0) continue;
|
|
33939
33889
|
if (isCatalogReference(version)) return null;
|
|
33940
33890
|
if (isConcreteDependencyVersion(version)) return version;
|
|
33941
33891
|
}
|
|
@@ -33967,16 +33917,13 @@ const extractDependencyInfo = (packageJson) => {
|
|
|
33967
33917
|
};
|
|
33968
33918
|
};
|
|
33969
33919
|
const getDependencySpec = (packageJson, packageName) => {
|
|
33970
|
-
|
|
33971
|
-
|
|
33972
|
-
if (typeof spec === "string") return spec;
|
|
33973
|
-
}
|
|
33974
|
-
return null;
|
|
33920
|
+
const spec = packageJson.dependencies?.[packageName] ?? packageJson.devDependencies?.[packageName] ?? packageJson.peerDependencies?.[packageName] ?? packageJson.optionalDependencies?.[packageName];
|
|
33921
|
+
return typeof spec === "string" ? spec : null;
|
|
33975
33922
|
};
|
|
33976
33923
|
const getDependencyDeclaration = ({ packageJson, packageName, sections }) => {
|
|
33977
33924
|
for (const section of sections) {
|
|
33978
33925
|
const version = packageJson[section]?.[packageName];
|
|
33979
|
-
if (
|
|
33926
|
+
if (version === void 0) continue;
|
|
33980
33927
|
return {
|
|
33981
33928
|
catalogReference: extractCatalogName(version) ?? null,
|
|
33982
33929
|
hasDeclaration: true,
|
|
@@ -34010,15 +33957,24 @@ const getPreactVersion = (packageJson) => {
|
|
|
34010
33957
|
...packageJson.devDependencies
|
|
34011
33958
|
}.preact ?? null;
|
|
34012
33959
|
};
|
|
34013
|
-
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 }) => {
|
|
34014
33974
|
if (version === null || !isCatalogReference(version)) return version;
|
|
34015
33975
|
const catalogName = extractCatalogName(version);
|
|
34016
|
-
const
|
|
34017
|
-
if (
|
|
34018
|
-
if (sourceDirectory !== rootDirectory || sourcePackageJson !== rootPackageJson) {
|
|
34019
|
-
const resolvedRootVersion = resolveCatalogVersion(rootPackageJson, packageName, rootDirectory, catalogName);
|
|
34020
|
-
if (resolvedRootVersion) return resolvedRootVersion;
|
|
34021
|
-
}
|
|
33976
|
+
const resolvedLocalVersion = resolveCatalogVersion(rootPackageJson, packageName, rootDirectory, catalogName);
|
|
33977
|
+
if (resolvedLocalVersion) return resolvedLocalVersion;
|
|
34022
33978
|
const monorepoRoot = findMonorepoRoot(rootDirectory);
|
|
34023
33979
|
if (!monorepoRoot) return version;
|
|
34024
33980
|
const monorepoPackageJsonPath = Path.join(monorepoRoot, "package.json");
|
|
@@ -34216,75 +34172,11 @@ const listWorkspacePackages = (rootDirectory) => {
|
|
|
34216
34172
|
}
|
|
34217
34173
|
return packages;
|
|
34218
34174
|
};
|
|
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
|
-
};
|
|
34268
34175
|
const REANIMATED_DEPENDENCY_NAME = "react-native-reanimated";
|
|
34269
34176
|
const MOBX_REACT_PACKAGE_NAME = "mobx-react";
|
|
34270
34177
|
const MOBX_REACT_LITE_PACKAGE_NAME = "mobx-react-lite";
|
|
34271
34178
|
const MOBX_STATE_TREE_PACKAGE_NAME = "mobx-state-tree";
|
|
34272
34179
|
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"];
|
|
34288
34180
|
const SHOPIFY_FLASH_LIST_PACKAGE_NAME = "@shopify/flash-list";
|
|
34289
34181
|
const resolveWorkspaceDependencyVersion = ({ concreteVersion, packageName, rootDirectory, rootPackageJson, sections, workspaceDirectory, workspacePackageJson }) => {
|
|
34290
34182
|
const dependencyDeclaration = getDependencyDeclaration({
|
|
@@ -34295,7 +34187,7 @@ const resolveWorkspaceDependencyVersion = ({ concreteVersion, packageName, rootD
|
|
|
34295
34187
|
if (!dependencyDeclaration.hasDeclaration) return null;
|
|
34296
34188
|
return concreteVersion ?? resolveCatalogVersion(workspacePackageJson, packageName, workspaceDirectory, dependencyDeclaration.catalogReference) ?? resolveCatalogVersion(rootPackageJson, packageName, rootDirectory, dependencyDeclaration.catalogReference);
|
|
34297
34189
|
};
|
|
34298
|
-
const
|
|
34190
|
+
const shouldReplaceReactVersion = (currentVersion, nextVersion) => {
|
|
34299
34191
|
if (!currentVersion) return true;
|
|
34300
34192
|
const currentMajor = parseReactMajor(currentVersion);
|
|
34301
34193
|
const nextMajor = parseReactMajor(nextVersion);
|
|
@@ -34314,50 +34206,6 @@ const shouldReplaceSupportedDependencyFact = (currentFact, nextFact, latestSuppo
|
|
|
34314
34206
|
if (nextMajor > latestSupportedMajor) return true;
|
|
34315
34207
|
return nextMajor < currentMajor;
|
|
34316
34208
|
};
|
|
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
34209
|
const evaluateManifestFacts = (facts, packageJson, directory, rootDirectory, rootPackageJson) => {
|
|
34362
34210
|
if (facts.expo.version === null) {
|
|
34363
34211
|
const spec = getDependencySpec(packageJson, "expo");
|
|
@@ -34391,10 +34239,10 @@ const evaluateManifestFacts = (facts, packageJson, directory, rootDirectory, roo
|
|
|
34391
34239
|
}),
|
|
34392
34240
|
sourceDirectory: directory
|
|
34393
34241
|
};
|
|
34394
|
-
if (
|
|
34242
|
+
if (shouldReplaceSupportedDependencyFact(facts.mobx, nextMobxFact, 6)) facts.mobx = nextMobxFact;
|
|
34395
34243
|
}
|
|
34396
|
-
|
|
34397
|
-
|
|
34244
|
+
facts.hasMobxReact = facts.hasMobxReact || getDependencySpec(packageJson, MOBX_REACT_PACKAGE_NAME) !== null;
|
|
34245
|
+
facts.hasMobxReactLite = facts.hasMobxReactLite || getDependencySpec(packageJson, MOBX_REACT_LITE_PACKAGE_NAME) !== null;
|
|
34398
34246
|
facts.hasMobxStateTree = facts.hasMobxStateTree || getDependencySpec(packageJson, MOBX_STATE_TREE_PACKAGE_NAME) !== null;
|
|
34399
34247
|
facts.hasMobxReactObserver = facts.hasMobxReactObserver || getDependencySpec(packageJson, MOBX_REACT_OBSERVER_PACKAGE_NAME) !== null;
|
|
34400
34248
|
const zustandSpec = getDependencySpec(packageJson, "zustand");
|
|
@@ -34418,52 +34266,6 @@ const evaluateManifestFacts = (facts, packageJson, directory, rootDirectory, roo
|
|
|
34418
34266
|
const spec = getDependencySpec(packageJson, "valtio");
|
|
34419
34267
|
if (spec !== null) facts.valtioVersion = spec;
|
|
34420
34268
|
}
|
|
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
|
-
}
|
|
34467
34269
|
facts.hasReactNativeAwarePackage = facts.hasReactNativeAwarePackage || isPackageJsonReactNativeAware(packageJson);
|
|
34468
34270
|
facts.hasReanimatedAwarePackage = facts.hasReanimatedAwarePackage || isPackageJsonReanimatedAware(packageJson);
|
|
34469
34271
|
facts.hasSsrDependency = facts.hasSsrDependency || isPackageJsonSsrAware(packageJson);
|
|
@@ -34485,8 +34287,6 @@ const evaluateManifestFacts = (facts, packageJson, directory, rootDirectory, roo
|
|
|
34485
34287
|
if (currentRemotionMajorVersion === null || remotionMajorVersion < currentRemotionMajorVersion) facts.remotionVersion = resolvedRemotionVersion;
|
|
34486
34288
|
}
|
|
34487
34289
|
}
|
|
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);
|
|
34490
34290
|
};
|
|
34491
34291
|
const collectWorkspaceFacts = (rootDirectory, rootPackageJson, { collectReactGroup }) => {
|
|
34492
34292
|
const facts = {
|
|
@@ -34512,32 +34312,19 @@ const collectWorkspaceFacts = (rootDirectory, rootPackageJson, { collectReactGro
|
|
|
34512
34312
|
sourceDirectory: null
|
|
34513
34313
|
},
|
|
34514
34314
|
hasMobxReact: false,
|
|
34515
|
-
mobxReactVersion: null,
|
|
34516
34315
|
hasMobxReactLite: false,
|
|
34517
|
-
mobxReactLiteVersion: null,
|
|
34518
34316
|
hasMobxStateTree: false,
|
|
34519
34317
|
hasMobxReactObserver: false,
|
|
34520
34318
|
zustand: {
|
|
34521
34319
|
version: null,
|
|
34522
34320
|
sourceDirectory: null
|
|
34523
34321
|
},
|
|
34524
|
-
tanstackQueryVersion: null,
|
|
34525
|
-
styledComponentsVersion: null,
|
|
34526
|
-
hasI18nLibrary: false,
|
|
34527
34322
|
hasReactNativeAwarePackage: false,
|
|
34528
34323
|
hasReanimatedAwarePackage: false,
|
|
34529
34324
|
hasSsrDependency: false,
|
|
34530
34325
|
hasRemotionDependency: false,
|
|
34531
34326
|
hasUnknownRemotionVersion: false,
|
|
34532
34327
|
remotionVersion: null,
|
|
34533
|
-
hasThree: false,
|
|
34534
|
-
threeVersion: null,
|
|
34535
|
-
hasReactThreeFiber: false,
|
|
34536
|
-
reactThreeFiber: {
|
|
34537
|
-
packageName: null,
|
|
34538
|
-
version: null,
|
|
34539
|
-
sourceDirectory: null
|
|
34540
|
-
},
|
|
34541
34328
|
reanimatedVersion: null
|
|
34542
34329
|
};
|
|
34543
34330
|
evaluateManifestFacts(facts, rootPackageJson, rootDirectory, rootDirectory, rootPackageJson);
|
|
@@ -34580,7 +34367,7 @@ const collectWorkspaceFacts = (rootDirectory, rootPackageJson, { collectReactGro
|
|
|
34580
34367
|
workspaceDirectory,
|
|
34581
34368
|
workspacePackageJson
|
|
34582
34369
|
});
|
|
34583
|
-
if (reactVersion &&
|
|
34370
|
+
if (reactVersion && shouldReplaceReactVersion(facts.reactVersion, reactVersion)) facts.reactVersion = reactVersion;
|
|
34584
34371
|
if (tailwindVersion && !facts.tailwindVersion) facts.tailwindVersion = tailwindVersion;
|
|
34585
34372
|
if (zodVersion && !facts.zodVersion) facts.zodVersion = zodVersion;
|
|
34586
34373
|
const settledReactMajor = parseReactMajor(facts.reactVersion);
|
|
@@ -34776,9 +34563,7 @@ const discoverProjectWithoutPackageJson = (directory) => {
|
|
|
34776
34563
|
mobxVersion: null,
|
|
34777
34564
|
mobxMajorVersion: null,
|
|
34778
34565
|
hasMobxReact: false,
|
|
34779
|
-
mobxReactVersion: null,
|
|
34780
34566
|
hasMobxReactLite: false,
|
|
34781
|
-
mobxReactLiteVersion: null,
|
|
34782
34567
|
hasMobxStateTree: false,
|
|
34783
34568
|
hasMobxReactObserver: false,
|
|
34784
34569
|
zustandVersion: null,
|
|
@@ -34793,15 +34578,6 @@ const discoverProjectWithoutPackageJson = (directory) => {
|
|
|
34793
34578
|
hasRemotion: false,
|
|
34794
34579
|
remotionVersion: null,
|
|
34795
34580
|
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,
|
|
34805
34581
|
hasSsrDependency: false,
|
|
34806
34582
|
preactVersion: null,
|
|
34807
34583
|
preactMajorVersion: null,
|
|
@@ -34928,19 +34704,6 @@ const discoverProject = (directory) => {
|
|
|
34928
34704
|
});
|
|
34929
34705
|
const preactVersion = getPreactVersion(packageJson);
|
|
34930
34706
|
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
|
-
});
|
|
34944
34707
|
const isPreES2023Target = hasTypeScript && detectPreES2023Target(directory);
|
|
34945
34708
|
const projectInfo = {
|
|
34946
34709
|
rootDirectory: directory,
|
|
@@ -34951,11 +34714,9 @@ const discoverProject = (directory) => {
|
|
|
34951
34714
|
zodVersion,
|
|
34952
34715
|
zodMajorVersion: zodVersion === null ? null : getLowestDependencyMajor(zodVersion),
|
|
34953
34716
|
mobxVersion,
|
|
34954
|
-
mobxMajorVersion: mobxVersion === null ? null :
|
|
34717
|
+
mobxMajorVersion: mobxVersion === null ? null : getLowestDependencyMajor(mobxVersion),
|
|
34955
34718
|
hasMobxReact: workspaceFacts.hasMobxReact,
|
|
34956
|
-
mobxReactVersion: workspaceFacts.mobxReactVersion,
|
|
34957
34719
|
hasMobxReactLite: workspaceFacts.hasMobxReactLite,
|
|
34958
|
-
mobxReactLiteVersion: workspaceFacts.mobxReactLiteVersion,
|
|
34959
34720
|
hasMobxStateTree: workspaceFacts.hasMobxStateTree,
|
|
34960
34721
|
hasMobxReactObserver: workspaceFacts.hasMobxReactObserver,
|
|
34961
34722
|
zustandVersion,
|
|
@@ -34964,21 +34725,12 @@ const discoverProject = (directory) => {
|
|
|
34964
34725
|
hasTypeScript,
|
|
34965
34726
|
hasReactCompiler: detectReactCompiler(directory, packageJson),
|
|
34966
34727
|
hasReactCompilerLintPlugin: detectReactCompilerLintPlugin(directory, packageJson),
|
|
34967
|
-
hasTanStackQuery:
|
|
34968
|
-
hasI18nLibrary: workspaceFacts.hasI18nLibrary,
|
|
34969
|
-
tanstackQueryVersion,
|
|
34970
|
-
styledComponentsVersion: workspaceFacts.styledComponentsVersion,
|
|
34728
|
+
hasTanStackQuery: hasTanStackQuery(packageJson),
|
|
34971
34729
|
valtioVersion,
|
|
34972
34730
|
valtioMajorVersion: valtioVersion === null ? null : getLowestDependencyMajor(valtioVersion),
|
|
34973
34731
|
hasRemotion: workspaceFacts.hasRemotionDependency,
|
|
34974
34732
|
remotionVersion,
|
|
34975
34733
|
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),
|
|
34982
34734
|
hasSsrDependency: workspaceFacts.hasSsrDependency,
|
|
34983
34735
|
preactVersion,
|
|
34984
34736
|
preactMajorVersion: parseReactMajor(preactVersion),
|
|
@@ -38179,10 +37931,10 @@ const SSR_FRAMEWORKS = new Set([
|
|
|
38179
37931
|
"gatsby",
|
|
38180
37932
|
"tanstack-start"
|
|
38181
37933
|
]);
|
|
38182
|
-
const
|
|
38183
|
-
if (
|
|
38184
|
-
const
|
|
38185
|
-
for (let candidate = earliest; candidate <=
|
|
37934
|
+
const addMajorLadder = (capabilities, name, major, earliest, latest) => {
|
|
37935
|
+
if (major === null) return;
|
|
37936
|
+
const cappedMajor = Math.min(major, latest);
|
|
37937
|
+
for (let candidate = earliest; candidate <= cappedMajor; candidate += 1) capabilities.add(`${name}:${candidate}`);
|
|
38186
37938
|
};
|
|
38187
37939
|
const buildCapabilities = (project) => {
|
|
38188
37940
|
const capabilities = /* @__PURE__ */ new Set();
|
|
@@ -38195,77 +37947,39 @@ const buildCapabilities = (project) => {
|
|
|
38195
37947
|
if (CLIENT_ONLY_FRAMEWORKS.has(project.framework)) capabilities.add("client-only");
|
|
38196
37948
|
if (project.isStaticExport) capabilities.add("nextjs:static-export");
|
|
38197
37949
|
if (project.nextjsMajorVersion !== null && project.nextjsMajorVersion >= 15) capabilities.add("nextjs:15");
|
|
38198
|
-
|
|
38199
|
-
addVersionCapabilityLadder(capabilities, "react", project.reactMajorVersion, 17, 30);
|
|
37950
|
+
addMajorLadder(capabilities, "react", project.reactMajorVersion, 17, 30);
|
|
38200
37951
|
if (project.reactMajorVersion !== null && project.reactMajorVersion >= 19 && isMajorMinorAtLeast(parseReactMajorMinor(project.reactVersion), {
|
|
38201
37952
|
major: 19,
|
|
38202
37953
|
minor: 2
|
|
38203
37954
|
})) capabilities.add("react:19.2");
|
|
38204
|
-
if (project.tailwindVersion !== null)
|
|
38205
|
-
|
|
38206
|
-
|
|
38207
|
-
|
|
38208
|
-
|
|
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
|
-
}
|
|
37955
|
+
if (project.tailwindVersion !== null) capabilities.add("tailwind");
|
|
37956
|
+
if (project.tailwindVersion !== null && isMajorMinorAtLeast(parseTailwindMajorMinor(project.tailwindVersion), {
|
|
37957
|
+
major: 3,
|
|
37958
|
+
minor: 4
|
|
37959
|
+
})) capabilities.add("tailwind:3.4");
|
|
38216
37960
|
if (project.zodVersion !== null) capabilities.add("zod");
|
|
38217
37961
|
if (project.zodMajorVersion !== null && project.zodMajorVersion >= 4) capabilities.add("zod:4");
|
|
38218
37962
|
if (project.mobxVersion !== void 0 && project.mobxVersion !== null || project.hasMobxReact === true || project.hasMobxReactLite === true || project.hasMobxStateTree === true || project.hasMobxReactObserver === true) capabilities.add("mobx");
|
|
38219
37963
|
if (project.hasMobxReact === true) capabilities.add("mobx-react");
|
|
38220
37964
|
if (project.hasMobxReactLite === true) capabilities.add("mobx-react-lite");
|
|
38221
37965
|
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
37966
|
if (project.hasMobxStateTree === true) capabilities.add("mobx-state-tree");
|
|
38236
37967
|
if (project.hasMobxReactObserver === true) capabilities.add("mobx-react-observer");
|
|
38237
|
-
if (project.mobxMajorVersion !== void 0 && project.mobxMajorVersion !== null && project.mobxMajorVersion >= 4 && project.mobxMajorVersion <= 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");
|
|
37968
|
+
if (project.mobxMajorVersion !== void 0 && project.mobxMajorVersion !== null && project.mobxMajorVersion >= 4 && project.mobxMajorVersion <= 6) addMajorLadder(capabilities, "mobx", project.mobxMajorVersion, 4, 6);
|
|
38243
37969
|
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)
|
|
37970
|
+
if (project.zustandMajorVersion !== void 0 && project.zustandMajorVersion !== null && project.zustandMajorVersion >= 1 && project.zustandMajorVersion <= 5) addMajorLadder(capabilities, "zustand", project.zustandMajorVersion, 1, 5);
|
|
38245
37971
|
if (project.isPreES2023Target) capabilities.add("pre-es2023");
|
|
38246
37972
|
if (project.hasReactCompiler) capabilities.add("react-compiler");
|
|
38247
|
-
if (
|
|
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");
|
|
37973
|
+
if (project.hasTanStackQuery) capabilities.add("tanstack-query");
|
|
38254
37974
|
if (project.valtioVersion !== null) capabilities.add("valtio");
|
|
38255
|
-
|
|
37975
|
+
addMajorLadder(capabilities, "valtio", project.valtioMajorVersion, 1, 10);
|
|
38256
37976
|
if (project.hasRemotion) {
|
|
38257
37977
|
capabilities.add("remotion");
|
|
38258
|
-
|
|
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);
|
|
37978
|
+
addMajorLadder(capabilities, "remotion", project.remotionMajorVersion ?? null, 4, 30);
|
|
38265
37979
|
}
|
|
38266
37980
|
if (project.hasTypeScript) capabilities.add("typescript");
|
|
38267
37981
|
if (project.preactVersion !== null) capabilities.add("preact");
|
|
38268
|
-
|
|
37982
|
+
addMajorLadder(capabilities, "preact", project.preactMajorVersion, 10, 20);
|
|
38269
37983
|
if (project.preactVersion !== null && project.reactVersion === null) capabilities.add("pure-preact");
|
|
38270
37984
|
return capabilities;
|
|
38271
37985
|
};
|
|
@@ -38277,7 +37991,7 @@ const getCapabilities = (project) => {
|
|
|
38277
37991
|
capabilitiesByProject.set(project, capabilities);
|
|
38278
37992
|
return capabilities;
|
|
38279
37993
|
};
|
|
38280
|
-
const shouldEnableRule = (requires, tags, capabilities, ignoredTags, disabledWhen
|
|
37994
|
+
const shouldEnableRule = (requires, tags, capabilities, ignoredTags, disabledWhen) => {
|
|
38281
37995
|
if (requires) {
|
|
38282
37996
|
for (const capability of requires) if (!capabilities.has(capability)) return false;
|
|
38283
37997
|
}
|
|
@@ -38288,29 +38002,20 @@ const shouldEnableRule = (requires, tags, capabilities, ignoredTags, disabledWhe
|
|
|
38288
38002
|
if (tags) {
|
|
38289
38003
|
for (const tag of tags) if (ignoredTags.has(tag)) return false;
|
|
38290
38004
|
}
|
|
38291
|
-
if (includedTags && includedTags.size > 0) {
|
|
38292
|
-
if (!tags?.some((tag) => includedTags.has(tag))) return false;
|
|
38293
|
-
}
|
|
38294
38005
|
return true;
|
|
38295
38006
|
};
|
|
38296
|
-
const shouldEnableRuleByDefaultStatus = (options) => options.defaultEnabled !== false || options.hasExplicitOverride === true || options.includeTagDefaults && options.hasIncludedTags;
|
|
38297
38007
|
const yieldToEventLoop = () => new Promise((resolve) => {
|
|
38298
38008
|
setImmediate(resolve);
|
|
38299
38009
|
});
|
|
38300
38010
|
const createSecurityScanSession = (rootDirectory, options) => {
|
|
38301
38011
|
const capabilities = options.project ? getCapabilities(options.project) : /* @__PURE__ */ new Set();
|
|
38302
38012
|
const ignoredTags = options.ignoredTags ?? /* @__PURE__ */ new Set();
|
|
38303
|
-
const includedTags = options.includedTags ?? /* @__PURE__ */ new Set();
|
|
38304
38013
|
const enabledScanRules = REACT_DOCTOR_RULES.flatMap((entry) => {
|
|
38305
38014
|
const rule = entry.rule;
|
|
38306
38015
|
const scan = rule.scan;
|
|
38307
38016
|
if (typeof scan !== "function") return [];
|
|
38308
|
-
if (
|
|
38309
|
-
|
|
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 [];
|
|
38017
|
+
if (rule.defaultEnabled === false) return [];
|
|
38018
|
+
if (!shouldEnableRule(rule.requires, rule.tags, capabilities, ignoredTags, rule.disabledWhen)) return [];
|
|
38314
38019
|
return [{
|
|
38315
38020
|
entry,
|
|
38316
38021
|
scan,
|
|
@@ -40296,9 +40001,8 @@ const buildUserPluginRules = (userPlugin, severityControls) => {
|
|
|
40296
40001
|
}
|
|
40297
40002
|
return enabled;
|
|
40298
40003
|
};
|
|
40299
|
-
const createOxlintConfig = ({ pluginPath, project, customRulesOnly = false, extendsPaths = [], ignoredTags = /* @__PURE__ */ new Set(),
|
|
40300
|
-
const
|
|
40301
|
-
const reactHooksJsPlugin = disableReactHooksJsPlugin || ruleSelection === "sidecar" || hasIncludedTags ? null : resolveReactHooksJsPlugin(project.hasReactCompiler || project.hasReactCompilerLintPlugin === true, customRulesOnly);
|
|
40004
|
+
const createOxlintConfig = ({ pluginPath, project, customRulesOnly = false, extendsPaths = [], ignoredTags = /* @__PURE__ */ new Set(), serverAuthFunctionNames, severityControls, userPlugins = [], disableReactHooksJsPlugin = false, ruleSelection, sidecarRuleIdFilter }) => {
|
|
40005
|
+
const reactHooksJsPlugin = disableReactHooksJsPlugin || ruleSelection === "sidecar" ? null : resolveReactHooksJsPlugin(project.hasReactCompiler || project.hasReactCompilerLintPlugin === true, customRulesOnly);
|
|
40302
40006
|
const reactCompilerRules = reactHooksJsPlugin ? applyRuleSeverityControls(filterRulesToAvailable(REACT_COMPILER_RULES, "react-hooks-js", reactHooksJsPlugin.availableRuleNames), severityControls) : {};
|
|
40303
40007
|
const jsPlugins = [];
|
|
40304
40008
|
if (reactHooksJsPlugin) jsPlugins.push(reactHooksJsPlugin.entry);
|
|
@@ -40313,14 +40017,9 @@ const createOxlintConfig = ({ pluginPath, project, customRulesOnly = false, exte
|
|
|
40313
40017
|
if (rule.scan !== void 0) continue;
|
|
40314
40018
|
if (customRulesOnly && registryEntry.originallyExternal) continue;
|
|
40315
40019
|
if (rule.framework !== "global" && !rule.requires) continue;
|
|
40316
|
-
if (!shouldEnableRule(rule.requires, rule.tags, capabilities, ignoredTags, rule.disabledWhen
|
|
40020
|
+
if (!shouldEnableRule(rule.requires, rule.tags, capabilities, ignoredTags, rule.disabledWhen)) continue;
|
|
40317
40021
|
const explicitRuleOverride = resolveRuleSeverityOverride({ ruleKey: registryEntry.key }, severityControls);
|
|
40318
|
-
if (
|
|
40319
|
-
defaultEnabled: rule.defaultEnabled,
|
|
40320
|
-
includeTagDefaults,
|
|
40321
|
-
hasIncludedTags,
|
|
40322
|
-
hasExplicitOverride: explicitRuleOverride !== void 0
|
|
40323
|
-
})) continue;
|
|
40022
|
+
if (rule.defaultEnabled === false && explicitRuleOverride === void 0) continue;
|
|
40324
40023
|
const severity = resolveRuleSeverityOverride({
|
|
40325
40024
|
ruleKey: registryEntry.key,
|
|
40326
40025
|
category: rule.category
|
|
@@ -40329,7 +40028,7 @@ const createOxlintConfig = ({ pluginPath, project, customRulesOnly = false, exte
|
|
|
40329
40028
|
enabledReactDoctorRules[registryEntry.key] = severity;
|
|
40330
40029
|
}
|
|
40331
40030
|
const userPluginRules = {};
|
|
40332
|
-
if (ruleSelection !== "sidecar"
|
|
40031
|
+
if (ruleSelection !== "sidecar") for (const userPlugin of userPlugins) {
|
|
40333
40032
|
Object.assign(userPluginRules, buildUserPluginRules(userPlugin, severityControls));
|
|
40334
40033
|
jsPlugins.push(userPlugin.entry);
|
|
40335
40034
|
}
|
|
@@ -40546,19 +40245,6 @@ const createSidecarLintCache = (cacheDirectory, rulesetHash) => {
|
|
|
40546
40245
|
}
|
|
40547
40246
|
};
|
|
40548
40247
|
};
|
|
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
|
-
};
|
|
40562
40248
|
const bundledRequire = createRequire(import.meta.url);
|
|
40563
40249
|
const childNodeVersionByBinaryPath = /* @__PURE__ */ new Map();
|
|
40564
40250
|
const resolveChildNodeVersion = (nodeBinaryPath) => {
|
|
@@ -40582,13 +40268,6 @@ const TOOLCHAIN_PACKAGE_SPECIFIERS = [
|
|
|
40582
40268
|
"oxlint-plugin-react-doctor/package.json",
|
|
40583
40269
|
"eslint-plugin-react-hooks/package.json"
|
|
40584
40270
|
];
|
|
40585
|
-
const resolvePluginFingerprint = () => {
|
|
40586
|
-
try {
|
|
40587
|
-
return fingerprintFileContents(bundledRequire.resolve("oxlint-plugin-react-doctor"), 16);
|
|
40588
|
-
} catch {
|
|
40589
|
-
return "unresolved";
|
|
40590
|
-
}
|
|
40591
|
-
};
|
|
40592
40271
|
const resolveOxlintToolchainVersions = (nodeBinaryPath = process.execPath) => {
|
|
40593
40272
|
const versions = [`node=${resolveChildNodeVersion(nodeBinaryPath)}`];
|
|
40594
40273
|
for (const specifier of TOOLCHAIN_PACKAGE_SPECIFIERS) try {
|
|
@@ -40598,7 +40277,6 @@ const resolveOxlintToolchainVersions = (nodeBinaryPath = process.execPath) => {
|
|
|
40598
40277
|
} catch {
|
|
40599
40278
|
versions.push(`${specifier}=missing`);
|
|
40600
40279
|
}
|
|
40601
|
-
versions.push(`oxlint-plugin-react-doctor#fingerprint=${resolvePluginFingerprint()}`);
|
|
40602
40280
|
return versions;
|
|
40603
40281
|
};
|
|
40604
40282
|
const esmRequire = createRequire(import.meta.url);
|
|
@@ -42074,7 +41752,7 @@ const reactHooksJsPluginDropNote = (error) => {
|
|
|
42074
41752
|
* 6. always restore disable directives + clean up the temp dir
|
|
42075
41753
|
*/
|
|
42076
41754
|
const runOxlint = async (options) => {
|
|
42077
|
-
const { rootDirectory, project, includePaths, nodeBinaryPath = process.execPath, customRulesOnly = false, respectInlineDisables = true, adoptExistingLintConfig = true, ignoredTags = /* @__PURE__ */ new Set(),
|
|
41755
|
+
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;
|
|
42078
41756
|
const serverAuthFunctionNames = Array.isArray(userConfig?.serverAuthFunctionNames) ? userConfig.serverAuthFunctionNames.filter((entry) => typeof entry === "string" && entry.length > 0) : void 0;
|
|
42079
41757
|
const severityControls = buildRuleSeverityControls(userConfig);
|
|
42080
41758
|
validateRuleRegistration();
|
|
@@ -42088,15 +41766,13 @@ const runOxlint = async (options) => {
|
|
|
42088
41766
|
}
|
|
42089
41767
|
const pluginPath = resolvePluginPath();
|
|
42090
41768
|
const extendsPaths = (adoptExistingLintConfig && !customRulesOnly ? detectUserLintConfigPaths(rootDirectory) : []).filter(canOxlintExtendConfig);
|
|
42091
|
-
const userPlugins =
|
|
41769
|
+
const userPlugins = resolveUserPlugins(userConfig?.plugins, configSourceDirectory);
|
|
42092
41770
|
const buildConfig = (overrides) => createOxlintConfig({
|
|
42093
41771
|
pluginPath,
|
|
42094
41772
|
project,
|
|
42095
41773
|
customRulesOnly,
|
|
42096
41774
|
extendsPaths: overrides.extendsPaths,
|
|
42097
41775
|
ignoredTags,
|
|
42098
|
-
includedTags,
|
|
42099
|
-
includeTagDefaults,
|
|
42100
41776
|
serverAuthFunctionNames,
|
|
42101
41777
|
severityControls,
|
|
42102
41778
|
userPlugins,
|
|
@@ -42485,8 +42161,6 @@ var Linter = class Linter extends Service()("react-doctor/Linter") {
|
|
|
42485
42161
|
respectInlineDisables: input.respectInlineDisables,
|
|
42486
42162
|
adoptExistingLintConfig: input.adoptExistingLintConfig,
|
|
42487
42163
|
ignoredTags: input.ignoredTags,
|
|
42488
|
-
includedTags: input.includedTags,
|
|
42489
|
-
includeTagDefaults: input.includeTagDefaults,
|
|
42490
42164
|
userConfig: input.userConfig ?? null,
|
|
42491
42165
|
configSourceDirectory: input.configSourceDirectory,
|
|
42492
42166
|
onPartialFailure: (reason) => {
|
|
@@ -43335,9 +43009,7 @@ const runInspect = (input, hooks = {}) => gen(function* () {
|
|
|
43335
43009
|
const securityScanFailedRef = yield* make$13(false);
|
|
43336
43010
|
const securityScanFiber = yield* forkChild(runCollect(applyPerElementPipeline(isDiffMode ? empty$4 : unwrap(tryPromise(() => checkSecurityScanCooperative(scanDirectory, {
|
|
43337
43011
|
project,
|
|
43338
|
-
ignoredTags: input.ignoredTags
|
|
43339
|
-
includedTags: input.includedTags,
|
|
43340
|
-
includeTagDefaults: input.includeTagDefaults
|
|
43012
|
+
ignoredTags: input.ignoredTags
|
|
43341
43013
|
})).pipe(map$3((diagnostics) => fromIterable$1(diagnostics)), catch_$1(() => set(securityScanFailedRef, true).pipe(as(empty$4))))))).pipe(withSpan("SecurityScan.run")));
|
|
43342
43014
|
const shouldRunSupplyChain = !isDiffMode || (input.supplyChainManifestChanged ?? false);
|
|
43343
43015
|
const supplyChainOverlapTimeout = yield* SupplyChainOverlapTimeoutMs;
|
|
@@ -43428,8 +43100,6 @@ const runInspect = (input, hooks = {}) => gen(function* () {
|
|
|
43428
43100
|
respectInlineDisables: input.respectInlineDisables,
|
|
43429
43101
|
adoptExistingLintConfig: input.adoptExistingLintConfig,
|
|
43430
43102
|
ignoredTags: input.ignoredTags,
|
|
43431
|
-
includedTags: input.includedTags,
|
|
43432
|
-
includeTagDefaults: input.includeTagDefaults,
|
|
43433
43103
|
userConfig: resolvedConfig.config ?? void 0,
|
|
43434
43104
|
configSourceDirectory: resolvedConfig.configSourceDirectory ?? void 0,
|
|
43435
43105
|
onFileProgress: (scannedFileCount, totalFileCount) => {
|
|
@@ -45932,5 +45602,5 @@ const startLanguageServer = () => {
|
|
|
45932
45602
|
};
|
|
45933
45603
|
//#endregion
|
|
45934
45604
|
export { startLanguageServer };
|
|
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]="
|
|
45936
|
-
//# debugId=
|
|
45605
|
+
!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="f2369b82-a22a-50e5-b71b-2ceb30eaee9f")}catch(e){}}();
|
|
45606
|
+
//# debugId=f2369b82-a22a-50e5-b71b-2ceb30eaee9f
|