react-doctor 0.8.1-dev.5b468f8 → 0.8.1-dev.6fcd9c9
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 +147 -524
- package/dist/index.d.ts +0 -17
- package/dist/index.js +103 -433
- package/dist/lsp.js +103 -433
- 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]="81bdc95e-12f2-565f-a05c-7b8a60a98f81")}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,75 +37316,11 @@ const listWorkspacePackages = (rootDirectory) => {
|
|
|
37360
37316
|
}
|
|
37361
37317
|
return packages;
|
|
37362
37318
|
};
|
|
37363
|
-
const getPreferredDependencyVersion = ({ packageJson, packageNames }) => {
|
|
37364
|
-
const allDependencies = {
|
|
37365
|
-
...packageJson.devDependencies,
|
|
37366
|
-
...packageJson.peerDependencies,
|
|
37367
|
-
...packageJson.dependencies
|
|
37368
|
-
};
|
|
37369
|
-
for (const packageName of packageNames) {
|
|
37370
|
-
const version = allDependencies[packageName];
|
|
37371
|
-
if (version !== void 0) return version;
|
|
37372
|
-
}
|
|
37373
|
-
return null;
|
|
37374
|
-
};
|
|
37375
|
-
const TANSTACK_REACT_QUERY_PACKAGES = ["@tanstack/react-query", "react-query"];
|
|
37376
|
-
const getTanStackQueryVersion = (packageJson) => {
|
|
37377
|
-
return getPreferredDependencyVersion({
|
|
37378
|
-
packageJson,
|
|
37379
|
-
packageNames: TANSTACK_REACT_QUERY_PACKAGES
|
|
37380
|
-
});
|
|
37381
|
-
};
|
|
37382
|
-
const STYLED_COMPONENTS_PACKAGES = ["styled-components"];
|
|
37383
|
-
const getStyledComponentsVersion = (packageJson) => {
|
|
37384
|
-
return getPreferredDependencyVersion({
|
|
37385
|
-
packageJson,
|
|
37386
|
-
packageNames: STYLED_COMPONENTS_PACKAGES
|
|
37387
|
-
});
|
|
37388
|
-
};
|
|
37389
|
-
const I18N_PACKAGES = [
|
|
37390
|
-
"i18next",
|
|
37391
|
-
"react-i18next",
|
|
37392
|
-
"next-i18next",
|
|
37393
|
-
"react-intl",
|
|
37394
|
-
"next-intl",
|
|
37395
|
-
"use-intl",
|
|
37396
|
-
"@formatjs/intl",
|
|
37397
|
-
"@lingui/core",
|
|
37398
|
-
"@lingui/react",
|
|
37399
|
-
"typesafe-i18n",
|
|
37400
|
-
"@tolgee/react",
|
|
37401
|
-
"react-intl-universal"
|
|
37402
|
-
];
|
|
37403
|
-
const hasI18nDependency = (packageJson) => {
|
|
37404
|
-
const allDependencies = {
|
|
37405
|
-
...packageJson.peerDependencies,
|
|
37406
|
-
...packageJson.dependencies,
|
|
37407
|
-
...packageJson.devDependencies,
|
|
37408
|
-
...packageJson.optionalDependencies
|
|
37409
|
-
};
|
|
37410
|
-
return I18N_PACKAGES.some((packageName) => allDependencies[packageName] !== void 0);
|
|
37411
|
-
};
|
|
37412
37319
|
const REANIMATED_DEPENDENCY_NAME = "react-native-reanimated";
|
|
37413
37320
|
const MOBX_REACT_PACKAGE_NAME = "mobx-react";
|
|
37414
37321
|
const MOBX_REACT_LITE_PACKAGE_NAME = "mobx-react-lite";
|
|
37415
37322
|
const MOBX_STATE_TREE_PACKAGE_NAME = "mobx-state-tree";
|
|
37416
37323
|
const MOBX_REACT_OBSERVER_PACKAGE_NAME = "mobx-react-observer";
|
|
37417
|
-
const REACT_THREE_FIBER_DEPENDENCY_NAMES = ["@react-three/fiber", "react-three-fiber"];
|
|
37418
|
-
const REACT_THREE_FIBER_SECTIONS = [
|
|
37419
|
-
"dependencies",
|
|
37420
|
-
"peerDependencies",
|
|
37421
|
-
"optionalDependencies",
|
|
37422
|
-
"devDependencies"
|
|
37423
|
-
];
|
|
37424
|
-
const THREE_DEPENDENCY_SECTIONS = [
|
|
37425
|
-
"dependencies",
|
|
37426
|
-
"peerDependencies",
|
|
37427
|
-
"optionalDependencies",
|
|
37428
|
-
"devDependencies"
|
|
37429
|
-
];
|
|
37430
|
-
const REACT_THREE_FIBER_ECOSYSTEM_DEPENDENCY_NAMES = [...REACT_THREE_FIBER_DEPENDENCY_NAMES, "@react-three/drei"];
|
|
37431
|
-
const THREE_DEPENDENCY_NAMES = [...REACT_THREE_FIBER_ECOSYSTEM_DEPENDENCY_NAMES, "three"];
|
|
37432
37324
|
const SHOPIFY_FLASH_LIST_PACKAGE_NAME = "@shopify/flash-list";
|
|
37433
37325
|
const resolveWorkspaceDependencyVersion = ({ concreteVersion, packageName, rootDirectory, rootPackageJson, sections, workspaceDirectory, workspacePackageJson }) => {
|
|
37434
37326
|
const dependencyDeclaration = getDependencyDeclaration({
|
|
@@ -37439,7 +37331,7 @@ const resolveWorkspaceDependencyVersion = ({ concreteVersion, packageName, rootD
|
|
|
37439
37331
|
if (!dependencyDeclaration.hasDeclaration) return null;
|
|
37440
37332
|
return concreteVersion ?? resolveCatalogVersion(workspacePackageJson, packageName, workspaceDirectory, dependencyDeclaration.catalogReference) ?? resolveCatalogVersion(rootPackageJson, packageName, rootDirectory, dependencyDeclaration.catalogReference);
|
|
37441
37333
|
};
|
|
37442
|
-
const
|
|
37334
|
+
const shouldReplaceReactVersion = (currentVersion, nextVersion) => {
|
|
37443
37335
|
if (!currentVersion) return true;
|
|
37444
37336
|
const currentMajor = parseReactMajor(currentVersion);
|
|
37445
37337
|
const nextMajor = parseReactMajor(nextVersion);
|
|
@@ -37458,50 +37350,6 @@ const shouldReplaceSupportedDependencyFact = (currentFact, nextFact, latestSuppo
|
|
|
37458
37350
|
if (nextMajor > latestSupportedMajor) return true;
|
|
37459
37351
|
return nextMajor < currentMajor;
|
|
37460
37352
|
};
|
|
37461
|
-
const shouldReplaceStyledComponentsVersion = (currentVersion, nextVersion) => {
|
|
37462
|
-
if (!currentVersion) return true;
|
|
37463
|
-
const currentMajor = getLowestDependencyMajor(currentVersion);
|
|
37464
|
-
const nextMajor = getLowestDependencyMajor(nextVersion);
|
|
37465
|
-
if (currentMajor === null) return nextMajor !== null && nextMajor < 6;
|
|
37466
|
-
if (nextMajor === null) return currentMajor >= 6;
|
|
37467
|
-
return nextMajor < currentMajor;
|
|
37468
|
-
};
|
|
37469
|
-
const selectOldestDependencyVersion = (currentVersion, nextVersion) => {
|
|
37470
|
-
if (currentVersion === null || nextVersion === null) return null;
|
|
37471
|
-
const current = parseDependencyMajorMinor(currentVersion);
|
|
37472
|
-
const next = parseDependencyMajorMinor(nextVersion);
|
|
37473
|
-
if (current === null) return currentVersion;
|
|
37474
|
-
if (next === null) return nextVersion;
|
|
37475
|
-
if (next.major !== current.major) return next.major < current.major ? nextVersion : currentVersion;
|
|
37476
|
-
return next.minor < current.minor ? nextVersion : currentVersion;
|
|
37477
|
-
};
|
|
37478
|
-
const shouldReplaceMobxFact = (currentFact, nextFact) => {
|
|
37479
|
-
if (currentFact.sourceDirectory === null) return true;
|
|
37480
|
-
if (currentFact.version === null) return false;
|
|
37481
|
-
if (nextFact.version === null) return true;
|
|
37482
|
-
const currentMajor = getDependencyMajorWithinSupportedRange(currentFact.version, 6);
|
|
37483
|
-
const nextMajor = getDependencyMajorWithinSupportedRange(nextFact.version, 6);
|
|
37484
|
-
if (currentMajor === null) return false;
|
|
37485
|
-
if (nextMajor === null) return true;
|
|
37486
|
-
return selectOldestDependencyVersion(currentFact.version, nextFact.version) === nextFact.version;
|
|
37487
|
-
};
|
|
37488
|
-
const collectBindingVersion = (facts, packageJson, directory, packageName) => {
|
|
37489
|
-
const version = getDependencySpec(packageJson, packageName);
|
|
37490
|
-
if (version === null) return;
|
|
37491
|
-
const resolvedVersion = resolveCatalogBackedDependencyVersion({
|
|
37492
|
-
rootDirectory: directory,
|
|
37493
|
-
rootPackageJson: packageJson,
|
|
37494
|
-
packageName,
|
|
37495
|
-
version
|
|
37496
|
-
});
|
|
37497
|
-
if (packageName === MOBX_REACT_PACKAGE_NAME) {
|
|
37498
|
-
facts.mobxReactVersion = facts.hasMobxReact ? selectOldestDependencyVersion(facts.mobxReactVersion, resolvedVersion) : resolvedVersion;
|
|
37499
|
-
facts.hasMobxReact = true;
|
|
37500
|
-
return;
|
|
37501
|
-
}
|
|
37502
|
-
facts.mobxReactLiteVersion = facts.hasMobxReactLite ? selectOldestDependencyVersion(facts.mobxReactLiteVersion, resolvedVersion) : resolvedVersion;
|
|
37503
|
-
facts.hasMobxReactLite = true;
|
|
37504
|
-
};
|
|
37505
37353
|
const evaluateManifestFacts = (facts, packageJson, directory, rootDirectory, rootPackageJson) => {
|
|
37506
37354
|
if (facts.expo.version === null) {
|
|
37507
37355
|
const spec = getDependencySpec(packageJson, "expo");
|
|
@@ -37535,10 +37383,10 @@ const evaluateManifestFacts = (facts, packageJson, directory, rootDirectory, roo
|
|
|
37535
37383
|
}),
|
|
37536
37384
|
sourceDirectory: directory
|
|
37537
37385
|
};
|
|
37538
|
-
if (
|
|
37386
|
+
if (shouldReplaceSupportedDependencyFact(facts.mobx, nextMobxFact, 6)) facts.mobx = nextMobxFact;
|
|
37539
37387
|
}
|
|
37540
|
-
|
|
37541
|
-
|
|
37388
|
+
facts.hasMobxReact = facts.hasMobxReact || getDependencySpec(packageJson, MOBX_REACT_PACKAGE_NAME) !== null;
|
|
37389
|
+
facts.hasMobxReactLite = facts.hasMobxReactLite || getDependencySpec(packageJson, MOBX_REACT_LITE_PACKAGE_NAME) !== null;
|
|
37542
37390
|
facts.hasMobxStateTree = facts.hasMobxStateTree || getDependencySpec(packageJson, MOBX_STATE_TREE_PACKAGE_NAME) !== null;
|
|
37543
37391
|
facts.hasMobxReactObserver = facts.hasMobxReactObserver || getDependencySpec(packageJson, MOBX_REACT_OBSERVER_PACKAGE_NAME) !== null;
|
|
37544
37392
|
const zustandSpec = getDependencySpec(packageJson, "zustand");
|
|
@@ -37562,52 +37410,6 @@ const evaluateManifestFacts = (facts, packageJson, directory, rootDirectory, roo
|
|
|
37562
37410
|
const spec = getDependencySpec(packageJson, "valtio");
|
|
37563
37411
|
if (spec !== null) facts.valtioVersion = spec;
|
|
37564
37412
|
}
|
|
37565
|
-
facts.tanstackQueryVersion ??= getTanStackQueryVersion(packageJson);
|
|
37566
|
-
const styledComponentsVersion = resolveCatalogBackedDependencyVersion({
|
|
37567
|
-
rootDirectory: directory,
|
|
37568
|
-
rootPackageJson: packageJson,
|
|
37569
|
-
packageName: "styled-components",
|
|
37570
|
-
version: getStyledComponentsVersion(packageJson)
|
|
37571
|
-
});
|
|
37572
|
-
if (styledComponentsVersion && shouldReplaceStyledComponentsVersion(facts.styledComponentsVersion, styledComponentsVersion)) facts.styledComponentsVersion = styledComponentsVersion;
|
|
37573
|
-
facts.hasI18nLibrary = facts.hasI18nLibrary || hasI18nDependency(packageJson);
|
|
37574
|
-
for (const packageName of REACT_THREE_FIBER_DEPENDENCY_NAMES) {
|
|
37575
|
-
const version = resolveCatalogBackedDependencyVersion({
|
|
37576
|
-
rootDirectory,
|
|
37577
|
-
rootPackageJson,
|
|
37578
|
-
sourceDirectory: directory,
|
|
37579
|
-
sourcePackageJson: packageJson,
|
|
37580
|
-
packageName,
|
|
37581
|
-
version: getDependencyDeclaration({
|
|
37582
|
-
packageName,
|
|
37583
|
-
packageJson,
|
|
37584
|
-
sections: REACT_THREE_FIBER_SECTIONS
|
|
37585
|
-
}).version
|
|
37586
|
-
});
|
|
37587
|
-
if (version === null) continue;
|
|
37588
|
-
if (shouldReplaceWithLowerMajor(facts.reactThreeFiber.version, version)) facts.reactThreeFiber = {
|
|
37589
|
-
packageName,
|
|
37590
|
-
version,
|
|
37591
|
-
sourceDirectory: directory
|
|
37592
|
-
};
|
|
37593
|
-
}
|
|
37594
|
-
const threeVersion = resolveCatalogBackedDependencyVersion({
|
|
37595
|
-
rootDirectory,
|
|
37596
|
-
rootPackageJson,
|
|
37597
|
-
sourceDirectory: directory,
|
|
37598
|
-
sourcePackageJson: packageJson,
|
|
37599
|
-
packageName: "three",
|
|
37600
|
-
version: getDependencyDeclaration({
|
|
37601
|
-
packageName: "three",
|
|
37602
|
-
packageJson,
|
|
37603
|
-
sections: THREE_DEPENDENCY_SECTIONS
|
|
37604
|
-
}).version
|
|
37605
|
-
});
|
|
37606
|
-
if (threeVersion !== null) {
|
|
37607
|
-
const currentRelease = parseThreeRelease(facts.threeVersion);
|
|
37608
|
-
const nextRelease = parseThreeRelease(threeVersion);
|
|
37609
|
-
if (facts.threeVersion === null || nextRelease !== null && (currentRelease === null || nextRelease < currentRelease)) facts.threeVersion = threeVersion;
|
|
37610
|
-
}
|
|
37611
37413
|
facts.hasReactNativeAwarePackage = facts.hasReactNativeAwarePackage || isPackageJsonReactNativeAware(packageJson);
|
|
37612
37414
|
facts.hasReanimatedAwarePackage = facts.hasReanimatedAwarePackage || isPackageJsonReanimatedAware(packageJson);
|
|
37613
37415
|
facts.hasSsrDependency = facts.hasSsrDependency || isPackageJsonSsrAware(packageJson);
|
|
@@ -37629,8 +37431,6 @@ const evaluateManifestFacts = (facts, packageJson, directory, rootDirectory, roo
|
|
|
37629
37431
|
if (currentRemotionMajorVersion === null || remotionMajorVersion < currentRemotionMajorVersion) facts.remotionVersion = resolvedRemotionVersion;
|
|
37630
37432
|
}
|
|
37631
37433
|
}
|
|
37632
|
-
facts.hasThree = facts.hasThree || THREE_DEPENDENCY_NAMES.some((dependencyName) => getDependencySpec(packageJson, dependencyName) !== null);
|
|
37633
|
-
facts.hasReactThreeFiber = facts.hasReactThreeFiber || REACT_THREE_FIBER_ECOSYSTEM_DEPENDENCY_NAMES.some((dependencyName) => getDependencySpec(packageJson, dependencyName) !== null);
|
|
37634
37434
|
};
|
|
37635
37435
|
const collectWorkspaceFacts = (rootDirectory, rootPackageJson, { collectReactGroup }) => {
|
|
37636
37436
|
const facts = {
|
|
@@ -37656,32 +37456,19 @@ const collectWorkspaceFacts = (rootDirectory, rootPackageJson, { collectReactGro
|
|
|
37656
37456
|
sourceDirectory: null
|
|
37657
37457
|
},
|
|
37658
37458
|
hasMobxReact: false,
|
|
37659
|
-
mobxReactVersion: null,
|
|
37660
37459
|
hasMobxReactLite: false,
|
|
37661
|
-
mobxReactLiteVersion: null,
|
|
37662
37460
|
hasMobxStateTree: false,
|
|
37663
37461
|
hasMobxReactObserver: false,
|
|
37664
37462
|
zustand: {
|
|
37665
37463
|
version: null,
|
|
37666
37464
|
sourceDirectory: null
|
|
37667
37465
|
},
|
|
37668
|
-
tanstackQueryVersion: null,
|
|
37669
|
-
styledComponentsVersion: null,
|
|
37670
|
-
hasI18nLibrary: false,
|
|
37671
37466
|
hasReactNativeAwarePackage: false,
|
|
37672
37467
|
hasReanimatedAwarePackage: false,
|
|
37673
37468
|
hasSsrDependency: false,
|
|
37674
37469
|
hasRemotionDependency: false,
|
|
37675
37470
|
hasUnknownRemotionVersion: false,
|
|
37676
37471
|
remotionVersion: null,
|
|
37677
|
-
hasThree: false,
|
|
37678
|
-
threeVersion: null,
|
|
37679
|
-
hasReactThreeFiber: false,
|
|
37680
|
-
reactThreeFiber: {
|
|
37681
|
-
packageName: null,
|
|
37682
|
-
version: null,
|
|
37683
|
-
sourceDirectory: null
|
|
37684
|
-
},
|
|
37685
37472
|
reanimatedVersion: null
|
|
37686
37473
|
};
|
|
37687
37474
|
evaluateManifestFacts(facts, rootPackageJson, rootDirectory, rootDirectory, rootPackageJson);
|
|
@@ -37724,7 +37511,7 @@ const collectWorkspaceFacts = (rootDirectory, rootPackageJson, { collectReactGro
|
|
|
37724
37511
|
workspaceDirectory,
|
|
37725
37512
|
workspacePackageJson
|
|
37726
37513
|
});
|
|
37727
|
-
if (reactVersion &&
|
|
37514
|
+
if (reactVersion && shouldReplaceReactVersion(facts.reactVersion, reactVersion)) facts.reactVersion = reactVersion;
|
|
37728
37515
|
if (tailwindVersion && !facts.tailwindVersion) facts.tailwindVersion = tailwindVersion;
|
|
37729
37516
|
if (zodVersion && !facts.zodVersion) facts.zodVersion = zodVersion;
|
|
37730
37517
|
const settledReactMajor = parseReactMajor(facts.reactVersion);
|
|
@@ -37917,9 +37704,7 @@ const discoverProjectWithoutPackageJson = (directory) => {
|
|
|
37917
37704
|
mobxVersion: null,
|
|
37918
37705
|
mobxMajorVersion: null,
|
|
37919
37706
|
hasMobxReact: false,
|
|
37920
|
-
mobxReactVersion: null,
|
|
37921
37707
|
hasMobxReactLite: false,
|
|
37922
|
-
mobxReactLiteVersion: null,
|
|
37923
37708
|
hasMobxStateTree: false,
|
|
37924
37709
|
hasMobxReactObserver: false,
|
|
37925
37710
|
zustandVersion: null,
|
|
@@ -37934,15 +37719,6 @@ const discoverProjectWithoutPackageJson = (directory) => {
|
|
|
37934
37719
|
hasRemotion: false,
|
|
37935
37720
|
remotionVersion: null,
|
|
37936
37721
|
remotionMajorVersion: null,
|
|
37937
|
-
hasI18nLibrary: false,
|
|
37938
|
-
tanstackQueryVersion: null,
|
|
37939
|
-
styledComponentsVersion: null,
|
|
37940
|
-
hasThree: false,
|
|
37941
|
-
threeVersion: null,
|
|
37942
|
-
threeRelease: null,
|
|
37943
|
-
hasReactThreeFiber: false,
|
|
37944
|
-
reactThreeFiberVersion: null,
|
|
37945
|
-
reactThreeFiberMajorVersion: null,
|
|
37946
37722
|
hasSsrDependency: false,
|
|
37947
37723
|
preactVersion: null,
|
|
37948
37724
|
preactMajorVersion: null,
|
|
@@ -38069,19 +37845,6 @@ const discoverProject = (directory) => {
|
|
|
38069
37845
|
});
|
|
38070
37846
|
const preactVersion = getPreactVersion(packageJson);
|
|
38071
37847
|
const remotionVersion = workspaceFacts.remotionVersion;
|
|
38072
|
-
const tanstackQueryVersion = getTanStackQueryVersion(packageJson) ?? workspaceFacts.tanstackQueryVersion;
|
|
38073
|
-
const reactThreeFiberVersion = workspaceFacts.reactThreeFiber.packageName ? resolveCatalogBackedDependencyVersion({
|
|
38074
|
-
rootDirectory: directory,
|
|
38075
|
-
rootPackageJson: packageJson,
|
|
38076
|
-
packageName: workspaceFacts.reactThreeFiber.packageName,
|
|
38077
|
-
version: workspaceFacts.reactThreeFiber.version
|
|
38078
|
-
}) : null;
|
|
38079
|
-
const threeVersion = resolveCatalogBackedDependencyVersion({
|
|
38080
|
-
rootDirectory: directory,
|
|
38081
|
-
rootPackageJson: packageJson,
|
|
38082
|
-
packageName: "three",
|
|
38083
|
-
version: workspaceFacts.threeVersion
|
|
38084
|
-
});
|
|
38085
37848
|
const isPreES2023Target = hasTypeScript && detectPreES2023Target(directory);
|
|
38086
37849
|
const projectInfo = {
|
|
38087
37850
|
rootDirectory: directory,
|
|
@@ -38092,11 +37855,9 @@ const discoverProject = (directory) => {
|
|
|
38092
37855
|
zodVersion,
|
|
38093
37856
|
zodMajorVersion: zodVersion === null ? null : getLowestDependencyMajor(zodVersion),
|
|
38094
37857
|
mobxVersion,
|
|
38095
|
-
mobxMajorVersion: mobxVersion === null ? null :
|
|
37858
|
+
mobxMajorVersion: mobxVersion === null ? null : getLowestDependencyMajor(mobxVersion),
|
|
38096
37859
|
hasMobxReact: workspaceFacts.hasMobxReact,
|
|
38097
|
-
mobxReactVersion: workspaceFacts.mobxReactVersion,
|
|
38098
37860
|
hasMobxReactLite: workspaceFacts.hasMobxReactLite,
|
|
38099
|
-
mobxReactLiteVersion: workspaceFacts.mobxReactLiteVersion,
|
|
38100
37861
|
hasMobxStateTree: workspaceFacts.hasMobxStateTree,
|
|
38101
37862
|
hasMobxReactObserver: workspaceFacts.hasMobxReactObserver,
|
|
38102
37863
|
zustandVersion,
|
|
@@ -38105,21 +37866,12 @@ const discoverProject = (directory) => {
|
|
|
38105
37866
|
hasTypeScript,
|
|
38106
37867
|
hasReactCompiler: detectReactCompiler(directory, packageJson),
|
|
38107
37868
|
hasReactCompilerLintPlugin: detectReactCompilerLintPlugin(directory, packageJson),
|
|
38108
|
-
hasTanStackQuery:
|
|
38109
|
-
hasI18nLibrary: workspaceFacts.hasI18nLibrary,
|
|
38110
|
-
tanstackQueryVersion,
|
|
38111
|
-
styledComponentsVersion: workspaceFacts.styledComponentsVersion,
|
|
37869
|
+
hasTanStackQuery: hasTanStackQuery(packageJson),
|
|
38112
37870
|
valtioVersion,
|
|
38113
37871
|
valtioMajorVersion: valtioVersion === null ? null : getLowestDependencyMajor(valtioVersion),
|
|
38114
37872
|
hasRemotion: workspaceFacts.hasRemotionDependency,
|
|
38115
37873
|
remotionVersion,
|
|
38116
37874
|
remotionMajorVersion: remotionVersion === null ? null : getLowestDependencyMajor(remotionVersion),
|
|
38117
|
-
hasThree: workspaceFacts.hasThree,
|
|
38118
|
-
threeVersion,
|
|
38119
|
-
threeRelease: parseThreeRelease(threeVersion),
|
|
38120
|
-
hasReactThreeFiber: workspaceFacts.hasReactThreeFiber,
|
|
38121
|
-
reactThreeFiberVersion,
|
|
38122
|
-
reactThreeFiberMajorVersion: reactThreeFiberVersion === null ? null : getLowestDependencyMajor(reactThreeFiberVersion),
|
|
38123
37875
|
hasSsrDependency: workspaceFacts.hasSsrDependency,
|
|
38124
37876
|
preactVersion,
|
|
38125
37877
|
preactMajorVersion: parseReactMajor(preactVersion),
|
|
@@ -41429,10 +41181,10 @@ const SSR_FRAMEWORKS = new Set([
|
|
|
41429
41181
|
"gatsby",
|
|
41430
41182
|
"tanstack-start"
|
|
41431
41183
|
]);
|
|
41432
|
-
const
|
|
41433
|
-
if (
|
|
41434
|
-
const
|
|
41435
|
-
for (let candidate = earliest; candidate <=
|
|
41184
|
+
const addMajorLadder = (capabilities, name, major, earliest, latest) => {
|
|
41185
|
+
if (major === null) return;
|
|
41186
|
+
const cappedMajor = Math.min(major, latest);
|
|
41187
|
+
for (let candidate = earliest; candidate <= cappedMajor; candidate += 1) capabilities.add(`${name}:${candidate}`);
|
|
41436
41188
|
};
|
|
41437
41189
|
const buildCapabilities = (project) => {
|
|
41438
41190
|
const capabilities = /* @__PURE__ */ new Set();
|
|
@@ -41445,77 +41197,39 @@ const buildCapabilities = (project) => {
|
|
|
41445
41197
|
if (CLIENT_ONLY_FRAMEWORKS.has(project.framework)) capabilities.add("client-only");
|
|
41446
41198
|
if (project.isStaticExport) capabilities.add("nextjs:static-export");
|
|
41447
41199
|
if (project.nextjsMajorVersion !== null && project.nextjsMajorVersion >= 15) capabilities.add("nextjs:15");
|
|
41448
|
-
|
|
41449
|
-
addVersionCapabilityLadder(capabilities, "react", project.reactMajorVersion, 17, 30);
|
|
41200
|
+
addMajorLadder(capabilities, "react", project.reactMajorVersion, 17, 30);
|
|
41450
41201
|
if (project.reactMajorVersion !== null && project.reactMajorVersion >= 19 && isMajorMinorAtLeast(parseReactMajorMinor(project.reactVersion), {
|
|
41451
41202
|
major: 19,
|
|
41452
41203
|
minor: 2
|
|
41453
41204
|
})) capabilities.add("react:19.2");
|
|
41454
|
-
if (project.tailwindVersion !== null)
|
|
41455
|
-
|
|
41456
|
-
|
|
41457
|
-
|
|
41458
|
-
|
|
41459
|
-
minor: 4
|
|
41460
|
-
})) capabilities.add("tailwind:3.4");
|
|
41461
|
-
if (tailwindVersion !== null && isMajorMinorAtLeast(tailwindVersion, {
|
|
41462
|
-
major: 4,
|
|
41463
|
-
minor: 0
|
|
41464
|
-
})) capabilities.add("tailwind:4");
|
|
41465
|
-
}
|
|
41205
|
+
if (project.tailwindVersion !== null) capabilities.add("tailwind");
|
|
41206
|
+
if (project.tailwindVersion !== null && isMajorMinorAtLeast(parseTailwindMajorMinor(project.tailwindVersion), {
|
|
41207
|
+
major: 3,
|
|
41208
|
+
minor: 4
|
|
41209
|
+
})) capabilities.add("tailwind:3.4");
|
|
41466
41210
|
if (project.zodVersion !== null) capabilities.add("zod");
|
|
41467
41211
|
if (project.zodMajorVersion !== null && project.zodMajorVersion >= 4) capabilities.add("zod:4");
|
|
41468
41212
|
if (project.mobxVersion !== void 0 && project.mobxVersion !== null || project.hasMobxReact === true || project.hasMobxReactLite === true || project.hasMobxStateTree === true || project.hasMobxReactObserver === true) capabilities.add("mobx");
|
|
41469
41213
|
if (project.hasMobxReact === true) capabilities.add("mobx-react");
|
|
41470
41214
|
if (project.hasMobxReactLite === true) capabilities.add("mobx-react-lite");
|
|
41471
41215
|
if (project.hasMobxReact === true || project.hasMobxReactLite === true) capabilities.add("mobx-react-binding");
|
|
41472
|
-
const mobxReactVersion = parseDependencyMajorMinor(project.mobxReactVersion);
|
|
41473
|
-
const mobxReactLiteVersion = parseDependencyMajorMinor(project.mobxReactLiteVersion);
|
|
41474
|
-
const hasMobxReactObserverMemoGuard = mobxReactVersion !== null && isMajorMinorAtLeast(mobxReactVersion, {
|
|
41475
|
-
major: 7,
|
|
41476
|
-
minor: 3
|
|
41477
|
-
});
|
|
41478
|
-
const hasMobxReactLiteObserverMemoGuard = mobxReactLiteVersion !== null && isMajorMinorAtLeast(mobxReactLiteVersion, {
|
|
41479
|
-
major: 3,
|
|
41480
|
-
minor: 3
|
|
41481
|
-
});
|
|
41482
|
-
if (hasMobxReactObserverMemoGuard) capabilities.add("mobx-react-observer-memo-guard");
|
|
41483
|
-
if (hasMobxReactLiteObserverMemoGuard) capabilities.add("mobx-react-lite-observer-memo-guard");
|
|
41484
|
-
if (hasMobxReactObserverMemoGuard || hasMobxReactLiteObserverMemoGuard) capabilities.add("mobx-react-binding-observer-memo-guard");
|
|
41485
41216
|
if (project.hasMobxStateTree === true) capabilities.add("mobx-state-tree");
|
|
41486
41217
|
if (project.hasMobxReactObserver === true) capabilities.add("mobx-react-observer");
|
|
41487
|
-
if (project.mobxMajorVersion !== void 0 && project.mobxMajorVersion !== null && project.mobxMajorVersion >= 4 && project.mobxMajorVersion <= 6)
|
|
41488
|
-
const mobxVersion = parseDependencyMajorMinor(project.mobxVersion);
|
|
41489
|
-
if (project.mobxMajorVersion === 6 && mobxVersion !== null && isMajorMinorAtLeast(mobxVersion, {
|
|
41490
|
-
major: 6,
|
|
41491
|
-
minor: 10
|
|
41492
|
-
})) capabilities.add("mobx:6.10");
|
|
41218
|
+
if (project.mobxMajorVersion !== void 0 && project.mobxMajorVersion !== null && project.mobxMajorVersion >= 4 && project.mobxMajorVersion <= 6) addMajorLadder(capabilities, "mobx", project.mobxMajorVersion, 4, 6);
|
|
41493
41219
|
if (project.zustandVersion !== void 0 && project.zustandVersion !== null) capabilities.add("zustand");
|
|
41494
|
-
if (project.zustandMajorVersion !== void 0 && project.zustandMajorVersion !== null && project.zustandMajorVersion >= 1 && project.zustandMajorVersion <= 5)
|
|
41220
|
+
if (project.zustandMajorVersion !== void 0 && project.zustandMajorVersion !== null && project.zustandMajorVersion >= 1 && project.zustandMajorVersion <= 5) addMajorLadder(capabilities, "zustand", project.zustandMajorVersion, 1, 5);
|
|
41495
41221
|
if (project.isPreES2023Target) capabilities.add("pre-es2023");
|
|
41496
41222
|
if (project.hasReactCompiler) capabilities.add("react-compiler");
|
|
41497
|
-
if (
|
|
41498
|
-
if (project.styledComponentsVersion) {
|
|
41499
|
-
capabilities.add("styled-components");
|
|
41500
|
-
const styledComponentsMajor = getLowestDependencyMajor(project.styledComponentsVersion);
|
|
41501
|
-
if (styledComponentsMajor !== null && styledComponentsMajor >= 6) capabilities.add("styled-components:6");
|
|
41502
|
-
}
|
|
41503
|
-
if (project.hasI18nLibrary) capabilities.add("i18n");
|
|
41223
|
+
if (project.hasTanStackQuery) capabilities.add("tanstack-query");
|
|
41504
41224
|
if (project.valtioVersion !== null) capabilities.add("valtio");
|
|
41505
|
-
|
|
41225
|
+
addMajorLadder(capabilities, "valtio", project.valtioMajorVersion, 1, 10);
|
|
41506
41226
|
if (project.hasRemotion) {
|
|
41507
41227
|
capabilities.add("remotion");
|
|
41508
|
-
|
|
41509
|
-
}
|
|
41510
|
-
if (project.hasThree || project.hasReactThreeFiber) capabilities.add("three");
|
|
41511
|
-
addVersionCapabilityLadder(capabilities, "three", project.threeRelease ?? null, 145, 250);
|
|
41512
|
-
if (project.hasReactThreeFiber) {
|
|
41513
|
-
capabilities.add("r3f");
|
|
41514
|
-
addVersionCapabilityLadder(capabilities, "r3f", project.reactThreeFiberMajorVersion ?? null, 3, 10);
|
|
41228
|
+
addMajorLadder(capabilities, "remotion", project.remotionMajorVersion ?? null, 4, 30);
|
|
41515
41229
|
}
|
|
41516
41230
|
if (project.hasTypeScript) capabilities.add("typescript");
|
|
41517
41231
|
if (project.preactVersion !== null) capabilities.add("preact");
|
|
41518
|
-
|
|
41232
|
+
addMajorLadder(capabilities, "preact", project.preactMajorVersion, 10, 20);
|
|
41519
41233
|
if (project.preactVersion !== null && project.reactVersion === null) capabilities.add("pure-preact");
|
|
41520
41234
|
return capabilities;
|
|
41521
41235
|
};
|
|
@@ -41527,7 +41241,7 @@ const getCapabilities = (project) => {
|
|
|
41527
41241
|
capabilitiesByProject.set(project, capabilities);
|
|
41528
41242
|
return capabilities;
|
|
41529
41243
|
};
|
|
41530
|
-
const shouldEnableRule = (requires, tags, capabilities, ignoredTags, disabledWhen
|
|
41244
|
+
const shouldEnableRule = (requires, tags, capabilities, ignoredTags, disabledWhen) => {
|
|
41531
41245
|
if (requires) {
|
|
41532
41246
|
for (const capability of requires) if (!capabilities.has(capability)) return false;
|
|
41533
41247
|
}
|
|
@@ -41538,29 +41252,20 @@ const shouldEnableRule = (requires, tags, capabilities, ignoredTags, disabledWhe
|
|
|
41538
41252
|
if (tags) {
|
|
41539
41253
|
for (const tag of tags) if (ignoredTags.has(tag)) return false;
|
|
41540
41254
|
}
|
|
41541
|
-
if (includedTags && includedTags.size > 0) {
|
|
41542
|
-
if (!tags?.some((tag) => includedTags.has(tag))) return false;
|
|
41543
|
-
}
|
|
41544
41255
|
return true;
|
|
41545
41256
|
};
|
|
41546
|
-
const shouldEnableRuleByDefaultStatus = (options) => options.defaultEnabled !== false || options.hasExplicitOverride === true || options.includeTagDefaults && options.hasIncludedTags;
|
|
41547
41257
|
const yieldToEventLoop = () => new Promise((resolve) => {
|
|
41548
41258
|
setImmediate(resolve);
|
|
41549
41259
|
});
|
|
41550
41260
|
const createSecurityScanSession = (rootDirectory, options) => {
|
|
41551
41261
|
const capabilities = options.project ? getCapabilities(options.project) : /* @__PURE__ */ new Set();
|
|
41552
41262
|
const ignoredTags = options.ignoredTags ?? /* @__PURE__ */ new Set();
|
|
41553
|
-
const includedTags = options.includedTags ?? /* @__PURE__ */ new Set();
|
|
41554
41263
|
const enabledScanRules = REACT_DOCTOR_RULES.flatMap((entry) => {
|
|
41555
41264
|
const rule = entry.rule;
|
|
41556
41265
|
const scan = rule.scan;
|
|
41557
41266
|
if (typeof scan !== "function") return [];
|
|
41558
|
-
if (
|
|
41559
|
-
|
|
41560
|
-
includeTagDefaults: options.includeTagDefaults === true,
|
|
41561
|
-
hasIncludedTags: includedTags.size > 0
|
|
41562
|
-
})) return [];
|
|
41563
|
-
if (!shouldEnableRule(rule.requires, rule.tags, capabilities, ignoredTags, rule.disabledWhen, includedTags)) return [];
|
|
41267
|
+
if (rule.defaultEnabled === false) return [];
|
|
41268
|
+
if (!shouldEnableRule(rule.requires, rule.tags, capabilities, ignoredTags, rule.disabledWhen)) return [];
|
|
41564
41269
|
return [{
|
|
41565
41270
|
entry,
|
|
41566
41271
|
scan,
|
|
@@ -43562,9 +43267,8 @@ const buildUserPluginRules = (userPlugin, severityControls) => {
|
|
|
43562
43267
|
}
|
|
43563
43268
|
return enabled;
|
|
43564
43269
|
};
|
|
43565
|
-
const createOxlintConfig = ({ pluginPath, project, customRulesOnly = false, extendsPaths = [], ignoredTags = /* @__PURE__ */ new Set(),
|
|
43566
|
-
const
|
|
43567
|
-
const reactHooksJsPlugin = disableReactHooksJsPlugin || ruleSelection === "sidecar" || hasIncludedTags ? null : resolveReactHooksJsPlugin(project.hasReactCompiler || project.hasReactCompilerLintPlugin === true, customRulesOnly);
|
|
43270
|
+
const createOxlintConfig = ({ pluginPath, project, customRulesOnly = false, extendsPaths = [], ignoredTags = /* @__PURE__ */ new Set(), serverAuthFunctionNames, severityControls, userPlugins = [], disableReactHooksJsPlugin = false, ruleSelection, sidecarRuleIdFilter }) => {
|
|
43271
|
+
const reactHooksJsPlugin = disableReactHooksJsPlugin || ruleSelection === "sidecar" ? null : resolveReactHooksJsPlugin(project.hasReactCompiler || project.hasReactCompilerLintPlugin === true, customRulesOnly);
|
|
43568
43272
|
const reactCompilerRules = reactHooksJsPlugin ? applyRuleSeverityControls(filterRulesToAvailable(REACT_COMPILER_RULES, "react-hooks-js", reactHooksJsPlugin.availableRuleNames), severityControls) : {};
|
|
43569
43273
|
const jsPlugins = [];
|
|
43570
43274
|
if (reactHooksJsPlugin) jsPlugins.push(reactHooksJsPlugin.entry);
|
|
@@ -43579,14 +43283,9 @@ const createOxlintConfig = ({ pluginPath, project, customRulesOnly = false, exte
|
|
|
43579
43283
|
if (rule.scan !== void 0) continue;
|
|
43580
43284
|
if (customRulesOnly && registryEntry.originallyExternal) continue;
|
|
43581
43285
|
if (rule.framework !== "global" && !rule.requires) continue;
|
|
43582
|
-
if (!shouldEnableRule(rule.requires, rule.tags, capabilities, ignoredTags, rule.disabledWhen
|
|
43286
|
+
if (!shouldEnableRule(rule.requires, rule.tags, capabilities, ignoredTags, rule.disabledWhen)) continue;
|
|
43583
43287
|
const explicitRuleOverride = resolveRuleSeverityOverride({ ruleKey: registryEntry.key }, severityControls);
|
|
43584
|
-
if (
|
|
43585
|
-
defaultEnabled: rule.defaultEnabled,
|
|
43586
|
-
includeTagDefaults,
|
|
43587
|
-
hasIncludedTags,
|
|
43588
|
-
hasExplicitOverride: explicitRuleOverride !== void 0
|
|
43589
|
-
})) continue;
|
|
43288
|
+
if (rule.defaultEnabled === false && explicitRuleOverride === void 0) continue;
|
|
43590
43289
|
const severity = resolveRuleSeverityOverride({
|
|
43591
43290
|
ruleKey: registryEntry.key,
|
|
43592
43291
|
category: rule.category
|
|
@@ -43595,7 +43294,7 @@ const createOxlintConfig = ({ pluginPath, project, customRulesOnly = false, exte
|
|
|
43595
43294
|
enabledReactDoctorRules[registryEntry.key] = severity;
|
|
43596
43295
|
}
|
|
43597
43296
|
const userPluginRules = {};
|
|
43598
|
-
if (ruleSelection !== "sidecar"
|
|
43297
|
+
if (ruleSelection !== "sidecar") for (const userPlugin of userPlugins) {
|
|
43599
43298
|
Object.assign(userPluginRules, buildUserPluginRules(userPlugin, severityControls));
|
|
43600
43299
|
jsPlugins.push(userPlugin.entry);
|
|
43601
43300
|
}
|
|
@@ -43812,19 +43511,6 @@ const createSidecarLintCache = (cacheDirectory, rulesetHash) => {
|
|
|
43812
43511
|
}
|
|
43813
43512
|
};
|
|
43814
43513
|
};
|
|
43815
|
-
const fingerprintCacheByFilePath = /* @__PURE__ */ new Map();
|
|
43816
|
-
const fingerprintFileContents = (filePath, fingerprintLength) => {
|
|
43817
|
-
const fileStats = NFS.statSync(filePath, { bigint: true });
|
|
43818
|
-
const cachedFingerprint = fingerprintCacheByFilePath.get(filePath);
|
|
43819
|
-
if (cachedFingerprint?.modifiedTimeNanoseconds === fileStats.mtimeNs && cachedFingerprint.sizeBytes === fileStats.size) return cachedFingerprint.fingerprint;
|
|
43820
|
-
const fingerprint = crypto.createHash("sha256").update(NFS.readFileSync(filePath)).digest("hex").slice(0, fingerprintLength);
|
|
43821
|
-
fingerprintCacheByFilePath.set(filePath, {
|
|
43822
|
-
fingerprint,
|
|
43823
|
-
modifiedTimeNanoseconds: fileStats.mtimeNs,
|
|
43824
|
-
sizeBytes: fileStats.size
|
|
43825
|
-
});
|
|
43826
|
-
return fingerprint;
|
|
43827
|
-
};
|
|
43828
43514
|
const bundledRequire$3 = createRequire(import.meta.url);
|
|
43829
43515
|
const childNodeVersionByBinaryPath = /* @__PURE__ */ new Map();
|
|
43830
43516
|
const resolveChildNodeVersion = (nodeBinaryPath) => {
|
|
@@ -43848,13 +43534,6 @@ const TOOLCHAIN_PACKAGE_SPECIFIERS$1 = [
|
|
|
43848
43534
|
"oxlint-plugin-react-doctor/package.json",
|
|
43849
43535
|
"eslint-plugin-react-hooks/package.json"
|
|
43850
43536
|
];
|
|
43851
|
-
const resolvePluginFingerprint = () => {
|
|
43852
|
-
try {
|
|
43853
|
-
return fingerprintFileContents(bundledRequire$3.resolve("oxlint-plugin-react-doctor"), 16);
|
|
43854
|
-
} catch {
|
|
43855
|
-
return "unresolved";
|
|
43856
|
-
}
|
|
43857
|
-
};
|
|
43858
43537
|
const resolveOxlintToolchainVersions = (nodeBinaryPath = process.execPath) => {
|
|
43859
43538
|
const versions = [`node=${resolveChildNodeVersion(nodeBinaryPath)}`];
|
|
43860
43539
|
for (const specifier of TOOLCHAIN_PACKAGE_SPECIFIERS$1) try {
|
|
@@ -43864,7 +43543,6 @@ const resolveOxlintToolchainVersions = (nodeBinaryPath = process.execPath) => {
|
|
|
43864
43543
|
} catch {
|
|
43865
43544
|
versions.push(`${specifier}=missing`);
|
|
43866
43545
|
}
|
|
43867
|
-
versions.push(`oxlint-plugin-react-doctor#fingerprint=${resolvePluginFingerprint()}`);
|
|
43868
43546
|
return versions;
|
|
43869
43547
|
};
|
|
43870
43548
|
const esmRequire = createRequire(import.meta.url);
|
|
@@ -45340,7 +45018,7 @@ const reactHooksJsPluginDropNote = (error) => {
|
|
|
45340
45018
|
* 6. always restore disable directives + clean up the temp dir
|
|
45341
45019
|
*/
|
|
45342
45020
|
const runOxlint = async (options) => {
|
|
45343
|
-
const { rootDirectory, project, includePaths, nodeBinaryPath = process.execPath, customRulesOnly = false, respectInlineDisables = true, adoptExistingLintConfig = true, ignoredTags = /* @__PURE__ */ new Set(),
|
|
45021
|
+
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;
|
|
45344
45022
|
const serverAuthFunctionNames = Array.isArray(userConfig?.serverAuthFunctionNames) ? userConfig.serverAuthFunctionNames.filter((entry) => typeof entry === "string" && entry.length > 0) : void 0;
|
|
45345
45023
|
const severityControls = buildRuleSeverityControls(userConfig);
|
|
45346
45024
|
validateRuleRegistration();
|
|
@@ -45354,15 +45032,13 @@ const runOxlint = async (options) => {
|
|
|
45354
45032
|
}
|
|
45355
45033
|
const pluginPath = resolvePluginPath();
|
|
45356
45034
|
const extendsPaths = (adoptExistingLintConfig && !customRulesOnly ? detectUserLintConfigPaths(rootDirectory) : []).filter(canOxlintExtendConfig);
|
|
45357
|
-
const userPlugins =
|
|
45035
|
+
const userPlugins = resolveUserPlugins(userConfig?.plugins, configSourceDirectory);
|
|
45358
45036
|
const buildConfig = (overrides) => createOxlintConfig({
|
|
45359
45037
|
pluginPath,
|
|
45360
45038
|
project,
|
|
45361
45039
|
customRulesOnly,
|
|
45362
45040
|
extendsPaths: overrides.extendsPaths,
|
|
45363
45041
|
ignoredTags,
|
|
45364
|
-
includedTags,
|
|
45365
|
-
includeTagDefaults,
|
|
45366
45042
|
serverAuthFunctionNames,
|
|
45367
45043
|
severityControls,
|
|
45368
45044
|
userPlugins,
|
|
@@ -45751,8 +45427,6 @@ var Linter = class Linter extends Service()("react-doctor/Linter") {
|
|
|
45751
45427
|
respectInlineDisables: input.respectInlineDisables,
|
|
45752
45428
|
adoptExistingLintConfig: input.adoptExistingLintConfig,
|
|
45753
45429
|
ignoredTags: input.ignoredTags,
|
|
45754
|
-
includedTags: input.includedTags,
|
|
45755
|
-
includeTagDefaults: input.includeTagDefaults,
|
|
45756
45430
|
userConfig: input.userConfig ?? null,
|
|
45757
45431
|
configSourceDirectory: input.configSourceDirectory,
|
|
45758
45432
|
onPartialFailure: (reason) => {
|
|
@@ -46601,9 +46275,7 @@ const runInspect = (input, hooks = {}) => gen(function* () {
|
|
|
46601
46275
|
const securityScanFailedRef = yield* make$13(false);
|
|
46602
46276
|
const securityScanFiber = yield* forkChild(runCollect(applyPerElementPipeline(isDiffMode ? empty$4 : unwrap(tryPromise(() => checkSecurityScanCooperative(scanDirectory, {
|
|
46603
46277
|
project,
|
|
46604
|
-
ignoredTags: input.ignoredTags
|
|
46605
|
-
includedTags: input.includedTags,
|
|
46606
|
-
includeTagDefaults: input.includeTagDefaults
|
|
46278
|
+
ignoredTags: input.ignoredTags
|
|
46607
46279
|
})).pipe(map$3((diagnostics) => fromIterable$1(diagnostics)), catch_$1(() => set(securityScanFailedRef, true).pipe(as(empty$4))))))).pipe(withSpan("SecurityScan.run")));
|
|
46608
46280
|
const shouldRunSupplyChain = !isDiffMode || (input.supplyChainManifestChanged ?? false);
|
|
46609
46281
|
const supplyChainOverlapTimeout = yield* SupplyChainOverlapTimeoutMs;
|
|
@@ -46694,8 +46366,6 @@ const runInspect = (input, hooks = {}) => gen(function* () {
|
|
|
46694
46366
|
respectInlineDisables: input.respectInlineDisables,
|
|
46695
46367
|
adoptExistingLintConfig: input.adoptExistingLintConfig,
|
|
46696
46368
|
ignoredTags: input.ignoredTags,
|
|
46697
|
-
includedTags: input.includedTags,
|
|
46698
|
-
includeTagDefaults: input.includeTagDefaults,
|
|
46699
46369
|
userConfig: resolvedConfig.config ?? void 0,
|
|
46700
46370
|
configSourceDirectory: resolvedConfig.configSourceDirectory ?? void 0,
|
|
46701
46371
|
onFileProgress: (scannedFileCount, totalFileCount) => {
|
|
@@ -47840,7 +47510,7 @@ const makeNoopConsole = () => ({
|
|
|
47840
47510
|
});
|
|
47841
47511
|
//#endregion
|
|
47842
47512
|
//#region src/cli/utils/version.ts
|
|
47843
|
-
const VERSION = "0.8.1-dev.
|
|
47513
|
+
const VERSION = "0.8.1-dev.6fcd9c9";
|
|
47844
47514
|
//#endregion
|
|
47845
47515
|
//#region src/cli/utils/json-mode.ts
|
|
47846
47516
|
let context = null;
|
|
@@ -47927,11 +47597,7 @@ const getRunId = () => {
|
|
|
47927
47597
|
};
|
|
47928
47598
|
//#endregion
|
|
47929
47599
|
//#region src/cli/utils/build-run-context.ts
|
|
47930
|
-
const ROOT_SUBCOMMANDS = new Set([
|
|
47931
|
-
"design",
|
|
47932
|
-
"install",
|
|
47933
|
-
"setup"
|
|
47934
|
-
]);
|
|
47600
|
+
const ROOT_SUBCOMMANDS = new Set(["install", "setup"]);
|
|
47935
47601
|
const detectInvokedVia = () => {
|
|
47936
47602
|
const userAgent = process.env.npm_config_user_agent;
|
|
47937
47603
|
if (!userAgent) return "unknown";
|
|
@@ -48015,9 +47681,7 @@ const buildSentryProjectContext = (projectInfo) => ({
|
|
|
48015
47681
|
reactMajorVersion: projectInfo.reactMajorVersion,
|
|
48016
47682
|
hasTypeScript: projectInfo.hasTypeScript,
|
|
48017
47683
|
hasReactCompiler: projectInfo.hasReactCompiler,
|
|
48018
|
-
|
|
48019
|
-
mobxVersion: projectInfo.mobxVersion,
|
|
48020
|
-
styledComponentsVersion: projectInfo.styledComponentsVersion,
|
|
47684
|
+
hasTanStackQuery: projectInfo.hasTanStackQuery,
|
|
48021
47685
|
tailwindVersion: projectInfo.tailwindVersion,
|
|
48022
47686
|
zodVersion: projectInfo.zodVersion,
|
|
48023
47687
|
preactVersion: projectInfo.preactVersion,
|
|
@@ -48198,13 +47862,13 @@ const isDevVersion = (version) => version === "0.0.0" || version.includes("-");
|
|
|
48198
47862
|
* uploads source-map artifacts under, so stack frames symbolicate. Honors the
|
|
48199
47863
|
* standard `SENTRY_RELEASE` override.
|
|
48200
47864
|
*/
|
|
48201
|
-
const resolveSentryRelease = () => process.env.SENTRY_RELEASE || `react-doctor@0.8.1-dev.
|
|
47865
|
+
const resolveSentryRelease = () => process.env.SENTRY_RELEASE || `react-doctor@0.8.1-dev.6fcd9c9`;
|
|
48202
47866
|
/**
|
|
48203
47867
|
* Deployment environment shown in Sentry's environment filter. Defaults to
|
|
48204
47868
|
* `production` for tagged releases and `development` for dev/unbuilt versions,
|
|
48205
47869
|
* overridable via the standard `SENTRY_ENVIRONMENT` env var.
|
|
48206
47870
|
*/
|
|
48207
|
-
const resolveSentryEnvironment = () => process.env.SENTRY_ENVIRONMENT || (isDevVersion("0.8.1-dev.
|
|
47871
|
+
const resolveSentryEnvironment = () => process.env.SENTRY_ENVIRONMENT || (isDevVersion("0.8.1-dev.6fcd9c9") ? "development" : "production");
|
|
48208
47872
|
/**
|
|
48209
47873
|
* Performance-tracing sample rate in `[0, 1]`. Reads `SENTRY_TRACES_SAMPLE_RATE`
|
|
48210
47874
|
* (set to `0` to disable tracing) and falls back to
|
|
@@ -60530,8 +60194,6 @@ const buildScanResultCacheKey = (input) => {
|
|
|
60530
60194
|
warnings: input.options.warnings,
|
|
60531
60195
|
adoptExistingLintConfig: input.options.adoptExistingLintConfig,
|
|
60532
60196
|
ignoredTags: [...input.options.ignoredTags].sort(),
|
|
60533
|
-
includedTags: [...input.options.includedTags].sort(),
|
|
60534
|
-
includeTagDefaults: input.options.includeTagDefaults,
|
|
60535
60197
|
concurrency: input.options.concurrency,
|
|
60536
60198
|
lintBatchOrdering: resolveLintBatchOrdering(),
|
|
60537
60199
|
baselineRef: input.options.baseline?.ref,
|
|
@@ -61358,8 +61020,8 @@ const createDiagnosticEvidenceReader = (rootDirectory, options = {}) => {
|
|
|
61358
61020
|
//#endregion
|
|
61359
61021
|
//#region src/cli/utils/build-no-score-message.ts
|
|
61360
61022
|
const ENTERPRISE_CONTACT_HINT = `Want something custom to your company? Contact us at ${ENTERPRISE_CONTACT_URL}.`;
|
|
61361
|
-
const buildNoScoreMessage = (isScoreDisabled
|
|
61362
|
-
return `${isScoreDisabled ?
|
|
61023
|
+
const buildNoScoreMessage = (isScoreDisabled) => {
|
|
61024
|
+
return `${isScoreDisabled ? "Score disabled by --no-score." : "Score unavailable (could not reach the score API)."} ${ENTERPRISE_CONTACT_HINT}`;
|
|
61363
61025
|
};
|
|
61364
61026
|
//#endregion
|
|
61365
61027
|
//#region src/cli/utils/render-agent-guidance.ts
|
|
@@ -62484,47 +62146,40 @@ const buildChangedLineMatcher = (directory, changedLineRanges) => {
|
|
|
62484
62146
|
return diagnosticIntersectsLineRanges(diagnostic, ranges);
|
|
62485
62147
|
};
|
|
62486
62148
|
};
|
|
62487
|
-
const buildIgnoredTags = (userConfig
|
|
62149
|
+
const buildIgnoredTags = (userConfig) => {
|
|
62488
62150
|
const tags = /* @__PURE__ */ new Set();
|
|
62489
62151
|
if (userConfig?.ignore?.tags) for (const tag of userConfig.ignore.tags) tags.add(tag);
|
|
62490
|
-
for (const tag of includedTags) tags.delete(tag);
|
|
62491
62152
|
return tags;
|
|
62492
62153
|
};
|
|
62493
|
-
const mergeInspectOptions = (inputOptions, userConfig) => {
|
|
62494
|
-
|
|
62495
|
-
|
|
62496
|
-
|
|
62497
|
-
|
|
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
|
-
maxDurationMs: inputOptions.maxDurationMs ?? null,
|
|
62523
|
-
baseline: inputOptions.baseline ?? null,
|
|
62524
|
-
changedLineRanges: inputOptions.changedLineRanges ?? null,
|
|
62525
|
-
supplyChainManifestChanged: inputOptions.supplyChainManifestChanged ?? false
|
|
62526
|
-
};
|
|
62527
|
-
};
|
|
62154
|
+
const mergeInspectOptions = (inputOptions, userConfig) => ({
|
|
62155
|
+
lint: inputOptions.lint ?? userConfig?.lint ?? true,
|
|
62156
|
+
deadCode: inputOptions.deadCode ?? userConfig?.deadCode ?? true,
|
|
62157
|
+
supplyChain: inputOptions.supplyChain ?? userConfig?.supplyChain?.enabled ?? true,
|
|
62158
|
+
verbose: inputOptions.verbose ?? userConfig?.verbose ?? false,
|
|
62159
|
+
outputDirectory: inputOptions.outputDirectory || null,
|
|
62160
|
+
scoreOnly: inputOptions.scoreOnly ?? false,
|
|
62161
|
+
noScore: inputOptions.noScore ?? userConfig?.noScore ?? false,
|
|
62162
|
+
isCi: inputOptions.isCi ?? false,
|
|
62163
|
+
isCiOrCodingAgentEnvironment: isCiOrCodingAgentEnvironment(),
|
|
62164
|
+
isNonInteractiveEnvironment: isNonInteractiveEnvironment(),
|
|
62165
|
+
silent: inputOptions.silent ?? false,
|
|
62166
|
+
includePaths: inputOptions.includePaths ?? [],
|
|
62167
|
+
customRulesOnly: userConfig?.customRulesOnly ?? false,
|
|
62168
|
+
share: userConfig?.share ?? true,
|
|
62169
|
+
respectInlineDisables: inputOptions.respectInlineDisables ?? userConfig?.respectInlineDisables ?? true,
|
|
62170
|
+
warnings: inputOptions.warnings ?? userConfig?.warnings ?? true,
|
|
62171
|
+
categoryFilters: new Set(resolveCliCategories(inputOptions.categoryFilters) ?? []),
|
|
62172
|
+
adoptExistingLintConfig: userConfig?.adoptExistingLintConfig ?? true,
|
|
62173
|
+
ignoredTags: buildIgnoredTags(userConfig),
|
|
62174
|
+
outputSurface: inputOptions.outputSurface ?? "cli",
|
|
62175
|
+
suppressRendering: inputOptions.suppressRendering ?? false,
|
|
62176
|
+
concurrentScan: inputOptions.concurrentScan ?? false,
|
|
62177
|
+
concurrency: inputOptions.concurrency,
|
|
62178
|
+
maxDurationMs: inputOptions.maxDurationMs ?? null,
|
|
62179
|
+
baseline: inputOptions.baseline ?? null,
|
|
62180
|
+
changedLineRanges: inputOptions.changedLineRanges ?? null,
|
|
62181
|
+
supplyChainManifestChanged: inputOptions.supplyChainManifestChanged ?? false
|
|
62182
|
+
});
|
|
62528
62183
|
const deriveScope = (options) => {
|
|
62529
62184
|
if (options.baseline) return "changed";
|
|
62530
62185
|
if (options.changedLineRanges !== null) return "lines";
|
|
@@ -62655,8 +62310,6 @@ const runBaselineComparison = async (params) => {
|
|
|
62655
62310
|
warnings: params.options.warnings,
|
|
62656
62311
|
adoptExistingLintConfig: params.options.adoptExistingLintConfig,
|
|
62657
62312
|
ignoredTags: params.options.ignoredTags,
|
|
62658
|
-
includedTags: params.options.includedTags,
|
|
62659
|
-
includeTagDefaults: params.options.includeTagDefaults,
|
|
62660
62313
|
nodeBinaryPath: params.resolvedNodeBinaryPath ?? void 0,
|
|
62661
62314
|
runDeadCode: false,
|
|
62662
62315
|
isCi: params.options.isCi,
|
|
@@ -62750,8 +62403,6 @@ const runInspectWithRuntime = async (directory, options, userConfig, hasConfigOv
|
|
|
62750
62403
|
warnings: options.warnings,
|
|
62751
62404
|
adoptExistingLintConfig: options.adoptExistingLintConfig,
|
|
62752
62405
|
ignoredTags: options.ignoredTags,
|
|
62753
|
-
includedTags: options.includedTags,
|
|
62754
|
-
includeTagDefaults: options.includeTagDefaults,
|
|
62755
62406
|
nodeBinaryPath: resolvedNodeBinaryPath ?? void 0,
|
|
62756
62407
|
runDeadCode: options.deadCode,
|
|
62757
62408
|
isCi: options.isCi,
|
|
@@ -62940,7 +62591,7 @@ const finalizeAndRender = (input) => gen(function* () {
|
|
|
62940
62591
|
securityScanFailed
|
|
62941
62592
|
});
|
|
62942
62593
|
const hasSkippedChecks = skippedChecks.length > 0;
|
|
62943
|
-
const noScoreMessage = buildNoScoreMessage(options.noScore
|
|
62594
|
+
const noScoreMessage = buildNoScoreMessage(options.noScore);
|
|
62944
62595
|
const buildResult = () => ({
|
|
62945
62596
|
diagnostics: [...diagnostics],
|
|
62946
62597
|
score,
|
|
@@ -65045,25 +64696,21 @@ const resolveParallelFlag = (parallel) => parallel === false ? 1 : void 0;
|
|
|
65045
64696
|
*/
|
|
65046
64697
|
const resolveCliInspectOptions = (flags, userConfig) => {
|
|
65047
64698
|
const wantsWarningGate = pickBlockingLevel(flags, userConfig) === "warning";
|
|
65048
|
-
const isDesignScan = flags.design === true;
|
|
65049
64699
|
return {
|
|
65050
64700
|
lint: flags.lint,
|
|
65051
|
-
deadCode:
|
|
65052
|
-
supplyChain:
|
|
64701
|
+
deadCode: flags.deadCode,
|
|
64702
|
+
supplyChain: flags.supplyChain,
|
|
65053
64703
|
verbose: flags.verbose,
|
|
65054
64704
|
outputDirectory: flags.outputDir,
|
|
65055
64705
|
respectInlineDisables: flags.respectInlineDisables === false ? false : void 0,
|
|
65056
64706
|
warnings: wantsWarningGate ? true : flags.warnings,
|
|
65057
64707
|
scoreOnly: flags.score === true,
|
|
65058
|
-
noScore:
|
|
64708
|
+
noScore: flags.score === false || flags.telemetry === false ? true : void 0,
|
|
65059
64709
|
isCi: isCiEnvironment(),
|
|
65060
64710
|
silent: Boolean(flags.json),
|
|
65061
64711
|
concurrency: resolveParallelFlag(flags.parallel),
|
|
65062
64712
|
maxDurationMs: resolveMaxDurationFlag(flags.maxDuration),
|
|
65063
|
-
categoryFilters: resolveCliCategories(flags.category)
|
|
65064
|
-
includedTags: isDesignScan ? new Set(["design"]) : void 0,
|
|
65065
|
-
includeTagDefaults: isDesignScan ? true : void 0,
|
|
65066
|
-
scoreDisabledMessage: isDesignScan ? "Design scans do not affect the React health score." : void 0
|
|
64713
|
+
categoryFilters: resolveCliCategories(flags.category)
|
|
65067
64714
|
};
|
|
65068
64715
|
};
|
|
65069
64716
|
//#endregion
|
|
@@ -65481,7 +65128,7 @@ const maybeMigrateLegacyConfig = async (requestedDirectory, { isQuiet, isStaged
|
|
|
65481
65128
|
if (!(!isQuiet && !isStaged && process.stdout.isTTY === true && !isCiOrCodingAgentEnvironment())) return;
|
|
65482
65129
|
await runProjectMigrations(requestedDirectory);
|
|
65483
65130
|
};
|
|
65484
|
-
const inspectAction = async (directory, flags
|
|
65131
|
+
const inspectAction = async (directory, flags) => {
|
|
65485
65132
|
const isScoreOnly = Boolean(flags.score);
|
|
65486
65133
|
const isJsonMode = Boolean(flags.json);
|
|
65487
65134
|
const isQuiet = isScoreOnly || isJsonMode;
|
|
@@ -65495,7 +65142,7 @@ const inspectAction = async (directory, flags, invocationCommand = "inspect") =>
|
|
|
65495
65142
|
});
|
|
65496
65143
|
if (flags.jsonOut) recordCount(METRIC.jsonOutUsed, 1);
|
|
65497
65144
|
}
|
|
65498
|
-
recordCount(METRIC.cliInvoked, 1, { command:
|
|
65145
|
+
recordCount(METRIC.cliInvoked, 1, { command: "inspect" });
|
|
65499
65146
|
try {
|
|
65500
65147
|
validateModeFlags(flags);
|
|
65501
65148
|
if (flags.staged) setJsonReportMode("staged");
|
|
@@ -65807,13 +65454,6 @@ const inspectAction = async (directory, flags, invocationCommand = "inspect") =>
|
|
|
65807
65454
|
}
|
|
65808
65455
|
};
|
|
65809
65456
|
//#endregion
|
|
65810
|
-
//#region src/cli/commands/design.ts
|
|
65811
|
-
const designAction = async (directory, flags) => inspectAction(directory, {
|
|
65812
|
-
...flags,
|
|
65813
|
-
design: true,
|
|
65814
|
-
lint: flags.lint ?? true
|
|
65815
|
-
}, "design");
|
|
65816
|
-
//#endregion
|
|
65817
65457
|
//#region src/cli/commands/install.ts
|
|
65818
65458
|
const installAction = async (options, command) => {
|
|
65819
65459
|
recordCount(METRIC.cliInvoked, 1, { command: "install" });
|
|
@@ -66650,7 +66290,6 @@ const INSTALL_FLAG_SPEC = {
|
|
|
66650
66290
|
shortOptionsWithRequiredValues: new Set(["-c"])
|
|
66651
66291
|
};
|
|
66652
66292
|
const COMMAND_FLAG_SPECS = new Map([
|
|
66653
|
-
["design", ROOT_FLAG_SPEC],
|
|
66654
66293
|
["install", INSTALL_FLAG_SPEC],
|
|
66655
66294
|
["setup", INSTALL_FLAG_SPEC],
|
|
66656
66295
|
["version", {
|
|
@@ -66807,7 +66446,6 @@ ${formatExampleLines([
|
|
|
66807
66446
|
["react-doctor --scope changed --base main", "scan only new issues vs. main"],
|
|
66808
66447
|
["react-doctor --project modules/a,modules/b", "score each module separately (names or paths)"],
|
|
66809
66448
|
["react-doctor --staged", "scan staged files (pre-commit hook)"],
|
|
66810
|
-
["react-doctor design", "run the focused UI design audit"],
|
|
66811
66449
|
["react-doctor --category Security", "show only one diagnostic category"],
|
|
66812
66450
|
["react-doctor --blocking warning", "fail CI on warnings too (default: error)"],
|
|
66813
66451
|
["react-doctor --json > report.json", "write a machine-readable report"],
|
|
@@ -66841,20 +66479,6 @@ ${highlighter.dim("Managing CI:")}
|
|
|
66841
66479
|
${highlighter.dim("Learn more:")}
|
|
66842
66480
|
${highlighter.info(CANONICAL_GITHUB_URL)}
|
|
66843
66481
|
`;
|
|
66844
|
-
const renderDesignHelpEpilog = () => `
|
|
66845
|
-
${highlighter.dim("Examples:")}
|
|
66846
|
-
${formatExampleLines([
|
|
66847
|
-
["react-doctor design", "audit UI design in the current project"],
|
|
66848
|
-
["react-doctor design ./apps/web", "audit one application"],
|
|
66849
|
-
["react-doctor design --verbose", "show every design finding"],
|
|
66850
|
-
["react-doctor design --json", "write a design-only JSON report"]
|
|
66851
|
-
])}
|
|
66852
|
-
|
|
66853
|
-
${highlighter.dim("Scope:")}
|
|
66854
|
-
Runs only rules tagged ${highlighter.info("design")}, including focused rules that stay opt-in during a general health scan.
|
|
66855
|
-
Dead-code, supply-chain, external lint-config, custom-plugin, and health-score passes are skipped.
|
|
66856
|
-
Standard scan flags such as ${highlighter.info("--scope")}, ${highlighter.info("--project")}, ${highlighter.info("--verbose")}, and ${highlighter.info("--json")} still work.
|
|
66857
|
-
`;
|
|
66858
66482
|
const renderCiHelpEpilog = () => `
|
|
66859
66483
|
${highlighter.dim("Examples:")}
|
|
66860
66484
|
${formatExampleLines([
|
|
@@ -66876,7 +66500,6 @@ ${highlighter.dim("Learn more:")}
|
|
|
66876
66500
|
const collectCategoryOption = (value, previousValues) => [...previousValues ?? [], value];
|
|
66877
66501
|
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);
|
|
66878
66502
|
program.action(inspectAction);
|
|
66879
|
-
program.command("design [directory]").description("Run only the focused UI design diagnostics").addHelpText("after", renderDesignHelpEpilog).action((directory, _options, command) => designAction(directory ?? ".", command.optsWithGlobals()));
|
|
66880
66503
|
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));
|
|
66881
66504
|
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);
|
|
66882
66505
|
const providerOption = ["--provider <name>", "ci provider: github-actions or gitlab-ci (auto-detected by default)"];
|
|
@@ -66925,4 +66548,4 @@ Promise.resolve().then(() => assertNoRemovedFlags(process.argv)).then(() => prog
|
|
|
66925
66548
|
export {};
|
|
66926
66549
|
|
|
66927
66550
|
//# sourceMappingURL=cli.js.map
|
|
66928
|
-
//# debugId=
|
|
66551
|
+
//# debugId=81bdc95e-12f2-565f-a05c-7b8a60a98f81
|