react-doctor 0.8.1-dev.284b4e4 → 0.8.1-dev.3018538
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 +165 -587
- package/dist/index.d.ts +1 -38
- package/dist/index.js +122 -499
- package/dist/lsp.js +122 -499
- 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;
|
|
@@ -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,11 @@ const getPreactVersion = (packageJson) => {
|
|
|
34010
33957
|
...packageJson.devDependencies
|
|
34011
33958
|
}.preact ?? null;
|
|
34012
33959
|
};
|
|
34013
|
-
const resolveCatalogBackedDependencyVersion = ({ rootDirectory, rootPackageJson, packageName,
|
|
33960
|
+
const resolveCatalogBackedDependencyVersion = ({ rootDirectory, rootPackageJson, packageName, version }) => {
|
|
34014
33961
|
if (version === null || !isCatalogReference(version)) return version;
|
|
34015
33962
|
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
|
-
}
|
|
33963
|
+
const resolvedLocalVersion = resolveCatalogVersion(rootPackageJson, packageName, rootDirectory, catalogName);
|
|
33964
|
+
if (resolvedLocalVersion) return resolvedLocalVersion;
|
|
34022
33965
|
const monorepoRoot = findMonorepoRoot(rootDirectory);
|
|
34023
33966
|
if (!monorepoRoot) return version;
|
|
34024
33967
|
const monorepoPackageJsonPath = Path.join(monorepoRoot, "package.json");
|
|
@@ -34216,19 +34159,15 @@ const listWorkspacePackages = (rootDirectory) => {
|
|
|
34216
34159
|
}
|
|
34217
34160
|
return packages;
|
|
34218
34161
|
};
|
|
34219
|
-
const PREFERRED_DEPENDENCY_SECTIONS = [
|
|
34220
|
-
"dependencies",
|
|
34221
|
-
"peerDependencies",
|
|
34222
|
-
"devDependencies"
|
|
34223
|
-
];
|
|
34224
34162
|
const getPreferredDependencyVersion = ({ packageJson, packageNames }) => {
|
|
34163
|
+
const allDependencies = {
|
|
34164
|
+
...packageJson.devDependencies,
|
|
34165
|
+
...packageJson.peerDependencies,
|
|
34166
|
+
...packageJson.dependencies
|
|
34167
|
+
};
|
|
34225
34168
|
for (const packageName of packageNames) {
|
|
34226
|
-
const
|
|
34227
|
-
|
|
34228
|
-
packageName,
|
|
34229
|
-
sections: PREFERRED_DEPENDENCY_SECTIONS
|
|
34230
|
-
});
|
|
34231
|
-
if (declaration.version !== null) return declaration.version;
|
|
34169
|
+
const version = allDependencies[packageName];
|
|
34170
|
+
if (version !== void 0) return version;
|
|
34232
34171
|
}
|
|
34233
34172
|
return null;
|
|
34234
34173
|
};
|
|
@@ -34239,6 +34178,18 @@ const getTanStackQueryVersion = (packageJson) => {
|
|
|
34239
34178
|
packageNames: TANSTACK_REACT_QUERY_PACKAGES
|
|
34240
34179
|
});
|
|
34241
34180
|
};
|
|
34181
|
+
const MOBX_PACKAGES = [
|
|
34182
|
+
"mobx",
|
|
34183
|
+
"mobx-react",
|
|
34184
|
+
"mobx-react-lite",
|
|
34185
|
+
"mobx-state-tree"
|
|
34186
|
+
];
|
|
34187
|
+
const getMobxVersion = (packageJson) => {
|
|
34188
|
+
return getPreferredDependencyVersion({
|
|
34189
|
+
packageJson,
|
|
34190
|
+
packageNames: MOBX_PACKAGES
|
|
34191
|
+
});
|
|
34192
|
+
};
|
|
34242
34193
|
const STYLED_COMPONENTS_PACKAGES = ["styled-components"];
|
|
34243
34194
|
const getStyledComponentsVersion = (packageJson) => {
|
|
34244
34195
|
return getPreferredDependencyVersion({
|
|
@@ -34270,25 +34221,6 @@ const hasI18nDependency = (packageJson) => {
|
|
|
34270
34221
|
return I18N_PACKAGES.some((packageName) => allDependencies[packageName] !== void 0);
|
|
34271
34222
|
};
|
|
34272
34223
|
const REANIMATED_DEPENDENCY_NAME = "react-native-reanimated";
|
|
34273
|
-
const MOBX_REACT_PACKAGE_NAME = "mobx-react";
|
|
34274
|
-
const MOBX_REACT_LITE_PACKAGE_NAME = "mobx-react-lite";
|
|
34275
|
-
const MOBX_STATE_TREE_PACKAGE_NAME = "mobx-state-tree";
|
|
34276
|
-
const MOBX_REACT_OBSERVER_PACKAGE_NAME = "mobx-react-observer";
|
|
34277
|
-
const REACT_THREE_FIBER_DEPENDENCY_NAMES = ["@react-three/fiber", "react-three-fiber"];
|
|
34278
|
-
const REACT_THREE_FIBER_SECTIONS = [
|
|
34279
|
-
"dependencies",
|
|
34280
|
-
"peerDependencies",
|
|
34281
|
-
"optionalDependencies",
|
|
34282
|
-
"devDependencies"
|
|
34283
|
-
];
|
|
34284
|
-
const THREE_DEPENDENCY_SECTIONS = [
|
|
34285
|
-
"dependencies",
|
|
34286
|
-
"peerDependencies",
|
|
34287
|
-
"optionalDependencies",
|
|
34288
|
-
"devDependencies"
|
|
34289
|
-
];
|
|
34290
|
-
const REACT_THREE_FIBER_ECOSYSTEM_DEPENDENCY_NAMES = [...REACT_THREE_FIBER_DEPENDENCY_NAMES, "@react-three/drei"];
|
|
34291
|
-
const THREE_DEPENDENCY_NAMES = [...REACT_THREE_FIBER_ECOSYSTEM_DEPENDENCY_NAMES, "three"];
|
|
34292
34224
|
const SHOPIFY_FLASH_LIST_PACKAGE_NAME = "@shopify/flash-list";
|
|
34293
34225
|
const resolveWorkspaceDependencyVersion = ({ concreteVersion, packageName, rootDirectory, rootPackageJson, sections, workspaceDirectory, workspacePackageJson }) => {
|
|
34294
34226
|
const dependencyDeclaration = getDependencyDeclaration({
|
|
@@ -34299,7 +34231,7 @@ const resolveWorkspaceDependencyVersion = ({ concreteVersion, packageName, rootD
|
|
|
34299
34231
|
if (!dependencyDeclaration.hasDeclaration) return null;
|
|
34300
34232
|
return concreteVersion ?? resolveCatalogVersion(workspacePackageJson, packageName, workspaceDirectory, dependencyDeclaration.catalogReference) ?? resolveCatalogVersion(rootPackageJson, packageName, rootDirectory, dependencyDeclaration.catalogReference);
|
|
34301
34233
|
};
|
|
34302
|
-
const
|
|
34234
|
+
const shouldReplaceReactVersion = (currentVersion, nextVersion) => {
|
|
34303
34235
|
if (!currentVersion) return true;
|
|
34304
34236
|
const currentMajor = parseReactMajor(currentVersion);
|
|
34305
34237
|
const nextMajor = parseReactMajor(nextVersion);
|
|
@@ -34307,62 +34239,15 @@ const shouldReplaceWithLowerMajor = (currentVersion, nextVersion) => {
|
|
|
34307
34239
|
if (nextMajor === null) return false;
|
|
34308
34240
|
return nextMajor < currentMajor;
|
|
34309
34241
|
};
|
|
34310
|
-
const shouldReplaceSupportedDependencyFact = (currentFact, nextFact, latestSupportedMajor) => {
|
|
34311
|
-
if (currentFact.version === null) return true;
|
|
34312
|
-
if (nextFact.version === null) return false;
|
|
34313
|
-
const currentMajor = getLowestDependencyMajor(currentFact.version);
|
|
34314
|
-
const nextMajor = getLowestDependencyMajor(nextFact.version);
|
|
34315
|
-
if (currentMajor === null) return false;
|
|
34316
|
-
if (nextMajor === null) return true;
|
|
34317
|
-
if (currentMajor > latestSupportedMajor) return false;
|
|
34318
|
-
if (nextMajor > latestSupportedMajor) return true;
|
|
34319
|
-
return nextMajor < currentMajor;
|
|
34320
|
-
};
|
|
34321
34242
|
const shouldReplaceStyledComponentsVersion = (currentVersion, nextVersion) => {
|
|
34322
34243
|
if (!currentVersion) return true;
|
|
34323
34244
|
const currentMajor = getLowestDependencyMajor(currentVersion);
|
|
34324
34245
|
const nextMajor = getLowestDependencyMajor(nextVersion);
|
|
34325
|
-
if (currentMajor === null) return nextMajor !== null && nextMajor < 6;
|
|
34326
|
-
if (nextMajor === null) return currentMajor >= 6;
|
|
34327
|
-
return nextMajor < currentMajor;
|
|
34328
|
-
};
|
|
34329
|
-
const selectOldestDependencyVersion = (currentVersion, nextVersion) => {
|
|
34330
|
-
if (currentVersion === null || nextVersion === null) return null;
|
|
34331
|
-
const current = parseDependencyMajorMinor(currentVersion);
|
|
34332
|
-
const next = parseDependencyMajorMinor(nextVersion);
|
|
34333
|
-
if (current === null) return currentVersion;
|
|
34334
|
-
if (next === null) return nextVersion;
|
|
34335
|
-
if (next.major !== current.major) return next.major < current.major ? nextVersion : currentVersion;
|
|
34336
|
-
return next.minor < current.minor ? nextVersion : currentVersion;
|
|
34337
|
-
};
|
|
34338
|
-
const shouldReplaceMobxFact = (currentFact, nextFact) => {
|
|
34339
|
-
if (currentFact.sourceDirectory === null) return true;
|
|
34340
|
-
if (currentFact.version === null) return false;
|
|
34341
|
-
if (nextFact.version === null) return true;
|
|
34342
|
-
const currentMajor = getDependencyMajorWithinSupportedRange(currentFact.version, 6);
|
|
34343
|
-
const nextMajor = getDependencyMajorWithinSupportedRange(nextFact.version, 6);
|
|
34344
34246
|
if (currentMajor === null) return false;
|
|
34345
34247
|
if (nextMajor === null) return true;
|
|
34346
|
-
return
|
|
34347
|
-
};
|
|
34348
|
-
const collectBindingVersion = (facts, packageJson, directory, packageName) => {
|
|
34349
|
-
const version = getDependencySpec(packageJson, packageName);
|
|
34350
|
-
if (version === null) return;
|
|
34351
|
-
const resolvedVersion = resolveCatalogBackedDependencyVersion({
|
|
34352
|
-
rootDirectory: directory,
|
|
34353
|
-
rootPackageJson: packageJson,
|
|
34354
|
-
packageName,
|
|
34355
|
-
version
|
|
34356
|
-
});
|
|
34357
|
-
if (packageName === MOBX_REACT_PACKAGE_NAME) {
|
|
34358
|
-
facts.mobxReactVersion = facts.hasMobxReact ? selectOldestDependencyVersion(facts.mobxReactVersion, resolvedVersion) : resolvedVersion;
|
|
34359
|
-
facts.hasMobxReact = true;
|
|
34360
|
-
return;
|
|
34361
|
-
}
|
|
34362
|
-
facts.mobxReactLiteVersion = facts.hasMobxReactLite ? selectOldestDependencyVersion(facts.mobxReactLiteVersion, resolvedVersion) : resolvedVersion;
|
|
34363
|
-
facts.hasMobxReactLite = true;
|
|
34248
|
+
return nextMajor < currentMajor;
|
|
34364
34249
|
};
|
|
34365
|
-
const evaluateManifestFacts = (facts, packageJson, directory
|
|
34250
|
+
const evaluateManifestFacts = (facts, packageJson, directory) => {
|
|
34366
34251
|
if (facts.expo.version === null) {
|
|
34367
34252
|
const spec = getDependencySpec(packageJson, "expo");
|
|
34368
34253
|
if (spec !== null) facts.expo = {
|
|
@@ -34384,113 +34269,18 @@ const evaluateManifestFacts = (facts, packageJson, directory, rootDirectory, roo
|
|
|
34384
34269
|
sourceDirectory: directory
|
|
34385
34270
|
};
|
|
34386
34271
|
}
|
|
34387
|
-
const mobxSpec = getDependencySpec(packageJson, "mobx");
|
|
34388
|
-
if (mobxSpec !== null) {
|
|
34389
|
-
const nextMobxFact = {
|
|
34390
|
-
version: resolveCatalogBackedDependencyVersion({
|
|
34391
|
-
rootDirectory: directory,
|
|
34392
|
-
rootPackageJson: packageJson,
|
|
34393
|
-
packageName: "mobx",
|
|
34394
|
-
version: mobxSpec
|
|
34395
|
-
}),
|
|
34396
|
-
sourceDirectory: directory
|
|
34397
|
-
};
|
|
34398
|
-
if (shouldReplaceMobxFact(facts.mobx, nextMobxFact)) facts.mobx = nextMobxFact;
|
|
34399
|
-
}
|
|
34400
|
-
collectBindingVersion(facts, packageJson, directory, MOBX_REACT_PACKAGE_NAME);
|
|
34401
|
-
collectBindingVersion(facts, packageJson, directory, MOBX_REACT_LITE_PACKAGE_NAME);
|
|
34402
|
-
facts.hasMobxStateTree = facts.hasMobxStateTree || getDependencySpec(packageJson, MOBX_STATE_TREE_PACKAGE_NAME) !== null;
|
|
34403
|
-
facts.hasMobxReactObserver = facts.hasMobxReactObserver || getDependencySpec(packageJson, MOBX_REACT_OBSERVER_PACKAGE_NAME) !== null;
|
|
34404
|
-
const zustandSpec = getDependencySpec(packageJson, "zustand");
|
|
34405
|
-
if (zustandSpec !== null) {
|
|
34406
|
-
const nextZustandFact = {
|
|
34407
|
-
version: resolveCatalogBackedDependencyVersion({
|
|
34408
|
-
rootDirectory: directory,
|
|
34409
|
-
rootPackageJson: packageJson,
|
|
34410
|
-
packageName: "zustand",
|
|
34411
|
-
version: zustandSpec
|
|
34412
|
-
}),
|
|
34413
|
-
sourceDirectory: directory
|
|
34414
|
-
};
|
|
34415
|
-
if (shouldReplaceSupportedDependencyFact(facts.zustand, nextZustandFact, 5)) facts.zustand = nextZustandFact;
|
|
34416
|
-
}
|
|
34417
34272
|
if (facts.reanimatedVersion === null) {
|
|
34418
34273
|
const spec = getDependencySpec(packageJson, REANIMATED_DEPENDENCY_NAME);
|
|
34419
34274
|
if (spec !== null) facts.reanimatedVersion = spec;
|
|
34420
34275
|
}
|
|
34421
|
-
if (facts.valtioVersion === null) {
|
|
34422
|
-
const spec = getDependencySpec(packageJson, "valtio");
|
|
34423
|
-
if (spec !== null) facts.valtioVersion = spec;
|
|
34424
|
-
}
|
|
34425
34276
|
facts.tanstackQueryVersion ??= getTanStackQueryVersion(packageJson);
|
|
34426
|
-
|
|
34427
|
-
|
|
34428
|
-
rootPackageJson: packageJson,
|
|
34429
|
-
packageName: "styled-components",
|
|
34430
|
-
version: getStyledComponentsVersion(packageJson)
|
|
34431
|
-
});
|
|
34277
|
+
facts.mobxVersion ??= getMobxVersion(packageJson);
|
|
34278
|
+
const styledComponentsVersion = getStyledComponentsVersion(packageJson);
|
|
34432
34279
|
if (styledComponentsVersion && shouldReplaceStyledComponentsVersion(facts.styledComponentsVersion, styledComponentsVersion)) facts.styledComponentsVersion = styledComponentsVersion;
|
|
34433
34280
|
facts.hasI18nLibrary = facts.hasI18nLibrary || hasI18nDependency(packageJson);
|
|
34434
|
-
for (const packageName of REACT_THREE_FIBER_DEPENDENCY_NAMES) {
|
|
34435
|
-
const version = resolveCatalogBackedDependencyVersion({
|
|
34436
|
-
rootDirectory,
|
|
34437
|
-
rootPackageJson,
|
|
34438
|
-
sourceDirectory: directory,
|
|
34439
|
-
sourcePackageJson: packageJson,
|
|
34440
|
-
packageName,
|
|
34441
|
-
version: getDependencyDeclaration({
|
|
34442
|
-
packageName,
|
|
34443
|
-
packageJson,
|
|
34444
|
-
sections: REACT_THREE_FIBER_SECTIONS
|
|
34445
|
-
}).version
|
|
34446
|
-
});
|
|
34447
|
-
if (version === null) continue;
|
|
34448
|
-
if (shouldReplaceWithLowerMajor(facts.reactThreeFiber.version, version)) facts.reactThreeFiber = {
|
|
34449
|
-
packageName,
|
|
34450
|
-
version,
|
|
34451
|
-
sourceDirectory: directory
|
|
34452
|
-
};
|
|
34453
|
-
}
|
|
34454
|
-
const threeVersion = resolveCatalogBackedDependencyVersion({
|
|
34455
|
-
rootDirectory,
|
|
34456
|
-
rootPackageJson,
|
|
34457
|
-
sourceDirectory: directory,
|
|
34458
|
-
sourcePackageJson: packageJson,
|
|
34459
|
-
packageName: "three",
|
|
34460
|
-
version: getDependencyDeclaration({
|
|
34461
|
-
packageName: "three",
|
|
34462
|
-
packageJson,
|
|
34463
|
-
sections: THREE_DEPENDENCY_SECTIONS
|
|
34464
|
-
}).version
|
|
34465
|
-
});
|
|
34466
|
-
if (threeVersion !== null) {
|
|
34467
|
-
const currentRelease = parseThreeRelease(facts.threeVersion);
|
|
34468
|
-
const nextRelease = parseThreeRelease(threeVersion);
|
|
34469
|
-
if (facts.threeVersion === null || nextRelease !== null && (currentRelease === null || nextRelease < currentRelease)) facts.threeVersion = threeVersion;
|
|
34470
|
-
}
|
|
34471
34281
|
facts.hasReactNativeAwarePackage = facts.hasReactNativeAwarePackage || isPackageJsonReactNativeAware(packageJson);
|
|
34472
34282
|
facts.hasReanimatedAwarePackage = facts.hasReanimatedAwarePackage || isPackageJsonReanimatedAware(packageJson);
|
|
34473
34283
|
facts.hasSsrDependency = facts.hasSsrDependency || isPackageJsonSsrAware(packageJson);
|
|
34474
|
-
const remotionSpec = getDependencySpec(packageJson, "remotion");
|
|
34475
|
-
if (remotionSpec !== null) {
|
|
34476
|
-
facts.hasRemotionDependency = true;
|
|
34477
|
-
const resolvedRemotionVersion = resolveCatalogBackedDependencyVersion({
|
|
34478
|
-
rootDirectory,
|
|
34479
|
-
rootPackageJson,
|
|
34480
|
-
packageName: "remotion",
|
|
34481
|
-
version: remotionSpec
|
|
34482
|
-
});
|
|
34483
|
-
const remotionMajorVersion = resolvedRemotionVersion === null ? null : getLowestDependencyMajor(resolvedRemotionVersion);
|
|
34484
|
-
if (remotionMajorVersion === null) {
|
|
34485
|
-
facts.hasUnknownRemotionVersion = true;
|
|
34486
|
-
facts.remotionVersion = null;
|
|
34487
|
-
} else if (!facts.hasUnknownRemotionVersion) {
|
|
34488
|
-
const currentRemotionMajorVersion = facts.remotionVersion === null ? null : getLowestDependencyMajor(facts.remotionVersion);
|
|
34489
|
-
if (currentRemotionMajorVersion === null || remotionMajorVersion < currentRemotionMajorVersion) facts.remotionVersion = resolvedRemotionVersion;
|
|
34490
|
-
}
|
|
34491
|
-
}
|
|
34492
|
-
facts.hasThree = facts.hasThree || THREE_DEPENDENCY_NAMES.some((dependencyName) => getDependencySpec(packageJson, dependencyName) !== null);
|
|
34493
|
-
facts.hasReactThreeFiber = facts.hasReactThreeFiber || REACT_THREE_FIBER_ECOSYSTEM_DEPENDENCY_NAMES.some((dependencyName) => getDependencySpec(packageJson, dependencyName) !== null);
|
|
34494
34284
|
};
|
|
34495
34285
|
const collectWorkspaceFacts = (rootDirectory, rootPackageJson, { collectReactGroup }) => {
|
|
34496
34286
|
const facts = {
|
|
@@ -34510,41 +34300,16 @@ const collectWorkspaceFacts = (rootDirectory, rootPackageJson, { collectReactGro
|
|
|
34510
34300
|
version: null,
|
|
34511
34301
|
sourceDirectory: null
|
|
34512
34302
|
},
|
|
34513
|
-
valtioVersion: null,
|
|
34514
|
-
mobx: {
|
|
34515
|
-
version: null,
|
|
34516
|
-
sourceDirectory: null
|
|
34517
|
-
},
|
|
34518
|
-
hasMobxReact: false,
|
|
34519
|
-
mobxReactVersion: null,
|
|
34520
|
-
hasMobxReactLite: false,
|
|
34521
|
-
mobxReactLiteVersion: null,
|
|
34522
|
-
hasMobxStateTree: false,
|
|
34523
|
-
hasMobxReactObserver: false,
|
|
34524
|
-
zustand: {
|
|
34525
|
-
version: null,
|
|
34526
|
-
sourceDirectory: null
|
|
34527
|
-
},
|
|
34528
34303
|
tanstackQueryVersion: null,
|
|
34304
|
+
mobxVersion: null,
|
|
34529
34305
|
styledComponentsVersion: null,
|
|
34530
34306
|
hasI18nLibrary: false,
|
|
34531
34307
|
hasReactNativeAwarePackage: false,
|
|
34532
34308
|
hasReanimatedAwarePackage: false,
|
|
34533
34309
|
hasSsrDependency: false,
|
|
34534
|
-
hasRemotionDependency: false,
|
|
34535
|
-
hasUnknownRemotionVersion: false,
|
|
34536
|
-
remotionVersion: null,
|
|
34537
|
-
hasThree: false,
|
|
34538
|
-
threeVersion: null,
|
|
34539
|
-
hasReactThreeFiber: false,
|
|
34540
|
-
reactThreeFiber: {
|
|
34541
|
-
packageName: null,
|
|
34542
|
-
version: null,
|
|
34543
|
-
sourceDirectory: null
|
|
34544
|
-
},
|
|
34545
34310
|
reanimatedVersion: null
|
|
34546
34311
|
};
|
|
34547
|
-
evaluateManifestFacts(facts, rootPackageJson, rootDirectory
|
|
34312
|
+
evaluateManifestFacts(facts, rootPackageJson, rootDirectory);
|
|
34548
34313
|
let isReactGroupSettled = !collectReactGroup;
|
|
34549
34314
|
const visitedDirectories = /* @__PURE__ */ new Set();
|
|
34550
34315
|
for (const pattern of getWorkspacePatterns(rootDirectory, rootPackageJson)) {
|
|
@@ -34553,7 +34318,7 @@ const collectWorkspaceFacts = (rootDirectory, rootPackageJson, { collectReactGro
|
|
|
34553
34318
|
if (visitedDirectories.has(workspaceDirectory)) continue;
|
|
34554
34319
|
visitedDirectories.add(workspaceDirectory);
|
|
34555
34320
|
const workspacePackageJson = readPackageJson(Path.join(workspaceDirectory, "package.json"));
|
|
34556
|
-
evaluateManifestFacts(facts, workspacePackageJson, workspaceDirectory
|
|
34321
|
+
evaluateManifestFacts(facts, workspacePackageJson, workspaceDirectory);
|
|
34557
34322
|
const info = extractDependencyInfo(workspacePackageJson);
|
|
34558
34323
|
if (info.framework !== "unknown" && frameworkMergeRank(info.framework) < frameworkMergeRank(facts.framework)) facts.framework = info.framework;
|
|
34559
34324
|
if (isReactGroupSettled) continue;
|
|
@@ -34584,7 +34349,7 @@ const collectWorkspaceFacts = (rootDirectory, rootPackageJson, { collectReactGro
|
|
|
34584
34349
|
workspaceDirectory,
|
|
34585
34350
|
workspacePackageJson
|
|
34586
34351
|
});
|
|
34587
|
-
if (reactVersion &&
|
|
34352
|
+
if (reactVersion && shouldReplaceReactVersion(facts.reactVersion, reactVersion)) facts.reactVersion = reactVersion;
|
|
34588
34353
|
if (tailwindVersion && !facts.tailwindVersion) facts.tailwindVersion = tailwindVersion;
|
|
34589
34354
|
if (zodVersion && !facts.zodVersion) facts.zodVersion = zodVersion;
|
|
34590
34355
|
const settledReactMajor = parseReactMajor(facts.reactVersion);
|
|
@@ -34777,35 +34542,15 @@ const discoverProjectWithoutPackageJson = (directory) => {
|
|
|
34777
34542
|
tailwindVersion: null,
|
|
34778
34543
|
zodVersion: null,
|
|
34779
34544
|
zodMajorVersion: null,
|
|
34780
|
-
mobxVersion: null,
|
|
34781
|
-
mobxMajorVersion: null,
|
|
34782
|
-
hasMobxReact: false,
|
|
34783
|
-
mobxReactVersion: null,
|
|
34784
|
-
hasMobxReactLite: false,
|
|
34785
|
-
mobxReactLiteVersion: null,
|
|
34786
|
-
hasMobxStateTree: false,
|
|
34787
|
-
hasMobxReactObserver: false,
|
|
34788
|
-
zustandVersion: null,
|
|
34789
|
-
zustandMajorVersion: null,
|
|
34790
34545
|
framework: "unknown",
|
|
34791
34546
|
hasTypeScript: hasOwnTsConfig,
|
|
34792
34547
|
hasReactCompiler: false,
|
|
34793
34548
|
hasReactCompilerLintPlugin: false,
|
|
34794
34549
|
hasTanStackQuery: false,
|
|
34795
|
-
valtioVersion: null,
|
|
34796
|
-
valtioMajorVersion: null,
|
|
34797
|
-
hasRemotion: false,
|
|
34798
|
-
remotionVersion: null,
|
|
34799
|
-
remotionMajorVersion: null,
|
|
34800
34550
|
hasI18nLibrary: false,
|
|
34801
34551
|
tanstackQueryVersion: null,
|
|
34552
|
+
mobxVersion: null,
|
|
34802
34553
|
styledComponentsVersion: null,
|
|
34803
|
-
hasThree: false,
|
|
34804
|
-
threeVersion: null,
|
|
34805
|
-
threeRelease: null,
|
|
34806
|
-
hasReactThreeFiber: false,
|
|
34807
|
-
reactThreeFiberVersion: null,
|
|
34808
|
-
reactThreeFiberMajorVersion: null,
|
|
34809
34554
|
hasSsrDependency: false,
|
|
34810
34555
|
preactVersion: null,
|
|
34811
34556
|
preactMajorVersion: null,
|
|
@@ -34904,12 +34649,6 @@ const discoverProject = (directory) => {
|
|
|
34904
34649
|
packageName: SHOPIFY_FLASH_LIST_PACKAGE_NAME,
|
|
34905
34650
|
version: workspaceFacts.shopifyFlashList.version
|
|
34906
34651
|
}) : null;
|
|
34907
|
-
const zustandVersion = resolveCatalogBackedDependencyVersion({
|
|
34908
|
-
rootDirectory: directory,
|
|
34909
|
-
rootPackageJson: packageJson,
|
|
34910
|
-
packageName: "zustand",
|
|
34911
|
-
version: workspaceFacts.zustand.version
|
|
34912
|
-
});
|
|
34913
34652
|
const hasReanimated = hasReactNativeWorkspace && workspaceFacts.hasReanimatedAwarePackage;
|
|
34914
34653
|
const reanimatedVersion = hasReanimated ? workspaceFacts.reanimatedVersion : null;
|
|
34915
34654
|
const nextjsVersion = framework === "nextjs" ? resolveCatalogBackedDependencyVersion({
|
|
@@ -34918,33 +34657,8 @@ const discoverProject = (directory) => {
|
|
|
34918
34657
|
packageName: "next",
|
|
34919
34658
|
version: workspaceFacts.next.version
|
|
34920
34659
|
}) : null;
|
|
34921
|
-
const valtioVersion = resolveCatalogBackedDependencyVersion({
|
|
34922
|
-
rootDirectory: directory,
|
|
34923
|
-
rootPackageJson: packageJson,
|
|
34924
|
-
packageName: "valtio",
|
|
34925
|
-
version: workspaceFacts.valtioVersion
|
|
34926
|
-
});
|
|
34927
|
-
const mobxVersion = resolveCatalogBackedDependencyVersion({
|
|
34928
|
-
rootDirectory: directory,
|
|
34929
|
-
rootPackageJson: packageJson,
|
|
34930
|
-
packageName: "mobx",
|
|
34931
|
-
version: workspaceFacts.mobx.version
|
|
34932
|
-
});
|
|
34933
34660
|
const preactVersion = getPreactVersion(packageJson);
|
|
34934
|
-
const remotionVersion = workspaceFacts.remotionVersion;
|
|
34935
34661
|
const tanstackQueryVersion = getTanStackQueryVersion(packageJson) ?? workspaceFacts.tanstackQueryVersion;
|
|
34936
|
-
const reactThreeFiberVersion = workspaceFacts.reactThreeFiber.packageName ? resolveCatalogBackedDependencyVersion({
|
|
34937
|
-
rootDirectory: directory,
|
|
34938
|
-
rootPackageJson: packageJson,
|
|
34939
|
-
packageName: workspaceFacts.reactThreeFiber.packageName,
|
|
34940
|
-
version: workspaceFacts.reactThreeFiber.version
|
|
34941
|
-
}) : null;
|
|
34942
|
-
const threeVersion = resolveCatalogBackedDependencyVersion({
|
|
34943
|
-
rootDirectory: directory,
|
|
34944
|
-
rootPackageJson: packageJson,
|
|
34945
|
-
packageName: "three",
|
|
34946
|
-
version: workspaceFacts.threeVersion
|
|
34947
|
-
});
|
|
34948
34662
|
const isPreES2023Target = hasTypeScript && detectPreES2023Target(directory);
|
|
34949
34663
|
const projectInfo = {
|
|
34950
34664
|
rootDirectory: directory,
|
|
@@ -34954,16 +34668,6 @@ const discoverProject = (directory) => {
|
|
|
34954
34668
|
tailwindVersion,
|
|
34955
34669
|
zodVersion,
|
|
34956
34670
|
zodMajorVersion: zodVersion === null ? null : getLowestDependencyMajor(zodVersion),
|
|
34957
|
-
mobxVersion,
|
|
34958
|
-
mobxMajorVersion: mobxVersion === null ? null : getDependencyMajorWithinSupportedRange(mobxVersion, 6),
|
|
34959
|
-
hasMobxReact: workspaceFacts.hasMobxReact,
|
|
34960
|
-
mobxReactVersion: workspaceFacts.mobxReactVersion,
|
|
34961
|
-
hasMobxReactLite: workspaceFacts.hasMobxReactLite,
|
|
34962
|
-
mobxReactLiteVersion: workspaceFacts.mobxReactLiteVersion,
|
|
34963
|
-
hasMobxStateTree: workspaceFacts.hasMobxStateTree,
|
|
34964
|
-
hasMobxReactObserver: workspaceFacts.hasMobxReactObserver,
|
|
34965
|
-
zustandVersion,
|
|
34966
|
-
zustandMajorVersion: zustandVersion === null ? null : getLowestDependencyMajor(zustandVersion),
|
|
34967
34671
|
framework,
|
|
34968
34672
|
hasTypeScript,
|
|
34969
34673
|
hasReactCompiler: detectReactCompiler(directory, packageJson),
|
|
@@ -34971,18 +34675,8 @@ const discoverProject = (directory) => {
|
|
|
34971
34675
|
hasTanStackQuery: tanstackQueryVersion !== null,
|
|
34972
34676
|
hasI18nLibrary: workspaceFacts.hasI18nLibrary,
|
|
34973
34677
|
tanstackQueryVersion,
|
|
34678
|
+
mobxVersion: workspaceFacts.mobxVersion,
|
|
34974
34679
|
styledComponentsVersion: workspaceFacts.styledComponentsVersion,
|
|
34975
|
-
valtioVersion,
|
|
34976
|
-
valtioMajorVersion: valtioVersion === null ? null : getLowestDependencyMajor(valtioVersion),
|
|
34977
|
-
hasRemotion: workspaceFacts.hasRemotionDependency,
|
|
34978
|
-
remotionVersion,
|
|
34979
|
-
remotionMajorVersion: remotionVersion === null ? null : getLowestDependencyMajor(remotionVersion),
|
|
34980
|
-
hasThree: workspaceFacts.hasThree,
|
|
34981
|
-
threeVersion,
|
|
34982
|
-
threeRelease: parseThreeRelease(threeVersion),
|
|
34983
|
-
hasReactThreeFiber: workspaceFacts.hasReactThreeFiber,
|
|
34984
|
-
reactThreeFiberVersion,
|
|
34985
|
-
reactThreeFiberMajorVersion: reactThreeFiberVersion === null ? null : getLowestDependencyMajor(reactThreeFiberVersion),
|
|
34986
34680
|
hasSsrDependency: workspaceFacts.hasSsrDependency,
|
|
34987
34681
|
preactVersion,
|
|
34988
34682
|
preactMajorVersion: parseReactMajor(preactVersion),
|
|
@@ -37428,25 +37122,9 @@ const BABEL_CONFIG_FILE_NAMES = [
|
|
|
37428
37122
|
".babelrc.json"
|
|
37429
37123
|
];
|
|
37430
37124
|
const LEGACY_PRESET_SPEC = "module:metro-react-native-babel-preset";
|
|
37431
|
-
const LEGACY_PRESET_PACKAGE = "metro-react-native-babel-preset";
|
|
37432
|
-
const REACT_NATIVE_PACKAGE = "react-native";
|
|
37433
|
-
const PRESET_RENAME_MINIMUM_REACT_NATIVE_VERSION = "0.73.0";
|
|
37434
|
-
const LEGACY_PRESET_REFERENCE = new RegExp(`['"]${LEGACY_PRESET_SPEC}['"]`);
|
|
37435
37125
|
const MODERN_PRESET_REFERENCE = new RegExp(`['"]module:@react-native/babel-preset['"]`);
|
|
37436
37126
|
const ENABLE_BABEL_RUNTIME_VERSION = /enableBabelRuntime["']?\s*:\s*['"]/;
|
|
37437
|
-
const isReactNativeVersionAtLeastPresetRename = (rootDirectory, packageJson) => {
|
|
37438
|
-
const installedReactNativeManifestPath = Path.join(rootDirectory, "node_modules", REACT_NATIVE_PACKAGE, "package.json");
|
|
37439
|
-
const reactNativeVersionSpec = (isFile(installedReactNativeManifestPath) ? readPackageJson(installedReactNativeManifestPath).version : void 0) ?? getDependencySpec(packageJson, REACT_NATIVE_PACKAGE);
|
|
37440
|
-
if (reactNativeVersionSpec === null || reactNativeVersionSpec === void 0) return false;
|
|
37441
|
-
const normalizedVersionRange = import_semver.validRange(reactNativeVersionSpec);
|
|
37442
|
-
if (normalizedVersionRange === null) return false;
|
|
37443
|
-
const minimumVersion = import_semver.minVersion(normalizedVersionRange);
|
|
37444
|
-
return minimumVersion !== null && import_semver.gte(minimumVersion, PRESET_RENAME_MINIMUM_REACT_NATIVE_VERSION);
|
|
37445
|
-
};
|
|
37446
|
-
const canResolveLegacyPreset = (rootDirectory, packageJson) => getDependencySpec(packageJson, LEGACY_PRESET_PACKAGE) !== null || isFile(Path.join(rootDirectory, "node_modules", LEGACY_PRESET_PACKAGE, "package.json"));
|
|
37447
37127
|
const checkReactNativeMetroBabelPreset = (rootDirectory) => {
|
|
37448
|
-
const packageJson = readPackageJson(Path.join(rootDirectory, "package.json"));
|
|
37449
|
-
const shouldReportLegacyPreset = isReactNativeVersionAtLeastPresetRename(rootDirectory, packageJson) && !canResolveLegacyPreset(rootDirectory, packageJson);
|
|
37450
37128
|
for (const fileName of BABEL_CONFIG_FILE_NAMES) {
|
|
37451
37129
|
const filePath = Path.join(rootDirectory, fileName);
|
|
37452
37130
|
if (!isFile(filePath)) continue;
|
|
@@ -37456,7 +37134,7 @@ const checkReactNativeMetroBabelPreset = (rootDirectory) => {
|
|
|
37456
37134
|
} catch {
|
|
37457
37135
|
continue;
|
|
37458
37136
|
}
|
|
37459
|
-
if (
|
|
37137
|
+
if (contents.includes(LEGACY_PRESET_SPEC)) return [buildReactNativeDiagnostic({
|
|
37460
37138
|
filePath: fileName,
|
|
37461
37139
|
rule: "rn-no-metro-babel-preset",
|
|
37462
37140
|
severity: "error",
|
|
@@ -37479,6 +37157,12 @@ const checkReactNativeProject = (rootDirectory, project) => {
|
|
|
37479
37157
|
return [...checkReactNativeMetroBabelPreset(rootDirectory), ...checkReactNativeLibraryDependencies(rootDirectory)];
|
|
37480
37158
|
};
|
|
37481
37159
|
const RULE_KEY = "no-vulnerable-react-server-components";
|
|
37160
|
+
const DEPENDENCY_SECTIONS = [
|
|
37161
|
+
"dependencies",
|
|
37162
|
+
"devDependencies",
|
|
37163
|
+
"peerDependencies",
|
|
37164
|
+
"optionalDependencies"
|
|
37165
|
+
];
|
|
37482
37166
|
const REACT_RSC_ADVISORIES_BY_MINOR = {
|
|
37483
37167
|
"19.0": {
|
|
37484
37168
|
rceFixedVersion: "19.0.1",
|
|
@@ -37525,13 +37209,20 @@ const enumerateWorkspaceDirectories = (workspaceRoot) => {
|
|
|
37525
37209
|
for (const pattern of patterns) for (const directory of resolveWorkspaceDirectories(workspaceRoot, pattern)) directories.add(directory);
|
|
37526
37210
|
return [...directories];
|
|
37527
37211
|
};
|
|
37212
|
+
const readDeclaredSpec = (packageJson, packageName) => {
|
|
37213
|
+
for (const section of DEPENDENCY_SECTIONS) {
|
|
37214
|
+
const spec = packageJson[section]?.[packageName];
|
|
37215
|
+
if (typeof spec === "string") return spec;
|
|
37216
|
+
}
|
|
37217
|
+
return null;
|
|
37218
|
+
};
|
|
37528
37219
|
const resolveVersionInDirectory = (directory, packageName, declaredSpecOverride) => {
|
|
37529
37220
|
const manifestPath = Path.join(directory, "node_modules", packageName, "package.json");
|
|
37530
37221
|
if (isFile(manifestPath)) {
|
|
37531
37222
|
const installedVersion = import_semver.valid(readPackageJson(manifestPath).version ?? null);
|
|
37532
37223
|
if (installedVersion !== null) return installedVersion;
|
|
37533
37224
|
}
|
|
37534
|
-
const candidateSpecs = [
|
|
37225
|
+
const candidateSpecs = [readDeclaredSpec(readPackageJson(Path.join(directory, "package.json")), packageName), declaredSpecOverride];
|
|
37535
37226
|
for (const spec of candidateSpecs) {
|
|
37536
37227
|
const pinnedVersion = spec === null ? null : import_semver.valid(spec);
|
|
37537
37228
|
if (pinnedVersion !== null) return pinnedVersion;
|
|
@@ -38183,10 +37874,10 @@ const SSR_FRAMEWORKS = new Set([
|
|
|
38183
37874
|
"gatsby",
|
|
38184
37875
|
"tanstack-start"
|
|
38185
37876
|
]);
|
|
38186
|
-
const
|
|
38187
|
-
if (
|
|
38188
|
-
const
|
|
38189
|
-
for (let candidate = earliest; candidate <=
|
|
37877
|
+
const addMajorLadder = (capabilities, name, major, earliest, latest) => {
|
|
37878
|
+
if (major === null) return;
|
|
37879
|
+
const cappedMajor = Math.min(major, latest);
|
|
37880
|
+
for (let candidate = earliest; candidate <= cappedMajor; candidate += 1) capabilities.add(`${name}:${candidate}`);
|
|
38190
37881
|
};
|
|
38191
37882
|
const buildCapabilities = (project) => {
|
|
38192
37883
|
const capabilities = /* @__PURE__ */ new Set();
|
|
@@ -38200,76 +37891,31 @@ const buildCapabilities = (project) => {
|
|
|
38200
37891
|
if (project.isStaticExport) capabilities.add("nextjs:static-export");
|
|
38201
37892
|
if (project.nextjsMajorVersion !== null && project.nextjsMajorVersion >= 15) capabilities.add("nextjs:15");
|
|
38202
37893
|
if (project.nextjsMajorVersion !== null && project.nextjsMajorVersion >= 16) capabilities.add("nextjs:16");
|
|
38203
|
-
|
|
37894
|
+
addMajorLadder(capabilities, "react", project.reactMajorVersion, 17, 30);
|
|
38204
37895
|
if (project.reactMajorVersion !== null && project.reactMajorVersion >= 19 && isMajorMinorAtLeast(parseReactMajorMinor(project.reactVersion), {
|
|
38205
37896
|
major: 19,
|
|
38206
37897
|
minor: 2
|
|
38207
37898
|
})) capabilities.add("react:19.2");
|
|
38208
|
-
if (project.tailwindVersion !== null)
|
|
38209
|
-
|
|
38210
|
-
|
|
38211
|
-
|
|
38212
|
-
|
|
38213
|
-
minor: 4
|
|
38214
|
-
})) capabilities.add("tailwind:3.4");
|
|
38215
|
-
if (tailwindVersion !== null && isMajorMinorAtLeast(tailwindVersion, {
|
|
38216
|
-
major: 4,
|
|
38217
|
-
minor: 0
|
|
38218
|
-
})) capabilities.add("tailwind:4");
|
|
38219
|
-
}
|
|
37899
|
+
if (project.tailwindVersion !== null) capabilities.add("tailwind");
|
|
37900
|
+
if (project.tailwindVersion !== null && isMajorMinorAtLeast(parseTailwindMajorMinor(project.tailwindVersion), {
|
|
37901
|
+
major: 3,
|
|
37902
|
+
minor: 4
|
|
37903
|
+
})) capabilities.add("tailwind:3.4");
|
|
38220
37904
|
if (project.zodVersion !== null) capabilities.add("zod");
|
|
38221
37905
|
if (project.zodMajorVersion !== null && project.zodMajorVersion >= 4) capabilities.add("zod:4");
|
|
38222
|
-
if (project.mobxVersion !== void 0 && project.mobxVersion !== null || project.hasMobxReact === true || project.hasMobxReactLite === true || project.hasMobxStateTree === true || project.hasMobxReactObserver === true) capabilities.add("mobx");
|
|
38223
|
-
if (project.hasMobxReact === true) capabilities.add("mobx-react");
|
|
38224
|
-
if (project.hasMobxReactLite === true) capabilities.add("mobx-react-lite");
|
|
38225
|
-
if (project.hasMobxReact === true || project.hasMobxReactLite === true) capabilities.add("mobx-react-binding");
|
|
38226
|
-
const mobxReactVersion = parseDependencyMajorMinor(project.mobxReactVersion);
|
|
38227
|
-
const mobxReactLiteVersion = parseDependencyMajorMinor(project.mobxReactLiteVersion);
|
|
38228
|
-
const hasMobxReactObserverMemoGuard = mobxReactVersion !== null && isMajorMinorAtLeast(mobxReactVersion, {
|
|
38229
|
-
major: 7,
|
|
38230
|
-
minor: 3
|
|
38231
|
-
});
|
|
38232
|
-
const hasMobxReactLiteObserverMemoGuard = mobxReactLiteVersion !== null && isMajorMinorAtLeast(mobxReactLiteVersion, {
|
|
38233
|
-
major: 3,
|
|
38234
|
-
minor: 3
|
|
38235
|
-
});
|
|
38236
|
-
if (hasMobxReactObserverMemoGuard) capabilities.add("mobx-react-observer-memo-guard");
|
|
38237
|
-
if (hasMobxReactLiteObserverMemoGuard) capabilities.add("mobx-react-lite-observer-memo-guard");
|
|
38238
|
-
if (hasMobxReactObserverMemoGuard || hasMobxReactLiteObserverMemoGuard) capabilities.add("mobx-react-binding-observer-memo-guard");
|
|
38239
|
-
if (project.hasMobxStateTree === true) capabilities.add("mobx-state-tree");
|
|
38240
|
-
if (project.hasMobxReactObserver === true) capabilities.add("mobx-react-observer");
|
|
38241
|
-
if (project.mobxMajorVersion !== void 0 && project.mobxMajorVersion !== null && project.mobxMajorVersion >= 4 && project.mobxMajorVersion <= 6) addVersionCapabilityLadder(capabilities, "mobx", project.mobxMajorVersion, 4, 6);
|
|
38242
|
-
const mobxVersion = parseDependencyMajorMinor(project.mobxVersion);
|
|
38243
|
-
if (project.mobxMajorVersion === 6 && mobxVersion !== null && isMajorMinorAtLeast(mobxVersion, {
|
|
38244
|
-
major: 6,
|
|
38245
|
-
minor: 10
|
|
38246
|
-
})) capabilities.add("mobx:6.10");
|
|
38247
|
-
if (project.zustandVersion !== void 0 && project.zustandVersion !== null) capabilities.add("zustand");
|
|
38248
|
-
if (project.zustandMajorVersion !== void 0 && project.zustandMajorVersion !== null && project.zustandMajorVersion >= 1 && project.zustandMajorVersion <= 5) addVersionCapabilityLadder(capabilities, "zustand", project.zustandMajorVersion, 1, 5);
|
|
38249
37906
|
if (project.isPreES2023Target) capabilities.add("pre-es2023");
|
|
38250
37907
|
if (project.hasReactCompiler) capabilities.add("react-compiler");
|
|
38251
37908
|
if (Boolean(project.hasTanStackQuery) || Boolean(project.tanstackQueryVersion)) capabilities.add("tanstack-query");
|
|
37909
|
+
if (project.mobxVersion) capabilities.add("mobx");
|
|
38252
37910
|
if (project.styledComponentsVersion) {
|
|
38253
37911
|
capabilities.add("styled-components");
|
|
38254
37912
|
const styledComponentsMajor = getLowestDependencyMajor(project.styledComponentsVersion);
|
|
38255
37913
|
if (styledComponentsMajor !== null && styledComponentsMajor >= 6) capabilities.add("styled-components:6");
|
|
38256
37914
|
}
|
|
38257
37915
|
if (project.hasI18nLibrary) capabilities.add("i18n");
|
|
38258
|
-
if (project.valtioVersion !== null) capabilities.add("valtio");
|
|
38259
|
-
addVersionCapabilityLadder(capabilities, "valtio", project.valtioMajorVersion, 1, 10);
|
|
38260
|
-
if (project.hasRemotion) {
|
|
38261
|
-
capabilities.add("remotion");
|
|
38262
|
-
addVersionCapabilityLadder(capabilities, "remotion", project.remotionMajorVersion ?? null, 4, 30);
|
|
38263
|
-
}
|
|
38264
|
-
if (project.hasThree || project.hasReactThreeFiber) capabilities.add("three");
|
|
38265
|
-
addVersionCapabilityLadder(capabilities, "three", project.threeRelease ?? null, 145, 250);
|
|
38266
|
-
if (project.hasReactThreeFiber) {
|
|
38267
|
-
capabilities.add("r3f");
|
|
38268
|
-
addVersionCapabilityLadder(capabilities, "r3f", project.reactThreeFiberMajorVersion ?? null, 3, 10);
|
|
38269
|
-
}
|
|
38270
37916
|
if (project.hasTypeScript) capabilities.add("typescript");
|
|
38271
37917
|
if (project.preactVersion !== null) capabilities.add("preact");
|
|
38272
|
-
|
|
37918
|
+
addMajorLadder(capabilities, "preact", project.preactMajorVersion, 10, 20);
|
|
38273
37919
|
if (project.preactVersion !== null && project.reactVersion === null) capabilities.add("pure-preact");
|
|
38274
37920
|
return capabilities;
|
|
38275
37921
|
};
|
|
@@ -38281,7 +37927,7 @@ const getCapabilities = (project) => {
|
|
|
38281
37927
|
capabilitiesByProject.set(project, capabilities);
|
|
38282
37928
|
return capabilities;
|
|
38283
37929
|
};
|
|
38284
|
-
const shouldEnableRule = (requires, tags, capabilities, ignoredTags, disabledWhen
|
|
37930
|
+
const shouldEnableRule = (requires, tags, capabilities, ignoredTags, disabledWhen) => {
|
|
38285
37931
|
if (requires) {
|
|
38286
37932
|
for (const capability of requires) if (!capabilities.has(capability)) return false;
|
|
38287
37933
|
}
|
|
@@ -38292,29 +37938,20 @@ const shouldEnableRule = (requires, tags, capabilities, ignoredTags, disabledWhe
|
|
|
38292
37938
|
if (tags) {
|
|
38293
37939
|
for (const tag of tags) if (ignoredTags.has(tag)) return false;
|
|
38294
37940
|
}
|
|
38295
|
-
if (includedTags && includedTags.size > 0) {
|
|
38296
|
-
if (!tags?.some((tag) => includedTags.has(tag))) return false;
|
|
38297
|
-
}
|
|
38298
37941
|
return true;
|
|
38299
37942
|
};
|
|
38300
|
-
const shouldEnableRuleByDefaultStatus = (options) => options.defaultEnabled !== false || options.hasExplicitOverride === true || options.includeTagDefaults && options.hasIncludedTags;
|
|
38301
37943
|
const yieldToEventLoop = () => new Promise((resolve) => {
|
|
38302
37944
|
setImmediate(resolve);
|
|
38303
37945
|
});
|
|
38304
37946
|
const createSecurityScanSession = (rootDirectory, options) => {
|
|
38305
37947
|
const capabilities = options.project ? getCapabilities(options.project) : /* @__PURE__ */ new Set();
|
|
38306
37948
|
const ignoredTags = options.ignoredTags ?? /* @__PURE__ */ new Set();
|
|
38307
|
-
const includedTags = options.includedTags ?? /* @__PURE__ */ new Set();
|
|
38308
37949
|
const enabledScanRules = REACT_DOCTOR_RULES.flatMap((entry) => {
|
|
38309
37950
|
const rule = entry.rule;
|
|
38310
37951
|
const scan = rule.scan;
|
|
38311
37952
|
if (typeof scan !== "function") return [];
|
|
38312
|
-
if (
|
|
38313
|
-
|
|
38314
|
-
includeTagDefaults: options.includeTagDefaults === true,
|
|
38315
|
-
hasIncludedTags: includedTags.size > 0
|
|
38316
|
-
})) return [];
|
|
38317
|
-
if (!shouldEnableRule(rule.requires, rule.tags, capabilities, ignoredTags, rule.disabledWhen, includedTags)) return [];
|
|
37953
|
+
if (rule.defaultEnabled === false) return [];
|
|
37954
|
+
if (!shouldEnableRule(rule.requires, rule.tags, capabilities, ignoredTags, rule.disabledWhen)) return [];
|
|
38318
37955
|
return [{
|
|
38319
37956
|
entry,
|
|
38320
37957
|
scan,
|
|
@@ -40300,9 +39937,8 @@ const buildUserPluginRules = (userPlugin, severityControls) => {
|
|
|
40300
39937
|
}
|
|
40301
39938
|
return enabled;
|
|
40302
39939
|
};
|
|
40303
|
-
const createOxlintConfig = ({ pluginPath, project, customRulesOnly = false, extendsPaths = [], ignoredTags = /* @__PURE__ */ new Set(),
|
|
40304
|
-
const
|
|
40305
|
-
const reactHooksJsPlugin = disableReactHooksJsPlugin || ruleSelection === "sidecar" || hasIncludedTags ? null : resolveReactHooksJsPlugin(project.hasReactCompiler || project.hasReactCompilerLintPlugin === true, customRulesOnly);
|
|
39940
|
+
const createOxlintConfig = ({ pluginPath, project, customRulesOnly = false, extendsPaths = [], ignoredTags = /* @__PURE__ */ new Set(), serverAuthFunctionNames, severityControls, userPlugins = [], disableReactHooksJsPlugin = false, ruleSelection, sidecarRuleIdFilter }) => {
|
|
39941
|
+
const reactHooksJsPlugin = disableReactHooksJsPlugin || ruleSelection === "sidecar" ? null : resolveReactHooksJsPlugin(project.hasReactCompiler || project.hasReactCompilerLintPlugin === true, customRulesOnly);
|
|
40306
39942
|
const reactCompilerRules = reactHooksJsPlugin ? applyRuleSeverityControls(filterRulesToAvailable(REACT_COMPILER_RULES, "react-hooks-js", reactHooksJsPlugin.availableRuleNames), severityControls) : {};
|
|
40307
39943
|
const jsPlugins = [];
|
|
40308
39944
|
if (reactHooksJsPlugin) jsPlugins.push(reactHooksJsPlugin.entry);
|
|
@@ -40317,14 +39953,9 @@ const createOxlintConfig = ({ pluginPath, project, customRulesOnly = false, exte
|
|
|
40317
39953
|
if (rule.scan !== void 0) continue;
|
|
40318
39954
|
if (customRulesOnly && registryEntry.originallyExternal) continue;
|
|
40319
39955
|
if (rule.framework !== "global" && !rule.requires) continue;
|
|
40320
|
-
if (!shouldEnableRule(rule.requires, rule.tags, capabilities, ignoredTags, rule.disabledWhen
|
|
39956
|
+
if (!shouldEnableRule(rule.requires, rule.tags, capabilities, ignoredTags, rule.disabledWhen)) continue;
|
|
40321
39957
|
const explicitRuleOverride = resolveRuleSeverityOverride({ ruleKey: registryEntry.key }, severityControls);
|
|
40322
|
-
if (
|
|
40323
|
-
defaultEnabled: rule.defaultEnabled,
|
|
40324
|
-
includeTagDefaults,
|
|
40325
|
-
hasIncludedTags,
|
|
40326
|
-
hasExplicitOverride: explicitRuleOverride !== void 0
|
|
40327
|
-
})) continue;
|
|
39958
|
+
if (rule.defaultEnabled === false && explicitRuleOverride === void 0) continue;
|
|
40328
39959
|
const severity = resolveRuleSeverityOverride({
|
|
40329
39960
|
ruleKey: registryEntry.key,
|
|
40330
39961
|
category: rule.category
|
|
@@ -40333,7 +39964,7 @@ const createOxlintConfig = ({ pluginPath, project, customRulesOnly = false, exte
|
|
|
40333
39964
|
enabledReactDoctorRules[registryEntry.key] = severity;
|
|
40334
39965
|
}
|
|
40335
39966
|
const userPluginRules = {};
|
|
40336
|
-
if (ruleSelection !== "sidecar"
|
|
39967
|
+
if (ruleSelection !== "sidecar") for (const userPlugin of userPlugins) {
|
|
40337
39968
|
Object.assign(userPluginRules, buildUserPluginRules(userPlugin, severityControls));
|
|
40338
39969
|
jsPlugins.push(userPlugin.entry);
|
|
40339
39970
|
}
|
|
@@ -42078,7 +41709,7 @@ const reactHooksJsPluginDropNote = (error) => {
|
|
|
42078
41709
|
* 6. always restore disable directives + clean up the temp dir
|
|
42079
41710
|
*/
|
|
42080
41711
|
const runOxlint = async (options) => {
|
|
42081
|
-
const { rootDirectory, project, includePaths, nodeBinaryPath = process.execPath, customRulesOnly = false, respectInlineDisables = true, adoptExistingLintConfig = true, ignoredTags = /* @__PURE__ */ new Set(),
|
|
41712
|
+
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;
|
|
42082
41713
|
const serverAuthFunctionNames = Array.isArray(userConfig?.serverAuthFunctionNames) ? userConfig.serverAuthFunctionNames.filter((entry) => typeof entry === "string" && entry.length > 0) : void 0;
|
|
42083
41714
|
const severityControls = buildRuleSeverityControls(userConfig);
|
|
42084
41715
|
validateRuleRegistration();
|
|
@@ -42092,15 +41723,13 @@ const runOxlint = async (options) => {
|
|
|
42092
41723
|
}
|
|
42093
41724
|
const pluginPath = resolvePluginPath();
|
|
42094
41725
|
const extendsPaths = (adoptExistingLintConfig && !customRulesOnly ? detectUserLintConfigPaths(rootDirectory) : []).filter(canOxlintExtendConfig);
|
|
42095
|
-
const userPlugins =
|
|
41726
|
+
const userPlugins = resolveUserPlugins(userConfig?.plugins, configSourceDirectory);
|
|
42096
41727
|
const buildConfig = (overrides) => createOxlintConfig({
|
|
42097
41728
|
pluginPath,
|
|
42098
41729
|
project,
|
|
42099
41730
|
customRulesOnly,
|
|
42100
41731
|
extendsPaths: overrides.extendsPaths,
|
|
42101
41732
|
ignoredTags,
|
|
42102
|
-
includedTags,
|
|
42103
|
-
includeTagDefaults,
|
|
42104
41733
|
serverAuthFunctionNames,
|
|
42105
41734
|
severityControls,
|
|
42106
41735
|
userPlugins,
|
|
@@ -42489,8 +42118,6 @@ var Linter = class Linter extends Service()("react-doctor/Linter") {
|
|
|
42489
42118
|
respectInlineDisables: input.respectInlineDisables,
|
|
42490
42119
|
adoptExistingLintConfig: input.adoptExistingLintConfig,
|
|
42491
42120
|
ignoredTags: input.ignoredTags,
|
|
42492
|
-
includedTags: input.includedTags,
|
|
42493
|
-
includeTagDefaults: input.includeTagDefaults,
|
|
42494
42121
|
userConfig: input.userConfig ?? null,
|
|
42495
42122
|
configSourceDirectory: input.configSourceDirectory,
|
|
42496
42123
|
onPartialFailure: (reason) => {
|
|
@@ -43339,9 +42966,7 @@ const runInspect = (input, hooks = {}) => gen(function* () {
|
|
|
43339
42966
|
const securityScanFailedRef = yield* make$13(false);
|
|
43340
42967
|
const securityScanFiber = yield* forkChild(runCollect(applyPerElementPipeline(isDiffMode ? empty$4 : unwrap(tryPromise(() => checkSecurityScanCooperative(scanDirectory, {
|
|
43341
42968
|
project,
|
|
43342
|
-
ignoredTags: input.ignoredTags
|
|
43343
|
-
includedTags: input.includedTags,
|
|
43344
|
-
includeTagDefaults: input.includeTagDefaults
|
|
42969
|
+
ignoredTags: input.ignoredTags
|
|
43345
42970
|
})).pipe(map$3((diagnostics) => fromIterable$1(diagnostics)), catch_$1(() => set(securityScanFailedRef, true).pipe(as(empty$4))))))).pipe(withSpan("SecurityScan.run")));
|
|
43346
42971
|
const shouldRunSupplyChain = !isDiffMode || (input.supplyChainManifestChanged ?? false);
|
|
43347
42972
|
const supplyChainOverlapTimeout = yield* SupplyChainOverlapTimeoutMs;
|
|
@@ -43432,8 +43057,6 @@ const runInspect = (input, hooks = {}) => gen(function* () {
|
|
|
43432
43057
|
respectInlineDisables: input.respectInlineDisables,
|
|
43433
43058
|
adoptExistingLintConfig: input.adoptExistingLintConfig,
|
|
43434
43059
|
ignoredTags: input.ignoredTags,
|
|
43435
|
-
includedTags: input.includedTags,
|
|
43436
|
-
includeTagDefaults: input.includeTagDefaults,
|
|
43437
43060
|
userConfig: resolvedConfig.config ?? void 0,
|
|
43438
43061
|
configSourceDirectory: resolvedConfig.configSourceDirectory ?? void 0,
|
|
43439
43062
|
onFileProgress: (scannedFileCount, totalFileCount) => {
|
|
@@ -45936,5 +45559,5 @@ const startLanguageServer = () => {
|
|
|
45936
45559
|
};
|
|
45937
45560
|
//#endregion
|
|
45938
45561
|
export { startLanguageServer };
|
|
45939
|
-
!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]="
|
|
45940
|
-
//# debugId=
|
|
45562
|
+
!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]="02e90846-98be-5fc3-82e6-cda81a2e7456")}catch(e){}}();
|
|
45563
|
+
//# debugId=02e90846-98be-5fc3-82e6-cda81a2e7456
|