react-doctor 0.8.1-dev.fc1b3a3 → 0.8.1-dev.fe241a9
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 +141 -549
- package/dist/index.d.ts +0 -29
- package/dist/index.js +97 -458
- package/dist/lsp.js +97 -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]="24153a3f-aef9-53fd-8dff-9b016a9613fb")}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),
|
|
@@ -38245,6 +37977,7 @@ const LEGACY_RULE_KEY_TO_NATIVE_RULE_KEY = {
|
|
|
38245
37977
|
"react/jsx-no-new-function-as-prop": "react-doctor/jsx-no-new-function-as-prop",
|
|
38246
37978
|
"react/jsx-no-new-object-as-prop": "react-doctor/jsx-no-new-object-as-prop",
|
|
38247
37979
|
"react/jsx-no-script-url": "react-doctor/jsx-no-script-url",
|
|
37980
|
+
"react/jsx-no-target-blank": "react-doctor/jsx-no-target-blank",
|
|
38248
37981
|
"react/jsx-no-undef": "react-doctor/jsx-no-undef",
|
|
38249
37982
|
"react/jsx-no-useless-fragment": "react-doctor/jsx-no-useless-fragment",
|
|
38250
37983
|
"react/jsx-pascal-case": "react-doctor/jsx-pascal-case",
|
|
@@ -40566,25 +40299,9 @@ const BABEL_CONFIG_FILE_NAMES = [
|
|
|
40566
40299
|
".babelrc.json"
|
|
40567
40300
|
];
|
|
40568
40301
|
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
40302
|
const MODERN_PRESET_REFERENCE = new RegExp(`['"]module:@react-native/babel-preset['"]`);
|
|
40574
40303
|
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
40304
|
const checkReactNativeMetroBabelPreset = (rootDirectory) => {
|
|
40586
|
-
const packageJson = readPackageJson$1(Path.join(rootDirectory, "package.json"));
|
|
40587
|
-
const shouldReportLegacyPreset = isReactNativeVersionAtLeastPresetRename(rootDirectory, packageJson) && !canResolveLegacyPreset(rootDirectory, packageJson);
|
|
40588
40305
|
for (const fileName of BABEL_CONFIG_FILE_NAMES) {
|
|
40589
40306
|
const filePath = Path.join(rootDirectory, fileName);
|
|
40590
40307
|
if (!isFile(filePath)) continue;
|
|
@@ -40594,7 +40311,7 @@ const checkReactNativeMetroBabelPreset = (rootDirectory) => {
|
|
|
40594
40311
|
} catch {
|
|
40595
40312
|
continue;
|
|
40596
40313
|
}
|
|
40597
|
-
if (
|
|
40314
|
+
if (contents.includes(LEGACY_PRESET_SPEC)) return [buildReactNativeDiagnostic({
|
|
40598
40315
|
filePath: fileName,
|
|
40599
40316
|
rule: "rn-no-metro-babel-preset",
|
|
40600
40317
|
severity: "error",
|
|
@@ -40617,6 +40334,12 @@ const checkReactNativeProject = (rootDirectory, project) => {
|
|
|
40617
40334
|
return [...checkReactNativeMetroBabelPreset(rootDirectory), ...checkReactNativeLibraryDependencies(rootDirectory)];
|
|
40618
40335
|
};
|
|
40619
40336
|
const RULE_KEY = "no-vulnerable-react-server-components";
|
|
40337
|
+
const DEPENDENCY_SECTIONS = [
|
|
40338
|
+
"dependencies",
|
|
40339
|
+
"devDependencies",
|
|
40340
|
+
"peerDependencies",
|
|
40341
|
+
"optionalDependencies"
|
|
40342
|
+
];
|
|
40620
40343
|
const REACT_RSC_ADVISORIES_BY_MINOR = {
|
|
40621
40344
|
"19.0": {
|
|
40622
40345
|
rceFixedVersion: "19.0.1",
|
|
@@ -40663,13 +40386,20 @@ const enumerateWorkspaceDirectories = (workspaceRoot) => {
|
|
|
40663
40386
|
for (const pattern of patterns) for (const directory of resolveWorkspaceDirectories(workspaceRoot, pattern)) directories.add(directory);
|
|
40664
40387
|
return [...directories];
|
|
40665
40388
|
};
|
|
40389
|
+
const readDeclaredSpec = (packageJson, packageName) => {
|
|
40390
|
+
for (const section of DEPENDENCY_SECTIONS) {
|
|
40391
|
+
const spec = packageJson[section]?.[packageName];
|
|
40392
|
+
if (typeof spec === "string") return spec;
|
|
40393
|
+
}
|
|
40394
|
+
return null;
|
|
40395
|
+
};
|
|
40666
40396
|
const resolveVersionInDirectory = (directory, packageName, declaredSpecOverride) => {
|
|
40667
40397
|
const manifestPath = Path.join(directory, "node_modules", packageName, "package.json");
|
|
40668
40398
|
if (isFile(manifestPath)) {
|
|
40669
40399
|
const installedVersion = import_semver.valid(readPackageJson$1(manifestPath).version ?? null);
|
|
40670
40400
|
if (installedVersion !== null) return installedVersion;
|
|
40671
40401
|
}
|
|
40672
|
-
const candidateSpecs = [
|
|
40402
|
+
const candidateSpecs = [readDeclaredSpec(readPackageJson$1(Path.join(directory, "package.json")), packageName), declaredSpecOverride];
|
|
40673
40403
|
for (const spec of candidateSpecs) {
|
|
40674
40404
|
const pinnedVersion = spec === null ? null : import_semver.valid(spec);
|
|
40675
40405
|
if (pinnedVersion !== null) return pinnedVersion;
|
|
@@ -41337,68 +41067,21 @@ const buildCapabilities = (project) => {
|
|
|
41337
41067
|
if (CLIENT_ONLY_FRAMEWORKS.has(project.framework)) capabilities.add("client-only");
|
|
41338
41068
|
if (project.isStaticExport) capabilities.add("nextjs:static-export");
|
|
41339
41069
|
if (project.nextjsMajorVersion !== null && project.nextjsMajorVersion >= 15) capabilities.add("nextjs:15");
|
|
41340
|
-
if (project.nextjsMajorVersion !== null && project.nextjsMajorVersion >= 16) capabilities.add("nextjs:16");
|
|
41341
41070
|
addMajorLadder(capabilities, "react", project.reactMajorVersion, 17, 30);
|
|
41342
41071
|
if (project.reactMajorVersion !== null && project.reactMajorVersion >= 19 && isMajorMinorAtLeast(parseReactMajorMinor(project.reactVersion), {
|
|
41343
41072
|
major: 19,
|
|
41344
41073
|
minor: 2
|
|
41345
41074
|
})) 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
|
-
}
|
|
41075
|
+
if (project.tailwindVersion !== null) capabilities.add("tailwind");
|
|
41076
|
+
if (project.tailwindVersion !== null && isMajorMinorAtLeast(parseTailwindMajorMinor(project.tailwindVersion), {
|
|
41077
|
+
major: 3,
|
|
41078
|
+
minor: 4
|
|
41079
|
+
})) capabilities.add("tailwind:3.4");
|
|
41358
41080
|
if (project.zodVersion !== null) capabilities.add("zod");
|
|
41359
41081
|
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
41082
|
if (project.isPreES2023Target) capabilities.add("pre-es2023");
|
|
41388
41083
|
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
|
-
}
|
|
41084
|
+
if (project.hasTanStackQuery) capabilities.add("tanstack-query");
|
|
41402
41085
|
if (project.hasTypeScript) capabilities.add("typescript");
|
|
41403
41086
|
if (project.preactVersion !== null) capabilities.add("preact");
|
|
41404
41087
|
addMajorLadder(capabilities, "preact", project.preactMajorVersion, 10, 20);
|
|
@@ -41413,7 +41096,7 @@ const getCapabilities = (project) => {
|
|
|
41413
41096
|
capabilitiesByProject.set(project, capabilities);
|
|
41414
41097
|
return capabilities;
|
|
41415
41098
|
};
|
|
41416
|
-
const shouldEnableRule = (requires, tags, capabilities, ignoredTags, disabledWhen
|
|
41099
|
+
const shouldEnableRule = (requires, tags, capabilities, ignoredTags, disabledWhen) => {
|
|
41417
41100
|
if (requires) {
|
|
41418
41101
|
for (const capability of requires) if (!capabilities.has(capability)) return false;
|
|
41419
41102
|
}
|
|
@@ -41424,29 +41107,20 @@ const shouldEnableRule = (requires, tags, capabilities, ignoredTags, disabledWhe
|
|
|
41424
41107
|
if (tags) {
|
|
41425
41108
|
for (const tag of tags) if (ignoredTags.has(tag)) return false;
|
|
41426
41109
|
}
|
|
41427
|
-
if (includedTags && includedTags.size > 0) {
|
|
41428
|
-
if (!tags?.some((tag) => includedTags.has(tag))) return false;
|
|
41429
|
-
}
|
|
41430
41110
|
return true;
|
|
41431
41111
|
};
|
|
41432
|
-
const shouldEnableRuleByDefaultStatus = (options) => options.defaultEnabled !== false || options.hasExplicitOverride === true || options.includeTagDefaults && options.hasIncludedTags;
|
|
41433
41112
|
const yieldToEventLoop = () => new Promise((resolve) => {
|
|
41434
41113
|
setImmediate(resolve);
|
|
41435
41114
|
});
|
|
41436
41115
|
const createSecurityScanSession = (rootDirectory, options) => {
|
|
41437
41116
|
const capabilities = options.project ? getCapabilities(options.project) : /* @__PURE__ */ new Set();
|
|
41438
41117
|
const ignoredTags = options.ignoredTags ?? /* @__PURE__ */ new Set();
|
|
41439
|
-
const includedTags = options.includedTags ?? /* @__PURE__ */ new Set();
|
|
41440
41118
|
const enabledScanRules = REACT_DOCTOR_RULES.flatMap((entry) => {
|
|
41441
41119
|
const rule = entry.rule;
|
|
41442
41120
|
const scan = rule.scan;
|
|
41443
41121
|
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 [];
|
|
41122
|
+
if (rule.defaultEnabled === false) return [];
|
|
41123
|
+
if (!shouldEnableRule(rule.requires, rule.tags, capabilities, ignoredTags, rule.disabledWhen)) return [];
|
|
41450
41124
|
return [{
|
|
41451
41125
|
entry,
|
|
41452
41126
|
scan,
|
|
@@ -43448,9 +43122,8 @@ const buildUserPluginRules = (userPlugin, severityControls) => {
|
|
|
43448
43122
|
}
|
|
43449
43123
|
return enabled;
|
|
43450
43124
|
};
|
|
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);
|
|
43125
|
+
const createOxlintConfig = ({ pluginPath, project, customRulesOnly = false, extendsPaths = [], ignoredTags = /* @__PURE__ */ new Set(), serverAuthFunctionNames, severityControls, userPlugins = [], disableReactHooksJsPlugin = false, ruleSelection, sidecarRuleIdFilter }) => {
|
|
43126
|
+
const reactHooksJsPlugin = disableReactHooksJsPlugin || ruleSelection === "sidecar" ? null : resolveReactHooksJsPlugin(project.hasReactCompiler || project.hasReactCompilerLintPlugin === true, customRulesOnly);
|
|
43454
43127
|
const reactCompilerRules = reactHooksJsPlugin ? applyRuleSeverityControls(filterRulesToAvailable(REACT_COMPILER_RULES, "react-hooks-js", reactHooksJsPlugin.availableRuleNames), severityControls) : {};
|
|
43455
43128
|
const jsPlugins = [];
|
|
43456
43129
|
if (reactHooksJsPlugin) jsPlugins.push(reactHooksJsPlugin.entry);
|
|
@@ -43465,14 +43138,9 @@ const createOxlintConfig = ({ pluginPath, project, customRulesOnly = false, exte
|
|
|
43465
43138
|
if (rule.scan !== void 0) continue;
|
|
43466
43139
|
if (customRulesOnly && registryEntry.originallyExternal) continue;
|
|
43467
43140
|
if (rule.framework !== "global" && !rule.requires) continue;
|
|
43468
|
-
if (!shouldEnableRule(rule.requires, rule.tags, capabilities, ignoredTags, rule.disabledWhen
|
|
43141
|
+
if (!shouldEnableRule(rule.requires, rule.tags, capabilities, ignoredTags, rule.disabledWhen)) continue;
|
|
43469
43142
|
const explicitRuleOverride = resolveRuleSeverityOverride({ ruleKey: registryEntry.key }, severityControls);
|
|
43470
|
-
if (
|
|
43471
|
-
defaultEnabled: rule.defaultEnabled,
|
|
43472
|
-
includeTagDefaults,
|
|
43473
|
-
hasIncludedTags,
|
|
43474
|
-
hasExplicitOverride: explicitRuleOverride !== void 0
|
|
43475
|
-
})) continue;
|
|
43143
|
+
if (rule.defaultEnabled === false && explicitRuleOverride === void 0) continue;
|
|
43476
43144
|
const severity = resolveRuleSeverityOverride({
|
|
43477
43145
|
ruleKey: registryEntry.key,
|
|
43478
43146
|
category: rule.category
|
|
@@ -43481,7 +43149,7 @@ const createOxlintConfig = ({ pluginPath, project, customRulesOnly = false, exte
|
|
|
43481
43149
|
enabledReactDoctorRules[registryEntry.key] = severity;
|
|
43482
43150
|
}
|
|
43483
43151
|
const userPluginRules = {};
|
|
43484
|
-
if (ruleSelection !== "sidecar"
|
|
43152
|
+
if (ruleSelection !== "sidecar") for (const userPlugin of userPlugins) {
|
|
43485
43153
|
Object.assign(userPluginRules, buildUserPluginRules(userPlugin, severityControls));
|
|
43486
43154
|
jsPlugins.push(userPlugin.entry);
|
|
43487
43155
|
}
|
|
@@ -43698,19 +43366,6 @@ const createSidecarLintCache = (cacheDirectory, rulesetHash) => {
|
|
|
43698
43366
|
}
|
|
43699
43367
|
};
|
|
43700
43368
|
};
|
|
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
43369
|
const bundledRequire$3 = createRequire(import.meta.url);
|
|
43715
43370
|
const childNodeVersionByBinaryPath = /* @__PURE__ */ new Map();
|
|
43716
43371
|
const resolveChildNodeVersion = (nodeBinaryPath) => {
|
|
@@ -43734,13 +43389,6 @@ const TOOLCHAIN_PACKAGE_SPECIFIERS$1 = [
|
|
|
43734
43389
|
"oxlint-plugin-react-doctor/package.json",
|
|
43735
43390
|
"eslint-plugin-react-hooks/package.json"
|
|
43736
43391
|
];
|
|
43737
|
-
const resolvePluginFingerprint = () => {
|
|
43738
|
-
try {
|
|
43739
|
-
return fingerprintFileContents(bundledRequire$3.resolve("oxlint-plugin-react-doctor"), 16);
|
|
43740
|
-
} catch {
|
|
43741
|
-
return "unresolved";
|
|
43742
|
-
}
|
|
43743
|
-
};
|
|
43744
43392
|
const resolveOxlintToolchainVersions = (nodeBinaryPath = process.execPath) => {
|
|
43745
43393
|
const versions = [`node=${resolveChildNodeVersion(nodeBinaryPath)}`];
|
|
43746
43394
|
for (const specifier of TOOLCHAIN_PACKAGE_SPECIFIERS$1) try {
|
|
@@ -43750,7 +43398,6 @@ const resolveOxlintToolchainVersions = (nodeBinaryPath = process.execPath) => {
|
|
|
43750
43398
|
} catch {
|
|
43751
43399
|
versions.push(`${specifier}=missing`);
|
|
43752
43400
|
}
|
|
43753
|
-
versions.push(`oxlint-plugin-react-doctor#fingerprint=${resolvePluginFingerprint()}`);
|
|
43754
43401
|
return versions;
|
|
43755
43402
|
};
|
|
43756
43403
|
const esmRequire = createRequire(import.meta.url);
|
|
@@ -45226,7 +44873,7 @@ const reactHooksJsPluginDropNote = (error) => {
|
|
|
45226
44873
|
* 6. always restore disable directives + clean up the temp dir
|
|
45227
44874
|
*/
|
|
45228
44875
|
const runOxlint = async (options) => {
|
|
45229
|
-
const { rootDirectory, project, includePaths, nodeBinaryPath = process.execPath, customRulesOnly = false, respectInlineDisables = true, adoptExistingLintConfig = true, ignoredTags = /* @__PURE__ */ new Set(),
|
|
44876
|
+
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
44877
|
const serverAuthFunctionNames = Array.isArray(userConfig?.serverAuthFunctionNames) ? userConfig.serverAuthFunctionNames.filter((entry) => typeof entry === "string" && entry.length > 0) : void 0;
|
|
45231
44878
|
const severityControls = buildRuleSeverityControls(userConfig);
|
|
45232
44879
|
validateRuleRegistration();
|
|
@@ -45240,15 +44887,13 @@ const runOxlint = async (options) => {
|
|
|
45240
44887
|
}
|
|
45241
44888
|
const pluginPath = resolvePluginPath();
|
|
45242
44889
|
const extendsPaths = (adoptExistingLintConfig && !customRulesOnly ? detectUserLintConfigPaths(rootDirectory) : []).filter(canOxlintExtendConfig);
|
|
45243
|
-
const userPlugins =
|
|
44890
|
+
const userPlugins = resolveUserPlugins(userConfig?.plugins, configSourceDirectory);
|
|
45244
44891
|
const buildConfig = (overrides) => createOxlintConfig({
|
|
45245
44892
|
pluginPath,
|
|
45246
44893
|
project,
|
|
45247
44894
|
customRulesOnly,
|
|
45248
44895
|
extendsPaths: overrides.extendsPaths,
|
|
45249
44896
|
ignoredTags,
|
|
45250
|
-
includedTags,
|
|
45251
|
-
includeTagDefaults,
|
|
45252
44897
|
serverAuthFunctionNames,
|
|
45253
44898
|
severityControls,
|
|
45254
44899
|
userPlugins,
|
|
@@ -45637,8 +45282,6 @@ var Linter = class Linter extends Service()("react-doctor/Linter") {
|
|
|
45637
45282
|
respectInlineDisables: input.respectInlineDisables,
|
|
45638
45283
|
adoptExistingLintConfig: input.adoptExistingLintConfig,
|
|
45639
45284
|
ignoredTags: input.ignoredTags,
|
|
45640
|
-
includedTags: input.includedTags,
|
|
45641
|
-
includeTagDefaults: input.includeTagDefaults,
|
|
45642
45285
|
userConfig: input.userConfig ?? null,
|
|
45643
45286
|
configSourceDirectory: input.configSourceDirectory,
|
|
45644
45287
|
onPartialFailure: (reason) => {
|
|
@@ -46487,9 +46130,7 @@ const runInspect = (input, hooks = {}) => gen(function* () {
|
|
|
46487
46130
|
const securityScanFailedRef = yield* make$13(false);
|
|
46488
46131
|
const securityScanFiber = yield* forkChild(runCollect(applyPerElementPipeline(isDiffMode ? empty$4 : unwrap(tryPromise(() => checkSecurityScanCooperative(scanDirectory, {
|
|
46489
46132
|
project,
|
|
46490
|
-
ignoredTags: input.ignoredTags
|
|
46491
|
-
includedTags: input.includedTags,
|
|
46492
|
-
includeTagDefaults: input.includeTagDefaults
|
|
46133
|
+
ignoredTags: input.ignoredTags
|
|
46493
46134
|
})).pipe(map$3((diagnostics) => fromIterable$1(diagnostics)), catch_$1(() => set(securityScanFailedRef, true).pipe(as(empty$4))))))).pipe(withSpan("SecurityScan.run")));
|
|
46494
46135
|
const shouldRunSupplyChain = !isDiffMode || (input.supplyChainManifestChanged ?? false);
|
|
46495
46136
|
const supplyChainOverlapTimeout = yield* SupplyChainOverlapTimeoutMs;
|
|
@@ -46580,8 +46221,6 @@ const runInspect = (input, hooks = {}) => gen(function* () {
|
|
|
46580
46221
|
respectInlineDisables: input.respectInlineDisables,
|
|
46581
46222
|
adoptExistingLintConfig: input.adoptExistingLintConfig,
|
|
46582
46223
|
ignoredTags: input.ignoredTags,
|
|
46583
|
-
includedTags: input.includedTags,
|
|
46584
|
-
includeTagDefaults: input.includeTagDefaults,
|
|
46585
46224
|
userConfig: resolvedConfig.config ?? void 0,
|
|
46586
46225
|
configSourceDirectory: resolvedConfig.configSourceDirectory ?? void 0,
|
|
46587
46226
|
onFileProgress: (scannedFileCount, totalFileCount) => {
|
|
@@ -47726,7 +47365,7 @@ const makeNoopConsole = () => ({
|
|
|
47726
47365
|
});
|
|
47727
47366
|
//#endregion
|
|
47728
47367
|
//#region src/cli/utils/version.ts
|
|
47729
|
-
const VERSION = "0.8.1-dev.
|
|
47368
|
+
const VERSION = "0.8.1-dev.fe241a9";
|
|
47730
47369
|
//#endregion
|
|
47731
47370
|
//#region src/cli/utils/json-mode.ts
|
|
47732
47371
|
let context = null;
|
|
@@ -47813,11 +47452,7 @@ const getRunId = () => {
|
|
|
47813
47452
|
};
|
|
47814
47453
|
//#endregion
|
|
47815
47454
|
//#region src/cli/utils/build-run-context.ts
|
|
47816
|
-
const ROOT_SUBCOMMANDS = new Set([
|
|
47817
|
-
"design",
|
|
47818
|
-
"install",
|
|
47819
|
-
"setup"
|
|
47820
|
-
]);
|
|
47455
|
+
const ROOT_SUBCOMMANDS = new Set(["install", "setup"]);
|
|
47821
47456
|
const detectInvokedVia = () => {
|
|
47822
47457
|
const userAgent = process.env.npm_config_user_agent;
|
|
47823
47458
|
if (!userAgent) return "unknown";
|
|
@@ -47901,9 +47536,7 @@ const buildSentryProjectContext = (projectInfo) => ({
|
|
|
47901
47536
|
reactMajorVersion: projectInfo.reactMajorVersion,
|
|
47902
47537
|
hasTypeScript: projectInfo.hasTypeScript,
|
|
47903
47538
|
hasReactCompiler: projectInfo.hasReactCompiler,
|
|
47904
|
-
|
|
47905
|
-
mobxVersion: projectInfo.mobxVersion,
|
|
47906
|
-
styledComponentsVersion: projectInfo.styledComponentsVersion,
|
|
47539
|
+
hasTanStackQuery: projectInfo.hasTanStackQuery,
|
|
47907
47540
|
tailwindVersion: projectInfo.tailwindVersion,
|
|
47908
47541
|
zodVersion: projectInfo.zodVersion,
|
|
47909
47542
|
preactVersion: projectInfo.preactVersion,
|
|
@@ -48084,13 +47717,13 @@ const isDevVersion = (version) => version === "0.0.0" || version.includes("-");
|
|
|
48084
47717
|
* uploads source-map artifacts under, so stack frames symbolicate. Honors the
|
|
48085
47718
|
* standard `SENTRY_RELEASE` override.
|
|
48086
47719
|
*/
|
|
48087
|
-
const resolveSentryRelease = () => process.env.SENTRY_RELEASE || `react-doctor@0.8.1-dev.
|
|
47720
|
+
const resolveSentryRelease = () => process.env.SENTRY_RELEASE || `react-doctor@0.8.1-dev.fe241a9`;
|
|
48088
47721
|
/**
|
|
48089
47722
|
* Deployment environment shown in Sentry's environment filter. Defaults to
|
|
48090
47723
|
* `production` for tagged releases and `development` for dev/unbuilt versions,
|
|
48091
47724
|
* overridable via the standard `SENTRY_ENVIRONMENT` env var.
|
|
48092
47725
|
*/
|
|
48093
|
-
const resolveSentryEnvironment = () => process.env.SENTRY_ENVIRONMENT || (isDevVersion("0.8.1-dev.
|
|
47726
|
+
const resolveSentryEnvironment = () => process.env.SENTRY_ENVIRONMENT || (isDevVersion("0.8.1-dev.fe241a9") ? "development" : "production");
|
|
48094
47727
|
/**
|
|
48095
47728
|
* Performance-tracing sample rate in `[0, 1]`. Reads `SENTRY_TRACES_SAMPLE_RATE`
|
|
48096
47729
|
* (set to `0` to disable tracing) and falls back to
|
|
@@ -60416,8 +60049,6 @@ const buildScanResultCacheKey = (input) => {
|
|
|
60416
60049
|
warnings: input.options.warnings,
|
|
60417
60050
|
adoptExistingLintConfig: input.options.adoptExistingLintConfig,
|
|
60418
60051
|
ignoredTags: [...input.options.ignoredTags].sort(),
|
|
60419
|
-
includedTags: [...input.options.includedTags].sort(),
|
|
60420
|
-
includeTagDefaults: input.options.includeTagDefaults,
|
|
60421
60052
|
concurrency: input.options.concurrency,
|
|
60422
60053
|
lintBatchOrdering: resolveLintBatchOrdering(),
|
|
60423
60054
|
baselineRef: input.options.baseline?.ref,
|
|
@@ -61244,8 +60875,8 @@ const createDiagnosticEvidenceReader = (rootDirectory, options = {}) => {
|
|
|
61244
60875
|
//#endregion
|
|
61245
60876
|
//#region src/cli/utils/build-no-score-message.ts
|
|
61246
60877
|
const ENTERPRISE_CONTACT_HINT = `Want something custom to your company? Contact us at ${ENTERPRISE_CONTACT_URL}.`;
|
|
61247
|
-
const buildNoScoreMessage = (isScoreDisabled
|
|
61248
|
-
return `${isScoreDisabled ?
|
|
60878
|
+
const buildNoScoreMessage = (isScoreDisabled) => {
|
|
60879
|
+
return `${isScoreDisabled ? "Score disabled by --no-score." : "Score unavailable (could not reach the score API)."} ${ENTERPRISE_CONTACT_HINT}`;
|
|
61249
60880
|
};
|
|
61250
60881
|
//#endregion
|
|
61251
60882
|
//#region src/cli/utils/render-agent-guidance.ts
|
|
@@ -62370,47 +62001,40 @@ const buildChangedLineMatcher = (directory, changedLineRanges) => {
|
|
|
62370
62001
|
return diagnosticIntersectsLineRanges(diagnostic, ranges);
|
|
62371
62002
|
};
|
|
62372
62003
|
};
|
|
62373
|
-
const buildIgnoredTags = (userConfig
|
|
62004
|
+
const buildIgnoredTags = (userConfig) => {
|
|
62374
62005
|
const tags = /* @__PURE__ */ new Set();
|
|
62375
62006
|
if (userConfig?.ignore?.tags) for (const tag of userConfig.ignore.tags) tags.add(tag);
|
|
62376
|
-
for (const tag of includedTags) tags.delete(tag);
|
|
62377
62007
|
return tags;
|
|
62378
62008
|
};
|
|
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
|
-
};
|
|
62009
|
+
const mergeInspectOptions = (inputOptions, userConfig) => ({
|
|
62010
|
+
lint: inputOptions.lint ?? userConfig?.lint ?? true,
|
|
62011
|
+
deadCode: inputOptions.deadCode ?? userConfig?.deadCode ?? true,
|
|
62012
|
+
supplyChain: inputOptions.supplyChain ?? userConfig?.supplyChain?.enabled ?? true,
|
|
62013
|
+
verbose: inputOptions.verbose ?? userConfig?.verbose ?? false,
|
|
62014
|
+
outputDirectory: inputOptions.outputDirectory || null,
|
|
62015
|
+
scoreOnly: inputOptions.scoreOnly ?? false,
|
|
62016
|
+
noScore: inputOptions.noScore ?? userConfig?.noScore ?? false,
|
|
62017
|
+
isCi: inputOptions.isCi ?? false,
|
|
62018
|
+
isCiOrCodingAgentEnvironment: isCiOrCodingAgentEnvironment(),
|
|
62019
|
+
isNonInteractiveEnvironment: isNonInteractiveEnvironment(),
|
|
62020
|
+
silent: inputOptions.silent ?? false,
|
|
62021
|
+
includePaths: inputOptions.includePaths ?? [],
|
|
62022
|
+
customRulesOnly: userConfig?.customRulesOnly ?? false,
|
|
62023
|
+
share: userConfig?.share ?? true,
|
|
62024
|
+
respectInlineDisables: inputOptions.respectInlineDisables ?? userConfig?.respectInlineDisables ?? true,
|
|
62025
|
+
warnings: inputOptions.warnings ?? userConfig?.warnings ?? true,
|
|
62026
|
+
categoryFilters: new Set(resolveCliCategories(inputOptions.categoryFilters) ?? []),
|
|
62027
|
+
adoptExistingLintConfig: userConfig?.adoptExistingLintConfig ?? true,
|
|
62028
|
+
ignoredTags: buildIgnoredTags(userConfig),
|
|
62029
|
+
outputSurface: inputOptions.outputSurface ?? "cli",
|
|
62030
|
+
suppressRendering: inputOptions.suppressRendering ?? false,
|
|
62031
|
+
concurrentScan: inputOptions.concurrentScan ?? false,
|
|
62032
|
+
concurrency: inputOptions.concurrency,
|
|
62033
|
+
maxDurationMs: inputOptions.maxDurationMs ?? null,
|
|
62034
|
+
baseline: inputOptions.baseline ?? null,
|
|
62035
|
+
changedLineRanges: inputOptions.changedLineRanges ?? null,
|
|
62036
|
+
supplyChainManifestChanged: inputOptions.supplyChainManifestChanged ?? false
|
|
62037
|
+
});
|
|
62414
62038
|
const deriveScope = (options) => {
|
|
62415
62039
|
if (options.baseline) return "changed";
|
|
62416
62040
|
if (options.changedLineRanges !== null) return "lines";
|
|
@@ -62541,8 +62165,6 @@ const runBaselineComparison = async (params) => {
|
|
|
62541
62165
|
warnings: params.options.warnings,
|
|
62542
62166
|
adoptExistingLintConfig: params.options.adoptExistingLintConfig,
|
|
62543
62167
|
ignoredTags: params.options.ignoredTags,
|
|
62544
|
-
includedTags: params.options.includedTags,
|
|
62545
|
-
includeTagDefaults: params.options.includeTagDefaults,
|
|
62546
62168
|
nodeBinaryPath: params.resolvedNodeBinaryPath ?? void 0,
|
|
62547
62169
|
runDeadCode: false,
|
|
62548
62170
|
isCi: params.options.isCi,
|
|
@@ -62636,8 +62258,6 @@ const runInspectWithRuntime = async (directory, options, userConfig, hasConfigOv
|
|
|
62636
62258
|
warnings: options.warnings,
|
|
62637
62259
|
adoptExistingLintConfig: options.adoptExistingLintConfig,
|
|
62638
62260
|
ignoredTags: options.ignoredTags,
|
|
62639
|
-
includedTags: options.includedTags,
|
|
62640
|
-
includeTagDefaults: options.includeTagDefaults,
|
|
62641
62261
|
nodeBinaryPath: resolvedNodeBinaryPath ?? void 0,
|
|
62642
62262
|
runDeadCode: options.deadCode,
|
|
62643
62263
|
isCi: options.isCi,
|
|
@@ -62826,7 +62446,7 @@ const finalizeAndRender = (input) => gen(function* () {
|
|
|
62826
62446
|
securityScanFailed
|
|
62827
62447
|
});
|
|
62828
62448
|
const hasSkippedChecks = skippedChecks.length > 0;
|
|
62829
|
-
const noScoreMessage = buildNoScoreMessage(options.noScore
|
|
62449
|
+
const noScoreMessage = buildNoScoreMessage(options.noScore);
|
|
62830
62450
|
const buildResult = () => ({
|
|
62831
62451
|
diagnostics: [...diagnostics],
|
|
62832
62452
|
score,
|
|
@@ -64931,25 +64551,21 @@ const resolveParallelFlag = (parallel) => parallel === false ? 1 : void 0;
|
|
|
64931
64551
|
*/
|
|
64932
64552
|
const resolveCliInspectOptions = (flags, userConfig) => {
|
|
64933
64553
|
const wantsWarningGate = pickBlockingLevel(flags, userConfig) === "warning";
|
|
64934
|
-
const isDesignScan = flags.design === true;
|
|
64935
64554
|
return {
|
|
64936
64555
|
lint: flags.lint,
|
|
64937
|
-
deadCode:
|
|
64938
|
-
supplyChain:
|
|
64556
|
+
deadCode: flags.deadCode,
|
|
64557
|
+
supplyChain: flags.supplyChain,
|
|
64939
64558
|
verbose: flags.verbose,
|
|
64940
64559
|
outputDirectory: flags.outputDir,
|
|
64941
64560
|
respectInlineDisables: flags.respectInlineDisables === false ? false : void 0,
|
|
64942
64561
|
warnings: wantsWarningGate ? true : flags.warnings,
|
|
64943
64562
|
scoreOnly: flags.score === true,
|
|
64944
|
-
noScore:
|
|
64563
|
+
noScore: flags.score === false || flags.telemetry === false ? true : void 0,
|
|
64945
64564
|
isCi: isCiEnvironment(),
|
|
64946
64565
|
silent: Boolean(flags.json),
|
|
64947
64566
|
concurrency: resolveParallelFlag(flags.parallel),
|
|
64948
64567
|
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
|
|
64568
|
+
categoryFilters: resolveCliCategories(flags.category)
|
|
64953
64569
|
};
|
|
64954
64570
|
};
|
|
64955
64571
|
//#endregion
|
|
@@ -65367,7 +64983,7 @@ const maybeMigrateLegacyConfig = async (requestedDirectory, { isQuiet, isStaged
|
|
|
65367
64983
|
if (!(!isQuiet && !isStaged && process.stdout.isTTY === true && !isCiOrCodingAgentEnvironment())) return;
|
|
65368
64984
|
await runProjectMigrations(requestedDirectory);
|
|
65369
64985
|
};
|
|
65370
|
-
const inspectAction = async (directory, flags
|
|
64986
|
+
const inspectAction = async (directory, flags) => {
|
|
65371
64987
|
const isScoreOnly = Boolean(flags.score);
|
|
65372
64988
|
const isJsonMode = Boolean(flags.json);
|
|
65373
64989
|
const isQuiet = isScoreOnly || isJsonMode;
|
|
@@ -65381,7 +64997,7 @@ const inspectAction = async (directory, flags, invocationCommand = "inspect") =>
|
|
|
65381
64997
|
});
|
|
65382
64998
|
if (flags.jsonOut) recordCount(METRIC.jsonOutUsed, 1);
|
|
65383
64999
|
}
|
|
65384
|
-
recordCount(METRIC.cliInvoked, 1, { command:
|
|
65000
|
+
recordCount(METRIC.cliInvoked, 1, { command: "inspect" });
|
|
65385
65001
|
try {
|
|
65386
65002
|
validateModeFlags(flags);
|
|
65387
65003
|
if (flags.staged) setJsonReportMode("staged");
|
|
@@ -65693,13 +65309,6 @@ const inspectAction = async (directory, flags, invocationCommand = "inspect") =>
|
|
|
65693
65309
|
}
|
|
65694
65310
|
};
|
|
65695
65311
|
//#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
65312
|
//#region src/cli/commands/install.ts
|
|
65704
65313
|
const installAction = async (options, command) => {
|
|
65705
65314
|
recordCount(METRIC.cliInvoked, 1, { command: "install" });
|
|
@@ -66536,7 +66145,6 @@ const INSTALL_FLAG_SPEC = {
|
|
|
66536
66145
|
shortOptionsWithRequiredValues: new Set(["-c"])
|
|
66537
66146
|
};
|
|
66538
66147
|
const COMMAND_FLAG_SPECS = new Map([
|
|
66539
|
-
["design", ROOT_FLAG_SPEC],
|
|
66540
66148
|
["install", INSTALL_FLAG_SPEC],
|
|
66541
66149
|
["setup", INSTALL_FLAG_SPEC],
|
|
66542
66150
|
["version", {
|
|
@@ -66693,7 +66301,6 @@ ${formatExampleLines([
|
|
|
66693
66301
|
["react-doctor --scope changed --base main", "scan only new issues vs. main"],
|
|
66694
66302
|
["react-doctor --project modules/a,modules/b", "score each module separately (names or paths)"],
|
|
66695
66303
|
["react-doctor --staged", "scan staged files (pre-commit hook)"],
|
|
66696
|
-
["react-doctor design", "run the focused UI design audit"],
|
|
66697
66304
|
["react-doctor --category Security", "show only one diagnostic category"],
|
|
66698
66305
|
["react-doctor --blocking warning", "fail CI on warnings too (default: error)"],
|
|
66699
66306
|
["react-doctor --json > report.json", "write a machine-readable report"],
|
|
@@ -66727,20 +66334,6 @@ ${highlighter.dim("Managing CI:")}
|
|
|
66727
66334
|
${highlighter.dim("Learn more:")}
|
|
66728
66335
|
${highlighter.info(CANONICAL_GITHUB_URL)}
|
|
66729
66336
|
`;
|
|
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
66337
|
const renderCiHelpEpilog = () => `
|
|
66745
66338
|
${highlighter.dim("Examples:")}
|
|
66746
66339
|
${formatExampleLines([
|
|
@@ -66762,7 +66355,6 @@ ${highlighter.dim("Learn more:")}
|
|
|
66762
66355
|
const collectCategoryOption = (value, previousValues) => [...previousValues ?? [], value];
|
|
66763
66356
|
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
66357
|
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
66358
|
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
66359
|
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
66360
|
const providerOption = ["--provider <name>", "ci provider: github-actions or gitlab-ci (auto-detected by default)"];
|
|
@@ -66811,4 +66403,4 @@ Promise.resolve().then(() => assertNoRemovedFlags(process.argv)).then(() => prog
|
|
|
66811
66403
|
export {};
|
|
66812
66404
|
|
|
66813
66405
|
//# sourceMappingURL=cli.js.map
|
|
66814
|
-
//# debugId=
|
|
66406
|
+
//# debugId=24153a3f-aef9-53fd-8dff-9b016a9613fb
|