react-doctor 0.8.1-dev.3598138 → 0.8.1-dev.412377e
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +14 -4
- package/dist/cli.js +775 -143
- package/dist/index.d.ts +45 -0
- package/dist/index.js +684 -99
- package/dist/lsp.js +684 -99
- package/dist/skills/react-doctor/SKILL.md +5 -0
- package/package.json +3 -3
package/dist/cli.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]="87efffda-8fc4-5b52-80e1-7ec503c85206")}catch(e){}}();
|
|
3
3
|
import { createRequire } from "node:module";
|
|
4
4
|
import * as NodeChildProcess from "node:child_process";
|
|
5
5
|
import { execFile, execFileSync, spawn, spawnSync } from "node:child_process";
|
|
@@ -36022,44 +36022,6 @@ var AmbiguousProjectError = class extends Error {
|
|
|
36022
36022
|
}
|
|
36023
36023
|
};
|
|
36024
36024
|
const isProjectDiscoveryError = (value) => value instanceof ProjectNotFoundError || value instanceof NoReactDependencyError || value instanceof PackageJsonNotFoundError || value instanceof NotADirectoryError || value instanceof AmbiguousProjectError;
|
|
36025
|
-
const isErrnoException = (error) => error instanceof Error && "code" in error;
|
|
36026
|
-
const IGNORABLE_READDIR_ERROR_CODES = new Set([
|
|
36027
|
-
"EACCES",
|
|
36028
|
-
"EPERM",
|
|
36029
|
-
"ENOENT",
|
|
36030
|
-
"ENOTDIR",
|
|
36031
|
-
"EINVAL",
|
|
36032
|
-
"ELOOP",
|
|
36033
|
-
"ENAMETOOLONG"
|
|
36034
|
-
]);
|
|
36035
|
-
const isIgnorableReaddirError = (error) => isErrnoException(error) && typeof error.code === "string" && IGNORABLE_READDIR_ERROR_CODES.has(error.code);
|
|
36036
|
-
const readDirectoryEntries = (directoryPath) => {
|
|
36037
|
-
try {
|
|
36038
|
-
return NFS.readdirSync(directoryPath, { withFileTypes: true });
|
|
36039
|
-
} catch (error) {
|
|
36040
|
-
if (isIgnorableReaddirError(error)) return [];
|
|
36041
|
-
throw error;
|
|
36042
|
-
}
|
|
36043
|
-
};
|
|
36044
|
-
const isFile = (filePath) => {
|
|
36045
|
-
try {
|
|
36046
|
-
return NFS.statSync(filePath).isFile();
|
|
36047
|
-
} catch {
|
|
36048
|
-
return false;
|
|
36049
|
-
}
|
|
36050
|
-
};
|
|
36051
|
-
const isDirectory = (directoryPath) => {
|
|
36052
|
-
try {
|
|
36053
|
-
return NFS.statSync(directoryPath).isDirectory();
|
|
36054
|
-
} catch {
|
|
36055
|
-
return false;
|
|
36056
|
-
}
|
|
36057
|
-
};
|
|
36058
|
-
const isPlainObject = (value) => {
|
|
36059
|
-
if (typeof value !== "object" || value === null || Array.isArray(value)) return false;
|
|
36060
|
-
const prototype = Object.getPrototypeOf(value);
|
|
36061
|
-
return prototype === null || prototype === Object.prototype;
|
|
36062
|
-
};
|
|
36063
36025
|
const SOURCE_FILE_PATTERN = /\.(tsx?|jsx?|mts|mjs)$/;
|
|
36064
36026
|
const GENERATED_BUNDLE_FILE_PATTERN = /\.(iife|umd|global|min)\.m?js$/i;
|
|
36065
36027
|
const GENERATED_SOURCE_DIRECTORY_PATTERN = /(?:^|\/)__generated__\//;
|
|
@@ -36101,6 +36063,58 @@ const IGNORED_DIRECTORIES = new Set([
|
|
|
36101
36063
|
]);
|
|
36102
36064
|
const JSX_FILE_PATTERN = /\.(tsx|jsx)$/;
|
|
36103
36065
|
const MILLISECONDS_PER_SECOND = 1e3;
|
|
36066
|
+
const REACT_ROUTER_CAPABILITY_THRESHOLDS = [
|
|
36067
|
+
{
|
|
36068
|
+
capability: "react-router:6.4",
|
|
36069
|
+
major: 6,
|
|
36070
|
+
minor: 4
|
|
36071
|
+
},
|
|
36072
|
+
{
|
|
36073
|
+
capability: "react-router:6.7",
|
|
36074
|
+
major: 6,
|
|
36075
|
+
minor: 7
|
|
36076
|
+
},
|
|
36077
|
+
{
|
|
36078
|
+
capability: "react-router:6.9",
|
|
36079
|
+
major: 6,
|
|
36080
|
+
minor: 9
|
|
36081
|
+
},
|
|
36082
|
+
{
|
|
36083
|
+
capability: "react-router:6.19",
|
|
36084
|
+
major: 6,
|
|
36085
|
+
minor: 19
|
|
36086
|
+
},
|
|
36087
|
+
{
|
|
36088
|
+
capability: "react-router:7",
|
|
36089
|
+
major: 7,
|
|
36090
|
+
minor: 0
|
|
36091
|
+
},
|
|
36092
|
+
{
|
|
36093
|
+
capability: "react-router:7.8",
|
|
36094
|
+
major: 7,
|
|
36095
|
+
minor: 8
|
|
36096
|
+
},
|
|
36097
|
+
{
|
|
36098
|
+
capability: "react-router:7.9",
|
|
36099
|
+
major: 7,
|
|
36100
|
+
minor: 9
|
|
36101
|
+
},
|
|
36102
|
+
{
|
|
36103
|
+
capability: "react-router:7.10",
|
|
36104
|
+
major: 7,
|
|
36105
|
+
minor: 10
|
|
36106
|
+
},
|
|
36107
|
+
{
|
|
36108
|
+
capability: "react-router:7.15",
|
|
36109
|
+
major: 7,
|
|
36110
|
+
minor: 15
|
|
36111
|
+
},
|
|
36112
|
+
{
|
|
36113
|
+
capability: "react-router:8",
|
|
36114
|
+
major: 8,
|
|
36115
|
+
minor: 0
|
|
36116
|
+
}
|
|
36117
|
+
];
|
|
36104
36118
|
const SCORE_API_URL = "https://www.react.doctor/api/score";
|
|
36105
36119
|
const ENTERPRISE_CONTACT_URL = "https://react.doctor/enterprise";
|
|
36106
36120
|
const SHARE_BASE_URL = "https://react.doctor/share";
|
|
@@ -36252,6 +36266,44 @@ const SUPPLY_CHAIN_OVERLAP_TIMEOUT_MS = 9e4;
|
|
|
36252
36266
|
const SUPPLY_CHAIN_CACHE_TTL_MS = 864e5;
|
|
36253
36267
|
const SUPPLY_CHAIN_CACHE_SUBDIR = "supply-chain";
|
|
36254
36268
|
const SUPPLY_CHAIN_IGNORED_PACKAGES = new Set(["next"]);
|
|
36269
|
+
const isErrnoException = (error) => error instanceof Error && "code" in error;
|
|
36270
|
+
const IGNORABLE_READDIR_ERROR_CODES = new Set([
|
|
36271
|
+
"EACCES",
|
|
36272
|
+
"EPERM",
|
|
36273
|
+
"ENOENT",
|
|
36274
|
+
"ENOTDIR",
|
|
36275
|
+
"EINVAL",
|
|
36276
|
+
"ELOOP",
|
|
36277
|
+
"ENAMETOOLONG"
|
|
36278
|
+
]);
|
|
36279
|
+
const isIgnorableReaddirError = (error) => isErrnoException(error) && typeof error.code === "string" && IGNORABLE_READDIR_ERROR_CODES.has(error.code);
|
|
36280
|
+
const readDirectoryEntries = (directoryPath) => {
|
|
36281
|
+
try {
|
|
36282
|
+
return NFS.readdirSync(directoryPath, { withFileTypes: true });
|
|
36283
|
+
} catch (error) {
|
|
36284
|
+
if (isIgnorableReaddirError(error)) return [];
|
|
36285
|
+
throw error;
|
|
36286
|
+
}
|
|
36287
|
+
};
|
|
36288
|
+
const isFile = (filePath) => {
|
|
36289
|
+
try {
|
|
36290
|
+
return NFS.statSync(filePath).isFile();
|
|
36291
|
+
} catch {
|
|
36292
|
+
return false;
|
|
36293
|
+
}
|
|
36294
|
+
};
|
|
36295
|
+
const isDirectory = (directoryPath) => {
|
|
36296
|
+
try {
|
|
36297
|
+
return NFS.statSync(directoryPath).isDirectory();
|
|
36298
|
+
} catch {
|
|
36299
|
+
return false;
|
|
36300
|
+
}
|
|
36301
|
+
};
|
|
36302
|
+
const isPlainObject = (value) => {
|
|
36303
|
+
if (typeof value !== "object" || value === null || Array.isArray(value)) return false;
|
|
36304
|
+
const prototype = Object.getPrototypeOf(value);
|
|
36305
|
+
return prototype === null || prototype === Object.prototype;
|
|
36306
|
+
};
|
|
36255
36307
|
const lastSourceMappingUrl = (fileContent) => {
|
|
36256
36308
|
const lastReference = [...fileContent.matchAll(/\/\/# sourceMappingURL=(\S+)/g)].at(-1);
|
|
36257
36309
|
return lastReference ? lastReference[1] : null;
|
|
@@ -36571,10 +36623,10 @@ const FALLBACK_TSCONFIG_FILENAMES = ["tsconfig.app.json", "tsconfig.build.json"]
|
|
|
36571
36623
|
const FRAMEWORK_PACKAGES = {
|
|
36572
36624
|
next: "nextjs",
|
|
36573
36625
|
"@tanstack/react-start": "tanstack-start",
|
|
36574
|
-
vite: "vite",
|
|
36575
|
-
"react-scripts": "cra",
|
|
36576
36626
|
"@remix-run/react": "remix",
|
|
36577
36627
|
gatsby: "gatsby",
|
|
36628
|
+
vite: "vite",
|
|
36629
|
+
"react-scripts": "cra",
|
|
36578
36630
|
expo: "expo",
|
|
36579
36631
|
"react-native": "react-native"
|
|
36580
36632
|
};
|
|
@@ -36598,11 +36650,17 @@ const NEXT_CONFIG_FILENAMES = [
|
|
|
36598
36650
|
];
|
|
36599
36651
|
const BABEL_CONFIG_FILENAMES = [
|
|
36600
36652
|
".babelrc",
|
|
36653
|
+
".babelrc.js",
|
|
36601
36654
|
".babelrc.json",
|
|
36655
|
+
".babelrc.cjs",
|
|
36656
|
+
".babelrc.mjs",
|
|
36657
|
+
".babelrc.cts",
|
|
36602
36658
|
"babel.config.js",
|
|
36603
36659
|
"babel.config.json",
|
|
36604
36660
|
"babel.config.cjs",
|
|
36605
|
-
"babel.config.mjs"
|
|
36661
|
+
"babel.config.mjs",
|
|
36662
|
+
"babel.config.ts",
|
|
36663
|
+
"babel.config.cts"
|
|
36606
36664
|
];
|
|
36607
36665
|
const VITE_CONFIG_FILENAMES = [
|
|
36608
36666
|
"vite.config.js",
|
|
@@ -36614,12 +36672,28 @@ const VITE_CONFIG_FILENAMES = [
|
|
|
36614
36672
|
"vitest.config.ts",
|
|
36615
36673
|
"vitest.config.js"
|
|
36616
36674
|
];
|
|
36675
|
+
const RSBUILD_CONFIG_FILENAMES = [
|
|
36676
|
+
"rsbuild.config.ts",
|
|
36677
|
+
"rsbuild.config.js",
|
|
36678
|
+
"rsbuild.config.mts",
|
|
36679
|
+
"rsbuild.config.mjs",
|
|
36680
|
+
"rsbuild.config.cts",
|
|
36681
|
+
"rsbuild.config.cjs"
|
|
36682
|
+
];
|
|
36683
|
+
const RSPACK_CONFIG_FILENAMES = [
|
|
36684
|
+
"rspack.config.ts",
|
|
36685
|
+
"rspack.config.js",
|
|
36686
|
+
"rspack.config.mts",
|
|
36687
|
+
"rspack.config.mjs",
|
|
36688
|
+
"rspack.config.cts",
|
|
36689
|
+
"rspack.config.cjs"
|
|
36690
|
+
];
|
|
36617
36691
|
const EXPO_APP_CONFIG_FILENAMES = [
|
|
36618
36692
|
"app.json",
|
|
36619
36693
|
"app.config.js",
|
|
36620
36694
|
"app.config.ts"
|
|
36621
36695
|
];
|
|
36622
|
-
const REACT_COMPILER_PACKAGE_REFERENCE_PATTERN = /babel-plugin-react-compiler|react-compiler-runtime|["']react-compiler["']/;
|
|
36696
|
+
const REACT_COMPILER_PACKAGE_REFERENCE_PATTERN = /babel-plugin-react-compiler|react-compiler-runtime|reactCompilerPreset\s*\(|["']react-compiler["']/;
|
|
36623
36697
|
const REACT_COMPILER_ENABLED_FLAG_PATTERN = /["']?reactCompiler["']?\s*:\s*(?:true\b|\{)/;
|
|
36624
36698
|
const STATIC_EXPORT_OUTPUT_PATTERN = /(?:^|[^.\w])["']?output["']?\s*:\s*["']export["']/m;
|
|
36625
36699
|
const hasCompilerPackage = (packageJson, compilerPackages) => {
|
|
@@ -36654,6 +36728,8 @@ const detectReactCompiler = (directory, packageJson) => {
|
|
|
36654
36728
|
if (hasCompilerInConfigFiles(directory, NEXT_CONFIG_FILENAMES)) return true;
|
|
36655
36729
|
if (hasCompilerInConfigFiles(directory, BABEL_CONFIG_FILENAMES)) return true;
|
|
36656
36730
|
if (hasCompilerInConfigFiles(directory, VITE_CONFIG_FILENAMES)) return true;
|
|
36731
|
+
if (hasCompilerInConfigFiles(directory, RSBUILD_CONFIG_FILENAMES)) return true;
|
|
36732
|
+
if (hasCompilerInConfigFiles(directory, RSPACK_CONFIG_FILENAMES)) return true;
|
|
36657
36733
|
if (hasCompilerInConfigFiles(directory, EXPO_APP_CONFIG_FILENAMES)) return true;
|
|
36658
36734
|
return hasCompilerPackageInAncestors(directory, REACT_COMPILER_TRANSFORM_PACKAGES);
|
|
36659
36735
|
};
|
|
@@ -36662,7 +36738,7 @@ const detectNextjsStaticExport = (directory) => NEXT_CONFIG_FILENAMES.some((file
|
|
|
36662
36738
|
const filePath = Path.join(directory, filename);
|
|
36663
36739
|
return isFile(filePath) && STATIC_EXPORT_OUTPUT_PATTERN.test(NFS.readFileSync(filePath, "utf-8"));
|
|
36664
36740
|
});
|
|
36665
|
-
const UNRESOLVABLE_PROTOCOL_VERSION = /^(?:file|git|github|https?|link|patch|portal|workspace|npm):/i;
|
|
36741
|
+
const UNRESOLVABLE_PROTOCOL_VERSION = /^(?:catalog|file|git|github|https?|link|patch|portal|workspace|npm):/i;
|
|
36666
36742
|
const DIST_TAG_VERSION = /^[a-z][a-z0-9._-]*$/i;
|
|
36667
36743
|
const WILDCARD_VERSION = /^[*xX](?:\.[*xX])*$/;
|
|
36668
36744
|
const NPM_ALIAS_VERSION = /^npm:(?:@[^/]+\/[^@]+|[^@]+)@(.+)$/i;
|
|
@@ -36795,6 +36871,16 @@ const getLowestDependencyMajor = (version) => {
|
|
|
36795
36871
|
}
|
|
36796
36872
|
return lowestMajor;
|
|
36797
36873
|
};
|
|
36874
|
+
const getDependencyMajorWithinSupportedRange = (version, latestSupportedMajor) => {
|
|
36875
|
+
const normalizedVersion = normalizeDependencyVersion(version);
|
|
36876
|
+
if (normalizedVersion === null) return null;
|
|
36877
|
+
const validRange = import_semver.validRange(normalizedVersion);
|
|
36878
|
+
if (validRange === null) return null;
|
|
36879
|
+
const minimumVersion = import_semver.minVersion(validRange);
|
|
36880
|
+
if (minimumVersion === null || minimumVersion.major > latestSupportedMajor) return null;
|
|
36881
|
+
if (import_semver.intersects(validRange, `>=${latestSupportedMajor + 1}.0.0`)) return null;
|
|
36882
|
+
return minimumVersion.major;
|
|
36883
|
+
};
|
|
36798
36884
|
const isConcreteDependencyVersion = (version) => {
|
|
36799
36885
|
const normalizedVersion = normalizeDependencyVersion(version);
|
|
36800
36886
|
return normalizedVersion !== null && /\d/.test(normalizedVersion);
|
|
@@ -36838,9 +36924,18 @@ const parseReactMajorMinor = (reactVersion) => {
|
|
|
36838
36924
|
};
|
|
36839
36925
|
};
|
|
36840
36926
|
const parseLowerBoundVersion = (versionSpec) => import_semver.validRange(versionSpec) !== null ? import_semver.minVersion(versionSpec) : import_semver.coerce(versionSpec);
|
|
36841
|
-
const
|
|
36842
|
-
if (typeof
|
|
36843
|
-
const
|
|
36927
|
+
const parseThreeRelease = (threeVersion) => {
|
|
36928
|
+
if (typeof threeVersion !== "string") return null;
|
|
36929
|
+
const normalizedVersion = normalizeDependencyVersion(threeVersion);
|
|
36930
|
+
if (normalizedVersion === null) return null;
|
|
36931
|
+
const lowerBound = parseLowerBoundVersion(normalizedVersion);
|
|
36932
|
+
if (lowerBound === null) return null;
|
|
36933
|
+
if (lowerBound.major > 0) return Number.MAX_SAFE_INTEGER;
|
|
36934
|
+
return lowerBound.minor > 0 ? lowerBound.minor : null;
|
|
36935
|
+
};
|
|
36936
|
+
const parseDependencyMajorMinor = (dependencyVersion) => {
|
|
36937
|
+
if (typeof dependencyVersion !== "string") return null;
|
|
36938
|
+
const trimmed = dependencyVersion.trim();
|
|
36844
36939
|
if (trimmed.length === 0) return null;
|
|
36845
36940
|
const lowerBound = parseLowerBoundVersion(trimmed);
|
|
36846
36941
|
if (lowerBound === null || lowerBound.major <= 0) return null;
|
|
@@ -36849,6 +36944,7 @@ const parseTailwindMajorMinor = (tailwindVersion) => {
|
|
|
36849
36944
|
minor: lowerBound.minor
|
|
36850
36945
|
};
|
|
36851
36946
|
};
|
|
36947
|
+
const parseTailwindMajorMinor = (tailwindVersion) => parseDependencyMajorMinor(tailwindVersion);
|
|
36852
36948
|
const hasUpperBoundOnlyPeerRange = (range) => {
|
|
36853
36949
|
if (typeof range !== "string") return false;
|
|
36854
36950
|
const normalizedRange = normalizeDependencyVersion(range);
|
|
@@ -36870,7 +36966,7 @@ const resolveEffectiveReactMajor = (reactVersion, packageJson) => {
|
|
|
36870
36966
|
if (peerFloor === null) return hasUpperBoundOnlyPeerRange(peerReactRange) ? null : installedReactMajor;
|
|
36871
36967
|
return installedReactMajor !== null ? Math.min(installedReactMajor, peerFloor) : peerFloor;
|
|
36872
36968
|
};
|
|
36873
|
-
const isCatalogReference = (version) => version.startsWith("catalog:");
|
|
36969
|
+
const isCatalogReference = (version) => typeof version === "string" && version.startsWith("catalog:");
|
|
36874
36970
|
const extractCatalogName = (version) => {
|
|
36875
36971
|
if (!isCatalogReference(version)) return null;
|
|
36876
36972
|
const name = version.slice(8).trim();
|
|
@@ -37020,6 +37116,12 @@ const TAILWIND_ZOD_SECTIONS = [
|
|
|
37020
37116
|
"devDependencies",
|
|
37021
37117
|
"peerDependencies"
|
|
37022
37118
|
];
|
|
37119
|
+
const DEPENDENCY_SPEC_SECTIONS = [
|
|
37120
|
+
"dependencies",
|
|
37121
|
+
"devDependencies",
|
|
37122
|
+
"peerDependencies",
|
|
37123
|
+
"optionalDependencies"
|
|
37124
|
+
];
|
|
37023
37125
|
const EMPTY_DEPENDENCY_INFO = {
|
|
37024
37126
|
reactVersion: null,
|
|
37025
37127
|
tailwindVersion: null,
|
|
@@ -37029,7 +37131,7 @@ const EMPTY_DEPENDENCY_INFO = {
|
|
|
37029
37131
|
const pickConcreteVersion = (packageJson, packageName, sections) => {
|
|
37030
37132
|
for (const section of sections) {
|
|
37031
37133
|
const version = packageJson[section]?.[packageName];
|
|
37032
|
-
if (version
|
|
37134
|
+
if (typeof version !== "string") continue;
|
|
37033
37135
|
if (isCatalogReference(version)) return null;
|
|
37034
37136
|
if (isConcreteDependencyVersion(version)) return version;
|
|
37035
37137
|
}
|
|
@@ -37061,13 +37163,16 @@ const extractDependencyInfo = (packageJson) => {
|
|
|
37061
37163
|
};
|
|
37062
37164
|
};
|
|
37063
37165
|
const getDependencySpec = (packageJson, packageName) => {
|
|
37064
|
-
const
|
|
37065
|
-
|
|
37166
|
+
for (const section of DEPENDENCY_SPEC_SECTIONS) {
|
|
37167
|
+
const spec = packageJson[section]?.[packageName];
|
|
37168
|
+
if (typeof spec === "string") return spec;
|
|
37169
|
+
}
|
|
37170
|
+
return null;
|
|
37066
37171
|
};
|
|
37067
37172
|
const getDependencyDeclaration = ({ packageJson, packageName, sections }) => {
|
|
37068
37173
|
for (const section of sections) {
|
|
37069
37174
|
const version = packageJson[section]?.[packageName];
|
|
37070
|
-
if (version
|
|
37175
|
+
if (typeof version !== "string") continue;
|
|
37071
37176
|
return {
|
|
37072
37177
|
catalogReference: extractCatalogName(version) ?? null,
|
|
37073
37178
|
hasDeclaration: true,
|
|
@@ -37101,24 +37206,15 @@ const getPreactVersion = (packageJson) => {
|
|
|
37101
37206
|
...packageJson.devDependencies
|
|
37102
37207
|
}.preact ?? null;
|
|
37103
37208
|
};
|
|
37104
|
-
const
|
|
37105
|
-
"@tanstack/react-query",
|
|
37106
|
-
"@tanstack/query-core",
|
|
37107
|
-
"react-query"
|
|
37108
|
-
]);
|
|
37109
|
-
const hasTanStackQuery = (packageJson) => {
|
|
37110
|
-
const allDependencies = {
|
|
37111
|
-
...packageJson.peerDependencies,
|
|
37112
|
-
...packageJson.dependencies,
|
|
37113
|
-
...packageJson.devDependencies
|
|
37114
|
-
};
|
|
37115
|
-
return Object.keys(allDependencies).some((packageName) => TANSTACK_QUERY_PACKAGES.has(packageName));
|
|
37116
|
-
};
|
|
37117
|
-
const resolveCatalogBackedDependencyVersion = ({ rootDirectory, rootPackageJson, packageName, version }) => {
|
|
37209
|
+
const resolveCatalogBackedDependencyVersion = ({ rootDirectory, rootPackageJson, packageName, sourceDirectory = rootDirectory, sourcePackageJson = rootPackageJson, version }) => {
|
|
37118
37210
|
if (version === null || !isCatalogReference(version)) return version;
|
|
37119
37211
|
const catalogName = extractCatalogName(version);
|
|
37120
|
-
const
|
|
37121
|
-
if (
|
|
37212
|
+
const resolvedSourceVersion = resolveCatalogVersion(sourcePackageJson, packageName, sourceDirectory, catalogName);
|
|
37213
|
+
if (resolvedSourceVersion) return resolvedSourceVersion;
|
|
37214
|
+
if (sourceDirectory !== rootDirectory || sourcePackageJson !== rootPackageJson) {
|
|
37215
|
+
const resolvedRootVersion = resolveCatalogVersion(rootPackageJson, packageName, rootDirectory, catalogName);
|
|
37216
|
+
if (resolvedRootVersion) return resolvedRootVersion;
|
|
37217
|
+
}
|
|
37122
37218
|
const monorepoRoot = findMonorepoRoot(rootDirectory);
|
|
37123
37219
|
if (!monorepoRoot) return version;
|
|
37124
37220
|
const monorepoPackageJsonPath = Path.join(monorepoRoot, "package.json");
|
|
@@ -37316,7 +37412,84 @@ const listWorkspacePackages = (rootDirectory) => {
|
|
|
37316
37412
|
}
|
|
37317
37413
|
return packages;
|
|
37318
37414
|
};
|
|
37415
|
+
const PREFERRED_DEPENDENCY_SECTIONS = [
|
|
37416
|
+
"dependencies",
|
|
37417
|
+
"peerDependencies",
|
|
37418
|
+
"devDependencies"
|
|
37419
|
+
];
|
|
37420
|
+
const getPreferredDependencyVersion = ({ packageJson, packageNames }) => {
|
|
37421
|
+
for (const packageName of packageNames) {
|
|
37422
|
+
const declaration = getDependencyDeclaration({
|
|
37423
|
+
packageJson,
|
|
37424
|
+
packageName,
|
|
37425
|
+
sections: PREFERRED_DEPENDENCY_SECTIONS
|
|
37426
|
+
});
|
|
37427
|
+
if (declaration.version !== null) return declaration.version;
|
|
37428
|
+
}
|
|
37429
|
+
return null;
|
|
37430
|
+
};
|
|
37431
|
+
const TANSTACK_REACT_QUERY_PACKAGES = ["@tanstack/react-query", "react-query"];
|
|
37432
|
+
const getTanStackQueryVersion = (packageJson) => {
|
|
37433
|
+
return getPreferredDependencyVersion({
|
|
37434
|
+
packageJson,
|
|
37435
|
+
packageNames: TANSTACK_REACT_QUERY_PACKAGES
|
|
37436
|
+
});
|
|
37437
|
+
};
|
|
37438
|
+
const STYLED_COMPONENTS_PACKAGES = ["styled-components"];
|
|
37439
|
+
const getStyledComponentsVersion = (packageJson) => {
|
|
37440
|
+
return getPreferredDependencyVersion({
|
|
37441
|
+
packageJson,
|
|
37442
|
+
packageNames: STYLED_COMPONENTS_PACKAGES
|
|
37443
|
+
});
|
|
37444
|
+
};
|
|
37445
|
+
const I18N_PACKAGES = [
|
|
37446
|
+
"i18next",
|
|
37447
|
+
"react-i18next",
|
|
37448
|
+
"next-i18next",
|
|
37449
|
+
"react-intl",
|
|
37450
|
+
"next-intl",
|
|
37451
|
+
"use-intl",
|
|
37452
|
+
"@formatjs/intl",
|
|
37453
|
+
"@lingui/core",
|
|
37454
|
+
"@lingui/react",
|
|
37455
|
+
"typesafe-i18n",
|
|
37456
|
+
"@tolgee/react",
|
|
37457
|
+
"react-intl-universal"
|
|
37458
|
+
];
|
|
37459
|
+
const hasI18nDependency = (packageJson) => {
|
|
37460
|
+
const allDependencies = {
|
|
37461
|
+
...packageJson.peerDependencies,
|
|
37462
|
+
...packageJson.dependencies,
|
|
37463
|
+
...packageJson.devDependencies,
|
|
37464
|
+
...packageJson.optionalDependencies
|
|
37465
|
+
};
|
|
37466
|
+
return I18N_PACKAGES.some((packageName) => allDependencies[packageName] !== void 0);
|
|
37467
|
+
};
|
|
37319
37468
|
const REANIMATED_DEPENDENCY_NAME = "react-native-reanimated";
|
|
37469
|
+
const MOBX_REACT_PACKAGE_NAME = "mobx-react";
|
|
37470
|
+
const MOBX_REACT_LITE_PACKAGE_NAME = "mobx-react-lite";
|
|
37471
|
+
const MOBX_STATE_TREE_PACKAGE_NAME = "mobx-state-tree";
|
|
37472
|
+
const MOBX_REACT_OBSERVER_PACKAGE_NAME = "mobx-react-observer";
|
|
37473
|
+
const REACT_THREE_FIBER_DEPENDENCY_NAMES = ["@react-three/fiber", "react-three-fiber"];
|
|
37474
|
+
const REACT_THREE_FIBER_SECTIONS = [
|
|
37475
|
+
"dependencies",
|
|
37476
|
+
"peerDependencies",
|
|
37477
|
+
"optionalDependencies",
|
|
37478
|
+
"devDependencies"
|
|
37479
|
+
];
|
|
37480
|
+
const THREE_DEPENDENCY_SECTIONS = [
|
|
37481
|
+
"dependencies",
|
|
37482
|
+
"peerDependencies",
|
|
37483
|
+
"optionalDependencies",
|
|
37484
|
+
"devDependencies"
|
|
37485
|
+
];
|
|
37486
|
+
const REACT_THREE_FIBER_ECOSYSTEM_DEPENDENCY_NAMES = [...REACT_THREE_FIBER_DEPENDENCY_NAMES, "@react-three/drei"];
|
|
37487
|
+
const THREE_DEPENDENCY_NAMES = [...REACT_THREE_FIBER_ECOSYSTEM_DEPENDENCY_NAMES, "three"];
|
|
37488
|
+
const REACT_ROUTER_DEPENDENCY_NAMES = [
|
|
37489
|
+
"@react-router/dev",
|
|
37490
|
+
"react-router-dom",
|
|
37491
|
+
"react-router"
|
|
37492
|
+
];
|
|
37320
37493
|
const SHOPIFY_FLASH_LIST_PACKAGE_NAME = "@shopify/flash-list";
|
|
37321
37494
|
const resolveWorkspaceDependencyVersion = ({ concreteVersion, packageName, rootDirectory, rootPackageJson, sections, workspaceDirectory, workspacePackageJson }) => {
|
|
37322
37495
|
const dependencyDeclaration = getDependencyDeclaration({
|
|
@@ -37327,7 +37500,7 @@ const resolveWorkspaceDependencyVersion = ({ concreteVersion, packageName, rootD
|
|
|
37327
37500
|
if (!dependencyDeclaration.hasDeclaration) return null;
|
|
37328
37501
|
return concreteVersion ?? resolveCatalogVersion(workspacePackageJson, packageName, workspaceDirectory, dependencyDeclaration.catalogReference) ?? resolveCatalogVersion(rootPackageJson, packageName, rootDirectory, dependencyDeclaration.catalogReference);
|
|
37329
37502
|
};
|
|
37330
|
-
const
|
|
37503
|
+
const shouldReplaceWithLowerMajor = (currentVersion, nextVersion) => {
|
|
37331
37504
|
if (!currentVersion) return true;
|
|
37332
37505
|
const currentMajor = parseReactMajor(currentVersion);
|
|
37333
37506
|
const nextMajor = parseReactMajor(nextVersion);
|
|
@@ -37335,7 +37508,71 @@ const shouldReplaceReactVersion = (currentVersion, nextVersion) => {
|
|
|
37335
37508
|
if (nextMajor === null) return false;
|
|
37336
37509
|
return nextMajor < currentMajor;
|
|
37337
37510
|
};
|
|
37338
|
-
const
|
|
37511
|
+
const shouldReplaceSupportedDependencyFact = (currentFact, nextFact, latestSupportedMajor) => {
|
|
37512
|
+
if (currentFact.version === null) return true;
|
|
37513
|
+
if (nextFact.version === null) return false;
|
|
37514
|
+
const currentMajor = getLowestDependencyMajor(currentFact.version);
|
|
37515
|
+
const nextMajor = getLowestDependencyMajor(nextFact.version);
|
|
37516
|
+
if (currentMajor === null) return false;
|
|
37517
|
+
if (nextMajor === null) return true;
|
|
37518
|
+
if (currentMajor > latestSupportedMajor) return false;
|
|
37519
|
+
if (nextMajor > latestSupportedMajor) return true;
|
|
37520
|
+
return nextMajor < currentMajor;
|
|
37521
|
+
};
|
|
37522
|
+
const shouldReplaceStyledComponentsVersion = (currentVersion, nextVersion) => {
|
|
37523
|
+
if (!currentVersion) return true;
|
|
37524
|
+
const currentMajor = getLowestDependencyMajor(currentVersion);
|
|
37525
|
+
const nextMajor = getLowestDependencyMajor(nextVersion);
|
|
37526
|
+
if (currentMajor === null) return nextMajor !== null && nextMajor < 6;
|
|
37527
|
+
if (nextMajor === null) return currentMajor >= 6;
|
|
37528
|
+
return nextMajor < currentMajor;
|
|
37529
|
+
};
|
|
37530
|
+
const selectOldestDependencyVersion = (currentVersion, nextVersion) => {
|
|
37531
|
+
if (currentVersion === null || nextVersion === null) return null;
|
|
37532
|
+
const current = parseDependencyMajorMinor(currentVersion);
|
|
37533
|
+
const next = parseDependencyMajorMinor(nextVersion);
|
|
37534
|
+
if (current === null) return currentVersion;
|
|
37535
|
+
if (next === null) return nextVersion;
|
|
37536
|
+
if (next.major !== current.major) return next.major < current.major ? nextVersion : currentVersion;
|
|
37537
|
+
return next.minor < current.minor ? nextVersion : currentVersion;
|
|
37538
|
+
};
|
|
37539
|
+
const shouldReplaceMobxFact = (currentFact, nextFact) => {
|
|
37540
|
+
if (currentFact.sourceDirectory === null) return true;
|
|
37541
|
+
if (currentFact.version === null) return false;
|
|
37542
|
+
if (nextFact.version === null) return true;
|
|
37543
|
+
const currentMajor = getDependencyMajorWithinSupportedRange(currentFact.version, 6);
|
|
37544
|
+
const nextMajor = getDependencyMajorWithinSupportedRange(nextFact.version, 6);
|
|
37545
|
+
if (currentMajor === null) return false;
|
|
37546
|
+
if (nextMajor === null) return true;
|
|
37547
|
+
return selectOldestDependencyVersion(currentFact.version, nextFact.version) === nextFact.version;
|
|
37548
|
+
};
|
|
37549
|
+
const collectBindingVersion = (facts, packageJson, directory, packageName) => {
|
|
37550
|
+
const version = getDependencySpec(packageJson, packageName);
|
|
37551
|
+
if (version === null) return;
|
|
37552
|
+
const resolvedVersion = resolveCatalogBackedDependencyVersion({
|
|
37553
|
+
rootDirectory: directory,
|
|
37554
|
+
rootPackageJson: packageJson,
|
|
37555
|
+
packageName,
|
|
37556
|
+
version
|
|
37557
|
+
});
|
|
37558
|
+
if (packageName === MOBX_REACT_PACKAGE_NAME) {
|
|
37559
|
+
facts.mobxReactVersion = facts.hasMobxReact ? selectOldestDependencyVersion(facts.mobxReactVersion, resolvedVersion) : resolvedVersion;
|
|
37560
|
+
facts.hasMobxReact = true;
|
|
37561
|
+
return;
|
|
37562
|
+
}
|
|
37563
|
+
facts.mobxReactLiteVersion = facts.hasMobxReactLite ? selectOldestDependencyVersion(facts.mobxReactLiteVersion, resolvedVersion) : resolvedVersion;
|
|
37564
|
+
facts.hasMobxReactLite = true;
|
|
37565
|
+
};
|
|
37566
|
+
const shouldReplaceReactRouterVersion = (currentVersion, nextVersion) => {
|
|
37567
|
+
if (currentVersion === null) return true;
|
|
37568
|
+
const current = parseReactMajorMinor(currentVersion);
|
|
37569
|
+
const next = parseReactMajorMinor(nextVersion);
|
|
37570
|
+
if (current === null) return next !== null;
|
|
37571
|
+
if (next === null) return false;
|
|
37572
|
+
if (next.major !== current.major) return next.major < current.major;
|
|
37573
|
+
return next.minor < current.minor;
|
|
37574
|
+
};
|
|
37575
|
+
const evaluateManifestFacts = (facts, packageJson, directory, rootDirectory, rootPackageJson) => {
|
|
37339
37576
|
if (facts.expo.version === null) {
|
|
37340
37577
|
const spec = getDependencySpec(packageJson, "expo");
|
|
37341
37578
|
if (spec !== null) facts.expo = {
|
|
@@ -37350,6 +37587,23 @@ const evaluateManifestFacts = (facts, packageJson, directory) => {
|
|
|
37350
37587
|
sourceDirectory: directory
|
|
37351
37588
|
};
|
|
37352
37589
|
}
|
|
37590
|
+
for (const packageName of REACT_ROUTER_DEPENDENCY_NAMES) {
|
|
37591
|
+
const resolvedSpec = resolveCatalogBackedDependencyVersion({
|
|
37592
|
+
rootDirectory,
|
|
37593
|
+
rootPackageJson,
|
|
37594
|
+
sourceDirectory: directory,
|
|
37595
|
+
sourcePackageJson: packageJson,
|
|
37596
|
+
packageName,
|
|
37597
|
+
version: getDependencySpec(packageJson, packageName)
|
|
37598
|
+
});
|
|
37599
|
+
if (resolvedSpec === null || !shouldReplaceReactRouterVersion(facts.reactRouter.version, resolvedSpec)) continue;
|
|
37600
|
+
facts.reactRouter = {
|
|
37601
|
+
version: resolvedSpec,
|
|
37602
|
+
sourceDirectory: directory,
|
|
37603
|
+
packageName
|
|
37604
|
+
};
|
|
37605
|
+
}
|
|
37606
|
+
facts.hasReactRouterFramework = facts.hasReactRouterFramework || getDependencySpec(packageJson, "@react-router/dev") !== null;
|
|
37353
37607
|
if (facts.shopifyFlashList.version === null) {
|
|
37354
37608
|
const spec = getDependencySpec(packageJson, SHOPIFY_FLASH_LIST_PACKAGE_NAME);
|
|
37355
37609
|
if (spec !== null) facts.shopifyFlashList = {
|
|
@@ -37357,13 +37611,113 @@ const evaluateManifestFacts = (facts, packageJson, directory) => {
|
|
|
37357
37611
|
sourceDirectory: directory
|
|
37358
37612
|
};
|
|
37359
37613
|
}
|
|
37614
|
+
const mobxSpec = getDependencySpec(packageJson, "mobx");
|
|
37615
|
+
if (mobxSpec !== null) {
|
|
37616
|
+
const nextMobxFact = {
|
|
37617
|
+
version: resolveCatalogBackedDependencyVersion({
|
|
37618
|
+
rootDirectory: directory,
|
|
37619
|
+
rootPackageJson: packageJson,
|
|
37620
|
+
packageName: "mobx",
|
|
37621
|
+
version: mobxSpec
|
|
37622
|
+
}),
|
|
37623
|
+
sourceDirectory: directory
|
|
37624
|
+
};
|
|
37625
|
+
if (shouldReplaceMobxFact(facts.mobx, nextMobxFact)) facts.mobx = nextMobxFact;
|
|
37626
|
+
}
|
|
37627
|
+
collectBindingVersion(facts, packageJson, directory, MOBX_REACT_PACKAGE_NAME);
|
|
37628
|
+
collectBindingVersion(facts, packageJson, directory, MOBX_REACT_LITE_PACKAGE_NAME);
|
|
37629
|
+
facts.hasMobxStateTree = facts.hasMobxStateTree || getDependencySpec(packageJson, MOBX_STATE_TREE_PACKAGE_NAME) !== null;
|
|
37630
|
+
facts.hasMobxReactObserver = facts.hasMobxReactObserver || getDependencySpec(packageJson, MOBX_REACT_OBSERVER_PACKAGE_NAME) !== null;
|
|
37631
|
+
const zustandSpec = getDependencySpec(packageJson, "zustand");
|
|
37632
|
+
if (zustandSpec !== null) {
|
|
37633
|
+
const nextZustandFact = {
|
|
37634
|
+
version: resolveCatalogBackedDependencyVersion({
|
|
37635
|
+
rootDirectory: directory,
|
|
37636
|
+
rootPackageJson: packageJson,
|
|
37637
|
+
packageName: "zustand",
|
|
37638
|
+
version: zustandSpec
|
|
37639
|
+
}),
|
|
37640
|
+
sourceDirectory: directory
|
|
37641
|
+
};
|
|
37642
|
+
if (shouldReplaceSupportedDependencyFact(facts.zustand, nextZustandFact, 5)) facts.zustand = nextZustandFact;
|
|
37643
|
+
}
|
|
37360
37644
|
if (facts.reanimatedVersion === null) {
|
|
37361
37645
|
const spec = getDependencySpec(packageJson, REANIMATED_DEPENDENCY_NAME);
|
|
37362
37646
|
if (spec !== null) facts.reanimatedVersion = spec;
|
|
37363
37647
|
}
|
|
37648
|
+
if (facts.valtioVersion === null) {
|
|
37649
|
+
const spec = getDependencySpec(packageJson, "valtio");
|
|
37650
|
+
if (spec !== null) facts.valtioVersion = spec;
|
|
37651
|
+
}
|
|
37652
|
+
facts.tanstackQueryVersion ??= getTanStackQueryVersion(packageJson);
|
|
37653
|
+
const styledComponentsVersion = resolveCatalogBackedDependencyVersion({
|
|
37654
|
+
rootDirectory: directory,
|
|
37655
|
+
rootPackageJson: packageJson,
|
|
37656
|
+
packageName: "styled-components",
|
|
37657
|
+
version: getStyledComponentsVersion(packageJson)
|
|
37658
|
+
});
|
|
37659
|
+
if (styledComponentsVersion && shouldReplaceStyledComponentsVersion(facts.styledComponentsVersion, styledComponentsVersion)) facts.styledComponentsVersion = styledComponentsVersion;
|
|
37660
|
+
facts.hasI18nLibrary = facts.hasI18nLibrary || hasI18nDependency(packageJson);
|
|
37661
|
+
for (const packageName of REACT_THREE_FIBER_DEPENDENCY_NAMES) {
|
|
37662
|
+
const version = resolveCatalogBackedDependencyVersion({
|
|
37663
|
+
rootDirectory,
|
|
37664
|
+
rootPackageJson,
|
|
37665
|
+
sourceDirectory: directory,
|
|
37666
|
+
sourcePackageJson: packageJson,
|
|
37667
|
+
packageName,
|
|
37668
|
+
version: getDependencyDeclaration({
|
|
37669
|
+
packageName,
|
|
37670
|
+
packageJson,
|
|
37671
|
+
sections: REACT_THREE_FIBER_SECTIONS
|
|
37672
|
+
}).version
|
|
37673
|
+
});
|
|
37674
|
+
if (version === null) continue;
|
|
37675
|
+
if (shouldReplaceWithLowerMajor(facts.reactThreeFiber.version, version)) facts.reactThreeFiber = {
|
|
37676
|
+
packageName,
|
|
37677
|
+
version,
|
|
37678
|
+
sourceDirectory: directory
|
|
37679
|
+
};
|
|
37680
|
+
}
|
|
37681
|
+
const threeVersion = resolveCatalogBackedDependencyVersion({
|
|
37682
|
+
rootDirectory,
|
|
37683
|
+
rootPackageJson,
|
|
37684
|
+
sourceDirectory: directory,
|
|
37685
|
+
sourcePackageJson: packageJson,
|
|
37686
|
+
packageName: "three",
|
|
37687
|
+
version: getDependencyDeclaration({
|
|
37688
|
+
packageName: "three",
|
|
37689
|
+
packageJson,
|
|
37690
|
+
sections: THREE_DEPENDENCY_SECTIONS
|
|
37691
|
+
}).version
|
|
37692
|
+
});
|
|
37693
|
+
if (threeVersion !== null) {
|
|
37694
|
+
const currentRelease = parseThreeRelease(facts.threeVersion);
|
|
37695
|
+
const nextRelease = parseThreeRelease(threeVersion);
|
|
37696
|
+
if (facts.threeVersion === null || nextRelease !== null && (currentRelease === null || nextRelease < currentRelease)) facts.threeVersion = threeVersion;
|
|
37697
|
+
}
|
|
37364
37698
|
facts.hasReactNativeAwarePackage = facts.hasReactNativeAwarePackage || isPackageJsonReactNativeAware(packageJson);
|
|
37365
37699
|
facts.hasReanimatedAwarePackage = facts.hasReanimatedAwarePackage || isPackageJsonReanimatedAware(packageJson);
|
|
37366
37700
|
facts.hasSsrDependency = facts.hasSsrDependency || isPackageJsonSsrAware(packageJson);
|
|
37701
|
+
const remotionSpec = getDependencySpec(packageJson, "remotion");
|
|
37702
|
+
if (remotionSpec !== null) {
|
|
37703
|
+
facts.hasRemotionDependency = true;
|
|
37704
|
+
const resolvedRemotionVersion = resolveCatalogBackedDependencyVersion({
|
|
37705
|
+
rootDirectory,
|
|
37706
|
+
rootPackageJson,
|
|
37707
|
+
packageName: "remotion",
|
|
37708
|
+
version: remotionSpec
|
|
37709
|
+
});
|
|
37710
|
+
const remotionMajorVersion = resolvedRemotionVersion === null ? null : getLowestDependencyMajor(resolvedRemotionVersion);
|
|
37711
|
+
if (remotionMajorVersion === null) {
|
|
37712
|
+
facts.hasUnknownRemotionVersion = true;
|
|
37713
|
+
facts.remotionVersion = null;
|
|
37714
|
+
} else if (!facts.hasUnknownRemotionVersion) {
|
|
37715
|
+
const currentRemotionMajorVersion = facts.remotionVersion === null ? null : getLowestDependencyMajor(facts.remotionVersion);
|
|
37716
|
+
if (currentRemotionMajorVersion === null || remotionMajorVersion < currentRemotionMajorVersion) facts.remotionVersion = resolvedRemotionVersion;
|
|
37717
|
+
}
|
|
37718
|
+
}
|
|
37719
|
+
facts.hasThree = facts.hasThree || THREE_DEPENDENCY_NAMES.some((dependencyName) => getDependencySpec(packageJson, dependencyName) !== null);
|
|
37720
|
+
facts.hasReactThreeFiber = facts.hasReactThreeFiber || REACT_THREE_FIBER_ECOSYSTEM_DEPENDENCY_NAMES.some((dependencyName) => getDependencySpec(packageJson, dependencyName) !== null);
|
|
37367
37721
|
};
|
|
37368
37722
|
const collectWorkspaceFacts = (rootDirectory, rootPackageJson, { collectReactGroup }) => {
|
|
37369
37723
|
const facts = {
|
|
@@ -37379,25 +37733,60 @@ const collectWorkspaceFacts = (rootDirectory, rootPackageJson, { collectReactGro
|
|
|
37379
37733
|
version: null,
|
|
37380
37734
|
sourceDirectory: null
|
|
37381
37735
|
},
|
|
37736
|
+
reactRouter: {
|
|
37737
|
+
version: null,
|
|
37738
|
+
sourceDirectory: null,
|
|
37739
|
+
packageName: null
|
|
37740
|
+
},
|
|
37382
37741
|
shopifyFlashList: {
|
|
37383
37742
|
version: null,
|
|
37384
37743
|
sourceDirectory: null
|
|
37385
37744
|
},
|
|
37745
|
+
valtioVersion: null,
|
|
37746
|
+
mobx: {
|
|
37747
|
+
version: null,
|
|
37748
|
+
sourceDirectory: null
|
|
37749
|
+
},
|
|
37750
|
+
hasMobxReact: false,
|
|
37751
|
+
mobxReactVersion: null,
|
|
37752
|
+
hasMobxReactLite: false,
|
|
37753
|
+
mobxReactLiteVersion: null,
|
|
37754
|
+
hasMobxStateTree: false,
|
|
37755
|
+
hasMobxReactObserver: false,
|
|
37756
|
+
zustand: {
|
|
37757
|
+
version: null,
|
|
37758
|
+
sourceDirectory: null
|
|
37759
|
+
},
|
|
37760
|
+
tanstackQueryVersion: null,
|
|
37761
|
+
styledComponentsVersion: null,
|
|
37762
|
+
hasI18nLibrary: false,
|
|
37386
37763
|
hasReactNativeAwarePackage: false,
|
|
37387
37764
|
hasReanimatedAwarePackage: false,
|
|
37388
37765
|
hasSsrDependency: false,
|
|
37766
|
+
hasRemotionDependency: false,
|
|
37767
|
+
hasUnknownRemotionVersion: false,
|
|
37768
|
+
remotionVersion: null,
|
|
37769
|
+
hasThree: false,
|
|
37770
|
+
threeVersion: null,
|
|
37771
|
+
hasReactThreeFiber: false,
|
|
37772
|
+
reactThreeFiber: {
|
|
37773
|
+
packageName: null,
|
|
37774
|
+
version: null,
|
|
37775
|
+
sourceDirectory: null
|
|
37776
|
+
},
|
|
37777
|
+
hasReactRouterFramework: false,
|
|
37389
37778
|
reanimatedVersion: null
|
|
37390
37779
|
};
|
|
37391
|
-
evaluateManifestFacts(facts, rootPackageJson, rootDirectory);
|
|
37780
|
+
evaluateManifestFacts(facts, rootPackageJson, rootDirectory, rootDirectory, rootPackageJson);
|
|
37392
37781
|
let isReactGroupSettled = !collectReactGroup;
|
|
37393
37782
|
const visitedDirectories = /* @__PURE__ */ new Set();
|
|
37394
37783
|
for (const pattern of getWorkspacePatterns(rootDirectory, rootPackageJson)) {
|
|
37395
|
-
const directories =
|
|
37784
|
+
const directories = resolveWorkspaceDirectories(rootDirectory, pattern).toSorted();
|
|
37396
37785
|
for (const workspaceDirectory of directories) {
|
|
37397
37786
|
if (visitedDirectories.has(workspaceDirectory)) continue;
|
|
37398
37787
|
visitedDirectories.add(workspaceDirectory);
|
|
37399
37788
|
const workspacePackageJson = readPackageJson$1(Path.join(workspaceDirectory, "package.json"));
|
|
37400
|
-
evaluateManifestFacts(facts, workspacePackageJson, workspaceDirectory);
|
|
37789
|
+
evaluateManifestFacts(facts, workspacePackageJson, workspaceDirectory, rootDirectory, rootPackageJson);
|
|
37401
37790
|
const info = extractDependencyInfo(workspacePackageJson);
|
|
37402
37791
|
if (info.framework !== "unknown" && frameworkMergeRank(info.framework) < frameworkMergeRank(facts.framework)) facts.framework = info.framework;
|
|
37403
37792
|
if (isReactGroupSettled) continue;
|
|
@@ -37428,7 +37817,7 @@ const collectWorkspaceFacts = (rootDirectory, rootPackageJson, { collectReactGro
|
|
|
37428
37817
|
workspaceDirectory,
|
|
37429
37818
|
workspacePackageJson
|
|
37430
37819
|
});
|
|
37431
|
-
if (reactVersion &&
|
|
37820
|
+
if (reactVersion && shouldReplaceWithLowerMajor(facts.reactVersion, reactVersion)) facts.reactVersion = reactVersion;
|
|
37432
37821
|
if (tailwindVersion && !facts.tailwindVersion) facts.tailwindVersion = tailwindVersion;
|
|
37433
37822
|
if (zodVersion && !facts.zodVersion) facts.zodVersion = zodVersion;
|
|
37434
37823
|
const settledReactMajor = parseReactMajor(facts.reactVersion);
|
|
@@ -37618,17 +38007,43 @@ const discoverProjectWithoutPackageJson = (directory) => {
|
|
|
37618
38007
|
tailwindVersion: null,
|
|
37619
38008
|
zodVersion: null,
|
|
37620
38009
|
zodMajorVersion: null,
|
|
38010
|
+
mobxVersion: null,
|
|
38011
|
+
mobxMajorVersion: null,
|
|
38012
|
+
hasMobxReact: false,
|
|
38013
|
+
mobxReactVersion: null,
|
|
38014
|
+
hasMobxReactLite: false,
|
|
38015
|
+
mobxReactLiteVersion: null,
|
|
38016
|
+
hasMobxStateTree: false,
|
|
38017
|
+
hasMobxReactObserver: false,
|
|
38018
|
+
zustandVersion: null,
|
|
38019
|
+
zustandMajorVersion: null,
|
|
37621
38020
|
framework: "unknown",
|
|
37622
38021
|
hasTypeScript: hasOwnTsConfig,
|
|
37623
38022
|
hasReactCompiler: false,
|
|
37624
38023
|
hasReactCompilerLintPlugin: false,
|
|
37625
38024
|
hasTanStackQuery: false,
|
|
38025
|
+
valtioVersion: null,
|
|
38026
|
+
valtioMajorVersion: null,
|
|
38027
|
+
hasRemotion: false,
|
|
38028
|
+
remotionVersion: null,
|
|
38029
|
+
remotionMajorVersion: null,
|
|
38030
|
+
hasI18nLibrary: false,
|
|
38031
|
+
tanstackQueryVersion: null,
|
|
38032
|
+
styledComponentsVersion: null,
|
|
38033
|
+
hasThree: false,
|
|
38034
|
+
threeVersion: null,
|
|
38035
|
+
threeRelease: null,
|
|
38036
|
+
hasReactThreeFiber: false,
|
|
38037
|
+
reactThreeFiberVersion: null,
|
|
38038
|
+
reactThreeFiberMajorVersion: null,
|
|
37626
38039
|
hasSsrDependency: false,
|
|
37627
38040
|
preactVersion: null,
|
|
37628
38041
|
preactMajorVersion: null,
|
|
37629
38042
|
hasReactNativeWorkspace: false,
|
|
37630
38043
|
nextjsVersion: null,
|
|
37631
38044
|
nextjsMajorVersion: null,
|
|
38045
|
+
reactRouterVersion: null,
|
|
38046
|
+
hasReactRouterFramework: false,
|
|
37632
38047
|
expoVersion: null,
|
|
37633
38048
|
shopifyFlashListVersion: null,
|
|
37634
38049
|
shopifyFlashListMajorVersion: null,
|
|
@@ -37721,6 +38136,12 @@ const discoverProject = (directory) => {
|
|
|
37721
38136
|
packageName: SHOPIFY_FLASH_LIST_PACKAGE_NAME,
|
|
37722
38137
|
version: workspaceFacts.shopifyFlashList.version
|
|
37723
38138
|
}) : null;
|
|
38139
|
+
const zustandVersion = resolveCatalogBackedDependencyVersion({
|
|
38140
|
+
rootDirectory: directory,
|
|
38141
|
+
rootPackageJson: packageJson,
|
|
38142
|
+
packageName: "zustand",
|
|
38143
|
+
version: workspaceFacts.zustand.version
|
|
38144
|
+
});
|
|
37724
38145
|
const hasReanimated = hasReactNativeWorkspace && workspaceFacts.hasReanimatedAwarePackage;
|
|
37725
38146
|
const reanimatedVersion = hasReanimated ? workspaceFacts.reanimatedVersion : null;
|
|
37726
38147
|
const nextjsVersion = framework === "nextjs" ? resolveCatalogBackedDependencyVersion({
|
|
@@ -37729,7 +38150,39 @@ const discoverProject = (directory) => {
|
|
|
37729
38150
|
packageName: "next",
|
|
37730
38151
|
version: workspaceFacts.next.version
|
|
37731
38152
|
}) : null;
|
|
38153
|
+
const valtioVersion = resolveCatalogBackedDependencyVersion({
|
|
38154
|
+
rootDirectory: directory,
|
|
38155
|
+
rootPackageJson: packageJson,
|
|
38156
|
+
packageName: "valtio",
|
|
38157
|
+
version: workspaceFacts.valtioVersion
|
|
38158
|
+
});
|
|
38159
|
+
const mobxVersion = resolveCatalogBackedDependencyVersion({
|
|
38160
|
+
rootDirectory: directory,
|
|
38161
|
+
rootPackageJson: packageJson,
|
|
38162
|
+
packageName: "mobx",
|
|
38163
|
+
version: workspaceFacts.mobx.version
|
|
38164
|
+
});
|
|
38165
|
+
const reactRouterVersion = workspaceFacts.reactRouter.packageName === null ? null : resolveCatalogBackedDependencyVersion({
|
|
38166
|
+
rootDirectory: directory,
|
|
38167
|
+
rootPackageJson: packageJson,
|
|
38168
|
+
packageName: workspaceFacts.reactRouter.packageName,
|
|
38169
|
+
version: workspaceFacts.reactRouter.version
|
|
38170
|
+
});
|
|
37732
38171
|
const preactVersion = getPreactVersion(packageJson);
|
|
38172
|
+
const remotionVersion = workspaceFacts.remotionVersion;
|
|
38173
|
+
const tanstackQueryVersion = getTanStackQueryVersion(packageJson) ?? workspaceFacts.tanstackQueryVersion;
|
|
38174
|
+
const reactThreeFiberVersion = workspaceFacts.reactThreeFiber.packageName ? resolveCatalogBackedDependencyVersion({
|
|
38175
|
+
rootDirectory: directory,
|
|
38176
|
+
rootPackageJson: packageJson,
|
|
38177
|
+
packageName: workspaceFacts.reactThreeFiber.packageName,
|
|
38178
|
+
version: workspaceFacts.reactThreeFiber.version
|
|
38179
|
+
}) : null;
|
|
38180
|
+
const threeVersion = resolveCatalogBackedDependencyVersion({
|
|
38181
|
+
rootDirectory: directory,
|
|
38182
|
+
rootPackageJson: packageJson,
|
|
38183
|
+
packageName: "three",
|
|
38184
|
+
version: workspaceFacts.threeVersion
|
|
38185
|
+
});
|
|
37733
38186
|
const isPreES2023Target = hasTypeScript && detectPreES2023Target(directory);
|
|
37734
38187
|
const projectInfo = {
|
|
37735
38188
|
rootDirectory: directory,
|
|
@@ -37739,17 +38192,43 @@ const discoverProject = (directory) => {
|
|
|
37739
38192
|
tailwindVersion,
|
|
37740
38193
|
zodVersion,
|
|
37741
38194
|
zodMajorVersion: zodVersion === null ? null : getLowestDependencyMajor(zodVersion),
|
|
38195
|
+
mobxVersion,
|
|
38196
|
+
mobxMajorVersion: mobxVersion === null ? null : getDependencyMajorWithinSupportedRange(mobxVersion, 6),
|
|
38197
|
+
hasMobxReact: workspaceFacts.hasMobxReact,
|
|
38198
|
+
mobxReactVersion: workspaceFacts.mobxReactVersion,
|
|
38199
|
+
hasMobxReactLite: workspaceFacts.hasMobxReactLite,
|
|
38200
|
+
mobxReactLiteVersion: workspaceFacts.mobxReactLiteVersion,
|
|
38201
|
+
hasMobxStateTree: workspaceFacts.hasMobxStateTree,
|
|
38202
|
+
hasMobxReactObserver: workspaceFacts.hasMobxReactObserver,
|
|
38203
|
+
zustandVersion,
|
|
38204
|
+
zustandMajorVersion: zustandVersion === null ? null : getLowestDependencyMajor(zustandVersion),
|
|
37742
38205
|
framework,
|
|
37743
38206
|
hasTypeScript,
|
|
37744
38207
|
hasReactCompiler: detectReactCompiler(directory, packageJson),
|
|
37745
38208
|
hasReactCompilerLintPlugin: detectReactCompilerLintPlugin(directory, packageJson),
|
|
37746
|
-
hasTanStackQuery:
|
|
38209
|
+
hasTanStackQuery: tanstackQueryVersion !== null,
|
|
38210
|
+
hasI18nLibrary: workspaceFacts.hasI18nLibrary,
|
|
38211
|
+
tanstackQueryVersion,
|
|
38212
|
+
styledComponentsVersion: workspaceFacts.styledComponentsVersion,
|
|
38213
|
+
valtioVersion,
|
|
38214
|
+
valtioMajorVersion: valtioVersion === null ? null : getLowestDependencyMajor(valtioVersion),
|
|
38215
|
+
hasRemotion: workspaceFacts.hasRemotionDependency,
|
|
38216
|
+
remotionVersion,
|
|
38217
|
+
remotionMajorVersion: remotionVersion === null ? null : getLowestDependencyMajor(remotionVersion),
|
|
38218
|
+
hasThree: workspaceFacts.hasThree,
|
|
38219
|
+
threeVersion,
|
|
38220
|
+
threeRelease: parseThreeRelease(threeVersion),
|
|
38221
|
+
hasReactThreeFiber: workspaceFacts.hasReactThreeFiber,
|
|
38222
|
+
reactThreeFiberVersion,
|
|
38223
|
+
reactThreeFiberMajorVersion: reactThreeFiberVersion === null ? null : getLowestDependencyMajor(reactThreeFiberVersion),
|
|
37747
38224
|
hasSsrDependency: workspaceFacts.hasSsrDependency,
|
|
37748
38225
|
preactVersion,
|
|
37749
38226
|
preactMajorVersion: parseReactMajor(preactVersion),
|
|
37750
38227
|
hasReactNativeWorkspace,
|
|
37751
38228
|
nextjsVersion,
|
|
37752
38229
|
nextjsMajorVersion: nextjsVersion === null ? null : getLowestDependencyMajor(nextjsVersion),
|
|
38230
|
+
reactRouterVersion,
|
|
38231
|
+
hasReactRouterFramework: workspaceFacts.hasReactRouterFramework,
|
|
37753
38232
|
expoVersion,
|
|
37754
38233
|
shopifyFlashListVersion,
|
|
37755
38234
|
shopifyFlashListMajorVersion: shopifyFlashListVersion === null ? null : getLowestDependencyMajor(shopifyFlashListVersion),
|
|
@@ -41053,10 +41532,10 @@ const SSR_FRAMEWORKS = new Set([
|
|
|
41053
41532
|
"gatsby",
|
|
41054
41533
|
"tanstack-start"
|
|
41055
41534
|
]);
|
|
41056
|
-
const
|
|
41057
|
-
if (
|
|
41058
|
-
const
|
|
41059
|
-
for (let candidate = earliest; candidate <=
|
|
41535
|
+
const addVersionCapabilityLadder = (capabilities, name, detectedVersion, earliest, latest) => {
|
|
41536
|
+
if (detectedVersion === null) return;
|
|
41537
|
+
const cappedVersion = Math.min(detectedVersion, latest);
|
|
41538
|
+
for (let candidate = earliest; candidate <= cappedVersion; candidate += 1) capabilities.add(`${name}:${candidate}`);
|
|
41060
41539
|
};
|
|
41061
41540
|
const buildCapabilities = (project) => {
|
|
41062
41541
|
const capabilities = /* @__PURE__ */ new Set();
|
|
@@ -41069,24 +41548,86 @@ const buildCapabilities = (project) => {
|
|
|
41069
41548
|
if (CLIENT_ONLY_FRAMEWORKS.has(project.framework)) capabilities.add("client-only");
|
|
41070
41549
|
if (project.isStaticExport) capabilities.add("nextjs:static-export");
|
|
41071
41550
|
if (project.nextjsMajorVersion !== null && project.nextjsMajorVersion >= 15) capabilities.add("nextjs:15");
|
|
41072
|
-
|
|
41551
|
+
if (project.nextjsMajorVersion !== null && project.nextjsMajorVersion >= 16) capabilities.add("nextjs:16");
|
|
41552
|
+
const reactRouterVersion = project.reactRouterVersion ?? null;
|
|
41553
|
+
if (reactRouterVersion !== null) {
|
|
41554
|
+
capabilities.add("react-router");
|
|
41555
|
+
if (project.hasReactRouterFramework === true) capabilities.add("react-router-framework");
|
|
41556
|
+
const detectedVersion = parseReactMajorMinor(reactRouterVersion);
|
|
41557
|
+
if (detectedVersion !== null) {
|
|
41558
|
+
for (const threshold of REACT_ROUTER_CAPABILITY_THRESHOLDS) if (isMajorMinorAtLeast(detectedVersion, threshold)) capabilities.add(threshold.capability);
|
|
41559
|
+
}
|
|
41560
|
+
}
|
|
41561
|
+
addVersionCapabilityLadder(capabilities, "react", project.reactMajorVersion, 17, 30);
|
|
41073
41562
|
if (project.reactMajorVersion !== null && project.reactMajorVersion >= 19 && isMajorMinorAtLeast(parseReactMajorMinor(project.reactVersion), {
|
|
41074
41563
|
major: 19,
|
|
41075
41564
|
minor: 2
|
|
41076
41565
|
})) capabilities.add("react:19.2");
|
|
41077
|
-
if (project.tailwindVersion !== null)
|
|
41078
|
-
|
|
41079
|
-
|
|
41080
|
-
|
|
41081
|
-
|
|
41566
|
+
if (project.tailwindVersion !== null) {
|
|
41567
|
+
capabilities.add("tailwind");
|
|
41568
|
+
const tailwindVersion = parseTailwindMajorMinor(project.tailwindVersion);
|
|
41569
|
+
if (isMajorMinorAtLeast(tailwindVersion, {
|
|
41570
|
+
major: 3,
|
|
41571
|
+
minor: 4
|
|
41572
|
+
})) capabilities.add("tailwind:3.4");
|
|
41573
|
+
if (tailwindVersion !== null && isMajorMinorAtLeast(tailwindVersion, {
|
|
41574
|
+
major: 4,
|
|
41575
|
+
minor: 0
|
|
41576
|
+
})) capabilities.add("tailwind:4");
|
|
41577
|
+
}
|
|
41082
41578
|
if (project.zodVersion !== null) capabilities.add("zod");
|
|
41083
41579
|
if (project.zodMajorVersion !== null && project.zodMajorVersion >= 4) capabilities.add("zod:4");
|
|
41580
|
+
if (project.mobxVersion !== void 0 && project.mobxVersion !== null || project.hasMobxReact === true || project.hasMobxReactLite === true || project.hasMobxStateTree === true || project.hasMobxReactObserver === true) capabilities.add("mobx");
|
|
41581
|
+
if (project.hasMobxReact === true) capabilities.add("mobx-react");
|
|
41582
|
+
if (project.hasMobxReactLite === true) capabilities.add("mobx-react-lite");
|
|
41583
|
+
if (project.hasMobxReact === true || project.hasMobxReactLite === true) capabilities.add("mobx-react-binding");
|
|
41584
|
+
const mobxReactVersion = parseDependencyMajorMinor(project.mobxReactVersion);
|
|
41585
|
+
const mobxReactLiteVersion = parseDependencyMajorMinor(project.mobxReactLiteVersion);
|
|
41586
|
+
const hasMobxReactObserverMemoGuard = mobxReactVersion !== null && isMajorMinorAtLeast(mobxReactVersion, {
|
|
41587
|
+
major: 7,
|
|
41588
|
+
minor: 3
|
|
41589
|
+
});
|
|
41590
|
+
const hasMobxReactLiteObserverMemoGuard = mobxReactLiteVersion !== null && isMajorMinorAtLeast(mobxReactLiteVersion, {
|
|
41591
|
+
major: 3,
|
|
41592
|
+
minor: 3
|
|
41593
|
+
});
|
|
41594
|
+
if (hasMobxReactObserverMemoGuard) capabilities.add("mobx-react-observer-memo-guard");
|
|
41595
|
+
if (hasMobxReactLiteObserverMemoGuard) capabilities.add("mobx-react-lite-observer-memo-guard");
|
|
41596
|
+
if (hasMobxReactObserverMemoGuard || hasMobxReactLiteObserverMemoGuard) capabilities.add("mobx-react-binding-observer-memo-guard");
|
|
41597
|
+
if (project.hasMobxStateTree === true) capabilities.add("mobx-state-tree");
|
|
41598
|
+
if (project.hasMobxReactObserver === true) capabilities.add("mobx-react-observer");
|
|
41599
|
+
if (project.mobxMajorVersion !== void 0 && project.mobxMajorVersion !== null && project.mobxMajorVersion >= 4 && project.mobxMajorVersion <= 6) addVersionCapabilityLadder(capabilities, "mobx", project.mobxMajorVersion, 4, 6);
|
|
41600
|
+
const mobxVersion = parseDependencyMajorMinor(project.mobxVersion);
|
|
41601
|
+
if (project.mobxMajorVersion === 6 && mobxVersion !== null && isMajorMinorAtLeast(mobxVersion, {
|
|
41602
|
+
major: 6,
|
|
41603
|
+
minor: 10
|
|
41604
|
+
})) capabilities.add("mobx:6.10");
|
|
41605
|
+
if (project.zustandVersion !== void 0 && project.zustandVersion !== null) capabilities.add("zustand");
|
|
41606
|
+
if (project.zustandMajorVersion !== void 0 && project.zustandMajorVersion !== null && project.zustandMajorVersion >= 1 && project.zustandMajorVersion <= 5) addVersionCapabilityLadder(capabilities, "zustand", project.zustandMajorVersion, 1, 5);
|
|
41084
41607
|
if (project.isPreES2023Target) capabilities.add("pre-es2023");
|
|
41085
41608
|
if (project.hasReactCompiler) capabilities.add("react-compiler");
|
|
41086
|
-
if (project.hasTanStackQuery) capabilities.add("tanstack-query");
|
|
41609
|
+
if (Boolean(project.hasTanStackQuery) || Boolean(project.tanstackQueryVersion)) capabilities.add("tanstack-query");
|
|
41610
|
+
if (project.styledComponentsVersion) {
|
|
41611
|
+
capabilities.add("styled-components");
|
|
41612
|
+
const styledComponentsMajor = getLowestDependencyMajor(project.styledComponentsVersion);
|
|
41613
|
+
if (styledComponentsMajor !== null && styledComponentsMajor >= 6) capabilities.add("styled-components:6");
|
|
41614
|
+
}
|
|
41615
|
+
if (project.hasI18nLibrary) capabilities.add("i18n");
|
|
41616
|
+
if (project.valtioVersion !== null) capabilities.add("valtio");
|
|
41617
|
+
addVersionCapabilityLadder(capabilities, "valtio", project.valtioMajorVersion, 1, 10);
|
|
41618
|
+
if (project.hasRemotion) {
|
|
41619
|
+
capabilities.add("remotion");
|
|
41620
|
+
addVersionCapabilityLadder(capabilities, "remotion", project.remotionMajorVersion ?? null, 4, 30);
|
|
41621
|
+
}
|
|
41622
|
+
if (project.hasThree || project.hasReactThreeFiber) capabilities.add("three");
|
|
41623
|
+
addVersionCapabilityLadder(capabilities, "three", project.threeRelease ?? null, 145, 250);
|
|
41624
|
+
if (project.hasReactThreeFiber) {
|
|
41625
|
+
capabilities.add("r3f");
|
|
41626
|
+
addVersionCapabilityLadder(capabilities, "r3f", project.reactThreeFiberMajorVersion ?? null, 3, 10);
|
|
41627
|
+
}
|
|
41087
41628
|
if (project.hasTypeScript) capabilities.add("typescript");
|
|
41088
41629
|
if (project.preactVersion !== null) capabilities.add("preact");
|
|
41089
|
-
|
|
41630
|
+
addVersionCapabilityLadder(capabilities, "preact", project.preactMajorVersion, 10, 20);
|
|
41090
41631
|
if (project.preactVersion !== null && project.reactVersion === null) capabilities.add("pure-preact");
|
|
41091
41632
|
return capabilities;
|
|
41092
41633
|
};
|
|
@@ -41098,7 +41639,7 @@ const getCapabilities = (project) => {
|
|
|
41098
41639
|
capabilitiesByProject.set(project, capabilities);
|
|
41099
41640
|
return capabilities;
|
|
41100
41641
|
};
|
|
41101
|
-
const shouldEnableRule = (requires, tags, capabilities, ignoredTags, disabledWhen) => {
|
|
41642
|
+
const shouldEnableRule = (requires, tags, capabilities, ignoredTags, disabledWhen, includedTags) => {
|
|
41102
41643
|
if (requires) {
|
|
41103
41644
|
for (const capability of requires) if (!capabilities.has(capability)) return false;
|
|
41104
41645
|
}
|
|
@@ -41109,20 +41650,29 @@ const shouldEnableRule = (requires, tags, capabilities, ignoredTags, disabledWhe
|
|
|
41109
41650
|
if (tags) {
|
|
41110
41651
|
for (const tag of tags) if (ignoredTags.has(tag)) return false;
|
|
41111
41652
|
}
|
|
41653
|
+
if (includedTags && includedTags.size > 0) {
|
|
41654
|
+
if (!tags?.some((tag) => includedTags.has(tag))) return false;
|
|
41655
|
+
}
|
|
41112
41656
|
return true;
|
|
41113
41657
|
};
|
|
41658
|
+
const shouldEnableRuleByDefaultStatus = (options) => options.defaultEnabled !== false || options.hasExplicitOverride === true || options.includeTagDefaults && options.hasIncludedTags;
|
|
41114
41659
|
const yieldToEventLoop = () => new Promise((resolve) => {
|
|
41115
41660
|
setImmediate(resolve);
|
|
41116
41661
|
});
|
|
41117
41662
|
const createSecurityScanSession = (rootDirectory, options) => {
|
|
41118
41663
|
const capabilities = options.project ? getCapabilities(options.project) : /* @__PURE__ */ new Set();
|
|
41119
41664
|
const ignoredTags = options.ignoredTags ?? /* @__PURE__ */ new Set();
|
|
41665
|
+
const includedTags = options.includedTags ?? /* @__PURE__ */ new Set();
|
|
41120
41666
|
const enabledScanRules = REACT_DOCTOR_RULES.flatMap((entry) => {
|
|
41121
41667
|
const rule = entry.rule;
|
|
41122
41668
|
const scan = rule.scan;
|
|
41123
41669
|
if (typeof scan !== "function") return [];
|
|
41124
|
-
if (
|
|
41125
|
-
|
|
41670
|
+
if (!shouldEnableRuleByDefaultStatus({
|
|
41671
|
+
defaultEnabled: rule.defaultEnabled,
|
|
41672
|
+
includeTagDefaults: options.includeTagDefaults === true,
|
|
41673
|
+
hasIncludedTags: includedTags.size > 0
|
|
41674
|
+
})) return [];
|
|
41675
|
+
if (!shouldEnableRule(rule.requires, rule.tags, capabilities, ignoredTags, rule.disabledWhen, includedTags)) return [];
|
|
41126
41676
|
return [{
|
|
41127
41677
|
entry,
|
|
41128
41678
|
scan,
|
|
@@ -43124,8 +43674,9 @@ const buildUserPluginRules = (userPlugin, severityControls) => {
|
|
|
43124
43674
|
}
|
|
43125
43675
|
return enabled;
|
|
43126
43676
|
};
|
|
43127
|
-
const createOxlintConfig = ({ pluginPath, project, customRulesOnly = false, extendsPaths = [], ignoredTags = /* @__PURE__ */ new Set(), serverAuthFunctionNames, severityControls, userPlugins = [], disableReactHooksJsPlugin = false, ruleSelection, sidecarRuleIdFilter }) => {
|
|
43128
|
-
const
|
|
43677
|
+
const createOxlintConfig = ({ pluginPath, project, customRulesOnly = false, extendsPaths = [], ignoredTags = /* @__PURE__ */ new Set(), includedTags = /* @__PURE__ */ new Set(), includeTagDefaults = false, serverAuthFunctionNames, severityControls, userPlugins = [], disableReactHooksJsPlugin = false, ruleSelection, sidecarRuleIdFilter }) => {
|
|
43678
|
+
const hasIncludedTags = includedTags.size > 0;
|
|
43679
|
+
const reactHooksJsPlugin = disableReactHooksJsPlugin || ruleSelection === "sidecar" || hasIncludedTags ? null : resolveReactHooksJsPlugin(project.hasReactCompiler || project.hasReactCompilerLintPlugin === true, customRulesOnly);
|
|
43129
43680
|
const reactCompilerRules = reactHooksJsPlugin ? applyRuleSeverityControls(filterRulesToAvailable(REACT_COMPILER_RULES, "react-hooks-js", reactHooksJsPlugin.availableRuleNames), severityControls) : {};
|
|
43130
43681
|
const jsPlugins = [];
|
|
43131
43682
|
if (reactHooksJsPlugin) jsPlugins.push(reactHooksJsPlugin.entry);
|
|
@@ -43140,9 +43691,14 @@ const createOxlintConfig = ({ pluginPath, project, customRulesOnly = false, exte
|
|
|
43140
43691
|
if (rule.scan !== void 0) continue;
|
|
43141
43692
|
if (customRulesOnly && registryEntry.originallyExternal) continue;
|
|
43142
43693
|
if (rule.framework !== "global" && !rule.requires) continue;
|
|
43143
|
-
if (!shouldEnableRule(rule.requires, rule.tags, capabilities, ignoredTags, rule.disabledWhen)) continue;
|
|
43694
|
+
if (!shouldEnableRule(rule.requires, rule.tags, capabilities, ignoredTags, rule.disabledWhen, includedTags)) continue;
|
|
43144
43695
|
const explicitRuleOverride = resolveRuleSeverityOverride({ ruleKey: registryEntry.key }, severityControls);
|
|
43145
|
-
if (
|
|
43696
|
+
if (!shouldEnableRuleByDefaultStatus({
|
|
43697
|
+
defaultEnabled: rule.defaultEnabled,
|
|
43698
|
+
includeTagDefaults,
|
|
43699
|
+
hasIncludedTags,
|
|
43700
|
+
hasExplicitOverride: explicitRuleOverride !== void 0
|
|
43701
|
+
})) continue;
|
|
43146
43702
|
const severity = resolveRuleSeverityOverride({
|
|
43147
43703
|
ruleKey: registryEntry.key,
|
|
43148
43704
|
category: rule.category
|
|
@@ -43151,7 +43707,7 @@ const createOxlintConfig = ({ pluginPath, project, customRulesOnly = false, exte
|
|
|
43151
43707
|
enabledReactDoctorRules[registryEntry.key] = severity;
|
|
43152
43708
|
}
|
|
43153
43709
|
const userPluginRules = {};
|
|
43154
|
-
if (ruleSelection !== "sidecar") for (const userPlugin of userPlugins) {
|
|
43710
|
+
if (ruleSelection !== "sidecar" && !hasIncludedTags) for (const userPlugin of userPlugins) {
|
|
43155
43711
|
Object.assign(userPluginRules, buildUserPluginRules(userPlugin, severityControls));
|
|
43156
43712
|
jsPlugins.push(userPlugin.entry);
|
|
43157
43713
|
}
|
|
@@ -43368,6 +43924,19 @@ const createSidecarLintCache = (cacheDirectory, rulesetHash) => {
|
|
|
43368
43924
|
}
|
|
43369
43925
|
};
|
|
43370
43926
|
};
|
|
43927
|
+
const fingerprintCacheByFilePath = /* @__PURE__ */ new Map();
|
|
43928
|
+
const fingerprintFileContents = (filePath, fingerprintLength) => {
|
|
43929
|
+
const fileStats = NFS.statSync(filePath, { bigint: true });
|
|
43930
|
+
const cachedFingerprint = fingerprintCacheByFilePath.get(filePath);
|
|
43931
|
+
if (cachedFingerprint?.modifiedTimeNanoseconds === fileStats.mtimeNs && cachedFingerprint.sizeBytes === fileStats.size) return cachedFingerprint.fingerprint;
|
|
43932
|
+
const fingerprint = crypto.createHash("sha256").update(NFS.readFileSync(filePath)).digest("hex").slice(0, fingerprintLength);
|
|
43933
|
+
fingerprintCacheByFilePath.set(filePath, {
|
|
43934
|
+
fingerprint,
|
|
43935
|
+
modifiedTimeNanoseconds: fileStats.mtimeNs,
|
|
43936
|
+
sizeBytes: fileStats.size
|
|
43937
|
+
});
|
|
43938
|
+
return fingerprint;
|
|
43939
|
+
};
|
|
43371
43940
|
const bundledRequire$3 = createRequire(import.meta.url);
|
|
43372
43941
|
const childNodeVersionByBinaryPath = /* @__PURE__ */ new Map();
|
|
43373
43942
|
const resolveChildNodeVersion = (nodeBinaryPath) => {
|
|
@@ -43391,6 +43960,13 @@ const TOOLCHAIN_PACKAGE_SPECIFIERS$1 = [
|
|
|
43391
43960
|
"oxlint-plugin-react-doctor/package.json",
|
|
43392
43961
|
"eslint-plugin-react-hooks/package.json"
|
|
43393
43962
|
];
|
|
43963
|
+
const resolvePluginFingerprint = () => {
|
|
43964
|
+
try {
|
|
43965
|
+
return fingerprintFileContents(bundledRequire$3.resolve("oxlint-plugin-react-doctor"), 16);
|
|
43966
|
+
} catch {
|
|
43967
|
+
return "unresolved";
|
|
43968
|
+
}
|
|
43969
|
+
};
|
|
43394
43970
|
const resolveOxlintToolchainVersions = (nodeBinaryPath = process.execPath) => {
|
|
43395
43971
|
const versions = [`node=${resolveChildNodeVersion(nodeBinaryPath)}`];
|
|
43396
43972
|
for (const specifier of TOOLCHAIN_PACKAGE_SPECIFIERS$1) try {
|
|
@@ -43400,6 +43976,7 @@ const resolveOxlintToolchainVersions = (nodeBinaryPath = process.execPath) => {
|
|
|
43400
43976
|
} catch {
|
|
43401
43977
|
versions.push(`${specifier}=missing`);
|
|
43402
43978
|
}
|
|
43979
|
+
versions.push(`oxlint-plugin-react-doctor#fingerprint=${resolvePluginFingerprint()}`);
|
|
43403
43980
|
return versions;
|
|
43404
43981
|
};
|
|
43405
43982
|
const esmRequire = createRequire(import.meta.url);
|
|
@@ -44875,7 +45452,7 @@ const reactHooksJsPluginDropNote = (error) => {
|
|
|
44875
45452
|
* 6. always restore disable directives + clean up the temp dir
|
|
44876
45453
|
*/
|
|
44877
45454
|
const runOxlint = async (options) => {
|
|
44878
|
-
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;
|
|
45455
|
+
const { rootDirectory, project, includePaths, nodeBinaryPath = process.execPath, customRulesOnly = false, respectInlineDisables = true, adoptExistingLintConfig = true, ignoredTags = /* @__PURE__ */ new Set(), includedTags = /* @__PURE__ */ new Set(), includeTagDefaults = false, userConfig, configSourceDirectory = rootDirectory, onPartialFailure, onFileCoverage, perFileLintCacheEnabled = false, sidecarLintCacheEnabled = false, onCacheStats, onSidecarStats, spawnTimeoutMs, outputMaxBytes, lintBatchOrdering = "cost" } = options;
|
|
44879
45456
|
const serverAuthFunctionNames = Array.isArray(userConfig?.serverAuthFunctionNames) ? userConfig.serverAuthFunctionNames.filter((entry) => typeof entry === "string" && entry.length > 0) : void 0;
|
|
44880
45457
|
const severityControls = buildRuleSeverityControls(userConfig);
|
|
44881
45458
|
validateRuleRegistration();
|
|
@@ -44889,13 +45466,15 @@ const runOxlint = async (options) => {
|
|
|
44889
45466
|
}
|
|
44890
45467
|
const pluginPath = resolvePluginPath();
|
|
44891
45468
|
const extendsPaths = (adoptExistingLintConfig && !customRulesOnly ? detectUserLintConfigPaths(rootDirectory) : []).filter(canOxlintExtendConfig);
|
|
44892
|
-
const userPlugins = resolveUserPlugins(userConfig?.plugins, configSourceDirectory);
|
|
45469
|
+
const userPlugins = includedTags.size > 0 ? [] : resolveUserPlugins(userConfig?.plugins, configSourceDirectory);
|
|
44893
45470
|
const buildConfig = (overrides) => createOxlintConfig({
|
|
44894
45471
|
pluginPath,
|
|
44895
45472
|
project,
|
|
44896
45473
|
customRulesOnly,
|
|
44897
45474
|
extendsPaths: overrides.extendsPaths,
|
|
44898
45475
|
ignoredTags,
|
|
45476
|
+
includedTags,
|
|
45477
|
+
includeTagDefaults,
|
|
44899
45478
|
serverAuthFunctionNames,
|
|
44900
45479
|
severityControls,
|
|
44901
45480
|
userPlugins,
|
|
@@ -45284,6 +45863,8 @@ var Linter = class Linter extends Service()("react-doctor/Linter") {
|
|
|
45284
45863
|
respectInlineDisables: input.respectInlineDisables,
|
|
45285
45864
|
adoptExistingLintConfig: input.adoptExistingLintConfig,
|
|
45286
45865
|
ignoredTags: input.ignoredTags,
|
|
45866
|
+
includedTags: input.includedTags,
|
|
45867
|
+
includeTagDefaults: input.includeTagDefaults,
|
|
45287
45868
|
userConfig: input.userConfig ?? null,
|
|
45288
45869
|
configSourceDirectory: input.configSourceDirectory,
|
|
45289
45870
|
onPartialFailure: (reason) => {
|
|
@@ -46132,7 +46713,9 @@ const runInspect = (input, hooks = {}) => gen(function* () {
|
|
|
46132
46713
|
const securityScanFailedRef = yield* make$13(false);
|
|
46133
46714
|
const securityScanFiber = yield* forkChild(runCollect(applyPerElementPipeline(isDiffMode ? empty$4 : unwrap(tryPromise(() => checkSecurityScanCooperative(scanDirectory, {
|
|
46134
46715
|
project,
|
|
46135
|
-
ignoredTags: input.ignoredTags
|
|
46716
|
+
ignoredTags: input.ignoredTags,
|
|
46717
|
+
includedTags: input.includedTags,
|
|
46718
|
+
includeTagDefaults: input.includeTagDefaults
|
|
46136
46719
|
})).pipe(map$3((diagnostics) => fromIterable$1(diagnostics)), catch_$1(() => set(securityScanFailedRef, true).pipe(as(empty$4))))))).pipe(withSpan("SecurityScan.run")));
|
|
46137
46720
|
const shouldRunSupplyChain = !isDiffMode || (input.supplyChainManifestChanged ?? false);
|
|
46138
46721
|
const supplyChainOverlapTimeout = yield* SupplyChainOverlapTimeoutMs;
|
|
@@ -46223,6 +46806,8 @@ const runInspect = (input, hooks = {}) => gen(function* () {
|
|
|
46223
46806
|
respectInlineDisables: input.respectInlineDisables,
|
|
46224
46807
|
adoptExistingLintConfig: input.adoptExistingLintConfig,
|
|
46225
46808
|
ignoredTags: input.ignoredTags,
|
|
46809
|
+
includedTags: input.includedTags,
|
|
46810
|
+
includeTagDefaults: input.includeTagDefaults,
|
|
46226
46811
|
userConfig: resolvedConfig.config ?? void 0,
|
|
46227
46812
|
configSourceDirectory: resolvedConfig.configSourceDirectory ?? void 0,
|
|
46228
46813
|
onFileProgress: (scannedFileCount, totalFileCount) => {
|
|
@@ -47367,7 +47952,7 @@ const makeNoopConsole = () => ({
|
|
|
47367
47952
|
});
|
|
47368
47953
|
//#endregion
|
|
47369
47954
|
//#region src/cli/utils/version.ts
|
|
47370
|
-
const VERSION = "0.8.1-dev.
|
|
47955
|
+
const VERSION = "0.8.1-dev.412377e";
|
|
47371
47956
|
//#endregion
|
|
47372
47957
|
//#region src/cli/utils/json-mode.ts
|
|
47373
47958
|
let context = null;
|
|
@@ -47454,7 +48039,11 @@ const getRunId = () => {
|
|
|
47454
48039
|
};
|
|
47455
48040
|
//#endregion
|
|
47456
48041
|
//#region src/cli/utils/build-run-context.ts
|
|
47457
|
-
const ROOT_SUBCOMMANDS = new Set([
|
|
48042
|
+
const ROOT_SUBCOMMANDS = new Set([
|
|
48043
|
+
"design",
|
|
48044
|
+
"install",
|
|
48045
|
+
"setup"
|
|
48046
|
+
]);
|
|
47458
48047
|
const detectInvokedVia = () => {
|
|
47459
48048
|
const userAgent = process.env.npm_config_user_agent;
|
|
47460
48049
|
if (!userAgent) return "unknown";
|
|
@@ -47538,7 +48127,9 @@ const buildSentryProjectContext = (projectInfo) => ({
|
|
|
47538
48127
|
reactMajorVersion: projectInfo.reactMajorVersion,
|
|
47539
48128
|
hasTypeScript: projectInfo.hasTypeScript,
|
|
47540
48129
|
hasReactCompiler: projectInfo.hasReactCompiler,
|
|
47541
|
-
|
|
48130
|
+
tanstackQueryVersion: projectInfo.tanstackQueryVersion,
|
|
48131
|
+
mobxVersion: projectInfo.mobxVersion,
|
|
48132
|
+
styledComponentsVersion: projectInfo.styledComponentsVersion,
|
|
47542
48133
|
tailwindVersion: projectInfo.tailwindVersion,
|
|
47543
48134
|
zodVersion: projectInfo.zodVersion,
|
|
47544
48135
|
preactVersion: projectInfo.preactVersion,
|
|
@@ -47719,13 +48310,13 @@ const isDevVersion = (version) => version === "0.0.0" || version.includes("-");
|
|
|
47719
48310
|
* uploads source-map artifacts under, so stack frames symbolicate. Honors the
|
|
47720
48311
|
* standard `SENTRY_RELEASE` override.
|
|
47721
48312
|
*/
|
|
47722
|
-
const resolveSentryRelease = () => process.env.SENTRY_RELEASE || `react-doctor@0.8.1-dev.
|
|
48313
|
+
const resolveSentryRelease = () => process.env.SENTRY_RELEASE || `react-doctor@0.8.1-dev.412377e`;
|
|
47723
48314
|
/**
|
|
47724
48315
|
* Deployment environment shown in Sentry's environment filter. Defaults to
|
|
47725
48316
|
* `production` for tagged releases and `development` for dev/unbuilt versions,
|
|
47726
48317
|
* overridable via the standard `SENTRY_ENVIRONMENT` env var.
|
|
47727
48318
|
*/
|
|
47728
|
-
const resolveSentryEnvironment = () => process.env.SENTRY_ENVIRONMENT || (isDevVersion("0.8.1-dev.
|
|
48319
|
+
const resolveSentryEnvironment = () => process.env.SENTRY_ENVIRONMENT || (isDevVersion("0.8.1-dev.412377e") ? "development" : "production");
|
|
47729
48320
|
/**
|
|
47730
48321
|
* Performance-tracing sample rate in `[0, 1]`. Reads `SENTRY_TRACES_SAMPLE_RATE`
|
|
47731
48322
|
* (set to `0` to disable tracing) and falls back to
|
|
@@ -60051,6 +60642,8 @@ const buildScanResultCacheKey = (input) => {
|
|
|
60051
60642
|
warnings: input.options.warnings,
|
|
60052
60643
|
adoptExistingLintConfig: input.options.adoptExistingLintConfig,
|
|
60053
60644
|
ignoredTags: [...input.options.ignoredTags].sort(),
|
|
60645
|
+
includedTags: [...input.options.includedTags].sort(),
|
|
60646
|
+
includeTagDefaults: input.options.includeTagDefaults,
|
|
60054
60647
|
concurrency: input.options.concurrency,
|
|
60055
60648
|
lintBatchOrdering: resolveLintBatchOrdering(),
|
|
60056
60649
|
baselineRef: input.options.baseline?.ref,
|
|
@@ -60877,8 +61470,8 @@ const createDiagnosticEvidenceReader = (rootDirectory, options = {}) => {
|
|
|
60877
61470
|
//#endregion
|
|
60878
61471
|
//#region src/cli/utils/build-no-score-message.ts
|
|
60879
61472
|
const ENTERPRISE_CONTACT_HINT = `Want something custom to your company? Contact us at ${ENTERPRISE_CONTACT_URL}.`;
|
|
60880
|
-
const buildNoScoreMessage = (isScoreDisabled) => {
|
|
60881
|
-
return `${isScoreDisabled ? "Score disabled by --no-score." : "Score unavailable (could not reach the score API)."} ${ENTERPRISE_CONTACT_HINT}`;
|
|
61473
|
+
const buildNoScoreMessage = (isScoreDisabled, disabledMessage) => {
|
|
61474
|
+
return `${isScoreDisabled ? disabledMessage ?? "Score disabled by --no-score." : "Score unavailable (could not reach the score API)."} ${ENTERPRISE_CONTACT_HINT}`;
|
|
60882
61475
|
};
|
|
60883
61476
|
//#endregion
|
|
60884
61477
|
//#region src/cli/utils/render-agent-guidance.ts
|
|
@@ -62003,40 +62596,47 @@ const buildChangedLineMatcher = (directory, changedLineRanges) => {
|
|
|
62003
62596
|
return diagnosticIntersectsLineRanges(diagnostic, ranges);
|
|
62004
62597
|
};
|
|
62005
62598
|
};
|
|
62006
|
-
const buildIgnoredTags = (userConfig) => {
|
|
62599
|
+
const buildIgnoredTags = (userConfig, includedTags) => {
|
|
62007
62600
|
const tags = /* @__PURE__ */ new Set();
|
|
62008
62601
|
if (userConfig?.ignore?.tags) for (const tag of userConfig.ignore.tags) tags.add(tag);
|
|
62602
|
+
for (const tag of includedTags) tags.delete(tag);
|
|
62009
62603
|
return tags;
|
|
62010
62604
|
};
|
|
62011
|
-
const mergeInspectOptions = (inputOptions, userConfig) =>
|
|
62012
|
-
|
|
62013
|
-
|
|
62014
|
-
|
|
62015
|
-
|
|
62016
|
-
|
|
62017
|
-
|
|
62018
|
-
|
|
62019
|
-
|
|
62020
|
-
|
|
62021
|
-
|
|
62022
|
-
|
|
62023
|
-
|
|
62024
|
-
|
|
62025
|
-
|
|
62026
|
-
|
|
62027
|
-
|
|
62028
|
-
|
|
62029
|
-
|
|
62030
|
-
|
|
62031
|
-
|
|
62032
|
-
|
|
62033
|
-
|
|
62034
|
-
|
|
62035
|
-
|
|
62036
|
-
|
|
62037
|
-
|
|
62038
|
-
|
|
62039
|
-
|
|
62605
|
+
const mergeInspectOptions = (inputOptions, userConfig) => {
|
|
62606
|
+
const includedTags = inputOptions.includedTags ?? /* @__PURE__ */ new Set();
|
|
62607
|
+
return {
|
|
62608
|
+
lint: inputOptions.lint ?? userConfig?.lint ?? true,
|
|
62609
|
+
deadCode: inputOptions.deadCode ?? userConfig?.deadCode ?? true,
|
|
62610
|
+
supplyChain: inputOptions.supplyChain ?? userConfig?.supplyChain?.enabled ?? true,
|
|
62611
|
+
verbose: inputOptions.verbose ?? userConfig?.verbose ?? false,
|
|
62612
|
+
outputDirectory: inputOptions.outputDirectory || null,
|
|
62613
|
+
scoreOnly: inputOptions.scoreOnly ?? false,
|
|
62614
|
+
noScore: inputOptions.noScore ?? userConfig?.noScore ?? false,
|
|
62615
|
+
isCi: inputOptions.isCi ?? false,
|
|
62616
|
+
isCiOrCodingAgentEnvironment: isCiOrCodingAgentEnvironment(),
|
|
62617
|
+
isNonInteractiveEnvironment: isNonInteractiveEnvironment(),
|
|
62618
|
+
silent: inputOptions.silent ?? false,
|
|
62619
|
+
includePaths: inputOptions.includePaths ?? [],
|
|
62620
|
+
customRulesOnly: includedTags.size > 0 ? false : userConfig?.customRulesOnly ?? false,
|
|
62621
|
+
share: userConfig?.share ?? true,
|
|
62622
|
+
respectInlineDisables: inputOptions.respectInlineDisables ?? userConfig?.respectInlineDisables ?? true,
|
|
62623
|
+
warnings: inputOptions.warnings ?? userConfig?.warnings ?? true,
|
|
62624
|
+
categoryFilters: new Set(resolveCliCategories(inputOptions.categoryFilters) ?? []),
|
|
62625
|
+
adoptExistingLintConfig: includedTags.size > 0 ? false : userConfig?.adoptExistingLintConfig ?? true,
|
|
62626
|
+
ignoredTags: buildIgnoredTags(userConfig, includedTags),
|
|
62627
|
+
includedTags,
|
|
62628
|
+
includeTagDefaults: inputOptions.includeTagDefaults ?? false,
|
|
62629
|
+
scoreDisabledMessage: inputOptions.scoreDisabledMessage,
|
|
62630
|
+
outputSurface: inputOptions.outputSurface ?? "cli",
|
|
62631
|
+
suppressRendering: inputOptions.suppressRendering ?? false,
|
|
62632
|
+
concurrentScan: inputOptions.concurrentScan ?? false,
|
|
62633
|
+
concurrency: inputOptions.concurrency,
|
|
62634
|
+
maxDurationMs: inputOptions.maxDurationMs ?? null,
|
|
62635
|
+
baseline: inputOptions.baseline ?? null,
|
|
62636
|
+
changedLineRanges: inputOptions.changedLineRanges ?? null,
|
|
62637
|
+
supplyChainManifestChanged: inputOptions.supplyChainManifestChanged ?? false
|
|
62638
|
+
};
|
|
62639
|
+
};
|
|
62040
62640
|
const deriveScope = (options) => {
|
|
62041
62641
|
if (options.baseline) return "changed";
|
|
62042
62642
|
if (options.changedLineRanges !== null) return "lines";
|
|
@@ -62167,6 +62767,8 @@ const runBaselineComparison = async (params) => {
|
|
|
62167
62767
|
warnings: params.options.warnings,
|
|
62168
62768
|
adoptExistingLintConfig: params.options.adoptExistingLintConfig,
|
|
62169
62769
|
ignoredTags: params.options.ignoredTags,
|
|
62770
|
+
includedTags: params.options.includedTags,
|
|
62771
|
+
includeTagDefaults: params.options.includeTagDefaults,
|
|
62170
62772
|
nodeBinaryPath: params.resolvedNodeBinaryPath ?? void 0,
|
|
62171
62773
|
runDeadCode: false,
|
|
62172
62774
|
isCi: params.options.isCi,
|
|
@@ -62260,6 +62862,8 @@ const runInspectWithRuntime = async (directory, options, userConfig, hasConfigOv
|
|
|
62260
62862
|
warnings: options.warnings,
|
|
62261
62863
|
adoptExistingLintConfig: options.adoptExistingLintConfig,
|
|
62262
62864
|
ignoredTags: options.ignoredTags,
|
|
62865
|
+
includedTags: options.includedTags,
|
|
62866
|
+
includeTagDefaults: options.includeTagDefaults,
|
|
62263
62867
|
nodeBinaryPath: resolvedNodeBinaryPath ?? void 0,
|
|
62264
62868
|
runDeadCode: options.deadCode,
|
|
62265
62869
|
isCi: options.isCi,
|
|
@@ -62448,7 +63052,7 @@ const finalizeAndRender = (input) => gen(function* () {
|
|
|
62448
63052
|
securityScanFailed
|
|
62449
63053
|
});
|
|
62450
63054
|
const hasSkippedChecks = skippedChecks.length > 0;
|
|
62451
|
-
const noScoreMessage = buildNoScoreMessage(options.noScore);
|
|
63055
|
+
const noScoreMessage = buildNoScoreMessage(options.noScore, options.scoreDisabledMessage);
|
|
62452
63056
|
const buildResult = () => ({
|
|
62453
63057
|
diagnostics: [...diagnostics],
|
|
62454
63058
|
score,
|
|
@@ -64553,21 +65157,25 @@ const resolveParallelFlag = (parallel) => parallel === false ? 1 : void 0;
|
|
|
64553
65157
|
*/
|
|
64554
65158
|
const resolveCliInspectOptions = (flags, userConfig) => {
|
|
64555
65159
|
const wantsWarningGate = pickBlockingLevel(flags, userConfig) === "warning";
|
|
65160
|
+
const isDesignScan = flags.design === true;
|
|
64556
65161
|
return {
|
|
64557
65162
|
lint: flags.lint,
|
|
64558
|
-
deadCode: flags.deadCode,
|
|
64559
|
-
supplyChain: flags.supplyChain,
|
|
65163
|
+
deadCode: isDesignScan ? false : flags.deadCode,
|
|
65164
|
+
supplyChain: isDesignScan ? false : flags.supplyChain,
|
|
64560
65165
|
verbose: flags.verbose,
|
|
64561
65166
|
outputDirectory: flags.outputDir,
|
|
64562
65167
|
respectInlineDisables: flags.respectInlineDisables === false ? false : void 0,
|
|
64563
65168
|
warnings: wantsWarningGate ? true : flags.warnings,
|
|
64564
65169
|
scoreOnly: flags.score === true,
|
|
64565
|
-
noScore: flags.score === false || flags.telemetry === false ? true : void 0,
|
|
65170
|
+
noScore: isDesignScan || flags.score === false || flags.telemetry === false ? true : void 0,
|
|
64566
65171
|
isCi: isCiEnvironment(),
|
|
64567
65172
|
silent: Boolean(flags.json),
|
|
64568
65173
|
concurrency: resolveParallelFlag(flags.parallel),
|
|
64569
65174
|
maxDurationMs: resolveMaxDurationFlag(flags.maxDuration),
|
|
64570
|
-
categoryFilters: resolveCliCategories(flags.category)
|
|
65175
|
+
categoryFilters: resolveCliCategories(flags.category),
|
|
65176
|
+
includedTags: isDesignScan ? new Set(["design"]) : void 0,
|
|
65177
|
+
includeTagDefaults: isDesignScan ? true : void 0,
|
|
65178
|
+
scoreDisabledMessage: isDesignScan ? "Design scans do not affect the React health score." : void 0
|
|
64571
65179
|
};
|
|
64572
65180
|
};
|
|
64573
65181
|
//#endregion
|
|
@@ -64985,7 +65593,7 @@ const maybeMigrateLegacyConfig = async (requestedDirectory, { isQuiet, isStaged
|
|
|
64985
65593
|
if (!(!isQuiet && !isStaged && process.stdout.isTTY === true && !isCiOrCodingAgentEnvironment())) return;
|
|
64986
65594
|
await runProjectMigrations(requestedDirectory);
|
|
64987
65595
|
};
|
|
64988
|
-
const inspectAction = async (directory, flags) => {
|
|
65596
|
+
const inspectAction = async (directory, flags, invocationCommand = "inspect") => {
|
|
64989
65597
|
const isScoreOnly = Boolean(flags.score);
|
|
64990
65598
|
const isJsonMode = Boolean(flags.json);
|
|
64991
65599
|
const isQuiet = isScoreOnly || isJsonMode;
|
|
@@ -64999,7 +65607,7 @@ const inspectAction = async (directory, flags) => {
|
|
|
64999
65607
|
});
|
|
65000
65608
|
if (flags.jsonOut) recordCount(METRIC.jsonOutUsed, 1);
|
|
65001
65609
|
}
|
|
65002
|
-
recordCount(METRIC.cliInvoked, 1, { command:
|
|
65610
|
+
recordCount(METRIC.cliInvoked, 1, { command: invocationCommand });
|
|
65003
65611
|
try {
|
|
65004
65612
|
validateModeFlags(flags);
|
|
65005
65613
|
if (flags.staged) setJsonReportMode("staged");
|
|
@@ -65311,6 +65919,13 @@ const inspectAction = async (directory, flags) => {
|
|
|
65311
65919
|
}
|
|
65312
65920
|
};
|
|
65313
65921
|
//#endregion
|
|
65922
|
+
//#region src/cli/commands/design.ts
|
|
65923
|
+
const designAction = async (directory, flags) => inspectAction(directory, {
|
|
65924
|
+
...flags,
|
|
65925
|
+
design: true,
|
|
65926
|
+
lint: flags.lint ?? true
|
|
65927
|
+
}, "design");
|
|
65928
|
+
//#endregion
|
|
65314
65929
|
//#region src/cli/commands/install.ts
|
|
65315
65930
|
const installAction = async (options, command) => {
|
|
65316
65931
|
recordCount(METRIC.cliInvoked, 1, { command: "install" });
|
|
@@ -66147,6 +66762,7 @@ const INSTALL_FLAG_SPEC = {
|
|
|
66147
66762
|
shortOptionsWithRequiredValues: new Set(["-c"])
|
|
66148
66763
|
};
|
|
66149
66764
|
const COMMAND_FLAG_SPECS = new Map([
|
|
66765
|
+
["design", ROOT_FLAG_SPEC],
|
|
66150
66766
|
["install", INSTALL_FLAG_SPEC],
|
|
66151
66767
|
["setup", INSTALL_FLAG_SPEC],
|
|
66152
66768
|
["version", {
|
|
@@ -66303,6 +66919,7 @@ ${formatExampleLines([
|
|
|
66303
66919
|
["react-doctor --scope changed --base main", "scan only new issues vs. main"],
|
|
66304
66920
|
["react-doctor --project modules/a,modules/b", "score each module separately (names or paths)"],
|
|
66305
66921
|
["react-doctor --staged", "scan staged files (pre-commit hook)"],
|
|
66922
|
+
["react-doctor design", "run the focused UI design audit"],
|
|
66306
66923
|
["react-doctor --category Security", "show only one diagnostic category"],
|
|
66307
66924
|
["react-doctor --blocking warning", "fail CI on warnings too (default: error)"],
|
|
66308
66925
|
["react-doctor --json > report.json", "write a machine-readable report"],
|
|
@@ -66336,6 +66953,20 @@ ${highlighter.dim("Managing CI:")}
|
|
|
66336
66953
|
${highlighter.dim("Learn more:")}
|
|
66337
66954
|
${highlighter.info(CANONICAL_GITHUB_URL)}
|
|
66338
66955
|
`;
|
|
66956
|
+
const renderDesignHelpEpilog = () => `
|
|
66957
|
+
${highlighter.dim("Examples:")}
|
|
66958
|
+
${formatExampleLines([
|
|
66959
|
+
["react-doctor design", "audit UI design in the current project"],
|
|
66960
|
+
["react-doctor design ./apps/web", "audit one application"],
|
|
66961
|
+
["react-doctor design --verbose", "show every design finding"],
|
|
66962
|
+
["react-doctor design --json", "write a design-only JSON report"]
|
|
66963
|
+
])}
|
|
66964
|
+
|
|
66965
|
+
${highlighter.dim("Scope:")}
|
|
66966
|
+
Runs only rules tagged ${highlighter.info("design")}, including focused rules that stay opt-in during a general health scan.
|
|
66967
|
+
Dead-code, supply-chain, external lint-config, custom-plugin, and health-score passes are skipped.
|
|
66968
|
+
Standard scan flags such as ${highlighter.info("--scope")}, ${highlighter.info("--project")}, ${highlighter.info("--verbose")}, and ${highlighter.info("--json")} still work.
|
|
66969
|
+
`;
|
|
66339
66970
|
const renderCiHelpEpilog = () => `
|
|
66340
66971
|
${highlighter.dim("Examples:")}
|
|
66341
66972
|
${formatExampleLines([
|
|
@@ -66357,6 +66988,7 @@ ${highlighter.dim("Learn more:")}
|
|
|
66357
66988
|
const collectCategoryOption = (value, previousValues) => [...previousValues ?? [], value];
|
|
66358
66989
|
const program = new Command().name("react-doctor").description("Diagnose React codebase health").version(VERSION, "-v, --version", "display the version number").argument("[directory]", "project directory to scan", ".").option("--lint", "enable linting").option("--no-lint", "skip linting").option("--dead-code", "enable dead-code analysis (default)").option("--no-dead-code", "skip dead-code analysis (unused files / exports / dependencies, circular imports)").option("--supply-chain", "enable the dependency supply-chain scan (default)").option("--no-supply-chain", "skip the dependency supply-chain scan (Socket.dev dependency health checks)").option("--verbose", "show every rule and per-file details (default shows top 3 rules)").option("--debug", "force a Sentry trace and print its id at the end (paste it into a bug report)").option("--output-dir <dir>", "directory for the full diagnostics dump (default: a temp folder)").option("--score", "output only the score").option("--json", "output a single structured JSON report (suppresses other output)").option("--json-compact", "with --json, emit compact JSON (no indentation)").option("--json-out <path>", "with --json, write the report to a file instead of stdout").option("-y, --yes", "skip prompts, scan all workspace projects").option("--no-parallel", "lint serially with one worker (default: parallel across CPU cores; set the worker count with REACT_DOCTOR_PARALLEL)").option("--project <name>", "select projects: workspace names or directory paths (comma-separated for multiple); overrides the `projects` config field").option("--scope <value>", "how much supported JS/TS source to scan/report: full (default), files, changed (only new issues vs base), or lines (issues whose source spans touch changed lines)").option("--base <ref>", "base git ref for files/changed/lines scope (auto-detected when omitted)").option("--include-untracked", "with --scope files/changed/lines, also scan ordinary untracked files (respects .gitignore)").addOption(new Option("--diff [base]", "[deprecated] alias for --scope changed (pass `false` to force a full scan)").hideHelp()).addOption(new Option("--changed-files-from <file>", "scan source files listed in a newline-delimited changed-files file").hideHelp()).option("--no-score", "skip the score API, the share URL, and crash reporting").addOption(new Option("--category <category>", "only show diagnostics in a category (repeatable; e.g. Security)").argParser(collectCategoryOption)).option("--no-telemetry", "alias for --no-score (skip the score API, share URL, and crash reporting)").option("--staged", "scan only staged (git index) files for pre-commit hooks").option("--max-duration <seconds>", "scan time budget for the whole run, shared across workspace projects: past it, remaining lint batches and dead-code are skipped and partial results are reported (skipped files are listed in the JSON report)").option("--blocking <level>", "severity that fails CI: error (default), warning, or none (advisory)").addOption(new Option("--fail-on <level>", "[deprecated] alias for --blocking <level>").hideHelp()).option("--no-respect-inline-disables", "audit mode: neutralize inline lint suppressions before scanning").option("--warnings", "show warning-severity diagnostics (default)").option("--no-warnings", "hide warning-severity diagnostics (errors only)").option("--color", "force colored output").option("--no-color", "disable colored output (also honors NO_COLOR)").addHelpText("after", renderRootHelpEpilog);
|
|
66359
66990
|
program.action(inspectAction);
|
|
66991
|
+
program.command("design [directory]").description("Run only the focused UI design diagnostics").addHelpText("after", renderDesignHelpEpilog).action((directory, _options, command) => designAction(directory ?? ".", command.optsWithGlobals()));
|
|
66360
66992
|
program.command("why <location>").description("Explain why a rule fired (or why a suppression didn't apply) at a file:line").option("--project <name>", "select projects: workspace names or directory paths (comma-separated for multiple)").option("-c, --cwd <cwd>", "working directory", process.cwd()).option("--color", "force colored output").option("--no-color", "disable colored output (also honors NO_COLOR)").action((location, options) => whyAction(location, options));
|
|
66361
66993
|
program.command("install").alias("setup").description("Install the react-doctor skill into your coding agents and optional git hook").option("-y, --yes", "skip prompts, install for all detected agents").option("--dry-run", "show what would be installed without writing files").option("--agent-hooks", "install native non-blocking agent hooks for Claude Code and Cursor").option("-c, --cwd <cwd>", "working directory", process.cwd()).option("--color", "force colored output").option("--no-color", "disable colored output (also honors NO_COLOR)").addHelpText("after", renderInstallHelpEpilog).action(installAction);
|
|
66362
66994
|
const providerOption = ["--provider <name>", "ci provider: github-actions or gitlab-ci (auto-detected by default)"];
|
|
@@ -66405,4 +67037,4 @@ Promise.resolve().then(() => assertNoRemovedFlags(process.argv)).then(() => prog
|
|
|
66405
67037
|
export {};
|
|
66406
67038
|
|
|
66407
67039
|
//# sourceMappingURL=cli.js.map
|
|
66408
|
-
//# debugId=
|
|
67040
|
+
//# debugId=87efffda-8fc4-5b52-80e1-7ec503c85206
|