react-doctor 0.8.1-dev.af33723 → 0.8.1-dev.b4556e3
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 +140 -549
- package/dist/index.d.ts +0 -29
- package/dist/index.js +96 -458
- package/dist/lsp.js +96 -458
- package/dist/skills/react-doctor/SKILL.md +0 -5
- package/package.json +4 -4
package/dist/cli.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
|
|
2
|
-
!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="
|
|
2
|
+
!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="f6c63ef7-3eca-54f6-80d8-221d85cea09b")}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
|
};
|
|
@@ -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,9 +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 trimmed =
|
|
36841
|
+
const parseTailwindMajorMinor = (tailwindVersion) => {
|
|
36842
|
+
if (typeof tailwindVersion !== "string") return null;
|
|
36843
|
+
const trimmed = tailwindVersion.trim();
|
|
36878
36844
|
if (trimmed.length === 0) return null;
|
|
36879
36845
|
const lowerBound = parseLowerBoundVersion(trimmed);
|
|
36880
36846
|
if (lowerBound === null || lowerBound.major <= 0) return null;
|
|
@@ -36883,7 +36849,6 @@ const parseDependencyMajorMinor = (dependencyVersion) => {
|
|
|
36883
36849
|
minor: lowerBound.minor
|
|
36884
36850
|
};
|
|
36885
36851
|
};
|
|
36886
|
-
const parseTailwindMajorMinor = (tailwindVersion) => parseDependencyMajorMinor(tailwindVersion);
|
|
36887
36852
|
const hasUpperBoundOnlyPeerRange = (range) => {
|
|
36888
36853
|
if (typeof range !== "string") return false;
|
|
36889
36854
|
const normalizedRange = normalizeDependencyVersion(range);
|
|
@@ -37136,6 +37101,19 @@ const getPreactVersion = (packageJson) => {
|
|
|
37136
37101
|
...packageJson.devDependencies
|
|
37137
37102
|
}.preact ?? null;
|
|
37138
37103
|
};
|
|
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
|
+
};
|
|
37139
37117
|
const resolveCatalogBackedDependencyVersion = ({ rootDirectory, rootPackageJson, packageName, version }) => {
|
|
37140
37118
|
if (version === null || !isCatalogReference(version)) return version;
|
|
37141
37119
|
const catalogName = extractCatalogName(version);
|
|
@@ -37338,60 +37316,7 @@ const listWorkspacePackages = (rootDirectory) => {
|
|
|
37338
37316
|
}
|
|
37339
37317
|
return packages;
|
|
37340
37318
|
};
|
|
37341
|
-
const getPreferredDependencyVersion = ({ packageJson, packageNames }) => {
|
|
37342
|
-
const allDependencies = {
|
|
37343
|
-
...packageJson.devDependencies,
|
|
37344
|
-
...packageJson.peerDependencies,
|
|
37345
|
-
...packageJson.dependencies
|
|
37346
|
-
};
|
|
37347
|
-
for (const packageName of packageNames) {
|
|
37348
|
-
const version = allDependencies[packageName];
|
|
37349
|
-
if (version !== void 0) return version;
|
|
37350
|
-
}
|
|
37351
|
-
return null;
|
|
37352
|
-
};
|
|
37353
|
-
const TANSTACK_REACT_QUERY_PACKAGES = ["@tanstack/react-query", "react-query"];
|
|
37354
|
-
const getTanStackQueryVersion = (packageJson) => {
|
|
37355
|
-
return getPreferredDependencyVersion({
|
|
37356
|
-
packageJson,
|
|
37357
|
-
packageNames: TANSTACK_REACT_QUERY_PACKAGES
|
|
37358
|
-
});
|
|
37359
|
-
};
|
|
37360
|
-
const STYLED_COMPONENTS_PACKAGES = ["styled-components"];
|
|
37361
|
-
const getStyledComponentsVersion = (packageJson) => {
|
|
37362
|
-
return getPreferredDependencyVersion({
|
|
37363
|
-
packageJson,
|
|
37364
|
-
packageNames: STYLED_COMPONENTS_PACKAGES
|
|
37365
|
-
});
|
|
37366
|
-
};
|
|
37367
|
-
const I18N_PACKAGES = [
|
|
37368
|
-
"i18next",
|
|
37369
|
-
"react-i18next",
|
|
37370
|
-
"next-i18next",
|
|
37371
|
-
"react-intl",
|
|
37372
|
-
"next-intl",
|
|
37373
|
-
"use-intl",
|
|
37374
|
-
"@formatjs/intl",
|
|
37375
|
-
"@lingui/core",
|
|
37376
|
-
"@lingui/react",
|
|
37377
|
-
"typesafe-i18n",
|
|
37378
|
-
"@tolgee/react",
|
|
37379
|
-
"react-intl-universal"
|
|
37380
|
-
];
|
|
37381
|
-
const hasI18nDependency = (packageJson) => {
|
|
37382
|
-
const allDependencies = {
|
|
37383
|
-
...packageJson.peerDependencies,
|
|
37384
|
-
...packageJson.dependencies,
|
|
37385
|
-
...packageJson.devDependencies,
|
|
37386
|
-
...packageJson.optionalDependencies
|
|
37387
|
-
};
|
|
37388
|
-
return I18N_PACKAGES.some((packageName) => allDependencies[packageName] !== void 0);
|
|
37389
|
-
};
|
|
37390
37319
|
const REANIMATED_DEPENDENCY_NAME = "react-native-reanimated";
|
|
37391
|
-
const MOBX_REACT_PACKAGE_NAME = "mobx-react";
|
|
37392
|
-
const MOBX_REACT_LITE_PACKAGE_NAME = "mobx-react-lite";
|
|
37393
|
-
const MOBX_STATE_TREE_PACKAGE_NAME = "mobx-state-tree";
|
|
37394
|
-
const MOBX_REACT_OBSERVER_PACKAGE_NAME = "mobx-react-observer";
|
|
37395
37320
|
const SHOPIFY_FLASH_LIST_PACKAGE_NAME = "@shopify/flash-list";
|
|
37396
37321
|
const resolveWorkspaceDependencyVersion = ({ concreteVersion, packageName, rootDirectory, rootPackageJson, sections, workspaceDirectory, workspacePackageJson }) => {
|
|
37397
37322
|
const dependencyDeclaration = getDependencyDeclaration({
|
|
@@ -37410,62 +37335,7 @@ const shouldReplaceReactVersion = (currentVersion, nextVersion) => {
|
|
|
37410
37335
|
if (nextMajor === null) return false;
|
|
37411
37336
|
return nextMajor < currentMajor;
|
|
37412
37337
|
};
|
|
37413
|
-
const
|
|
37414
|
-
if (currentFact.version === null) return true;
|
|
37415
|
-
if (nextFact.version === null) return false;
|
|
37416
|
-
const currentMajor = getLowestDependencyMajor(currentFact.version);
|
|
37417
|
-
const nextMajor = getLowestDependencyMajor(nextFact.version);
|
|
37418
|
-
if (currentMajor === null) return false;
|
|
37419
|
-
if (nextMajor === null) return true;
|
|
37420
|
-
if (currentMajor > latestSupportedMajor) return false;
|
|
37421
|
-
if (nextMajor > latestSupportedMajor) return true;
|
|
37422
|
-
return nextMajor < currentMajor;
|
|
37423
|
-
};
|
|
37424
|
-
const shouldReplaceStyledComponentsVersion = (currentVersion, nextVersion) => {
|
|
37425
|
-
if (!currentVersion) return true;
|
|
37426
|
-
const currentMajor = getLowestDependencyMajor(currentVersion);
|
|
37427
|
-
const nextMajor = getLowestDependencyMajor(nextVersion);
|
|
37428
|
-
if (currentMajor === null) return nextMajor !== null && nextMajor < 6;
|
|
37429
|
-
if (nextMajor === null) return currentMajor >= 6;
|
|
37430
|
-
return nextMajor < currentMajor;
|
|
37431
|
-
};
|
|
37432
|
-
const selectOldestDependencyVersion = (currentVersion, nextVersion) => {
|
|
37433
|
-
if (currentVersion === null || nextVersion === null) return null;
|
|
37434
|
-
const current = parseDependencyMajorMinor(currentVersion);
|
|
37435
|
-
const next = parseDependencyMajorMinor(nextVersion);
|
|
37436
|
-
if (current === null) return currentVersion;
|
|
37437
|
-
if (next === null) return nextVersion;
|
|
37438
|
-
if (next.major !== current.major) return next.major < current.major ? nextVersion : currentVersion;
|
|
37439
|
-
return next.minor < current.minor ? nextVersion : currentVersion;
|
|
37440
|
-
};
|
|
37441
|
-
const shouldReplaceMobxFact = (currentFact, nextFact) => {
|
|
37442
|
-
if (currentFact.sourceDirectory === null) return true;
|
|
37443
|
-
if (currentFact.version === null) return false;
|
|
37444
|
-
if (nextFact.version === null) return true;
|
|
37445
|
-
const currentMajor = getDependencyMajorWithinSupportedRange(currentFact.version, 6);
|
|
37446
|
-
const nextMajor = getDependencyMajorWithinSupportedRange(nextFact.version, 6);
|
|
37447
|
-
if (currentMajor === null) return false;
|
|
37448
|
-
if (nextMajor === null) return true;
|
|
37449
|
-
return selectOldestDependencyVersion(currentFact.version, nextFact.version) === nextFact.version;
|
|
37450
|
-
};
|
|
37451
|
-
const collectBindingVersion = (facts, packageJson, directory, packageName) => {
|
|
37452
|
-
const version = getDependencySpec(packageJson, packageName);
|
|
37453
|
-
if (version === null) return;
|
|
37454
|
-
const resolvedVersion = resolveCatalogBackedDependencyVersion({
|
|
37455
|
-
rootDirectory: directory,
|
|
37456
|
-
rootPackageJson: packageJson,
|
|
37457
|
-
packageName,
|
|
37458
|
-
version
|
|
37459
|
-
});
|
|
37460
|
-
if (packageName === MOBX_REACT_PACKAGE_NAME) {
|
|
37461
|
-
facts.mobxReactVersion = facts.hasMobxReact ? selectOldestDependencyVersion(facts.mobxReactVersion, resolvedVersion) : resolvedVersion;
|
|
37462
|
-
facts.hasMobxReact = true;
|
|
37463
|
-
return;
|
|
37464
|
-
}
|
|
37465
|
-
facts.mobxReactLiteVersion = facts.hasMobxReactLite ? selectOldestDependencyVersion(facts.mobxReactLiteVersion, resolvedVersion) : resolvedVersion;
|
|
37466
|
-
facts.hasMobxReactLite = true;
|
|
37467
|
-
};
|
|
37468
|
-
const evaluateManifestFacts = (facts, packageJson, directory, rootDirectory, rootPackageJson) => {
|
|
37338
|
+
const evaluateManifestFacts = (facts, packageJson, directory) => {
|
|
37469
37339
|
if (facts.expo.version === null) {
|
|
37470
37340
|
const spec = getDependencySpec(packageJson, "expo");
|
|
37471
37341
|
if (spec !== null) facts.expo = {
|
|
@@ -37487,74 +37357,13 @@ const evaluateManifestFacts = (facts, packageJson, directory, rootDirectory, roo
|
|
|
37487
37357
|
sourceDirectory: directory
|
|
37488
37358
|
};
|
|
37489
37359
|
}
|
|
37490
|
-
const mobxSpec = getDependencySpec(packageJson, "mobx");
|
|
37491
|
-
if (mobxSpec !== null) {
|
|
37492
|
-
const nextMobxFact = {
|
|
37493
|
-
version: resolveCatalogBackedDependencyVersion({
|
|
37494
|
-
rootDirectory: directory,
|
|
37495
|
-
rootPackageJson: packageJson,
|
|
37496
|
-
packageName: "mobx",
|
|
37497
|
-
version: mobxSpec
|
|
37498
|
-
}),
|
|
37499
|
-
sourceDirectory: directory
|
|
37500
|
-
};
|
|
37501
|
-
if (shouldReplaceMobxFact(facts.mobx, nextMobxFact)) facts.mobx = nextMobxFact;
|
|
37502
|
-
}
|
|
37503
|
-
collectBindingVersion(facts, packageJson, directory, MOBX_REACT_PACKAGE_NAME);
|
|
37504
|
-
collectBindingVersion(facts, packageJson, directory, MOBX_REACT_LITE_PACKAGE_NAME);
|
|
37505
|
-
facts.hasMobxStateTree = facts.hasMobxStateTree || getDependencySpec(packageJson, MOBX_STATE_TREE_PACKAGE_NAME) !== null;
|
|
37506
|
-
facts.hasMobxReactObserver = facts.hasMobxReactObserver || getDependencySpec(packageJson, MOBX_REACT_OBSERVER_PACKAGE_NAME) !== null;
|
|
37507
|
-
const zustandSpec = getDependencySpec(packageJson, "zustand");
|
|
37508
|
-
if (zustandSpec !== null) {
|
|
37509
|
-
const nextZustandFact = {
|
|
37510
|
-
version: resolveCatalogBackedDependencyVersion({
|
|
37511
|
-
rootDirectory: directory,
|
|
37512
|
-
rootPackageJson: packageJson,
|
|
37513
|
-
packageName: "zustand",
|
|
37514
|
-
version: zustandSpec
|
|
37515
|
-
}),
|
|
37516
|
-
sourceDirectory: directory
|
|
37517
|
-
};
|
|
37518
|
-
if (shouldReplaceSupportedDependencyFact(facts.zustand, nextZustandFact, 5)) facts.zustand = nextZustandFact;
|
|
37519
|
-
}
|
|
37520
37360
|
if (facts.reanimatedVersion === null) {
|
|
37521
37361
|
const spec = getDependencySpec(packageJson, REANIMATED_DEPENDENCY_NAME);
|
|
37522
37362
|
if (spec !== null) facts.reanimatedVersion = spec;
|
|
37523
37363
|
}
|
|
37524
|
-
if (facts.valtioVersion === null) {
|
|
37525
|
-
const spec = getDependencySpec(packageJson, "valtio");
|
|
37526
|
-
if (spec !== null) facts.valtioVersion = spec;
|
|
37527
|
-
}
|
|
37528
|
-
facts.tanstackQueryVersion ??= getTanStackQueryVersion(packageJson);
|
|
37529
|
-
const styledComponentsVersion = resolveCatalogBackedDependencyVersion({
|
|
37530
|
-
rootDirectory: directory,
|
|
37531
|
-
rootPackageJson: packageJson,
|
|
37532
|
-
packageName: "styled-components",
|
|
37533
|
-
version: getStyledComponentsVersion(packageJson)
|
|
37534
|
-
});
|
|
37535
|
-
if (styledComponentsVersion && shouldReplaceStyledComponentsVersion(facts.styledComponentsVersion, styledComponentsVersion)) facts.styledComponentsVersion = styledComponentsVersion;
|
|
37536
|
-
facts.hasI18nLibrary = facts.hasI18nLibrary || hasI18nDependency(packageJson);
|
|
37537
37364
|
facts.hasReactNativeAwarePackage = facts.hasReactNativeAwarePackage || isPackageJsonReactNativeAware(packageJson);
|
|
37538
37365
|
facts.hasReanimatedAwarePackage = facts.hasReanimatedAwarePackage || isPackageJsonReanimatedAware(packageJson);
|
|
37539
37366
|
facts.hasSsrDependency = facts.hasSsrDependency || isPackageJsonSsrAware(packageJson);
|
|
37540
|
-
const remotionSpec = getDependencySpec(packageJson, "remotion");
|
|
37541
|
-
if (remotionSpec !== null) {
|
|
37542
|
-
facts.hasRemotionDependency = true;
|
|
37543
|
-
const resolvedRemotionVersion = resolveCatalogBackedDependencyVersion({
|
|
37544
|
-
rootDirectory,
|
|
37545
|
-
rootPackageJson,
|
|
37546
|
-
packageName: "remotion",
|
|
37547
|
-
version: remotionSpec
|
|
37548
|
-
});
|
|
37549
|
-
const remotionMajorVersion = resolvedRemotionVersion === null ? null : getLowestDependencyMajor(resolvedRemotionVersion);
|
|
37550
|
-
if (remotionMajorVersion === null) {
|
|
37551
|
-
facts.hasUnknownRemotionVersion = true;
|
|
37552
|
-
facts.remotionVersion = null;
|
|
37553
|
-
} else if (!facts.hasUnknownRemotionVersion) {
|
|
37554
|
-
const currentRemotionMajorVersion = facts.remotionVersion === null ? null : getLowestDependencyMajor(facts.remotionVersion);
|
|
37555
|
-
if (currentRemotionMajorVersion === null || remotionMajorVersion < currentRemotionMajorVersion) facts.remotionVersion = resolvedRemotionVersion;
|
|
37556
|
-
}
|
|
37557
|
-
}
|
|
37558
37367
|
};
|
|
37559
37368
|
const collectWorkspaceFacts = (rootDirectory, rootPackageJson, { collectReactGroup }) => {
|
|
37560
37369
|
const facts = {
|
|
@@ -37574,33 +37383,12 @@ const collectWorkspaceFacts = (rootDirectory, rootPackageJson, { collectReactGro
|
|
|
37574
37383
|
version: null,
|
|
37575
37384
|
sourceDirectory: null
|
|
37576
37385
|
},
|
|
37577
|
-
valtioVersion: null,
|
|
37578
|
-
mobx: {
|
|
37579
|
-
version: null,
|
|
37580
|
-
sourceDirectory: null
|
|
37581
|
-
},
|
|
37582
|
-
hasMobxReact: false,
|
|
37583
|
-
mobxReactVersion: null,
|
|
37584
|
-
hasMobxReactLite: false,
|
|
37585
|
-
mobxReactLiteVersion: null,
|
|
37586
|
-
hasMobxStateTree: false,
|
|
37587
|
-
hasMobxReactObserver: false,
|
|
37588
|
-
zustand: {
|
|
37589
|
-
version: null,
|
|
37590
|
-
sourceDirectory: null
|
|
37591
|
-
},
|
|
37592
|
-
tanstackQueryVersion: null,
|
|
37593
|
-
styledComponentsVersion: null,
|
|
37594
|
-
hasI18nLibrary: false,
|
|
37595
37386
|
hasReactNativeAwarePackage: false,
|
|
37596
37387
|
hasReanimatedAwarePackage: false,
|
|
37597
37388
|
hasSsrDependency: false,
|
|
37598
|
-
hasRemotionDependency: false,
|
|
37599
|
-
hasUnknownRemotionVersion: false,
|
|
37600
|
-
remotionVersion: null,
|
|
37601
37389
|
reanimatedVersion: null
|
|
37602
37390
|
};
|
|
37603
|
-
evaluateManifestFacts(facts, rootPackageJson, rootDirectory
|
|
37391
|
+
evaluateManifestFacts(facts, rootPackageJson, rootDirectory);
|
|
37604
37392
|
let isReactGroupSettled = !collectReactGroup;
|
|
37605
37393
|
const visitedDirectories = /* @__PURE__ */ new Set();
|
|
37606
37394
|
for (const pattern of getWorkspacePatterns(rootDirectory, rootPackageJson)) {
|
|
@@ -37609,7 +37397,7 @@ const collectWorkspaceFacts = (rootDirectory, rootPackageJson, { collectReactGro
|
|
|
37609
37397
|
if (visitedDirectories.has(workspaceDirectory)) continue;
|
|
37610
37398
|
visitedDirectories.add(workspaceDirectory);
|
|
37611
37399
|
const workspacePackageJson = readPackageJson$1(Path.join(workspaceDirectory, "package.json"));
|
|
37612
|
-
evaluateManifestFacts(facts, workspacePackageJson, workspaceDirectory
|
|
37400
|
+
evaluateManifestFacts(facts, workspacePackageJson, workspaceDirectory);
|
|
37613
37401
|
const info = extractDependencyInfo(workspacePackageJson);
|
|
37614
37402
|
if (info.framework !== "unknown" && frameworkMergeRank(info.framework) < frameworkMergeRank(facts.framework)) facts.framework = info.framework;
|
|
37615
37403
|
if (isReactGroupSettled) continue;
|
|
@@ -37830,29 +37618,11 @@ const discoverProjectWithoutPackageJson = (directory) => {
|
|
|
37830
37618
|
tailwindVersion: null,
|
|
37831
37619
|
zodVersion: null,
|
|
37832
37620
|
zodMajorVersion: null,
|
|
37833
|
-
mobxVersion: null,
|
|
37834
|
-
mobxMajorVersion: null,
|
|
37835
|
-
hasMobxReact: false,
|
|
37836
|
-
mobxReactVersion: null,
|
|
37837
|
-
hasMobxReactLite: false,
|
|
37838
|
-
mobxReactLiteVersion: null,
|
|
37839
|
-
hasMobxStateTree: false,
|
|
37840
|
-
hasMobxReactObserver: false,
|
|
37841
|
-
zustandVersion: null,
|
|
37842
|
-
zustandMajorVersion: null,
|
|
37843
37621
|
framework: "unknown",
|
|
37844
37622
|
hasTypeScript: hasOwnTsConfig,
|
|
37845
37623
|
hasReactCompiler: false,
|
|
37846
37624
|
hasReactCompilerLintPlugin: false,
|
|
37847
37625
|
hasTanStackQuery: false,
|
|
37848
|
-
valtioVersion: null,
|
|
37849
|
-
valtioMajorVersion: null,
|
|
37850
|
-
hasRemotion: false,
|
|
37851
|
-
remotionVersion: null,
|
|
37852
|
-
remotionMajorVersion: null,
|
|
37853
|
-
hasI18nLibrary: false,
|
|
37854
|
-
tanstackQueryVersion: null,
|
|
37855
|
-
styledComponentsVersion: null,
|
|
37856
37626
|
hasSsrDependency: false,
|
|
37857
37627
|
preactVersion: null,
|
|
37858
37628
|
preactMajorVersion: null,
|
|
@@ -37951,12 +37721,6 @@ const discoverProject = (directory) => {
|
|
|
37951
37721
|
packageName: SHOPIFY_FLASH_LIST_PACKAGE_NAME,
|
|
37952
37722
|
version: workspaceFacts.shopifyFlashList.version
|
|
37953
37723
|
}) : null;
|
|
37954
|
-
const zustandVersion = resolveCatalogBackedDependencyVersion({
|
|
37955
|
-
rootDirectory: directory,
|
|
37956
|
-
rootPackageJson: packageJson,
|
|
37957
|
-
packageName: "zustand",
|
|
37958
|
-
version: workspaceFacts.zustand.version
|
|
37959
|
-
});
|
|
37960
37724
|
const hasReanimated = hasReactNativeWorkspace && workspaceFacts.hasReanimatedAwarePackage;
|
|
37961
37725
|
const reanimatedVersion = hasReanimated ? workspaceFacts.reanimatedVersion : null;
|
|
37962
37726
|
const nextjsVersion = framework === "nextjs" ? resolveCatalogBackedDependencyVersion({
|
|
@@ -37965,21 +37729,7 @@ const discoverProject = (directory) => {
|
|
|
37965
37729
|
packageName: "next",
|
|
37966
37730
|
version: workspaceFacts.next.version
|
|
37967
37731
|
}) : null;
|
|
37968
|
-
const valtioVersion = resolveCatalogBackedDependencyVersion({
|
|
37969
|
-
rootDirectory: directory,
|
|
37970
|
-
rootPackageJson: packageJson,
|
|
37971
|
-
packageName: "valtio",
|
|
37972
|
-
version: workspaceFacts.valtioVersion
|
|
37973
|
-
});
|
|
37974
|
-
const mobxVersion = resolveCatalogBackedDependencyVersion({
|
|
37975
|
-
rootDirectory: directory,
|
|
37976
|
-
rootPackageJson: packageJson,
|
|
37977
|
-
packageName: "mobx",
|
|
37978
|
-
version: workspaceFacts.mobx.version
|
|
37979
|
-
});
|
|
37980
37732
|
const preactVersion = getPreactVersion(packageJson);
|
|
37981
|
-
const remotionVersion = workspaceFacts.remotionVersion;
|
|
37982
|
-
const tanstackQueryVersion = getTanStackQueryVersion(packageJson) ?? workspaceFacts.tanstackQueryVersion;
|
|
37983
37733
|
const isPreES2023Target = hasTypeScript && detectPreES2023Target(directory);
|
|
37984
37734
|
const projectInfo = {
|
|
37985
37735
|
rootDirectory: directory,
|
|
@@ -37989,29 +37739,11 @@ const discoverProject = (directory) => {
|
|
|
37989
37739
|
tailwindVersion,
|
|
37990
37740
|
zodVersion,
|
|
37991
37741
|
zodMajorVersion: zodVersion === null ? null : getLowestDependencyMajor(zodVersion),
|
|
37992
|
-
mobxVersion,
|
|
37993
|
-
mobxMajorVersion: mobxVersion === null ? null : getDependencyMajorWithinSupportedRange(mobxVersion, 6),
|
|
37994
|
-
hasMobxReact: workspaceFacts.hasMobxReact,
|
|
37995
|
-
mobxReactVersion: workspaceFacts.mobxReactVersion,
|
|
37996
|
-
hasMobxReactLite: workspaceFacts.hasMobxReactLite,
|
|
37997
|
-
mobxReactLiteVersion: workspaceFacts.mobxReactLiteVersion,
|
|
37998
|
-
hasMobxStateTree: workspaceFacts.hasMobxStateTree,
|
|
37999
|
-
hasMobxReactObserver: workspaceFacts.hasMobxReactObserver,
|
|
38000
|
-
zustandVersion,
|
|
38001
|
-
zustandMajorVersion: zustandVersion === null ? null : getLowestDependencyMajor(zustandVersion),
|
|
38002
37742
|
framework,
|
|
38003
37743
|
hasTypeScript,
|
|
38004
37744
|
hasReactCompiler: detectReactCompiler(directory, packageJson),
|
|
38005
37745
|
hasReactCompilerLintPlugin: detectReactCompilerLintPlugin(directory, packageJson),
|
|
38006
|
-
hasTanStackQuery:
|
|
38007
|
-
hasI18nLibrary: workspaceFacts.hasI18nLibrary,
|
|
38008
|
-
tanstackQueryVersion,
|
|
38009
|
-
styledComponentsVersion: workspaceFacts.styledComponentsVersion,
|
|
38010
|
-
valtioVersion,
|
|
38011
|
-
valtioMajorVersion: valtioVersion === null ? null : getLowestDependencyMajor(valtioVersion),
|
|
38012
|
-
hasRemotion: workspaceFacts.hasRemotionDependency,
|
|
38013
|
-
remotionVersion,
|
|
38014
|
-
remotionMajorVersion: remotionVersion === null ? null : getLowestDependencyMajor(remotionVersion),
|
|
37746
|
+
hasTanStackQuery: hasTanStackQuery(packageJson),
|
|
38015
37747
|
hasSsrDependency: workspaceFacts.hasSsrDependency,
|
|
38016
37748
|
preactVersion,
|
|
38017
37749
|
preactMajorVersion: parseReactMajor(preactVersion),
|
|
@@ -40566,25 +40298,9 @@ const BABEL_CONFIG_FILE_NAMES = [
|
|
|
40566
40298
|
".babelrc.json"
|
|
40567
40299
|
];
|
|
40568
40300
|
const LEGACY_PRESET_SPEC = "module:metro-react-native-babel-preset";
|
|
40569
|
-
const LEGACY_PRESET_PACKAGE = "metro-react-native-babel-preset";
|
|
40570
|
-
const REACT_NATIVE_PACKAGE = "react-native";
|
|
40571
|
-
const PRESET_RENAME_MINIMUM_REACT_NATIVE_VERSION = "0.73.0";
|
|
40572
|
-
const LEGACY_PRESET_REFERENCE = new RegExp(`['"]${LEGACY_PRESET_SPEC}['"]`);
|
|
40573
40301
|
const MODERN_PRESET_REFERENCE = new RegExp(`['"]module:@react-native/babel-preset['"]`);
|
|
40574
40302
|
const ENABLE_BABEL_RUNTIME_VERSION = /enableBabelRuntime["']?\s*:\s*['"]/;
|
|
40575
|
-
const isReactNativeVersionAtLeastPresetRename = (rootDirectory, packageJson) => {
|
|
40576
|
-
const installedReactNativeManifestPath = Path.join(rootDirectory, "node_modules", REACT_NATIVE_PACKAGE, "package.json");
|
|
40577
|
-
const reactNativeVersionSpec = (isFile(installedReactNativeManifestPath) ? readPackageJson$1(installedReactNativeManifestPath).version : void 0) ?? getDependencySpec(packageJson, REACT_NATIVE_PACKAGE);
|
|
40578
|
-
if (reactNativeVersionSpec === null || reactNativeVersionSpec === void 0) return false;
|
|
40579
|
-
const normalizedVersionRange = import_semver.validRange(reactNativeVersionSpec);
|
|
40580
|
-
if (normalizedVersionRange === null) return false;
|
|
40581
|
-
const minimumVersion = import_semver.minVersion(normalizedVersionRange);
|
|
40582
|
-
return minimumVersion !== null && import_semver.gte(minimumVersion, PRESET_RENAME_MINIMUM_REACT_NATIVE_VERSION);
|
|
40583
|
-
};
|
|
40584
|
-
const canResolveLegacyPreset = (rootDirectory, packageJson) => getDependencySpec(packageJson, LEGACY_PRESET_PACKAGE) !== null || isFile(Path.join(rootDirectory, "node_modules", LEGACY_PRESET_PACKAGE, "package.json"));
|
|
40585
40303
|
const checkReactNativeMetroBabelPreset = (rootDirectory) => {
|
|
40586
|
-
const packageJson = readPackageJson$1(Path.join(rootDirectory, "package.json"));
|
|
40587
|
-
const shouldReportLegacyPreset = isReactNativeVersionAtLeastPresetRename(rootDirectory, packageJson) && !canResolveLegacyPreset(rootDirectory, packageJson);
|
|
40588
40304
|
for (const fileName of BABEL_CONFIG_FILE_NAMES) {
|
|
40589
40305
|
const filePath = Path.join(rootDirectory, fileName);
|
|
40590
40306
|
if (!isFile(filePath)) continue;
|
|
@@ -40594,7 +40310,7 @@ const checkReactNativeMetroBabelPreset = (rootDirectory) => {
|
|
|
40594
40310
|
} catch {
|
|
40595
40311
|
continue;
|
|
40596
40312
|
}
|
|
40597
|
-
if (
|
|
40313
|
+
if (contents.includes(LEGACY_PRESET_SPEC)) return [buildReactNativeDiagnostic({
|
|
40598
40314
|
filePath: fileName,
|
|
40599
40315
|
rule: "rn-no-metro-babel-preset",
|
|
40600
40316
|
severity: "error",
|
|
@@ -40617,6 +40333,12 @@ const checkReactNativeProject = (rootDirectory, project) => {
|
|
|
40617
40333
|
return [...checkReactNativeMetroBabelPreset(rootDirectory), ...checkReactNativeLibraryDependencies(rootDirectory)];
|
|
40618
40334
|
};
|
|
40619
40335
|
const RULE_KEY = "no-vulnerable-react-server-components";
|
|
40336
|
+
const DEPENDENCY_SECTIONS = [
|
|
40337
|
+
"dependencies",
|
|
40338
|
+
"devDependencies",
|
|
40339
|
+
"peerDependencies",
|
|
40340
|
+
"optionalDependencies"
|
|
40341
|
+
];
|
|
40620
40342
|
const REACT_RSC_ADVISORIES_BY_MINOR = {
|
|
40621
40343
|
"19.0": {
|
|
40622
40344
|
rceFixedVersion: "19.0.1",
|
|
@@ -40663,13 +40385,20 @@ const enumerateWorkspaceDirectories = (workspaceRoot) => {
|
|
|
40663
40385
|
for (const pattern of patterns) for (const directory of resolveWorkspaceDirectories(workspaceRoot, pattern)) directories.add(directory);
|
|
40664
40386
|
return [...directories];
|
|
40665
40387
|
};
|
|
40388
|
+
const readDeclaredSpec = (packageJson, packageName) => {
|
|
40389
|
+
for (const section of DEPENDENCY_SECTIONS) {
|
|
40390
|
+
const spec = packageJson[section]?.[packageName];
|
|
40391
|
+
if (typeof spec === "string") return spec;
|
|
40392
|
+
}
|
|
40393
|
+
return null;
|
|
40394
|
+
};
|
|
40666
40395
|
const resolveVersionInDirectory = (directory, packageName, declaredSpecOverride) => {
|
|
40667
40396
|
const manifestPath = Path.join(directory, "node_modules", packageName, "package.json");
|
|
40668
40397
|
if (isFile(manifestPath)) {
|
|
40669
40398
|
const installedVersion = import_semver.valid(readPackageJson$1(manifestPath).version ?? null);
|
|
40670
40399
|
if (installedVersion !== null) return installedVersion;
|
|
40671
40400
|
}
|
|
40672
|
-
const candidateSpecs = [
|
|
40401
|
+
const candidateSpecs = [readDeclaredSpec(readPackageJson$1(Path.join(directory, "package.json")), packageName), declaredSpecOverride];
|
|
40673
40402
|
for (const spec of candidateSpecs) {
|
|
40674
40403
|
const pinnedVersion = spec === null ? null : import_semver.valid(spec);
|
|
40675
40404
|
if (pinnedVersion !== null) return pinnedVersion;
|
|
@@ -41337,68 +41066,21 @@ const buildCapabilities = (project) => {
|
|
|
41337
41066
|
if (CLIENT_ONLY_FRAMEWORKS.has(project.framework)) capabilities.add("client-only");
|
|
41338
41067
|
if (project.isStaticExport) capabilities.add("nextjs:static-export");
|
|
41339
41068
|
if (project.nextjsMajorVersion !== null && project.nextjsMajorVersion >= 15) capabilities.add("nextjs:15");
|
|
41340
|
-
if (project.nextjsMajorVersion !== null && project.nextjsMajorVersion >= 16) capabilities.add("nextjs:16");
|
|
41341
41069
|
addMajorLadder(capabilities, "react", project.reactMajorVersion, 17, 30);
|
|
41342
41070
|
if (project.reactMajorVersion !== null && project.reactMajorVersion >= 19 && isMajorMinorAtLeast(parseReactMajorMinor(project.reactVersion), {
|
|
41343
41071
|
major: 19,
|
|
41344
41072
|
minor: 2
|
|
41345
41073
|
})) capabilities.add("react:19.2");
|
|
41346
|
-
if (project.tailwindVersion !== null)
|
|
41347
|
-
|
|
41348
|
-
|
|
41349
|
-
|
|
41350
|
-
|
|
41351
|
-
minor: 4
|
|
41352
|
-
})) capabilities.add("tailwind:3.4");
|
|
41353
|
-
if (tailwindVersion !== null && isMajorMinorAtLeast(tailwindVersion, {
|
|
41354
|
-
major: 4,
|
|
41355
|
-
minor: 0
|
|
41356
|
-
})) capabilities.add("tailwind:4");
|
|
41357
|
-
}
|
|
41074
|
+
if (project.tailwindVersion !== null) capabilities.add("tailwind");
|
|
41075
|
+
if (project.tailwindVersion !== null && isMajorMinorAtLeast(parseTailwindMajorMinor(project.tailwindVersion), {
|
|
41076
|
+
major: 3,
|
|
41077
|
+
minor: 4
|
|
41078
|
+
})) capabilities.add("tailwind:3.4");
|
|
41358
41079
|
if (project.zodVersion !== null) capabilities.add("zod");
|
|
41359
41080
|
if (project.zodMajorVersion !== null && project.zodMajorVersion >= 4) capabilities.add("zod:4");
|
|
41360
|
-
if (project.mobxVersion !== void 0 && project.mobxVersion !== null || project.hasMobxReact === true || project.hasMobxReactLite === true || project.hasMobxStateTree === true || project.hasMobxReactObserver === true) capabilities.add("mobx");
|
|
41361
|
-
if (project.hasMobxReact === true) capabilities.add("mobx-react");
|
|
41362
|
-
if (project.hasMobxReactLite === true) capabilities.add("mobx-react-lite");
|
|
41363
|
-
if (project.hasMobxReact === true || project.hasMobxReactLite === true) capabilities.add("mobx-react-binding");
|
|
41364
|
-
const mobxReactVersion = parseDependencyMajorMinor(project.mobxReactVersion);
|
|
41365
|
-
const mobxReactLiteVersion = parseDependencyMajorMinor(project.mobxReactLiteVersion);
|
|
41366
|
-
const hasMobxReactObserverMemoGuard = mobxReactVersion !== null && isMajorMinorAtLeast(mobxReactVersion, {
|
|
41367
|
-
major: 7,
|
|
41368
|
-
minor: 3
|
|
41369
|
-
});
|
|
41370
|
-
const hasMobxReactLiteObserverMemoGuard = mobxReactLiteVersion !== null && isMajorMinorAtLeast(mobxReactLiteVersion, {
|
|
41371
|
-
major: 3,
|
|
41372
|
-
minor: 3
|
|
41373
|
-
});
|
|
41374
|
-
if (hasMobxReactObserverMemoGuard) capabilities.add("mobx-react-observer-memo-guard");
|
|
41375
|
-
if (hasMobxReactLiteObserverMemoGuard) capabilities.add("mobx-react-lite-observer-memo-guard");
|
|
41376
|
-
if (hasMobxReactObserverMemoGuard || hasMobxReactLiteObserverMemoGuard) capabilities.add("mobx-react-binding-observer-memo-guard");
|
|
41377
|
-
if (project.hasMobxStateTree === true) capabilities.add("mobx-state-tree");
|
|
41378
|
-
if (project.hasMobxReactObserver === true) capabilities.add("mobx-react-observer");
|
|
41379
|
-
if (project.mobxMajorVersion !== void 0 && project.mobxMajorVersion !== null && project.mobxMajorVersion >= 4 && project.mobxMajorVersion <= 6) addMajorLadder(capabilities, "mobx", project.mobxMajorVersion, 4, 6);
|
|
41380
|
-
const mobxVersion = parseDependencyMajorMinor(project.mobxVersion);
|
|
41381
|
-
if (project.mobxMajorVersion === 6 && mobxVersion !== null && isMajorMinorAtLeast(mobxVersion, {
|
|
41382
|
-
major: 6,
|
|
41383
|
-
minor: 10
|
|
41384
|
-
})) capabilities.add("mobx:6.10");
|
|
41385
|
-
if (project.zustandVersion !== void 0 && project.zustandVersion !== null) capabilities.add("zustand");
|
|
41386
|
-
if (project.zustandMajorVersion !== void 0 && project.zustandMajorVersion !== null && project.zustandMajorVersion >= 1 && project.zustandMajorVersion <= 5) addMajorLadder(capabilities, "zustand", project.zustandMajorVersion, 1, 5);
|
|
41387
41081
|
if (project.isPreES2023Target) capabilities.add("pre-es2023");
|
|
41388
41082
|
if (project.hasReactCompiler) capabilities.add("react-compiler");
|
|
41389
|
-
if (
|
|
41390
|
-
if (project.styledComponentsVersion) {
|
|
41391
|
-
capabilities.add("styled-components");
|
|
41392
|
-
const styledComponentsMajor = getLowestDependencyMajor(project.styledComponentsVersion);
|
|
41393
|
-
if (styledComponentsMajor !== null && styledComponentsMajor >= 6) capabilities.add("styled-components:6");
|
|
41394
|
-
}
|
|
41395
|
-
if (project.hasI18nLibrary) capabilities.add("i18n");
|
|
41396
|
-
if (project.valtioVersion !== null) capabilities.add("valtio");
|
|
41397
|
-
addMajorLadder(capabilities, "valtio", project.valtioMajorVersion, 1, 10);
|
|
41398
|
-
if (project.hasRemotion) {
|
|
41399
|
-
capabilities.add("remotion");
|
|
41400
|
-
addMajorLadder(capabilities, "remotion", project.remotionMajorVersion ?? null, 4, 30);
|
|
41401
|
-
}
|
|
41083
|
+
if (project.hasTanStackQuery) capabilities.add("tanstack-query");
|
|
41402
41084
|
if (project.hasTypeScript) capabilities.add("typescript");
|
|
41403
41085
|
if (project.preactVersion !== null) capabilities.add("preact");
|
|
41404
41086
|
addMajorLadder(capabilities, "preact", project.preactMajorVersion, 10, 20);
|
|
@@ -41413,7 +41095,7 @@ const getCapabilities = (project) => {
|
|
|
41413
41095
|
capabilitiesByProject.set(project, capabilities);
|
|
41414
41096
|
return capabilities;
|
|
41415
41097
|
};
|
|
41416
|
-
const shouldEnableRule = (requires, tags, capabilities, ignoredTags, disabledWhen
|
|
41098
|
+
const shouldEnableRule = (requires, tags, capabilities, ignoredTags, disabledWhen) => {
|
|
41417
41099
|
if (requires) {
|
|
41418
41100
|
for (const capability of requires) if (!capabilities.has(capability)) return false;
|
|
41419
41101
|
}
|
|
@@ -41424,29 +41106,20 @@ const shouldEnableRule = (requires, tags, capabilities, ignoredTags, disabledWhe
|
|
|
41424
41106
|
if (tags) {
|
|
41425
41107
|
for (const tag of tags) if (ignoredTags.has(tag)) return false;
|
|
41426
41108
|
}
|
|
41427
|
-
if (includedTags && includedTags.size > 0) {
|
|
41428
|
-
if (!tags?.some((tag) => includedTags.has(tag))) return false;
|
|
41429
|
-
}
|
|
41430
41109
|
return true;
|
|
41431
41110
|
};
|
|
41432
|
-
const shouldEnableRuleByDefaultStatus = (options) => options.defaultEnabled !== false || options.hasExplicitOverride === true || options.includeTagDefaults && options.hasIncludedTags;
|
|
41433
41111
|
const yieldToEventLoop = () => new Promise((resolve) => {
|
|
41434
41112
|
setImmediate(resolve);
|
|
41435
41113
|
});
|
|
41436
41114
|
const createSecurityScanSession = (rootDirectory, options) => {
|
|
41437
41115
|
const capabilities = options.project ? getCapabilities(options.project) : /* @__PURE__ */ new Set();
|
|
41438
41116
|
const ignoredTags = options.ignoredTags ?? /* @__PURE__ */ new Set();
|
|
41439
|
-
const includedTags = options.includedTags ?? /* @__PURE__ */ new Set();
|
|
41440
41117
|
const enabledScanRules = REACT_DOCTOR_RULES.flatMap((entry) => {
|
|
41441
41118
|
const rule = entry.rule;
|
|
41442
41119
|
const scan = rule.scan;
|
|
41443
41120
|
if (typeof scan !== "function") return [];
|
|
41444
|
-
if (
|
|
41445
|
-
|
|
41446
|
-
includeTagDefaults: options.includeTagDefaults === true,
|
|
41447
|
-
hasIncludedTags: includedTags.size > 0
|
|
41448
|
-
})) return [];
|
|
41449
|
-
if (!shouldEnableRule(rule.requires, rule.tags, capabilities, ignoredTags, rule.disabledWhen, includedTags)) return [];
|
|
41121
|
+
if (rule.defaultEnabled === false) return [];
|
|
41122
|
+
if (!shouldEnableRule(rule.requires, rule.tags, capabilities, ignoredTags, rule.disabledWhen)) return [];
|
|
41450
41123
|
return [{
|
|
41451
41124
|
entry,
|
|
41452
41125
|
scan,
|
|
@@ -43448,9 +43121,8 @@ const buildUserPluginRules = (userPlugin, severityControls) => {
|
|
|
43448
43121
|
}
|
|
43449
43122
|
return enabled;
|
|
43450
43123
|
};
|
|
43451
|
-
const createOxlintConfig = ({ pluginPath, project, customRulesOnly = false, extendsPaths = [], ignoredTags = /* @__PURE__ */ new Set(),
|
|
43452
|
-
const
|
|
43453
|
-
const reactHooksJsPlugin = disableReactHooksJsPlugin || ruleSelection === "sidecar" || hasIncludedTags ? null : resolveReactHooksJsPlugin(project.hasReactCompiler || project.hasReactCompilerLintPlugin === true, customRulesOnly);
|
|
43124
|
+
const createOxlintConfig = ({ pluginPath, project, customRulesOnly = false, extendsPaths = [], ignoredTags = /* @__PURE__ */ new Set(), serverAuthFunctionNames, severityControls, userPlugins = [], disableReactHooksJsPlugin = false, ruleSelection, sidecarRuleIdFilter }) => {
|
|
43125
|
+
const reactHooksJsPlugin = disableReactHooksJsPlugin || ruleSelection === "sidecar" ? null : resolveReactHooksJsPlugin(project.hasReactCompiler || project.hasReactCompilerLintPlugin === true, customRulesOnly);
|
|
43454
43126
|
const reactCompilerRules = reactHooksJsPlugin ? applyRuleSeverityControls(filterRulesToAvailable(REACT_COMPILER_RULES, "react-hooks-js", reactHooksJsPlugin.availableRuleNames), severityControls) : {};
|
|
43455
43127
|
const jsPlugins = [];
|
|
43456
43128
|
if (reactHooksJsPlugin) jsPlugins.push(reactHooksJsPlugin.entry);
|
|
@@ -43465,14 +43137,9 @@ const createOxlintConfig = ({ pluginPath, project, customRulesOnly = false, exte
|
|
|
43465
43137
|
if (rule.scan !== void 0) continue;
|
|
43466
43138
|
if (customRulesOnly && registryEntry.originallyExternal) continue;
|
|
43467
43139
|
if (rule.framework !== "global" && !rule.requires) continue;
|
|
43468
|
-
if (!shouldEnableRule(rule.requires, rule.tags, capabilities, ignoredTags, rule.disabledWhen
|
|
43140
|
+
if (!shouldEnableRule(rule.requires, rule.tags, capabilities, ignoredTags, rule.disabledWhen)) continue;
|
|
43469
43141
|
const explicitRuleOverride = resolveRuleSeverityOverride({ ruleKey: registryEntry.key }, severityControls);
|
|
43470
|
-
if (
|
|
43471
|
-
defaultEnabled: rule.defaultEnabled,
|
|
43472
|
-
includeTagDefaults,
|
|
43473
|
-
hasIncludedTags,
|
|
43474
|
-
hasExplicitOverride: explicitRuleOverride !== void 0
|
|
43475
|
-
})) continue;
|
|
43142
|
+
if (rule.defaultEnabled === false && explicitRuleOverride === void 0) continue;
|
|
43476
43143
|
const severity = resolveRuleSeverityOverride({
|
|
43477
43144
|
ruleKey: registryEntry.key,
|
|
43478
43145
|
category: rule.category
|
|
@@ -43481,7 +43148,7 @@ const createOxlintConfig = ({ pluginPath, project, customRulesOnly = false, exte
|
|
|
43481
43148
|
enabledReactDoctorRules[registryEntry.key] = severity;
|
|
43482
43149
|
}
|
|
43483
43150
|
const userPluginRules = {};
|
|
43484
|
-
if (ruleSelection !== "sidecar"
|
|
43151
|
+
if (ruleSelection !== "sidecar") for (const userPlugin of userPlugins) {
|
|
43485
43152
|
Object.assign(userPluginRules, buildUserPluginRules(userPlugin, severityControls));
|
|
43486
43153
|
jsPlugins.push(userPlugin.entry);
|
|
43487
43154
|
}
|
|
@@ -43698,19 +43365,6 @@ const createSidecarLintCache = (cacheDirectory, rulesetHash) => {
|
|
|
43698
43365
|
}
|
|
43699
43366
|
};
|
|
43700
43367
|
};
|
|
43701
|
-
const fingerprintCacheByFilePath = /* @__PURE__ */ new Map();
|
|
43702
|
-
const fingerprintFileContents = (filePath, fingerprintLength) => {
|
|
43703
|
-
const fileStats = NFS.statSync(filePath, { bigint: true });
|
|
43704
|
-
const cachedFingerprint = fingerprintCacheByFilePath.get(filePath);
|
|
43705
|
-
if (cachedFingerprint?.modifiedTimeNanoseconds === fileStats.mtimeNs && cachedFingerprint.sizeBytes === fileStats.size) return cachedFingerprint.fingerprint;
|
|
43706
|
-
const fingerprint = crypto.createHash("sha256").update(NFS.readFileSync(filePath)).digest("hex").slice(0, fingerprintLength);
|
|
43707
|
-
fingerprintCacheByFilePath.set(filePath, {
|
|
43708
|
-
fingerprint,
|
|
43709
|
-
modifiedTimeNanoseconds: fileStats.mtimeNs,
|
|
43710
|
-
sizeBytes: fileStats.size
|
|
43711
|
-
});
|
|
43712
|
-
return fingerprint;
|
|
43713
|
-
};
|
|
43714
43368
|
const bundledRequire$3 = createRequire(import.meta.url);
|
|
43715
43369
|
const childNodeVersionByBinaryPath = /* @__PURE__ */ new Map();
|
|
43716
43370
|
const resolveChildNodeVersion = (nodeBinaryPath) => {
|
|
@@ -43734,13 +43388,6 @@ const TOOLCHAIN_PACKAGE_SPECIFIERS$1 = [
|
|
|
43734
43388
|
"oxlint-plugin-react-doctor/package.json",
|
|
43735
43389
|
"eslint-plugin-react-hooks/package.json"
|
|
43736
43390
|
];
|
|
43737
|
-
const resolvePluginFingerprint = () => {
|
|
43738
|
-
try {
|
|
43739
|
-
return fingerprintFileContents(bundledRequire$3.resolve("oxlint-plugin-react-doctor"), 16);
|
|
43740
|
-
} catch {
|
|
43741
|
-
return "unresolved";
|
|
43742
|
-
}
|
|
43743
|
-
};
|
|
43744
43391
|
const resolveOxlintToolchainVersions = (nodeBinaryPath = process.execPath) => {
|
|
43745
43392
|
const versions = [`node=${resolveChildNodeVersion(nodeBinaryPath)}`];
|
|
43746
43393
|
for (const specifier of TOOLCHAIN_PACKAGE_SPECIFIERS$1) try {
|
|
@@ -43750,7 +43397,6 @@ const resolveOxlintToolchainVersions = (nodeBinaryPath = process.execPath) => {
|
|
|
43750
43397
|
} catch {
|
|
43751
43398
|
versions.push(`${specifier}=missing`);
|
|
43752
43399
|
}
|
|
43753
|
-
versions.push(`oxlint-plugin-react-doctor#fingerprint=${resolvePluginFingerprint()}`);
|
|
43754
43400
|
return versions;
|
|
43755
43401
|
};
|
|
43756
43402
|
const esmRequire = createRequire(import.meta.url);
|
|
@@ -45226,7 +44872,7 @@ const reactHooksJsPluginDropNote = (error) => {
|
|
|
45226
44872
|
* 6. always restore disable directives + clean up the temp dir
|
|
45227
44873
|
*/
|
|
45228
44874
|
const runOxlint = async (options) => {
|
|
45229
|
-
const { rootDirectory, project, includePaths, nodeBinaryPath = process.execPath, customRulesOnly = false, respectInlineDisables = true, adoptExistingLintConfig = true, ignoredTags = /* @__PURE__ */ new Set(),
|
|
44875
|
+
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;
|
|
45230
44876
|
const serverAuthFunctionNames = Array.isArray(userConfig?.serverAuthFunctionNames) ? userConfig.serverAuthFunctionNames.filter((entry) => typeof entry === "string" && entry.length > 0) : void 0;
|
|
45231
44877
|
const severityControls = buildRuleSeverityControls(userConfig);
|
|
45232
44878
|
validateRuleRegistration();
|
|
@@ -45240,15 +44886,13 @@ const runOxlint = async (options) => {
|
|
|
45240
44886
|
}
|
|
45241
44887
|
const pluginPath = resolvePluginPath();
|
|
45242
44888
|
const extendsPaths = (adoptExistingLintConfig && !customRulesOnly ? detectUserLintConfigPaths(rootDirectory) : []).filter(canOxlintExtendConfig);
|
|
45243
|
-
const userPlugins =
|
|
44889
|
+
const userPlugins = resolveUserPlugins(userConfig?.plugins, configSourceDirectory);
|
|
45244
44890
|
const buildConfig = (overrides) => createOxlintConfig({
|
|
45245
44891
|
pluginPath,
|
|
45246
44892
|
project,
|
|
45247
44893
|
customRulesOnly,
|
|
45248
44894
|
extendsPaths: overrides.extendsPaths,
|
|
45249
44895
|
ignoredTags,
|
|
45250
|
-
includedTags,
|
|
45251
|
-
includeTagDefaults,
|
|
45252
44896
|
serverAuthFunctionNames,
|
|
45253
44897
|
severityControls,
|
|
45254
44898
|
userPlugins,
|
|
@@ -45637,8 +45281,6 @@ var Linter = class Linter extends Service()("react-doctor/Linter") {
|
|
|
45637
45281
|
respectInlineDisables: input.respectInlineDisables,
|
|
45638
45282
|
adoptExistingLintConfig: input.adoptExistingLintConfig,
|
|
45639
45283
|
ignoredTags: input.ignoredTags,
|
|
45640
|
-
includedTags: input.includedTags,
|
|
45641
|
-
includeTagDefaults: input.includeTagDefaults,
|
|
45642
45284
|
userConfig: input.userConfig ?? null,
|
|
45643
45285
|
configSourceDirectory: input.configSourceDirectory,
|
|
45644
45286
|
onPartialFailure: (reason) => {
|
|
@@ -46487,9 +46129,7 @@ const runInspect = (input, hooks = {}) => gen(function* () {
|
|
|
46487
46129
|
const securityScanFailedRef = yield* make$13(false);
|
|
46488
46130
|
const securityScanFiber = yield* forkChild(runCollect(applyPerElementPipeline(isDiffMode ? empty$4 : unwrap(tryPromise(() => checkSecurityScanCooperative(scanDirectory, {
|
|
46489
46131
|
project,
|
|
46490
|
-
ignoredTags: input.ignoredTags
|
|
46491
|
-
includedTags: input.includedTags,
|
|
46492
|
-
includeTagDefaults: input.includeTagDefaults
|
|
46132
|
+
ignoredTags: input.ignoredTags
|
|
46493
46133
|
})).pipe(map$3((diagnostics) => fromIterable$1(diagnostics)), catch_$1(() => set(securityScanFailedRef, true).pipe(as(empty$4))))))).pipe(withSpan("SecurityScan.run")));
|
|
46494
46134
|
const shouldRunSupplyChain = !isDiffMode || (input.supplyChainManifestChanged ?? false);
|
|
46495
46135
|
const supplyChainOverlapTimeout = yield* SupplyChainOverlapTimeoutMs;
|
|
@@ -46580,8 +46220,6 @@ const runInspect = (input, hooks = {}) => gen(function* () {
|
|
|
46580
46220
|
respectInlineDisables: input.respectInlineDisables,
|
|
46581
46221
|
adoptExistingLintConfig: input.adoptExistingLintConfig,
|
|
46582
46222
|
ignoredTags: input.ignoredTags,
|
|
46583
|
-
includedTags: input.includedTags,
|
|
46584
|
-
includeTagDefaults: input.includeTagDefaults,
|
|
46585
46223
|
userConfig: resolvedConfig.config ?? void 0,
|
|
46586
46224
|
configSourceDirectory: resolvedConfig.configSourceDirectory ?? void 0,
|
|
46587
46225
|
onFileProgress: (scannedFileCount, totalFileCount) => {
|
|
@@ -47726,7 +47364,7 @@ const makeNoopConsole = () => ({
|
|
|
47726
47364
|
});
|
|
47727
47365
|
//#endregion
|
|
47728
47366
|
//#region src/cli/utils/version.ts
|
|
47729
|
-
const VERSION = "0.8.1-dev.
|
|
47367
|
+
const VERSION = "0.8.1-dev.b4556e3";
|
|
47730
47368
|
//#endregion
|
|
47731
47369
|
//#region src/cli/utils/json-mode.ts
|
|
47732
47370
|
let context = null;
|
|
@@ -47813,11 +47451,7 @@ const getRunId = () => {
|
|
|
47813
47451
|
};
|
|
47814
47452
|
//#endregion
|
|
47815
47453
|
//#region src/cli/utils/build-run-context.ts
|
|
47816
|
-
const ROOT_SUBCOMMANDS = new Set([
|
|
47817
|
-
"design",
|
|
47818
|
-
"install",
|
|
47819
|
-
"setup"
|
|
47820
|
-
]);
|
|
47454
|
+
const ROOT_SUBCOMMANDS = new Set(["install", "setup"]);
|
|
47821
47455
|
const detectInvokedVia = () => {
|
|
47822
47456
|
const userAgent = process.env.npm_config_user_agent;
|
|
47823
47457
|
if (!userAgent) return "unknown";
|
|
@@ -47901,9 +47535,7 @@ const buildSentryProjectContext = (projectInfo) => ({
|
|
|
47901
47535
|
reactMajorVersion: projectInfo.reactMajorVersion,
|
|
47902
47536
|
hasTypeScript: projectInfo.hasTypeScript,
|
|
47903
47537
|
hasReactCompiler: projectInfo.hasReactCompiler,
|
|
47904
|
-
|
|
47905
|
-
mobxVersion: projectInfo.mobxVersion,
|
|
47906
|
-
styledComponentsVersion: projectInfo.styledComponentsVersion,
|
|
47538
|
+
hasTanStackQuery: projectInfo.hasTanStackQuery,
|
|
47907
47539
|
tailwindVersion: projectInfo.tailwindVersion,
|
|
47908
47540
|
zodVersion: projectInfo.zodVersion,
|
|
47909
47541
|
preactVersion: projectInfo.preactVersion,
|
|
@@ -48084,13 +47716,13 @@ const isDevVersion = (version) => version === "0.0.0" || version.includes("-");
|
|
|
48084
47716
|
* uploads source-map artifacts under, so stack frames symbolicate. Honors the
|
|
48085
47717
|
* standard `SENTRY_RELEASE` override.
|
|
48086
47718
|
*/
|
|
48087
|
-
const resolveSentryRelease = () => process.env.SENTRY_RELEASE || `react-doctor@0.8.1-dev.
|
|
47719
|
+
const resolveSentryRelease = () => process.env.SENTRY_RELEASE || `react-doctor@0.8.1-dev.b4556e3`;
|
|
48088
47720
|
/**
|
|
48089
47721
|
* Deployment environment shown in Sentry's environment filter. Defaults to
|
|
48090
47722
|
* `production` for tagged releases and `development` for dev/unbuilt versions,
|
|
48091
47723
|
* overridable via the standard `SENTRY_ENVIRONMENT` env var.
|
|
48092
47724
|
*/
|
|
48093
|
-
const resolveSentryEnvironment = () => process.env.SENTRY_ENVIRONMENT || (isDevVersion("0.8.1-dev.
|
|
47725
|
+
const resolveSentryEnvironment = () => process.env.SENTRY_ENVIRONMENT || (isDevVersion("0.8.1-dev.b4556e3") ? "development" : "production");
|
|
48094
47726
|
/**
|
|
48095
47727
|
* Performance-tracing sample rate in `[0, 1]`. Reads `SENTRY_TRACES_SAMPLE_RATE`
|
|
48096
47728
|
* (set to `0` to disable tracing) and falls back to
|
|
@@ -60416,8 +60048,6 @@ const buildScanResultCacheKey = (input) => {
|
|
|
60416
60048
|
warnings: input.options.warnings,
|
|
60417
60049
|
adoptExistingLintConfig: input.options.adoptExistingLintConfig,
|
|
60418
60050
|
ignoredTags: [...input.options.ignoredTags].sort(),
|
|
60419
|
-
includedTags: [...input.options.includedTags].sort(),
|
|
60420
|
-
includeTagDefaults: input.options.includeTagDefaults,
|
|
60421
60051
|
concurrency: input.options.concurrency,
|
|
60422
60052
|
lintBatchOrdering: resolveLintBatchOrdering(),
|
|
60423
60053
|
baselineRef: input.options.baseline?.ref,
|
|
@@ -61244,8 +60874,8 @@ const createDiagnosticEvidenceReader = (rootDirectory, options = {}) => {
|
|
|
61244
60874
|
//#endregion
|
|
61245
60875
|
//#region src/cli/utils/build-no-score-message.ts
|
|
61246
60876
|
const ENTERPRISE_CONTACT_HINT = `Want something custom to your company? Contact us at ${ENTERPRISE_CONTACT_URL}.`;
|
|
61247
|
-
const buildNoScoreMessage = (isScoreDisabled
|
|
61248
|
-
return `${isScoreDisabled ?
|
|
60877
|
+
const buildNoScoreMessage = (isScoreDisabled) => {
|
|
60878
|
+
return `${isScoreDisabled ? "Score disabled by --no-score." : "Score unavailable (could not reach the score API)."} ${ENTERPRISE_CONTACT_HINT}`;
|
|
61249
60879
|
};
|
|
61250
60880
|
//#endregion
|
|
61251
60881
|
//#region src/cli/utils/render-agent-guidance.ts
|
|
@@ -62370,47 +62000,40 @@ const buildChangedLineMatcher = (directory, changedLineRanges) => {
|
|
|
62370
62000
|
return diagnosticIntersectsLineRanges(diagnostic, ranges);
|
|
62371
62001
|
};
|
|
62372
62002
|
};
|
|
62373
|
-
const buildIgnoredTags = (userConfig
|
|
62003
|
+
const buildIgnoredTags = (userConfig) => {
|
|
62374
62004
|
const tags = /* @__PURE__ */ new Set();
|
|
62375
62005
|
if (userConfig?.ignore?.tags) for (const tag of userConfig.ignore.tags) tags.add(tag);
|
|
62376
|
-
for (const tag of includedTags) tags.delete(tag);
|
|
62377
62006
|
return tags;
|
|
62378
62007
|
};
|
|
62379
|
-
const mergeInspectOptions = (inputOptions, userConfig) => {
|
|
62380
|
-
|
|
62381
|
-
|
|
62382
|
-
|
|
62383
|
-
|
|
62384
|
-
|
|
62385
|
-
|
|
62386
|
-
|
|
62387
|
-
|
|
62388
|
-
|
|
62389
|
-
|
|
62390
|
-
|
|
62391
|
-
|
|
62392
|
-
|
|
62393
|
-
|
|
62394
|
-
|
|
62395
|
-
|
|
62396
|
-
|
|
62397
|
-
|
|
62398
|
-
|
|
62399
|
-
|
|
62400
|
-
|
|
62401
|
-
|
|
62402
|
-
|
|
62403
|
-
|
|
62404
|
-
|
|
62405
|
-
|
|
62406
|
-
|
|
62407
|
-
|
|
62408
|
-
maxDurationMs: inputOptions.maxDurationMs ?? null,
|
|
62409
|
-
baseline: inputOptions.baseline ?? null,
|
|
62410
|
-
changedLineRanges: inputOptions.changedLineRanges ?? null,
|
|
62411
|
-
supplyChainManifestChanged: inputOptions.supplyChainManifestChanged ?? false
|
|
62412
|
-
};
|
|
62413
|
-
};
|
|
62008
|
+
const mergeInspectOptions = (inputOptions, userConfig) => ({
|
|
62009
|
+
lint: inputOptions.lint ?? userConfig?.lint ?? true,
|
|
62010
|
+
deadCode: inputOptions.deadCode ?? userConfig?.deadCode ?? true,
|
|
62011
|
+
supplyChain: inputOptions.supplyChain ?? userConfig?.supplyChain?.enabled ?? true,
|
|
62012
|
+
verbose: inputOptions.verbose ?? userConfig?.verbose ?? false,
|
|
62013
|
+
outputDirectory: inputOptions.outputDirectory || null,
|
|
62014
|
+
scoreOnly: inputOptions.scoreOnly ?? false,
|
|
62015
|
+
noScore: inputOptions.noScore ?? userConfig?.noScore ?? false,
|
|
62016
|
+
isCi: inputOptions.isCi ?? false,
|
|
62017
|
+
isCiOrCodingAgentEnvironment: isCiOrCodingAgentEnvironment(),
|
|
62018
|
+
isNonInteractiveEnvironment: isNonInteractiveEnvironment(),
|
|
62019
|
+
silent: inputOptions.silent ?? false,
|
|
62020
|
+
includePaths: inputOptions.includePaths ?? [],
|
|
62021
|
+
customRulesOnly: userConfig?.customRulesOnly ?? false,
|
|
62022
|
+
share: userConfig?.share ?? true,
|
|
62023
|
+
respectInlineDisables: inputOptions.respectInlineDisables ?? userConfig?.respectInlineDisables ?? true,
|
|
62024
|
+
warnings: inputOptions.warnings ?? userConfig?.warnings ?? true,
|
|
62025
|
+
categoryFilters: new Set(resolveCliCategories(inputOptions.categoryFilters) ?? []),
|
|
62026
|
+
adoptExistingLintConfig: userConfig?.adoptExistingLintConfig ?? true,
|
|
62027
|
+
ignoredTags: buildIgnoredTags(userConfig),
|
|
62028
|
+
outputSurface: inputOptions.outputSurface ?? "cli",
|
|
62029
|
+
suppressRendering: inputOptions.suppressRendering ?? false,
|
|
62030
|
+
concurrentScan: inputOptions.concurrentScan ?? false,
|
|
62031
|
+
concurrency: inputOptions.concurrency,
|
|
62032
|
+
maxDurationMs: inputOptions.maxDurationMs ?? null,
|
|
62033
|
+
baseline: inputOptions.baseline ?? null,
|
|
62034
|
+
changedLineRanges: inputOptions.changedLineRanges ?? null,
|
|
62035
|
+
supplyChainManifestChanged: inputOptions.supplyChainManifestChanged ?? false
|
|
62036
|
+
});
|
|
62414
62037
|
const deriveScope = (options) => {
|
|
62415
62038
|
if (options.baseline) return "changed";
|
|
62416
62039
|
if (options.changedLineRanges !== null) return "lines";
|
|
@@ -62541,8 +62164,6 @@ const runBaselineComparison = async (params) => {
|
|
|
62541
62164
|
warnings: params.options.warnings,
|
|
62542
62165
|
adoptExistingLintConfig: params.options.adoptExistingLintConfig,
|
|
62543
62166
|
ignoredTags: params.options.ignoredTags,
|
|
62544
|
-
includedTags: params.options.includedTags,
|
|
62545
|
-
includeTagDefaults: params.options.includeTagDefaults,
|
|
62546
62167
|
nodeBinaryPath: params.resolvedNodeBinaryPath ?? void 0,
|
|
62547
62168
|
runDeadCode: false,
|
|
62548
62169
|
isCi: params.options.isCi,
|
|
@@ -62636,8 +62257,6 @@ const runInspectWithRuntime = async (directory, options, userConfig, hasConfigOv
|
|
|
62636
62257
|
warnings: options.warnings,
|
|
62637
62258
|
adoptExistingLintConfig: options.adoptExistingLintConfig,
|
|
62638
62259
|
ignoredTags: options.ignoredTags,
|
|
62639
|
-
includedTags: options.includedTags,
|
|
62640
|
-
includeTagDefaults: options.includeTagDefaults,
|
|
62641
62260
|
nodeBinaryPath: resolvedNodeBinaryPath ?? void 0,
|
|
62642
62261
|
runDeadCode: options.deadCode,
|
|
62643
62262
|
isCi: options.isCi,
|
|
@@ -62826,7 +62445,7 @@ const finalizeAndRender = (input) => gen(function* () {
|
|
|
62826
62445
|
securityScanFailed
|
|
62827
62446
|
});
|
|
62828
62447
|
const hasSkippedChecks = skippedChecks.length > 0;
|
|
62829
|
-
const noScoreMessage = buildNoScoreMessage(options.noScore
|
|
62448
|
+
const noScoreMessage = buildNoScoreMessage(options.noScore);
|
|
62830
62449
|
const buildResult = () => ({
|
|
62831
62450
|
diagnostics: [...diagnostics],
|
|
62832
62451
|
score,
|
|
@@ -64931,25 +64550,21 @@ const resolveParallelFlag = (parallel) => parallel === false ? 1 : void 0;
|
|
|
64931
64550
|
*/
|
|
64932
64551
|
const resolveCliInspectOptions = (flags, userConfig) => {
|
|
64933
64552
|
const wantsWarningGate = pickBlockingLevel(flags, userConfig) === "warning";
|
|
64934
|
-
const isDesignScan = flags.design === true;
|
|
64935
64553
|
return {
|
|
64936
64554
|
lint: flags.lint,
|
|
64937
|
-
deadCode:
|
|
64938
|
-
supplyChain:
|
|
64555
|
+
deadCode: flags.deadCode,
|
|
64556
|
+
supplyChain: flags.supplyChain,
|
|
64939
64557
|
verbose: flags.verbose,
|
|
64940
64558
|
outputDirectory: flags.outputDir,
|
|
64941
64559
|
respectInlineDisables: flags.respectInlineDisables === false ? false : void 0,
|
|
64942
64560
|
warnings: wantsWarningGate ? true : flags.warnings,
|
|
64943
64561
|
scoreOnly: flags.score === true,
|
|
64944
|
-
noScore:
|
|
64562
|
+
noScore: flags.score === false || flags.telemetry === false ? true : void 0,
|
|
64945
64563
|
isCi: isCiEnvironment(),
|
|
64946
64564
|
silent: Boolean(flags.json),
|
|
64947
64565
|
concurrency: resolveParallelFlag(flags.parallel),
|
|
64948
64566
|
maxDurationMs: resolveMaxDurationFlag(flags.maxDuration),
|
|
64949
|
-
categoryFilters: resolveCliCategories(flags.category)
|
|
64950
|
-
includedTags: isDesignScan ? new Set(["design"]) : void 0,
|
|
64951
|
-
includeTagDefaults: isDesignScan ? true : void 0,
|
|
64952
|
-
scoreDisabledMessage: isDesignScan ? "Design scans do not affect the React health score." : void 0
|
|
64567
|
+
categoryFilters: resolveCliCategories(flags.category)
|
|
64953
64568
|
};
|
|
64954
64569
|
};
|
|
64955
64570
|
//#endregion
|
|
@@ -65367,7 +64982,7 @@ const maybeMigrateLegacyConfig = async (requestedDirectory, { isQuiet, isStaged
|
|
|
65367
64982
|
if (!(!isQuiet && !isStaged && process.stdout.isTTY === true && !isCiOrCodingAgentEnvironment())) return;
|
|
65368
64983
|
await runProjectMigrations(requestedDirectory);
|
|
65369
64984
|
};
|
|
65370
|
-
const inspectAction = async (directory, flags
|
|
64985
|
+
const inspectAction = async (directory, flags) => {
|
|
65371
64986
|
const isScoreOnly = Boolean(flags.score);
|
|
65372
64987
|
const isJsonMode = Boolean(flags.json);
|
|
65373
64988
|
const isQuiet = isScoreOnly || isJsonMode;
|
|
@@ -65381,7 +64996,7 @@ const inspectAction = async (directory, flags, invocationCommand = "inspect") =>
|
|
|
65381
64996
|
});
|
|
65382
64997
|
if (flags.jsonOut) recordCount(METRIC.jsonOutUsed, 1);
|
|
65383
64998
|
}
|
|
65384
|
-
recordCount(METRIC.cliInvoked, 1, { command:
|
|
64999
|
+
recordCount(METRIC.cliInvoked, 1, { command: "inspect" });
|
|
65385
65000
|
try {
|
|
65386
65001
|
validateModeFlags(flags);
|
|
65387
65002
|
if (flags.staged) setJsonReportMode("staged");
|
|
@@ -65693,13 +65308,6 @@ const inspectAction = async (directory, flags, invocationCommand = "inspect") =>
|
|
|
65693
65308
|
}
|
|
65694
65309
|
};
|
|
65695
65310
|
//#endregion
|
|
65696
|
-
//#region src/cli/commands/design.ts
|
|
65697
|
-
const designAction = async (directory, flags) => inspectAction(directory, {
|
|
65698
|
-
...flags,
|
|
65699
|
-
design: true,
|
|
65700
|
-
lint: flags.lint ?? true
|
|
65701
|
-
}, "design");
|
|
65702
|
-
//#endregion
|
|
65703
65311
|
//#region src/cli/commands/install.ts
|
|
65704
65312
|
const installAction = async (options, command) => {
|
|
65705
65313
|
recordCount(METRIC.cliInvoked, 1, { command: "install" });
|
|
@@ -66536,7 +66144,6 @@ const INSTALL_FLAG_SPEC = {
|
|
|
66536
66144
|
shortOptionsWithRequiredValues: new Set(["-c"])
|
|
66537
66145
|
};
|
|
66538
66146
|
const COMMAND_FLAG_SPECS = new Map([
|
|
66539
|
-
["design", ROOT_FLAG_SPEC],
|
|
66540
66147
|
["install", INSTALL_FLAG_SPEC],
|
|
66541
66148
|
["setup", INSTALL_FLAG_SPEC],
|
|
66542
66149
|
["version", {
|
|
@@ -66693,7 +66300,6 @@ ${formatExampleLines([
|
|
|
66693
66300
|
["react-doctor --scope changed --base main", "scan only new issues vs. main"],
|
|
66694
66301
|
["react-doctor --project modules/a,modules/b", "score each module separately (names or paths)"],
|
|
66695
66302
|
["react-doctor --staged", "scan staged files (pre-commit hook)"],
|
|
66696
|
-
["react-doctor design", "run the focused UI design audit"],
|
|
66697
66303
|
["react-doctor --category Security", "show only one diagnostic category"],
|
|
66698
66304
|
["react-doctor --blocking warning", "fail CI on warnings too (default: error)"],
|
|
66699
66305
|
["react-doctor --json > report.json", "write a machine-readable report"],
|
|
@@ -66727,20 +66333,6 @@ ${highlighter.dim("Managing CI:")}
|
|
|
66727
66333
|
${highlighter.dim("Learn more:")}
|
|
66728
66334
|
${highlighter.info(CANONICAL_GITHUB_URL)}
|
|
66729
66335
|
`;
|
|
66730
|
-
const renderDesignHelpEpilog = () => `
|
|
66731
|
-
${highlighter.dim("Examples:")}
|
|
66732
|
-
${formatExampleLines([
|
|
66733
|
-
["react-doctor design", "audit UI design in the current project"],
|
|
66734
|
-
["react-doctor design ./apps/web", "audit one application"],
|
|
66735
|
-
["react-doctor design --verbose", "show every design finding"],
|
|
66736
|
-
["react-doctor design --json", "write a design-only JSON report"]
|
|
66737
|
-
])}
|
|
66738
|
-
|
|
66739
|
-
${highlighter.dim("Scope:")}
|
|
66740
|
-
Runs only rules tagged ${highlighter.info("design")}, including focused rules that stay opt-in during a general health scan.
|
|
66741
|
-
Dead-code, supply-chain, external lint-config, custom-plugin, and health-score passes are skipped.
|
|
66742
|
-
Standard scan flags such as ${highlighter.info("--scope")}, ${highlighter.info("--project")}, ${highlighter.info("--verbose")}, and ${highlighter.info("--json")} still work.
|
|
66743
|
-
`;
|
|
66744
66336
|
const renderCiHelpEpilog = () => `
|
|
66745
66337
|
${highlighter.dim("Examples:")}
|
|
66746
66338
|
${formatExampleLines([
|
|
@@ -66762,7 +66354,6 @@ ${highlighter.dim("Learn more:")}
|
|
|
66762
66354
|
const collectCategoryOption = (value, previousValues) => [...previousValues ?? [], value];
|
|
66763
66355
|
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);
|
|
66764
66356
|
program.action(inspectAction);
|
|
66765
|
-
program.command("design [directory]").description("Run only the focused UI design diagnostics").addHelpText("after", renderDesignHelpEpilog).action((directory, _options, command) => designAction(directory ?? ".", command.optsWithGlobals()));
|
|
66766
66357
|
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));
|
|
66767
66358
|
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);
|
|
66768
66359
|
const providerOption = ["--provider <name>", "ci provider: github-actions or gitlab-ci (auto-detected by default)"];
|
|
@@ -66811,4 +66402,4 @@ Promise.resolve().then(() => assertNoRemovedFlags(process.argv)).then(() => prog
|
|
|
66811
66402
|
export {};
|
|
66812
66403
|
|
|
66813
66404
|
//# sourceMappingURL=cli.js.map
|
|
66814
|
-
//# debugId=
|
|
66405
|
+
//# debugId=f6c63ef7-3eca-54f6-80d8-221d85cea09b
|