react-doctor 0.8.1-dev.284b4e4 → 0.8.1-dev.3018538
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +4 -14
- package/dist/cli.js +165 -587
- package/dist/index.d.ts +1 -38
- package/dist/index.js +122 -499
- package/dist/lsp.js +122 -499
- package/dist/skills/react-doctor/SKILL.md +0 -5
- package/package.json +5 -5
package/dist/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]="263a3384-e99c-5526-89f9-c7e1a6bd4e76")}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;
|
|
@@ -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,11 @@ const getPreactVersion = (packageJson) => {
|
|
|
37154
37101
|
...packageJson.devDependencies
|
|
37155
37102
|
}.preact ?? null;
|
|
37156
37103
|
};
|
|
37157
|
-
const resolveCatalogBackedDependencyVersion = ({ rootDirectory, rootPackageJson, packageName,
|
|
37104
|
+
const resolveCatalogBackedDependencyVersion = ({ rootDirectory, rootPackageJson, packageName, version }) => {
|
|
37158
37105
|
if (version === null || !isCatalogReference(version)) return version;
|
|
37159
37106
|
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
|
-
}
|
|
37107
|
+
const resolvedLocalVersion = resolveCatalogVersion(rootPackageJson, packageName, rootDirectory, catalogName);
|
|
37108
|
+
if (resolvedLocalVersion) return resolvedLocalVersion;
|
|
37166
37109
|
const monorepoRoot = findMonorepoRoot(rootDirectory);
|
|
37167
37110
|
if (!monorepoRoot) return version;
|
|
37168
37111
|
const monorepoPackageJsonPath = Path.join(monorepoRoot, "package.json");
|
|
@@ -37360,19 +37303,15 @@ const listWorkspacePackages = (rootDirectory) => {
|
|
|
37360
37303
|
}
|
|
37361
37304
|
return packages;
|
|
37362
37305
|
};
|
|
37363
|
-
const PREFERRED_DEPENDENCY_SECTIONS = [
|
|
37364
|
-
"dependencies",
|
|
37365
|
-
"peerDependencies",
|
|
37366
|
-
"devDependencies"
|
|
37367
|
-
];
|
|
37368
37306
|
const getPreferredDependencyVersion = ({ packageJson, packageNames }) => {
|
|
37307
|
+
const allDependencies = {
|
|
37308
|
+
...packageJson.devDependencies,
|
|
37309
|
+
...packageJson.peerDependencies,
|
|
37310
|
+
...packageJson.dependencies
|
|
37311
|
+
};
|
|
37369
37312
|
for (const packageName of packageNames) {
|
|
37370
|
-
const
|
|
37371
|
-
|
|
37372
|
-
packageName,
|
|
37373
|
-
sections: PREFERRED_DEPENDENCY_SECTIONS
|
|
37374
|
-
});
|
|
37375
|
-
if (declaration.version !== null) return declaration.version;
|
|
37313
|
+
const version = allDependencies[packageName];
|
|
37314
|
+
if (version !== void 0) return version;
|
|
37376
37315
|
}
|
|
37377
37316
|
return null;
|
|
37378
37317
|
};
|
|
@@ -37383,6 +37322,18 @@ const getTanStackQueryVersion = (packageJson) => {
|
|
|
37383
37322
|
packageNames: TANSTACK_REACT_QUERY_PACKAGES
|
|
37384
37323
|
});
|
|
37385
37324
|
};
|
|
37325
|
+
const MOBX_PACKAGES = [
|
|
37326
|
+
"mobx",
|
|
37327
|
+
"mobx-react",
|
|
37328
|
+
"mobx-react-lite",
|
|
37329
|
+
"mobx-state-tree"
|
|
37330
|
+
];
|
|
37331
|
+
const getMobxVersion = (packageJson) => {
|
|
37332
|
+
return getPreferredDependencyVersion({
|
|
37333
|
+
packageJson,
|
|
37334
|
+
packageNames: MOBX_PACKAGES
|
|
37335
|
+
});
|
|
37336
|
+
};
|
|
37386
37337
|
const STYLED_COMPONENTS_PACKAGES = ["styled-components"];
|
|
37387
37338
|
const getStyledComponentsVersion = (packageJson) => {
|
|
37388
37339
|
return getPreferredDependencyVersion({
|
|
@@ -37414,25 +37365,6 @@ const hasI18nDependency = (packageJson) => {
|
|
|
37414
37365
|
return I18N_PACKAGES.some((packageName) => allDependencies[packageName] !== void 0);
|
|
37415
37366
|
};
|
|
37416
37367
|
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
37368
|
const SHOPIFY_FLASH_LIST_PACKAGE_NAME = "@shopify/flash-list";
|
|
37437
37369
|
const resolveWorkspaceDependencyVersion = ({ concreteVersion, packageName, rootDirectory, rootPackageJson, sections, workspaceDirectory, workspacePackageJson }) => {
|
|
37438
37370
|
const dependencyDeclaration = getDependencyDeclaration({
|
|
@@ -37443,7 +37375,7 @@ const resolveWorkspaceDependencyVersion = ({ concreteVersion, packageName, rootD
|
|
|
37443
37375
|
if (!dependencyDeclaration.hasDeclaration) return null;
|
|
37444
37376
|
return concreteVersion ?? resolveCatalogVersion(workspacePackageJson, packageName, workspaceDirectory, dependencyDeclaration.catalogReference) ?? resolveCatalogVersion(rootPackageJson, packageName, rootDirectory, dependencyDeclaration.catalogReference);
|
|
37445
37377
|
};
|
|
37446
|
-
const
|
|
37378
|
+
const shouldReplaceReactVersion = (currentVersion, nextVersion) => {
|
|
37447
37379
|
if (!currentVersion) return true;
|
|
37448
37380
|
const currentMajor = parseReactMajor(currentVersion);
|
|
37449
37381
|
const nextMajor = parseReactMajor(nextVersion);
|
|
@@ -37451,62 +37383,15 @@ const shouldReplaceWithLowerMajor = (currentVersion, nextVersion) => {
|
|
|
37451
37383
|
if (nextMajor === null) return false;
|
|
37452
37384
|
return nextMajor < currentMajor;
|
|
37453
37385
|
};
|
|
37454
|
-
const shouldReplaceSupportedDependencyFact = (currentFact, nextFact, latestSupportedMajor) => {
|
|
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
37386
|
const shouldReplaceStyledComponentsVersion = (currentVersion, nextVersion) => {
|
|
37466
37387
|
if (!currentVersion) return true;
|
|
37467
37388
|
const currentMajor = getLowestDependencyMajor(currentVersion);
|
|
37468
37389
|
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
37390
|
if (currentMajor === null) return false;
|
|
37489
37391
|
if (nextMajor === null) return true;
|
|
37490
|
-
return
|
|
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;
|
|
37392
|
+
return nextMajor < currentMajor;
|
|
37508
37393
|
};
|
|
37509
|
-
const evaluateManifestFacts = (facts, packageJson, directory
|
|
37394
|
+
const evaluateManifestFacts = (facts, packageJson, directory) => {
|
|
37510
37395
|
if (facts.expo.version === null) {
|
|
37511
37396
|
const spec = getDependencySpec(packageJson, "expo");
|
|
37512
37397
|
if (spec !== null) facts.expo = {
|
|
@@ -37528,113 +37413,18 @@ const evaluateManifestFacts = (facts, packageJson, directory, rootDirectory, roo
|
|
|
37528
37413
|
sourceDirectory: directory
|
|
37529
37414
|
};
|
|
37530
37415
|
}
|
|
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
37416
|
if (facts.reanimatedVersion === null) {
|
|
37562
37417
|
const spec = getDependencySpec(packageJson, REANIMATED_DEPENDENCY_NAME);
|
|
37563
37418
|
if (spec !== null) facts.reanimatedVersion = spec;
|
|
37564
37419
|
}
|
|
37565
|
-
if (facts.valtioVersion === null) {
|
|
37566
|
-
const spec = getDependencySpec(packageJson, "valtio");
|
|
37567
|
-
if (spec !== null) facts.valtioVersion = spec;
|
|
37568
|
-
}
|
|
37569
37420
|
facts.tanstackQueryVersion ??= getTanStackQueryVersion(packageJson);
|
|
37570
|
-
|
|
37571
|
-
|
|
37572
|
-
rootPackageJson: packageJson,
|
|
37573
|
-
packageName: "styled-components",
|
|
37574
|
-
version: getStyledComponentsVersion(packageJson)
|
|
37575
|
-
});
|
|
37421
|
+
facts.mobxVersion ??= getMobxVersion(packageJson);
|
|
37422
|
+
const styledComponentsVersion = getStyledComponentsVersion(packageJson);
|
|
37576
37423
|
if (styledComponentsVersion && shouldReplaceStyledComponentsVersion(facts.styledComponentsVersion, styledComponentsVersion)) facts.styledComponentsVersion = styledComponentsVersion;
|
|
37577
37424
|
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
37425
|
facts.hasReactNativeAwarePackage = facts.hasReactNativeAwarePackage || isPackageJsonReactNativeAware(packageJson);
|
|
37616
37426
|
facts.hasReanimatedAwarePackage = facts.hasReanimatedAwarePackage || isPackageJsonReanimatedAware(packageJson);
|
|
37617
37427
|
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
37428
|
};
|
|
37639
37429
|
const collectWorkspaceFacts = (rootDirectory, rootPackageJson, { collectReactGroup }) => {
|
|
37640
37430
|
const facts = {
|
|
@@ -37654,41 +37444,16 @@ const collectWorkspaceFacts = (rootDirectory, rootPackageJson, { collectReactGro
|
|
|
37654
37444
|
version: null,
|
|
37655
37445
|
sourceDirectory: null
|
|
37656
37446
|
},
|
|
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
37447
|
tanstackQueryVersion: null,
|
|
37448
|
+
mobxVersion: null,
|
|
37673
37449
|
styledComponentsVersion: null,
|
|
37674
37450
|
hasI18nLibrary: false,
|
|
37675
37451
|
hasReactNativeAwarePackage: false,
|
|
37676
37452
|
hasReanimatedAwarePackage: false,
|
|
37677
37453
|
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
37454
|
reanimatedVersion: null
|
|
37690
37455
|
};
|
|
37691
|
-
evaluateManifestFacts(facts, rootPackageJson, rootDirectory
|
|
37456
|
+
evaluateManifestFacts(facts, rootPackageJson, rootDirectory);
|
|
37692
37457
|
let isReactGroupSettled = !collectReactGroup;
|
|
37693
37458
|
const visitedDirectories = /* @__PURE__ */ new Set();
|
|
37694
37459
|
for (const pattern of getWorkspacePatterns(rootDirectory, rootPackageJson)) {
|
|
@@ -37697,7 +37462,7 @@ const collectWorkspaceFacts = (rootDirectory, rootPackageJson, { collectReactGro
|
|
|
37697
37462
|
if (visitedDirectories.has(workspaceDirectory)) continue;
|
|
37698
37463
|
visitedDirectories.add(workspaceDirectory);
|
|
37699
37464
|
const workspacePackageJson = readPackageJson$1(Path.join(workspaceDirectory, "package.json"));
|
|
37700
|
-
evaluateManifestFacts(facts, workspacePackageJson, workspaceDirectory
|
|
37465
|
+
evaluateManifestFacts(facts, workspacePackageJson, workspaceDirectory);
|
|
37701
37466
|
const info = extractDependencyInfo(workspacePackageJson);
|
|
37702
37467
|
if (info.framework !== "unknown" && frameworkMergeRank(info.framework) < frameworkMergeRank(facts.framework)) facts.framework = info.framework;
|
|
37703
37468
|
if (isReactGroupSettled) continue;
|
|
@@ -37728,7 +37493,7 @@ const collectWorkspaceFacts = (rootDirectory, rootPackageJson, { collectReactGro
|
|
|
37728
37493
|
workspaceDirectory,
|
|
37729
37494
|
workspacePackageJson
|
|
37730
37495
|
});
|
|
37731
|
-
if (reactVersion &&
|
|
37496
|
+
if (reactVersion && shouldReplaceReactVersion(facts.reactVersion, reactVersion)) facts.reactVersion = reactVersion;
|
|
37732
37497
|
if (tailwindVersion && !facts.tailwindVersion) facts.tailwindVersion = tailwindVersion;
|
|
37733
37498
|
if (zodVersion && !facts.zodVersion) facts.zodVersion = zodVersion;
|
|
37734
37499
|
const settledReactMajor = parseReactMajor(facts.reactVersion);
|
|
@@ -37918,35 +37683,15 @@ const discoverProjectWithoutPackageJson = (directory) => {
|
|
|
37918
37683
|
tailwindVersion: null,
|
|
37919
37684
|
zodVersion: null,
|
|
37920
37685
|
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
37686
|
framework: "unknown",
|
|
37932
37687
|
hasTypeScript: hasOwnTsConfig,
|
|
37933
37688
|
hasReactCompiler: false,
|
|
37934
37689
|
hasReactCompilerLintPlugin: false,
|
|
37935
37690
|
hasTanStackQuery: false,
|
|
37936
|
-
valtioVersion: null,
|
|
37937
|
-
valtioMajorVersion: null,
|
|
37938
|
-
hasRemotion: false,
|
|
37939
|
-
remotionVersion: null,
|
|
37940
|
-
remotionMajorVersion: null,
|
|
37941
37691
|
hasI18nLibrary: false,
|
|
37942
37692
|
tanstackQueryVersion: null,
|
|
37693
|
+
mobxVersion: null,
|
|
37943
37694
|
styledComponentsVersion: null,
|
|
37944
|
-
hasThree: false,
|
|
37945
|
-
threeVersion: null,
|
|
37946
|
-
threeRelease: null,
|
|
37947
|
-
hasReactThreeFiber: false,
|
|
37948
|
-
reactThreeFiberVersion: null,
|
|
37949
|
-
reactThreeFiberMajorVersion: null,
|
|
37950
37695
|
hasSsrDependency: false,
|
|
37951
37696
|
preactVersion: null,
|
|
37952
37697
|
preactMajorVersion: null,
|
|
@@ -38045,12 +37790,6 @@ const discoverProject = (directory) => {
|
|
|
38045
37790
|
packageName: SHOPIFY_FLASH_LIST_PACKAGE_NAME,
|
|
38046
37791
|
version: workspaceFacts.shopifyFlashList.version
|
|
38047
37792
|
}) : null;
|
|
38048
|
-
const zustandVersion = resolveCatalogBackedDependencyVersion({
|
|
38049
|
-
rootDirectory: directory,
|
|
38050
|
-
rootPackageJson: packageJson,
|
|
38051
|
-
packageName: "zustand",
|
|
38052
|
-
version: workspaceFacts.zustand.version
|
|
38053
|
-
});
|
|
38054
37793
|
const hasReanimated = hasReactNativeWorkspace && workspaceFacts.hasReanimatedAwarePackage;
|
|
38055
37794
|
const reanimatedVersion = hasReanimated ? workspaceFacts.reanimatedVersion : null;
|
|
38056
37795
|
const nextjsVersion = framework === "nextjs" ? resolveCatalogBackedDependencyVersion({
|
|
@@ -38059,33 +37798,8 @@ const discoverProject = (directory) => {
|
|
|
38059
37798
|
packageName: "next",
|
|
38060
37799
|
version: workspaceFacts.next.version
|
|
38061
37800
|
}) : 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
37801
|
const preactVersion = getPreactVersion(packageJson);
|
|
38075
|
-
const remotionVersion = workspaceFacts.remotionVersion;
|
|
38076
37802
|
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
37803
|
const isPreES2023Target = hasTypeScript && detectPreES2023Target(directory);
|
|
38090
37804
|
const projectInfo = {
|
|
38091
37805
|
rootDirectory: directory,
|
|
@@ -38095,16 +37809,6 @@ const discoverProject = (directory) => {
|
|
|
38095
37809
|
tailwindVersion,
|
|
38096
37810
|
zodVersion,
|
|
38097
37811
|
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
37812
|
framework,
|
|
38109
37813
|
hasTypeScript,
|
|
38110
37814
|
hasReactCompiler: detectReactCompiler(directory, packageJson),
|
|
@@ -38112,18 +37816,8 @@ const discoverProject = (directory) => {
|
|
|
38112
37816
|
hasTanStackQuery: tanstackQueryVersion !== null,
|
|
38113
37817
|
hasI18nLibrary: workspaceFacts.hasI18nLibrary,
|
|
38114
37818
|
tanstackQueryVersion,
|
|
37819
|
+
mobxVersion: workspaceFacts.mobxVersion,
|
|
38115
37820
|
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),
|
|
38127
37821
|
hasSsrDependency: workspaceFacts.hasSsrDependency,
|
|
38128
37822
|
preactVersion,
|
|
38129
37823
|
preactMajorVersion: parseReactMajor(preactVersion),
|
|
@@ -40678,25 +40372,9 @@ const BABEL_CONFIG_FILE_NAMES = [
|
|
|
40678
40372
|
".babelrc.json"
|
|
40679
40373
|
];
|
|
40680
40374
|
const LEGACY_PRESET_SPEC = "module:metro-react-native-babel-preset";
|
|
40681
|
-
const LEGACY_PRESET_PACKAGE = "metro-react-native-babel-preset";
|
|
40682
|
-
const REACT_NATIVE_PACKAGE = "react-native";
|
|
40683
|
-
const PRESET_RENAME_MINIMUM_REACT_NATIVE_VERSION = "0.73.0";
|
|
40684
|
-
const LEGACY_PRESET_REFERENCE = new RegExp(`['"]${LEGACY_PRESET_SPEC}['"]`);
|
|
40685
40375
|
const MODERN_PRESET_REFERENCE = new RegExp(`['"]module:@react-native/babel-preset['"]`);
|
|
40686
40376
|
const ENABLE_BABEL_RUNTIME_VERSION = /enableBabelRuntime["']?\s*:\s*['"]/;
|
|
40687
|
-
const isReactNativeVersionAtLeastPresetRename = (rootDirectory, packageJson) => {
|
|
40688
|
-
const installedReactNativeManifestPath = Path.join(rootDirectory, "node_modules", REACT_NATIVE_PACKAGE, "package.json");
|
|
40689
|
-
const reactNativeVersionSpec = (isFile(installedReactNativeManifestPath) ? readPackageJson$1(installedReactNativeManifestPath).version : void 0) ?? getDependencySpec(packageJson, REACT_NATIVE_PACKAGE);
|
|
40690
|
-
if (reactNativeVersionSpec === null || reactNativeVersionSpec === void 0) return false;
|
|
40691
|
-
const normalizedVersionRange = import_semver.validRange(reactNativeVersionSpec);
|
|
40692
|
-
if (normalizedVersionRange === null) return false;
|
|
40693
|
-
const minimumVersion = import_semver.minVersion(normalizedVersionRange);
|
|
40694
|
-
return minimumVersion !== null && import_semver.gte(minimumVersion, PRESET_RENAME_MINIMUM_REACT_NATIVE_VERSION);
|
|
40695
|
-
};
|
|
40696
|
-
const canResolveLegacyPreset = (rootDirectory, packageJson) => getDependencySpec(packageJson, LEGACY_PRESET_PACKAGE) !== null || isFile(Path.join(rootDirectory, "node_modules", LEGACY_PRESET_PACKAGE, "package.json"));
|
|
40697
40377
|
const checkReactNativeMetroBabelPreset = (rootDirectory) => {
|
|
40698
|
-
const packageJson = readPackageJson$1(Path.join(rootDirectory, "package.json"));
|
|
40699
|
-
const shouldReportLegacyPreset = isReactNativeVersionAtLeastPresetRename(rootDirectory, packageJson) && !canResolveLegacyPreset(rootDirectory, packageJson);
|
|
40700
40378
|
for (const fileName of BABEL_CONFIG_FILE_NAMES) {
|
|
40701
40379
|
const filePath = Path.join(rootDirectory, fileName);
|
|
40702
40380
|
if (!isFile(filePath)) continue;
|
|
@@ -40706,7 +40384,7 @@ const checkReactNativeMetroBabelPreset = (rootDirectory) => {
|
|
|
40706
40384
|
} catch {
|
|
40707
40385
|
continue;
|
|
40708
40386
|
}
|
|
40709
|
-
if (
|
|
40387
|
+
if (contents.includes(LEGACY_PRESET_SPEC)) return [buildReactNativeDiagnostic({
|
|
40710
40388
|
filePath: fileName,
|
|
40711
40389
|
rule: "rn-no-metro-babel-preset",
|
|
40712
40390
|
severity: "error",
|
|
@@ -40729,6 +40407,12 @@ const checkReactNativeProject = (rootDirectory, project) => {
|
|
|
40729
40407
|
return [...checkReactNativeMetroBabelPreset(rootDirectory), ...checkReactNativeLibraryDependencies(rootDirectory)];
|
|
40730
40408
|
};
|
|
40731
40409
|
const RULE_KEY = "no-vulnerable-react-server-components";
|
|
40410
|
+
const DEPENDENCY_SECTIONS = [
|
|
40411
|
+
"dependencies",
|
|
40412
|
+
"devDependencies",
|
|
40413
|
+
"peerDependencies",
|
|
40414
|
+
"optionalDependencies"
|
|
40415
|
+
];
|
|
40732
40416
|
const REACT_RSC_ADVISORIES_BY_MINOR = {
|
|
40733
40417
|
"19.0": {
|
|
40734
40418
|
rceFixedVersion: "19.0.1",
|
|
@@ -40775,13 +40459,20 @@ const enumerateWorkspaceDirectories = (workspaceRoot) => {
|
|
|
40775
40459
|
for (const pattern of patterns) for (const directory of resolveWorkspaceDirectories(workspaceRoot, pattern)) directories.add(directory);
|
|
40776
40460
|
return [...directories];
|
|
40777
40461
|
};
|
|
40462
|
+
const readDeclaredSpec = (packageJson, packageName) => {
|
|
40463
|
+
for (const section of DEPENDENCY_SECTIONS) {
|
|
40464
|
+
const spec = packageJson[section]?.[packageName];
|
|
40465
|
+
if (typeof spec === "string") return spec;
|
|
40466
|
+
}
|
|
40467
|
+
return null;
|
|
40468
|
+
};
|
|
40778
40469
|
const resolveVersionInDirectory = (directory, packageName, declaredSpecOverride) => {
|
|
40779
40470
|
const manifestPath = Path.join(directory, "node_modules", packageName, "package.json");
|
|
40780
40471
|
if (isFile(manifestPath)) {
|
|
40781
40472
|
const installedVersion = import_semver.valid(readPackageJson$1(manifestPath).version ?? null);
|
|
40782
40473
|
if (installedVersion !== null) return installedVersion;
|
|
40783
40474
|
}
|
|
40784
|
-
const candidateSpecs = [
|
|
40475
|
+
const candidateSpecs = [readDeclaredSpec(readPackageJson$1(Path.join(directory, "package.json")), packageName), declaredSpecOverride];
|
|
40785
40476
|
for (const spec of candidateSpecs) {
|
|
40786
40477
|
const pinnedVersion = spec === null ? null : import_semver.valid(spec);
|
|
40787
40478
|
if (pinnedVersion !== null) return pinnedVersion;
|
|
@@ -41433,10 +41124,10 @@ const SSR_FRAMEWORKS = new Set([
|
|
|
41433
41124
|
"gatsby",
|
|
41434
41125
|
"tanstack-start"
|
|
41435
41126
|
]);
|
|
41436
|
-
const
|
|
41437
|
-
if (
|
|
41438
|
-
const
|
|
41439
|
-
for (let candidate = earliest; candidate <=
|
|
41127
|
+
const addMajorLadder = (capabilities, name, major, earliest, latest) => {
|
|
41128
|
+
if (major === null) return;
|
|
41129
|
+
const cappedMajor = Math.min(major, latest);
|
|
41130
|
+
for (let candidate = earliest; candidate <= cappedMajor; candidate += 1) capabilities.add(`${name}:${candidate}`);
|
|
41440
41131
|
};
|
|
41441
41132
|
const buildCapabilities = (project) => {
|
|
41442
41133
|
const capabilities = /* @__PURE__ */ new Set();
|
|
@@ -41450,76 +41141,31 @@ const buildCapabilities = (project) => {
|
|
|
41450
41141
|
if (project.isStaticExport) capabilities.add("nextjs:static-export");
|
|
41451
41142
|
if (project.nextjsMajorVersion !== null && project.nextjsMajorVersion >= 15) capabilities.add("nextjs:15");
|
|
41452
41143
|
if (project.nextjsMajorVersion !== null && project.nextjsMajorVersion >= 16) capabilities.add("nextjs:16");
|
|
41453
|
-
|
|
41144
|
+
addMajorLadder(capabilities, "react", project.reactMajorVersion, 17, 30);
|
|
41454
41145
|
if (project.reactMajorVersion !== null && project.reactMajorVersion >= 19 && isMajorMinorAtLeast(parseReactMajorMinor(project.reactVersion), {
|
|
41455
41146
|
major: 19,
|
|
41456
41147
|
minor: 2
|
|
41457
41148
|
})) 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
|
-
}
|
|
41149
|
+
if (project.tailwindVersion !== null) capabilities.add("tailwind");
|
|
41150
|
+
if (project.tailwindVersion !== null && isMajorMinorAtLeast(parseTailwindMajorMinor(project.tailwindVersion), {
|
|
41151
|
+
major: 3,
|
|
41152
|
+
minor: 4
|
|
41153
|
+
})) capabilities.add("tailwind:3.4");
|
|
41470
41154
|
if (project.zodVersion !== null) capabilities.add("zod");
|
|
41471
41155
|
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
41156
|
if (project.isPreES2023Target) capabilities.add("pre-es2023");
|
|
41500
41157
|
if (project.hasReactCompiler) capabilities.add("react-compiler");
|
|
41501
41158
|
if (Boolean(project.hasTanStackQuery) || Boolean(project.tanstackQueryVersion)) capabilities.add("tanstack-query");
|
|
41159
|
+
if (project.mobxVersion) capabilities.add("mobx");
|
|
41502
41160
|
if (project.styledComponentsVersion) {
|
|
41503
41161
|
capabilities.add("styled-components");
|
|
41504
41162
|
const styledComponentsMajor = getLowestDependencyMajor(project.styledComponentsVersion);
|
|
41505
41163
|
if (styledComponentsMajor !== null && styledComponentsMajor >= 6) capabilities.add("styled-components:6");
|
|
41506
41164
|
}
|
|
41507
41165
|
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
|
-
}
|
|
41520
41166
|
if (project.hasTypeScript) capabilities.add("typescript");
|
|
41521
41167
|
if (project.preactVersion !== null) capabilities.add("preact");
|
|
41522
|
-
|
|
41168
|
+
addMajorLadder(capabilities, "preact", project.preactMajorVersion, 10, 20);
|
|
41523
41169
|
if (project.preactVersion !== null && project.reactVersion === null) capabilities.add("pure-preact");
|
|
41524
41170
|
return capabilities;
|
|
41525
41171
|
};
|
|
@@ -41531,7 +41177,7 @@ const getCapabilities = (project) => {
|
|
|
41531
41177
|
capabilitiesByProject.set(project, capabilities);
|
|
41532
41178
|
return capabilities;
|
|
41533
41179
|
};
|
|
41534
|
-
const shouldEnableRule = (requires, tags, capabilities, ignoredTags, disabledWhen
|
|
41180
|
+
const shouldEnableRule = (requires, tags, capabilities, ignoredTags, disabledWhen) => {
|
|
41535
41181
|
if (requires) {
|
|
41536
41182
|
for (const capability of requires) if (!capabilities.has(capability)) return false;
|
|
41537
41183
|
}
|
|
@@ -41542,29 +41188,20 @@ const shouldEnableRule = (requires, tags, capabilities, ignoredTags, disabledWhe
|
|
|
41542
41188
|
if (tags) {
|
|
41543
41189
|
for (const tag of tags) if (ignoredTags.has(tag)) return false;
|
|
41544
41190
|
}
|
|
41545
|
-
if (includedTags && includedTags.size > 0) {
|
|
41546
|
-
if (!tags?.some((tag) => includedTags.has(tag))) return false;
|
|
41547
|
-
}
|
|
41548
41191
|
return true;
|
|
41549
41192
|
};
|
|
41550
|
-
const shouldEnableRuleByDefaultStatus = (options) => options.defaultEnabled !== false || options.hasExplicitOverride === true || options.includeTagDefaults && options.hasIncludedTags;
|
|
41551
41193
|
const yieldToEventLoop = () => new Promise((resolve) => {
|
|
41552
41194
|
setImmediate(resolve);
|
|
41553
41195
|
});
|
|
41554
41196
|
const createSecurityScanSession = (rootDirectory, options) => {
|
|
41555
41197
|
const capabilities = options.project ? getCapabilities(options.project) : /* @__PURE__ */ new Set();
|
|
41556
41198
|
const ignoredTags = options.ignoredTags ?? /* @__PURE__ */ new Set();
|
|
41557
|
-
const includedTags = options.includedTags ?? /* @__PURE__ */ new Set();
|
|
41558
41199
|
const enabledScanRules = REACT_DOCTOR_RULES.flatMap((entry) => {
|
|
41559
41200
|
const rule = entry.rule;
|
|
41560
41201
|
const scan = rule.scan;
|
|
41561
41202
|
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 [];
|
|
41203
|
+
if (rule.defaultEnabled === false) return [];
|
|
41204
|
+
if (!shouldEnableRule(rule.requires, rule.tags, capabilities, ignoredTags, rule.disabledWhen)) return [];
|
|
41568
41205
|
return [{
|
|
41569
41206
|
entry,
|
|
41570
41207
|
scan,
|
|
@@ -43566,9 +43203,8 @@ const buildUserPluginRules = (userPlugin, severityControls) => {
|
|
|
43566
43203
|
}
|
|
43567
43204
|
return enabled;
|
|
43568
43205
|
};
|
|
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);
|
|
43206
|
+
const createOxlintConfig = ({ pluginPath, project, customRulesOnly = false, extendsPaths = [], ignoredTags = /* @__PURE__ */ new Set(), serverAuthFunctionNames, severityControls, userPlugins = [], disableReactHooksJsPlugin = false, ruleSelection, sidecarRuleIdFilter }) => {
|
|
43207
|
+
const reactHooksJsPlugin = disableReactHooksJsPlugin || ruleSelection === "sidecar" ? null : resolveReactHooksJsPlugin(project.hasReactCompiler || project.hasReactCompilerLintPlugin === true, customRulesOnly);
|
|
43572
43208
|
const reactCompilerRules = reactHooksJsPlugin ? applyRuleSeverityControls(filterRulesToAvailable(REACT_COMPILER_RULES, "react-hooks-js", reactHooksJsPlugin.availableRuleNames), severityControls) : {};
|
|
43573
43209
|
const jsPlugins = [];
|
|
43574
43210
|
if (reactHooksJsPlugin) jsPlugins.push(reactHooksJsPlugin.entry);
|
|
@@ -43583,14 +43219,9 @@ const createOxlintConfig = ({ pluginPath, project, customRulesOnly = false, exte
|
|
|
43583
43219
|
if (rule.scan !== void 0) continue;
|
|
43584
43220
|
if (customRulesOnly && registryEntry.originallyExternal) continue;
|
|
43585
43221
|
if (rule.framework !== "global" && !rule.requires) continue;
|
|
43586
|
-
if (!shouldEnableRule(rule.requires, rule.tags, capabilities, ignoredTags, rule.disabledWhen
|
|
43222
|
+
if (!shouldEnableRule(rule.requires, rule.tags, capabilities, ignoredTags, rule.disabledWhen)) continue;
|
|
43587
43223
|
const explicitRuleOverride = resolveRuleSeverityOverride({ ruleKey: registryEntry.key }, severityControls);
|
|
43588
|
-
if (
|
|
43589
|
-
defaultEnabled: rule.defaultEnabled,
|
|
43590
|
-
includeTagDefaults,
|
|
43591
|
-
hasIncludedTags,
|
|
43592
|
-
hasExplicitOverride: explicitRuleOverride !== void 0
|
|
43593
|
-
})) continue;
|
|
43224
|
+
if (rule.defaultEnabled === false && explicitRuleOverride === void 0) continue;
|
|
43594
43225
|
const severity = resolveRuleSeverityOverride({
|
|
43595
43226
|
ruleKey: registryEntry.key,
|
|
43596
43227
|
category: rule.category
|
|
@@ -43599,7 +43230,7 @@ const createOxlintConfig = ({ pluginPath, project, customRulesOnly = false, exte
|
|
|
43599
43230
|
enabledReactDoctorRules[registryEntry.key] = severity;
|
|
43600
43231
|
}
|
|
43601
43232
|
const userPluginRules = {};
|
|
43602
|
-
if (ruleSelection !== "sidecar"
|
|
43233
|
+
if (ruleSelection !== "sidecar") for (const userPlugin of userPlugins) {
|
|
43603
43234
|
Object.assign(userPluginRules, buildUserPluginRules(userPlugin, severityControls));
|
|
43604
43235
|
jsPlugins.push(userPlugin.entry);
|
|
43605
43236
|
}
|
|
@@ -45344,7 +44975,7 @@ const reactHooksJsPluginDropNote = (error) => {
|
|
|
45344
44975
|
* 6. always restore disable directives + clean up the temp dir
|
|
45345
44976
|
*/
|
|
45346
44977
|
const runOxlint = async (options) => {
|
|
45347
|
-
const { rootDirectory, project, includePaths, nodeBinaryPath = process.execPath, customRulesOnly = false, respectInlineDisables = true, adoptExistingLintConfig = true, ignoredTags = /* @__PURE__ */ new Set(),
|
|
44978
|
+
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
44979
|
const serverAuthFunctionNames = Array.isArray(userConfig?.serverAuthFunctionNames) ? userConfig.serverAuthFunctionNames.filter((entry) => typeof entry === "string" && entry.length > 0) : void 0;
|
|
45349
44980
|
const severityControls = buildRuleSeverityControls(userConfig);
|
|
45350
44981
|
validateRuleRegistration();
|
|
@@ -45358,15 +44989,13 @@ const runOxlint = async (options) => {
|
|
|
45358
44989
|
}
|
|
45359
44990
|
const pluginPath = resolvePluginPath();
|
|
45360
44991
|
const extendsPaths = (adoptExistingLintConfig && !customRulesOnly ? detectUserLintConfigPaths(rootDirectory) : []).filter(canOxlintExtendConfig);
|
|
45361
|
-
const userPlugins =
|
|
44992
|
+
const userPlugins = resolveUserPlugins(userConfig?.plugins, configSourceDirectory);
|
|
45362
44993
|
const buildConfig = (overrides) => createOxlintConfig({
|
|
45363
44994
|
pluginPath,
|
|
45364
44995
|
project,
|
|
45365
44996
|
customRulesOnly,
|
|
45366
44997
|
extendsPaths: overrides.extendsPaths,
|
|
45367
44998
|
ignoredTags,
|
|
45368
|
-
includedTags,
|
|
45369
|
-
includeTagDefaults,
|
|
45370
44999
|
serverAuthFunctionNames,
|
|
45371
45000
|
severityControls,
|
|
45372
45001
|
userPlugins,
|
|
@@ -45755,8 +45384,6 @@ var Linter = class Linter extends Service()("react-doctor/Linter") {
|
|
|
45755
45384
|
respectInlineDisables: input.respectInlineDisables,
|
|
45756
45385
|
adoptExistingLintConfig: input.adoptExistingLintConfig,
|
|
45757
45386
|
ignoredTags: input.ignoredTags,
|
|
45758
|
-
includedTags: input.includedTags,
|
|
45759
|
-
includeTagDefaults: input.includeTagDefaults,
|
|
45760
45387
|
userConfig: input.userConfig ?? null,
|
|
45761
45388
|
configSourceDirectory: input.configSourceDirectory,
|
|
45762
45389
|
onPartialFailure: (reason) => {
|
|
@@ -46605,9 +46232,7 @@ const runInspect = (input, hooks = {}) => gen(function* () {
|
|
|
46605
46232
|
const securityScanFailedRef = yield* make$13(false);
|
|
46606
46233
|
const securityScanFiber = yield* forkChild(runCollect(applyPerElementPipeline(isDiffMode ? empty$4 : unwrap(tryPromise(() => checkSecurityScanCooperative(scanDirectory, {
|
|
46607
46234
|
project,
|
|
46608
|
-
ignoredTags: input.ignoredTags
|
|
46609
|
-
includedTags: input.includedTags,
|
|
46610
|
-
includeTagDefaults: input.includeTagDefaults
|
|
46235
|
+
ignoredTags: input.ignoredTags
|
|
46611
46236
|
})).pipe(map$3((diagnostics) => fromIterable$1(diagnostics)), catch_$1(() => set(securityScanFailedRef, true).pipe(as(empty$4))))))).pipe(withSpan("SecurityScan.run")));
|
|
46612
46237
|
const shouldRunSupplyChain = !isDiffMode || (input.supplyChainManifestChanged ?? false);
|
|
46613
46238
|
const supplyChainOverlapTimeout = yield* SupplyChainOverlapTimeoutMs;
|
|
@@ -46698,8 +46323,6 @@ const runInspect = (input, hooks = {}) => gen(function* () {
|
|
|
46698
46323
|
respectInlineDisables: input.respectInlineDisables,
|
|
46699
46324
|
adoptExistingLintConfig: input.adoptExistingLintConfig,
|
|
46700
46325
|
ignoredTags: input.ignoredTags,
|
|
46701
|
-
includedTags: input.includedTags,
|
|
46702
|
-
includeTagDefaults: input.includeTagDefaults,
|
|
46703
46326
|
userConfig: resolvedConfig.config ?? void 0,
|
|
46704
46327
|
configSourceDirectory: resolvedConfig.configSourceDirectory ?? void 0,
|
|
46705
46328
|
onFileProgress: (scannedFileCount, totalFileCount) => {
|
|
@@ -47844,7 +47467,7 @@ const makeNoopConsole = () => ({
|
|
|
47844
47467
|
});
|
|
47845
47468
|
//#endregion
|
|
47846
47469
|
//#region src/cli/utils/version.ts
|
|
47847
|
-
const VERSION = "0.8.1-dev.
|
|
47470
|
+
const VERSION = "0.8.1-dev.3018538";
|
|
47848
47471
|
//#endregion
|
|
47849
47472
|
//#region src/cli/utils/json-mode.ts
|
|
47850
47473
|
let context = null;
|
|
@@ -47931,11 +47554,7 @@ const getRunId = () => {
|
|
|
47931
47554
|
};
|
|
47932
47555
|
//#endregion
|
|
47933
47556
|
//#region src/cli/utils/build-run-context.ts
|
|
47934
|
-
const ROOT_SUBCOMMANDS = new Set([
|
|
47935
|
-
"design",
|
|
47936
|
-
"install",
|
|
47937
|
-
"setup"
|
|
47938
|
-
]);
|
|
47557
|
+
const ROOT_SUBCOMMANDS = new Set(["install", "setup"]);
|
|
47939
47558
|
const detectInvokedVia = () => {
|
|
47940
47559
|
const userAgent = process.env.npm_config_user_agent;
|
|
47941
47560
|
if (!userAgent) return "unknown";
|
|
@@ -48202,13 +47821,13 @@ const isDevVersion = (version) => version === "0.0.0" || version.includes("-");
|
|
|
48202
47821
|
* uploads source-map artifacts under, so stack frames symbolicate. Honors the
|
|
48203
47822
|
* standard `SENTRY_RELEASE` override.
|
|
48204
47823
|
*/
|
|
48205
|
-
const resolveSentryRelease = () => process.env.SENTRY_RELEASE || `react-doctor@0.8.1-dev.
|
|
47824
|
+
const resolveSentryRelease = () => process.env.SENTRY_RELEASE || `react-doctor@0.8.1-dev.3018538`;
|
|
48206
47825
|
/**
|
|
48207
47826
|
* Deployment environment shown in Sentry's environment filter. Defaults to
|
|
48208
47827
|
* `production` for tagged releases and `development` for dev/unbuilt versions,
|
|
48209
47828
|
* overridable via the standard `SENTRY_ENVIRONMENT` env var.
|
|
48210
47829
|
*/
|
|
48211
|
-
const resolveSentryEnvironment = () => process.env.SENTRY_ENVIRONMENT || (isDevVersion("0.8.1-dev.
|
|
47830
|
+
const resolveSentryEnvironment = () => process.env.SENTRY_ENVIRONMENT || (isDevVersion("0.8.1-dev.3018538") ? "development" : "production");
|
|
48212
47831
|
/**
|
|
48213
47832
|
* Performance-tracing sample rate in `[0, 1]`. Reads `SENTRY_TRACES_SAMPLE_RATE`
|
|
48214
47833
|
* (set to `0` to disable tracing) and falls back to
|
|
@@ -60534,8 +60153,6 @@ const buildScanResultCacheKey = (input) => {
|
|
|
60534
60153
|
warnings: input.options.warnings,
|
|
60535
60154
|
adoptExistingLintConfig: input.options.adoptExistingLintConfig,
|
|
60536
60155
|
ignoredTags: [...input.options.ignoredTags].sort(),
|
|
60537
|
-
includedTags: [...input.options.includedTags].sort(),
|
|
60538
|
-
includeTagDefaults: input.options.includeTagDefaults,
|
|
60539
60156
|
concurrency: input.options.concurrency,
|
|
60540
60157
|
lintBatchOrdering: resolveLintBatchOrdering(),
|
|
60541
60158
|
baselineRef: input.options.baseline?.ref,
|
|
@@ -61362,8 +60979,8 @@ const createDiagnosticEvidenceReader = (rootDirectory, options = {}) => {
|
|
|
61362
60979
|
//#endregion
|
|
61363
60980
|
//#region src/cli/utils/build-no-score-message.ts
|
|
61364
60981
|
const ENTERPRISE_CONTACT_HINT = `Want something custom to your company? Contact us at ${ENTERPRISE_CONTACT_URL}.`;
|
|
61365
|
-
const buildNoScoreMessage = (isScoreDisabled
|
|
61366
|
-
return `${isScoreDisabled ?
|
|
60982
|
+
const buildNoScoreMessage = (isScoreDisabled) => {
|
|
60983
|
+
return `${isScoreDisabled ? "Score disabled by --no-score." : "Score unavailable (could not reach the score API)."} ${ENTERPRISE_CONTACT_HINT}`;
|
|
61367
60984
|
};
|
|
61368
60985
|
//#endregion
|
|
61369
60986
|
//#region src/cli/utils/render-agent-guidance.ts
|
|
@@ -62488,47 +62105,40 @@ const buildChangedLineMatcher = (directory, changedLineRanges) => {
|
|
|
62488
62105
|
return diagnosticIntersectsLineRanges(diagnostic, ranges);
|
|
62489
62106
|
};
|
|
62490
62107
|
};
|
|
62491
|
-
const buildIgnoredTags = (userConfig
|
|
62108
|
+
const buildIgnoredTags = (userConfig) => {
|
|
62492
62109
|
const tags = /* @__PURE__ */ new Set();
|
|
62493
62110
|
if (userConfig?.ignore?.tags) for (const tag of userConfig.ignore.tags) tags.add(tag);
|
|
62494
|
-
for (const tag of includedTags) tags.delete(tag);
|
|
62495
62111
|
return tags;
|
|
62496
62112
|
};
|
|
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
|
-
};
|
|
62113
|
+
const mergeInspectOptions = (inputOptions, userConfig) => ({
|
|
62114
|
+
lint: inputOptions.lint ?? userConfig?.lint ?? true,
|
|
62115
|
+
deadCode: inputOptions.deadCode ?? userConfig?.deadCode ?? true,
|
|
62116
|
+
supplyChain: inputOptions.supplyChain ?? userConfig?.supplyChain?.enabled ?? true,
|
|
62117
|
+
verbose: inputOptions.verbose ?? userConfig?.verbose ?? false,
|
|
62118
|
+
outputDirectory: inputOptions.outputDirectory || null,
|
|
62119
|
+
scoreOnly: inputOptions.scoreOnly ?? false,
|
|
62120
|
+
noScore: inputOptions.noScore ?? userConfig?.noScore ?? false,
|
|
62121
|
+
isCi: inputOptions.isCi ?? false,
|
|
62122
|
+
isCiOrCodingAgentEnvironment: isCiOrCodingAgentEnvironment(),
|
|
62123
|
+
isNonInteractiveEnvironment: isNonInteractiveEnvironment(),
|
|
62124
|
+
silent: inputOptions.silent ?? false,
|
|
62125
|
+
includePaths: inputOptions.includePaths ?? [],
|
|
62126
|
+
customRulesOnly: userConfig?.customRulesOnly ?? false,
|
|
62127
|
+
share: userConfig?.share ?? true,
|
|
62128
|
+
respectInlineDisables: inputOptions.respectInlineDisables ?? userConfig?.respectInlineDisables ?? true,
|
|
62129
|
+
warnings: inputOptions.warnings ?? userConfig?.warnings ?? true,
|
|
62130
|
+
categoryFilters: new Set(resolveCliCategories(inputOptions.categoryFilters) ?? []),
|
|
62131
|
+
adoptExistingLintConfig: userConfig?.adoptExistingLintConfig ?? true,
|
|
62132
|
+
ignoredTags: buildIgnoredTags(userConfig),
|
|
62133
|
+
outputSurface: inputOptions.outputSurface ?? "cli",
|
|
62134
|
+
suppressRendering: inputOptions.suppressRendering ?? false,
|
|
62135
|
+
concurrentScan: inputOptions.concurrentScan ?? false,
|
|
62136
|
+
concurrency: inputOptions.concurrency,
|
|
62137
|
+
maxDurationMs: inputOptions.maxDurationMs ?? null,
|
|
62138
|
+
baseline: inputOptions.baseline ?? null,
|
|
62139
|
+
changedLineRanges: inputOptions.changedLineRanges ?? null,
|
|
62140
|
+
supplyChainManifestChanged: inputOptions.supplyChainManifestChanged ?? false
|
|
62141
|
+
});
|
|
62532
62142
|
const deriveScope = (options) => {
|
|
62533
62143
|
if (options.baseline) return "changed";
|
|
62534
62144
|
if (options.changedLineRanges !== null) return "lines";
|
|
@@ -62659,8 +62269,6 @@ const runBaselineComparison = async (params) => {
|
|
|
62659
62269
|
warnings: params.options.warnings,
|
|
62660
62270
|
adoptExistingLintConfig: params.options.adoptExistingLintConfig,
|
|
62661
62271
|
ignoredTags: params.options.ignoredTags,
|
|
62662
|
-
includedTags: params.options.includedTags,
|
|
62663
|
-
includeTagDefaults: params.options.includeTagDefaults,
|
|
62664
62272
|
nodeBinaryPath: params.resolvedNodeBinaryPath ?? void 0,
|
|
62665
62273
|
runDeadCode: false,
|
|
62666
62274
|
isCi: params.options.isCi,
|
|
@@ -62754,8 +62362,6 @@ const runInspectWithRuntime = async (directory, options, userConfig, hasConfigOv
|
|
|
62754
62362
|
warnings: options.warnings,
|
|
62755
62363
|
adoptExistingLintConfig: options.adoptExistingLintConfig,
|
|
62756
62364
|
ignoredTags: options.ignoredTags,
|
|
62757
|
-
includedTags: options.includedTags,
|
|
62758
|
-
includeTagDefaults: options.includeTagDefaults,
|
|
62759
62365
|
nodeBinaryPath: resolvedNodeBinaryPath ?? void 0,
|
|
62760
62366
|
runDeadCode: options.deadCode,
|
|
62761
62367
|
isCi: options.isCi,
|
|
@@ -62944,7 +62550,7 @@ const finalizeAndRender = (input) => gen(function* () {
|
|
|
62944
62550
|
securityScanFailed
|
|
62945
62551
|
});
|
|
62946
62552
|
const hasSkippedChecks = skippedChecks.length > 0;
|
|
62947
|
-
const noScoreMessage = buildNoScoreMessage(options.noScore
|
|
62553
|
+
const noScoreMessage = buildNoScoreMessage(options.noScore);
|
|
62948
62554
|
const buildResult = () => ({
|
|
62949
62555
|
diagnostics: [...diagnostics],
|
|
62950
62556
|
score,
|
|
@@ -65049,25 +64655,21 @@ const resolveParallelFlag = (parallel) => parallel === false ? 1 : void 0;
|
|
|
65049
64655
|
*/
|
|
65050
64656
|
const resolveCliInspectOptions = (flags, userConfig) => {
|
|
65051
64657
|
const wantsWarningGate = pickBlockingLevel(flags, userConfig) === "warning";
|
|
65052
|
-
const isDesignScan = flags.design === true;
|
|
65053
64658
|
return {
|
|
65054
64659
|
lint: flags.lint,
|
|
65055
|
-
deadCode:
|
|
65056
|
-
supplyChain:
|
|
64660
|
+
deadCode: flags.deadCode,
|
|
64661
|
+
supplyChain: flags.supplyChain,
|
|
65057
64662
|
verbose: flags.verbose,
|
|
65058
64663
|
outputDirectory: flags.outputDir,
|
|
65059
64664
|
respectInlineDisables: flags.respectInlineDisables === false ? false : void 0,
|
|
65060
64665
|
warnings: wantsWarningGate ? true : flags.warnings,
|
|
65061
64666
|
scoreOnly: flags.score === true,
|
|
65062
|
-
noScore:
|
|
64667
|
+
noScore: flags.score === false || flags.telemetry === false ? true : void 0,
|
|
65063
64668
|
isCi: isCiEnvironment(),
|
|
65064
64669
|
silent: Boolean(flags.json),
|
|
65065
64670
|
concurrency: resolveParallelFlag(flags.parallel),
|
|
65066
64671
|
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
|
|
64672
|
+
categoryFilters: resolveCliCategories(flags.category)
|
|
65071
64673
|
};
|
|
65072
64674
|
};
|
|
65073
64675
|
//#endregion
|
|
@@ -65485,7 +65087,7 @@ const maybeMigrateLegacyConfig = async (requestedDirectory, { isQuiet, isStaged
|
|
|
65485
65087
|
if (!(!isQuiet && !isStaged && process.stdout.isTTY === true && !isCiOrCodingAgentEnvironment())) return;
|
|
65486
65088
|
await runProjectMigrations(requestedDirectory);
|
|
65487
65089
|
};
|
|
65488
|
-
const inspectAction = async (directory, flags
|
|
65090
|
+
const inspectAction = async (directory, flags) => {
|
|
65489
65091
|
const isScoreOnly = Boolean(flags.score);
|
|
65490
65092
|
const isJsonMode = Boolean(flags.json);
|
|
65491
65093
|
const isQuiet = isScoreOnly || isJsonMode;
|
|
@@ -65499,7 +65101,7 @@ const inspectAction = async (directory, flags, invocationCommand = "inspect") =>
|
|
|
65499
65101
|
});
|
|
65500
65102
|
if (flags.jsonOut) recordCount(METRIC.jsonOutUsed, 1);
|
|
65501
65103
|
}
|
|
65502
|
-
recordCount(METRIC.cliInvoked, 1, { command:
|
|
65104
|
+
recordCount(METRIC.cliInvoked, 1, { command: "inspect" });
|
|
65503
65105
|
try {
|
|
65504
65106
|
validateModeFlags(flags);
|
|
65505
65107
|
if (flags.staged) setJsonReportMode("staged");
|
|
@@ -65811,13 +65413,6 @@ const inspectAction = async (directory, flags, invocationCommand = "inspect") =>
|
|
|
65811
65413
|
}
|
|
65812
65414
|
};
|
|
65813
65415
|
//#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
65416
|
//#region src/cli/commands/install.ts
|
|
65822
65417
|
const installAction = async (options, command) => {
|
|
65823
65418
|
recordCount(METRIC.cliInvoked, 1, { command: "install" });
|
|
@@ -66654,7 +66249,6 @@ const INSTALL_FLAG_SPEC = {
|
|
|
66654
66249
|
shortOptionsWithRequiredValues: new Set(["-c"])
|
|
66655
66250
|
};
|
|
66656
66251
|
const COMMAND_FLAG_SPECS = new Map([
|
|
66657
|
-
["design", ROOT_FLAG_SPEC],
|
|
66658
66252
|
["install", INSTALL_FLAG_SPEC],
|
|
66659
66253
|
["setup", INSTALL_FLAG_SPEC],
|
|
66660
66254
|
["version", {
|
|
@@ -66811,7 +66405,6 @@ ${formatExampleLines([
|
|
|
66811
66405
|
["react-doctor --scope changed --base main", "scan only new issues vs. main"],
|
|
66812
66406
|
["react-doctor --project modules/a,modules/b", "score each module separately (names or paths)"],
|
|
66813
66407
|
["react-doctor --staged", "scan staged files (pre-commit hook)"],
|
|
66814
|
-
["react-doctor design", "run the focused UI design audit"],
|
|
66815
66408
|
["react-doctor --category Security", "show only one diagnostic category"],
|
|
66816
66409
|
["react-doctor --blocking warning", "fail CI on warnings too (default: error)"],
|
|
66817
66410
|
["react-doctor --json > report.json", "write a machine-readable report"],
|
|
@@ -66845,20 +66438,6 @@ ${highlighter.dim("Managing CI:")}
|
|
|
66845
66438
|
${highlighter.dim("Learn more:")}
|
|
66846
66439
|
${highlighter.info(CANONICAL_GITHUB_URL)}
|
|
66847
66440
|
`;
|
|
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
66441
|
const renderCiHelpEpilog = () => `
|
|
66863
66442
|
${highlighter.dim("Examples:")}
|
|
66864
66443
|
${formatExampleLines([
|
|
@@ -66880,7 +66459,6 @@ ${highlighter.dim("Learn more:")}
|
|
|
66880
66459
|
const collectCategoryOption = (value, previousValues) => [...previousValues ?? [], value];
|
|
66881
66460
|
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
66461
|
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
66462
|
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
66463
|
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
66464
|
const providerOption = ["--provider <name>", "ci provider: github-actions or gitlab-ci (auto-detected by default)"];
|
|
@@ -66929,4 +66507,4 @@ Promise.resolve().then(() => assertNoRemovedFlags(process.argv)).then(() => prog
|
|
|
66929
66507
|
export {};
|
|
66930
66508
|
|
|
66931
66509
|
//# sourceMappingURL=cli.js.map
|
|
66932
|
-
//# debugId=
|
|
66510
|
+
//# debugId=263a3384-e99c-5526-89f9-c7e1a6bd4e76
|