react-doctor 0.8.1-dev.284b4e4 → 0.8.1-dev.3598138
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 +142 -666
- package/dist/index.d.ts +0 -41
- package/dist/index.js +98 -575
- package/dist/lsp.js +98 -575
- 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]="cc020c29-7bf9-5ff5-867d-058ebf813fa9")}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__\//;
|
|
@@ -36214,44 +36252,6 @@ const SUPPLY_CHAIN_OVERLAP_TIMEOUT_MS = 9e4;
|
|
|
36214
36252
|
const SUPPLY_CHAIN_CACHE_TTL_MS = 864e5;
|
|
36215
36253
|
const SUPPLY_CHAIN_CACHE_SUBDIR = "supply-chain";
|
|
36216
36254
|
const SUPPLY_CHAIN_IGNORED_PACKAGES = new Set(["next"]);
|
|
36217
|
-
const isErrnoException = (error) => error instanceof Error && "code" in error;
|
|
36218
|
-
const IGNORABLE_READDIR_ERROR_CODES = new Set([
|
|
36219
|
-
"EACCES",
|
|
36220
|
-
"EPERM",
|
|
36221
|
-
"ENOENT",
|
|
36222
|
-
"ENOTDIR",
|
|
36223
|
-
"EINVAL",
|
|
36224
|
-
"ELOOP",
|
|
36225
|
-
"ENAMETOOLONG"
|
|
36226
|
-
]);
|
|
36227
|
-
const isIgnorableReaddirError = (error) => isErrnoException(error) && typeof error.code === "string" && IGNORABLE_READDIR_ERROR_CODES.has(error.code);
|
|
36228
|
-
const readDirectoryEntries = (directoryPath) => {
|
|
36229
|
-
try {
|
|
36230
|
-
return NFS.readdirSync(directoryPath, { withFileTypes: true });
|
|
36231
|
-
} catch (error) {
|
|
36232
|
-
if (isIgnorableReaddirError(error)) return [];
|
|
36233
|
-
throw error;
|
|
36234
|
-
}
|
|
36235
|
-
};
|
|
36236
|
-
const isFile = (filePath) => {
|
|
36237
|
-
try {
|
|
36238
|
-
return NFS.statSync(filePath).isFile();
|
|
36239
|
-
} catch {
|
|
36240
|
-
return false;
|
|
36241
|
-
}
|
|
36242
|
-
};
|
|
36243
|
-
const isDirectory = (directoryPath) => {
|
|
36244
|
-
try {
|
|
36245
|
-
return NFS.statSync(directoryPath).isDirectory();
|
|
36246
|
-
} catch {
|
|
36247
|
-
return false;
|
|
36248
|
-
}
|
|
36249
|
-
};
|
|
36250
|
-
const isPlainObject = (value) => {
|
|
36251
|
-
if (typeof value !== "object" || value === null || Array.isArray(value)) return false;
|
|
36252
|
-
const prototype = Object.getPrototypeOf(value);
|
|
36253
|
-
return prototype === null || prototype === Object.prototype;
|
|
36254
|
-
};
|
|
36255
36255
|
const lastSourceMappingUrl = (fileContent) => {
|
|
36256
36256
|
const lastReference = [...fileContent.matchAll(/\/\/# sourceMappingURL=(\S+)/g)].at(-1);
|
|
36257
36257
|
return lastReference ? lastReference[1] : null;
|
|
@@ -36571,10 +36571,10 @@ const FALLBACK_TSCONFIG_FILENAMES = ["tsconfig.app.json", "tsconfig.build.json"]
|
|
|
36571
36571
|
const FRAMEWORK_PACKAGES = {
|
|
36572
36572
|
next: "nextjs",
|
|
36573
36573
|
"@tanstack/react-start": "tanstack-start",
|
|
36574
|
-
"@remix-run/react": "remix",
|
|
36575
|
-
gatsby: "gatsby",
|
|
36576
36574
|
vite: "vite",
|
|
36577
36575
|
"react-scripts": "cra",
|
|
36576
|
+
"@remix-run/react": "remix",
|
|
36577
|
+
gatsby: "gatsby",
|
|
36578
36578
|
expo: "expo",
|
|
36579
36579
|
"react-native": "react-native"
|
|
36580
36580
|
};
|
|
@@ -36598,17 +36598,11 @@ const NEXT_CONFIG_FILENAMES = [
|
|
|
36598
36598
|
];
|
|
36599
36599
|
const BABEL_CONFIG_FILENAMES = [
|
|
36600
36600
|
".babelrc",
|
|
36601
|
-
".babelrc.js",
|
|
36602
36601
|
".babelrc.json",
|
|
36603
|
-
".babelrc.cjs",
|
|
36604
|
-
".babelrc.mjs",
|
|
36605
|
-
".babelrc.cts",
|
|
36606
36602
|
"babel.config.js",
|
|
36607
36603
|
"babel.config.json",
|
|
36608
36604
|
"babel.config.cjs",
|
|
36609
|
-
"babel.config.mjs"
|
|
36610
|
-
"babel.config.ts",
|
|
36611
|
-
"babel.config.cts"
|
|
36605
|
+
"babel.config.mjs"
|
|
36612
36606
|
];
|
|
36613
36607
|
const VITE_CONFIG_FILENAMES = [
|
|
36614
36608
|
"vite.config.js",
|
|
@@ -36620,28 +36614,12 @@ const VITE_CONFIG_FILENAMES = [
|
|
|
36620
36614
|
"vitest.config.ts",
|
|
36621
36615
|
"vitest.config.js"
|
|
36622
36616
|
];
|
|
36623
|
-
const RSBUILD_CONFIG_FILENAMES = [
|
|
36624
|
-
"rsbuild.config.ts",
|
|
36625
|
-
"rsbuild.config.js",
|
|
36626
|
-
"rsbuild.config.mts",
|
|
36627
|
-
"rsbuild.config.mjs",
|
|
36628
|
-
"rsbuild.config.cts",
|
|
36629
|
-
"rsbuild.config.cjs"
|
|
36630
|
-
];
|
|
36631
|
-
const RSPACK_CONFIG_FILENAMES = [
|
|
36632
|
-
"rspack.config.ts",
|
|
36633
|
-
"rspack.config.js",
|
|
36634
|
-
"rspack.config.mts",
|
|
36635
|
-
"rspack.config.mjs",
|
|
36636
|
-
"rspack.config.cts",
|
|
36637
|
-
"rspack.config.cjs"
|
|
36638
|
-
];
|
|
36639
36617
|
const EXPO_APP_CONFIG_FILENAMES = [
|
|
36640
36618
|
"app.json",
|
|
36641
36619
|
"app.config.js",
|
|
36642
36620
|
"app.config.ts"
|
|
36643
36621
|
];
|
|
36644
|
-
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["']/;
|
|
36645
36623
|
const REACT_COMPILER_ENABLED_FLAG_PATTERN = /["']?reactCompiler["']?\s*:\s*(?:true\b|\{)/;
|
|
36646
36624
|
const STATIC_EXPORT_OUTPUT_PATTERN = /(?:^|[^.\w])["']?output["']?\s*:\s*["']export["']/m;
|
|
36647
36625
|
const hasCompilerPackage = (packageJson, compilerPackages) => {
|
|
@@ -36676,8 +36654,6 @@ const detectReactCompiler = (directory, packageJson) => {
|
|
|
36676
36654
|
if (hasCompilerInConfigFiles(directory, NEXT_CONFIG_FILENAMES)) return true;
|
|
36677
36655
|
if (hasCompilerInConfigFiles(directory, BABEL_CONFIG_FILENAMES)) return true;
|
|
36678
36656
|
if (hasCompilerInConfigFiles(directory, VITE_CONFIG_FILENAMES)) return true;
|
|
36679
|
-
if (hasCompilerInConfigFiles(directory, RSBUILD_CONFIG_FILENAMES)) return true;
|
|
36680
|
-
if (hasCompilerInConfigFiles(directory, RSPACK_CONFIG_FILENAMES)) return true;
|
|
36681
36657
|
if (hasCompilerInConfigFiles(directory, EXPO_APP_CONFIG_FILENAMES)) return true;
|
|
36682
36658
|
return hasCompilerPackageInAncestors(directory, REACT_COMPILER_TRANSFORM_PACKAGES);
|
|
36683
36659
|
};
|
|
@@ -36686,7 +36662,7 @@ const detectNextjsStaticExport = (directory) => NEXT_CONFIG_FILENAMES.some((file
|
|
|
36686
36662
|
const filePath = Path.join(directory, filename);
|
|
36687
36663
|
return isFile(filePath) && STATIC_EXPORT_OUTPUT_PATTERN.test(NFS.readFileSync(filePath, "utf-8"));
|
|
36688
36664
|
});
|
|
36689
|
-
const UNRESOLVABLE_PROTOCOL_VERSION = /^(?:
|
|
36665
|
+
const UNRESOLVABLE_PROTOCOL_VERSION = /^(?:file|git|github|https?|link|patch|portal|workspace|npm):/i;
|
|
36690
36666
|
const DIST_TAG_VERSION = /^[a-z][a-z0-9._-]*$/i;
|
|
36691
36667
|
const WILDCARD_VERSION = /^[*xX](?:\.[*xX])*$/;
|
|
36692
36668
|
const NPM_ALIAS_VERSION = /^npm:(?:@[^/]+\/[^@]+|[^@]+)@(.+)$/i;
|
|
@@ -36819,16 +36795,6 @@ const getLowestDependencyMajor = (version) => {
|
|
|
36819
36795
|
}
|
|
36820
36796
|
return lowestMajor;
|
|
36821
36797
|
};
|
|
36822
|
-
const getDependencyMajorWithinSupportedRange = (version, latestSupportedMajor) => {
|
|
36823
|
-
const normalizedVersion = normalizeDependencyVersion(version);
|
|
36824
|
-
if (normalizedVersion === null) return null;
|
|
36825
|
-
const validRange = import_semver.validRange(normalizedVersion);
|
|
36826
|
-
if (validRange === null) return null;
|
|
36827
|
-
const minimumVersion = import_semver.minVersion(validRange);
|
|
36828
|
-
if (minimumVersion === null || minimumVersion.major > latestSupportedMajor) return null;
|
|
36829
|
-
if (import_semver.intersects(validRange, `>=${latestSupportedMajor + 1}.0.0`)) return null;
|
|
36830
|
-
return minimumVersion.major;
|
|
36831
|
-
};
|
|
36832
36798
|
const isConcreteDependencyVersion = (version) => {
|
|
36833
36799
|
const normalizedVersion = normalizeDependencyVersion(version);
|
|
36834
36800
|
return normalizedVersion !== null && /\d/.test(normalizedVersion);
|
|
@@ -36872,18 +36838,9 @@ const parseReactMajorMinor = (reactVersion) => {
|
|
|
36872
36838
|
};
|
|
36873
36839
|
};
|
|
36874
36840
|
const parseLowerBoundVersion = (versionSpec) => import_semver.validRange(versionSpec) !== null ? import_semver.minVersion(versionSpec) : import_semver.coerce(versionSpec);
|
|
36875
|
-
const
|
|
36876
|
-
if (typeof
|
|
36877
|
-
const
|
|
36878
|
-
if (normalizedVersion === null) return null;
|
|
36879
|
-
const lowerBound = parseLowerBoundVersion(normalizedVersion);
|
|
36880
|
-
if (lowerBound === null) return null;
|
|
36881
|
-
if (lowerBound.major > 0) return Number.MAX_SAFE_INTEGER;
|
|
36882
|
-
return lowerBound.minor > 0 ? lowerBound.minor : null;
|
|
36883
|
-
};
|
|
36884
|
-
const parseDependencyMajorMinor = (dependencyVersion) => {
|
|
36885
|
-
if (typeof dependencyVersion !== "string") return null;
|
|
36886
|
-
const trimmed = dependencyVersion.trim();
|
|
36841
|
+
const parseTailwindMajorMinor = (tailwindVersion) => {
|
|
36842
|
+
if (typeof tailwindVersion !== "string") return null;
|
|
36843
|
+
const trimmed = tailwindVersion.trim();
|
|
36887
36844
|
if (trimmed.length === 0) return null;
|
|
36888
36845
|
const lowerBound = parseLowerBoundVersion(trimmed);
|
|
36889
36846
|
if (lowerBound === null || lowerBound.major <= 0) return null;
|
|
@@ -36892,7 +36849,6 @@ const parseDependencyMajorMinor = (dependencyVersion) => {
|
|
|
36892
36849
|
minor: lowerBound.minor
|
|
36893
36850
|
};
|
|
36894
36851
|
};
|
|
36895
|
-
const parseTailwindMajorMinor = (tailwindVersion) => parseDependencyMajorMinor(tailwindVersion);
|
|
36896
36852
|
const hasUpperBoundOnlyPeerRange = (range) => {
|
|
36897
36853
|
if (typeof range !== "string") return false;
|
|
36898
36854
|
const normalizedRange = normalizeDependencyVersion(range);
|
|
@@ -36914,7 +36870,7 @@ const resolveEffectiveReactMajor = (reactVersion, packageJson) => {
|
|
|
36914
36870
|
if (peerFloor === null) return hasUpperBoundOnlyPeerRange(peerReactRange) ? null : installedReactMajor;
|
|
36915
36871
|
return installedReactMajor !== null ? Math.min(installedReactMajor, peerFloor) : peerFloor;
|
|
36916
36872
|
};
|
|
36917
|
-
const isCatalogReference = (version) =>
|
|
36873
|
+
const isCatalogReference = (version) => version.startsWith("catalog:");
|
|
36918
36874
|
const extractCatalogName = (version) => {
|
|
36919
36875
|
if (!isCatalogReference(version)) return null;
|
|
36920
36876
|
const name = version.slice(8).trim();
|
|
@@ -37064,12 +37020,6 @@ const TAILWIND_ZOD_SECTIONS = [
|
|
|
37064
37020
|
"devDependencies",
|
|
37065
37021
|
"peerDependencies"
|
|
37066
37022
|
];
|
|
37067
|
-
const DEPENDENCY_SPEC_SECTIONS = [
|
|
37068
|
-
"dependencies",
|
|
37069
|
-
"devDependencies",
|
|
37070
|
-
"peerDependencies",
|
|
37071
|
-
"optionalDependencies"
|
|
37072
|
-
];
|
|
37073
37023
|
const EMPTY_DEPENDENCY_INFO = {
|
|
37074
37024
|
reactVersion: null,
|
|
37075
37025
|
tailwindVersion: null,
|
|
@@ -37079,7 +37029,7 @@ const EMPTY_DEPENDENCY_INFO = {
|
|
|
37079
37029
|
const pickConcreteVersion = (packageJson, packageName, sections) => {
|
|
37080
37030
|
for (const section of sections) {
|
|
37081
37031
|
const version = packageJson[section]?.[packageName];
|
|
37082
|
-
if (
|
|
37032
|
+
if (version === void 0) continue;
|
|
37083
37033
|
if (isCatalogReference(version)) return null;
|
|
37084
37034
|
if (isConcreteDependencyVersion(version)) return version;
|
|
37085
37035
|
}
|
|
@@ -37111,16 +37061,13 @@ const extractDependencyInfo = (packageJson) => {
|
|
|
37111
37061
|
};
|
|
37112
37062
|
};
|
|
37113
37063
|
const getDependencySpec = (packageJson, packageName) => {
|
|
37114
|
-
|
|
37115
|
-
|
|
37116
|
-
if (typeof spec === "string") return spec;
|
|
37117
|
-
}
|
|
37118
|
-
return null;
|
|
37064
|
+
const spec = packageJson.dependencies?.[packageName] ?? packageJson.devDependencies?.[packageName] ?? packageJson.peerDependencies?.[packageName] ?? packageJson.optionalDependencies?.[packageName];
|
|
37065
|
+
return typeof spec === "string" ? spec : null;
|
|
37119
37066
|
};
|
|
37120
37067
|
const getDependencyDeclaration = ({ packageJson, packageName, sections }) => {
|
|
37121
37068
|
for (const section of sections) {
|
|
37122
37069
|
const version = packageJson[section]?.[packageName];
|
|
37123
|
-
if (
|
|
37070
|
+
if (version === void 0) continue;
|
|
37124
37071
|
return {
|
|
37125
37072
|
catalogReference: extractCatalogName(version) ?? null,
|
|
37126
37073
|
hasDeclaration: true,
|
|
@@ -37154,15 +37101,24 @@ const getPreactVersion = (packageJson) => {
|
|
|
37154
37101
|
...packageJson.devDependencies
|
|
37155
37102
|
}.preact ?? null;
|
|
37156
37103
|
};
|
|
37157
|
-
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 }) => {
|
|
37158
37118
|
if (version === null || !isCatalogReference(version)) return version;
|
|
37159
37119
|
const catalogName = extractCatalogName(version);
|
|
37160
|
-
const
|
|
37161
|
-
if (
|
|
37162
|
-
if (sourceDirectory !== rootDirectory || sourcePackageJson !== rootPackageJson) {
|
|
37163
|
-
const resolvedRootVersion = resolveCatalogVersion(rootPackageJson, packageName, rootDirectory, catalogName);
|
|
37164
|
-
if (resolvedRootVersion) return resolvedRootVersion;
|
|
37165
|
-
}
|
|
37120
|
+
const resolvedLocalVersion = resolveCatalogVersion(rootPackageJson, packageName, rootDirectory, catalogName);
|
|
37121
|
+
if (resolvedLocalVersion) return resolvedLocalVersion;
|
|
37166
37122
|
const monorepoRoot = findMonorepoRoot(rootDirectory);
|
|
37167
37123
|
if (!monorepoRoot) return version;
|
|
37168
37124
|
const monorepoPackageJsonPath = Path.join(monorepoRoot, "package.json");
|
|
@@ -37360,79 +37316,7 @@ const listWorkspacePackages = (rootDirectory) => {
|
|
|
37360
37316
|
}
|
|
37361
37317
|
return packages;
|
|
37362
37318
|
};
|
|
37363
|
-
const PREFERRED_DEPENDENCY_SECTIONS = [
|
|
37364
|
-
"dependencies",
|
|
37365
|
-
"peerDependencies",
|
|
37366
|
-
"devDependencies"
|
|
37367
|
-
];
|
|
37368
|
-
const getPreferredDependencyVersion = ({ packageJson, packageNames }) => {
|
|
37369
|
-
for (const packageName of packageNames) {
|
|
37370
|
-
const declaration = getDependencyDeclaration({
|
|
37371
|
-
packageJson,
|
|
37372
|
-
packageName,
|
|
37373
|
-
sections: PREFERRED_DEPENDENCY_SECTIONS
|
|
37374
|
-
});
|
|
37375
|
-
if (declaration.version !== null) return declaration.version;
|
|
37376
|
-
}
|
|
37377
|
-
return null;
|
|
37378
|
-
};
|
|
37379
|
-
const TANSTACK_REACT_QUERY_PACKAGES = ["@tanstack/react-query", "react-query"];
|
|
37380
|
-
const getTanStackQueryVersion = (packageJson) => {
|
|
37381
|
-
return getPreferredDependencyVersion({
|
|
37382
|
-
packageJson,
|
|
37383
|
-
packageNames: TANSTACK_REACT_QUERY_PACKAGES
|
|
37384
|
-
});
|
|
37385
|
-
};
|
|
37386
|
-
const STYLED_COMPONENTS_PACKAGES = ["styled-components"];
|
|
37387
|
-
const getStyledComponentsVersion = (packageJson) => {
|
|
37388
|
-
return getPreferredDependencyVersion({
|
|
37389
|
-
packageJson,
|
|
37390
|
-
packageNames: STYLED_COMPONENTS_PACKAGES
|
|
37391
|
-
});
|
|
37392
|
-
};
|
|
37393
|
-
const I18N_PACKAGES = [
|
|
37394
|
-
"i18next",
|
|
37395
|
-
"react-i18next",
|
|
37396
|
-
"next-i18next",
|
|
37397
|
-
"react-intl",
|
|
37398
|
-
"next-intl",
|
|
37399
|
-
"use-intl",
|
|
37400
|
-
"@formatjs/intl",
|
|
37401
|
-
"@lingui/core",
|
|
37402
|
-
"@lingui/react",
|
|
37403
|
-
"typesafe-i18n",
|
|
37404
|
-
"@tolgee/react",
|
|
37405
|
-
"react-intl-universal"
|
|
37406
|
-
];
|
|
37407
|
-
const hasI18nDependency = (packageJson) => {
|
|
37408
|
-
const allDependencies = {
|
|
37409
|
-
...packageJson.peerDependencies,
|
|
37410
|
-
...packageJson.dependencies,
|
|
37411
|
-
...packageJson.devDependencies,
|
|
37412
|
-
...packageJson.optionalDependencies
|
|
37413
|
-
};
|
|
37414
|
-
return I18N_PACKAGES.some((packageName) => allDependencies[packageName] !== void 0);
|
|
37415
|
-
};
|
|
37416
37319
|
const REANIMATED_DEPENDENCY_NAME = "react-native-reanimated";
|
|
37417
|
-
const MOBX_REACT_PACKAGE_NAME = "mobx-react";
|
|
37418
|
-
const MOBX_REACT_LITE_PACKAGE_NAME = "mobx-react-lite";
|
|
37419
|
-
const MOBX_STATE_TREE_PACKAGE_NAME = "mobx-state-tree";
|
|
37420
|
-
const MOBX_REACT_OBSERVER_PACKAGE_NAME = "mobx-react-observer";
|
|
37421
|
-
const REACT_THREE_FIBER_DEPENDENCY_NAMES = ["@react-three/fiber", "react-three-fiber"];
|
|
37422
|
-
const REACT_THREE_FIBER_SECTIONS = [
|
|
37423
|
-
"dependencies",
|
|
37424
|
-
"peerDependencies",
|
|
37425
|
-
"optionalDependencies",
|
|
37426
|
-
"devDependencies"
|
|
37427
|
-
];
|
|
37428
|
-
const THREE_DEPENDENCY_SECTIONS = [
|
|
37429
|
-
"dependencies",
|
|
37430
|
-
"peerDependencies",
|
|
37431
|
-
"optionalDependencies",
|
|
37432
|
-
"devDependencies"
|
|
37433
|
-
];
|
|
37434
|
-
const REACT_THREE_FIBER_ECOSYSTEM_DEPENDENCY_NAMES = [...REACT_THREE_FIBER_DEPENDENCY_NAMES, "@react-three/drei"];
|
|
37435
|
-
const THREE_DEPENDENCY_NAMES = [...REACT_THREE_FIBER_ECOSYSTEM_DEPENDENCY_NAMES, "three"];
|
|
37436
37320
|
const SHOPIFY_FLASH_LIST_PACKAGE_NAME = "@shopify/flash-list";
|
|
37437
37321
|
const resolveWorkspaceDependencyVersion = ({ concreteVersion, packageName, rootDirectory, rootPackageJson, sections, workspaceDirectory, workspacePackageJson }) => {
|
|
37438
37322
|
const dependencyDeclaration = getDependencyDeclaration({
|
|
@@ -37443,7 +37327,7 @@ const resolveWorkspaceDependencyVersion = ({ concreteVersion, packageName, rootD
|
|
|
37443
37327
|
if (!dependencyDeclaration.hasDeclaration) return null;
|
|
37444
37328
|
return concreteVersion ?? resolveCatalogVersion(workspacePackageJson, packageName, workspaceDirectory, dependencyDeclaration.catalogReference) ?? resolveCatalogVersion(rootPackageJson, packageName, rootDirectory, dependencyDeclaration.catalogReference);
|
|
37445
37329
|
};
|
|
37446
|
-
const
|
|
37330
|
+
const shouldReplaceReactVersion = (currentVersion, nextVersion) => {
|
|
37447
37331
|
if (!currentVersion) return true;
|
|
37448
37332
|
const currentMajor = parseReactMajor(currentVersion);
|
|
37449
37333
|
const nextMajor = parseReactMajor(nextVersion);
|
|
@@ -37451,62 +37335,7 @@ const shouldReplaceWithLowerMajor = (currentVersion, nextVersion) => {
|
|
|
37451
37335
|
if (nextMajor === null) return false;
|
|
37452
37336
|
return nextMajor < currentMajor;
|
|
37453
37337
|
};
|
|
37454
|
-
const
|
|
37455
|
-
if (currentFact.version === null) return true;
|
|
37456
|
-
if (nextFact.version === null) return false;
|
|
37457
|
-
const currentMajor = getLowestDependencyMajor(currentFact.version);
|
|
37458
|
-
const nextMajor = getLowestDependencyMajor(nextFact.version);
|
|
37459
|
-
if (currentMajor === null) return false;
|
|
37460
|
-
if (nextMajor === null) return true;
|
|
37461
|
-
if (currentMajor > latestSupportedMajor) return false;
|
|
37462
|
-
if (nextMajor > latestSupportedMajor) return true;
|
|
37463
|
-
return nextMajor < currentMajor;
|
|
37464
|
-
};
|
|
37465
|
-
const shouldReplaceStyledComponentsVersion = (currentVersion, nextVersion) => {
|
|
37466
|
-
if (!currentVersion) return true;
|
|
37467
|
-
const currentMajor = getLowestDependencyMajor(currentVersion);
|
|
37468
|
-
const nextMajor = getLowestDependencyMajor(nextVersion);
|
|
37469
|
-
if (currentMajor === null) return nextMajor !== null && nextMajor < 6;
|
|
37470
|
-
if (nextMajor === null) return currentMajor >= 6;
|
|
37471
|
-
return nextMajor < currentMajor;
|
|
37472
|
-
};
|
|
37473
|
-
const selectOldestDependencyVersion = (currentVersion, nextVersion) => {
|
|
37474
|
-
if (currentVersion === null || nextVersion === null) return null;
|
|
37475
|
-
const current = parseDependencyMajorMinor(currentVersion);
|
|
37476
|
-
const next = parseDependencyMajorMinor(nextVersion);
|
|
37477
|
-
if (current === null) return currentVersion;
|
|
37478
|
-
if (next === null) return nextVersion;
|
|
37479
|
-
if (next.major !== current.major) return next.major < current.major ? nextVersion : currentVersion;
|
|
37480
|
-
return next.minor < current.minor ? nextVersion : currentVersion;
|
|
37481
|
-
};
|
|
37482
|
-
const shouldReplaceMobxFact = (currentFact, nextFact) => {
|
|
37483
|
-
if (currentFact.sourceDirectory === null) return true;
|
|
37484
|
-
if (currentFact.version === null) return false;
|
|
37485
|
-
if (nextFact.version === null) return true;
|
|
37486
|
-
const currentMajor = getDependencyMajorWithinSupportedRange(currentFact.version, 6);
|
|
37487
|
-
const nextMajor = getDependencyMajorWithinSupportedRange(nextFact.version, 6);
|
|
37488
|
-
if (currentMajor === null) return false;
|
|
37489
|
-
if (nextMajor === null) return true;
|
|
37490
|
-
return selectOldestDependencyVersion(currentFact.version, nextFact.version) === nextFact.version;
|
|
37491
|
-
};
|
|
37492
|
-
const collectBindingVersion = (facts, packageJson, directory, packageName) => {
|
|
37493
|
-
const version = getDependencySpec(packageJson, packageName);
|
|
37494
|
-
if (version === null) return;
|
|
37495
|
-
const resolvedVersion = resolveCatalogBackedDependencyVersion({
|
|
37496
|
-
rootDirectory: directory,
|
|
37497
|
-
rootPackageJson: packageJson,
|
|
37498
|
-
packageName,
|
|
37499
|
-
version
|
|
37500
|
-
});
|
|
37501
|
-
if (packageName === MOBX_REACT_PACKAGE_NAME) {
|
|
37502
|
-
facts.mobxReactVersion = facts.hasMobxReact ? selectOldestDependencyVersion(facts.mobxReactVersion, resolvedVersion) : resolvedVersion;
|
|
37503
|
-
facts.hasMobxReact = true;
|
|
37504
|
-
return;
|
|
37505
|
-
}
|
|
37506
|
-
facts.mobxReactLiteVersion = facts.hasMobxReactLite ? selectOldestDependencyVersion(facts.mobxReactLiteVersion, resolvedVersion) : resolvedVersion;
|
|
37507
|
-
facts.hasMobxReactLite = true;
|
|
37508
|
-
};
|
|
37509
|
-
const evaluateManifestFacts = (facts, packageJson, directory, rootDirectory, rootPackageJson) => {
|
|
37338
|
+
const evaluateManifestFacts = (facts, packageJson, directory) => {
|
|
37510
37339
|
if (facts.expo.version === null) {
|
|
37511
37340
|
const spec = getDependencySpec(packageJson, "expo");
|
|
37512
37341
|
if (spec !== null) facts.expo = {
|
|
@@ -37528,113 +37357,13 @@ const evaluateManifestFacts = (facts, packageJson, directory, rootDirectory, roo
|
|
|
37528
37357
|
sourceDirectory: directory
|
|
37529
37358
|
};
|
|
37530
37359
|
}
|
|
37531
|
-
const mobxSpec = getDependencySpec(packageJson, "mobx");
|
|
37532
|
-
if (mobxSpec !== null) {
|
|
37533
|
-
const nextMobxFact = {
|
|
37534
|
-
version: resolveCatalogBackedDependencyVersion({
|
|
37535
|
-
rootDirectory: directory,
|
|
37536
|
-
rootPackageJson: packageJson,
|
|
37537
|
-
packageName: "mobx",
|
|
37538
|
-
version: mobxSpec
|
|
37539
|
-
}),
|
|
37540
|
-
sourceDirectory: directory
|
|
37541
|
-
};
|
|
37542
|
-
if (shouldReplaceMobxFact(facts.mobx, nextMobxFact)) facts.mobx = nextMobxFact;
|
|
37543
|
-
}
|
|
37544
|
-
collectBindingVersion(facts, packageJson, directory, MOBX_REACT_PACKAGE_NAME);
|
|
37545
|
-
collectBindingVersion(facts, packageJson, directory, MOBX_REACT_LITE_PACKAGE_NAME);
|
|
37546
|
-
facts.hasMobxStateTree = facts.hasMobxStateTree || getDependencySpec(packageJson, MOBX_STATE_TREE_PACKAGE_NAME) !== null;
|
|
37547
|
-
facts.hasMobxReactObserver = facts.hasMobxReactObserver || getDependencySpec(packageJson, MOBX_REACT_OBSERVER_PACKAGE_NAME) !== null;
|
|
37548
|
-
const zustandSpec = getDependencySpec(packageJson, "zustand");
|
|
37549
|
-
if (zustandSpec !== null) {
|
|
37550
|
-
const nextZustandFact = {
|
|
37551
|
-
version: resolveCatalogBackedDependencyVersion({
|
|
37552
|
-
rootDirectory: directory,
|
|
37553
|
-
rootPackageJson: packageJson,
|
|
37554
|
-
packageName: "zustand",
|
|
37555
|
-
version: zustandSpec
|
|
37556
|
-
}),
|
|
37557
|
-
sourceDirectory: directory
|
|
37558
|
-
};
|
|
37559
|
-
if (shouldReplaceSupportedDependencyFact(facts.zustand, nextZustandFact, 5)) facts.zustand = nextZustandFact;
|
|
37560
|
-
}
|
|
37561
37360
|
if (facts.reanimatedVersion === null) {
|
|
37562
37361
|
const spec = getDependencySpec(packageJson, REANIMATED_DEPENDENCY_NAME);
|
|
37563
37362
|
if (spec !== null) facts.reanimatedVersion = spec;
|
|
37564
37363
|
}
|
|
37565
|
-
if (facts.valtioVersion === null) {
|
|
37566
|
-
const spec = getDependencySpec(packageJson, "valtio");
|
|
37567
|
-
if (spec !== null) facts.valtioVersion = spec;
|
|
37568
|
-
}
|
|
37569
|
-
facts.tanstackQueryVersion ??= getTanStackQueryVersion(packageJson);
|
|
37570
|
-
const styledComponentsVersion = resolveCatalogBackedDependencyVersion({
|
|
37571
|
-
rootDirectory: directory,
|
|
37572
|
-
rootPackageJson: packageJson,
|
|
37573
|
-
packageName: "styled-components",
|
|
37574
|
-
version: getStyledComponentsVersion(packageJson)
|
|
37575
|
-
});
|
|
37576
|
-
if (styledComponentsVersion && shouldReplaceStyledComponentsVersion(facts.styledComponentsVersion, styledComponentsVersion)) facts.styledComponentsVersion = styledComponentsVersion;
|
|
37577
|
-
facts.hasI18nLibrary = facts.hasI18nLibrary || hasI18nDependency(packageJson);
|
|
37578
|
-
for (const packageName of REACT_THREE_FIBER_DEPENDENCY_NAMES) {
|
|
37579
|
-
const version = resolveCatalogBackedDependencyVersion({
|
|
37580
|
-
rootDirectory,
|
|
37581
|
-
rootPackageJson,
|
|
37582
|
-
sourceDirectory: directory,
|
|
37583
|
-
sourcePackageJson: packageJson,
|
|
37584
|
-
packageName,
|
|
37585
|
-
version: getDependencyDeclaration({
|
|
37586
|
-
packageName,
|
|
37587
|
-
packageJson,
|
|
37588
|
-
sections: REACT_THREE_FIBER_SECTIONS
|
|
37589
|
-
}).version
|
|
37590
|
-
});
|
|
37591
|
-
if (version === null) continue;
|
|
37592
|
-
if (shouldReplaceWithLowerMajor(facts.reactThreeFiber.version, version)) facts.reactThreeFiber = {
|
|
37593
|
-
packageName,
|
|
37594
|
-
version,
|
|
37595
|
-
sourceDirectory: directory
|
|
37596
|
-
};
|
|
37597
|
-
}
|
|
37598
|
-
const threeVersion = resolveCatalogBackedDependencyVersion({
|
|
37599
|
-
rootDirectory,
|
|
37600
|
-
rootPackageJson,
|
|
37601
|
-
sourceDirectory: directory,
|
|
37602
|
-
sourcePackageJson: packageJson,
|
|
37603
|
-
packageName: "three",
|
|
37604
|
-
version: getDependencyDeclaration({
|
|
37605
|
-
packageName: "three",
|
|
37606
|
-
packageJson,
|
|
37607
|
-
sections: THREE_DEPENDENCY_SECTIONS
|
|
37608
|
-
}).version
|
|
37609
|
-
});
|
|
37610
|
-
if (threeVersion !== null) {
|
|
37611
|
-
const currentRelease = parseThreeRelease(facts.threeVersion);
|
|
37612
|
-
const nextRelease = parseThreeRelease(threeVersion);
|
|
37613
|
-
if (facts.threeVersion === null || nextRelease !== null && (currentRelease === null || nextRelease < currentRelease)) facts.threeVersion = threeVersion;
|
|
37614
|
-
}
|
|
37615
37364
|
facts.hasReactNativeAwarePackage = facts.hasReactNativeAwarePackage || isPackageJsonReactNativeAware(packageJson);
|
|
37616
37365
|
facts.hasReanimatedAwarePackage = facts.hasReanimatedAwarePackage || isPackageJsonReanimatedAware(packageJson);
|
|
37617
37366
|
facts.hasSsrDependency = facts.hasSsrDependency || isPackageJsonSsrAware(packageJson);
|
|
37618
|
-
const remotionSpec = getDependencySpec(packageJson, "remotion");
|
|
37619
|
-
if (remotionSpec !== null) {
|
|
37620
|
-
facts.hasRemotionDependency = true;
|
|
37621
|
-
const resolvedRemotionVersion = resolveCatalogBackedDependencyVersion({
|
|
37622
|
-
rootDirectory,
|
|
37623
|
-
rootPackageJson,
|
|
37624
|
-
packageName: "remotion",
|
|
37625
|
-
version: remotionSpec
|
|
37626
|
-
});
|
|
37627
|
-
const remotionMajorVersion = resolvedRemotionVersion === null ? null : getLowestDependencyMajor(resolvedRemotionVersion);
|
|
37628
|
-
if (remotionMajorVersion === null) {
|
|
37629
|
-
facts.hasUnknownRemotionVersion = true;
|
|
37630
|
-
facts.remotionVersion = null;
|
|
37631
|
-
} else if (!facts.hasUnknownRemotionVersion) {
|
|
37632
|
-
const currentRemotionMajorVersion = facts.remotionVersion === null ? null : getLowestDependencyMajor(facts.remotionVersion);
|
|
37633
|
-
if (currentRemotionMajorVersion === null || remotionMajorVersion < currentRemotionMajorVersion) facts.remotionVersion = resolvedRemotionVersion;
|
|
37634
|
-
}
|
|
37635
|
-
}
|
|
37636
|
-
facts.hasThree = facts.hasThree || THREE_DEPENDENCY_NAMES.some((dependencyName) => getDependencySpec(packageJson, dependencyName) !== null);
|
|
37637
|
-
facts.hasReactThreeFiber = facts.hasReactThreeFiber || REACT_THREE_FIBER_ECOSYSTEM_DEPENDENCY_NAMES.some((dependencyName) => getDependencySpec(packageJson, dependencyName) !== null);
|
|
37638
37367
|
};
|
|
37639
37368
|
const collectWorkspaceFacts = (rootDirectory, rootPackageJson, { collectReactGroup }) => {
|
|
37640
37369
|
const facts = {
|
|
@@ -37654,41 +37383,12 @@ const collectWorkspaceFacts = (rootDirectory, rootPackageJson, { collectReactGro
|
|
|
37654
37383
|
version: null,
|
|
37655
37384
|
sourceDirectory: null
|
|
37656
37385
|
},
|
|
37657
|
-
valtioVersion: null,
|
|
37658
|
-
mobx: {
|
|
37659
|
-
version: null,
|
|
37660
|
-
sourceDirectory: null
|
|
37661
|
-
},
|
|
37662
|
-
hasMobxReact: false,
|
|
37663
|
-
mobxReactVersion: null,
|
|
37664
|
-
hasMobxReactLite: false,
|
|
37665
|
-
mobxReactLiteVersion: null,
|
|
37666
|
-
hasMobxStateTree: false,
|
|
37667
|
-
hasMobxReactObserver: false,
|
|
37668
|
-
zustand: {
|
|
37669
|
-
version: null,
|
|
37670
|
-
sourceDirectory: null
|
|
37671
|
-
},
|
|
37672
|
-
tanstackQueryVersion: null,
|
|
37673
|
-
styledComponentsVersion: null,
|
|
37674
|
-
hasI18nLibrary: false,
|
|
37675
37386
|
hasReactNativeAwarePackage: false,
|
|
37676
37387
|
hasReanimatedAwarePackage: false,
|
|
37677
37388
|
hasSsrDependency: false,
|
|
37678
|
-
hasRemotionDependency: false,
|
|
37679
|
-
hasUnknownRemotionVersion: false,
|
|
37680
|
-
remotionVersion: null,
|
|
37681
|
-
hasThree: false,
|
|
37682
|
-
threeVersion: null,
|
|
37683
|
-
hasReactThreeFiber: false,
|
|
37684
|
-
reactThreeFiber: {
|
|
37685
|
-
packageName: null,
|
|
37686
|
-
version: null,
|
|
37687
|
-
sourceDirectory: null
|
|
37688
|
-
},
|
|
37689
37389
|
reanimatedVersion: null
|
|
37690
37390
|
};
|
|
37691
|
-
evaluateManifestFacts(facts, rootPackageJson, rootDirectory
|
|
37391
|
+
evaluateManifestFacts(facts, rootPackageJson, rootDirectory);
|
|
37692
37392
|
let isReactGroupSettled = !collectReactGroup;
|
|
37693
37393
|
const visitedDirectories = /* @__PURE__ */ new Set();
|
|
37694
37394
|
for (const pattern of getWorkspacePatterns(rootDirectory, rootPackageJson)) {
|
|
@@ -37697,7 +37397,7 @@ const collectWorkspaceFacts = (rootDirectory, rootPackageJson, { collectReactGro
|
|
|
37697
37397
|
if (visitedDirectories.has(workspaceDirectory)) continue;
|
|
37698
37398
|
visitedDirectories.add(workspaceDirectory);
|
|
37699
37399
|
const workspacePackageJson = readPackageJson$1(Path.join(workspaceDirectory, "package.json"));
|
|
37700
|
-
evaluateManifestFacts(facts, workspacePackageJson, workspaceDirectory
|
|
37400
|
+
evaluateManifestFacts(facts, workspacePackageJson, workspaceDirectory);
|
|
37701
37401
|
const info = extractDependencyInfo(workspacePackageJson);
|
|
37702
37402
|
if (info.framework !== "unknown" && frameworkMergeRank(info.framework) < frameworkMergeRank(facts.framework)) facts.framework = info.framework;
|
|
37703
37403
|
if (isReactGroupSettled) continue;
|
|
@@ -37728,7 +37428,7 @@ const collectWorkspaceFacts = (rootDirectory, rootPackageJson, { collectReactGro
|
|
|
37728
37428
|
workspaceDirectory,
|
|
37729
37429
|
workspacePackageJson
|
|
37730
37430
|
});
|
|
37731
|
-
if (reactVersion &&
|
|
37431
|
+
if (reactVersion && shouldReplaceReactVersion(facts.reactVersion, reactVersion)) facts.reactVersion = reactVersion;
|
|
37732
37432
|
if (tailwindVersion && !facts.tailwindVersion) facts.tailwindVersion = tailwindVersion;
|
|
37733
37433
|
if (zodVersion && !facts.zodVersion) facts.zodVersion = zodVersion;
|
|
37734
37434
|
const settledReactMajor = parseReactMajor(facts.reactVersion);
|
|
@@ -37918,35 +37618,11 @@ const discoverProjectWithoutPackageJson = (directory) => {
|
|
|
37918
37618
|
tailwindVersion: null,
|
|
37919
37619
|
zodVersion: null,
|
|
37920
37620
|
zodMajorVersion: null,
|
|
37921
|
-
mobxVersion: null,
|
|
37922
|
-
mobxMajorVersion: null,
|
|
37923
|
-
hasMobxReact: false,
|
|
37924
|
-
mobxReactVersion: null,
|
|
37925
|
-
hasMobxReactLite: false,
|
|
37926
|
-
mobxReactLiteVersion: null,
|
|
37927
|
-
hasMobxStateTree: false,
|
|
37928
|
-
hasMobxReactObserver: false,
|
|
37929
|
-
zustandVersion: null,
|
|
37930
|
-
zustandMajorVersion: null,
|
|
37931
37621
|
framework: "unknown",
|
|
37932
37622
|
hasTypeScript: hasOwnTsConfig,
|
|
37933
37623
|
hasReactCompiler: false,
|
|
37934
37624
|
hasReactCompilerLintPlugin: false,
|
|
37935
37625
|
hasTanStackQuery: false,
|
|
37936
|
-
valtioVersion: null,
|
|
37937
|
-
valtioMajorVersion: null,
|
|
37938
|
-
hasRemotion: false,
|
|
37939
|
-
remotionVersion: null,
|
|
37940
|
-
remotionMajorVersion: null,
|
|
37941
|
-
hasI18nLibrary: false,
|
|
37942
|
-
tanstackQueryVersion: null,
|
|
37943
|
-
styledComponentsVersion: null,
|
|
37944
|
-
hasThree: false,
|
|
37945
|
-
threeVersion: null,
|
|
37946
|
-
threeRelease: null,
|
|
37947
|
-
hasReactThreeFiber: false,
|
|
37948
|
-
reactThreeFiberVersion: null,
|
|
37949
|
-
reactThreeFiberMajorVersion: null,
|
|
37950
37626
|
hasSsrDependency: false,
|
|
37951
37627
|
preactVersion: null,
|
|
37952
37628
|
preactMajorVersion: null,
|
|
@@ -38045,12 +37721,6 @@ const discoverProject = (directory) => {
|
|
|
38045
37721
|
packageName: SHOPIFY_FLASH_LIST_PACKAGE_NAME,
|
|
38046
37722
|
version: workspaceFacts.shopifyFlashList.version
|
|
38047
37723
|
}) : null;
|
|
38048
|
-
const zustandVersion = resolveCatalogBackedDependencyVersion({
|
|
38049
|
-
rootDirectory: directory,
|
|
38050
|
-
rootPackageJson: packageJson,
|
|
38051
|
-
packageName: "zustand",
|
|
38052
|
-
version: workspaceFacts.zustand.version
|
|
38053
|
-
});
|
|
38054
37724
|
const hasReanimated = hasReactNativeWorkspace && workspaceFacts.hasReanimatedAwarePackage;
|
|
38055
37725
|
const reanimatedVersion = hasReanimated ? workspaceFacts.reanimatedVersion : null;
|
|
38056
37726
|
const nextjsVersion = framework === "nextjs" ? resolveCatalogBackedDependencyVersion({
|
|
@@ -38059,33 +37729,7 @@ const discoverProject = (directory) => {
|
|
|
38059
37729
|
packageName: "next",
|
|
38060
37730
|
version: workspaceFacts.next.version
|
|
38061
37731
|
}) : null;
|
|
38062
|
-
const valtioVersion = resolveCatalogBackedDependencyVersion({
|
|
38063
|
-
rootDirectory: directory,
|
|
38064
|
-
rootPackageJson: packageJson,
|
|
38065
|
-
packageName: "valtio",
|
|
38066
|
-
version: workspaceFacts.valtioVersion
|
|
38067
|
-
});
|
|
38068
|
-
const mobxVersion = resolveCatalogBackedDependencyVersion({
|
|
38069
|
-
rootDirectory: directory,
|
|
38070
|
-
rootPackageJson: packageJson,
|
|
38071
|
-
packageName: "mobx",
|
|
38072
|
-
version: workspaceFacts.mobx.version
|
|
38073
|
-
});
|
|
38074
37732
|
const preactVersion = getPreactVersion(packageJson);
|
|
38075
|
-
const remotionVersion = workspaceFacts.remotionVersion;
|
|
38076
|
-
const tanstackQueryVersion = getTanStackQueryVersion(packageJson) ?? workspaceFacts.tanstackQueryVersion;
|
|
38077
|
-
const reactThreeFiberVersion = workspaceFacts.reactThreeFiber.packageName ? resolveCatalogBackedDependencyVersion({
|
|
38078
|
-
rootDirectory: directory,
|
|
38079
|
-
rootPackageJson: packageJson,
|
|
38080
|
-
packageName: workspaceFacts.reactThreeFiber.packageName,
|
|
38081
|
-
version: workspaceFacts.reactThreeFiber.version
|
|
38082
|
-
}) : null;
|
|
38083
|
-
const threeVersion = resolveCatalogBackedDependencyVersion({
|
|
38084
|
-
rootDirectory: directory,
|
|
38085
|
-
rootPackageJson: packageJson,
|
|
38086
|
-
packageName: "three",
|
|
38087
|
-
version: workspaceFacts.threeVersion
|
|
38088
|
-
});
|
|
38089
37733
|
const isPreES2023Target = hasTypeScript && detectPreES2023Target(directory);
|
|
38090
37734
|
const projectInfo = {
|
|
38091
37735
|
rootDirectory: directory,
|
|
@@ -38095,35 +37739,11 @@ const discoverProject = (directory) => {
|
|
|
38095
37739
|
tailwindVersion,
|
|
38096
37740
|
zodVersion,
|
|
38097
37741
|
zodMajorVersion: zodVersion === null ? null : getLowestDependencyMajor(zodVersion),
|
|
38098
|
-
mobxVersion,
|
|
38099
|
-
mobxMajorVersion: mobxVersion === null ? null : getDependencyMajorWithinSupportedRange(mobxVersion, 6),
|
|
38100
|
-
hasMobxReact: workspaceFacts.hasMobxReact,
|
|
38101
|
-
mobxReactVersion: workspaceFacts.mobxReactVersion,
|
|
38102
|
-
hasMobxReactLite: workspaceFacts.hasMobxReactLite,
|
|
38103
|
-
mobxReactLiteVersion: workspaceFacts.mobxReactLiteVersion,
|
|
38104
|
-
hasMobxStateTree: workspaceFacts.hasMobxStateTree,
|
|
38105
|
-
hasMobxReactObserver: workspaceFacts.hasMobxReactObserver,
|
|
38106
|
-
zustandVersion,
|
|
38107
|
-
zustandMajorVersion: zustandVersion === null ? null : getLowestDependencyMajor(zustandVersion),
|
|
38108
37742
|
framework,
|
|
38109
37743
|
hasTypeScript,
|
|
38110
37744
|
hasReactCompiler: detectReactCompiler(directory, packageJson),
|
|
38111
37745
|
hasReactCompilerLintPlugin: detectReactCompilerLintPlugin(directory, packageJson),
|
|
38112
|
-
hasTanStackQuery:
|
|
38113
|
-
hasI18nLibrary: workspaceFacts.hasI18nLibrary,
|
|
38114
|
-
tanstackQueryVersion,
|
|
38115
|
-
styledComponentsVersion: workspaceFacts.styledComponentsVersion,
|
|
38116
|
-
valtioVersion,
|
|
38117
|
-
valtioMajorVersion: valtioVersion === null ? null : getLowestDependencyMajor(valtioVersion),
|
|
38118
|
-
hasRemotion: workspaceFacts.hasRemotionDependency,
|
|
38119
|
-
remotionVersion,
|
|
38120
|
-
remotionMajorVersion: remotionVersion === null ? null : getLowestDependencyMajor(remotionVersion),
|
|
38121
|
-
hasThree: workspaceFacts.hasThree,
|
|
38122
|
-
threeVersion,
|
|
38123
|
-
threeRelease: parseThreeRelease(threeVersion),
|
|
38124
|
-
hasReactThreeFiber: workspaceFacts.hasReactThreeFiber,
|
|
38125
|
-
reactThreeFiberVersion,
|
|
38126
|
-
reactThreeFiberMajorVersion: reactThreeFiberVersion === null ? null : getLowestDependencyMajor(reactThreeFiberVersion),
|
|
37746
|
+
hasTanStackQuery: hasTanStackQuery(packageJson),
|
|
38127
37747
|
hasSsrDependency: workspaceFacts.hasSsrDependency,
|
|
38128
37748
|
preactVersion,
|
|
38129
37749
|
preactMajorVersion: parseReactMajor(preactVersion),
|
|
@@ -41433,10 +41053,10 @@ const SSR_FRAMEWORKS = new Set([
|
|
|
41433
41053
|
"gatsby",
|
|
41434
41054
|
"tanstack-start"
|
|
41435
41055
|
]);
|
|
41436
|
-
const
|
|
41437
|
-
if (
|
|
41438
|
-
const
|
|
41439
|
-
for (let candidate = earliest; candidate <=
|
|
41056
|
+
const addMajorLadder = (capabilities, name, major, earliest, latest) => {
|
|
41057
|
+
if (major === null) return;
|
|
41058
|
+
const cappedMajor = Math.min(major, latest);
|
|
41059
|
+
for (let candidate = earliest; candidate <= cappedMajor; candidate += 1) capabilities.add(`${name}:${candidate}`);
|
|
41440
41060
|
};
|
|
41441
41061
|
const buildCapabilities = (project) => {
|
|
41442
41062
|
const capabilities = /* @__PURE__ */ new Set();
|
|
@@ -41449,77 +41069,24 @@ const buildCapabilities = (project) => {
|
|
|
41449
41069
|
if (CLIENT_ONLY_FRAMEWORKS.has(project.framework)) capabilities.add("client-only");
|
|
41450
41070
|
if (project.isStaticExport) capabilities.add("nextjs:static-export");
|
|
41451
41071
|
if (project.nextjsMajorVersion !== null && project.nextjsMajorVersion >= 15) capabilities.add("nextjs:15");
|
|
41452
|
-
|
|
41453
|
-
addVersionCapabilityLadder(capabilities, "react", project.reactMajorVersion, 17, 30);
|
|
41072
|
+
addMajorLadder(capabilities, "react", project.reactMajorVersion, 17, 30);
|
|
41454
41073
|
if (project.reactMajorVersion !== null && project.reactMajorVersion >= 19 && isMajorMinorAtLeast(parseReactMajorMinor(project.reactVersion), {
|
|
41455
41074
|
major: 19,
|
|
41456
41075
|
minor: 2
|
|
41457
41076
|
})) capabilities.add("react:19.2");
|
|
41458
|
-
if (project.tailwindVersion !== null)
|
|
41459
|
-
|
|
41460
|
-
|
|
41461
|
-
|
|
41462
|
-
|
|
41463
|
-
minor: 4
|
|
41464
|
-
})) capabilities.add("tailwind:3.4");
|
|
41465
|
-
if (tailwindVersion !== null && isMajorMinorAtLeast(tailwindVersion, {
|
|
41466
|
-
major: 4,
|
|
41467
|
-
minor: 0
|
|
41468
|
-
})) capabilities.add("tailwind:4");
|
|
41469
|
-
}
|
|
41077
|
+
if (project.tailwindVersion !== null) capabilities.add("tailwind");
|
|
41078
|
+
if (project.tailwindVersion !== null && isMajorMinorAtLeast(parseTailwindMajorMinor(project.tailwindVersion), {
|
|
41079
|
+
major: 3,
|
|
41080
|
+
minor: 4
|
|
41081
|
+
})) capabilities.add("tailwind:3.4");
|
|
41470
41082
|
if (project.zodVersion !== null) capabilities.add("zod");
|
|
41471
41083
|
if (project.zodMajorVersion !== null && project.zodMajorVersion >= 4) capabilities.add("zod:4");
|
|
41472
|
-
if (project.mobxVersion !== void 0 && project.mobxVersion !== null || project.hasMobxReact === true || project.hasMobxReactLite === true || project.hasMobxStateTree === true || project.hasMobxReactObserver === true) capabilities.add("mobx");
|
|
41473
|
-
if (project.hasMobxReact === true) capabilities.add("mobx-react");
|
|
41474
|
-
if (project.hasMobxReactLite === true) capabilities.add("mobx-react-lite");
|
|
41475
|
-
if (project.hasMobxReact === true || project.hasMobxReactLite === true) capabilities.add("mobx-react-binding");
|
|
41476
|
-
const mobxReactVersion = parseDependencyMajorMinor(project.mobxReactVersion);
|
|
41477
|
-
const mobxReactLiteVersion = parseDependencyMajorMinor(project.mobxReactLiteVersion);
|
|
41478
|
-
const hasMobxReactObserverMemoGuard = mobxReactVersion !== null && isMajorMinorAtLeast(mobxReactVersion, {
|
|
41479
|
-
major: 7,
|
|
41480
|
-
minor: 3
|
|
41481
|
-
});
|
|
41482
|
-
const hasMobxReactLiteObserverMemoGuard = mobxReactLiteVersion !== null && isMajorMinorAtLeast(mobxReactLiteVersion, {
|
|
41483
|
-
major: 3,
|
|
41484
|
-
minor: 3
|
|
41485
|
-
});
|
|
41486
|
-
if (hasMobxReactObserverMemoGuard) capabilities.add("mobx-react-observer-memo-guard");
|
|
41487
|
-
if (hasMobxReactLiteObserverMemoGuard) capabilities.add("mobx-react-lite-observer-memo-guard");
|
|
41488
|
-
if (hasMobxReactObserverMemoGuard || hasMobxReactLiteObserverMemoGuard) capabilities.add("mobx-react-binding-observer-memo-guard");
|
|
41489
|
-
if (project.hasMobxStateTree === true) capabilities.add("mobx-state-tree");
|
|
41490
|
-
if (project.hasMobxReactObserver === true) capabilities.add("mobx-react-observer");
|
|
41491
|
-
if (project.mobxMajorVersion !== void 0 && project.mobxMajorVersion !== null && project.mobxMajorVersion >= 4 && project.mobxMajorVersion <= 6) addVersionCapabilityLadder(capabilities, "mobx", project.mobxMajorVersion, 4, 6);
|
|
41492
|
-
const mobxVersion = parseDependencyMajorMinor(project.mobxVersion);
|
|
41493
|
-
if (project.mobxMajorVersion === 6 && mobxVersion !== null && isMajorMinorAtLeast(mobxVersion, {
|
|
41494
|
-
major: 6,
|
|
41495
|
-
minor: 10
|
|
41496
|
-
})) capabilities.add("mobx:6.10");
|
|
41497
|
-
if (project.zustandVersion !== void 0 && project.zustandVersion !== null) capabilities.add("zustand");
|
|
41498
|
-
if (project.zustandMajorVersion !== void 0 && project.zustandMajorVersion !== null && project.zustandMajorVersion >= 1 && project.zustandMajorVersion <= 5) addVersionCapabilityLadder(capabilities, "zustand", project.zustandMajorVersion, 1, 5);
|
|
41499
41084
|
if (project.isPreES2023Target) capabilities.add("pre-es2023");
|
|
41500
41085
|
if (project.hasReactCompiler) capabilities.add("react-compiler");
|
|
41501
|
-
if (
|
|
41502
|
-
if (project.styledComponentsVersion) {
|
|
41503
|
-
capabilities.add("styled-components");
|
|
41504
|
-
const styledComponentsMajor = getLowestDependencyMajor(project.styledComponentsVersion);
|
|
41505
|
-
if (styledComponentsMajor !== null && styledComponentsMajor >= 6) capabilities.add("styled-components:6");
|
|
41506
|
-
}
|
|
41507
|
-
if (project.hasI18nLibrary) capabilities.add("i18n");
|
|
41508
|
-
if (project.valtioVersion !== null) capabilities.add("valtio");
|
|
41509
|
-
addVersionCapabilityLadder(capabilities, "valtio", project.valtioMajorVersion, 1, 10);
|
|
41510
|
-
if (project.hasRemotion) {
|
|
41511
|
-
capabilities.add("remotion");
|
|
41512
|
-
addVersionCapabilityLadder(capabilities, "remotion", project.remotionMajorVersion ?? null, 4, 30);
|
|
41513
|
-
}
|
|
41514
|
-
if (project.hasThree || project.hasReactThreeFiber) capabilities.add("three");
|
|
41515
|
-
addVersionCapabilityLadder(capabilities, "three", project.threeRelease ?? null, 145, 250);
|
|
41516
|
-
if (project.hasReactThreeFiber) {
|
|
41517
|
-
capabilities.add("r3f");
|
|
41518
|
-
addVersionCapabilityLadder(capabilities, "r3f", project.reactThreeFiberMajorVersion ?? null, 3, 10);
|
|
41519
|
-
}
|
|
41086
|
+
if (project.hasTanStackQuery) capabilities.add("tanstack-query");
|
|
41520
41087
|
if (project.hasTypeScript) capabilities.add("typescript");
|
|
41521
41088
|
if (project.preactVersion !== null) capabilities.add("preact");
|
|
41522
|
-
|
|
41089
|
+
addMajorLadder(capabilities, "preact", project.preactMajorVersion, 10, 20);
|
|
41523
41090
|
if (project.preactVersion !== null && project.reactVersion === null) capabilities.add("pure-preact");
|
|
41524
41091
|
return capabilities;
|
|
41525
41092
|
};
|
|
@@ -41531,7 +41098,7 @@ const getCapabilities = (project) => {
|
|
|
41531
41098
|
capabilitiesByProject.set(project, capabilities);
|
|
41532
41099
|
return capabilities;
|
|
41533
41100
|
};
|
|
41534
|
-
const shouldEnableRule = (requires, tags, capabilities, ignoredTags, disabledWhen
|
|
41101
|
+
const shouldEnableRule = (requires, tags, capabilities, ignoredTags, disabledWhen) => {
|
|
41535
41102
|
if (requires) {
|
|
41536
41103
|
for (const capability of requires) if (!capabilities.has(capability)) return false;
|
|
41537
41104
|
}
|
|
@@ -41542,29 +41109,20 @@ const shouldEnableRule = (requires, tags, capabilities, ignoredTags, disabledWhe
|
|
|
41542
41109
|
if (tags) {
|
|
41543
41110
|
for (const tag of tags) if (ignoredTags.has(tag)) return false;
|
|
41544
41111
|
}
|
|
41545
|
-
if (includedTags && includedTags.size > 0) {
|
|
41546
|
-
if (!tags?.some((tag) => includedTags.has(tag))) return false;
|
|
41547
|
-
}
|
|
41548
41112
|
return true;
|
|
41549
41113
|
};
|
|
41550
|
-
const shouldEnableRuleByDefaultStatus = (options) => options.defaultEnabled !== false || options.hasExplicitOverride === true || options.includeTagDefaults && options.hasIncludedTags;
|
|
41551
41114
|
const yieldToEventLoop = () => new Promise((resolve) => {
|
|
41552
41115
|
setImmediate(resolve);
|
|
41553
41116
|
});
|
|
41554
41117
|
const createSecurityScanSession = (rootDirectory, options) => {
|
|
41555
41118
|
const capabilities = options.project ? getCapabilities(options.project) : /* @__PURE__ */ new Set();
|
|
41556
41119
|
const ignoredTags = options.ignoredTags ?? /* @__PURE__ */ new Set();
|
|
41557
|
-
const includedTags = options.includedTags ?? /* @__PURE__ */ new Set();
|
|
41558
41120
|
const enabledScanRules = REACT_DOCTOR_RULES.flatMap((entry) => {
|
|
41559
41121
|
const rule = entry.rule;
|
|
41560
41122
|
const scan = rule.scan;
|
|
41561
41123
|
if (typeof scan !== "function") return [];
|
|
41562
|
-
if (
|
|
41563
|
-
|
|
41564
|
-
includeTagDefaults: options.includeTagDefaults === true,
|
|
41565
|
-
hasIncludedTags: includedTags.size > 0
|
|
41566
|
-
})) return [];
|
|
41567
|
-
if (!shouldEnableRule(rule.requires, rule.tags, capabilities, ignoredTags, rule.disabledWhen, includedTags)) return [];
|
|
41124
|
+
if (rule.defaultEnabled === false) return [];
|
|
41125
|
+
if (!shouldEnableRule(rule.requires, rule.tags, capabilities, ignoredTags, rule.disabledWhen)) return [];
|
|
41568
41126
|
return [{
|
|
41569
41127
|
entry,
|
|
41570
41128
|
scan,
|
|
@@ -43566,9 +43124,8 @@ const buildUserPluginRules = (userPlugin, severityControls) => {
|
|
|
43566
43124
|
}
|
|
43567
43125
|
return enabled;
|
|
43568
43126
|
};
|
|
43569
|
-
const createOxlintConfig = ({ pluginPath, project, customRulesOnly = false, extendsPaths = [], ignoredTags = /* @__PURE__ */ new Set(),
|
|
43570
|
-
const
|
|
43571
|
-
const reactHooksJsPlugin = disableReactHooksJsPlugin || ruleSelection === "sidecar" || hasIncludedTags ? null : resolveReactHooksJsPlugin(project.hasReactCompiler || project.hasReactCompilerLintPlugin === true, customRulesOnly);
|
|
43127
|
+
const createOxlintConfig = ({ pluginPath, project, customRulesOnly = false, extendsPaths = [], ignoredTags = /* @__PURE__ */ new Set(), serverAuthFunctionNames, severityControls, userPlugins = [], disableReactHooksJsPlugin = false, ruleSelection, sidecarRuleIdFilter }) => {
|
|
43128
|
+
const reactHooksJsPlugin = disableReactHooksJsPlugin || ruleSelection === "sidecar" ? null : resolveReactHooksJsPlugin(project.hasReactCompiler || project.hasReactCompilerLintPlugin === true, customRulesOnly);
|
|
43572
43129
|
const reactCompilerRules = reactHooksJsPlugin ? applyRuleSeverityControls(filterRulesToAvailable(REACT_COMPILER_RULES, "react-hooks-js", reactHooksJsPlugin.availableRuleNames), severityControls) : {};
|
|
43573
43130
|
const jsPlugins = [];
|
|
43574
43131
|
if (reactHooksJsPlugin) jsPlugins.push(reactHooksJsPlugin.entry);
|
|
@@ -43583,14 +43140,9 @@ const createOxlintConfig = ({ pluginPath, project, customRulesOnly = false, exte
|
|
|
43583
43140
|
if (rule.scan !== void 0) continue;
|
|
43584
43141
|
if (customRulesOnly && registryEntry.originallyExternal) continue;
|
|
43585
43142
|
if (rule.framework !== "global" && !rule.requires) continue;
|
|
43586
|
-
if (!shouldEnableRule(rule.requires, rule.tags, capabilities, ignoredTags, rule.disabledWhen
|
|
43143
|
+
if (!shouldEnableRule(rule.requires, rule.tags, capabilities, ignoredTags, rule.disabledWhen)) continue;
|
|
43587
43144
|
const explicitRuleOverride = resolveRuleSeverityOverride({ ruleKey: registryEntry.key }, severityControls);
|
|
43588
|
-
if (
|
|
43589
|
-
defaultEnabled: rule.defaultEnabled,
|
|
43590
|
-
includeTagDefaults,
|
|
43591
|
-
hasIncludedTags,
|
|
43592
|
-
hasExplicitOverride: explicitRuleOverride !== void 0
|
|
43593
|
-
})) continue;
|
|
43145
|
+
if (rule.defaultEnabled === false && explicitRuleOverride === void 0) continue;
|
|
43594
43146
|
const severity = resolveRuleSeverityOverride({
|
|
43595
43147
|
ruleKey: registryEntry.key,
|
|
43596
43148
|
category: rule.category
|
|
@@ -43599,7 +43151,7 @@ const createOxlintConfig = ({ pluginPath, project, customRulesOnly = false, exte
|
|
|
43599
43151
|
enabledReactDoctorRules[registryEntry.key] = severity;
|
|
43600
43152
|
}
|
|
43601
43153
|
const userPluginRules = {};
|
|
43602
|
-
if (ruleSelection !== "sidecar"
|
|
43154
|
+
if (ruleSelection !== "sidecar") for (const userPlugin of userPlugins) {
|
|
43603
43155
|
Object.assign(userPluginRules, buildUserPluginRules(userPlugin, severityControls));
|
|
43604
43156
|
jsPlugins.push(userPlugin.entry);
|
|
43605
43157
|
}
|
|
@@ -43816,19 +43368,6 @@ const createSidecarLintCache = (cacheDirectory, rulesetHash) => {
|
|
|
43816
43368
|
}
|
|
43817
43369
|
};
|
|
43818
43370
|
};
|
|
43819
|
-
const fingerprintCacheByFilePath = /* @__PURE__ */ new Map();
|
|
43820
|
-
const fingerprintFileContents = (filePath, fingerprintLength) => {
|
|
43821
|
-
const fileStats = NFS.statSync(filePath, { bigint: true });
|
|
43822
|
-
const cachedFingerprint = fingerprintCacheByFilePath.get(filePath);
|
|
43823
|
-
if (cachedFingerprint?.modifiedTimeNanoseconds === fileStats.mtimeNs && cachedFingerprint.sizeBytes === fileStats.size) return cachedFingerprint.fingerprint;
|
|
43824
|
-
const fingerprint = crypto.createHash("sha256").update(NFS.readFileSync(filePath)).digest("hex").slice(0, fingerprintLength);
|
|
43825
|
-
fingerprintCacheByFilePath.set(filePath, {
|
|
43826
|
-
fingerprint,
|
|
43827
|
-
modifiedTimeNanoseconds: fileStats.mtimeNs,
|
|
43828
|
-
sizeBytes: fileStats.size
|
|
43829
|
-
});
|
|
43830
|
-
return fingerprint;
|
|
43831
|
-
};
|
|
43832
43371
|
const bundledRequire$3 = createRequire(import.meta.url);
|
|
43833
43372
|
const childNodeVersionByBinaryPath = /* @__PURE__ */ new Map();
|
|
43834
43373
|
const resolveChildNodeVersion = (nodeBinaryPath) => {
|
|
@@ -43852,13 +43391,6 @@ const TOOLCHAIN_PACKAGE_SPECIFIERS$1 = [
|
|
|
43852
43391
|
"oxlint-plugin-react-doctor/package.json",
|
|
43853
43392
|
"eslint-plugin-react-hooks/package.json"
|
|
43854
43393
|
];
|
|
43855
|
-
const resolvePluginFingerprint = () => {
|
|
43856
|
-
try {
|
|
43857
|
-
return fingerprintFileContents(bundledRequire$3.resolve("oxlint-plugin-react-doctor"), 16);
|
|
43858
|
-
} catch {
|
|
43859
|
-
return "unresolved";
|
|
43860
|
-
}
|
|
43861
|
-
};
|
|
43862
43394
|
const resolveOxlintToolchainVersions = (nodeBinaryPath = process.execPath) => {
|
|
43863
43395
|
const versions = [`node=${resolveChildNodeVersion(nodeBinaryPath)}`];
|
|
43864
43396
|
for (const specifier of TOOLCHAIN_PACKAGE_SPECIFIERS$1) try {
|
|
@@ -43868,7 +43400,6 @@ const resolveOxlintToolchainVersions = (nodeBinaryPath = process.execPath) => {
|
|
|
43868
43400
|
} catch {
|
|
43869
43401
|
versions.push(`${specifier}=missing`);
|
|
43870
43402
|
}
|
|
43871
|
-
versions.push(`oxlint-plugin-react-doctor#fingerprint=${resolvePluginFingerprint()}`);
|
|
43872
43403
|
return versions;
|
|
43873
43404
|
};
|
|
43874
43405
|
const esmRequire = createRequire(import.meta.url);
|
|
@@ -45344,7 +44875,7 @@ const reactHooksJsPluginDropNote = (error) => {
|
|
|
45344
44875
|
* 6. always restore disable directives + clean up the temp dir
|
|
45345
44876
|
*/
|
|
45346
44877
|
const runOxlint = async (options) => {
|
|
45347
|
-
const { rootDirectory, project, includePaths, nodeBinaryPath = process.execPath, customRulesOnly = false, respectInlineDisables = true, adoptExistingLintConfig = true, ignoredTags = /* @__PURE__ */ new Set(),
|
|
44878
|
+
const { rootDirectory, project, includePaths, nodeBinaryPath = process.execPath, customRulesOnly = false, respectInlineDisables = true, adoptExistingLintConfig = true, ignoredTags = /* @__PURE__ */ new Set(), userConfig, configSourceDirectory = rootDirectory, onPartialFailure, onFileCoverage, perFileLintCacheEnabled = false, sidecarLintCacheEnabled = false, onCacheStats, onSidecarStats, spawnTimeoutMs, outputMaxBytes, lintBatchOrdering = "cost" } = options;
|
|
45348
44879
|
const serverAuthFunctionNames = Array.isArray(userConfig?.serverAuthFunctionNames) ? userConfig.serverAuthFunctionNames.filter((entry) => typeof entry === "string" && entry.length > 0) : void 0;
|
|
45349
44880
|
const severityControls = buildRuleSeverityControls(userConfig);
|
|
45350
44881
|
validateRuleRegistration();
|
|
@@ -45358,15 +44889,13 @@ const runOxlint = async (options) => {
|
|
|
45358
44889
|
}
|
|
45359
44890
|
const pluginPath = resolvePluginPath();
|
|
45360
44891
|
const extendsPaths = (adoptExistingLintConfig && !customRulesOnly ? detectUserLintConfigPaths(rootDirectory) : []).filter(canOxlintExtendConfig);
|
|
45361
|
-
const userPlugins =
|
|
44892
|
+
const userPlugins = resolveUserPlugins(userConfig?.plugins, configSourceDirectory);
|
|
45362
44893
|
const buildConfig = (overrides) => createOxlintConfig({
|
|
45363
44894
|
pluginPath,
|
|
45364
44895
|
project,
|
|
45365
44896
|
customRulesOnly,
|
|
45366
44897
|
extendsPaths: overrides.extendsPaths,
|
|
45367
44898
|
ignoredTags,
|
|
45368
|
-
includedTags,
|
|
45369
|
-
includeTagDefaults,
|
|
45370
44899
|
serverAuthFunctionNames,
|
|
45371
44900
|
severityControls,
|
|
45372
44901
|
userPlugins,
|
|
@@ -45755,8 +45284,6 @@ var Linter = class Linter extends Service()("react-doctor/Linter") {
|
|
|
45755
45284
|
respectInlineDisables: input.respectInlineDisables,
|
|
45756
45285
|
adoptExistingLintConfig: input.adoptExistingLintConfig,
|
|
45757
45286
|
ignoredTags: input.ignoredTags,
|
|
45758
|
-
includedTags: input.includedTags,
|
|
45759
|
-
includeTagDefaults: input.includeTagDefaults,
|
|
45760
45287
|
userConfig: input.userConfig ?? null,
|
|
45761
45288
|
configSourceDirectory: input.configSourceDirectory,
|
|
45762
45289
|
onPartialFailure: (reason) => {
|
|
@@ -46605,9 +46132,7 @@ const runInspect = (input, hooks = {}) => gen(function* () {
|
|
|
46605
46132
|
const securityScanFailedRef = yield* make$13(false);
|
|
46606
46133
|
const securityScanFiber = yield* forkChild(runCollect(applyPerElementPipeline(isDiffMode ? empty$4 : unwrap(tryPromise(() => checkSecurityScanCooperative(scanDirectory, {
|
|
46607
46134
|
project,
|
|
46608
|
-
ignoredTags: input.ignoredTags
|
|
46609
|
-
includedTags: input.includedTags,
|
|
46610
|
-
includeTagDefaults: input.includeTagDefaults
|
|
46135
|
+
ignoredTags: input.ignoredTags
|
|
46611
46136
|
})).pipe(map$3((diagnostics) => fromIterable$1(diagnostics)), catch_$1(() => set(securityScanFailedRef, true).pipe(as(empty$4))))))).pipe(withSpan("SecurityScan.run")));
|
|
46612
46137
|
const shouldRunSupplyChain = !isDiffMode || (input.supplyChainManifestChanged ?? false);
|
|
46613
46138
|
const supplyChainOverlapTimeout = yield* SupplyChainOverlapTimeoutMs;
|
|
@@ -46698,8 +46223,6 @@ const runInspect = (input, hooks = {}) => gen(function* () {
|
|
|
46698
46223
|
respectInlineDisables: input.respectInlineDisables,
|
|
46699
46224
|
adoptExistingLintConfig: input.adoptExistingLintConfig,
|
|
46700
46225
|
ignoredTags: input.ignoredTags,
|
|
46701
|
-
includedTags: input.includedTags,
|
|
46702
|
-
includeTagDefaults: input.includeTagDefaults,
|
|
46703
46226
|
userConfig: resolvedConfig.config ?? void 0,
|
|
46704
46227
|
configSourceDirectory: resolvedConfig.configSourceDirectory ?? void 0,
|
|
46705
46228
|
onFileProgress: (scannedFileCount, totalFileCount) => {
|
|
@@ -47844,7 +47367,7 @@ const makeNoopConsole = () => ({
|
|
|
47844
47367
|
});
|
|
47845
47368
|
//#endregion
|
|
47846
47369
|
//#region src/cli/utils/version.ts
|
|
47847
|
-
const VERSION = "0.8.1-dev.
|
|
47370
|
+
const VERSION = "0.8.1-dev.3598138";
|
|
47848
47371
|
//#endregion
|
|
47849
47372
|
//#region src/cli/utils/json-mode.ts
|
|
47850
47373
|
let context = null;
|
|
@@ -47931,11 +47454,7 @@ const getRunId = () => {
|
|
|
47931
47454
|
};
|
|
47932
47455
|
//#endregion
|
|
47933
47456
|
//#region src/cli/utils/build-run-context.ts
|
|
47934
|
-
const ROOT_SUBCOMMANDS = new Set([
|
|
47935
|
-
"design",
|
|
47936
|
-
"install",
|
|
47937
|
-
"setup"
|
|
47938
|
-
]);
|
|
47457
|
+
const ROOT_SUBCOMMANDS = new Set(["install", "setup"]);
|
|
47939
47458
|
const detectInvokedVia = () => {
|
|
47940
47459
|
const userAgent = process.env.npm_config_user_agent;
|
|
47941
47460
|
if (!userAgent) return "unknown";
|
|
@@ -48019,9 +47538,7 @@ const buildSentryProjectContext = (projectInfo) => ({
|
|
|
48019
47538
|
reactMajorVersion: projectInfo.reactMajorVersion,
|
|
48020
47539
|
hasTypeScript: projectInfo.hasTypeScript,
|
|
48021
47540
|
hasReactCompiler: projectInfo.hasReactCompiler,
|
|
48022
|
-
|
|
48023
|
-
mobxVersion: projectInfo.mobxVersion,
|
|
48024
|
-
styledComponentsVersion: projectInfo.styledComponentsVersion,
|
|
47541
|
+
hasTanStackQuery: projectInfo.hasTanStackQuery,
|
|
48025
47542
|
tailwindVersion: projectInfo.tailwindVersion,
|
|
48026
47543
|
zodVersion: projectInfo.zodVersion,
|
|
48027
47544
|
preactVersion: projectInfo.preactVersion,
|
|
@@ -48202,13 +47719,13 @@ const isDevVersion = (version) => version === "0.0.0" || version.includes("-");
|
|
|
48202
47719
|
* uploads source-map artifacts under, so stack frames symbolicate. Honors the
|
|
48203
47720
|
* standard `SENTRY_RELEASE` override.
|
|
48204
47721
|
*/
|
|
48205
|
-
const resolveSentryRelease = () => process.env.SENTRY_RELEASE || `react-doctor@0.8.1-dev.
|
|
47722
|
+
const resolveSentryRelease = () => process.env.SENTRY_RELEASE || `react-doctor@0.8.1-dev.3598138`;
|
|
48206
47723
|
/**
|
|
48207
47724
|
* Deployment environment shown in Sentry's environment filter. Defaults to
|
|
48208
47725
|
* `production` for tagged releases and `development` for dev/unbuilt versions,
|
|
48209
47726
|
* overridable via the standard `SENTRY_ENVIRONMENT` env var.
|
|
48210
47727
|
*/
|
|
48211
|
-
const resolveSentryEnvironment = () => process.env.SENTRY_ENVIRONMENT || (isDevVersion("0.8.1-dev.
|
|
47728
|
+
const resolveSentryEnvironment = () => process.env.SENTRY_ENVIRONMENT || (isDevVersion("0.8.1-dev.3598138") ? "development" : "production");
|
|
48212
47729
|
/**
|
|
48213
47730
|
* Performance-tracing sample rate in `[0, 1]`. Reads `SENTRY_TRACES_SAMPLE_RATE`
|
|
48214
47731
|
* (set to `0` to disable tracing) and falls back to
|
|
@@ -60534,8 +60051,6 @@ const buildScanResultCacheKey = (input) => {
|
|
|
60534
60051
|
warnings: input.options.warnings,
|
|
60535
60052
|
adoptExistingLintConfig: input.options.adoptExistingLintConfig,
|
|
60536
60053
|
ignoredTags: [...input.options.ignoredTags].sort(),
|
|
60537
|
-
includedTags: [...input.options.includedTags].sort(),
|
|
60538
|
-
includeTagDefaults: input.options.includeTagDefaults,
|
|
60539
60054
|
concurrency: input.options.concurrency,
|
|
60540
60055
|
lintBatchOrdering: resolveLintBatchOrdering(),
|
|
60541
60056
|
baselineRef: input.options.baseline?.ref,
|
|
@@ -61362,8 +60877,8 @@ const createDiagnosticEvidenceReader = (rootDirectory, options = {}) => {
|
|
|
61362
60877
|
//#endregion
|
|
61363
60878
|
//#region src/cli/utils/build-no-score-message.ts
|
|
61364
60879
|
const ENTERPRISE_CONTACT_HINT = `Want something custom to your company? Contact us at ${ENTERPRISE_CONTACT_URL}.`;
|
|
61365
|
-
const buildNoScoreMessage = (isScoreDisabled
|
|
61366
|
-
return `${isScoreDisabled ?
|
|
60880
|
+
const buildNoScoreMessage = (isScoreDisabled) => {
|
|
60881
|
+
return `${isScoreDisabled ? "Score disabled by --no-score." : "Score unavailable (could not reach the score API)."} ${ENTERPRISE_CONTACT_HINT}`;
|
|
61367
60882
|
};
|
|
61368
60883
|
//#endregion
|
|
61369
60884
|
//#region src/cli/utils/render-agent-guidance.ts
|
|
@@ -62488,47 +62003,40 @@ const buildChangedLineMatcher = (directory, changedLineRanges) => {
|
|
|
62488
62003
|
return diagnosticIntersectsLineRanges(diagnostic, ranges);
|
|
62489
62004
|
};
|
|
62490
62005
|
};
|
|
62491
|
-
const buildIgnoredTags = (userConfig
|
|
62006
|
+
const buildIgnoredTags = (userConfig) => {
|
|
62492
62007
|
const tags = /* @__PURE__ */ new Set();
|
|
62493
62008
|
if (userConfig?.ignore?.tags) for (const tag of userConfig.ignore.tags) tags.add(tag);
|
|
62494
|
-
for (const tag of includedTags) tags.delete(tag);
|
|
62495
62009
|
return tags;
|
|
62496
62010
|
};
|
|
62497
|
-
const mergeInspectOptions = (inputOptions, userConfig) => {
|
|
62498
|
-
|
|
62499
|
-
|
|
62500
|
-
|
|
62501
|
-
|
|
62502
|
-
|
|
62503
|
-
|
|
62504
|
-
|
|
62505
|
-
|
|
62506
|
-
|
|
62507
|
-
|
|
62508
|
-
|
|
62509
|
-
|
|
62510
|
-
|
|
62511
|
-
|
|
62512
|
-
|
|
62513
|
-
|
|
62514
|
-
|
|
62515
|
-
|
|
62516
|
-
|
|
62517
|
-
|
|
62518
|
-
|
|
62519
|
-
|
|
62520
|
-
|
|
62521
|
-
|
|
62522
|
-
|
|
62523
|
-
|
|
62524
|
-
|
|
62525
|
-
|
|
62526
|
-
maxDurationMs: inputOptions.maxDurationMs ?? null,
|
|
62527
|
-
baseline: inputOptions.baseline ?? null,
|
|
62528
|
-
changedLineRanges: inputOptions.changedLineRanges ?? null,
|
|
62529
|
-
supplyChainManifestChanged: inputOptions.supplyChainManifestChanged ?? false
|
|
62530
|
-
};
|
|
62531
|
-
};
|
|
62011
|
+
const mergeInspectOptions = (inputOptions, userConfig) => ({
|
|
62012
|
+
lint: inputOptions.lint ?? userConfig?.lint ?? true,
|
|
62013
|
+
deadCode: inputOptions.deadCode ?? userConfig?.deadCode ?? true,
|
|
62014
|
+
supplyChain: inputOptions.supplyChain ?? userConfig?.supplyChain?.enabled ?? true,
|
|
62015
|
+
verbose: inputOptions.verbose ?? userConfig?.verbose ?? false,
|
|
62016
|
+
outputDirectory: inputOptions.outputDirectory || null,
|
|
62017
|
+
scoreOnly: inputOptions.scoreOnly ?? false,
|
|
62018
|
+
noScore: inputOptions.noScore ?? userConfig?.noScore ?? false,
|
|
62019
|
+
isCi: inputOptions.isCi ?? false,
|
|
62020
|
+
isCiOrCodingAgentEnvironment: isCiOrCodingAgentEnvironment(),
|
|
62021
|
+
isNonInteractiveEnvironment: isNonInteractiveEnvironment(),
|
|
62022
|
+
silent: inputOptions.silent ?? false,
|
|
62023
|
+
includePaths: inputOptions.includePaths ?? [],
|
|
62024
|
+
customRulesOnly: userConfig?.customRulesOnly ?? false,
|
|
62025
|
+
share: userConfig?.share ?? true,
|
|
62026
|
+
respectInlineDisables: inputOptions.respectInlineDisables ?? userConfig?.respectInlineDisables ?? true,
|
|
62027
|
+
warnings: inputOptions.warnings ?? userConfig?.warnings ?? true,
|
|
62028
|
+
categoryFilters: new Set(resolveCliCategories(inputOptions.categoryFilters) ?? []),
|
|
62029
|
+
adoptExistingLintConfig: userConfig?.adoptExistingLintConfig ?? true,
|
|
62030
|
+
ignoredTags: buildIgnoredTags(userConfig),
|
|
62031
|
+
outputSurface: inputOptions.outputSurface ?? "cli",
|
|
62032
|
+
suppressRendering: inputOptions.suppressRendering ?? false,
|
|
62033
|
+
concurrentScan: inputOptions.concurrentScan ?? false,
|
|
62034
|
+
concurrency: inputOptions.concurrency,
|
|
62035
|
+
maxDurationMs: inputOptions.maxDurationMs ?? null,
|
|
62036
|
+
baseline: inputOptions.baseline ?? null,
|
|
62037
|
+
changedLineRanges: inputOptions.changedLineRanges ?? null,
|
|
62038
|
+
supplyChainManifestChanged: inputOptions.supplyChainManifestChanged ?? false
|
|
62039
|
+
});
|
|
62532
62040
|
const deriveScope = (options) => {
|
|
62533
62041
|
if (options.baseline) return "changed";
|
|
62534
62042
|
if (options.changedLineRanges !== null) return "lines";
|
|
@@ -62659,8 +62167,6 @@ const runBaselineComparison = async (params) => {
|
|
|
62659
62167
|
warnings: params.options.warnings,
|
|
62660
62168
|
adoptExistingLintConfig: params.options.adoptExistingLintConfig,
|
|
62661
62169
|
ignoredTags: params.options.ignoredTags,
|
|
62662
|
-
includedTags: params.options.includedTags,
|
|
62663
|
-
includeTagDefaults: params.options.includeTagDefaults,
|
|
62664
62170
|
nodeBinaryPath: params.resolvedNodeBinaryPath ?? void 0,
|
|
62665
62171
|
runDeadCode: false,
|
|
62666
62172
|
isCi: params.options.isCi,
|
|
@@ -62754,8 +62260,6 @@ const runInspectWithRuntime = async (directory, options, userConfig, hasConfigOv
|
|
|
62754
62260
|
warnings: options.warnings,
|
|
62755
62261
|
adoptExistingLintConfig: options.adoptExistingLintConfig,
|
|
62756
62262
|
ignoredTags: options.ignoredTags,
|
|
62757
|
-
includedTags: options.includedTags,
|
|
62758
|
-
includeTagDefaults: options.includeTagDefaults,
|
|
62759
62263
|
nodeBinaryPath: resolvedNodeBinaryPath ?? void 0,
|
|
62760
62264
|
runDeadCode: options.deadCode,
|
|
62761
62265
|
isCi: options.isCi,
|
|
@@ -62944,7 +62448,7 @@ const finalizeAndRender = (input) => gen(function* () {
|
|
|
62944
62448
|
securityScanFailed
|
|
62945
62449
|
});
|
|
62946
62450
|
const hasSkippedChecks = skippedChecks.length > 0;
|
|
62947
|
-
const noScoreMessage = buildNoScoreMessage(options.noScore
|
|
62451
|
+
const noScoreMessage = buildNoScoreMessage(options.noScore);
|
|
62948
62452
|
const buildResult = () => ({
|
|
62949
62453
|
diagnostics: [...diagnostics],
|
|
62950
62454
|
score,
|
|
@@ -65049,25 +64553,21 @@ const resolveParallelFlag = (parallel) => parallel === false ? 1 : void 0;
|
|
|
65049
64553
|
*/
|
|
65050
64554
|
const resolveCliInspectOptions = (flags, userConfig) => {
|
|
65051
64555
|
const wantsWarningGate = pickBlockingLevel(flags, userConfig) === "warning";
|
|
65052
|
-
const isDesignScan = flags.design === true;
|
|
65053
64556
|
return {
|
|
65054
64557
|
lint: flags.lint,
|
|
65055
|
-
deadCode:
|
|
65056
|
-
supplyChain:
|
|
64558
|
+
deadCode: flags.deadCode,
|
|
64559
|
+
supplyChain: flags.supplyChain,
|
|
65057
64560
|
verbose: flags.verbose,
|
|
65058
64561
|
outputDirectory: flags.outputDir,
|
|
65059
64562
|
respectInlineDisables: flags.respectInlineDisables === false ? false : void 0,
|
|
65060
64563
|
warnings: wantsWarningGate ? true : flags.warnings,
|
|
65061
64564
|
scoreOnly: flags.score === true,
|
|
65062
|
-
noScore:
|
|
64565
|
+
noScore: flags.score === false || flags.telemetry === false ? true : void 0,
|
|
65063
64566
|
isCi: isCiEnvironment(),
|
|
65064
64567
|
silent: Boolean(flags.json),
|
|
65065
64568
|
concurrency: resolveParallelFlag(flags.parallel),
|
|
65066
64569
|
maxDurationMs: resolveMaxDurationFlag(flags.maxDuration),
|
|
65067
|
-
categoryFilters: resolveCliCategories(flags.category)
|
|
65068
|
-
includedTags: isDesignScan ? new Set(["design"]) : void 0,
|
|
65069
|
-
includeTagDefaults: isDesignScan ? true : void 0,
|
|
65070
|
-
scoreDisabledMessage: isDesignScan ? "Design scans do not affect the React health score." : void 0
|
|
64570
|
+
categoryFilters: resolveCliCategories(flags.category)
|
|
65071
64571
|
};
|
|
65072
64572
|
};
|
|
65073
64573
|
//#endregion
|
|
@@ -65485,7 +64985,7 @@ const maybeMigrateLegacyConfig = async (requestedDirectory, { isQuiet, isStaged
|
|
|
65485
64985
|
if (!(!isQuiet && !isStaged && process.stdout.isTTY === true && !isCiOrCodingAgentEnvironment())) return;
|
|
65486
64986
|
await runProjectMigrations(requestedDirectory);
|
|
65487
64987
|
};
|
|
65488
|
-
const inspectAction = async (directory, flags
|
|
64988
|
+
const inspectAction = async (directory, flags) => {
|
|
65489
64989
|
const isScoreOnly = Boolean(flags.score);
|
|
65490
64990
|
const isJsonMode = Boolean(flags.json);
|
|
65491
64991
|
const isQuiet = isScoreOnly || isJsonMode;
|
|
@@ -65499,7 +64999,7 @@ const inspectAction = async (directory, flags, invocationCommand = "inspect") =>
|
|
|
65499
64999
|
});
|
|
65500
65000
|
if (flags.jsonOut) recordCount(METRIC.jsonOutUsed, 1);
|
|
65501
65001
|
}
|
|
65502
|
-
recordCount(METRIC.cliInvoked, 1, { command:
|
|
65002
|
+
recordCount(METRIC.cliInvoked, 1, { command: "inspect" });
|
|
65503
65003
|
try {
|
|
65504
65004
|
validateModeFlags(flags);
|
|
65505
65005
|
if (flags.staged) setJsonReportMode("staged");
|
|
@@ -65811,13 +65311,6 @@ const inspectAction = async (directory, flags, invocationCommand = "inspect") =>
|
|
|
65811
65311
|
}
|
|
65812
65312
|
};
|
|
65813
65313
|
//#endregion
|
|
65814
|
-
//#region src/cli/commands/design.ts
|
|
65815
|
-
const designAction = async (directory, flags) => inspectAction(directory, {
|
|
65816
|
-
...flags,
|
|
65817
|
-
design: true,
|
|
65818
|
-
lint: flags.lint ?? true
|
|
65819
|
-
}, "design");
|
|
65820
|
-
//#endregion
|
|
65821
65314
|
//#region src/cli/commands/install.ts
|
|
65822
65315
|
const installAction = async (options, command) => {
|
|
65823
65316
|
recordCount(METRIC.cliInvoked, 1, { command: "install" });
|
|
@@ -66654,7 +66147,6 @@ const INSTALL_FLAG_SPEC = {
|
|
|
66654
66147
|
shortOptionsWithRequiredValues: new Set(["-c"])
|
|
66655
66148
|
};
|
|
66656
66149
|
const COMMAND_FLAG_SPECS = new Map([
|
|
66657
|
-
["design", ROOT_FLAG_SPEC],
|
|
66658
66150
|
["install", INSTALL_FLAG_SPEC],
|
|
66659
66151
|
["setup", INSTALL_FLAG_SPEC],
|
|
66660
66152
|
["version", {
|
|
@@ -66811,7 +66303,6 @@ ${formatExampleLines([
|
|
|
66811
66303
|
["react-doctor --scope changed --base main", "scan only new issues vs. main"],
|
|
66812
66304
|
["react-doctor --project modules/a,modules/b", "score each module separately (names or paths)"],
|
|
66813
66305
|
["react-doctor --staged", "scan staged files (pre-commit hook)"],
|
|
66814
|
-
["react-doctor design", "run the focused UI design audit"],
|
|
66815
66306
|
["react-doctor --category Security", "show only one diagnostic category"],
|
|
66816
66307
|
["react-doctor --blocking warning", "fail CI on warnings too (default: error)"],
|
|
66817
66308
|
["react-doctor --json > report.json", "write a machine-readable report"],
|
|
@@ -66845,20 +66336,6 @@ ${highlighter.dim("Managing CI:")}
|
|
|
66845
66336
|
${highlighter.dim("Learn more:")}
|
|
66846
66337
|
${highlighter.info(CANONICAL_GITHUB_URL)}
|
|
66847
66338
|
`;
|
|
66848
|
-
const renderDesignHelpEpilog = () => `
|
|
66849
|
-
${highlighter.dim("Examples:")}
|
|
66850
|
-
${formatExampleLines([
|
|
66851
|
-
["react-doctor design", "audit UI design in the current project"],
|
|
66852
|
-
["react-doctor design ./apps/web", "audit one application"],
|
|
66853
|
-
["react-doctor design --verbose", "show every design finding"],
|
|
66854
|
-
["react-doctor design --json", "write a design-only JSON report"]
|
|
66855
|
-
])}
|
|
66856
|
-
|
|
66857
|
-
${highlighter.dim("Scope:")}
|
|
66858
|
-
Runs only rules tagged ${highlighter.info("design")}, including focused rules that stay opt-in during a general health scan.
|
|
66859
|
-
Dead-code, supply-chain, external lint-config, custom-plugin, and health-score passes are skipped.
|
|
66860
|
-
Standard scan flags such as ${highlighter.info("--scope")}, ${highlighter.info("--project")}, ${highlighter.info("--verbose")}, and ${highlighter.info("--json")} still work.
|
|
66861
|
-
`;
|
|
66862
66339
|
const renderCiHelpEpilog = () => `
|
|
66863
66340
|
${highlighter.dim("Examples:")}
|
|
66864
66341
|
${formatExampleLines([
|
|
@@ -66880,7 +66357,6 @@ ${highlighter.dim("Learn more:")}
|
|
|
66880
66357
|
const collectCategoryOption = (value, previousValues) => [...previousValues ?? [], value];
|
|
66881
66358
|
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);
|
|
66882
66359
|
program.action(inspectAction);
|
|
66883
|
-
program.command("design [directory]").description("Run only the focused UI design diagnostics").addHelpText("after", renderDesignHelpEpilog).action((directory, _options, command) => designAction(directory ?? ".", command.optsWithGlobals()));
|
|
66884
66360
|
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));
|
|
66885
66361
|
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);
|
|
66886
66362
|
const providerOption = ["--provider <name>", "ci provider: github-actions or gitlab-ci (auto-detected by default)"];
|
|
@@ -66929,4 +66405,4 @@ Promise.resolve().then(() => assertNoRemovedFlags(process.argv)).then(() => prog
|
|
|
66929
66405
|
export {};
|
|
66930
66406
|
|
|
66931
66407
|
//# sourceMappingURL=cli.js.map
|
|
66932
|
-
//# debugId=
|
|
66408
|
+
//# debugId=cc020c29-7bf9-5ff5-867d-058ebf813fa9
|