react-doctor 0.8.1-dev.412377e → 0.8.1-dev.5774353
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 +144 -759
- package/dist/index.d.ts +0 -36
- package/dist/index.js +100 -668
- package/dist/lsp.js +100 -668
- package/dist/skills/react-doctor/SKILL.md +0 -5
- package/package.json +2 -2
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]="83a484ab-e975-5390-830a-f2f723c71935")}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,36 +37357,6 @@ 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;
|
|
@@ -37649,75 +37365,9 @@ const evaluateManifestFacts = (facts, packageJson, directory, rootDirectory, roo
|
|
|
37649
37365
|
const spec = getDependencySpec(packageJson, "valtio");
|
|
37650
37366
|
if (spec !== null) facts.valtioVersion = spec;
|
|
37651
37367
|
}
|
|
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
37368
|
facts.hasReactNativeAwarePackage = facts.hasReactNativeAwarePackage || isPackageJsonReactNativeAware(packageJson);
|
|
37699
37369
|
facts.hasReanimatedAwarePackage = facts.hasReanimatedAwarePackage || isPackageJsonReanimatedAware(packageJson);
|
|
37700
37370
|
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
37371
|
};
|
|
37722
37372
|
const collectWorkspaceFacts = (rootDirectory, rootPackageJson, { collectReactGroup }) => {
|
|
37723
37373
|
const facts = {
|
|
@@ -37733,60 +37383,26 @@ const collectWorkspaceFacts = (rootDirectory, rootPackageJson, { collectReactGro
|
|
|
37733
37383
|
version: null,
|
|
37734
37384
|
sourceDirectory: null
|
|
37735
37385
|
},
|
|
37736
|
-
reactRouter: {
|
|
37737
|
-
version: null,
|
|
37738
|
-
sourceDirectory: null,
|
|
37739
|
-
packageName: null
|
|
37740
|
-
},
|
|
37741
37386
|
shopifyFlashList: {
|
|
37742
37387
|
version: null,
|
|
37743
37388
|
sourceDirectory: null
|
|
37744
37389
|
},
|
|
37745
37390
|
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
37391
|
hasReactNativeAwarePackage: false,
|
|
37764
37392
|
hasReanimatedAwarePackage: false,
|
|
37765
37393
|
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
37394
|
reanimatedVersion: null
|
|
37779
37395
|
};
|
|
37780
|
-
evaluateManifestFacts(facts, rootPackageJson, rootDirectory
|
|
37396
|
+
evaluateManifestFacts(facts, rootPackageJson, rootDirectory);
|
|
37781
37397
|
let isReactGroupSettled = !collectReactGroup;
|
|
37782
37398
|
const visitedDirectories = /* @__PURE__ */ new Set();
|
|
37783
37399
|
for (const pattern of getWorkspacePatterns(rootDirectory, rootPackageJson)) {
|
|
37784
|
-
const directories = resolveWorkspaceDirectories(rootDirectory, pattern).
|
|
37400
|
+
const directories = [...resolveWorkspaceDirectories(rootDirectory, pattern)].sort();
|
|
37785
37401
|
for (const workspaceDirectory of directories) {
|
|
37786
37402
|
if (visitedDirectories.has(workspaceDirectory)) continue;
|
|
37787
37403
|
visitedDirectories.add(workspaceDirectory);
|
|
37788
37404
|
const workspacePackageJson = readPackageJson$1(Path.join(workspaceDirectory, "package.json"));
|
|
37789
|
-
evaluateManifestFacts(facts, workspacePackageJson, workspaceDirectory
|
|
37405
|
+
evaluateManifestFacts(facts, workspacePackageJson, workspaceDirectory);
|
|
37790
37406
|
const info = extractDependencyInfo(workspacePackageJson);
|
|
37791
37407
|
if (info.framework !== "unknown" && frameworkMergeRank(info.framework) < frameworkMergeRank(facts.framework)) facts.framework = info.framework;
|
|
37792
37408
|
if (isReactGroupSettled) continue;
|
|
@@ -37817,7 +37433,7 @@ const collectWorkspaceFacts = (rootDirectory, rootPackageJson, { collectReactGro
|
|
|
37817
37433
|
workspaceDirectory,
|
|
37818
37434
|
workspacePackageJson
|
|
37819
37435
|
});
|
|
37820
|
-
if (reactVersion &&
|
|
37436
|
+
if (reactVersion && shouldReplaceReactVersion(facts.reactVersion, reactVersion)) facts.reactVersion = reactVersion;
|
|
37821
37437
|
if (tailwindVersion && !facts.tailwindVersion) facts.tailwindVersion = tailwindVersion;
|
|
37822
37438
|
if (zodVersion && !facts.zodVersion) facts.zodVersion = zodVersion;
|
|
37823
37439
|
const settledReactMajor = parseReactMajor(facts.reactVersion);
|
|
@@ -38007,16 +37623,6 @@ const discoverProjectWithoutPackageJson = (directory) => {
|
|
|
38007
37623
|
tailwindVersion: null,
|
|
38008
37624
|
zodVersion: null,
|
|
38009
37625
|
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
37626
|
framework: "unknown",
|
|
38021
37627
|
hasTypeScript: hasOwnTsConfig,
|
|
38022
37628
|
hasReactCompiler: false,
|
|
@@ -38024,26 +37630,12 @@ const discoverProjectWithoutPackageJson = (directory) => {
|
|
|
38024
37630
|
hasTanStackQuery: false,
|
|
38025
37631
|
valtioVersion: null,
|
|
38026
37632
|
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
37633
|
hasSsrDependency: false,
|
|
38040
37634
|
preactVersion: null,
|
|
38041
37635
|
preactMajorVersion: null,
|
|
38042
37636
|
hasReactNativeWorkspace: false,
|
|
38043
37637
|
nextjsVersion: null,
|
|
38044
37638
|
nextjsMajorVersion: null,
|
|
38045
|
-
reactRouterVersion: null,
|
|
38046
|
-
hasReactRouterFramework: false,
|
|
38047
37639
|
expoVersion: null,
|
|
38048
37640
|
shopifyFlashListVersion: null,
|
|
38049
37641
|
shopifyFlashListMajorVersion: null,
|
|
@@ -38136,12 +37728,6 @@ const discoverProject = (directory) => {
|
|
|
38136
37728
|
packageName: SHOPIFY_FLASH_LIST_PACKAGE_NAME,
|
|
38137
37729
|
version: workspaceFacts.shopifyFlashList.version
|
|
38138
37730
|
}) : null;
|
|
38139
|
-
const zustandVersion = resolveCatalogBackedDependencyVersion({
|
|
38140
|
-
rootDirectory: directory,
|
|
38141
|
-
rootPackageJson: packageJson,
|
|
38142
|
-
packageName: "zustand",
|
|
38143
|
-
version: workspaceFacts.zustand.version
|
|
38144
|
-
});
|
|
38145
37731
|
const hasReanimated = hasReactNativeWorkspace && workspaceFacts.hasReanimatedAwarePackage;
|
|
38146
37732
|
const reanimatedVersion = hasReanimated ? workspaceFacts.reanimatedVersion : null;
|
|
38147
37733
|
const nextjsVersion = framework === "nextjs" ? resolveCatalogBackedDependencyVersion({
|
|
@@ -38156,33 +37742,7 @@ const discoverProject = (directory) => {
|
|
|
38156
37742
|
packageName: "valtio",
|
|
38157
37743
|
version: workspaceFacts.valtioVersion
|
|
38158
37744
|
});
|
|
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
37745
|
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
37746
|
const isPreES2023Target = hasTypeScript && detectPreES2023Target(directory);
|
|
38187
37747
|
const projectInfo = {
|
|
38188
37748
|
rootDirectory: directory,
|
|
@@ -38192,43 +37752,19 @@ const discoverProject = (directory) => {
|
|
|
38192
37752
|
tailwindVersion,
|
|
38193
37753
|
zodVersion,
|
|
38194
37754
|
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
37755
|
framework,
|
|
38206
37756
|
hasTypeScript,
|
|
38207
37757
|
hasReactCompiler: detectReactCompiler(directory, packageJson),
|
|
38208
37758
|
hasReactCompilerLintPlugin: detectReactCompilerLintPlugin(directory, packageJson),
|
|
38209
|
-
hasTanStackQuery:
|
|
38210
|
-
hasI18nLibrary: workspaceFacts.hasI18nLibrary,
|
|
38211
|
-
tanstackQueryVersion,
|
|
38212
|
-
styledComponentsVersion: workspaceFacts.styledComponentsVersion,
|
|
37759
|
+
hasTanStackQuery: hasTanStackQuery(packageJson),
|
|
38213
37760
|
valtioVersion,
|
|
38214
37761
|
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),
|
|
38224
37762
|
hasSsrDependency: workspaceFacts.hasSsrDependency,
|
|
38225
37763
|
preactVersion,
|
|
38226
37764
|
preactMajorVersion: parseReactMajor(preactVersion),
|
|
38227
37765
|
hasReactNativeWorkspace,
|
|
38228
37766
|
nextjsVersion,
|
|
38229
37767
|
nextjsMajorVersion: nextjsVersion === null ? null : getLowestDependencyMajor(nextjsVersion),
|
|
38230
|
-
reactRouterVersion,
|
|
38231
|
-
hasReactRouterFramework: workspaceFacts.hasReactRouterFramework,
|
|
38232
37768
|
expoVersion,
|
|
38233
37769
|
shopifyFlashListVersion,
|
|
38234
37770
|
shopifyFlashListMajorVersion: shopifyFlashListVersion === null ? null : getLowestDependencyMajor(shopifyFlashListVersion),
|
|
@@ -41532,10 +41068,10 @@ const SSR_FRAMEWORKS = new Set([
|
|
|
41532
41068
|
"gatsby",
|
|
41533
41069
|
"tanstack-start"
|
|
41534
41070
|
]);
|
|
41535
|
-
const
|
|
41536
|
-
if (
|
|
41537
|
-
const
|
|
41538
|
-
for (let candidate = earliest; candidate <=
|
|
41071
|
+
const addMajorLadder = (capabilities, name, major, earliest, latest) => {
|
|
41072
|
+
if (major === null) return;
|
|
41073
|
+
const cappedMajor = Math.min(major, latest);
|
|
41074
|
+
for (let candidate = earliest; candidate <= cappedMajor; candidate += 1) capabilities.add(`${name}:${candidate}`);
|
|
41539
41075
|
};
|
|
41540
41076
|
const buildCapabilities = (project) => {
|
|
41541
41077
|
const capabilities = /* @__PURE__ */ new Set();
|
|
@@ -41548,86 +41084,26 @@ const buildCapabilities = (project) => {
|
|
|
41548
41084
|
if (CLIENT_ONLY_FRAMEWORKS.has(project.framework)) capabilities.add("client-only");
|
|
41549
41085
|
if (project.isStaticExport) capabilities.add("nextjs:static-export");
|
|
41550
41086
|
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);
|
|
41087
|
+
addMajorLadder(capabilities, "react", project.reactMajorVersion, 17, 30);
|
|
41562
41088
|
if (project.reactMajorVersion !== null && project.reactMajorVersion >= 19 && isMajorMinorAtLeast(parseReactMajorMinor(project.reactVersion), {
|
|
41563
41089
|
major: 19,
|
|
41564
41090
|
minor: 2
|
|
41565
41091
|
})) 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
|
-
}
|
|
41092
|
+
if (project.tailwindVersion !== null) capabilities.add("tailwind");
|
|
41093
|
+
if (project.tailwindVersion !== null && isMajorMinorAtLeast(parseTailwindMajorMinor(project.tailwindVersion), {
|
|
41094
|
+
major: 3,
|
|
41095
|
+
minor: 4
|
|
41096
|
+
})) capabilities.add("tailwind:3.4");
|
|
41578
41097
|
if (project.zodVersion !== null) capabilities.add("zod");
|
|
41579
41098
|
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
41099
|
if (project.isPreES2023Target) capabilities.add("pre-es2023");
|
|
41608
41100
|
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");
|
|
41101
|
+
if (project.hasTanStackQuery) capabilities.add("tanstack-query");
|
|
41616
41102
|
if (project.valtioVersion !== null) capabilities.add("valtio");
|
|
41617
|
-
|
|
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
|
-
}
|
|
41103
|
+
addMajorLadder(capabilities, "valtio", project.valtioMajorVersion, 1, 10);
|
|
41628
41104
|
if (project.hasTypeScript) capabilities.add("typescript");
|
|
41629
41105
|
if (project.preactVersion !== null) capabilities.add("preact");
|
|
41630
|
-
|
|
41106
|
+
addMajorLadder(capabilities, "preact", project.preactMajorVersion, 10, 20);
|
|
41631
41107
|
if (project.preactVersion !== null && project.reactVersion === null) capabilities.add("pure-preact");
|
|
41632
41108
|
return capabilities;
|
|
41633
41109
|
};
|
|
@@ -41639,7 +41115,7 @@ const getCapabilities = (project) => {
|
|
|
41639
41115
|
capabilitiesByProject.set(project, capabilities);
|
|
41640
41116
|
return capabilities;
|
|
41641
41117
|
};
|
|
41642
|
-
const shouldEnableRule = (requires, tags, capabilities, ignoredTags, disabledWhen
|
|
41118
|
+
const shouldEnableRule = (requires, tags, capabilities, ignoredTags, disabledWhen) => {
|
|
41643
41119
|
if (requires) {
|
|
41644
41120
|
for (const capability of requires) if (!capabilities.has(capability)) return false;
|
|
41645
41121
|
}
|
|
@@ -41650,29 +41126,20 @@ const shouldEnableRule = (requires, tags, capabilities, ignoredTags, disabledWhe
|
|
|
41650
41126
|
if (tags) {
|
|
41651
41127
|
for (const tag of tags) if (ignoredTags.has(tag)) return false;
|
|
41652
41128
|
}
|
|
41653
|
-
if (includedTags && includedTags.size > 0) {
|
|
41654
|
-
if (!tags?.some((tag) => includedTags.has(tag))) return false;
|
|
41655
|
-
}
|
|
41656
41129
|
return true;
|
|
41657
41130
|
};
|
|
41658
|
-
const shouldEnableRuleByDefaultStatus = (options) => options.defaultEnabled !== false || options.hasExplicitOverride === true || options.includeTagDefaults && options.hasIncludedTags;
|
|
41659
41131
|
const yieldToEventLoop = () => new Promise((resolve) => {
|
|
41660
41132
|
setImmediate(resolve);
|
|
41661
41133
|
});
|
|
41662
41134
|
const createSecurityScanSession = (rootDirectory, options) => {
|
|
41663
41135
|
const capabilities = options.project ? getCapabilities(options.project) : /* @__PURE__ */ new Set();
|
|
41664
41136
|
const ignoredTags = options.ignoredTags ?? /* @__PURE__ */ new Set();
|
|
41665
|
-
const includedTags = options.includedTags ?? /* @__PURE__ */ new Set();
|
|
41666
41137
|
const enabledScanRules = REACT_DOCTOR_RULES.flatMap((entry) => {
|
|
41667
41138
|
const rule = entry.rule;
|
|
41668
41139
|
const scan = rule.scan;
|
|
41669
41140
|
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 [];
|
|
41141
|
+
if (rule.defaultEnabled === false) return [];
|
|
41142
|
+
if (!shouldEnableRule(rule.requires, rule.tags, capabilities, ignoredTags, rule.disabledWhen)) return [];
|
|
41676
41143
|
return [{
|
|
41677
41144
|
entry,
|
|
41678
41145
|
scan,
|
|
@@ -43674,9 +43141,8 @@ const buildUserPluginRules = (userPlugin, severityControls) => {
|
|
|
43674
43141
|
}
|
|
43675
43142
|
return enabled;
|
|
43676
43143
|
};
|
|
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);
|
|
43144
|
+
const createOxlintConfig = ({ pluginPath, project, customRulesOnly = false, extendsPaths = [], ignoredTags = /* @__PURE__ */ new Set(), serverAuthFunctionNames, severityControls, userPlugins = [], disableReactHooksJsPlugin = false, ruleSelection, sidecarRuleIdFilter }) => {
|
|
43145
|
+
const reactHooksJsPlugin = disableReactHooksJsPlugin || ruleSelection === "sidecar" ? null : resolveReactHooksJsPlugin(project.hasReactCompiler || project.hasReactCompilerLintPlugin === true, customRulesOnly);
|
|
43680
43146
|
const reactCompilerRules = reactHooksJsPlugin ? applyRuleSeverityControls(filterRulesToAvailable(REACT_COMPILER_RULES, "react-hooks-js", reactHooksJsPlugin.availableRuleNames), severityControls) : {};
|
|
43681
43147
|
const jsPlugins = [];
|
|
43682
43148
|
if (reactHooksJsPlugin) jsPlugins.push(reactHooksJsPlugin.entry);
|
|
@@ -43691,14 +43157,9 @@ const createOxlintConfig = ({ pluginPath, project, customRulesOnly = false, exte
|
|
|
43691
43157
|
if (rule.scan !== void 0) continue;
|
|
43692
43158
|
if (customRulesOnly && registryEntry.originallyExternal) continue;
|
|
43693
43159
|
if (rule.framework !== "global" && !rule.requires) continue;
|
|
43694
|
-
if (!shouldEnableRule(rule.requires, rule.tags, capabilities, ignoredTags, rule.disabledWhen
|
|
43160
|
+
if (!shouldEnableRule(rule.requires, rule.tags, capabilities, ignoredTags, rule.disabledWhen)) continue;
|
|
43695
43161
|
const explicitRuleOverride = resolveRuleSeverityOverride({ ruleKey: registryEntry.key }, severityControls);
|
|
43696
|
-
if (
|
|
43697
|
-
defaultEnabled: rule.defaultEnabled,
|
|
43698
|
-
includeTagDefaults,
|
|
43699
|
-
hasIncludedTags,
|
|
43700
|
-
hasExplicitOverride: explicitRuleOverride !== void 0
|
|
43701
|
-
})) continue;
|
|
43162
|
+
if (rule.defaultEnabled === false && explicitRuleOverride === void 0) continue;
|
|
43702
43163
|
const severity = resolveRuleSeverityOverride({
|
|
43703
43164
|
ruleKey: registryEntry.key,
|
|
43704
43165
|
category: rule.category
|
|
@@ -43707,7 +43168,7 @@ const createOxlintConfig = ({ pluginPath, project, customRulesOnly = false, exte
|
|
|
43707
43168
|
enabledReactDoctorRules[registryEntry.key] = severity;
|
|
43708
43169
|
}
|
|
43709
43170
|
const userPluginRules = {};
|
|
43710
|
-
if (ruleSelection !== "sidecar"
|
|
43171
|
+
if (ruleSelection !== "sidecar") for (const userPlugin of userPlugins) {
|
|
43711
43172
|
Object.assign(userPluginRules, buildUserPluginRules(userPlugin, severityControls));
|
|
43712
43173
|
jsPlugins.push(userPlugin.entry);
|
|
43713
43174
|
}
|
|
@@ -43924,19 +43385,6 @@ const createSidecarLintCache = (cacheDirectory, rulesetHash) => {
|
|
|
43924
43385
|
}
|
|
43925
43386
|
};
|
|
43926
43387
|
};
|
|
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
43388
|
const bundledRequire$3 = createRequire(import.meta.url);
|
|
43941
43389
|
const childNodeVersionByBinaryPath = /* @__PURE__ */ new Map();
|
|
43942
43390
|
const resolveChildNodeVersion = (nodeBinaryPath) => {
|
|
@@ -43960,13 +43408,6 @@ const TOOLCHAIN_PACKAGE_SPECIFIERS$1 = [
|
|
|
43960
43408
|
"oxlint-plugin-react-doctor/package.json",
|
|
43961
43409
|
"eslint-plugin-react-hooks/package.json"
|
|
43962
43410
|
];
|
|
43963
|
-
const resolvePluginFingerprint = () => {
|
|
43964
|
-
try {
|
|
43965
|
-
return fingerprintFileContents(bundledRequire$3.resolve("oxlint-plugin-react-doctor"), 16);
|
|
43966
|
-
} catch {
|
|
43967
|
-
return "unresolved";
|
|
43968
|
-
}
|
|
43969
|
-
};
|
|
43970
43411
|
const resolveOxlintToolchainVersions = (nodeBinaryPath = process.execPath) => {
|
|
43971
43412
|
const versions = [`node=${resolveChildNodeVersion(nodeBinaryPath)}`];
|
|
43972
43413
|
for (const specifier of TOOLCHAIN_PACKAGE_SPECIFIERS$1) try {
|
|
@@ -43976,7 +43417,6 @@ const resolveOxlintToolchainVersions = (nodeBinaryPath = process.execPath) => {
|
|
|
43976
43417
|
} catch {
|
|
43977
43418
|
versions.push(`${specifier}=missing`);
|
|
43978
43419
|
}
|
|
43979
|
-
versions.push(`oxlint-plugin-react-doctor#fingerprint=${resolvePluginFingerprint()}`);
|
|
43980
43420
|
return versions;
|
|
43981
43421
|
};
|
|
43982
43422
|
const esmRequire = createRequire(import.meta.url);
|
|
@@ -45452,7 +44892,7 @@ const reactHooksJsPluginDropNote = (error) => {
|
|
|
45452
44892
|
* 6. always restore disable directives + clean up the temp dir
|
|
45453
44893
|
*/
|
|
45454
44894
|
const runOxlint = async (options) => {
|
|
45455
|
-
const { rootDirectory, project, includePaths, nodeBinaryPath = process.execPath, customRulesOnly = false, respectInlineDisables = true, adoptExistingLintConfig = true, ignoredTags = /* @__PURE__ */ new Set(),
|
|
44895
|
+
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
44896
|
const serverAuthFunctionNames = Array.isArray(userConfig?.serverAuthFunctionNames) ? userConfig.serverAuthFunctionNames.filter((entry) => typeof entry === "string" && entry.length > 0) : void 0;
|
|
45457
44897
|
const severityControls = buildRuleSeverityControls(userConfig);
|
|
45458
44898
|
validateRuleRegistration();
|
|
@@ -45466,15 +44906,13 @@ const runOxlint = async (options) => {
|
|
|
45466
44906
|
}
|
|
45467
44907
|
const pluginPath = resolvePluginPath();
|
|
45468
44908
|
const extendsPaths = (adoptExistingLintConfig && !customRulesOnly ? detectUserLintConfigPaths(rootDirectory) : []).filter(canOxlintExtendConfig);
|
|
45469
|
-
const userPlugins =
|
|
44909
|
+
const userPlugins = resolveUserPlugins(userConfig?.plugins, configSourceDirectory);
|
|
45470
44910
|
const buildConfig = (overrides) => createOxlintConfig({
|
|
45471
44911
|
pluginPath,
|
|
45472
44912
|
project,
|
|
45473
44913
|
customRulesOnly,
|
|
45474
44914
|
extendsPaths: overrides.extendsPaths,
|
|
45475
44915
|
ignoredTags,
|
|
45476
|
-
includedTags,
|
|
45477
|
-
includeTagDefaults,
|
|
45478
44916
|
serverAuthFunctionNames,
|
|
45479
44917
|
severityControls,
|
|
45480
44918
|
userPlugins,
|
|
@@ -45863,8 +45301,6 @@ var Linter = class Linter extends Service()("react-doctor/Linter") {
|
|
|
45863
45301
|
respectInlineDisables: input.respectInlineDisables,
|
|
45864
45302
|
adoptExistingLintConfig: input.adoptExistingLintConfig,
|
|
45865
45303
|
ignoredTags: input.ignoredTags,
|
|
45866
|
-
includedTags: input.includedTags,
|
|
45867
|
-
includeTagDefaults: input.includeTagDefaults,
|
|
45868
45304
|
userConfig: input.userConfig ?? null,
|
|
45869
45305
|
configSourceDirectory: input.configSourceDirectory,
|
|
45870
45306
|
onPartialFailure: (reason) => {
|
|
@@ -46713,9 +46149,7 @@ const runInspect = (input, hooks = {}) => gen(function* () {
|
|
|
46713
46149
|
const securityScanFailedRef = yield* make$13(false);
|
|
46714
46150
|
const securityScanFiber = yield* forkChild(runCollect(applyPerElementPipeline(isDiffMode ? empty$4 : unwrap(tryPromise(() => checkSecurityScanCooperative(scanDirectory, {
|
|
46715
46151
|
project,
|
|
46716
|
-
ignoredTags: input.ignoredTags
|
|
46717
|
-
includedTags: input.includedTags,
|
|
46718
|
-
includeTagDefaults: input.includeTagDefaults
|
|
46152
|
+
ignoredTags: input.ignoredTags
|
|
46719
46153
|
})).pipe(map$3((diagnostics) => fromIterable$1(diagnostics)), catch_$1(() => set(securityScanFailedRef, true).pipe(as(empty$4))))))).pipe(withSpan("SecurityScan.run")));
|
|
46720
46154
|
const shouldRunSupplyChain = !isDiffMode || (input.supplyChainManifestChanged ?? false);
|
|
46721
46155
|
const supplyChainOverlapTimeout = yield* SupplyChainOverlapTimeoutMs;
|
|
@@ -46806,8 +46240,6 @@ const runInspect = (input, hooks = {}) => gen(function* () {
|
|
|
46806
46240
|
respectInlineDisables: input.respectInlineDisables,
|
|
46807
46241
|
adoptExistingLintConfig: input.adoptExistingLintConfig,
|
|
46808
46242
|
ignoredTags: input.ignoredTags,
|
|
46809
|
-
includedTags: input.includedTags,
|
|
46810
|
-
includeTagDefaults: input.includeTagDefaults,
|
|
46811
46243
|
userConfig: resolvedConfig.config ?? void 0,
|
|
46812
46244
|
configSourceDirectory: resolvedConfig.configSourceDirectory ?? void 0,
|
|
46813
46245
|
onFileProgress: (scannedFileCount, totalFileCount) => {
|
|
@@ -47952,7 +47384,7 @@ const makeNoopConsole = () => ({
|
|
|
47952
47384
|
});
|
|
47953
47385
|
//#endregion
|
|
47954
47386
|
//#region src/cli/utils/version.ts
|
|
47955
|
-
const VERSION = "0.8.1-dev.
|
|
47387
|
+
const VERSION = "0.8.1-dev.5774353";
|
|
47956
47388
|
//#endregion
|
|
47957
47389
|
//#region src/cli/utils/json-mode.ts
|
|
47958
47390
|
let context = null;
|
|
@@ -48039,11 +47471,7 @@ const getRunId = () => {
|
|
|
48039
47471
|
};
|
|
48040
47472
|
//#endregion
|
|
48041
47473
|
//#region src/cli/utils/build-run-context.ts
|
|
48042
|
-
const ROOT_SUBCOMMANDS = new Set([
|
|
48043
|
-
"design",
|
|
48044
|
-
"install",
|
|
48045
|
-
"setup"
|
|
48046
|
-
]);
|
|
47474
|
+
const ROOT_SUBCOMMANDS = new Set(["install", "setup"]);
|
|
48047
47475
|
const detectInvokedVia = () => {
|
|
48048
47476
|
const userAgent = process.env.npm_config_user_agent;
|
|
48049
47477
|
if (!userAgent) return "unknown";
|
|
@@ -48127,9 +47555,7 @@ const buildSentryProjectContext = (projectInfo) => ({
|
|
|
48127
47555
|
reactMajorVersion: projectInfo.reactMajorVersion,
|
|
48128
47556
|
hasTypeScript: projectInfo.hasTypeScript,
|
|
48129
47557
|
hasReactCompiler: projectInfo.hasReactCompiler,
|
|
48130
|
-
|
|
48131
|
-
mobxVersion: projectInfo.mobxVersion,
|
|
48132
|
-
styledComponentsVersion: projectInfo.styledComponentsVersion,
|
|
47558
|
+
hasTanStackQuery: projectInfo.hasTanStackQuery,
|
|
48133
47559
|
tailwindVersion: projectInfo.tailwindVersion,
|
|
48134
47560
|
zodVersion: projectInfo.zodVersion,
|
|
48135
47561
|
preactVersion: projectInfo.preactVersion,
|
|
@@ -48310,13 +47736,13 @@ const isDevVersion = (version) => version === "0.0.0" || version.includes("-");
|
|
|
48310
47736
|
* uploads source-map artifacts under, so stack frames symbolicate. Honors the
|
|
48311
47737
|
* standard `SENTRY_RELEASE` override.
|
|
48312
47738
|
*/
|
|
48313
|
-
const resolveSentryRelease = () => process.env.SENTRY_RELEASE || `react-doctor@0.8.1-dev.
|
|
47739
|
+
const resolveSentryRelease = () => process.env.SENTRY_RELEASE || `react-doctor@0.8.1-dev.5774353`;
|
|
48314
47740
|
/**
|
|
48315
47741
|
* Deployment environment shown in Sentry's environment filter. Defaults to
|
|
48316
47742
|
* `production` for tagged releases and `development` for dev/unbuilt versions,
|
|
48317
47743
|
* overridable via the standard `SENTRY_ENVIRONMENT` env var.
|
|
48318
47744
|
*/
|
|
48319
|
-
const resolveSentryEnvironment = () => process.env.SENTRY_ENVIRONMENT || (isDevVersion("0.8.1-dev.
|
|
47745
|
+
const resolveSentryEnvironment = () => process.env.SENTRY_ENVIRONMENT || (isDevVersion("0.8.1-dev.5774353") ? "development" : "production");
|
|
48320
47746
|
/**
|
|
48321
47747
|
* Performance-tracing sample rate in `[0, 1]`. Reads `SENTRY_TRACES_SAMPLE_RATE`
|
|
48322
47748
|
* (set to `0` to disable tracing) and falls back to
|
|
@@ -60642,8 +60068,6 @@ const buildScanResultCacheKey = (input) => {
|
|
|
60642
60068
|
warnings: input.options.warnings,
|
|
60643
60069
|
adoptExistingLintConfig: input.options.adoptExistingLintConfig,
|
|
60644
60070
|
ignoredTags: [...input.options.ignoredTags].sort(),
|
|
60645
|
-
includedTags: [...input.options.includedTags].sort(),
|
|
60646
|
-
includeTagDefaults: input.options.includeTagDefaults,
|
|
60647
60071
|
concurrency: input.options.concurrency,
|
|
60648
60072
|
lintBatchOrdering: resolveLintBatchOrdering(),
|
|
60649
60073
|
baselineRef: input.options.baseline?.ref,
|
|
@@ -61470,8 +60894,8 @@ const createDiagnosticEvidenceReader = (rootDirectory, options = {}) => {
|
|
|
61470
60894
|
//#endregion
|
|
61471
60895
|
//#region src/cli/utils/build-no-score-message.ts
|
|
61472
60896
|
const ENTERPRISE_CONTACT_HINT = `Want something custom to your company? Contact us at ${ENTERPRISE_CONTACT_URL}.`;
|
|
61473
|
-
const buildNoScoreMessage = (isScoreDisabled
|
|
61474
|
-
return `${isScoreDisabled ?
|
|
60897
|
+
const buildNoScoreMessage = (isScoreDisabled) => {
|
|
60898
|
+
return `${isScoreDisabled ? "Score disabled by --no-score." : "Score unavailable (could not reach the score API)."} ${ENTERPRISE_CONTACT_HINT}`;
|
|
61475
60899
|
};
|
|
61476
60900
|
//#endregion
|
|
61477
60901
|
//#region src/cli/utils/render-agent-guidance.ts
|
|
@@ -62596,47 +62020,40 @@ const buildChangedLineMatcher = (directory, changedLineRanges) => {
|
|
|
62596
62020
|
return diagnosticIntersectsLineRanges(diagnostic, ranges);
|
|
62597
62021
|
};
|
|
62598
62022
|
};
|
|
62599
|
-
const buildIgnoredTags = (userConfig
|
|
62023
|
+
const buildIgnoredTags = (userConfig) => {
|
|
62600
62024
|
const tags = /* @__PURE__ */ new Set();
|
|
62601
62025
|
if (userConfig?.ignore?.tags) for (const tag of userConfig.ignore.tags) tags.add(tag);
|
|
62602
|
-
for (const tag of includedTags) tags.delete(tag);
|
|
62603
62026
|
return tags;
|
|
62604
62027
|
};
|
|
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
|
-
};
|
|
62028
|
+
const mergeInspectOptions = (inputOptions, userConfig) => ({
|
|
62029
|
+
lint: inputOptions.lint ?? userConfig?.lint ?? true,
|
|
62030
|
+
deadCode: inputOptions.deadCode ?? userConfig?.deadCode ?? true,
|
|
62031
|
+
supplyChain: inputOptions.supplyChain ?? userConfig?.supplyChain?.enabled ?? true,
|
|
62032
|
+
verbose: inputOptions.verbose ?? userConfig?.verbose ?? false,
|
|
62033
|
+
outputDirectory: inputOptions.outputDirectory || null,
|
|
62034
|
+
scoreOnly: inputOptions.scoreOnly ?? false,
|
|
62035
|
+
noScore: inputOptions.noScore ?? userConfig?.noScore ?? false,
|
|
62036
|
+
isCi: inputOptions.isCi ?? false,
|
|
62037
|
+
isCiOrCodingAgentEnvironment: isCiOrCodingAgentEnvironment(),
|
|
62038
|
+
isNonInteractiveEnvironment: isNonInteractiveEnvironment(),
|
|
62039
|
+
silent: inputOptions.silent ?? false,
|
|
62040
|
+
includePaths: inputOptions.includePaths ?? [],
|
|
62041
|
+
customRulesOnly: userConfig?.customRulesOnly ?? false,
|
|
62042
|
+
share: userConfig?.share ?? true,
|
|
62043
|
+
respectInlineDisables: inputOptions.respectInlineDisables ?? userConfig?.respectInlineDisables ?? true,
|
|
62044
|
+
warnings: inputOptions.warnings ?? userConfig?.warnings ?? true,
|
|
62045
|
+
categoryFilters: new Set(resolveCliCategories(inputOptions.categoryFilters) ?? []),
|
|
62046
|
+
adoptExistingLintConfig: userConfig?.adoptExistingLintConfig ?? true,
|
|
62047
|
+
ignoredTags: buildIgnoredTags(userConfig),
|
|
62048
|
+
outputSurface: inputOptions.outputSurface ?? "cli",
|
|
62049
|
+
suppressRendering: inputOptions.suppressRendering ?? false,
|
|
62050
|
+
concurrentScan: inputOptions.concurrentScan ?? false,
|
|
62051
|
+
concurrency: inputOptions.concurrency,
|
|
62052
|
+
maxDurationMs: inputOptions.maxDurationMs ?? null,
|
|
62053
|
+
baseline: inputOptions.baseline ?? null,
|
|
62054
|
+
changedLineRanges: inputOptions.changedLineRanges ?? null,
|
|
62055
|
+
supplyChainManifestChanged: inputOptions.supplyChainManifestChanged ?? false
|
|
62056
|
+
});
|
|
62640
62057
|
const deriveScope = (options) => {
|
|
62641
62058
|
if (options.baseline) return "changed";
|
|
62642
62059
|
if (options.changedLineRanges !== null) return "lines";
|
|
@@ -62767,8 +62184,6 @@ const runBaselineComparison = async (params) => {
|
|
|
62767
62184
|
warnings: params.options.warnings,
|
|
62768
62185
|
adoptExistingLintConfig: params.options.adoptExistingLintConfig,
|
|
62769
62186
|
ignoredTags: params.options.ignoredTags,
|
|
62770
|
-
includedTags: params.options.includedTags,
|
|
62771
|
-
includeTagDefaults: params.options.includeTagDefaults,
|
|
62772
62187
|
nodeBinaryPath: params.resolvedNodeBinaryPath ?? void 0,
|
|
62773
62188
|
runDeadCode: false,
|
|
62774
62189
|
isCi: params.options.isCi,
|
|
@@ -62862,8 +62277,6 @@ const runInspectWithRuntime = async (directory, options, userConfig, hasConfigOv
|
|
|
62862
62277
|
warnings: options.warnings,
|
|
62863
62278
|
adoptExistingLintConfig: options.adoptExistingLintConfig,
|
|
62864
62279
|
ignoredTags: options.ignoredTags,
|
|
62865
|
-
includedTags: options.includedTags,
|
|
62866
|
-
includeTagDefaults: options.includeTagDefaults,
|
|
62867
62280
|
nodeBinaryPath: resolvedNodeBinaryPath ?? void 0,
|
|
62868
62281
|
runDeadCode: options.deadCode,
|
|
62869
62282
|
isCi: options.isCi,
|
|
@@ -63052,7 +62465,7 @@ const finalizeAndRender = (input) => gen(function* () {
|
|
|
63052
62465
|
securityScanFailed
|
|
63053
62466
|
});
|
|
63054
62467
|
const hasSkippedChecks = skippedChecks.length > 0;
|
|
63055
|
-
const noScoreMessage = buildNoScoreMessage(options.noScore
|
|
62468
|
+
const noScoreMessage = buildNoScoreMessage(options.noScore);
|
|
63056
62469
|
const buildResult = () => ({
|
|
63057
62470
|
diagnostics: [...diagnostics],
|
|
63058
62471
|
score,
|
|
@@ -65157,25 +64570,21 @@ const resolveParallelFlag = (parallel) => parallel === false ? 1 : void 0;
|
|
|
65157
64570
|
*/
|
|
65158
64571
|
const resolveCliInspectOptions = (flags, userConfig) => {
|
|
65159
64572
|
const wantsWarningGate = pickBlockingLevel(flags, userConfig) === "warning";
|
|
65160
|
-
const isDesignScan = flags.design === true;
|
|
65161
64573
|
return {
|
|
65162
64574
|
lint: flags.lint,
|
|
65163
|
-
deadCode:
|
|
65164
|
-
supplyChain:
|
|
64575
|
+
deadCode: flags.deadCode,
|
|
64576
|
+
supplyChain: flags.supplyChain,
|
|
65165
64577
|
verbose: flags.verbose,
|
|
65166
64578
|
outputDirectory: flags.outputDir,
|
|
65167
64579
|
respectInlineDisables: flags.respectInlineDisables === false ? false : void 0,
|
|
65168
64580
|
warnings: wantsWarningGate ? true : flags.warnings,
|
|
65169
64581
|
scoreOnly: flags.score === true,
|
|
65170
|
-
noScore:
|
|
64582
|
+
noScore: flags.score === false || flags.telemetry === false ? true : void 0,
|
|
65171
64583
|
isCi: isCiEnvironment(),
|
|
65172
64584
|
silent: Boolean(flags.json),
|
|
65173
64585
|
concurrency: resolveParallelFlag(flags.parallel),
|
|
65174
64586
|
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
|
|
64587
|
+
categoryFilters: resolveCliCategories(flags.category)
|
|
65179
64588
|
};
|
|
65180
64589
|
};
|
|
65181
64590
|
//#endregion
|
|
@@ -65593,7 +65002,7 @@ const maybeMigrateLegacyConfig = async (requestedDirectory, { isQuiet, isStaged
|
|
|
65593
65002
|
if (!(!isQuiet && !isStaged && process.stdout.isTTY === true && !isCiOrCodingAgentEnvironment())) return;
|
|
65594
65003
|
await runProjectMigrations(requestedDirectory);
|
|
65595
65004
|
};
|
|
65596
|
-
const inspectAction = async (directory, flags
|
|
65005
|
+
const inspectAction = async (directory, flags) => {
|
|
65597
65006
|
const isScoreOnly = Boolean(flags.score);
|
|
65598
65007
|
const isJsonMode = Boolean(flags.json);
|
|
65599
65008
|
const isQuiet = isScoreOnly || isJsonMode;
|
|
@@ -65607,7 +65016,7 @@ const inspectAction = async (directory, flags, invocationCommand = "inspect") =>
|
|
|
65607
65016
|
});
|
|
65608
65017
|
if (flags.jsonOut) recordCount(METRIC.jsonOutUsed, 1);
|
|
65609
65018
|
}
|
|
65610
|
-
recordCount(METRIC.cliInvoked, 1, { command:
|
|
65019
|
+
recordCount(METRIC.cliInvoked, 1, { command: "inspect" });
|
|
65611
65020
|
try {
|
|
65612
65021
|
validateModeFlags(flags);
|
|
65613
65022
|
if (flags.staged) setJsonReportMode("staged");
|
|
@@ -65919,13 +65328,6 @@ const inspectAction = async (directory, flags, invocationCommand = "inspect") =>
|
|
|
65919
65328
|
}
|
|
65920
65329
|
};
|
|
65921
65330
|
//#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
65331
|
//#region src/cli/commands/install.ts
|
|
65930
65332
|
const installAction = async (options, command) => {
|
|
65931
65333
|
recordCount(METRIC.cliInvoked, 1, { command: "install" });
|
|
@@ -66762,7 +66164,6 @@ const INSTALL_FLAG_SPEC = {
|
|
|
66762
66164
|
shortOptionsWithRequiredValues: new Set(["-c"])
|
|
66763
66165
|
};
|
|
66764
66166
|
const COMMAND_FLAG_SPECS = new Map([
|
|
66765
|
-
["design", ROOT_FLAG_SPEC],
|
|
66766
66167
|
["install", INSTALL_FLAG_SPEC],
|
|
66767
66168
|
["setup", INSTALL_FLAG_SPEC],
|
|
66768
66169
|
["version", {
|
|
@@ -66919,7 +66320,6 @@ ${formatExampleLines([
|
|
|
66919
66320
|
["react-doctor --scope changed --base main", "scan only new issues vs. main"],
|
|
66920
66321
|
["react-doctor --project modules/a,modules/b", "score each module separately (names or paths)"],
|
|
66921
66322
|
["react-doctor --staged", "scan staged files (pre-commit hook)"],
|
|
66922
|
-
["react-doctor design", "run the focused UI design audit"],
|
|
66923
66323
|
["react-doctor --category Security", "show only one diagnostic category"],
|
|
66924
66324
|
["react-doctor --blocking warning", "fail CI on warnings too (default: error)"],
|
|
66925
66325
|
["react-doctor --json > report.json", "write a machine-readable report"],
|
|
@@ -66953,20 +66353,6 @@ ${highlighter.dim("Managing CI:")}
|
|
|
66953
66353
|
${highlighter.dim("Learn more:")}
|
|
66954
66354
|
${highlighter.info(CANONICAL_GITHUB_URL)}
|
|
66955
66355
|
`;
|
|
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
66356
|
const renderCiHelpEpilog = () => `
|
|
66971
66357
|
${highlighter.dim("Examples:")}
|
|
66972
66358
|
${formatExampleLines([
|
|
@@ -66988,7 +66374,6 @@ ${highlighter.dim("Learn more:")}
|
|
|
66988
66374
|
const collectCategoryOption = (value, previousValues) => [...previousValues ?? [], value];
|
|
66989
66375
|
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
66376
|
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
66377
|
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
66378
|
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
66379
|
const providerOption = ["--provider <name>", "ci provider: github-actions or gitlab-ci (auto-detected by default)"];
|
|
@@ -67037,4 +66422,4 @@ Promise.resolve().then(() => assertNoRemovedFlags(process.argv)).then(() => prog
|
|
|
67037
66422
|
export {};
|
|
67038
66423
|
|
|
67039
66424
|
//# sourceMappingURL=cli.js.map
|
|
67040
|
-
//# debugId=
|
|
66425
|
+
//# debugId=83a484ab-e975-5390-830a-f2f723c71935
|