react-doctor 0.8.1-dev.359d9b3 → 0.8.1-dev.5332cb6
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 +159 -793
- package/dist/index.d.ts +0 -45
- package/dist/index.js +115 -702
- package/dist/lsp.js +115 -702
- package/dist/skills/react-doctor/SKILL.md +0 -5
- package/package.json +4 -4
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]="24153a3f-aef9-53fd-8dff-9b016a9613fb")}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,6 +36022,44 @@ 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
|
+
};
|
|
36025
36063
|
const SOURCE_FILE_PATTERN = /\.(tsx?|jsx?|mts|mjs)$/;
|
|
36026
36064
|
const GENERATED_BUNDLE_FILE_PATTERN = /\.(iife|umd|global|min)\.m?js$/i;
|
|
36027
36065
|
const GENERATED_SOURCE_DIRECTORY_PATTERN = /(?:^|\/)__generated__\//;
|
|
@@ -36063,58 +36101,6 @@ const IGNORED_DIRECTORIES = new Set([
|
|
|
36063
36101
|
]);
|
|
36064
36102
|
const JSX_FILE_PATTERN = /\.(tsx|jsx)$/;
|
|
36065
36103
|
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
|
-
];
|
|
36118
36104
|
const SCORE_API_URL = "https://www.react.doctor/api/score";
|
|
36119
36105
|
const ENTERPRISE_CONTACT_URL = "https://react.doctor/enterprise";
|
|
36120
36106
|
const SHARE_BASE_URL = "https://react.doctor/share";
|
|
@@ -36266,44 +36252,6 @@ const SUPPLY_CHAIN_OVERLAP_TIMEOUT_MS = 9e4;
|
|
|
36266
36252
|
const SUPPLY_CHAIN_CACHE_TTL_MS = 864e5;
|
|
36267
36253
|
const SUPPLY_CHAIN_CACHE_SUBDIR = "supply-chain";
|
|
36268
36254
|
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
|
-
};
|
|
36307
36255
|
const lastSourceMappingUrl = (fileContent) => {
|
|
36308
36256
|
const lastReference = [...fileContent.matchAll(/\/\/# sourceMappingURL=(\S+)/g)].at(-1);
|
|
36309
36257
|
return lastReference ? lastReference[1] : null;
|
|
@@ -36623,10 +36571,10 @@ const FALLBACK_TSCONFIG_FILENAMES = ["tsconfig.app.json", "tsconfig.build.json"]
|
|
|
36623
36571
|
const FRAMEWORK_PACKAGES = {
|
|
36624
36572
|
next: "nextjs",
|
|
36625
36573
|
"@tanstack/react-start": "tanstack-start",
|
|
36626
|
-
"@remix-run/react": "remix",
|
|
36627
|
-
gatsby: "gatsby",
|
|
36628
36574
|
vite: "vite",
|
|
36629
36575
|
"react-scripts": "cra",
|
|
36576
|
+
"@remix-run/react": "remix",
|
|
36577
|
+
gatsby: "gatsby",
|
|
36630
36578
|
expo: "expo",
|
|
36631
36579
|
"react-native": "react-native"
|
|
36632
36580
|
};
|
|
@@ -36650,17 +36598,11 @@ const NEXT_CONFIG_FILENAMES = [
|
|
|
36650
36598
|
];
|
|
36651
36599
|
const BABEL_CONFIG_FILENAMES = [
|
|
36652
36600
|
".babelrc",
|
|
36653
|
-
".babelrc.js",
|
|
36654
36601
|
".babelrc.json",
|
|
36655
|
-
".babelrc.cjs",
|
|
36656
|
-
".babelrc.mjs",
|
|
36657
|
-
".babelrc.cts",
|
|
36658
36602
|
"babel.config.js",
|
|
36659
36603
|
"babel.config.json",
|
|
36660
36604
|
"babel.config.cjs",
|
|
36661
|
-
"babel.config.mjs"
|
|
36662
|
-
"babel.config.ts",
|
|
36663
|
-
"babel.config.cts"
|
|
36605
|
+
"babel.config.mjs"
|
|
36664
36606
|
];
|
|
36665
36607
|
const VITE_CONFIG_FILENAMES = [
|
|
36666
36608
|
"vite.config.js",
|
|
@@ -36672,28 +36614,12 @@ const VITE_CONFIG_FILENAMES = [
|
|
|
36672
36614
|
"vitest.config.ts",
|
|
36673
36615
|
"vitest.config.js"
|
|
36674
36616
|
];
|
|
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
|
-
];
|
|
36691
36617
|
const EXPO_APP_CONFIG_FILENAMES = [
|
|
36692
36618
|
"app.json",
|
|
36693
36619
|
"app.config.js",
|
|
36694
36620
|
"app.config.ts"
|
|
36695
36621
|
];
|
|
36696
|
-
const REACT_COMPILER_PACKAGE_REFERENCE_PATTERN = /babel-plugin-react-compiler|react-compiler-runtime|
|
|
36622
|
+
const REACT_COMPILER_PACKAGE_REFERENCE_PATTERN = /babel-plugin-react-compiler|react-compiler-runtime|["']react-compiler["']/;
|
|
36697
36623
|
const REACT_COMPILER_ENABLED_FLAG_PATTERN = /["']?reactCompiler["']?\s*:\s*(?:true\b|\{)/;
|
|
36698
36624
|
const STATIC_EXPORT_OUTPUT_PATTERN = /(?:^|[^.\w])["']?output["']?\s*:\s*["']export["']/m;
|
|
36699
36625
|
const hasCompilerPackage = (packageJson, compilerPackages) => {
|
|
@@ -36728,8 +36654,6 @@ const detectReactCompiler = (directory, packageJson) => {
|
|
|
36728
36654
|
if (hasCompilerInConfigFiles(directory, NEXT_CONFIG_FILENAMES)) return true;
|
|
36729
36655
|
if (hasCompilerInConfigFiles(directory, BABEL_CONFIG_FILENAMES)) return true;
|
|
36730
36656
|
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;
|
|
36733
36657
|
if (hasCompilerInConfigFiles(directory, EXPO_APP_CONFIG_FILENAMES)) return true;
|
|
36734
36658
|
return hasCompilerPackageInAncestors(directory, REACT_COMPILER_TRANSFORM_PACKAGES);
|
|
36735
36659
|
};
|
|
@@ -36738,7 +36662,7 @@ const detectNextjsStaticExport = (directory) => NEXT_CONFIG_FILENAMES.some((file
|
|
|
36738
36662
|
const filePath = Path.join(directory, filename);
|
|
36739
36663
|
return isFile(filePath) && STATIC_EXPORT_OUTPUT_PATTERN.test(NFS.readFileSync(filePath, "utf-8"));
|
|
36740
36664
|
});
|
|
36741
|
-
const UNRESOLVABLE_PROTOCOL_VERSION = /^(?:
|
|
36665
|
+
const UNRESOLVABLE_PROTOCOL_VERSION = /^(?:file|git|github|https?|link|patch|portal|workspace|npm):/i;
|
|
36742
36666
|
const DIST_TAG_VERSION = /^[a-z][a-z0-9._-]*$/i;
|
|
36743
36667
|
const WILDCARD_VERSION = /^[*xX](?:\.[*xX])*$/;
|
|
36744
36668
|
const NPM_ALIAS_VERSION = /^npm:(?:@[^/]+\/[^@]+|[^@]+)@(.+)$/i;
|
|
@@ -36871,16 +36795,6 @@ const getLowestDependencyMajor = (version) => {
|
|
|
36871
36795
|
}
|
|
36872
36796
|
return lowestMajor;
|
|
36873
36797
|
};
|
|
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
|
-
};
|
|
36884
36798
|
const isConcreteDependencyVersion = (version) => {
|
|
36885
36799
|
const normalizedVersion = normalizeDependencyVersion(version);
|
|
36886
36800
|
return normalizedVersion !== null && /\d/.test(normalizedVersion);
|
|
@@ -36924,18 +36838,9 @@ const parseReactMajorMinor = (reactVersion) => {
|
|
|
36924
36838
|
};
|
|
36925
36839
|
};
|
|
36926
36840
|
const parseLowerBoundVersion = (versionSpec) => import_semver.validRange(versionSpec) !== null ? import_semver.minVersion(versionSpec) : import_semver.coerce(versionSpec);
|
|
36927
|
-
const
|
|
36928
|
-
if (typeof
|
|
36929
|
-
const
|
|
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();
|
|
36841
|
+
const parseTailwindMajorMinor = (tailwindVersion) => {
|
|
36842
|
+
if (typeof tailwindVersion !== "string") return null;
|
|
36843
|
+
const trimmed = tailwindVersion.trim();
|
|
36939
36844
|
if (trimmed.length === 0) return null;
|
|
36940
36845
|
const lowerBound = parseLowerBoundVersion(trimmed);
|
|
36941
36846
|
if (lowerBound === null || lowerBound.major <= 0) return null;
|
|
@@ -36944,7 +36849,6 @@ const parseDependencyMajorMinor = (dependencyVersion) => {
|
|
|
36944
36849
|
minor: lowerBound.minor
|
|
36945
36850
|
};
|
|
36946
36851
|
};
|
|
36947
|
-
const parseTailwindMajorMinor = (tailwindVersion) => parseDependencyMajorMinor(tailwindVersion);
|
|
36948
36852
|
const hasUpperBoundOnlyPeerRange = (range) => {
|
|
36949
36853
|
if (typeof range !== "string") return false;
|
|
36950
36854
|
const normalizedRange = normalizeDependencyVersion(range);
|
|
@@ -36966,7 +36870,7 @@ const resolveEffectiveReactMajor = (reactVersion, packageJson) => {
|
|
|
36966
36870
|
if (peerFloor === null) return hasUpperBoundOnlyPeerRange(peerReactRange) ? null : installedReactMajor;
|
|
36967
36871
|
return installedReactMajor !== null ? Math.min(installedReactMajor, peerFloor) : peerFloor;
|
|
36968
36872
|
};
|
|
36969
|
-
const isCatalogReference = (version) =>
|
|
36873
|
+
const isCatalogReference = (version) => version.startsWith("catalog:");
|
|
36970
36874
|
const extractCatalogName = (version) => {
|
|
36971
36875
|
if (!isCatalogReference(version)) return null;
|
|
36972
36876
|
const name = version.slice(8).trim();
|
|
@@ -37116,12 +37020,6 @@ const TAILWIND_ZOD_SECTIONS = [
|
|
|
37116
37020
|
"devDependencies",
|
|
37117
37021
|
"peerDependencies"
|
|
37118
37022
|
];
|
|
37119
|
-
const DEPENDENCY_SPEC_SECTIONS = [
|
|
37120
|
-
"dependencies",
|
|
37121
|
-
"devDependencies",
|
|
37122
|
-
"peerDependencies",
|
|
37123
|
-
"optionalDependencies"
|
|
37124
|
-
];
|
|
37125
37023
|
const EMPTY_DEPENDENCY_INFO = {
|
|
37126
37024
|
reactVersion: null,
|
|
37127
37025
|
tailwindVersion: null,
|
|
@@ -37131,7 +37029,7 @@ const EMPTY_DEPENDENCY_INFO = {
|
|
|
37131
37029
|
const pickConcreteVersion = (packageJson, packageName, sections) => {
|
|
37132
37030
|
for (const section of sections) {
|
|
37133
37031
|
const version = packageJson[section]?.[packageName];
|
|
37134
|
-
if (
|
|
37032
|
+
if (version === void 0) continue;
|
|
37135
37033
|
if (isCatalogReference(version)) return null;
|
|
37136
37034
|
if (isConcreteDependencyVersion(version)) return version;
|
|
37137
37035
|
}
|
|
@@ -37163,16 +37061,13 @@ const extractDependencyInfo = (packageJson) => {
|
|
|
37163
37061
|
};
|
|
37164
37062
|
};
|
|
37165
37063
|
const getDependencySpec = (packageJson, packageName) => {
|
|
37166
|
-
|
|
37167
|
-
|
|
37168
|
-
if (typeof spec === "string") return spec;
|
|
37169
|
-
}
|
|
37170
|
-
return null;
|
|
37064
|
+
const spec = packageJson.dependencies?.[packageName] ?? packageJson.devDependencies?.[packageName] ?? packageJson.peerDependencies?.[packageName] ?? packageJson.optionalDependencies?.[packageName];
|
|
37065
|
+
return typeof spec === "string" ? spec : null;
|
|
37171
37066
|
};
|
|
37172
37067
|
const getDependencyDeclaration = ({ packageJson, packageName, sections }) => {
|
|
37173
37068
|
for (const section of sections) {
|
|
37174
37069
|
const version = packageJson[section]?.[packageName];
|
|
37175
|
-
if (
|
|
37070
|
+
if (version === void 0) continue;
|
|
37176
37071
|
return {
|
|
37177
37072
|
catalogReference: extractCatalogName(version) ?? null,
|
|
37178
37073
|
hasDeclaration: true,
|
|
@@ -37206,15 +37101,24 @@ const getPreactVersion = (packageJson) => {
|
|
|
37206
37101
|
...packageJson.devDependencies
|
|
37207
37102
|
}.preact ?? null;
|
|
37208
37103
|
};
|
|
37209
|
-
const
|
|
37104
|
+
const TANSTACK_QUERY_PACKAGES = new Set([
|
|
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 }) => {
|
|
37210
37118
|
if (version === null || !isCatalogReference(version)) return version;
|
|
37211
37119
|
const catalogName = extractCatalogName(version);
|
|
37212
|
-
const
|
|
37213
|
-
if (
|
|
37214
|
-
if (sourceDirectory !== rootDirectory || sourcePackageJson !== rootPackageJson) {
|
|
37215
|
-
const resolvedRootVersion = resolveCatalogVersion(rootPackageJson, packageName, rootDirectory, catalogName);
|
|
37216
|
-
if (resolvedRootVersion) return resolvedRootVersion;
|
|
37217
|
-
}
|
|
37120
|
+
const resolvedLocalVersion = resolveCatalogVersion(rootPackageJson, packageName, rootDirectory, catalogName);
|
|
37121
|
+
if (resolvedLocalVersion) return resolvedLocalVersion;
|
|
37218
37122
|
const monorepoRoot = findMonorepoRoot(rootDirectory);
|
|
37219
37123
|
if (!monorepoRoot) return version;
|
|
37220
37124
|
const monorepoPackageJsonPath = Path.join(monorepoRoot, "package.json");
|
|
@@ -37412,84 +37316,7 @@ const listWorkspacePackages = (rootDirectory) => {
|
|
|
37412
37316
|
}
|
|
37413
37317
|
return packages;
|
|
37414
37318
|
};
|
|
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
|
-
};
|
|
37468
37319
|
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
|
-
];
|
|
37493
37320
|
const SHOPIFY_FLASH_LIST_PACKAGE_NAME = "@shopify/flash-list";
|
|
37494
37321
|
const resolveWorkspaceDependencyVersion = ({ concreteVersion, packageName, rootDirectory, rootPackageJson, sections, workspaceDirectory, workspacePackageJson }) => {
|
|
37495
37322
|
const dependencyDeclaration = getDependencyDeclaration({
|
|
@@ -37500,7 +37327,7 @@ const resolveWorkspaceDependencyVersion = ({ concreteVersion, packageName, rootD
|
|
|
37500
37327
|
if (!dependencyDeclaration.hasDeclaration) return null;
|
|
37501
37328
|
return concreteVersion ?? resolveCatalogVersion(workspacePackageJson, packageName, workspaceDirectory, dependencyDeclaration.catalogReference) ?? resolveCatalogVersion(rootPackageJson, packageName, rootDirectory, dependencyDeclaration.catalogReference);
|
|
37502
37329
|
};
|
|
37503
|
-
const
|
|
37330
|
+
const shouldReplaceReactVersion = (currentVersion, nextVersion) => {
|
|
37504
37331
|
if (!currentVersion) return true;
|
|
37505
37332
|
const currentMajor = parseReactMajor(currentVersion);
|
|
37506
37333
|
const nextMajor = parseReactMajor(nextVersion);
|
|
@@ -37508,71 +37335,7 @@ const shouldReplaceWithLowerMajor = (currentVersion, nextVersion) => {
|
|
|
37508
37335
|
if (nextMajor === null) return false;
|
|
37509
37336
|
return nextMajor < currentMajor;
|
|
37510
37337
|
};
|
|
37511
|
-
const
|
|
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) => {
|
|
37338
|
+
const evaluateManifestFacts = (facts, packageJson, directory) => {
|
|
37576
37339
|
if (facts.expo.version === null) {
|
|
37577
37340
|
const spec = getDependencySpec(packageJson, "expo");
|
|
37578
37341
|
if (spec !== null) facts.expo = {
|
|
@@ -37587,23 +37350,6 @@ const evaluateManifestFacts = (facts, packageJson, directory, rootDirectory, roo
|
|
|
37587
37350
|
sourceDirectory: directory
|
|
37588
37351
|
};
|
|
37589
37352
|
}
|
|
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;
|
|
37607
37353
|
if (facts.shopifyFlashList.version === null) {
|
|
37608
37354
|
const spec = getDependencySpec(packageJson, SHOPIFY_FLASH_LIST_PACKAGE_NAME);
|
|
37609
37355
|
if (spec !== null) facts.shopifyFlashList = {
|
|
@@ -37611,113 +37357,13 @@ const evaluateManifestFacts = (facts, packageJson, directory, rootDirectory, roo
|
|
|
37611
37357
|
sourceDirectory: directory
|
|
37612
37358
|
};
|
|
37613
37359
|
}
|
|
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
|
-
}
|
|
37644
37360
|
if (facts.reanimatedVersion === null) {
|
|
37645
37361
|
const spec = getDependencySpec(packageJson, REANIMATED_DEPENDENCY_NAME);
|
|
37646
37362
|
if (spec !== null) facts.reanimatedVersion = spec;
|
|
37647
37363
|
}
|
|
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
|
-
}
|
|
37698
37364
|
facts.hasReactNativeAwarePackage = facts.hasReactNativeAwarePackage || isPackageJsonReactNativeAware(packageJson);
|
|
37699
37365
|
facts.hasReanimatedAwarePackage = facts.hasReanimatedAwarePackage || isPackageJsonReanimatedAware(packageJson);
|
|
37700
37366
|
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);
|
|
37721
37367
|
};
|
|
37722
37368
|
const collectWorkspaceFacts = (rootDirectory, rootPackageJson, { collectReactGroup }) => {
|
|
37723
37369
|
const facts = {
|
|
@@ -37733,60 +37379,25 @@ const collectWorkspaceFacts = (rootDirectory, rootPackageJson, { collectReactGro
|
|
|
37733
37379
|
version: null,
|
|
37734
37380
|
sourceDirectory: null
|
|
37735
37381
|
},
|
|
37736
|
-
reactRouter: {
|
|
37737
|
-
version: null,
|
|
37738
|
-
sourceDirectory: null,
|
|
37739
|
-
packageName: null
|
|
37740
|
-
},
|
|
37741
37382
|
shopifyFlashList: {
|
|
37742
37383
|
version: null,
|
|
37743
37384
|
sourceDirectory: null
|
|
37744
37385
|
},
|
|
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,
|
|
37763
37386
|
hasReactNativeAwarePackage: false,
|
|
37764
37387
|
hasReanimatedAwarePackage: false,
|
|
37765
37388
|
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,
|
|
37778
37389
|
reanimatedVersion: null
|
|
37779
37390
|
};
|
|
37780
|
-
evaluateManifestFacts(facts, rootPackageJson, rootDirectory
|
|
37391
|
+
evaluateManifestFacts(facts, rootPackageJson, rootDirectory);
|
|
37781
37392
|
let isReactGroupSettled = !collectReactGroup;
|
|
37782
37393
|
const visitedDirectories = /* @__PURE__ */ new Set();
|
|
37783
37394
|
for (const pattern of getWorkspacePatterns(rootDirectory, rootPackageJson)) {
|
|
37784
|
-
const directories = resolveWorkspaceDirectories(rootDirectory, pattern).
|
|
37395
|
+
const directories = [...resolveWorkspaceDirectories(rootDirectory, pattern)].sort();
|
|
37785
37396
|
for (const workspaceDirectory of directories) {
|
|
37786
37397
|
if (visitedDirectories.has(workspaceDirectory)) continue;
|
|
37787
37398
|
visitedDirectories.add(workspaceDirectory);
|
|
37788
37399
|
const workspacePackageJson = readPackageJson$1(Path.join(workspaceDirectory, "package.json"));
|
|
37789
|
-
evaluateManifestFacts(facts, workspacePackageJson, workspaceDirectory
|
|
37400
|
+
evaluateManifestFacts(facts, workspacePackageJson, workspaceDirectory);
|
|
37790
37401
|
const info = extractDependencyInfo(workspacePackageJson);
|
|
37791
37402
|
if (info.framework !== "unknown" && frameworkMergeRank(info.framework) < frameworkMergeRank(facts.framework)) facts.framework = info.framework;
|
|
37792
37403
|
if (isReactGroupSettled) continue;
|
|
@@ -37817,7 +37428,7 @@ const collectWorkspaceFacts = (rootDirectory, rootPackageJson, { collectReactGro
|
|
|
37817
37428
|
workspaceDirectory,
|
|
37818
37429
|
workspacePackageJson
|
|
37819
37430
|
});
|
|
37820
|
-
if (reactVersion &&
|
|
37431
|
+
if (reactVersion && shouldReplaceReactVersion(facts.reactVersion, reactVersion)) facts.reactVersion = reactVersion;
|
|
37821
37432
|
if (tailwindVersion && !facts.tailwindVersion) facts.tailwindVersion = tailwindVersion;
|
|
37822
37433
|
if (zodVersion && !facts.zodVersion) facts.zodVersion = zodVersion;
|
|
37823
37434
|
const settledReactMajor = parseReactMajor(facts.reactVersion);
|
|
@@ -38007,43 +37618,17 @@ const discoverProjectWithoutPackageJson = (directory) => {
|
|
|
38007
37618
|
tailwindVersion: null,
|
|
38008
37619
|
zodVersion: null,
|
|
38009
37620
|
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,
|
|
38020
37621
|
framework: "unknown",
|
|
38021
37622
|
hasTypeScript: hasOwnTsConfig,
|
|
38022
37623
|
hasReactCompiler: false,
|
|
38023
37624
|
hasReactCompilerLintPlugin: false,
|
|
38024
37625
|
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,
|
|
38039
37626
|
hasSsrDependency: false,
|
|
38040
37627
|
preactVersion: null,
|
|
38041
37628
|
preactMajorVersion: null,
|
|
38042
37629
|
hasReactNativeWorkspace: false,
|
|
38043
37630
|
nextjsVersion: null,
|
|
38044
37631
|
nextjsMajorVersion: null,
|
|
38045
|
-
reactRouterVersion: null,
|
|
38046
|
-
hasReactRouterFramework: false,
|
|
38047
37632
|
expoVersion: null,
|
|
38048
37633
|
shopifyFlashListVersion: null,
|
|
38049
37634
|
shopifyFlashListMajorVersion: null,
|
|
@@ -38136,12 +37721,6 @@ const discoverProject = (directory) => {
|
|
|
38136
37721
|
packageName: SHOPIFY_FLASH_LIST_PACKAGE_NAME,
|
|
38137
37722
|
version: workspaceFacts.shopifyFlashList.version
|
|
38138
37723
|
}) : null;
|
|
38139
|
-
const zustandVersion = resolveCatalogBackedDependencyVersion({
|
|
38140
|
-
rootDirectory: directory,
|
|
38141
|
-
rootPackageJson: packageJson,
|
|
38142
|
-
packageName: "zustand",
|
|
38143
|
-
version: workspaceFacts.zustand.version
|
|
38144
|
-
});
|
|
38145
37724
|
const hasReanimated = hasReactNativeWorkspace && workspaceFacts.hasReanimatedAwarePackage;
|
|
38146
37725
|
const reanimatedVersion = hasReanimated ? workspaceFacts.reanimatedVersion : null;
|
|
38147
37726
|
const nextjsVersion = framework === "nextjs" ? resolveCatalogBackedDependencyVersion({
|
|
@@ -38150,39 +37729,7 @@ const discoverProject = (directory) => {
|
|
|
38150
37729
|
packageName: "next",
|
|
38151
37730
|
version: workspaceFacts.next.version
|
|
38152
37731
|
}) : 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
|
-
});
|
|
38171
37732
|
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
|
-
});
|
|
38186
37733
|
const isPreES2023Target = hasTypeScript && detectPreES2023Target(directory);
|
|
38187
37734
|
const projectInfo = {
|
|
38188
37735
|
rootDirectory: directory,
|
|
@@ -38192,43 +37739,17 @@ const discoverProject = (directory) => {
|
|
|
38192
37739
|
tailwindVersion,
|
|
38193
37740
|
zodVersion,
|
|
38194
37741
|
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),
|
|
38205
37742
|
framework,
|
|
38206
37743
|
hasTypeScript,
|
|
38207
37744
|
hasReactCompiler: detectReactCompiler(directory, packageJson),
|
|
38208
37745
|
hasReactCompilerLintPlugin: detectReactCompilerLintPlugin(directory, packageJson),
|
|
38209
|
-
hasTanStackQuery:
|
|
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),
|
|
37746
|
+
hasTanStackQuery: hasTanStackQuery(packageJson),
|
|
38224
37747
|
hasSsrDependency: workspaceFacts.hasSsrDependency,
|
|
38225
37748
|
preactVersion,
|
|
38226
37749
|
preactMajorVersion: parseReactMajor(preactVersion),
|
|
38227
37750
|
hasReactNativeWorkspace,
|
|
38228
37751
|
nextjsVersion,
|
|
38229
37752
|
nextjsMajorVersion: nextjsVersion === null ? null : getLowestDependencyMajor(nextjsVersion),
|
|
38230
|
-
reactRouterVersion,
|
|
38231
|
-
hasReactRouterFramework: workspaceFacts.hasReactRouterFramework,
|
|
38232
37753
|
expoVersion,
|
|
38233
37754
|
shopifyFlashListVersion,
|
|
38234
37755
|
shopifyFlashListMajorVersion: shopifyFlashListVersion === null ? null : getLowestDependencyMajor(shopifyFlashListVersion),
|
|
@@ -38456,6 +37977,7 @@ const LEGACY_RULE_KEY_TO_NATIVE_RULE_KEY = {
|
|
|
38456
37977
|
"react/jsx-no-new-function-as-prop": "react-doctor/jsx-no-new-function-as-prop",
|
|
38457
37978
|
"react/jsx-no-new-object-as-prop": "react-doctor/jsx-no-new-object-as-prop",
|
|
38458
37979
|
"react/jsx-no-script-url": "react-doctor/jsx-no-script-url",
|
|
37980
|
+
"react/jsx-no-target-blank": "react-doctor/jsx-no-target-blank",
|
|
38459
37981
|
"react/jsx-no-undef": "react-doctor/jsx-no-undef",
|
|
38460
37982
|
"react/jsx-no-useless-fragment": "react-doctor/jsx-no-useless-fragment",
|
|
38461
37983
|
"react/jsx-pascal-case": "react-doctor/jsx-pascal-case",
|
|
@@ -40777,25 +40299,9 @@ const BABEL_CONFIG_FILE_NAMES = [
|
|
|
40777
40299
|
".babelrc.json"
|
|
40778
40300
|
];
|
|
40779
40301
|
const LEGACY_PRESET_SPEC = "module:metro-react-native-babel-preset";
|
|
40780
|
-
const LEGACY_PRESET_PACKAGE = "metro-react-native-babel-preset";
|
|
40781
|
-
const REACT_NATIVE_PACKAGE = "react-native";
|
|
40782
|
-
const PRESET_RENAME_MINIMUM_REACT_NATIVE_VERSION = "0.73.0";
|
|
40783
|
-
const LEGACY_PRESET_REFERENCE = new RegExp(`['"]${LEGACY_PRESET_SPEC}['"]`);
|
|
40784
40302
|
const MODERN_PRESET_REFERENCE = new RegExp(`['"]module:@react-native/babel-preset['"]`);
|
|
40785
40303
|
const ENABLE_BABEL_RUNTIME_VERSION = /enableBabelRuntime["']?\s*:\s*['"]/;
|
|
40786
|
-
const isReactNativeVersionAtLeastPresetRename = (rootDirectory, packageJson) => {
|
|
40787
|
-
const installedReactNativeManifestPath = Path.join(rootDirectory, "node_modules", REACT_NATIVE_PACKAGE, "package.json");
|
|
40788
|
-
const reactNativeVersionSpec = (isFile(installedReactNativeManifestPath) ? readPackageJson$1(installedReactNativeManifestPath).version : void 0) ?? getDependencySpec(packageJson, REACT_NATIVE_PACKAGE);
|
|
40789
|
-
if (reactNativeVersionSpec === null || reactNativeVersionSpec === void 0) return false;
|
|
40790
|
-
const normalizedVersionRange = import_semver.validRange(reactNativeVersionSpec);
|
|
40791
|
-
if (normalizedVersionRange === null) return false;
|
|
40792
|
-
const minimumVersion = import_semver.minVersion(normalizedVersionRange);
|
|
40793
|
-
return minimumVersion !== null && import_semver.gte(minimumVersion, PRESET_RENAME_MINIMUM_REACT_NATIVE_VERSION);
|
|
40794
|
-
};
|
|
40795
|
-
const canResolveLegacyPreset = (rootDirectory, packageJson) => getDependencySpec(packageJson, LEGACY_PRESET_PACKAGE) !== null || isFile(Path.join(rootDirectory, "node_modules", LEGACY_PRESET_PACKAGE, "package.json"));
|
|
40796
40304
|
const checkReactNativeMetroBabelPreset = (rootDirectory) => {
|
|
40797
|
-
const packageJson = readPackageJson$1(Path.join(rootDirectory, "package.json"));
|
|
40798
|
-
const shouldReportLegacyPreset = isReactNativeVersionAtLeastPresetRename(rootDirectory, packageJson) && !canResolveLegacyPreset(rootDirectory, packageJson);
|
|
40799
40305
|
for (const fileName of BABEL_CONFIG_FILE_NAMES) {
|
|
40800
40306
|
const filePath = Path.join(rootDirectory, fileName);
|
|
40801
40307
|
if (!isFile(filePath)) continue;
|
|
@@ -40805,7 +40311,7 @@ const checkReactNativeMetroBabelPreset = (rootDirectory) => {
|
|
|
40805
40311
|
} catch {
|
|
40806
40312
|
continue;
|
|
40807
40313
|
}
|
|
40808
|
-
if (
|
|
40314
|
+
if (contents.includes(LEGACY_PRESET_SPEC)) return [buildReactNativeDiagnostic({
|
|
40809
40315
|
filePath: fileName,
|
|
40810
40316
|
rule: "rn-no-metro-babel-preset",
|
|
40811
40317
|
severity: "error",
|
|
@@ -40828,6 +40334,12 @@ const checkReactNativeProject = (rootDirectory, project) => {
|
|
|
40828
40334
|
return [...checkReactNativeMetroBabelPreset(rootDirectory), ...checkReactNativeLibraryDependencies(rootDirectory)];
|
|
40829
40335
|
};
|
|
40830
40336
|
const RULE_KEY = "no-vulnerable-react-server-components";
|
|
40337
|
+
const DEPENDENCY_SECTIONS = [
|
|
40338
|
+
"dependencies",
|
|
40339
|
+
"devDependencies",
|
|
40340
|
+
"peerDependencies",
|
|
40341
|
+
"optionalDependencies"
|
|
40342
|
+
];
|
|
40831
40343
|
const REACT_RSC_ADVISORIES_BY_MINOR = {
|
|
40832
40344
|
"19.0": {
|
|
40833
40345
|
rceFixedVersion: "19.0.1",
|
|
@@ -40874,13 +40386,20 @@ const enumerateWorkspaceDirectories = (workspaceRoot) => {
|
|
|
40874
40386
|
for (const pattern of patterns) for (const directory of resolveWorkspaceDirectories(workspaceRoot, pattern)) directories.add(directory);
|
|
40875
40387
|
return [...directories];
|
|
40876
40388
|
};
|
|
40389
|
+
const readDeclaredSpec = (packageJson, packageName) => {
|
|
40390
|
+
for (const section of DEPENDENCY_SECTIONS) {
|
|
40391
|
+
const spec = packageJson[section]?.[packageName];
|
|
40392
|
+
if (typeof spec === "string") return spec;
|
|
40393
|
+
}
|
|
40394
|
+
return null;
|
|
40395
|
+
};
|
|
40877
40396
|
const resolveVersionInDirectory = (directory, packageName, declaredSpecOverride) => {
|
|
40878
40397
|
const manifestPath = Path.join(directory, "node_modules", packageName, "package.json");
|
|
40879
40398
|
if (isFile(manifestPath)) {
|
|
40880
40399
|
const installedVersion = import_semver.valid(readPackageJson$1(manifestPath).version ?? null);
|
|
40881
40400
|
if (installedVersion !== null) return installedVersion;
|
|
40882
40401
|
}
|
|
40883
|
-
const candidateSpecs = [
|
|
40402
|
+
const candidateSpecs = [readDeclaredSpec(readPackageJson$1(Path.join(directory, "package.json")), packageName), declaredSpecOverride];
|
|
40884
40403
|
for (const spec of candidateSpecs) {
|
|
40885
40404
|
const pinnedVersion = spec === null ? null : import_semver.valid(spec);
|
|
40886
40405
|
if (pinnedVersion !== null) return pinnedVersion;
|
|
@@ -41532,10 +41051,10 @@ const SSR_FRAMEWORKS = new Set([
|
|
|
41532
41051
|
"gatsby",
|
|
41533
41052
|
"tanstack-start"
|
|
41534
41053
|
]);
|
|
41535
|
-
const
|
|
41536
|
-
if (
|
|
41537
|
-
const
|
|
41538
|
-
for (let candidate = earliest; candidate <=
|
|
41054
|
+
const addMajorLadder = (capabilities, name, major, earliest, latest) => {
|
|
41055
|
+
if (major === null) return;
|
|
41056
|
+
const cappedMajor = Math.min(major, latest);
|
|
41057
|
+
for (let candidate = earliest; candidate <= cappedMajor; candidate += 1) capabilities.add(`${name}:${candidate}`);
|
|
41539
41058
|
};
|
|
41540
41059
|
const buildCapabilities = (project) => {
|
|
41541
41060
|
const capabilities = /* @__PURE__ */ new Set();
|
|
@@ -41548,86 +41067,24 @@ const buildCapabilities = (project) => {
|
|
|
41548
41067
|
if (CLIENT_ONLY_FRAMEWORKS.has(project.framework)) capabilities.add("client-only");
|
|
41549
41068
|
if (project.isStaticExport) capabilities.add("nextjs:static-export");
|
|
41550
41069
|
if (project.nextjsMajorVersion !== null && project.nextjsMajorVersion >= 15) capabilities.add("nextjs:15");
|
|
41551
|
-
|
|
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);
|
|
41070
|
+
addMajorLadder(capabilities, "react", project.reactMajorVersion, 17, 30);
|
|
41562
41071
|
if (project.reactMajorVersion !== null && project.reactMajorVersion >= 19 && isMajorMinorAtLeast(parseReactMajorMinor(project.reactVersion), {
|
|
41563
41072
|
major: 19,
|
|
41564
41073
|
minor: 2
|
|
41565
41074
|
})) capabilities.add("react:19.2");
|
|
41566
|
-
if (project.tailwindVersion !== null)
|
|
41567
|
-
|
|
41568
|
-
|
|
41569
|
-
|
|
41570
|
-
|
|
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
|
-
}
|
|
41075
|
+
if (project.tailwindVersion !== null) capabilities.add("tailwind");
|
|
41076
|
+
if (project.tailwindVersion !== null && isMajorMinorAtLeast(parseTailwindMajorMinor(project.tailwindVersion), {
|
|
41077
|
+
major: 3,
|
|
41078
|
+
minor: 4
|
|
41079
|
+
})) capabilities.add("tailwind:3.4");
|
|
41578
41080
|
if (project.zodVersion !== null) capabilities.add("zod");
|
|
41579
41081
|
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);
|
|
41607
41082
|
if (project.isPreES2023Target) capabilities.add("pre-es2023");
|
|
41608
41083
|
if (project.hasReactCompiler) capabilities.add("react-compiler");
|
|
41609
|
-
if (
|
|
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
|
-
}
|
|
41084
|
+
if (project.hasTanStackQuery) capabilities.add("tanstack-query");
|
|
41628
41085
|
if (project.hasTypeScript) capabilities.add("typescript");
|
|
41629
41086
|
if (project.preactVersion !== null) capabilities.add("preact");
|
|
41630
|
-
|
|
41087
|
+
addMajorLadder(capabilities, "preact", project.preactMajorVersion, 10, 20);
|
|
41631
41088
|
if (project.preactVersion !== null && project.reactVersion === null) capabilities.add("pure-preact");
|
|
41632
41089
|
return capabilities;
|
|
41633
41090
|
};
|
|
@@ -41639,7 +41096,7 @@ const getCapabilities = (project) => {
|
|
|
41639
41096
|
capabilitiesByProject.set(project, capabilities);
|
|
41640
41097
|
return capabilities;
|
|
41641
41098
|
};
|
|
41642
|
-
const shouldEnableRule = (requires, tags, capabilities, ignoredTags, disabledWhen
|
|
41099
|
+
const shouldEnableRule = (requires, tags, capabilities, ignoredTags, disabledWhen) => {
|
|
41643
41100
|
if (requires) {
|
|
41644
41101
|
for (const capability of requires) if (!capabilities.has(capability)) return false;
|
|
41645
41102
|
}
|
|
@@ -41650,29 +41107,20 @@ const shouldEnableRule = (requires, tags, capabilities, ignoredTags, disabledWhe
|
|
|
41650
41107
|
if (tags) {
|
|
41651
41108
|
for (const tag of tags) if (ignoredTags.has(tag)) return false;
|
|
41652
41109
|
}
|
|
41653
|
-
if (includedTags && includedTags.size > 0) {
|
|
41654
|
-
if (!tags?.some((tag) => includedTags.has(tag))) return false;
|
|
41655
|
-
}
|
|
41656
41110
|
return true;
|
|
41657
41111
|
};
|
|
41658
|
-
const shouldEnableRuleByDefaultStatus = (options) => options.defaultEnabled !== false || options.hasExplicitOverride === true || options.includeTagDefaults && options.hasIncludedTags;
|
|
41659
41112
|
const yieldToEventLoop = () => new Promise((resolve) => {
|
|
41660
41113
|
setImmediate(resolve);
|
|
41661
41114
|
});
|
|
41662
41115
|
const createSecurityScanSession = (rootDirectory, options) => {
|
|
41663
41116
|
const capabilities = options.project ? getCapabilities(options.project) : /* @__PURE__ */ new Set();
|
|
41664
41117
|
const ignoredTags = options.ignoredTags ?? /* @__PURE__ */ new Set();
|
|
41665
|
-
const includedTags = options.includedTags ?? /* @__PURE__ */ new Set();
|
|
41666
41118
|
const enabledScanRules = REACT_DOCTOR_RULES.flatMap((entry) => {
|
|
41667
41119
|
const rule = entry.rule;
|
|
41668
41120
|
const scan = rule.scan;
|
|
41669
41121
|
if (typeof scan !== "function") return [];
|
|
41670
|
-
if (
|
|
41671
|
-
|
|
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 [];
|
|
41122
|
+
if (rule.defaultEnabled === false) return [];
|
|
41123
|
+
if (!shouldEnableRule(rule.requires, rule.tags, capabilities, ignoredTags, rule.disabledWhen)) return [];
|
|
41676
41124
|
return [{
|
|
41677
41125
|
entry,
|
|
41678
41126
|
scan,
|
|
@@ -43674,9 +43122,8 @@ const buildUserPluginRules = (userPlugin, severityControls) => {
|
|
|
43674
43122
|
}
|
|
43675
43123
|
return enabled;
|
|
43676
43124
|
};
|
|
43677
|
-
const createOxlintConfig = ({ pluginPath, project, customRulesOnly = false, extendsPaths = [], ignoredTags = /* @__PURE__ */ new Set(),
|
|
43678
|
-
const
|
|
43679
|
-
const reactHooksJsPlugin = disableReactHooksJsPlugin || ruleSelection === "sidecar" || hasIncludedTags ? null : resolveReactHooksJsPlugin(project.hasReactCompiler || project.hasReactCompilerLintPlugin === true, customRulesOnly);
|
|
43125
|
+
const createOxlintConfig = ({ pluginPath, project, customRulesOnly = false, extendsPaths = [], ignoredTags = /* @__PURE__ */ new Set(), serverAuthFunctionNames, severityControls, userPlugins = [], disableReactHooksJsPlugin = false, ruleSelection, sidecarRuleIdFilter }) => {
|
|
43126
|
+
const reactHooksJsPlugin = disableReactHooksJsPlugin || ruleSelection === "sidecar" ? null : resolveReactHooksJsPlugin(project.hasReactCompiler || project.hasReactCompilerLintPlugin === true, customRulesOnly);
|
|
43680
43127
|
const reactCompilerRules = reactHooksJsPlugin ? applyRuleSeverityControls(filterRulesToAvailable(REACT_COMPILER_RULES, "react-hooks-js", reactHooksJsPlugin.availableRuleNames), severityControls) : {};
|
|
43681
43128
|
const jsPlugins = [];
|
|
43682
43129
|
if (reactHooksJsPlugin) jsPlugins.push(reactHooksJsPlugin.entry);
|
|
@@ -43691,14 +43138,9 @@ const createOxlintConfig = ({ pluginPath, project, customRulesOnly = false, exte
|
|
|
43691
43138
|
if (rule.scan !== void 0) continue;
|
|
43692
43139
|
if (customRulesOnly && registryEntry.originallyExternal) continue;
|
|
43693
43140
|
if (rule.framework !== "global" && !rule.requires) continue;
|
|
43694
|
-
if (!shouldEnableRule(rule.requires, rule.tags, capabilities, ignoredTags, rule.disabledWhen
|
|
43141
|
+
if (!shouldEnableRule(rule.requires, rule.tags, capabilities, ignoredTags, rule.disabledWhen)) continue;
|
|
43695
43142
|
const explicitRuleOverride = resolveRuleSeverityOverride({ ruleKey: registryEntry.key }, severityControls);
|
|
43696
|
-
if (
|
|
43697
|
-
defaultEnabled: rule.defaultEnabled,
|
|
43698
|
-
includeTagDefaults,
|
|
43699
|
-
hasIncludedTags,
|
|
43700
|
-
hasExplicitOverride: explicitRuleOverride !== void 0
|
|
43701
|
-
})) continue;
|
|
43143
|
+
if (rule.defaultEnabled === false && explicitRuleOverride === void 0) continue;
|
|
43702
43144
|
const severity = resolveRuleSeverityOverride({
|
|
43703
43145
|
ruleKey: registryEntry.key,
|
|
43704
43146
|
category: rule.category
|
|
@@ -43707,7 +43149,7 @@ const createOxlintConfig = ({ pluginPath, project, customRulesOnly = false, exte
|
|
|
43707
43149
|
enabledReactDoctorRules[registryEntry.key] = severity;
|
|
43708
43150
|
}
|
|
43709
43151
|
const userPluginRules = {};
|
|
43710
|
-
if (ruleSelection !== "sidecar"
|
|
43152
|
+
if (ruleSelection !== "sidecar") for (const userPlugin of userPlugins) {
|
|
43711
43153
|
Object.assign(userPluginRules, buildUserPluginRules(userPlugin, severityControls));
|
|
43712
43154
|
jsPlugins.push(userPlugin.entry);
|
|
43713
43155
|
}
|
|
@@ -43924,19 +43366,6 @@ const createSidecarLintCache = (cacheDirectory, rulesetHash) => {
|
|
|
43924
43366
|
}
|
|
43925
43367
|
};
|
|
43926
43368
|
};
|
|
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
|
-
};
|
|
43940
43369
|
const bundledRequire$3 = createRequire(import.meta.url);
|
|
43941
43370
|
const childNodeVersionByBinaryPath = /* @__PURE__ */ new Map();
|
|
43942
43371
|
const resolveChildNodeVersion = (nodeBinaryPath) => {
|
|
@@ -43960,13 +43389,6 @@ const TOOLCHAIN_PACKAGE_SPECIFIERS$1 = [
|
|
|
43960
43389
|
"oxlint-plugin-react-doctor/package.json",
|
|
43961
43390
|
"eslint-plugin-react-hooks/package.json"
|
|
43962
43391
|
];
|
|
43963
|
-
const resolvePluginFingerprint = () => {
|
|
43964
|
-
try {
|
|
43965
|
-
return fingerprintFileContents(bundledRequire$3.resolve("oxlint-plugin-react-doctor"), 16);
|
|
43966
|
-
} catch {
|
|
43967
|
-
return "unresolved";
|
|
43968
|
-
}
|
|
43969
|
-
};
|
|
43970
43392
|
const resolveOxlintToolchainVersions = (nodeBinaryPath = process.execPath) => {
|
|
43971
43393
|
const versions = [`node=${resolveChildNodeVersion(nodeBinaryPath)}`];
|
|
43972
43394
|
for (const specifier of TOOLCHAIN_PACKAGE_SPECIFIERS$1) try {
|
|
@@ -43976,7 +43398,6 @@ const resolveOxlintToolchainVersions = (nodeBinaryPath = process.execPath) => {
|
|
|
43976
43398
|
} catch {
|
|
43977
43399
|
versions.push(`${specifier}=missing`);
|
|
43978
43400
|
}
|
|
43979
|
-
versions.push(`oxlint-plugin-react-doctor#fingerprint=${resolvePluginFingerprint()}`);
|
|
43980
43401
|
return versions;
|
|
43981
43402
|
};
|
|
43982
43403
|
const esmRequire = createRequire(import.meta.url);
|
|
@@ -45452,7 +44873,7 @@ const reactHooksJsPluginDropNote = (error) => {
|
|
|
45452
44873
|
* 6. always restore disable directives + clean up the temp dir
|
|
45453
44874
|
*/
|
|
45454
44875
|
const runOxlint = async (options) => {
|
|
45455
|
-
const { rootDirectory, project, includePaths, nodeBinaryPath = process.execPath, customRulesOnly = false, respectInlineDisables = true, adoptExistingLintConfig = true, ignoredTags = /* @__PURE__ */ new Set(),
|
|
44876
|
+
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;
|
|
45456
44877
|
const serverAuthFunctionNames = Array.isArray(userConfig?.serverAuthFunctionNames) ? userConfig.serverAuthFunctionNames.filter((entry) => typeof entry === "string" && entry.length > 0) : void 0;
|
|
45457
44878
|
const severityControls = buildRuleSeverityControls(userConfig);
|
|
45458
44879
|
validateRuleRegistration();
|
|
@@ -45466,15 +44887,13 @@ const runOxlint = async (options) => {
|
|
|
45466
44887
|
}
|
|
45467
44888
|
const pluginPath = resolvePluginPath();
|
|
45468
44889
|
const extendsPaths = (adoptExistingLintConfig && !customRulesOnly ? detectUserLintConfigPaths(rootDirectory) : []).filter(canOxlintExtendConfig);
|
|
45469
|
-
const userPlugins =
|
|
44890
|
+
const userPlugins = resolveUserPlugins(userConfig?.plugins, configSourceDirectory);
|
|
45470
44891
|
const buildConfig = (overrides) => createOxlintConfig({
|
|
45471
44892
|
pluginPath,
|
|
45472
44893
|
project,
|
|
45473
44894
|
customRulesOnly,
|
|
45474
44895
|
extendsPaths: overrides.extendsPaths,
|
|
45475
44896
|
ignoredTags,
|
|
45476
|
-
includedTags,
|
|
45477
|
-
includeTagDefaults,
|
|
45478
44897
|
serverAuthFunctionNames,
|
|
45479
44898
|
severityControls,
|
|
45480
44899
|
userPlugins,
|
|
@@ -45863,8 +45282,6 @@ var Linter = class Linter extends Service()("react-doctor/Linter") {
|
|
|
45863
45282
|
respectInlineDisables: input.respectInlineDisables,
|
|
45864
45283
|
adoptExistingLintConfig: input.adoptExistingLintConfig,
|
|
45865
45284
|
ignoredTags: input.ignoredTags,
|
|
45866
|
-
includedTags: input.includedTags,
|
|
45867
|
-
includeTagDefaults: input.includeTagDefaults,
|
|
45868
45285
|
userConfig: input.userConfig ?? null,
|
|
45869
45286
|
configSourceDirectory: input.configSourceDirectory,
|
|
45870
45287
|
onPartialFailure: (reason) => {
|
|
@@ -46713,9 +46130,7 @@ const runInspect = (input, hooks = {}) => gen(function* () {
|
|
|
46713
46130
|
const securityScanFailedRef = yield* make$13(false);
|
|
46714
46131
|
const securityScanFiber = yield* forkChild(runCollect(applyPerElementPipeline(isDiffMode ? empty$4 : unwrap(tryPromise(() => checkSecurityScanCooperative(scanDirectory, {
|
|
46715
46132
|
project,
|
|
46716
|
-
ignoredTags: input.ignoredTags
|
|
46717
|
-
includedTags: input.includedTags,
|
|
46718
|
-
includeTagDefaults: input.includeTagDefaults
|
|
46133
|
+
ignoredTags: input.ignoredTags
|
|
46719
46134
|
})).pipe(map$3((diagnostics) => fromIterable$1(diagnostics)), catch_$1(() => set(securityScanFailedRef, true).pipe(as(empty$4))))))).pipe(withSpan("SecurityScan.run")));
|
|
46720
46135
|
const shouldRunSupplyChain = !isDiffMode || (input.supplyChainManifestChanged ?? false);
|
|
46721
46136
|
const supplyChainOverlapTimeout = yield* SupplyChainOverlapTimeoutMs;
|
|
@@ -46806,8 +46221,6 @@ const runInspect = (input, hooks = {}) => gen(function* () {
|
|
|
46806
46221
|
respectInlineDisables: input.respectInlineDisables,
|
|
46807
46222
|
adoptExistingLintConfig: input.adoptExistingLintConfig,
|
|
46808
46223
|
ignoredTags: input.ignoredTags,
|
|
46809
|
-
includedTags: input.includedTags,
|
|
46810
|
-
includeTagDefaults: input.includeTagDefaults,
|
|
46811
46224
|
userConfig: resolvedConfig.config ?? void 0,
|
|
46812
46225
|
configSourceDirectory: resolvedConfig.configSourceDirectory ?? void 0,
|
|
46813
46226
|
onFileProgress: (scannedFileCount, totalFileCount) => {
|
|
@@ -47952,7 +47365,7 @@ const makeNoopConsole = () => ({
|
|
|
47952
47365
|
});
|
|
47953
47366
|
//#endregion
|
|
47954
47367
|
//#region src/cli/utils/version.ts
|
|
47955
|
-
const VERSION = "0.8.1-dev.
|
|
47368
|
+
const VERSION = "0.8.1-dev.5332cb6";
|
|
47956
47369
|
//#endregion
|
|
47957
47370
|
//#region src/cli/utils/json-mode.ts
|
|
47958
47371
|
let context = null;
|
|
@@ -48039,11 +47452,7 @@ const getRunId = () => {
|
|
|
48039
47452
|
};
|
|
48040
47453
|
//#endregion
|
|
48041
47454
|
//#region src/cli/utils/build-run-context.ts
|
|
48042
|
-
const ROOT_SUBCOMMANDS = new Set([
|
|
48043
|
-
"design",
|
|
48044
|
-
"install",
|
|
48045
|
-
"setup"
|
|
48046
|
-
]);
|
|
47455
|
+
const ROOT_SUBCOMMANDS = new Set(["install", "setup"]);
|
|
48047
47456
|
const detectInvokedVia = () => {
|
|
48048
47457
|
const userAgent = process.env.npm_config_user_agent;
|
|
48049
47458
|
if (!userAgent) return "unknown";
|
|
@@ -48127,9 +47536,7 @@ const buildSentryProjectContext = (projectInfo) => ({
|
|
|
48127
47536
|
reactMajorVersion: projectInfo.reactMajorVersion,
|
|
48128
47537
|
hasTypeScript: projectInfo.hasTypeScript,
|
|
48129
47538
|
hasReactCompiler: projectInfo.hasReactCompiler,
|
|
48130
|
-
|
|
48131
|
-
mobxVersion: projectInfo.mobxVersion,
|
|
48132
|
-
styledComponentsVersion: projectInfo.styledComponentsVersion,
|
|
47539
|
+
hasTanStackQuery: projectInfo.hasTanStackQuery,
|
|
48133
47540
|
tailwindVersion: projectInfo.tailwindVersion,
|
|
48134
47541
|
zodVersion: projectInfo.zodVersion,
|
|
48135
47542
|
preactVersion: projectInfo.preactVersion,
|
|
@@ -48310,13 +47717,13 @@ const isDevVersion = (version) => version === "0.0.0" || version.includes("-");
|
|
|
48310
47717
|
* uploads source-map artifacts under, so stack frames symbolicate. Honors the
|
|
48311
47718
|
* standard `SENTRY_RELEASE` override.
|
|
48312
47719
|
*/
|
|
48313
|
-
const resolveSentryRelease = () => process.env.SENTRY_RELEASE || `react-doctor@0.8.1-dev.
|
|
47720
|
+
const resolveSentryRelease = () => process.env.SENTRY_RELEASE || `react-doctor@0.8.1-dev.5332cb6`;
|
|
48314
47721
|
/**
|
|
48315
47722
|
* Deployment environment shown in Sentry's environment filter. Defaults to
|
|
48316
47723
|
* `production` for tagged releases and `development` for dev/unbuilt versions,
|
|
48317
47724
|
* overridable via the standard `SENTRY_ENVIRONMENT` env var.
|
|
48318
47725
|
*/
|
|
48319
|
-
const resolveSentryEnvironment = () => process.env.SENTRY_ENVIRONMENT || (isDevVersion("0.8.1-dev.
|
|
47726
|
+
const resolveSentryEnvironment = () => process.env.SENTRY_ENVIRONMENT || (isDevVersion("0.8.1-dev.5332cb6") ? "development" : "production");
|
|
48320
47727
|
/**
|
|
48321
47728
|
* Performance-tracing sample rate in `[0, 1]`. Reads `SENTRY_TRACES_SAMPLE_RATE`
|
|
48322
47729
|
* (set to `0` to disable tracing) and falls back to
|
|
@@ -60642,8 +60049,6 @@ const buildScanResultCacheKey = (input) => {
|
|
|
60642
60049
|
warnings: input.options.warnings,
|
|
60643
60050
|
adoptExistingLintConfig: input.options.adoptExistingLintConfig,
|
|
60644
60051
|
ignoredTags: [...input.options.ignoredTags].sort(),
|
|
60645
|
-
includedTags: [...input.options.includedTags].sort(),
|
|
60646
|
-
includeTagDefaults: input.options.includeTagDefaults,
|
|
60647
60052
|
concurrency: input.options.concurrency,
|
|
60648
60053
|
lintBatchOrdering: resolveLintBatchOrdering(),
|
|
60649
60054
|
baselineRef: input.options.baseline?.ref,
|
|
@@ -61470,8 +60875,8 @@ const createDiagnosticEvidenceReader = (rootDirectory, options = {}) => {
|
|
|
61470
60875
|
//#endregion
|
|
61471
60876
|
//#region src/cli/utils/build-no-score-message.ts
|
|
61472
60877
|
const ENTERPRISE_CONTACT_HINT = `Want something custom to your company? Contact us at ${ENTERPRISE_CONTACT_URL}.`;
|
|
61473
|
-
const buildNoScoreMessage = (isScoreDisabled
|
|
61474
|
-
return `${isScoreDisabled ?
|
|
60878
|
+
const buildNoScoreMessage = (isScoreDisabled) => {
|
|
60879
|
+
return `${isScoreDisabled ? "Score disabled by --no-score." : "Score unavailable (could not reach the score API)."} ${ENTERPRISE_CONTACT_HINT}`;
|
|
61475
60880
|
};
|
|
61476
60881
|
//#endregion
|
|
61477
60882
|
//#region src/cli/utils/render-agent-guidance.ts
|
|
@@ -62596,47 +62001,40 @@ const buildChangedLineMatcher = (directory, changedLineRanges) => {
|
|
|
62596
62001
|
return diagnosticIntersectsLineRanges(diagnostic, ranges);
|
|
62597
62002
|
};
|
|
62598
62003
|
};
|
|
62599
|
-
const buildIgnoredTags = (userConfig
|
|
62004
|
+
const buildIgnoredTags = (userConfig) => {
|
|
62600
62005
|
const tags = /* @__PURE__ */ new Set();
|
|
62601
62006
|
if (userConfig?.ignore?.tags) for (const tag of userConfig.ignore.tags) tags.add(tag);
|
|
62602
|
-
for (const tag of includedTags) tags.delete(tag);
|
|
62603
62007
|
return tags;
|
|
62604
62008
|
};
|
|
62605
|
-
const mergeInspectOptions = (inputOptions, userConfig) => {
|
|
62606
|
-
|
|
62607
|
-
|
|
62608
|
-
|
|
62609
|
-
|
|
62610
|
-
|
|
62611
|
-
|
|
62612
|
-
|
|
62613
|
-
|
|
62614
|
-
|
|
62615
|
-
|
|
62616
|
-
|
|
62617
|
-
|
|
62618
|
-
|
|
62619
|
-
|
|
62620
|
-
|
|
62621
|
-
|
|
62622
|
-
|
|
62623
|
-
|
|
62624
|
-
|
|
62625
|
-
|
|
62626
|
-
|
|
62627
|
-
|
|
62628
|
-
|
|
62629
|
-
|
|
62630
|
-
|
|
62631
|
-
|
|
62632
|
-
|
|
62633
|
-
|
|
62634
|
-
maxDurationMs: inputOptions.maxDurationMs ?? null,
|
|
62635
|
-
baseline: inputOptions.baseline ?? null,
|
|
62636
|
-
changedLineRanges: inputOptions.changedLineRanges ?? null,
|
|
62637
|
-
supplyChainManifestChanged: inputOptions.supplyChainManifestChanged ?? false
|
|
62638
|
-
};
|
|
62639
|
-
};
|
|
62009
|
+
const mergeInspectOptions = (inputOptions, userConfig) => ({
|
|
62010
|
+
lint: inputOptions.lint ?? userConfig?.lint ?? true,
|
|
62011
|
+
deadCode: inputOptions.deadCode ?? userConfig?.deadCode ?? true,
|
|
62012
|
+
supplyChain: inputOptions.supplyChain ?? userConfig?.supplyChain?.enabled ?? true,
|
|
62013
|
+
verbose: inputOptions.verbose ?? userConfig?.verbose ?? false,
|
|
62014
|
+
outputDirectory: inputOptions.outputDirectory || null,
|
|
62015
|
+
scoreOnly: inputOptions.scoreOnly ?? false,
|
|
62016
|
+
noScore: inputOptions.noScore ?? userConfig?.noScore ?? false,
|
|
62017
|
+
isCi: inputOptions.isCi ?? false,
|
|
62018
|
+
isCiOrCodingAgentEnvironment: isCiOrCodingAgentEnvironment(),
|
|
62019
|
+
isNonInteractiveEnvironment: isNonInteractiveEnvironment(),
|
|
62020
|
+
silent: inputOptions.silent ?? false,
|
|
62021
|
+
includePaths: inputOptions.includePaths ?? [],
|
|
62022
|
+
customRulesOnly: userConfig?.customRulesOnly ?? false,
|
|
62023
|
+
share: userConfig?.share ?? true,
|
|
62024
|
+
respectInlineDisables: inputOptions.respectInlineDisables ?? userConfig?.respectInlineDisables ?? true,
|
|
62025
|
+
warnings: inputOptions.warnings ?? userConfig?.warnings ?? true,
|
|
62026
|
+
categoryFilters: new Set(resolveCliCategories(inputOptions.categoryFilters) ?? []),
|
|
62027
|
+
adoptExistingLintConfig: userConfig?.adoptExistingLintConfig ?? true,
|
|
62028
|
+
ignoredTags: buildIgnoredTags(userConfig),
|
|
62029
|
+
outputSurface: inputOptions.outputSurface ?? "cli",
|
|
62030
|
+
suppressRendering: inputOptions.suppressRendering ?? false,
|
|
62031
|
+
concurrentScan: inputOptions.concurrentScan ?? false,
|
|
62032
|
+
concurrency: inputOptions.concurrency,
|
|
62033
|
+
maxDurationMs: inputOptions.maxDurationMs ?? null,
|
|
62034
|
+
baseline: inputOptions.baseline ?? null,
|
|
62035
|
+
changedLineRanges: inputOptions.changedLineRanges ?? null,
|
|
62036
|
+
supplyChainManifestChanged: inputOptions.supplyChainManifestChanged ?? false
|
|
62037
|
+
});
|
|
62640
62038
|
const deriveScope = (options) => {
|
|
62641
62039
|
if (options.baseline) return "changed";
|
|
62642
62040
|
if (options.changedLineRanges !== null) return "lines";
|
|
@@ -62767,8 +62165,6 @@ const runBaselineComparison = async (params) => {
|
|
|
62767
62165
|
warnings: params.options.warnings,
|
|
62768
62166
|
adoptExistingLintConfig: params.options.adoptExistingLintConfig,
|
|
62769
62167
|
ignoredTags: params.options.ignoredTags,
|
|
62770
|
-
includedTags: params.options.includedTags,
|
|
62771
|
-
includeTagDefaults: params.options.includeTagDefaults,
|
|
62772
62168
|
nodeBinaryPath: params.resolvedNodeBinaryPath ?? void 0,
|
|
62773
62169
|
runDeadCode: false,
|
|
62774
62170
|
isCi: params.options.isCi,
|
|
@@ -62862,8 +62258,6 @@ const runInspectWithRuntime = async (directory, options, userConfig, hasConfigOv
|
|
|
62862
62258
|
warnings: options.warnings,
|
|
62863
62259
|
adoptExistingLintConfig: options.adoptExistingLintConfig,
|
|
62864
62260
|
ignoredTags: options.ignoredTags,
|
|
62865
|
-
includedTags: options.includedTags,
|
|
62866
|
-
includeTagDefaults: options.includeTagDefaults,
|
|
62867
62261
|
nodeBinaryPath: resolvedNodeBinaryPath ?? void 0,
|
|
62868
62262
|
runDeadCode: options.deadCode,
|
|
62869
62263
|
isCi: options.isCi,
|
|
@@ -63052,7 +62446,7 @@ const finalizeAndRender = (input) => gen(function* () {
|
|
|
63052
62446
|
securityScanFailed
|
|
63053
62447
|
});
|
|
63054
62448
|
const hasSkippedChecks = skippedChecks.length > 0;
|
|
63055
|
-
const noScoreMessage = buildNoScoreMessage(options.noScore
|
|
62449
|
+
const noScoreMessage = buildNoScoreMessage(options.noScore);
|
|
63056
62450
|
const buildResult = () => ({
|
|
63057
62451
|
diagnostics: [...diagnostics],
|
|
63058
62452
|
score,
|
|
@@ -65157,25 +64551,21 @@ const resolveParallelFlag = (parallel) => parallel === false ? 1 : void 0;
|
|
|
65157
64551
|
*/
|
|
65158
64552
|
const resolveCliInspectOptions = (flags, userConfig) => {
|
|
65159
64553
|
const wantsWarningGate = pickBlockingLevel(flags, userConfig) === "warning";
|
|
65160
|
-
const isDesignScan = flags.design === true;
|
|
65161
64554
|
return {
|
|
65162
64555
|
lint: flags.lint,
|
|
65163
|
-
deadCode:
|
|
65164
|
-
supplyChain:
|
|
64556
|
+
deadCode: flags.deadCode,
|
|
64557
|
+
supplyChain: flags.supplyChain,
|
|
65165
64558
|
verbose: flags.verbose,
|
|
65166
64559
|
outputDirectory: flags.outputDir,
|
|
65167
64560
|
respectInlineDisables: flags.respectInlineDisables === false ? false : void 0,
|
|
65168
64561
|
warnings: wantsWarningGate ? true : flags.warnings,
|
|
65169
64562
|
scoreOnly: flags.score === true,
|
|
65170
|
-
noScore:
|
|
64563
|
+
noScore: flags.score === false || flags.telemetry === false ? true : void 0,
|
|
65171
64564
|
isCi: isCiEnvironment(),
|
|
65172
64565
|
silent: Boolean(flags.json),
|
|
65173
64566
|
concurrency: resolveParallelFlag(flags.parallel),
|
|
65174
64567
|
maxDurationMs: resolveMaxDurationFlag(flags.maxDuration),
|
|
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
|
|
64568
|
+
categoryFilters: resolveCliCategories(flags.category)
|
|
65179
64569
|
};
|
|
65180
64570
|
};
|
|
65181
64571
|
//#endregion
|
|
@@ -65593,7 +64983,7 @@ const maybeMigrateLegacyConfig = async (requestedDirectory, { isQuiet, isStaged
|
|
|
65593
64983
|
if (!(!isQuiet && !isStaged && process.stdout.isTTY === true && !isCiOrCodingAgentEnvironment())) return;
|
|
65594
64984
|
await runProjectMigrations(requestedDirectory);
|
|
65595
64985
|
};
|
|
65596
|
-
const inspectAction = async (directory, flags
|
|
64986
|
+
const inspectAction = async (directory, flags) => {
|
|
65597
64987
|
const isScoreOnly = Boolean(flags.score);
|
|
65598
64988
|
const isJsonMode = Boolean(flags.json);
|
|
65599
64989
|
const isQuiet = isScoreOnly || isJsonMode;
|
|
@@ -65607,7 +64997,7 @@ const inspectAction = async (directory, flags, invocationCommand = "inspect") =>
|
|
|
65607
64997
|
});
|
|
65608
64998
|
if (flags.jsonOut) recordCount(METRIC.jsonOutUsed, 1);
|
|
65609
64999
|
}
|
|
65610
|
-
recordCount(METRIC.cliInvoked, 1, { command:
|
|
65000
|
+
recordCount(METRIC.cliInvoked, 1, { command: "inspect" });
|
|
65611
65001
|
try {
|
|
65612
65002
|
validateModeFlags(flags);
|
|
65613
65003
|
if (flags.staged) setJsonReportMode("staged");
|
|
@@ -65919,13 +65309,6 @@ const inspectAction = async (directory, flags, invocationCommand = "inspect") =>
|
|
|
65919
65309
|
}
|
|
65920
65310
|
};
|
|
65921
65311
|
//#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
|
|
65929
65312
|
//#region src/cli/commands/install.ts
|
|
65930
65313
|
const installAction = async (options, command) => {
|
|
65931
65314
|
recordCount(METRIC.cliInvoked, 1, { command: "install" });
|
|
@@ -66762,7 +66145,6 @@ const INSTALL_FLAG_SPEC = {
|
|
|
66762
66145
|
shortOptionsWithRequiredValues: new Set(["-c"])
|
|
66763
66146
|
};
|
|
66764
66147
|
const COMMAND_FLAG_SPECS = new Map([
|
|
66765
|
-
["design", ROOT_FLAG_SPEC],
|
|
66766
66148
|
["install", INSTALL_FLAG_SPEC],
|
|
66767
66149
|
["setup", INSTALL_FLAG_SPEC],
|
|
66768
66150
|
["version", {
|
|
@@ -66919,7 +66301,6 @@ ${formatExampleLines([
|
|
|
66919
66301
|
["react-doctor --scope changed --base main", "scan only new issues vs. main"],
|
|
66920
66302
|
["react-doctor --project modules/a,modules/b", "score each module separately (names or paths)"],
|
|
66921
66303
|
["react-doctor --staged", "scan staged files (pre-commit hook)"],
|
|
66922
|
-
["react-doctor design", "run the focused UI design audit"],
|
|
66923
66304
|
["react-doctor --category Security", "show only one diagnostic category"],
|
|
66924
66305
|
["react-doctor --blocking warning", "fail CI on warnings too (default: error)"],
|
|
66925
66306
|
["react-doctor --json > report.json", "write a machine-readable report"],
|
|
@@ -66953,20 +66334,6 @@ ${highlighter.dim("Managing CI:")}
|
|
|
66953
66334
|
${highlighter.dim("Learn more:")}
|
|
66954
66335
|
${highlighter.info(CANONICAL_GITHUB_URL)}
|
|
66955
66336
|
`;
|
|
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
|
-
`;
|
|
66970
66337
|
const renderCiHelpEpilog = () => `
|
|
66971
66338
|
${highlighter.dim("Examples:")}
|
|
66972
66339
|
${formatExampleLines([
|
|
@@ -66988,7 +66355,6 @@ ${highlighter.dim("Learn more:")}
|
|
|
66988
66355
|
const collectCategoryOption = (value, previousValues) => [...previousValues ?? [], value];
|
|
66989
66356
|
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);
|
|
66990
66357
|
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()));
|
|
66992
66358
|
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));
|
|
66993
66359
|
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);
|
|
66994
66360
|
const providerOption = ["--provider <name>", "ci provider: github-actions or gitlab-ci (auto-detected by default)"];
|
|
@@ -67037,4 +66403,4 @@ Promise.resolve().then(() => assertNoRemovedFlags(process.argv)).then(() => prog
|
|
|
67037
66403
|
export {};
|
|
67038
66404
|
|
|
67039
66405
|
//# sourceMappingURL=cli.js.map
|
|
67040
|
-
//# debugId=
|
|
66406
|
+
//# debugId=24153a3f-aef9-53fd-8dff-9b016a9613fb
|