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/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
|
|
2
|
-
!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="
|
|
2
|
+
!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="d6253eef-925f-579a-9b36-3bbf313293f5")}catch(e){}}();
|
|
3
3
|
import { r as __toESM$1, t as __commonJSMin$1 } from "./chunk-N93fKeF6.js";
|
|
4
4
|
import { createRequire } from "node:module";
|
|
5
5
|
import reactDoctorPlugin, { ALL_REACT_DOCTOR_RULE_KEYS, CROSS_FILE_DEPENDENCY_COLLECTORS, CROSS_FILE_RULE_IDS, FRAMEWORK_SPECIFIC_RULE_KEYS, FRAMEWORK_TOKENS, MOTION_LIBRARY_PACKAGES, REACT_COMPILER_RULES, REACT_DOCTOR_RULES, classifySecurityScanFile, collectCrossFileDependencyProbes, resetManifestCaches, shouldReadSecurityScanContent } from "oxlint-plugin-react-doctor";
|
|
@@ -32854,6 +32854,44 @@ var AmbiguousProjectError = class extends Error {
|
|
|
32854
32854
|
}
|
|
32855
32855
|
};
|
|
32856
32856
|
const isProjectDiscoveryError = (value) => value instanceof ProjectNotFoundError || value instanceof NoReactDependencyError || value instanceof PackageJsonNotFoundError || value instanceof NotADirectoryError || value instanceof AmbiguousProjectError;
|
|
32857
|
+
const isErrnoException = (error) => error instanceof Error && "code" in error;
|
|
32858
|
+
const IGNORABLE_READDIR_ERROR_CODES = new Set([
|
|
32859
|
+
"EACCES",
|
|
32860
|
+
"EPERM",
|
|
32861
|
+
"ENOENT",
|
|
32862
|
+
"ENOTDIR",
|
|
32863
|
+
"EINVAL",
|
|
32864
|
+
"ELOOP",
|
|
32865
|
+
"ENAMETOOLONG"
|
|
32866
|
+
]);
|
|
32867
|
+
const isIgnorableReaddirError = (error) => isErrnoException(error) && typeof error.code === "string" && IGNORABLE_READDIR_ERROR_CODES.has(error.code);
|
|
32868
|
+
const readDirectoryEntries = (directoryPath) => {
|
|
32869
|
+
try {
|
|
32870
|
+
return NFS.readdirSync(directoryPath, { withFileTypes: true });
|
|
32871
|
+
} catch (error) {
|
|
32872
|
+
if (isIgnorableReaddirError(error)) return [];
|
|
32873
|
+
throw error;
|
|
32874
|
+
}
|
|
32875
|
+
};
|
|
32876
|
+
const isFile = (filePath) => {
|
|
32877
|
+
try {
|
|
32878
|
+
return NFS.statSync(filePath).isFile();
|
|
32879
|
+
} catch {
|
|
32880
|
+
return false;
|
|
32881
|
+
}
|
|
32882
|
+
};
|
|
32883
|
+
const isDirectory = (directoryPath) => {
|
|
32884
|
+
try {
|
|
32885
|
+
return NFS.statSync(directoryPath).isDirectory();
|
|
32886
|
+
} catch {
|
|
32887
|
+
return false;
|
|
32888
|
+
}
|
|
32889
|
+
};
|
|
32890
|
+
const isPlainObject = (value) => {
|
|
32891
|
+
if (typeof value !== "object" || value === null || Array.isArray(value)) return false;
|
|
32892
|
+
const prototype = Object.getPrototypeOf(value);
|
|
32893
|
+
return prototype === null || prototype === Object.prototype;
|
|
32894
|
+
};
|
|
32857
32895
|
const SOURCE_FILE_PATTERN = /\.(tsx?|jsx?|mts|mjs)$/;
|
|
32858
32896
|
const GENERATED_BUNDLE_FILE_PATTERN = /\.(iife|umd|global|min)\.m?js$/i;
|
|
32859
32897
|
const GENERATED_SOURCE_DIRECTORY_PATTERN = /(?:^|\/)__generated__\//;
|
|
@@ -33012,44 +33050,6 @@ const SUPPLY_CHAIN_OVERLAP_TIMEOUT_MS = 9e4;
|
|
|
33012
33050
|
const SUPPLY_CHAIN_CACHE_TTL_MS = 864e5;
|
|
33013
33051
|
const SUPPLY_CHAIN_CACHE_SUBDIR = "supply-chain";
|
|
33014
33052
|
const SUPPLY_CHAIN_IGNORED_PACKAGES = new Set(["next"]);
|
|
33015
|
-
const isErrnoException = (error) => error instanceof Error && "code" in error;
|
|
33016
|
-
const IGNORABLE_READDIR_ERROR_CODES = new Set([
|
|
33017
|
-
"EACCES",
|
|
33018
|
-
"EPERM",
|
|
33019
|
-
"ENOENT",
|
|
33020
|
-
"ENOTDIR",
|
|
33021
|
-
"EINVAL",
|
|
33022
|
-
"ELOOP",
|
|
33023
|
-
"ENAMETOOLONG"
|
|
33024
|
-
]);
|
|
33025
|
-
const isIgnorableReaddirError = (error) => isErrnoException(error) && typeof error.code === "string" && IGNORABLE_READDIR_ERROR_CODES.has(error.code);
|
|
33026
|
-
const readDirectoryEntries = (directoryPath) => {
|
|
33027
|
-
try {
|
|
33028
|
-
return NFS.readdirSync(directoryPath, { withFileTypes: true });
|
|
33029
|
-
} catch (error) {
|
|
33030
|
-
if (isIgnorableReaddirError(error)) return [];
|
|
33031
|
-
throw error;
|
|
33032
|
-
}
|
|
33033
|
-
};
|
|
33034
|
-
const isFile = (filePath) => {
|
|
33035
|
-
try {
|
|
33036
|
-
return NFS.statSync(filePath).isFile();
|
|
33037
|
-
} catch {
|
|
33038
|
-
return false;
|
|
33039
|
-
}
|
|
33040
|
-
};
|
|
33041
|
-
const isDirectory = (directoryPath) => {
|
|
33042
|
-
try {
|
|
33043
|
-
return NFS.statSync(directoryPath).isDirectory();
|
|
33044
|
-
} catch {
|
|
33045
|
-
return false;
|
|
33046
|
-
}
|
|
33047
|
-
};
|
|
33048
|
-
const isPlainObject = (value) => {
|
|
33049
|
-
if (typeof value !== "object" || value === null || Array.isArray(value)) return false;
|
|
33050
|
-
const prototype = Object.getPrototypeOf(value);
|
|
33051
|
-
return prototype === null || prototype === Object.prototype;
|
|
33052
|
-
};
|
|
33053
33053
|
const lastSourceMappingUrl = (fileContent) => {
|
|
33054
33054
|
const lastReference = [...fileContent.matchAll(/\/\/# sourceMappingURL=(\S+)/g)].at(-1);
|
|
33055
33055
|
return lastReference ? lastReference[1] : null;
|
|
@@ -33402,17 +33402,11 @@ const NEXT_CONFIG_FILENAMES = [
|
|
|
33402
33402
|
];
|
|
33403
33403
|
const BABEL_CONFIG_FILENAMES = [
|
|
33404
33404
|
".babelrc",
|
|
33405
|
-
".babelrc.js",
|
|
33406
33405
|
".babelrc.json",
|
|
33407
|
-
".babelrc.cjs",
|
|
33408
|
-
".babelrc.mjs",
|
|
33409
|
-
".babelrc.cts",
|
|
33410
33406
|
"babel.config.js",
|
|
33411
33407
|
"babel.config.json",
|
|
33412
33408
|
"babel.config.cjs",
|
|
33413
|
-
"babel.config.mjs"
|
|
33414
|
-
"babel.config.ts",
|
|
33415
|
-
"babel.config.cts"
|
|
33409
|
+
"babel.config.mjs"
|
|
33416
33410
|
];
|
|
33417
33411
|
const VITE_CONFIG_FILENAMES = [
|
|
33418
33412
|
"vite.config.js",
|
|
@@ -33424,28 +33418,12 @@ const VITE_CONFIG_FILENAMES = [
|
|
|
33424
33418
|
"vitest.config.ts",
|
|
33425
33419
|
"vitest.config.js"
|
|
33426
33420
|
];
|
|
33427
|
-
const RSBUILD_CONFIG_FILENAMES = [
|
|
33428
|
-
"rsbuild.config.ts",
|
|
33429
|
-
"rsbuild.config.js",
|
|
33430
|
-
"rsbuild.config.mts",
|
|
33431
|
-
"rsbuild.config.mjs",
|
|
33432
|
-
"rsbuild.config.cts",
|
|
33433
|
-
"rsbuild.config.cjs"
|
|
33434
|
-
];
|
|
33435
|
-
const RSPACK_CONFIG_FILENAMES = [
|
|
33436
|
-
"rspack.config.ts",
|
|
33437
|
-
"rspack.config.js",
|
|
33438
|
-
"rspack.config.mts",
|
|
33439
|
-
"rspack.config.mjs",
|
|
33440
|
-
"rspack.config.cts",
|
|
33441
|
-
"rspack.config.cjs"
|
|
33442
|
-
];
|
|
33443
33421
|
const EXPO_APP_CONFIG_FILENAMES = [
|
|
33444
33422
|
"app.json",
|
|
33445
33423
|
"app.config.js",
|
|
33446
33424
|
"app.config.ts"
|
|
33447
33425
|
];
|
|
33448
|
-
const REACT_COMPILER_PACKAGE_REFERENCE_PATTERN = /babel-plugin-react-compiler|react-compiler-runtime|
|
|
33426
|
+
const REACT_COMPILER_PACKAGE_REFERENCE_PATTERN = /babel-plugin-react-compiler|react-compiler-runtime|["']react-compiler["']/;
|
|
33449
33427
|
const REACT_COMPILER_ENABLED_FLAG_PATTERN = /["']?reactCompiler["']?\s*:\s*(?:true\b|\{)/;
|
|
33450
33428
|
const STATIC_EXPORT_OUTPUT_PATTERN = /(?:^|[^.\w])["']?output["']?\s*:\s*["']export["']/m;
|
|
33451
33429
|
const hasCompilerPackage = (packageJson, compilerPackages) => {
|
|
@@ -33480,8 +33458,6 @@ const detectReactCompiler = (directory, packageJson) => {
|
|
|
33480
33458
|
if (hasCompilerInConfigFiles(directory, NEXT_CONFIG_FILENAMES)) return true;
|
|
33481
33459
|
if (hasCompilerInConfigFiles(directory, BABEL_CONFIG_FILENAMES)) return true;
|
|
33482
33460
|
if (hasCompilerInConfigFiles(directory, VITE_CONFIG_FILENAMES)) return true;
|
|
33483
|
-
if (hasCompilerInConfigFiles(directory, RSBUILD_CONFIG_FILENAMES)) return true;
|
|
33484
|
-
if (hasCompilerInConfigFiles(directory, RSPACK_CONFIG_FILENAMES)) return true;
|
|
33485
33461
|
if (hasCompilerInConfigFiles(directory, EXPO_APP_CONFIG_FILENAMES)) return true;
|
|
33486
33462
|
return hasCompilerPackageInAncestors(directory, REACT_COMPILER_TRANSFORM_PACKAGES);
|
|
33487
33463
|
};
|
|
@@ -33490,7 +33466,7 @@ const detectNextjsStaticExport = (directory) => NEXT_CONFIG_FILENAMES.some((file
|
|
|
33490
33466
|
const filePath = Path.join(directory, filename);
|
|
33491
33467
|
return isFile(filePath) && STATIC_EXPORT_OUTPUT_PATTERN.test(NFS.readFileSync(filePath, "utf-8"));
|
|
33492
33468
|
});
|
|
33493
|
-
const UNRESOLVABLE_PROTOCOL_VERSION = /^(?:
|
|
33469
|
+
const UNRESOLVABLE_PROTOCOL_VERSION = /^(?:file|git|github|https?|link|patch|portal|workspace|npm):/i;
|
|
33494
33470
|
const DIST_TAG_VERSION = /^[a-z][a-z0-9._-]*$/i;
|
|
33495
33471
|
const WILDCARD_VERSION = /^[*xX](?:\.[*xX])*$/;
|
|
33496
33472
|
const NPM_ALIAS_VERSION = /^npm:(?:@[^/]+\/[^@]+|[^@]+)@(.+)$/i;
|
|
@@ -33623,16 +33599,6 @@ const getLowestDependencyMajor = (version) => {
|
|
|
33623
33599
|
}
|
|
33624
33600
|
return lowestMajor;
|
|
33625
33601
|
};
|
|
33626
|
-
const getDependencyMajorWithinSupportedRange = (version, latestSupportedMajor) => {
|
|
33627
|
-
const normalizedVersion = normalizeDependencyVersion(version);
|
|
33628
|
-
if (normalizedVersion === null) return null;
|
|
33629
|
-
const validRange = import_semver.validRange(normalizedVersion);
|
|
33630
|
-
if (validRange === null) return null;
|
|
33631
|
-
const minimumVersion = import_semver.minVersion(validRange);
|
|
33632
|
-
if (minimumVersion === null || minimumVersion.major > latestSupportedMajor) return null;
|
|
33633
|
-
if (import_semver.intersects(validRange, `>=${latestSupportedMajor + 1}.0.0`)) return null;
|
|
33634
|
-
return minimumVersion.major;
|
|
33635
|
-
};
|
|
33636
33602
|
const isConcreteDependencyVersion = (version) => {
|
|
33637
33603
|
const normalizedVersion = normalizeDependencyVersion(version);
|
|
33638
33604
|
return normalizedVersion !== null && /\d/.test(normalizedVersion);
|
|
@@ -33676,18 +33642,9 @@ const parseReactMajorMinor = (reactVersion) => {
|
|
|
33676
33642
|
};
|
|
33677
33643
|
};
|
|
33678
33644
|
const parseLowerBoundVersion = (versionSpec) => import_semver.validRange(versionSpec) !== null ? import_semver.minVersion(versionSpec) : import_semver.coerce(versionSpec);
|
|
33679
|
-
const
|
|
33680
|
-
if (typeof
|
|
33681
|
-
const
|
|
33682
|
-
if (normalizedVersion === null) return null;
|
|
33683
|
-
const lowerBound = parseLowerBoundVersion(normalizedVersion);
|
|
33684
|
-
if (lowerBound === null) return null;
|
|
33685
|
-
if (lowerBound.major > 0) return Number.MAX_SAFE_INTEGER;
|
|
33686
|
-
return lowerBound.minor > 0 ? lowerBound.minor : null;
|
|
33687
|
-
};
|
|
33688
|
-
const parseDependencyMajorMinor = (dependencyVersion) => {
|
|
33689
|
-
if (typeof dependencyVersion !== "string") return null;
|
|
33690
|
-
const trimmed = dependencyVersion.trim();
|
|
33645
|
+
const parseTailwindMajorMinor = (tailwindVersion) => {
|
|
33646
|
+
if (typeof tailwindVersion !== "string") return null;
|
|
33647
|
+
const trimmed = tailwindVersion.trim();
|
|
33691
33648
|
if (trimmed.length === 0) return null;
|
|
33692
33649
|
const lowerBound = parseLowerBoundVersion(trimmed);
|
|
33693
33650
|
if (lowerBound === null || lowerBound.major <= 0) return null;
|
|
@@ -33696,7 +33653,6 @@ const parseDependencyMajorMinor = (dependencyVersion) => {
|
|
|
33696
33653
|
minor: lowerBound.minor
|
|
33697
33654
|
};
|
|
33698
33655
|
};
|
|
33699
|
-
const parseTailwindMajorMinor = (tailwindVersion) => parseDependencyMajorMinor(tailwindVersion);
|
|
33700
33656
|
const hasUpperBoundOnlyPeerRange = (range) => {
|
|
33701
33657
|
if (typeof range !== "string") return false;
|
|
33702
33658
|
const normalizedRange = normalizeDependencyVersion(range);
|
|
@@ -33718,7 +33674,7 @@ const resolveEffectiveReactMajor = (reactVersion, packageJson) => {
|
|
|
33718
33674
|
if (peerFloor === null) return hasUpperBoundOnlyPeerRange(peerReactRange) ? null : installedReactMajor;
|
|
33719
33675
|
return installedReactMajor !== null ? Math.min(installedReactMajor, peerFloor) : peerFloor;
|
|
33720
33676
|
};
|
|
33721
|
-
const isCatalogReference = (version) =>
|
|
33677
|
+
const isCatalogReference = (version) => version.startsWith("catalog:");
|
|
33722
33678
|
const extractCatalogName = (version) => {
|
|
33723
33679
|
if (!isCatalogReference(version)) return null;
|
|
33724
33680
|
const name = version.slice(8).trim();
|
|
@@ -33868,12 +33824,6 @@ const TAILWIND_ZOD_SECTIONS = [
|
|
|
33868
33824
|
"devDependencies",
|
|
33869
33825
|
"peerDependencies"
|
|
33870
33826
|
];
|
|
33871
|
-
const DEPENDENCY_SPEC_SECTIONS = [
|
|
33872
|
-
"dependencies",
|
|
33873
|
-
"devDependencies",
|
|
33874
|
-
"peerDependencies",
|
|
33875
|
-
"optionalDependencies"
|
|
33876
|
-
];
|
|
33877
33827
|
const EMPTY_DEPENDENCY_INFO = {
|
|
33878
33828
|
reactVersion: null,
|
|
33879
33829
|
tailwindVersion: null,
|
|
@@ -33883,7 +33833,7 @@ const EMPTY_DEPENDENCY_INFO = {
|
|
|
33883
33833
|
const pickConcreteVersion = (packageJson, packageName, sections) => {
|
|
33884
33834
|
for (const section of sections) {
|
|
33885
33835
|
const version = packageJson[section]?.[packageName];
|
|
33886
|
-
if (
|
|
33836
|
+
if (version === void 0) continue;
|
|
33887
33837
|
if (isCatalogReference(version)) return null;
|
|
33888
33838
|
if (isConcreteDependencyVersion(version)) return version;
|
|
33889
33839
|
}
|
|
@@ -33915,16 +33865,13 @@ const extractDependencyInfo = (packageJson) => {
|
|
|
33915
33865
|
};
|
|
33916
33866
|
};
|
|
33917
33867
|
const getDependencySpec = (packageJson, packageName) => {
|
|
33918
|
-
|
|
33919
|
-
|
|
33920
|
-
if (typeof spec === "string") return spec;
|
|
33921
|
-
}
|
|
33922
|
-
return null;
|
|
33868
|
+
const spec = packageJson.dependencies?.[packageName] ?? packageJson.devDependencies?.[packageName] ?? packageJson.peerDependencies?.[packageName] ?? packageJson.optionalDependencies?.[packageName];
|
|
33869
|
+
return typeof spec === "string" ? spec : null;
|
|
33923
33870
|
};
|
|
33924
33871
|
const getDependencyDeclaration = ({ packageJson, packageName, sections }) => {
|
|
33925
33872
|
for (const section of sections) {
|
|
33926
33873
|
const version = packageJson[section]?.[packageName];
|
|
33927
|
-
if (
|
|
33874
|
+
if (version === void 0) continue;
|
|
33928
33875
|
return {
|
|
33929
33876
|
catalogReference: extractCatalogName(version) ?? null,
|
|
33930
33877
|
hasDeclaration: true,
|
|
@@ -33958,15 +33905,11 @@ const getPreactVersion = (packageJson) => {
|
|
|
33958
33905
|
...packageJson.devDependencies
|
|
33959
33906
|
}.preact ?? null;
|
|
33960
33907
|
};
|
|
33961
|
-
const resolveCatalogBackedDependencyVersion = ({ rootDirectory, rootPackageJson, packageName,
|
|
33908
|
+
const resolveCatalogBackedDependencyVersion = ({ rootDirectory, rootPackageJson, packageName, version }) => {
|
|
33962
33909
|
if (version === null || !isCatalogReference(version)) return version;
|
|
33963
33910
|
const catalogName = extractCatalogName(version);
|
|
33964
|
-
const
|
|
33965
|
-
if (
|
|
33966
|
-
if (sourceDirectory !== rootDirectory || sourcePackageJson !== rootPackageJson) {
|
|
33967
|
-
const resolvedRootVersion = resolveCatalogVersion(rootPackageJson, packageName, rootDirectory, catalogName);
|
|
33968
|
-
if (resolvedRootVersion) return resolvedRootVersion;
|
|
33969
|
-
}
|
|
33911
|
+
const resolvedLocalVersion = resolveCatalogVersion(rootPackageJson, packageName, rootDirectory, catalogName);
|
|
33912
|
+
if (resolvedLocalVersion) return resolvedLocalVersion;
|
|
33970
33913
|
const monorepoRoot = findMonorepoRoot(rootDirectory);
|
|
33971
33914
|
if (!monorepoRoot) return version;
|
|
33972
33915
|
const monorepoPackageJsonPath = Path.join(monorepoRoot, "package.json");
|
|
@@ -34164,19 +34107,15 @@ const listWorkspacePackages = (rootDirectory) => {
|
|
|
34164
34107
|
}
|
|
34165
34108
|
return packages;
|
|
34166
34109
|
};
|
|
34167
|
-
const PREFERRED_DEPENDENCY_SECTIONS = [
|
|
34168
|
-
"dependencies",
|
|
34169
|
-
"peerDependencies",
|
|
34170
|
-
"devDependencies"
|
|
34171
|
-
];
|
|
34172
34110
|
const getPreferredDependencyVersion = ({ packageJson, packageNames }) => {
|
|
34111
|
+
const allDependencies = {
|
|
34112
|
+
...packageJson.devDependencies,
|
|
34113
|
+
...packageJson.peerDependencies,
|
|
34114
|
+
...packageJson.dependencies
|
|
34115
|
+
};
|
|
34173
34116
|
for (const packageName of packageNames) {
|
|
34174
|
-
const
|
|
34175
|
-
|
|
34176
|
-
packageName,
|
|
34177
|
-
sections: PREFERRED_DEPENDENCY_SECTIONS
|
|
34178
|
-
});
|
|
34179
|
-
if (declaration.version !== null) return declaration.version;
|
|
34117
|
+
const version = allDependencies[packageName];
|
|
34118
|
+
if (version !== void 0) return version;
|
|
34180
34119
|
}
|
|
34181
34120
|
return null;
|
|
34182
34121
|
};
|
|
@@ -34187,6 +34126,18 @@ const getTanStackQueryVersion = (packageJson) => {
|
|
|
34187
34126
|
packageNames: TANSTACK_REACT_QUERY_PACKAGES
|
|
34188
34127
|
});
|
|
34189
34128
|
};
|
|
34129
|
+
const MOBX_PACKAGES = [
|
|
34130
|
+
"mobx",
|
|
34131
|
+
"mobx-react",
|
|
34132
|
+
"mobx-react-lite",
|
|
34133
|
+
"mobx-state-tree"
|
|
34134
|
+
];
|
|
34135
|
+
const getMobxVersion = (packageJson) => {
|
|
34136
|
+
return getPreferredDependencyVersion({
|
|
34137
|
+
packageJson,
|
|
34138
|
+
packageNames: MOBX_PACKAGES
|
|
34139
|
+
});
|
|
34140
|
+
};
|
|
34190
34141
|
const STYLED_COMPONENTS_PACKAGES = ["styled-components"];
|
|
34191
34142
|
const getStyledComponentsVersion = (packageJson) => {
|
|
34192
34143
|
return getPreferredDependencyVersion({
|
|
@@ -34218,25 +34169,6 @@ const hasI18nDependency = (packageJson) => {
|
|
|
34218
34169
|
return I18N_PACKAGES.some((packageName) => allDependencies[packageName] !== void 0);
|
|
34219
34170
|
};
|
|
34220
34171
|
const REANIMATED_DEPENDENCY_NAME = "react-native-reanimated";
|
|
34221
|
-
const MOBX_REACT_PACKAGE_NAME = "mobx-react";
|
|
34222
|
-
const MOBX_REACT_LITE_PACKAGE_NAME = "mobx-react-lite";
|
|
34223
|
-
const MOBX_STATE_TREE_PACKAGE_NAME = "mobx-state-tree";
|
|
34224
|
-
const MOBX_REACT_OBSERVER_PACKAGE_NAME = "mobx-react-observer";
|
|
34225
|
-
const REACT_THREE_FIBER_DEPENDENCY_NAMES = ["@react-three/fiber", "react-three-fiber"];
|
|
34226
|
-
const REACT_THREE_FIBER_SECTIONS = [
|
|
34227
|
-
"dependencies",
|
|
34228
|
-
"peerDependencies",
|
|
34229
|
-
"optionalDependencies",
|
|
34230
|
-
"devDependencies"
|
|
34231
|
-
];
|
|
34232
|
-
const THREE_DEPENDENCY_SECTIONS = [
|
|
34233
|
-
"dependencies",
|
|
34234
|
-
"peerDependencies",
|
|
34235
|
-
"optionalDependencies",
|
|
34236
|
-
"devDependencies"
|
|
34237
|
-
];
|
|
34238
|
-
const REACT_THREE_FIBER_ECOSYSTEM_DEPENDENCY_NAMES = [...REACT_THREE_FIBER_DEPENDENCY_NAMES, "@react-three/drei"];
|
|
34239
|
-
const THREE_DEPENDENCY_NAMES = [...REACT_THREE_FIBER_ECOSYSTEM_DEPENDENCY_NAMES, "three"];
|
|
34240
34172
|
const SHOPIFY_FLASH_LIST_PACKAGE_NAME = "@shopify/flash-list";
|
|
34241
34173
|
const resolveWorkspaceDependencyVersion = ({ concreteVersion, packageName, rootDirectory, rootPackageJson, sections, workspaceDirectory, workspacePackageJson }) => {
|
|
34242
34174
|
const dependencyDeclaration = getDependencyDeclaration({
|
|
@@ -34247,7 +34179,7 @@ const resolveWorkspaceDependencyVersion = ({ concreteVersion, packageName, rootD
|
|
|
34247
34179
|
if (!dependencyDeclaration.hasDeclaration) return null;
|
|
34248
34180
|
return concreteVersion ?? resolveCatalogVersion(workspacePackageJson, packageName, workspaceDirectory, dependencyDeclaration.catalogReference) ?? resolveCatalogVersion(rootPackageJson, packageName, rootDirectory, dependencyDeclaration.catalogReference);
|
|
34249
34181
|
};
|
|
34250
|
-
const
|
|
34182
|
+
const shouldReplaceReactVersion = (currentVersion, nextVersion) => {
|
|
34251
34183
|
if (!currentVersion) return true;
|
|
34252
34184
|
const currentMajor = parseReactMajor(currentVersion);
|
|
34253
34185
|
const nextMajor = parseReactMajor(nextVersion);
|
|
@@ -34255,62 +34187,15 @@ const shouldReplaceWithLowerMajor = (currentVersion, nextVersion) => {
|
|
|
34255
34187
|
if (nextMajor === null) return false;
|
|
34256
34188
|
return nextMajor < currentMajor;
|
|
34257
34189
|
};
|
|
34258
|
-
const shouldReplaceSupportedDependencyFact = (currentFact, nextFact, latestSupportedMajor) => {
|
|
34259
|
-
if (currentFact.version === null) return true;
|
|
34260
|
-
if (nextFact.version === null) return false;
|
|
34261
|
-
const currentMajor = getLowestDependencyMajor(currentFact.version);
|
|
34262
|
-
const nextMajor = getLowestDependencyMajor(nextFact.version);
|
|
34263
|
-
if (currentMajor === null) return false;
|
|
34264
|
-
if (nextMajor === null) return true;
|
|
34265
|
-
if (currentMajor > latestSupportedMajor) return false;
|
|
34266
|
-
if (nextMajor > latestSupportedMajor) return true;
|
|
34267
|
-
return nextMajor < currentMajor;
|
|
34268
|
-
};
|
|
34269
34190
|
const shouldReplaceStyledComponentsVersion = (currentVersion, nextVersion) => {
|
|
34270
34191
|
if (!currentVersion) return true;
|
|
34271
34192
|
const currentMajor = getLowestDependencyMajor(currentVersion);
|
|
34272
34193
|
const nextMajor = getLowestDependencyMajor(nextVersion);
|
|
34273
|
-
if (currentMajor === null) return nextMajor !== null && nextMajor < 6;
|
|
34274
|
-
if (nextMajor === null) return currentMajor >= 6;
|
|
34275
|
-
return nextMajor < currentMajor;
|
|
34276
|
-
};
|
|
34277
|
-
const selectOldestDependencyVersion = (currentVersion, nextVersion) => {
|
|
34278
|
-
if (currentVersion === null || nextVersion === null) return null;
|
|
34279
|
-
const current = parseDependencyMajorMinor(currentVersion);
|
|
34280
|
-
const next = parseDependencyMajorMinor(nextVersion);
|
|
34281
|
-
if (current === null) return currentVersion;
|
|
34282
|
-
if (next === null) return nextVersion;
|
|
34283
|
-
if (next.major !== current.major) return next.major < current.major ? nextVersion : currentVersion;
|
|
34284
|
-
return next.minor < current.minor ? nextVersion : currentVersion;
|
|
34285
|
-
};
|
|
34286
|
-
const shouldReplaceMobxFact = (currentFact, nextFact) => {
|
|
34287
|
-
if (currentFact.sourceDirectory === null) return true;
|
|
34288
|
-
if (currentFact.version === null) return false;
|
|
34289
|
-
if (nextFact.version === null) return true;
|
|
34290
|
-
const currentMajor = getDependencyMajorWithinSupportedRange(currentFact.version, 6);
|
|
34291
|
-
const nextMajor = getDependencyMajorWithinSupportedRange(nextFact.version, 6);
|
|
34292
34194
|
if (currentMajor === null) return false;
|
|
34293
34195
|
if (nextMajor === null) return true;
|
|
34294
|
-
return
|
|
34295
|
-
};
|
|
34296
|
-
const collectBindingVersion = (facts, packageJson, directory, packageName) => {
|
|
34297
|
-
const version = getDependencySpec(packageJson, packageName);
|
|
34298
|
-
if (version === null) return;
|
|
34299
|
-
const resolvedVersion = resolveCatalogBackedDependencyVersion({
|
|
34300
|
-
rootDirectory: directory,
|
|
34301
|
-
rootPackageJson: packageJson,
|
|
34302
|
-
packageName,
|
|
34303
|
-
version
|
|
34304
|
-
});
|
|
34305
|
-
if (packageName === MOBX_REACT_PACKAGE_NAME) {
|
|
34306
|
-
facts.mobxReactVersion = facts.hasMobxReact ? selectOldestDependencyVersion(facts.mobxReactVersion, resolvedVersion) : resolvedVersion;
|
|
34307
|
-
facts.hasMobxReact = true;
|
|
34308
|
-
return;
|
|
34309
|
-
}
|
|
34310
|
-
facts.mobxReactLiteVersion = facts.hasMobxReactLite ? selectOldestDependencyVersion(facts.mobxReactLiteVersion, resolvedVersion) : resolvedVersion;
|
|
34311
|
-
facts.hasMobxReactLite = true;
|
|
34196
|
+
return nextMajor < currentMajor;
|
|
34312
34197
|
};
|
|
34313
|
-
const evaluateManifestFacts = (facts, packageJson, directory
|
|
34198
|
+
const evaluateManifestFacts = (facts, packageJson, directory) => {
|
|
34314
34199
|
if (facts.expo.version === null) {
|
|
34315
34200
|
const spec = getDependencySpec(packageJson, "expo");
|
|
34316
34201
|
if (spec !== null) facts.expo = {
|
|
@@ -34332,113 +34217,18 @@ const evaluateManifestFacts = (facts, packageJson, directory, rootDirectory, roo
|
|
|
34332
34217
|
sourceDirectory: directory
|
|
34333
34218
|
};
|
|
34334
34219
|
}
|
|
34335
|
-
const mobxSpec = getDependencySpec(packageJson, "mobx");
|
|
34336
|
-
if (mobxSpec !== null) {
|
|
34337
|
-
const nextMobxFact = {
|
|
34338
|
-
version: resolveCatalogBackedDependencyVersion({
|
|
34339
|
-
rootDirectory: directory,
|
|
34340
|
-
rootPackageJson: packageJson,
|
|
34341
|
-
packageName: "mobx",
|
|
34342
|
-
version: mobxSpec
|
|
34343
|
-
}),
|
|
34344
|
-
sourceDirectory: directory
|
|
34345
|
-
};
|
|
34346
|
-
if (shouldReplaceMobxFact(facts.mobx, nextMobxFact)) facts.mobx = nextMobxFact;
|
|
34347
|
-
}
|
|
34348
|
-
collectBindingVersion(facts, packageJson, directory, MOBX_REACT_PACKAGE_NAME);
|
|
34349
|
-
collectBindingVersion(facts, packageJson, directory, MOBX_REACT_LITE_PACKAGE_NAME);
|
|
34350
|
-
facts.hasMobxStateTree = facts.hasMobxStateTree || getDependencySpec(packageJson, MOBX_STATE_TREE_PACKAGE_NAME) !== null;
|
|
34351
|
-
facts.hasMobxReactObserver = facts.hasMobxReactObserver || getDependencySpec(packageJson, MOBX_REACT_OBSERVER_PACKAGE_NAME) !== null;
|
|
34352
|
-
const zustandSpec = getDependencySpec(packageJson, "zustand");
|
|
34353
|
-
if (zustandSpec !== null) {
|
|
34354
|
-
const nextZustandFact = {
|
|
34355
|
-
version: resolveCatalogBackedDependencyVersion({
|
|
34356
|
-
rootDirectory: directory,
|
|
34357
|
-
rootPackageJson: packageJson,
|
|
34358
|
-
packageName: "zustand",
|
|
34359
|
-
version: zustandSpec
|
|
34360
|
-
}),
|
|
34361
|
-
sourceDirectory: directory
|
|
34362
|
-
};
|
|
34363
|
-
if (shouldReplaceSupportedDependencyFact(facts.zustand, nextZustandFact, 5)) facts.zustand = nextZustandFact;
|
|
34364
|
-
}
|
|
34365
34220
|
if (facts.reanimatedVersion === null) {
|
|
34366
34221
|
const spec = getDependencySpec(packageJson, REANIMATED_DEPENDENCY_NAME);
|
|
34367
34222
|
if (spec !== null) facts.reanimatedVersion = spec;
|
|
34368
34223
|
}
|
|
34369
|
-
if (facts.valtioVersion === null) {
|
|
34370
|
-
const spec = getDependencySpec(packageJson, "valtio");
|
|
34371
|
-
if (spec !== null) facts.valtioVersion = spec;
|
|
34372
|
-
}
|
|
34373
34224
|
facts.tanstackQueryVersion ??= getTanStackQueryVersion(packageJson);
|
|
34374
|
-
|
|
34375
|
-
|
|
34376
|
-
rootPackageJson: packageJson,
|
|
34377
|
-
packageName: "styled-components",
|
|
34378
|
-
version: getStyledComponentsVersion(packageJson)
|
|
34379
|
-
});
|
|
34225
|
+
facts.mobxVersion ??= getMobxVersion(packageJson);
|
|
34226
|
+
const styledComponentsVersion = getStyledComponentsVersion(packageJson);
|
|
34380
34227
|
if (styledComponentsVersion && shouldReplaceStyledComponentsVersion(facts.styledComponentsVersion, styledComponentsVersion)) facts.styledComponentsVersion = styledComponentsVersion;
|
|
34381
34228
|
facts.hasI18nLibrary = facts.hasI18nLibrary || hasI18nDependency(packageJson);
|
|
34382
|
-
for (const packageName of REACT_THREE_FIBER_DEPENDENCY_NAMES) {
|
|
34383
|
-
const version = resolveCatalogBackedDependencyVersion({
|
|
34384
|
-
rootDirectory,
|
|
34385
|
-
rootPackageJson,
|
|
34386
|
-
sourceDirectory: directory,
|
|
34387
|
-
sourcePackageJson: packageJson,
|
|
34388
|
-
packageName,
|
|
34389
|
-
version: getDependencyDeclaration({
|
|
34390
|
-
packageName,
|
|
34391
|
-
packageJson,
|
|
34392
|
-
sections: REACT_THREE_FIBER_SECTIONS
|
|
34393
|
-
}).version
|
|
34394
|
-
});
|
|
34395
|
-
if (version === null) continue;
|
|
34396
|
-
if (shouldReplaceWithLowerMajor(facts.reactThreeFiber.version, version)) facts.reactThreeFiber = {
|
|
34397
|
-
packageName,
|
|
34398
|
-
version,
|
|
34399
|
-
sourceDirectory: directory
|
|
34400
|
-
};
|
|
34401
|
-
}
|
|
34402
|
-
const threeVersion = resolveCatalogBackedDependencyVersion({
|
|
34403
|
-
rootDirectory,
|
|
34404
|
-
rootPackageJson,
|
|
34405
|
-
sourceDirectory: directory,
|
|
34406
|
-
sourcePackageJson: packageJson,
|
|
34407
|
-
packageName: "three",
|
|
34408
|
-
version: getDependencyDeclaration({
|
|
34409
|
-
packageName: "three",
|
|
34410
|
-
packageJson,
|
|
34411
|
-
sections: THREE_DEPENDENCY_SECTIONS
|
|
34412
|
-
}).version
|
|
34413
|
-
});
|
|
34414
|
-
if (threeVersion !== null) {
|
|
34415
|
-
const currentRelease = parseThreeRelease(facts.threeVersion);
|
|
34416
|
-
const nextRelease = parseThreeRelease(threeVersion);
|
|
34417
|
-
if (facts.threeVersion === null || nextRelease !== null && (currentRelease === null || nextRelease < currentRelease)) facts.threeVersion = threeVersion;
|
|
34418
|
-
}
|
|
34419
34229
|
facts.hasReactNativeAwarePackage = facts.hasReactNativeAwarePackage || isPackageJsonReactNativeAware(packageJson);
|
|
34420
34230
|
facts.hasReanimatedAwarePackage = facts.hasReanimatedAwarePackage || isPackageJsonReanimatedAware(packageJson);
|
|
34421
34231
|
facts.hasSsrDependency = facts.hasSsrDependency || isPackageJsonSsrAware(packageJson);
|
|
34422
|
-
const remotionSpec = getDependencySpec(packageJson, "remotion");
|
|
34423
|
-
if (remotionSpec !== null) {
|
|
34424
|
-
facts.hasRemotionDependency = true;
|
|
34425
|
-
const resolvedRemotionVersion = resolveCatalogBackedDependencyVersion({
|
|
34426
|
-
rootDirectory,
|
|
34427
|
-
rootPackageJson,
|
|
34428
|
-
packageName: "remotion",
|
|
34429
|
-
version: remotionSpec
|
|
34430
|
-
});
|
|
34431
|
-
const remotionMajorVersion = resolvedRemotionVersion === null ? null : getLowestDependencyMajor(resolvedRemotionVersion);
|
|
34432
|
-
if (remotionMajorVersion === null) {
|
|
34433
|
-
facts.hasUnknownRemotionVersion = true;
|
|
34434
|
-
facts.remotionVersion = null;
|
|
34435
|
-
} else if (!facts.hasUnknownRemotionVersion) {
|
|
34436
|
-
const currentRemotionMajorVersion = facts.remotionVersion === null ? null : getLowestDependencyMajor(facts.remotionVersion);
|
|
34437
|
-
if (currentRemotionMajorVersion === null || remotionMajorVersion < currentRemotionMajorVersion) facts.remotionVersion = resolvedRemotionVersion;
|
|
34438
|
-
}
|
|
34439
|
-
}
|
|
34440
|
-
facts.hasThree = facts.hasThree || THREE_DEPENDENCY_NAMES.some((dependencyName) => getDependencySpec(packageJson, dependencyName) !== null);
|
|
34441
|
-
facts.hasReactThreeFiber = facts.hasReactThreeFiber || REACT_THREE_FIBER_ECOSYSTEM_DEPENDENCY_NAMES.some((dependencyName) => getDependencySpec(packageJson, dependencyName) !== null);
|
|
34442
34232
|
};
|
|
34443
34233
|
const collectWorkspaceFacts = (rootDirectory, rootPackageJson, { collectReactGroup }) => {
|
|
34444
34234
|
const facts = {
|
|
@@ -34458,41 +34248,16 @@ const collectWorkspaceFacts = (rootDirectory, rootPackageJson, { collectReactGro
|
|
|
34458
34248
|
version: null,
|
|
34459
34249
|
sourceDirectory: null
|
|
34460
34250
|
},
|
|
34461
|
-
valtioVersion: null,
|
|
34462
|
-
mobx: {
|
|
34463
|
-
version: null,
|
|
34464
|
-
sourceDirectory: null
|
|
34465
|
-
},
|
|
34466
|
-
hasMobxReact: false,
|
|
34467
|
-
mobxReactVersion: null,
|
|
34468
|
-
hasMobxReactLite: false,
|
|
34469
|
-
mobxReactLiteVersion: null,
|
|
34470
|
-
hasMobxStateTree: false,
|
|
34471
|
-
hasMobxReactObserver: false,
|
|
34472
|
-
zustand: {
|
|
34473
|
-
version: null,
|
|
34474
|
-
sourceDirectory: null
|
|
34475
|
-
},
|
|
34476
34251
|
tanstackQueryVersion: null,
|
|
34252
|
+
mobxVersion: null,
|
|
34477
34253
|
styledComponentsVersion: null,
|
|
34478
34254
|
hasI18nLibrary: false,
|
|
34479
34255
|
hasReactNativeAwarePackage: false,
|
|
34480
34256
|
hasReanimatedAwarePackage: false,
|
|
34481
34257
|
hasSsrDependency: false,
|
|
34482
|
-
hasRemotionDependency: false,
|
|
34483
|
-
hasUnknownRemotionVersion: false,
|
|
34484
|
-
remotionVersion: null,
|
|
34485
|
-
hasThree: false,
|
|
34486
|
-
threeVersion: null,
|
|
34487
|
-
hasReactThreeFiber: false,
|
|
34488
|
-
reactThreeFiber: {
|
|
34489
|
-
packageName: null,
|
|
34490
|
-
version: null,
|
|
34491
|
-
sourceDirectory: null
|
|
34492
|
-
},
|
|
34493
34258
|
reanimatedVersion: null
|
|
34494
34259
|
};
|
|
34495
|
-
evaluateManifestFacts(facts, rootPackageJson, rootDirectory
|
|
34260
|
+
evaluateManifestFacts(facts, rootPackageJson, rootDirectory);
|
|
34496
34261
|
let isReactGroupSettled = !collectReactGroup;
|
|
34497
34262
|
const visitedDirectories = /* @__PURE__ */ new Set();
|
|
34498
34263
|
for (const pattern of getWorkspacePatterns(rootDirectory, rootPackageJson)) {
|
|
@@ -34501,7 +34266,7 @@ const collectWorkspaceFacts = (rootDirectory, rootPackageJson, { collectReactGro
|
|
|
34501
34266
|
if (visitedDirectories.has(workspaceDirectory)) continue;
|
|
34502
34267
|
visitedDirectories.add(workspaceDirectory);
|
|
34503
34268
|
const workspacePackageJson = readPackageJson(Path.join(workspaceDirectory, "package.json"));
|
|
34504
|
-
evaluateManifestFacts(facts, workspacePackageJson, workspaceDirectory
|
|
34269
|
+
evaluateManifestFacts(facts, workspacePackageJson, workspaceDirectory);
|
|
34505
34270
|
const info = extractDependencyInfo(workspacePackageJson);
|
|
34506
34271
|
if (info.framework !== "unknown" && frameworkMergeRank(info.framework) < frameworkMergeRank(facts.framework)) facts.framework = info.framework;
|
|
34507
34272
|
if (isReactGroupSettled) continue;
|
|
@@ -34532,7 +34297,7 @@ const collectWorkspaceFacts = (rootDirectory, rootPackageJson, { collectReactGro
|
|
|
34532
34297
|
workspaceDirectory,
|
|
34533
34298
|
workspacePackageJson
|
|
34534
34299
|
});
|
|
34535
|
-
if (reactVersion &&
|
|
34300
|
+
if (reactVersion && shouldReplaceReactVersion(facts.reactVersion, reactVersion)) facts.reactVersion = reactVersion;
|
|
34536
34301
|
if (tailwindVersion && !facts.tailwindVersion) facts.tailwindVersion = tailwindVersion;
|
|
34537
34302
|
if (zodVersion && !facts.zodVersion) facts.zodVersion = zodVersion;
|
|
34538
34303
|
const settledReactMajor = parseReactMajor(facts.reactVersion);
|
|
@@ -34725,35 +34490,15 @@ const discoverProjectWithoutPackageJson = (directory) => {
|
|
|
34725
34490
|
tailwindVersion: null,
|
|
34726
34491
|
zodVersion: null,
|
|
34727
34492
|
zodMajorVersion: null,
|
|
34728
|
-
mobxVersion: null,
|
|
34729
|
-
mobxMajorVersion: null,
|
|
34730
|
-
hasMobxReact: false,
|
|
34731
|
-
mobxReactVersion: null,
|
|
34732
|
-
hasMobxReactLite: false,
|
|
34733
|
-
mobxReactLiteVersion: null,
|
|
34734
|
-
hasMobxStateTree: false,
|
|
34735
|
-
hasMobxReactObserver: false,
|
|
34736
|
-
zustandVersion: null,
|
|
34737
|
-
zustandMajorVersion: null,
|
|
34738
34493
|
framework: "unknown",
|
|
34739
34494
|
hasTypeScript: hasOwnTsConfig,
|
|
34740
34495
|
hasReactCompiler: false,
|
|
34741
34496
|
hasReactCompilerLintPlugin: false,
|
|
34742
34497
|
hasTanStackQuery: false,
|
|
34743
|
-
valtioVersion: null,
|
|
34744
|
-
valtioMajorVersion: null,
|
|
34745
|
-
hasRemotion: false,
|
|
34746
|
-
remotionVersion: null,
|
|
34747
|
-
remotionMajorVersion: null,
|
|
34748
34498
|
hasI18nLibrary: false,
|
|
34749
34499
|
tanstackQueryVersion: null,
|
|
34500
|
+
mobxVersion: null,
|
|
34750
34501
|
styledComponentsVersion: null,
|
|
34751
|
-
hasThree: false,
|
|
34752
|
-
threeVersion: null,
|
|
34753
|
-
threeRelease: null,
|
|
34754
|
-
hasReactThreeFiber: false,
|
|
34755
|
-
reactThreeFiberVersion: null,
|
|
34756
|
-
reactThreeFiberMajorVersion: null,
|
|
34757
34502
|
hasSsrDependency: false,
|
|
34758
34503
|
preactVersion: null,
|
|
34759
34504
|
preactMajorVersion: null,
|
|
@@ -34852,12 +34597,6 @@ const discoverProject = (directory) => {
|
|
|
34852
34597
|
packageName: SHOPIFY_FLASH_LIST_PACKAGE_NAME,
|
|
34853
34598
|
version: workspaceFacts.shopifyFlashList.version
|
|
34854
34599
|
}) : null;
|
|
34855
|
-
const zustandVersion = resolveCatalogBackedDependencyVersion({
|
|
34856
|
-
rootDirectory: directory,
|
|
34857
|
-
rootPackageJson: packageJson,
|
|
34858
|
-
packageName: "zustand",
|
|
34859
|
-
version: workspaceFacts.zustand.version
|
|
34860
|
-
});
|
|
34861
34600
|
const hasReanimated = hasReactNativeWorkspace && workspaceFacts.hasReanimatedAwarePackage;
|
|
34862
34601
|
const reanimatedVersion = hasReanimated ? workspaceFacts.reanimatedVersion : null;
|
|
34863
34602
|
const nextjsVersion = framework === "nextjs" ? resolveCatalogBackedDependencyVersion({
|
|
@@ -34866,33 +34605,8 @@ const discoverProject = (directory) => {
|
|
|
34866
34605
|
packageName: "next",
|
|
34867
34606
|
version: workspaceFacts.next.version
|
|
34868
34607
|
}) : null;
|
|
34869
|
-
const valtioVersion = resolveCatalogBackedDependencyVersion({
|
|
34870
|
-
rootDirectory: directory,
|
|
34871
|
-
rootPackageJson: packageJson,
|
|
34872
|
-
packageName: "valtio",
|
|
34873
|
-
version: workspaceFacts.valtioVersion
|
|
34874
|
-
});
|
|
34875
|
-
const mobxVersion = resolveCatalogBackedDependencyVersion({
|
|
34876
|
-
rootDirectory: directory,
|
|
34877
|
-
rootPackageJson: packageJson,
|
|
34878
|
-
packageName: "mobx",
|
|
34879
|
-
version: workspaceFacts.mobx.version
|
|
34880
|
-
});
|
|
34881
34608
|
const preactVersion = getPreactVersion(packageJson);
|
|
34882
|
-
const remotionVersion = workspaceFacts.remotionVersion;
|
|
34883
34609
|
const tanstackQueryVersion = getTanStackQueryVersion(packageJson) ?? workspaceFacts.tanstackQueryVersion;
|
|
34884
|
-
const reactThreeFiberVersion = workspaceFacts.reactThreeFiber.packageName ? resolveCatalogBackedDependencyVersion({
|
|
34885
|
-
rootDirectory: directory,
|
|
34886
|
-
rootPackageJson: packageJson,
|
|
34887
|
-
packageName: workspaceFacts.reactThreeFiber.packageName,
|
|
34888
|
-
version: workspaceFacts.reactThreeFiber.version
|
|
34889
|
-
}) : null;
|
|
34890
|
-
const threeVersion = resolveCatalogBackedDependencyVersion({
|
|
34891
|
-
rootDirectory: directory,
|
|
34892
|
-
rootPackageJson: packageJson,
|
|
34893
|
-
packageName: "three",
|
|
34894
|
-
version: workspaceFacts.threeVersion
|
|
34895
|
-
});
|
|
34896
34610
|
const isPreES2023Target = hasTypeScript && detectPreES2023Target(directory);
|
|
34897
34611
|
const projectInfo = {
|
|
34898
34612
|
rootDirectory: directory,
|
|
@@ -34902,16 +34616,6 @@ const discoverProject = (directory) => {
|
|
|
34902
34616
|
tailwindVersion,
|
|
34903
34617
|
zodVersion,
|
|
34904
34618
|
zodMajorVersion: zodVersion === null ? null : getLowestDependencyMajor(zodVersion),
|
|
34905
|
-
mobxVersion,
|
|
34906
|
-
mobxMajorVersion: mobxVersion === null ? null : getDependencyMajorWithinSupportedRange(mobxVersion, 6),
|
|
34907
|
-
hasMobxReact: workspaceFacts.hasMobxReact,
|
|
34908
|
-
mobxReactVersion: workspaceFacts.mobxReactVersion,
|
|
34909
|
-
hasMobxReactLite: workspaceFacts.hasMobxReactLite,
|
|
34910
|
-
mobxReactLiteVersion: workspaceFacts.mobxReactLiteVersion,
|
|
34911
|
-
hasMobxStateTree: workspaceFacts.hasMobxStateTree,
|
|
34912
|
-
hasMobxReactObserver: workspaceFacts.hasMobxReactObserver,
|
|
34913
|
-
zustandVersion,
|
|
34914
|
-
zustandMajorVersion: zustandVersion === null ? null : getLowestDependencyMajor(zustandVersion),
|
|
34915
34619
|
framework,
|
|
34916
34620
|
hasTypeScript,
|
|
34917
34621
|
hasReactCompiler: detectReactCompiler(directory, packageJson),
|
|
@@ -34919,18 +34623,8 @@ const discoverProject = (directory) => {
|
|
|
34919
34623
|
hasTanStackQuery: tanstackQueryVersion !== null,
|
|
34920
34624
|
hasI18nLibrary: workspaceFacts.hasI18nLibrary,
|
|
34921
34625
|
tanstackQueryVersion,
|
|
34626
|
+
mobxVersion: workspaceFacts.mobxVersion,
|
|
34922
34627
|
styledComponentsVersion: workspaceFacts.styledComponentsVersion,
|
|
34923
|
-
valtioVersion,
|
|
34924
|
-
valtioMajorVersion: valtioVersion === null ? null : getLowestDependencyMajor(valtioVersion),
|
|
34925
|
-
hasRemotion: workspaceFacts.hasRemotionDependency,
|
|
34926
|
-
remotionVersion,
|
|
34927
|
-
remotionMajorVersion: remotionVersion === null ? null : getLowestDependencyMajor(remotionVersion),
|
|
34928
|
-
hasThree: workspaceFacts.hasThree,
|
|
34929
|
-
threeVersion,
|
|
34930
|
-
threeRelease: parseThreeRelease(threeVersion),
|
|
34931
|
-
hasReactThreeFiber: workspaceFacts.hasReactThreeFiber,
|
|
34932
|
-
reactThreeFiberVersion,
|
|
34933
|
-
reactThreeFiberMajorVersion: reactThreeFiberVersion === null ? null : getLowestDependencyMajor(reactThreeFiberVersion),
|
|
34934
34628
|
hasSsrDependency: workspaceFacts.hasSsrDependency,
|
|
34935
34629
|
preactVersion,
|
|
34936
34630
|
preactMajorVersion: parseReactMajor(preactVersion),
|
|
@@ -37450,25 +37144,9 @@ const BABEL_CONFIG_FILE_NAMES = [
|
|
|
37450
37144
|
".babelrc.json"
|
|
37451
37145
|
];
|
|
37452
37146
|
const LEGACY_PRESET_SPEC = "module:metro-react-native-babel-preset";
|
|
37453
|
-
const LEGACY_PRESET_PACKAGE = "metro-react-native-babel-preset";
|
|
37454
|
-
const REACT_NATIVE_PACKAGE = "react-native";
|
|
37455
|
-
const PRESET_RENAME_MINIMUM_REACT_NATIVE_VERSION = "0.73.0";
|
|
37456
|
-
const LEGACY_PRESET_REFERENCE = new RegExp(`['"]${LEGACY_PRESET_SPEC}['"]`);
|
|
37457
37147
|
const MODERN_PRESET_REFERENCE = new RegExp(`['"]module:@react-native/babel-preset['"]`);
|
|
37458
37148
|
const ENABLE_BABEL_RUNTIME_VERSION = /enableBabelRuntime["']?\s*:\s*['"]/;
|
|
37459
|
-
const isReactNativeVersionAtLeastPresetRename = (rootDirectory, packageJson) => {
|
|
37460
|
-
const installedReactNativeManifestPath = Path.join(rootDirectory, "node_modules", REACT_NATIVE_PACKAGE, "package.json");
|
|
37461
|
-
const reactNativeVersionSpec = (isFile(installedReactNativeManifestPath) ? readPackageJson(installedReactNativeManifestPath).version : void 0) ?? getDependencySpec(packageJson, REACT_NATIVE_PACKAGE);
|
|
37462
|
-
if (reactNativeVersionSpec === null || reactNativeVersionSpec === void 0) return false;
|
|
37463
|
-
const normalizedVersionRange = import_semver.validRange(reactNativeVersionSpec);
|
|
37464
|
-
if (normalizedVersionRange === null) return false;
|
|
37465
|
-
const minimumVersion = import_semver.minVersion(normalizedVersionRange);
|
|
37466
|
-
return minimumVersion !== null && import_semver.gte(minimumVersion, PRESET_RENAME_MINIMUM_REACT_NATIVE_VERSION);
|
|
37467
|
-
};
|
|
37468
|
-
const canResolveLegacyPreset = (rootDirectory, packageJson) => getDependencySpec(packageJson, LEGACY_PRESET_PACKAGE) !== null || isFile(Path.join(rootDirectory, "node_modules", LEGACY_PRESET_PACKAGE, "package.json"));
|
|
37469
37149
|
const checkReactNativeMetroBabelPreset = (rootDirectory) => {
|
|
37470
|
-
const packageJson = readPackageJson(Path.join(rootDirectory, "package.json"));
|
|
37471
|
-
const shouldReportLegacyPreset = isReactNativeVersionAtLeastPresetRename(rootDirectory, packageJson) && !canResolveLegacyPreset(rootDirectory, packageJson);
|
|
37472
37150
|
for (const fileName of BABEL_CONFIG_FILE_NAMES) {
|
|
37473
37151
|
const filePath = Path.join(rootDirectory, fileName);
|
|
37474
37152
|
if (!isFile(filePath)) continue;
|
|
@@ -37478,7 +37156,7 @@ const checkReactNativeMetroBabelPreset = (rootDirectory) => {
|
|
|
37478
37156
|
} catch {
|
|
37479
37157
|
continue;
|
|
37480
37158
|
}
|
|
37481
|
-
if (
|
|
37159
|
+
if (contents.includes(LEGACY_PRESET_SPEC)) return [buildReactNativeDiagnostic({
|
|
37482
37160
|
filePath: fileName,
|
|
37483
37161
|
rule: "rn-no-metro-babel-preset",
|
|
37484
37162
|
severity: "error",
|
|
@@ -37501,6 +37179,12 @@ const checkReactNativeProject = (rootDirectory, project) => {
|
|
|
37501
37179
|
return [...checkReactNativeMetroBabelPreset(rootDirectory), ...checkReactNativeLibraryDependencies(rootDirectory)];
|
|
37502
37180
|
};
|
|
37503
37181
|
const RULE_KEY = "no-vulnerable-react-server-components";
|
|
37182
|
+
const DEPENDENCY_SECTIONS = [
|
|
37183
|
+
"dependencies",
|
|
37184
|
+
"devDependencies",
|
|
37185
|
+
"peerDependencies",
|
|
37186
|
+
"optionalDependencies"
|
|
37187
|
+
];
|
|
37504
37188
|
const REACT_RSC_ADVISORIES_BY_MINOR = {
|
|
37505
37189
|
"19.0": {
|
|
37506
37190
|
rceFixedVersion: "19.0.1",
|
|
@@ -37547,13 +37231,20 @@ const enumerateWorkspaceDirectories = (workspaceRoot) => {
|
|
|
37547
37231
|
for (const pattern of patterns) for (const directory of resolveWorkspaceDirectories(workspaceRoot, pattern)) directories.add(directory);
|
|
37548
37232
|
return [...directories];
|
|
37549
37233
|
};
|
|
37234
|
+
const readDeclaredSpec = (packageJson, packageName) => {
|
|
37235
|
+
for (const section of DEPENDENCY_SECTIONS) {
|
|
37236
|
+
const spec = packageJson[section]?.[packageName];
|
|
37237
|
+
if (typeof spec === "string") return spec;
|
|
37238
|
+
}
|
|
37239
|
+
return null;
|
|
37240
|
+
};
|
|
37550
37241
|
const resolveVersionInDirectory = (directory, packageName, declaredSpecOverride) => {
|
|
37551
37242
|
const manifestPath = Path.join(directory, "node_modules", packageName, "package.json");
|
|
37552
37243
|
if (isFile(manifestPath)) {
|
|
37553
37244
|
const installedVersion = import_semver.valid(readPackageJson(manifestPath).version ?? null);
|
|
37554
37245
|
if (installedVersion !== null) return installedVersion;
|
|
37555
37246
|
}
|
|
37556
|
-
const candidateSpecs = [
|
|
37247
|
+
const candidateSpecs = [readDeclaredSpec(readPackageJson(Path.join(directory, "package.json")), packageName), declaredSpecOverride];
|
|
37557
37248
|
for (const spec of candidateSpecs) {
|
|
37558
37249
|
const pinnedVersion = spec === null ? null : import_semver.valid(spec);
|
|
37559
37250
|
if (pinnedVersion !== null) return pinnedVersion;
|
|
@@ -38205,10 +37896,10 @@ const SSR_FRAMEWORKS = new Set([
|
|
|
38205
37896
|
"gatsby",
|
|
38206
37897
|
"tanstack-start"
|
|
38207
37898
|
]);
|
|
38208
|
-
const
|
|
38209
|
-
if (
|
|
38210
|
-
const
|
|
38211
|
-
for (let candidate = earliest; candidate <=
|
|
37899
|
+
const addMajorLadder = (capabilities, name, major, earliest, latest) => {
|
|
37900
|
+
if (major === null) return;
|
|
37901
|
+
const cappedMajor = Math.min(major, latest);
|
|
37902
|
+
for (let candidate = earliest; candidate <= cappedMajor; candidate += 1) capabilities.add(`${name}:${candidate}`);
|
|
38212
37903
|
};
|
|
38213
37904
|
const buildCapabilities = (project) => {
|
|
38214
37905
|
const capabilities = /* @__PURE__ */ new Set();
|
|
@@ -38222,76 +37913,31 @@ const buildCapabilities = (project) => {
|
|
|
38222
37913
|
if (project.isStaticExport) capabilities.add("nextjs:static-export");
|
|
38223
37914
|
if (project.nextjsMajorVersion !== null && project.nextjsMajorVersion >= 15) capabilities.add("nextjs:15");
|
|
38224
37915
|
if (project.nextjsMajorVersion !== null && project.nextjsMajorVersion >= 16) capabilities.add("nextjs:16");
|
|
38225
|
-
|
|
37916
|
+
addMajorLadder(capabilities, "react", project.reactMajorVersion, 17, 30);
|
|
38226
37917
|
if (project.reactMajorVersion !== null && project.reactMajorVersion >= 19 && isMajorMinorAtLeast(parseReactMajorMinor(project.reactVersion), {
|
|
38227
37918
|
major: 19,
|
|
38228
37919
|
minor: 2
|
|
38229
37920
|
})) capabilities.add("react:19.2");
|
|
38230
|
-
if (project.tailwindVersion !== null)
|
|
38231
|
-
|
|
38232
|
-
|
|
38233
|
-
|
|
38234
|
-
|
|
38235
|
-
minor: 4
|
|
38236
|
-
})) capabilities.add("tailwind:3.4");
|
|
38237
|
-
if (tailwindVersion !== null && isMajorMinorAtLeast(tailwindVersion, {
|
|
38238
|
-
major: 4,
|
|
38239
|
-
minor: 0
|
|
38240
|
-
})) capabilities.add("tailwind:4");
|
|
38241
|
-
}
|
|
37921
|
+
if (project.tailwindVersion !== null) capabilities.add("tailwind");
|
|
37922
|
+
if (project.tailwindVersion !== null && isMajorMinorAtLeast(parseTailwindMajorMinor(project.tailwindVersion), {
|
|
37923
|
+
major: 3,
|
|
37924
|
+
minor: 4
|
|
37925
|
+
})) capabilities.add("tailwind:3.4");
|
|
38242
37926
|
if (project.zodVersion !== null) capabilities.add("zod");
|
|
38243
37927
|
if (project.zodMajorVersion !== null && project.zodMajorVersion >= 4) capabilities.add("zod:4");
|
|
38244
|
-
if (project.mobxVersion !== void 0 && project.mobxVersion !== null || project.hasMobxReact === true || project.hasMobxReactLite === true || project.hasMobxStateTree === true || project.hasMobxReactObserver === true) capabilities.add("mobx");
|
|
38245
|
-
if (project.hasMobxReact === true) capabilities.add("mobx-react");
|
|
38246
|
-
if (project.hasMobxReactLite === true) capabilities.add("mobx-react-lite");
|
|
38247
|
-
if (project.hasMobxReact === true || project.hasMobxReactLite === true) capabilities.add("mobx-react-binding");
|
|
38248
|
-
const mobxReactVersion = parseDependencyMajorMinor(project.mobxReactVersion);
|
|
38249
|
-
const mobxReactLiteVersion = parseDependencyMajorMinor(project.mobxReactLiteVersion);
|
|
38250
|
-
const hasMobxReactObserverMemoGuard = mobxReactVersion !== null && isMajorMinorAtLeast(mobxReactVersion, {
|
|
38251
|
-
major: 7,
|
|
38252
|
-
minor: 3
|
|
38253
|
-
});
|
|
38254
|
-
const hasMobxReactLiteObserverMemoGuard = mobxReactLiteVersion !== null && isMajorMinorAtLeast(mobxReactLiteVersion, {
|
|
38255
|
-
major: 3,
|
|
38256
|
-
minor: 3
|
|
38257
|
-
});
|
|
38258
|
-
if (hasMobxReactObserverMemoGuard) capabilities.add("mobx-react-observer-memo-guard");
|
|
38259
|
-
if (hasMobxReactLiteObserverMemoGuard) capabilities.add("mobx-react-lite-observer-memo-guard");
|
|
38260
|
-
if (hasMobxReactObserverMemoGuard || hasMobxReactLiteObserverMemoGuard) capabilities.add("mobx-react-binding-observer-memo-guard");
|
|
38261
|
-
if (project.hasMobxStateTree === true) capabilities.add("mobx-state-tree");
|
|
38262
|
-
if (project.hasMobxReactObserver === true) capabilities.add("mobx-react-observer");
|
|
38263
|
-
if (project.mobxMajorVersion !== void 0 && project.mobxMajorVersion !== null && project.mobxMajorVersion >= 4 && project.mobxMajorVersion <= 6) addVersionCapabilityLadder(capabilities, "mobx", project.mobxMajorVersion, 4, 6);
|
|
38264
|
-
const mobxVersion = parseDependencyMajorMinor(project.mobxVersion);
|
|
38265
|
-
if (project.mobxMajorVersion === 6 && mobxVersion !== null && isMajorMinorAtLeast(mobxVersion, {
|
|
38266
|
-
major: 6,
|
|
38267
|
-
minor: 10
|
|
38268
|
-
})) capabilities.add("mobx:6.10");
|
|
38269
|
-
if (project.zustandVersion !== void 0 && project.zustandVersion !== null) capabilities.add("zustand");
|
|
38270
|
-
if (project.zustandMajorVersion !== void 0 && project.zustandMajorVersion !== null && project.zustandMajorVersion >= 1 && project.zustandMajorVersion <= 5) addVersionCapabilityLadder(capabilities, "zustand", project.zustandMajorVersion, 1, 5);
|
|
38271
37928
|
if (project.isPreES2023Target) capabilities.add("pre-es2023");
|
|
38272
37929
|
if (project.hasReactCompiler) capabilities.add("react-compiler");
|
|
38273
37930
|
if (Boolean(project.hasTanStackQuery) || Boolean(project.tanstackQueryVersion)) capabilities.add("tanstack-query");
|
|
37931
|
+
if (project.mobxVersion) capabilities.add("mobx");
|
|
38274
37932
|
if (project.styledComponentsVersion) {
|
|
38275
37933
|
capabilities.add("styled-components");
|
|
38276
37934
|
const styledComponentsMajor = getLowestDependencyMajor(project.styledComponentsVersion);
|
|
38277
37935
|
if (styledComponentsMajor !== null && styledComponentsMajor >= 6) capabilities.add("styled-components:6");
|
|
38278
37936
|
}
|
|
38279
37937
|
if (project.hasI18nLibrary) capabilities.add("i18n");
|
|
38280
|
-
if (project.valtioVersion !== null) capabilities.add("valtio");
|
|
38281
|
-
addVersionCapabilityLadder(capabilities, "valtio", project.valtioMajorVersion, 1, 10);
|
|
38282
|
-
if (project.hasRemotion) {
|
|
38283
|
-
capabilities.add("remotion");
|
|
38284
|
-
addVersionCapabilityLadder(capabilities, "remotion", project.remotionMajorVersion ?? null, 4, 30);
|
|
38285
|
-
}
|
|
38286
|
-
if (project.hasThree || project.hasReactThreeFiber) capabilities.add("three");
|
|
38287
|
-
addVersionCapabilityLadder(capabilities, "three", project.threeRelease ?? null, 145, 250);
|
|
38288
|
-
if (project.hasReactThreeFiber) {
|
|
38289
|
-
capabilities.add("r3f");
|
|
38290
|
-
addVersionCapabilityLadder(capabilities, "r3f", project.reactThreeFiberMajorVersion ?? null, 3, 10);
|
|
38291
|
-
}
|
|
38292
37938
|
if (project.hasTypeScript) capabilities.add("typescript");
|
|
38293
37939
|
if (project.preactVersion !== null) capabilities.add("preact");
|
|
38294
|
-
|
|
37940
|
+
addMajorLadder(capabilities, "preact", project.preactMajorVersion, 10, 20);
|
|
38295
37941
|
if (project.preactVersion !== null && project.reactVersion === null) capabilities.add("pure-preact");
|
|
38296
37942
|
return capabilities;
|
|
38297
37943
|
};
|
|
@@ -38303,7 +37949,7 @@ const getCapabilities = (project) => {
|
|
|
38303
37949
|
capabilitiesByProject.set(project, capabilities);
|
|
38304
37950
|
return capabilities;
|
|
38305
37951
|
};
|
|
38306
|
-
const shouldEnableRule = (requires, tags, capabilities, ignoredTags, disabledWhen
|
|
37952
|
+
const shouldEnableRule = (requires, tags, capabilities, ignoredTags, disabledWhen) => {
|
|
38307
37953
|
if (requires) {
|
|
38308
37954
|
for (const capability of requires) if (!capabilities.has(capability)) return false;
|
|
38309
37955
|
}
|
|
@@ -38314,29 +37960,20 @@ const shouldEnableRule = (requires, tags, capabilities, ignoredTags, disabledWhe
|
|
|
38314
37960
|
if (tags) {
|
|
38315
37961
|
for (const tag of tags) if (ignoredTags.has(tag)) return false;
|
|
38316
37962
|
}
|
|
38317
|
-
if (includedTags && includedTags.size > 0) {
|
|
38318
|
-
if (!tags?.some((tag) => includedTags.has(tag))) return false;
|
|
38319
|
-
}
|
|
38320
37963
|
return true;
|
|
38321
37964
|
};
|
|
38322
|
-
const shouldEnableRuleByDefaultStatus = (options) => options.defaultEnabled !== false || options.hasExplicitOverride === true || options.includeTagDefaults && options.hasIncludedTags;
|
|
38323
37965
|
const yieldToEventLoop = () => new Promise((resolve) => {
|
|
38324
37966
|
setImmediate(resolve);
|
|
38325
37967
|
});
|
|
38326
37968
|
const createSecurityScanSession = (rootDirectory, options) => {
|
|
38327
37969
|
const capabilities = options.project ? getCapabilities(options.project) : /* @__PURE__ */ new Set();
|
|
38328
37970
|
const ignoredTags = options.ignoredTags ?? /* @__PURE__ */ new Set();
|
|
38329
|
-
const includedTags = options.includedTags ?? /* @__PURE__ */ new Set();
|
|
38330
37971
|
const enabledScanRules = REACT_DOCTOR_RULES.flatMap((entry) => {
|
|
38331
37972
|
const rule = entry.rule;
|
|
38332
37973
|
const scan = rule.scan;
|
|
38333
37974
|
if (typeof scan !== "function") return [];
|
|
38334
|
-
if (
|
|
38335
|
-
|
|
38336
|
-
includeTagDefaults: options.includeTagDefaults === true,
|
|
38337
|
-
hasIncludedTags: includedTags.size > 0
|
|
38338
|
-
})) return [];
|
|
38339
|
-
if (!shouldEnableRule(rule.requires, rule.tags, capabilities, ignoredTags, rule.disabledWhen, includedTags)) return [];
|
|
37975
|
+
if (rule.defaultEnabled === false) return [];
|
|
37976
|
+
if (!shouldEnableRule(rule.requires, rule.tags, capabilities, ignoredTags, rule.disabledWhen)) return [];
|
|
38340
37977
|
return [{
|
|
38341
37978
|
entry,
|
|
38342
37979
|
scan,
|
|
@@ -40322,9 +39959,8 @@ const buildUserPluginRules = (userPlugin, severityControls) => {
|
|
|
40322
39959
|
}
|
|
40323
39960
|
return enabled;
|
|
40324
39961
|
};
|
|
40325
|
-
const createOxlintConfig = ({ pluginPath, project, customRulesOnly = false, extendsPaths = [], ignoredTags = /* @__PURE__ */ new Set(),
|
|
40326
|
-
const
|
|
40327
|
-
const reactHooksJsPlugin = disableReactHooksJsPlugin || ruleSelection === "sidecar" || hasIncludedTags ? null : resolveReactHooksJsPlugin(project.hasReactCompiler || project.hasReactCompilerLintPlugin === true, customRulesOnly);
|
|
39962
|
+
const createOxlintConfig = ({ pluginPath, project, customRulesOnly = false, extendsPaths = [], ignoredTags = /* @__PURE__ */ new Set(), serverAuthFunctionNames, severityControls, userPlugins = [], disableReactHooksJsPlugin = false, ruleSelection, sidecarRuleIdFilter }) => {
|
|
39963
|
+
const reactHooksJsPlugin = disableReactHooksJsPlugin || ruleSelection === "sidecar" ? null : resolveReactHooksJsPlugin(project.hasReactCompiler || project.hasReactCompilerLintPlugin === true, customRulesOnly);
|
|
40328
39964
|
const reactCompilerRules = reactHooksJsPlugin ? applyRuleSeverityControls(filterRulesToAvailable(REACT_COMPILER_RULES, "react-hooks-js", reactHooksJsPlugin.availableRuleNames), severityControls) : {};
|
|
40329
39965
|
const jsPlugins = [];
|
|
40330
39966
|
if (reactHooksJsPlugin) jsPlugins.push(reactHooksJsPlugin.entry);
|
|
@@ -40339,14 +39975,9 @@ const createOxlintConfig = ({ pluginPath, project, customRulesOnly = false, exte
|
|
|
40339
39975
|
if (rule.scan !== void 0) continue;
|
|
40340
39976
|
if (customRulesOnly && registryEntry.originallyExternal) continue;
|
|
40341
39977
|
if (rule.framework !== "global" && !rule.requires) continue;
|
|
40342
|
-
if (!shouldEnableRule(rule.requires, rule.tags, capabilities, ignoredTags, rule.disabledWhen
|
|
39978
|
+
if (!shouldEnableRule(rule.requires, rule.tags, capabilities, ignoredTags, rule.disabledWhen)) continue;
|
|
40343
39979
|
const explicitRuleOverride = resolveRuleSeverityOverride({ ruleKey: registryEntry.key }, severityControls);
|
|
40344
|
-
if (
|
|
40345
|
-
defaultEnabled: rule.defaultEnabled,
|
|
40346
|
-
includeTagDefaults,
|
|
40347
|
-
hasIncludedTags,
|
|
40348
|
-
hasExplicitOverride: explicitRuleOverride !== void 0
|
|
40349
|
-
})) continue;
|
|
39980
|
+
if (rule.defaultEnabled === false && explicitRuleOverride === void 0) continue;
|
|
40350
39981
|
const severity = resolveRuleSeverityOverride({
|
|
40351
39982
|
ruleKey: registryEntry.key,
|
|
40352
39983
|
category: rule.category
|
|
@@ -40355,7 +39986,7 @@ const createOxlintConfig = ({ pluginPath, project, customRulesOnly = false, exte
|
|
|
40355
39986
|
enabledReactDoctorRules[registryEntry.key] = severity;
|
|
40356
39987
|
}
|
|
40357
39988
|
const userPluginRules = {};
|
|
40358
|
-
if (ruleSelection !== "sidecar"
|
|
39989
|
+
if (ruleSelection !== "sidecar") for (const userPlugin of userPlugins) {
|
|
40359
39990
|
Object.assign(userPluginRules, buildUserPluginRules(userPlugin, severityControls));
|
|
40360
39991
|
jsPlugins.push(userPlugin.entry);
|
|
40361
39992
|
}
|
|
@@ -42100,7 +41731,7 @@ const reactHooksJsPluginDropNote = (error) => {
|
|
|
42100
41731
|
* 6. always restore disable directives + clean up the temp dir
|
|
42101
41732
|
*/
|
|
42102
41733
|
const runOxlint = async (options) => {
|
|
42103
|
-
const { rootDirectory, project, includePaths, nodeBinaryPath = process.execPath, customRulesOnly = false, respectInlineDisables = true, adoptExistingLintConfig = true, ignoredTags = /* @__PURE__ */ new Set(),
|
|
41734
|
+
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;
|
|
42104
41735
|
const serverAuthFunctionNames = Array.isArray(userConfig?.serverAuthFunctionNames) ? userConfig.serverAuthFunctionNames.filter((entry) => typeof entry === "string" && entry.length > 0) : void 0;
|
|
42105
41736
|
const severityControls = buildRuleSeverityControls(userConfig);
|
|
42106
41737
|
validateRuleRegistration();
|
|
@@ -42114,15 +41745,13 @@ const runOxlint = async (options) => {
|
|
|
42114
41745
|
}
|
|
42115
41746
|
const pluginPath = resolvePluginPath();
|
|
42116
41747
|
const extendsPaths = (adoptExistingLintConfig && !customRulesOnly ? detectUserLintConfigPaths(rootDirectory) : []).filter(canOxlintExtendConfig);
|
|
42117
|
-
const userPlugins =
|
|
41748
|
+
const userPlugins = resolveUserPlugins(userConfig?.plugins, configSourceDirectory);
|
|
42118
41749
|
const buildConfig = (overrides) => createOxlintConfig({
|
|
42119
41750
|
pluginPath,
|
|
42120
41751
|
project,
|
|
42121
41752
|
customRulesOnly,
|
|
42122
41753
|
extendsPaths: overrides.extendsPaths,
|
|
42123
41754
|
ignoredTags,
|
|
42124
|
-
includedTags,
|
|
42125
|
-
includeTagDefaults,
|
|
42126
41755
|
serverAuthFunctionNames,
|
|
42127
41756
|
severityControls,
|
|
42128
41757
|
userPlugins,
|
|
@@ -42511,8 +42140,6 @@ var Linter = class Linter extends Service()("react-doctor/Linter") {
|
|
|
42511
42140
|
respectInlineDisables: input.respectInlineDisables,
|
|
42512
42141
|
adoptExistingLintConfig: input.adoptExistingLintConfig,
|
|
42513
42142
|
ignoredTags: input.ignoredTags,
|
|
42514
|
-
includedTags: input.includedTags,
|
|
42515
|
-
includeTagDefaults: input.includeTagDefaults,
|
|
42516
42143
|
userConfig: input.userConfig ?? null,
|
|
42517
42144
|
configSourceDirectory: input.configSourceDirectory,
|
|
42518
42145
|
onPartialFailure: (reason) => {
|
|
@@ -43361,9 +42988,7 @@ const runInspect = (input, hooks = {}) => gen(function* () {
|
|
|
43361
42988
|
const securityScanFailedRef = yield* make$13(false);
|
|
43362
42989
|
const securityScanFiber = yield* forkChild(runCollect(applyPerElementPipeline(isDiffMode ? empty$4 : unwrap(tryPromise(() => checkSecurityScanCooperative(scanDirectory, {
|
|
43363
42990
|
project,
|
|
43364
|
-
ignoredTags: input.ignoredTags
|
|
43365
|
-
includedTags: input.includedTags,
|
|
43366
|
-
includeTagDefaults: input.includeTagDefaults
|
|
42991
|
+
ignoredTags: input.ignoredTags
|
|
43367
42992
|
})).pipe(map$3((diagnostics) => fromIterable$1(diagnostics)), catch_$1(() => set(securityScanFailedRef, true).pipe(as(empty$4))))))).pipe(withSpan("SecurityScan.run")));
|
|
43368
42993
|
const shouldRunSupplyChain = !isDiffMode || (input.supplyChainManifestChanged ?? false);
|
|
43369
42994
|
const supplyChainOverlapTimeout = yield* SupplyChainOverlapTimeoutMs;
|
|
@@ -43454,8 +43079,6 @@ const runInspect = (input, hooks = {}) => gen(function* () {
|
|
|
43454
43079
|
respectInlineDisables: input.respectInlineDisables,
|
|
43455
43080
|
adoptExistingLintConfig: input.adoptExistingLintConfig,
|
|
43456
43081
|
ignoredTags: input.ignoredTags,
|
|
43457
|
-
includedTags: input.includedTags,
|
|
43458
|
-
includeTagDefaults: input.includeTagDefaults,
|
|
43459
43082
|
userConfig: resolvedConfig.config ?? void 0,
|
|
43460
43083
|
configSourceDirectory: resolvedConfig.configSourceDirectory ?? void 0,
|
|
43461
43084
|
onFileProgress: (scannedFileCount, totalFileCount) => {
|
|
@@ -44316,4 +43939,4 @@ const toJsonReport = (result, options) => buildJsonReport({
|
|
|
44316
43939
|
export { AmbiguousProjectError, NoReactDependencyError, NotADirectoryError, PackageJsonNotFoundError, ProjectNotFoundError, ReactDoctorError, buildJsonReport, buildJsonReportError, clearCaches, defineConfig, diagnose, filterSourceFiles, getDiffInfo, hasReactRuntime, isProjectDiscoveryError, isReactDoctorError, summarizeDiagnostics, toJsonReport };
|
|
44317
43940
|
|
|
44318
43941
|
//# sourceMappingURL=index.js.map
|
|
44319
|
-
//# debugId=
|
|
43942
|
+
//# debugId=d6253eef-925f-579a-9b36-3bbf313293f5
|