react-doctor 0.8.1-dev.0b0b5ac → 0.8.1-dev.21221c2
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 +99 -437
- package/dist/index.d.ts +0 -27
- package/dist/index.js +55 -346
- package/dist/lsp.js +55 -346
- 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";
|
|
@@ -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
|
};
|
|
@@ -37125,6 +37101,19 @@ const getPreactVersion = (packageJson) => {
|
|
|
37125
37101
|
...packageJson.devDependencies
|
|
37126
37102
|
}.preact ?? null;
|
|
37127
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
|
+
};
|
|
37128
37117
|
const resolveCatalogBackedDependencyVersion = ({ rootDirectory, rootPackageJson, packageName, version }) => {
|
|
37129
37118
|
if (version === null || !isCatalogReference(version)) return version;
|
|
37130
37119
|
const catalogName = extractCatalogName(version);
|
|
@@ -37327,60 +37316,7 @@ const listWorkspacePackages = (rootDirectory) => {
|
|
|
37327
37316
|
}
|
|
37328
37317
|
return packages;
|
|
37329
37318
|
};
|
|
37330
|
-
const getPreferredDependencyVersion = ({ packageJson, packageNames }) => {
|
|
37331
|
-
const allDependencies = {
|
|
37332
|
-
...packageJson.devDependencies,
|
|
37333
|
-
...packageJson.peerDependencies,
|
|
37334
|
-
...packageJson.dependencies
|
|
37335
|
-
};
|
|
37336
|
-
for (const packageName of packageNames) {
|
|
37337
|
-
const version = allDependencies[packageName];
|
|
37338
|
-
if (version !== void 0) return version;
|
|
37339
|
-
}
|
|
37340
|
-
return null;
|
|
37341
|
-
};
|
|
37342
|
-
const TANSTACK_REACT_QUERY_PACKAGES = ["@tanstack/react-query", "react-query"];
|
|
37343
|
-
const getTanStackQueryVersion = (packageJson) => {
|
|
37344
|
-
return getPreferredDependencyVersion({
|
|
37345
|
-
packageJson,
|
|
37346
|
-
packageNames: TANSTACK_REACT_QUERY_PACKAGES
|
|
37347
|
-
});
|
|
37348
|
-
};
|
|
37349
|
-
const STYLED_COMPONENTS_PACKAGES = ["styled-components"];
|
|
37350
|
-
const getStyledComponentsVersion = (packageJson) => {
|
|
37351
|
-
return getPreferredDependencyVersion({
|
|
37352
|
-
packageJson,
|
|
37353
|
-
packageNames: STYLED_COMPONENTS_PACKAGES
|
|
37354
|
-
});
|
|
37355
|
-
};
|
|
37356
|
-
const I18N_PACKAGES = [
|
|
37357
|
-
"i18next",
|
|
37358
|
-
"react-i18next",
|
|
37359
|
-
"next-i18next",
|
|
37360
|
-
"react-intl",
|
|
37361
|
-
"next-intl",
|
|
37362
|
-
"use-intl",
|
|
37363
|
-
"@formatjs/intl",
|
|
37364
|
-
"@lingui/core",
|
|
37365
|
-
"@lingui/react",
|
|
37366
|
-
"typesafe-i18n",
|
|
37367
|
-
"@tolgee/react",
|
|
37368
|
-
"react-intl-universal"
|
|
37369
|
-
];
|
|
37370
|
-
const hasI18nDependency = (packageJson) => {
|
|
37371
|
-
const allDependencies = {
|
|
37372
|
-
...packageJson.peerDependencies,
|
|
37373
|
-
...packageJson.dependencies,
|
|
37374
|
-
...packageJson.devDependencies,
|
|
37375
|
-
...packageJson.optionalDependencies
|
|
37376
|
-
};
|
|
37377
|
-
return I18N_PACKAGES.some((packageName) => allDependencies[packageName] !== void 0);
|
|
37378
|
-
};
|
|
37379
37319
|
const REANIMATED_DEPENDENCY_NAME = "react-native-reanimated";
|
|
37380
|
-
const MOBX_REACT_PACKAGE_NAME = "mobx-react";
|
|
37381
|
-
const MOBX_REACT_LITE_PACKAGE_NAME = "mobx-react-lite";
|
|
37382
|
-
const MOBX_STATE_TREE_PACKAGE_NAME = "mobx-state-tree";
|
|
37383
|
-
const MOBX_REACT_OBSERVER_PACKAGE_NAME = "mobx-react-observer";
|
|
37384
37320
|
const SHOPIFY_FLASH_LIST_PACKAGE_NAME = "@shopify/flash-list";
|
|
37385
37321
|
const resolveWorkspaceDependencyVersion = ({ concreteVersion, packageName, rootDirectory, rootPackageJson, sections, workspaceDirectory, workspacePackageJson }) => {
|
|
37386
37322
|
const dependencyDeclaration = getDependencyDeclaration({
|
|
@@ -37399,26 +37335,7 @@ const shouldReplaceReactVersion = (currentVersion, nextVersion) => {
|
|
|
37399
37335
|
if (nextMajor === null) return false;
|
|
37400
37336
|
return nextMajor < currentMajor;
|
|
37401
37337
|
};
|
|
37402
|
-
const
|
|
37403
|
-
if (currentFact.version === null) return true;
|
|
37404
|
-
if (nextFact.version === null) return false;
|
|
37405
|
-
const currentMajor = getLowestDependencyMajor(currentFact.version);
|
|
37406
|
-
const nextMajor = getLowestDependencyMajor(nextFact.version);
|
|
37407
|
-
if (currentMajor === null) return false;
|
|
37408
|
-
if (nextMajor === null) return true;
|
|
37409
|
-
if (currentMajor > latestSupportedMajor) return false;
|
|
37410
|
-
if (nextMajor > latestSupportedMajor) return true;
|
|
37411
|
-
return nextMajor < currentMajor;
|
|
37412
|
-
};
|
|
37413
|
-
const shouldReplaceStyledComponentsVersion = (currentVersion, nextVersion) => {
|
|
37414
|
-
if (!currentVersion) return true;
|
|
37415
|
-
const currentMajor = getLowestDependencyMajor(currentVersion);
|
|
37416
|
-
const nextMajor = getLowestDependencyMajor(nextVersion);
|
|
37417
|
-
if (currentMajor === null) return nextMajor !== null && nextMajor < 6;
|
|
37418
|
-
if (nextMajor === null) return currentMajor >= 6;
|
|
37419
|
-
return nextMajor < currentMajor;
|
|
37420
|
-
};
|
|
37421
|
-
const evaluateManifestFacts = (facts, packageJson, directory, rootDirectory, rootPackageJson) => {
|
|
37338
|
+
const evaluateManifestFacts = (facts, packageJson, directory) => {
|
|
37422
37339
|
if (facts.expo.version === null) {
|
|
37423
37340
|
const spec = getDependencySpec(packageJson, "expo");
|
|
37424
37341
|
if (spec !== null) facts.expo = {
|
|
@@ -37440,74 +37357,13 @@ const evaluateManifestFacts = (facts, packageJson, directory, rootDirectory, roo
|
|
|
37440
37357
|
sourceDirectory: directory
|
|
37441
37358
|
};
|
|
37442
37359
|
}
|
|
37443
|
-
const mobxSpec = getDependencySpec(packageJson, "mobx");
|
|
37444
|
-
if (mobxSpec !== null) {
|
|
37445
|
-
const nextMobxFact = {
|
|
37446
|
-
version: resolveCatalogBackedDependencyVersion({
|
|
37447
|
-
rootDirectory: directory,
|
|
37448
|
-
rootPackageJson: packageJson,
|
|
37449
|
-
packageName: "mobx",
|
|
37450
|
-
version: mobxSpec
|
|
37451
|
-
}),
|
|
37452
|
-
sourceDirectory: directory
|
|
37453
|
-
};
|
|
37454
|
-
if (shouldReplaceSupportedDependencyFact(facts.mobx, nextMobxFact, 6)) facts.mobx = nextMobxFact;
|
|
37455
|
-
}
|
|
37456
|
-
facts.hasMobxReact = facts.hasMobxReact || getDependencySpec(packageJson, MOBX_REACT_PACKAGE_NAME) !== null;
|
|
37457
|
-
facts.hasMobxReactLite = facts.hasMobxReactLite || getDependencySpec(packageJson, MOBX_REACT_LITE_PACKAGE_NAME) !== null;
|
|
37458
|
-
facts.hasMobxStateTree = facts.hasMobxStateTree || getDependencySpec(packageJson, MOBX_STATE_TREE_PACKAGE_NAME) !== null;
|
|
37459
|
-
facts.hasMobxReactObserver = facts.hasMobxReactObserver || getDependencySpec(packageJson, MOBX_REACT_OBSERVER_PACKAGE_NAME) !== null;
|
|
37460
|
-
const zustandSpec = getDependencySpec(packageJson, "zustand");
|
|
37461
|
-
if (zustandSpec !== null) {
|
|
37462
|
-
const nextZustandFact = {
|
|
37463
|
-
version: resolveCatalogBackedDependencyVersion({
|
|
37464
|
-
rootDirectory: directory,
|
|
37465
|
-
rootPackageJson: packageJson,
|
|
37466
|
-
packageName: "zustand",
|
|
37467
|
-
version: zustandSpec
|
|
37468
|
-
}),
|
|
37469
|
-
sourceDirectory: directory
|
|
37470
|
-
};
|
|
37471
|
-
if (shouldReplaceSupportedDependencyFact(facts.zustand, nextZustandFact, 5)) facts.zustand = nextZustandFact;
|
|
37472
|
-
}
|
|
37473
37360
|
if (facts.reanimatedVersion === null) {
|
|
37474
37361
|
const spec = getDependencySpec(packageJson, REANIMATED_DEPENDENCY_NAME);
|
|
37475
37362
|
if (spec !== null) facts.reanimatedVersion = spec;
|
|
37476
37363
|
}
|
|
37477
|
-
if (facts.valtioVersion === null) {
|
|
37478
|
-
const spec = getDependencySpec(packageJson, "valtio");
|
|
37479
|
-
if (spec !== null) facts.valtioVersion = spec;
|
|
37480
|
-
}
|
|
37481
|
-
facts.tanstackQueryVersion ??= getTanStackQueryVersion(packageJson);
|
|
37482
|
-
const styledComponentsVersion = resolveCatalogBackedDependencyVersion({
|
|
37483
|
-
rootDirectory: directory,
|
|
37484
|
-
rootPackageJson: packageJson,
|
|
37485
|
-
packageName: "styled-components",
|
|
37486
|
-
version: getStyledComponentsVersion(packageJson)
|
|
37487
|
-
});
|
|
37488
|
-
if (styledComponentsVersion && shouldReplaceStyledComponentsVersion(facts.styledComponentsVersion, styledComponentsVersion)) facts.styledComponentsVersion = styledComponentsVersion;
|
|
37489
|
-
facts.hasI18nLibrary = facts.hasI18nLibrary || hasI18nDependency(packageJson);
|
|
37490
37364
|
facts.hasReactNativeAwarePackage = facts.hasReactNativeAwarePackage || isPackageJsonReactNativeAware(packageJson);
|
|
37491
37365
|
facts.hasReanimatedAwarePackage = facts.hasReanimatedAwarePackage || isPackageJsonReanimatedAware(packageJson);
|
|
37492
37366
|
facts.hasSsrDependency = facts.hasSsrDependency || isPackageJsonSsrAware(packageJson);
|
|
37493
|
-
const remotionSpec = getDependencySpec(packageJson, "remotion");
|
|
37494
|
-
if (remotionSpec !== null) {
|
|
37495
|
-
facts.hasRemotionDependency = true;
|
|
37496
|
-
const resolvedRemotionVersion = resolveCatalogBackedDependencyVersion({
|
|
37497
|
-
rootDirectory,
|
|
37498
|
-
rootPackageJson,
|
|
37499
|
-
packageName: "remotion",
|
|
37500
|
-
version: remotionSpec
|
|
37501
|
-
});
|
|
37502
|
-
const remotionMajorVersion = resolvedRemotionVersion === null ? null : getLowestDependencyMajor(resolvedRemotionVersion);
|
|
37503
|
-
if (remotionMajorVersion === null) {
|
|
37504
|
-
facts.hasUnknownRemotionVersion = true;
|
|
37505
|
-
facts.remotionVersion = null;
|
|
37506
|
-
} else if (!facts.hasUnknownRemotionVersion) {
|
|
37507
|
-
const currentRemotionMajorVersion = facts.remotionVersion === null ? null : getLowestDependencyMajor(facts.remotionVersion);
|
|
37508
|
-
if (currentRemotionMajorVersion === null || remotionMajorVersion < currentRemotionMajorVersion) facts.remotionVersion = resolvedRemotionVersion;
|
|
37509
|
-
}
|
|
37510
|
-
}
|
|
37511
37367
|
};
|
|
37512
37368
|
const collectWorkspaceFacts = (rootDirectory, rootPackageJson, { collectReactGroup }) => {
|
|
37513
37369
|
const facts = {
|
|
@@ -37527,31 +37383,12 @@ const collectWorkspaceFacts = (rootDirectory, rootPackageJson, { collectReactGro
|
|
|
37527
37383
|
version: null,
|
|
37528
37384
|
sourceDirectory: null
|
|
37529
37385
|
},
|
|
37530
|
-
valtioVersion: null,
|
|
37531
|
-
mobx: {
|
|
37532
|
-
version: null,
|
|
37533
|
-
sourceDirectory: null
|
|
37534
|
-
},
|
|
37535
|
-
hasMobxReact: false,
|
|
37536
|
-
hasMobxReactLite: false,
|
|
37537
|
-
hasMobxStateTree: false,
|
|
37538
|
-
hasMobxReactObserver: false,
|
|
37539
|
-
zustand: {
|
|
37540
|
-
version: null,
|
|
37541
|
-
sourceDirectory: null
|
|
37542
|
-
},
|
|
37543
|
-
tanstackQueryVersion: null,
|
|
37544
|
-
styledComponentsVersion: null,
|
|
37545
|
-
hasI18nLibrary: false,
|
|
37546
37386
|
hasReactNativeAwarePackage: false,
|
|
37547
37387
|
hasReanimatedAwarePackage: false,
|
|
37548
37388
|
hasSsrDependency: false,
|
|
37549
|
-
hasRemotionDependency: false,
|
|
37550
|
-
hasUnknownRemotionVersion: false,
|
|
37551
|
-
remotionVersion: null,
|
|
37552
37389
|
reanimatedVersion: null
|
|
37553
37390
|
};
|
|
37554
|
-
evaluateManifestFacts(facts, rootPackageJson, rootDirectory
|
|
37391
|
+
evaluateManifestFacts(facts, rootPackageJson, rootDirectory);
|
|
37555
37392
|
let isReactGroupSettled = !collectReactGroup;
|
|
37556
37393
|
const visitedDirectories = /* @__PURE__ */ new Set();
|
|
37557
37394
|
for (const pattern of getWorkspacePatterns(rootDirectory, rootPackageJson)) {
|
|
@@ -37560,7 +37397,7 @@ const collectWorkspaceFacts = (rootDirectory, rootPackageJson, { collectReactGro
|
|
|
37560
37397
|
if (visitedDirectories.has(workspaceDirectory)) continue;
|
|
37561
37398
|
visitedDirectories.add(workspaceDirectory);
|
|
37562
37399
|
const workspacePackageJson = readPackageJson$1(Path.join(workspaceDirectory, "package.json"));
|
|
37563
|
-
evaluateManifestFacts(facts, workspacePackageJson, workspaceDirectory
|
|
37400
|
+
evaluateManifestFacts(facts, workspacePackageJson, workspaceDirectory);
|
|
37564
37401
|
const info = extractDependencyInfo(workspacePackageJson);
|
|
37565
37402
|
if (info.framework !== "unknown" && frameworkMergeRank(info.framework) < frameworkMergeRank(facts.framework)) facts.framework = info.framework;
|
|
37566
37403
|
if (isReactGroupSettled) continue;
|
|
@@ -37781,27 +37618,11 @@ const discoverProjectWithoutPackageJson = (directory) => {
|
|
|
37781
37618
|
tailwindVersion: null,
|
|
37782
37619
|
zodVersion: null,
|
|
37783
37620
|
zodMajorVersion: null,
|
|
37784
|
-
mobxVersion: null,
|
|
37785
|
-
mobxMajorVersion: null,
|
|
37786
|
-
hasMobxReact: false,
|
|
37787
|
-
hasMobxReactLite: false,
|
|
37788
|
-
hasMobxStateTree: false,
|
|
37789
|
-
hasMobxReactObserver: false,
|
|
37790
|
-
zustandVersion: null,
|
|
37791
|
-
zustandMajorVersion: null,
|
|
37792
37621
|
framework: "unknown",
|
|
37793
37622
|
hasTypeScript: hasOwnTsConfig,
|
|
37794
37623
|
hasReactCompiler: false,
|
|
37795
37624
|
hasReactCompilerLintPlugin: false,
|
|
37796
37625
|
hasTanStackQuery: false,
|
|
37797
|
-
valtioVersion: null,
|
|
37798
|
-
valtioMajorVersion: null,
|
|
37799
|
-
hasRemotion: false,
|
|
37800
|
-
remotionVersion: null,
|
|
37801
|
-
remotionMajorVersion: null,
|
|
37802
|
-
hasI18nLibrary: false,
|
|
37803
|
-
tanstackQueryVersion: null,
|
|
37804
|
-
styledComponentsVersion: null,
|
|
37805
37626
|
hasSsrDependency: false,
|
|
37806
37627
|
preactVersion: null,
|
|
37807
37628
|
preactMajorVersion: null,
|
|
@@ -37900,12 +37721,6 @@ const discoverProject = (directory) => {
|
|
|
37900
37721
|
packageName: SHOPIFY_FLASH_LIST_PACKAGE_NAME,
|
|
37901
37722
|
version: workspaceFacts.shopifyFlashList.version
|
|
37902
37723
|
}) : null;
|
|
37903
|
-
const zustandVersion = resolveCatalogBackedDependencyVersion({
|
|
37904
|
-
rootDirectory: directory,
|
|
37905
|
-
rootPackageJson: packageJson,
|
|
37906
|
-
packageName: "zustand",
|
|
37907
|
-
version: workspaceFacts.zustand.version
|
|
37908
|
-
});
|
|
37909
37724
|
const hasReanimated = hasReactNativeWorkspace && workspaceFacts.hasReanimatedAwarePackage;
|
|
37910
37725
|
const reanimatedVersion = hasReanimated ? workspaceFacts.reanimatedVersion : null;
|
|
37911
37726
|
const nextjsVersion = framework === "nextjs" ? resolveCatalogBackedDependencyVersion({
|
|
@@ -37914,21 +37729,7 @@ const discoverProject = (directory) => {
|
|
|
37914
37729
|
packageName: "next",
|
|
37915
37730
|
version: workspaceFacts.next.version
|
|
37916
37731
|
}) : null;
|
|
37917
|
-
const valtioVersion = resolveCatalogBackedDependencyVersion({
|
|
37918
|
-
rootDirectory: directory,
|
|
37919
|
-
rootPackageJson: packageJson,
|
|
37920
|
-
packageName: "valtio",
|
|
37921
|
-
version: workspaceFacts.valtioVersion
|
|
37922
|
-
});
|
|
37923
|
-
const mobxVersion = resolveCatalogBackedDependencyVersion({
|
|
37924
|
-
rootDirectory: directory,
|
|
37925
|
-
rootPackageJson: packageJson,
|
|
37926
|
-
packageName: "mobx",
|
|
37927
|
-
version: workspaceFacts.mobx.version
|
|
37928
|
-
});
|
|
37929
37732
|
const preactVersion = getPreactVersion(packageJson);
|
|
37930
|
-
const remotionVersion = workspaceFacts.remotionVersion;
|
|
37931
|
-
const tanstackQueryVersion = getTanStackQueryVersion(packageJson) ?? workspaceFacts.tanstackQueryVersion;
|
|
37932
37733
|
const isPreES2023Target = hasTypeScript && detectPreES2023Target(directory);
|
|
37933
37734
|
const projectInfo = {
|
|
37934
37735
|
rootDirectory: directory,
|
|
@@ -37938,27 +37739,11 @@ const discoverProject = (directory) => {
|
|
|
37938
37739
|
tailwindVersion,
|
|
37939
37740
|
zodVersion,
|
|
37940
37741
|
zodMajorVersion: zodVersion === null ? null : getLowestDependencyMajor(zodVersion),
|
|
37941
|
-
mobxVersion,
|
|
37942
|
-
mobxMajorVersion: mobxVersion === null ? null : getLowestDependencyMajor(mobxVersion),
|
|
37943
|
-
hasMobxReact: workspaceFacts.hasMobxReact,
|
|
37944
|
-
hasMobxReactLite: workspaceFacts.hasMobxReactLite,
|
|
37945
|
-
hasMobxStateTree: workspaceFacts.hasMobxStateTree,
|
|
37946
|
-
hasMobxReactObserver: workspaceFacts.hasMobxReactObserver,
|
|
37947
|
-
zustandVersion,
|
|
37948
|
-
zustandMajorVersion: zustandVersion === null ? null : getLowestDependencyMajor(zustandVersion),
|
|
37949
37742
|
framework,
|
|
37950
37743
|
hasTypeScript,
|
|
37951
37744
|
hasReactCompiler: detectReactCompiler(directory, packageJson),
|
|
37952
37745
|
hasReactCompilerLintPlugin: detectReactCompilerLintPlugin(directory, packageJson),
|
|
37953
|
-
hasTanStackQuery:
|
|
37954
|
-
hasI18nLibrary: workspaceFacts.hasI18nLibrary,
|
|
37955
|
-
tanstackQueryVersion,
|
|
37956
|
-
styledComponentsVersion: workspaceFacts.styledComponentsVersion,
|
|
37957
|
-
valtioVersion,
|
|
37958
|
-
valtioMajorVersion: valtioVersion === null ? null : getLowestDependencyMajor(valtioVersion),
|
|
37959
|
-
hasRemotion: workspaceFacts.hasRemotionDependency,
|
|
37960
|
-
remotionVersion,
|
|
37961
|
-
remotionMajorVersion: remotionVersion === null ? null : getLowestDependencyMajor(remotionVersion),
|
|
37746
|
+
hasTanStackQuery: hasTanStackQuery(packageJson),
|
|
37962
37747
|
hasSsrDependency: workspaceFacts.hasSsrDependency,
|
|
37963
37748
|
preactVersion,
|
|
37964
37749
|
preactMajorVersion: parseReactMajor(preactVersion),
|
|
@@ -40513,25 +40298,9 @@ const BABEL_CONFIG_FILE_NAMES = [
|
|
|
40513
40298
|
".babelrc.json"
|
|
40514
40299
|
];
|
|
40515
40300
|
const LEGACY_PRESET_SPEC = "module:metro-react-native-babel-preset";
|
|
40516
|
-
const LEGACY_PRESET_PACKAGE = "metro-react-native-babel-preset";
|
|
40517
|
-
const REACT_NATIVE_PACKAGE = "react-native";
|
|
40518
|
-
const PRESET_RENAME_MINIMUM_REACT_NATIVE_VERSION = "0.73.0";
|
|
40519
|
-
const LEGACY_PRESET_REFERENCE = new RegExp(`['"]${LEGACY_PRESET_SPEC}['"]`);
|
|
40520
40301
|
const MODERN_PRESET_REFERENCE = new RegExp(`['"]module:@react-native/babel-preset['"]`);
|
|
40521
40302
|
const ENABLE_BABEL_RUNTIME_VERSION = /enableBabelRuntime["']?\s*:\s*['"]/;
|
|
40522
|
-
const isReactNativeVersionAtLeastPresetRename = (rootDirectory, packageJson) => {
|
|
40523
|
-
const installedReactNativeManifestPath = Path.join(rootDirectory, "node_modules", REACT_NATIVE_PACKAGE, "package.json");
|
|
40524
|
-
const reactNativeVersionSpec = (isFile(installedReactNativeManifestPath) ? readPackageJson$1(installedReactNativeManifestPath).version : void 0) ?? getDependencySpec(packageJson, REACT_NATIVE_PACKAGE);
|
|
40525
|
-
if (reactNativeVersionSpec === null || reactNativeVersionSpec === void 0) return false;
|
|
40526
|
-
const normalizedVersionRange = import_semver.validRange(reactNativeVersionSpec);
|
|
40527
|
-
if (normalizedVersionRange === null) return false;
|
|
40528
|
-
const minimumVersion = import_semver.minVersion(normalizedVersionRange);
|
|
40529
|
-
return minimumVersion !== null && import_semver.gte(minimumVersion, PRESET_RENAME_MINIMUM_REACT_NATIVE_VERSION);
|
|
40530
|
-
};
|
|
40531
|
-
const canResolveLegacyPreset = (rootDirectory, packageJson) => getDependencySpec(packageJson, LEGACY_PRESET_PACKAGE) !== null || isFile(Path.join(rootDirectory, "node_modules", LEGACY_PRESET_PACKAGE, "package.json"));
|
|
40532
40303
|
const checkReactNativeMetroBabelPreset = (rootDirectory) => {
|
|
40533
|
-
const packageJson = readPackageJson$1(Path.join(rootDirectory, "package.json"));
|
|
40534
|
-
const shouldReportLegacyPreset = isReactNativeVersionAtLeastPresetRename(rootDirectory, packageJson) && !canResolveLegacyPreset(rootDirectory, packageJson);
|
|
40535
40304
|
for (const fileName of BABEL_CONFIG_FILE_NAMES) {
|
|
40536
40305
|
const filePath = Path.join(rootDirectory, fileName);
|
|
40537
40306
|
if (!isFile(filePath)) continue;
|
|
@@ -40541,7 +40310,7 @@ const checkReactNativeMetroBabelPreset = (rootDirectory) => {
|
|
|
40541
40310
|
} catch {
|
|
40542
40311
|
continue;
|
|
40543
40312
|
}
|
|
40544
|
-
if (
|
|
40313
|
+
if (contents.includes(LEGACY_PRESET_SPEC)) return [buildReactNativeDiagnostic({
|
|
40545
40314
|
filePath: fileName,
|
|
40546
40315
|
rule: "rn-no-metro-babel-preset",
|
|
40547
40316
|
severity: "error",
|
|
@@ -40564,6 +40333,12 @@ const checkReactNativeProject = (rootDirectory, project) => {
|
|
|
40564
40333
|
return [...checkReactNativeMetroBabelPreset(rootDirectory), ...checkReactNativeLibraryDependencies(rootDirectory)];
|
|
40565
40334
|
};
|
|
40566
40335
|
const RULE_KEY = "no-vulnerable-react-server-components";
|
|
40336
|
+
const DEPENDENCY_SECTIONS = [
|
|
40337
|
+
"dependencies",
|
|
40338
|
+
"devDependencies",
|
|
40339
|
+
"peerDependencies",
|
|
40340
|
+
"optionalDependencies"
|
|
40341
|
+
];
|
|
40567
40342
|
const REACT_RSC_ADVISORIES_BY_MINOR = {
|
|
40568
40343
|
"19.0": {
|
|
40569
40344
|
rceFixedVersion: "19.0.1",
|
|
@@ -40610,13 +40385,20 @@ const enumerateWorkspaceDirectories = (workspaceRoot) => {
|
|
|
40610
40385
|
for (const pattern of patterns) for (const directory of resolveWorkspaceDirectories(workspaceRoot, pattern)) directories.add(directory);
|
|
40611
40386
|
return [...directories];
|
|
40612
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
|
+
};
|
|
40613
40395
|
const resolveVersionInDirectory = (directory, packageName, declaredSpecOverride) => {
|
|
40614
40396
|
const manifestPath = Path.join(directory, "node_modules", packageName, "package.json");
|
|
40615
40397
|
if (isFile(manifestPath)) {
|
|
40616
40398
|
const installedVersion = import_semver.valid(readPackageJson$1(manifestPath).version ?? null);
|
|
40617
40399
|
if (installedVersion !== null) return installedVersion;
|
|
40618
40400
|
}
|
|
40619
|
-
const candidateSpecs = [
|
|
40401
|
+
const candidateSpecs = [readDeclaredSpec(readPackageJson$1(Path.join(directory, "package.json")), packageName), declaredSpecOverride];
|
|
40620
40402
|
for (const spec of candidateSpecs) {
|
|
40621
40403
|
const pinnedVersion = spec === null ? null : import_semver.valid(spec);
|
|
40622
40404
|
if (pinnedVersion !== null) return pinnedVersion;
|
|
@@ -41284,50 +41066,21 @@ const buildCapabilities = (project) => {
|
|
|
41284
41066
|
if (CLIENT_ONLY_FRAMEWORKS.has(project.framework)) capabilities.add("client-only");
|
|
41285
41067
|
if (project.isStaticExport) capabilities.add("nextjs:static-export");
|
|
41286
41068
|
if (project.nextjsMajorVersion !== null && project.nextjsMajorVersion >= 15) capabilities.add("nextjs:15");
|
|
41287
|
-
if (project.nextjsMajorVersion !== null && project.nextjsMajorVersion >= 16) capabilities.add("nextjs:16");
|
|
41288
41069
|
addMajorLadder(capabilities, "react", project.reactMajorVersion, 17, 30);
|
|
41289
41070
|
if (project.reactMajorVersion !== null && project.reactMajorVersion >= 19 && isMajorMinorAtLeast(parseReactMajorMinor(project.reactVersion), {
|
|
41290
41071
|
major: 19,
|
|
41291
41072
|
minor: 2
|
|
41292
41073
|
})) capabilities.add("react:19.2");
|
|
41293
|
-
if (project.tailwindVersion !== null)
|
|
41294
|
-
|
|
41295
|
-
|
|
41296
|
-
|
|
41297
|
-
|
|
41298
|
-
minor: 4
|
|
41299
|
-
})) capabilities.add("tailwind:3.4");
|
|
41300
|
-
if (tailwindVersion !== null && isMajorMinorAtLeast(tailwindVersion, {
|
|
41301
|
-
major: 4,
|
|
41302
|
-
minor: 0
|
|
41303
|
-
})) capabilities.add("tailwind:4");
|
|
41304
|
-
}
|
|
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");
|
|
41305
41079
|
if (project.zodVersion !== null) capabilities.add("zod");
|
|
41306
41080
|
if (project.zodMajorVersion !== null && project.zodMajorVersion >= 4) capabilities.add("zod:4");
|
|
41307
|
-
if (project.mobxVersion !== void 0 && project.mobxVersion !== null || project.hasMobxReact === true || project.hasMobxReactLite === true || project.hasMobxStateTree === true || project.hasMobxReactObserver === true) capabilities.add("mobx");
|
|
41308
|
-
if (project.hasMobxReact === true) capabilities.add("mobx-react");
|
|
41309
|
-
if (project.hasMobxReactLite === true) capabilities.add("mobx-react-lite");
|
|
41310
|
-
if (project.hasMobxReact === true || project.hasMobxReactLite === true) capabilities.add("mobx-react-binding");
|
|
41311
|
-
if (project.hasMobxStateTree === true) capabilities.add("mobx-state-tree");
|
|
41312
|
-
if (project.hasMobxReactObserver === true) capabilities.add("mobx-react-observer");
|
|
41313
|
-
if (project.mobxMajorVersion !== void 0 && project.mobxMajorVersion !== null && project.mobxMajorVersion >= 4 && project.mobxMajorVersion <= 6) addMajorLadder(capabilities, "mobx", project.mobxMajorVersion, 4, 6);
|
|
41314
|
-
if (project.zustandVersion !== void 0 && project.zustandVersion !== null) capabilities.add("zustand");
|
|
41315
|
-
if (project.zustandMajorVersion !== void 0 && project.zustandMajorVersion !== null && project.zustandMajorVersion >= 1 && project.zustandMajorVersion <= 5) addMajorLadder(capabilities, "zustand", project.zustandMajorVersion, 1, 5);
|
|
41316
41081
|
if (project.isPreES2023Target) capabilities.add("pre-es2023");
|
|
41317
41082
|
if (project.hasReactCompiler) capabilities.add("react-compiler");
|
|
41318
|
-
if (
|
|
41319
|
-
if (project.styledComponentsVersion) {
|
|
41320
|
-
capabilities.add("styled-components");
|
|
41321
|
-
const styledComponentsMajor = getLowestDependencyMajor(project.styledComponentsVersion);
|
|
41322
|
-
if (styledComponentsMajor !== null && styledComponentsMajor >= 6) capabilities.add("styled-components:6");
|
|
41323
|
-
}
|
|
41324
|
-
if (project.hasI18nLibrary) capabilities.add("i18n");
|
|
41325
|
-
if (project.valtioVersion !== null) capabilities.add("valtio");
|
|
41326
|
-
addMajorLadder(capabilities, "valtio", project.valtioMajorVersion, 1, 10);
|
|
41327
|
-
if (project.hasRemotion) {
|
|
41328
|
-
capabilities.add("remotion");
|
|
41329
|
-
addMajorLadder(capabilities, "remotion", project.remotionMajorVersion ?? null, 4, 30);
|
|
41330
|
-
}
|
|
41083
|
+
if (project.hasTanStackQuery) capabilities.add("tanstack-query");
|
|
41331
41084
|
if (project.hasTypeScript) capabilities.add("typescript");
|
|
41332
41085
|
if (project.preactVersion !== null) capabilities.add("preact");
|
|
41333
41086
|
addMajorLadder(capabilities, "preact", project.preactMajorVersion, 10, 20);
|
|
@@ -41342,7 +41095,7 @@ const getCapabilities = (project) => {
|
|
|
41342
41095
|
capabilitiesByProject.set(project, capabilities);
|
|
41343
41096
|
return capabilities;
|
|
41344
41097
|
};
|
|
41345
|
-
const shouldEnableRule = (requires, tags, capabilities, ignoredTags, disabledWhen
|
|
41098
|
+
const shouldEnableRule = (requires, tags, capabilities, ignoredTags, disabledWhen) => {
|
|
41346
41099
|
if (requires) {
|
|
41347
41100
|
for (const capability of requires) if (!capabilities.has(capability)) return false;
|
|
41348
41101
|
}
|
|
@@ -41353,29 +41106,20 @@ const shouldEnableRule = (requires, tags, capabilities, ignoredTags, disabledWhe
|
|
|
41353
41106
|
if (tags) {
|
|
41354
41107
|
for (const tag of tags) if (ignoredTags.has(tag)) return false;
|
|
41355
41108
|
}
|
|
41356
|
-
if (includedTags && includedTags.size > 0) {
|
|
41357
|
-
if (!tags?.some((tag) => includedTags.has(tag))) return false;
|
|
41358
|
-
}
|
|
41359
41109
|
return true;
|
|
41360
41110
|
};
|
|
41361
|
-
const shouldEnableRuleByDefaultStatus = (options) => options.defaultEnabled !== false || options.hasExplicitOverride === true || options.includeTagDefaults && options.hasIncludedTags;
|
|
41362
41111
|
const yieldToEventLoop = () => new Promise((resolve) => {
|
|
41363
41112
|
setImmediate(resolve);
|
|
41364
41113
|
});
|
|
41365
41114
|
const createSecurityScanSession = (rootDirectory, options) => {
|
|
41366
41115
|
const capabilities = options.project ? getCapabilities(options.project) : /* @__PURE__ */ new Set();
|
|
41367
41116
|
const ignoredTags = options.ignoredTags ?? /* @__PURE__ */ new Set();
|
|
41368
|
-
const includedTags = options.includedTags ?? /* @__PURE__ */ new Set();
|
|
41369
41117
|
const enabledScanRules = REACT_DOCTOR_RULES.flatMap((entry) => {
|
|
41370
41118
|
const rule = entry.rule;
|
|
41371
41119
|
const scan = rule.scan;
|
|
41372
41120
|
if (typeof scan !== "function") return [];
|
|
41373
|
-
if (
|
|
41374
|
-
|
|
41375
|
-
includeTagDefaults: options.includeTagDefaults === true,
|
|
41376
|
-
hasIncludedTags: includedTags.size > 0
|
|
41377
|
-
})) return [];
|
|
41378
|
-
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 [];
|
|
41379
41123
|
return [{
|
|
41380
41124
|
entry,
|
|
41381
41125
|
scan,
|
|
@@ -43377,9 +43121,8 @@ const buildUserPluginRules = (userPlugin, severityControls) => {
|
|
|
43377
43121
|
}
|
|
43378
43122
|
return enabled;
|
|
43379
43123
|
};
|
|
43380
|
-
const createOxlintConfig = ({ pluginPath, project, customRulesOnly = false, extendsPaths = [], ignoredTags = /* @__PURE__ */ new Set(),
|
|
43381
|
-
const
|
|
43382
|
-
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);
|
|
43383
43126
|
const reactCompilerRules = reactHooksJsPlugin ? applyRuleSeverityControls(filterRulesToAvailable(REACT_COMPILER_RULES, "react-hooks-js", reactHooksJsPlugin.availableRuleNames), severityControls) : {};
|
|
43384
43127
|
const jsPlugins = [];
|
|
43385
43128
|
if (reactHooksJsPlugin) jsPlugins.push(reactHooksJsPlugin.entry);
|
|
@@ -43394,14 +43137,9 @@ const createOxlintConfig = ({ pluginPath, project, customRulesOnly = false, exte
|
|
|
43394
43137
|
if (rule.scan !== void 0) continue;
|
|
43395
43138
|
if (customRulesOnly && registryEntry.originallyExternal) continue;
|
|
43396
43139
|
if (rule.framework !== "global" && !rule.requires) continue;
|
|
43397
|
-
if (!shouldEnableRule(rule.requires, rule.tags, capabilities, ignoredTags, rule.disabledWhen
|
|
43140
|
+
if (!shouldEnableRule(rule.requires, rule.tags, capabilities, ignoredTags, rule.disabledWhen)) continue;
|
|
43398
43141
|
const explicitRuleOverride = resolveRuleSeverityOverride({ ruleKey: registryEntry.key }, severityControls);
|
|
43399
|
-
if (
|
|
43400
|
-
defaultEnabled: rule.defaultEnabled,
|
|
43401
|
-
includeTagDefaults,
|
|
43402
|
-
hasIncludedTags,
|
|
43403
|
-
hasExplicitOverride: explicitRuleOverride !== void 0
|
|
43404
|
-
})) continue;
|
|
43142
|
+
if (rule.defaultEnabled === false && explicitRuleOverride === void 0) continue;
|
|
43405
43143
|
const severity = resolveRuleSeverityOverride({
|
|
43406
43144
|
ruleKey: registryEntry.key,
|
|
43407
43145
|
category: rule.category
|
|
@@ -43410,7 +43148,7 @@ const createOxlintConfig = ({ pluginPath, project, customRulesOnly = false, exte
|
|
|
43410
43148
|
enabledReactDoctorRules[registryEntry.key] = severity;
|
|
43411
43149
|
}
|
|
43412
43150
|
const userPluginRules = {};
|
|
43413
|
-
if (ruleSelection !== "sidecar"
|
|
43151
|
+
if (ruleSelection !== "sidecar") for (const userPlugin of userPlugins) {
|
|
43414
43152
|
Object.assign(userPluginRules, buildUserPluginRules(userPlugin, severityControls));
|
|
43415
43153
|
jsPlugins.push(userPlugin.entry);
|
|
43416
43154
|
}
|
|
@@ -43627,19 +43365,6 @@ const createSidecarLintCache = (cacheDirectory, rulesetHash) => {
|
|
|
43627
43365
|
}
|
|
43628
43366
|
};
|
|
43629
43367
|
};
|
|
43630
|
-
const fingerprintCacheByFilePath = /* @__PURE__ */ new Map();
|
|
43631
|
-
const fingerprintFileContents = (filePath, fingerprintLength) => {
|
|
43632
|
-
const fileStats = NFS.statSync(filePath, { bigint: true });
|
|
43633
|
-
const cachedFingerprint = fingerprintCacheByFilePath.get(filePath);
|
|
43634
|
-
if (cachedFingerprint?.modifiedTimeNanoseconds === fileStats.mtimeNs && cachedFingerprint.sizeBytes === fileStats.size) return cachedFingerprint.fingerprint;
|
|
43635
|
-
const fingerprint = crypto.createHash("sha256").update(NFS.readFileSync(filePath)).digest("hex").slice(0, fingerprintLength);
|
|
43636
|
-
fingerprintCacheByFilePath.set(filePath, {
|
|
43637
|
-
fingerprint,
|
|
43638
|
-
modifiedTimeNanoseconds: fileStats.mtimeNs,
|
|
43639
|
-
sizeBytes: fileStats.size
|
|
43640
|
-
});
|
|
43641
|
-
return fingerprint;
|
|
43642
|
-
};
|
|
43643
43368
|
const bundledRequire$3 = createRequire(import.meta.url);
|
|
43644
43369
|
const childNodeVersionByBinaryPath = /* @__PURE__ */ new Map();
|
|
43645
43370
|
const resolveChildNodeVersion = (nodeBinaryPath) => {
|
|
@@ -43663,13 +43388,6 @@ const TOOLCHAIN_PACKAGE_SPECIFIERS$1 = [
|
|
|
43663
43388
|
"oxlint-plugin-react-doctor/package.json",
|
|
43664
43389
|
"eslint-plugin-react-hooks/package.json"
|
|
43665
43390
|
];
|
|
43666
|
-
const resolvePluginFingerprint = () => {
|
|
43667
|
-
try {
|
|
43668
|
-
return fingerprintFileContents(bundledRequire$3.resolve("oxlint-plugin-react-doctor"), 16);
|
|
43669
|
-
} catch {
|
|
43670
|
-
return "unresolved";
|
|
43671
|
-
}
|
|
43672
|
-
};
|
|
43673
43391
|
const resolveOxlintToolchainVersions = (nodeBinaryPath = process.execPath) => {
|
|
43674
43392
|
const versions = [`node=${resolveChildNodeVersion(nodeBinaryPath)}`];
|
|
43675
43393
|
for (const specifier of TOOLCHAIN_PACKAGE_SPECIFIERS$1) try {
|
|
@@ -43679,7 +43397,6 @@ const resolveOxlintToolchainVersions = (nodeBinaryPath = process.execPath) => {
|
|
|
43679
43397
|
} catch {
|
|
43680
43398
|
versions.push(`${specifier}=missing`);
|
|
43681
43399
|
}
|
|
43682
|
-
versions.push(`oxlint-plugin-react-doctor#fingerprint=${resolvePluginFingerprint()}`);
|
|
43683
43400
|
return versions;
|
|
43684
43401
|
};
|
|
43685
43402
|
const esmRequire = createRequire(import.meta.url);
|
|
@@ -45155,7 +44872,7 @@ const reactHooksJsPluginDropNote = (error) => {
|
|
|
45155
44872
|
* 6. always restore disable directives + clean up the temp dir
|
|
45156
44873
|
*/
|
|
45157
44874
|
const runOxlint = async (options) => {
|
|
45158
|
-
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;
|
|
45159
44876
|
const serverAuthFunctionNames = Array.isArray(userConfig?.serverAuthFunctionNames) ? userConfig.serverAuthFunctionNames.filter((entry) => typeof entry === "string" && entry.length > 0) : void 0;
|
|
45160
44877
|
const severityControls = buildRuleSeverityControls(userConfig);
|
|
45161
44878
|
validateRuleRegistration();
|
|
@@ -45169,15 +44886,13 @@ const runOxlint = async (options) => {
|
|
|
45169
44886
|
}
|
|
45170
44887
|
const pluginPath = resolvePluginPath();
|
|
45171
44888
|
const extendsPaths = (adoptExistingLintConfig && !customRulesOnly ? detectUserLintConfigPaths(rootDirectory) : []).filter(canOxlintExtendConfig);
|
|
45172
|
-
const userPlugins =
|
|
44889
|
+
const userPlugins = resolveUserPlugins(userConfig?.plugins, configSourceDirectory);
|
|
45173
44890
|
const buildConfig = (overrides) => createOxlintConfig({
|
|
45174
44891
|
pluginPath,
|
|
45175
44892
|
project,
|
|
45176
44893
|
customRulesOnly,
|
|
45177
44894
|
extendsPaths: overrides.extendsPaths,
|
|
45178
44895
|
ignoredTags,
|
|
45179
|
-
includedTags,
|
|
45180
|
-
includeTagDefaults,
|
|
45181
44896
|
serverAuthFunctionNames,
|
|
45182
44897
|
severityControls,
|
|
45183
44898
|
userPlugins,
|
|
@@ -45566,8 +45281,6 @@ var Linter = class Linter extends Service()("react-doctor/Linter") {
|
|
|
45566
45281
|
respectInlineDisables: input.respectInlineDisables,
|
|
45567
45282
|
adoptExistingLintConfig: input.adoptExistingLintConfig,
|
|
45568
45283
|
ignoredTags: input.ignoredTags,
|
|
45569
|
-
includedTags: input.includedTags,
|
|
45570
|
-
includeTagDefaults: input.includeTagDefaults,
|
|
45571
45284
|
userConfig: input.userConfig ?? null,
|
|
45572
45285
|
configSourceDirectory: input.configSourceDirectory,
|
|
45573
45286
|
onPartialFailure: (reason) => {
|
|
@@ -46416,9 +46129,7 @@ const runInspect = (input, hooks = {}) => gen(function* () {
|
|
|
46416
46129
|
const securityScanFailedRef = yield* make$13(false);
|
|
46417
46130
|
const securityScanFiber = yield* forkChild(runCollect(applyPerElementPipeline(isDiffMode ? empty$4 : unwrap(tryPromise(() => checkSecurityScanCooperative(scanDirectory, {
|
|
46418
46131
|
project,
|
|
46419
|
-
ignoredTags: input.ignoredTags
|
|
46420
|
-
includedTags: input.includedTags,
|
|
46421
|
-
includeTagDefaults: input.includeTagDefaults
|
|
46132
|
+
ignoredTags: input.ignoredTags
|
|
46422
46133
|
})).pipe(map$3((diagnostics) => fromIterable$1(diagnostics)), catch_$1(() => set(securityScanFailedRef, true).pipe(as(empty$4))))))).pipe(withSpan("SecurityScan.run")));
|
|
46423
46134
|
const shouldRunSupplyChain = !isDiffMode || (input.supplyChainManifestChanged ?? false);
|
|
46424
46135
|
const supplyChainOverlapTimeout = yield* SupplyChainOverlapTimeoutMs;
|
|
@@ -46509,8 +46220,6 @@ const runInspect = (input, hooks = {}) => gen(function* () {
|
|
|
46509
46220
|
respectInlineDisables: input.respectInlineDisables,
|
|
46510
46221
|
adoptExistingLintConfig: input.adoptExistingLintConfig,
|
|
46511
46222
|
ignoredTags: input.ignoredTags,
|
|
46512
|
-
includedTags: input.includedTags,
|
|
46513
|
-
includeTagDefaults: input.includeTagDefaults,
|
|
46514
46223
|
userConfig: resolvedConfig.config ?? void 0,
|
|
46515
46224
|
configSourceDirectory: resolvedConfig.configSourceDirectory ?? void 0,
|
|
46516
46225
|
onFileProgress: (scannedFileCount, totalFileCount) => {
|
|
@@ -47655,7 +47364,7 @@ const makeNoopConsole = () => ({
|
|
|
47655
47364
|
});
|
|
47656
47365
|
//#endregion
|
|
47657
47366
|
//#region src/cli/utils/version.ts
|
|
47658
|
-
const VERSION = "0.8.1-dev.
|
|
47367
|
+
const VERSION = "0.8.1-dev.21221c2";
|
|
47659
47368
|
//#endregion
|
|
47660
47369
|
//#region src/cli/utils/json-mode.ts
|
|
47661
47370
|
let context = null;
|
|
@@ -47742,11 +47451,7 @@ const getRunId = () => {
|
|
|
47742
47451
|
};
|
|
47743
47452
|
//#endregion
|
|
47744
47453
|
//#region src/cli/utils/build-run-context.ts
|
|
47745
|
-
const ROOT_SUBCOMMANDS = new Set([
|
|
47746
|
-
"design",
|
|
47747
|
-
"install",
|
|
47748
|
-
"setup"
|
|
47749
|
-
]);
|
|
47454
|
+
const ROOT_SUBCOMMANDS = new Set(["install", "setup"]);
|
|
47750
47455
|
const detectInvokedVia = () => {
|
|
47751
47456
|
const userAgent = process.env.npm_config_user_agent;
|
|
47752
47457
|
if (!userAgent) return "unknown";
|
|
@@ -47830,9 +47535,7 @@ const buildSentryProjectContext = (projectInfo) => ({
|
|
|
47830
47535
|
reactMajorVersion: projectInfo.reactMajorVersion,
|
|
47831
47536
|
hasTypeScript: projectInfo.hasTypeScript,
|
|
47832
47537
|
hasReactCompiler: projectInfo.hasReactCompiler,
|
|
47833
|
-
|
|
47834
|
-
mobxVersion: projectInfo.mobxVersion,
|
|
47835
|
-
styledComponentsVersion: projectInfo.styledComponentsVersion,
|
|
47538
|
+
hasTanStackQuery: projectInfo.hasTanStackQuery,
|
|
47836
47539
|
tailwindVersion: projectInfo.tailwindVersion,
|
|
47837
47540
|
zodVersion: projectInfo.zodVersion,
|
|
47838
47541
|
preactVersion: projectInfo.preactVersion,
|
|
@@ -48013,13 +47716,13 @@ const isDevVersion = (version) => version === "0.0.0" || version.includes("-");
|
|
|
48013
47716
|
* uploads source-map artifacts under, so stack frames symbolicate. Honors the
|
|
48014
47717
|
* standard `SENTRY_RELEASE` override.
|
|
48015
47718
|
*/
|
|
48016
|
-
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.21221c2`;
|
|
48017
47720
|
/**
|
|
48018
47721
|
* Deployment environment shown in Sentry's environment filter. Defaults to
|
|
48019
47722
|
* `production` for tagged releases and `development` for dev/unbuilt versions,
|
|
48020
47723
|
* overridable via the standard `SENTRY_ENVIRONMENT` env var.
|
|
48021
47724
|
*/
|
|
48022
|
-
const resolveSentryEnvironment = () => process.env.SENTRY_ENVIRONMENT || (isDevVersion("0.8.1-dev.
|
|
47725
|
+
const resolveSentryEnvironment = () => process.env.SENTRY_ENVIRONMENT || (isDevVersion("0.8.1-dev.21221c2") ? "development" : "production");
|
|
48023
47726
|
/**
|
|
48024
47727
|
* Performance-tracing sample rate in `[0, 1]`. Reads `SENTRY_TRACES_SAMPLE_RATE`
|
|
48025
47728
|
* (set to `0` to disable tracing) and falls back to
|
|
@@ -60345,8 +60048,6 @@ const buildScanResultCacheKey = (input) => {
|
|
|
60345
60048
|
warnings: input.options.warnings,
|
|
60346
60049
|
adoptExistingLintConfig: input.options.adoptExistingLintConfig,
|
|
60347
60050
|
ignoredTags: [...input.options.ignoredTags].sort(),
|
|
60348
|
-
includedTags: [...input.options.includedTags].sort(),
|
|
60349
|
-
includeTagDefaults: input.options.includeTagDefaults,
|
|
60350
60051
|
concurrency: input.options.concurrency,
|
|
60351
60052
|
lintBatchOrdering: resolveLintBatchOrdering(),
|
|
60352
60053
|
baselineRef: input.options.baseline?.ref,
|
|
@@ -61173,8 +60874,8 @@ const createDiagnosticEvidenceReader = (rootDirectory, options = {}) => {
|
|
|
61173
60874
|
//#endregion
|
|
61174
60875
|
//#region src/cli/utils/build-no-score-message.ts
|
|
61175
60876
|
const ENTERPRISE_CONTACT_HINT = `Want something custom to your company? Contact us at ${ENTERPRISE_CONTACT_URL}.`;
|
|
61176
|
-
const buildNoScoreMessage = (isScoreDisabled
|
|
61177
|
-
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}`;
|
|
61178
60879
|
};
|
|
61179
60880
|
//#endregion
|
|
61180
60881
|
//#region src/cli/utils/render-agent-guidance.ts
|
|
@@ -62299,47 +62000,40 @@ const buildChangedLineMatcher = (directory, changedLineRanges) => {
|
|
|
62299
62000
|
return diagnosticIntersectsLineRanges(diagnostic, ranges);
|
|
62300
62001
|
};
|
|
62301
62002
|
};
|
|
62302
|
-
const buildIgnoredTags = (userConfig
|
|
62003
|
+
const buildIgnoredTags = (userConfig) => {
|
|
62303
62004
|
const tags = /* @__PURE__ */ new Set();
|
|
62304
62005
|
if (userConfig?.ignore?.tags) for (const tag of userConfig.ignore.tags) tags.add(tag);
|
|
62305
|
-
for (const tag of includedTags) tags.delete(tag);
|
|
62306
62006
|
return tags;
|
|
62307
62007
|
};
|
|
62308
|
-
const mergeInspectOptions = (inputOptions, userConfig) => {
|
|
62309
|
-
|
|
62310
|
-
|
|
62311
|
-
|
|
62312
|
-
|
|
62313
|
-
|
|
62314
|
-
|
|
62315
|
-
|
|
62316
|
-
|
|
62317
|
-
|
|
62318
|
-
|
|
62319
|
-
|
|
62320
|
-
|
|
62321
|
-
|
|
62322
|
-
|
|
62323
|
-
|
|
62324
|
-
|
|
62325
|
-
|
|
62326
|
-
|
|
62327
|
-
|
|
62328
|
-
|
|
62329
|
-
|
|
62330
|
-
|
|
62331
|
-
|
|
62332
|
-
|
|
62333
|
-
|
|
62334
|
-
|
|
62335
|
-
|
|
62336
|
-
|
|
62337
|
-
maxDurationMs: inputOptions.maxDurationMs ?? null,
|
|
62338
|
-
baseline: inputOptions.baseline ?? null,
|
|
62339
|
-
changedLineRanges: inputOptions.changedLineRanges ?? null,
|
|
62340
|
-
supplyChainManifestChanged: inputOptions.supplyChainManifestChanged ?? false
|
|
62341
|
-
};
|
|
62342
|
-
};
|
|
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
|
+
});
|
|
62343
62037
|
const deriveScope = (options) => {
|
|
62344
62038
|
if (options.baseline) return "changed";
|
|
62345
62039
|
if (options.changedLineRanges !== null) return "lines";
|
|
@@ -62470,8 +62164,6 @@ const runBaselineComparison = async (params) => {
|
|
|
62470
62164
|
warnings: params.options.warnings,
|
|
62471
62165
|
adoptExistingLintConfig: params.options.adoptExistingLintConfig,
|
|
62472
62166
|
ignoredTags: params.options.ignoredTags,
|
|
62473
|
-
includedTags: params.options.includedTags,
|
|
62474
|
-
includeTagDefaults: params.options.includeTagDefaults,
|
|
62475
62167
|
nodeBinaryPath: params.resolvedNodeBinaryPath ?? void 0,
|
|
62476
62168
|
runDeadCode: false,
|
|
62477
62169
|
isCi: params.options.isCi,
|
|
@@ -62565,8 +62257,6 @@ const runInspectWithRuntime = async (directory, options, userConfig, hasConfigOv
|
|
|
62565
62257
|
warnings: options.warnings,
|
|
62566
62258
|
adoptExistingLintConfig: options.adoptExistingLintConfig,
|
|
62567
62259
|
ignoredTags: options.ignoredTags,
|
|
62568
|
-
includedTags: options.includedTags,
|
|
62569
|
-
includeTagDefaults: options.includeTagDefaults,
|
|
62570
62260
|
nodeBinaryPath: resolvedNodeBinaryPath ?? void 0,
|
|
62571
62261
|
runDeadCode: options.deadCode,
|
|
62572
62262
|
isCi: options.isCi,
|
|
@@ -62755,7 +62445,7 @@ const finalizeAndRender = (input) => gen(function* () {
|
|
|
62755
62445
|
securityScanFailed
|
|
62756
62446
|
});
|
|
62757
62447
|
const hasSkippedChecks = skippedChecks.length > 0;
|
|
62758
|
-
const noScoreMessage = buildNoScoreMessage(options.noScore
|
|
62448
|
+
const noScoreMessage = buildNoScoreMessage(options.noScore);
|
|
62759
62449
|
const buildResult = () => ({
|
|
62760
62450
|
diagnostics: [...diagnostics],
|
|
62761
62451
|
score,
|
|
@@ -64860,25 +64550,21 @@ const resolveParallelFlag = (parallel) => parallel === false ? 1 : void 0;
|
|
|
64860
64550
|
*/
|
|
64861
64551
|
const resolveCliInspectOptions = (flags, userConfig) => {
|
|
64862
64552
|
const wantsWarningGate = pickBlockingLevel(flags, userConfig) === "warning";
|
|
64863
|
-
const isDesignScan = flags.design === true;
|
|
64864
64553
|
return {
|
|
64865
64554
|
lint: flags.lint,
|
|
64866
|
-
deadCode:
|
|
64867
|
-
supplyChain:
|
|
64555
|
+
deadCode: flags.deadCode,
|
|
64556
|
+
supplyChain: flags.supplyChain,
|
|
64868
64557
|
verbose: flags.verbose,
|
|
64869
64558
|
outputDirectory: flags.outputDir,
|
|
64870
64559
|
respectInlineDisables: flags.respectInlineDisables === false ? false : void 0,
|
|
64871
64560
|
warnings: wantsWarningGate ? true : flags.warnings,
|
|
64872
64561
|
scoreOnly: flags.score === true,
|
|
64873
|
-
noScore:
|
|
64562
|
+
noScore: flags.score === false || flags.telemetry === false ? true : void 0,
|
|
64874
64563
|
isCi: isCiEnvironment(),
|
|
64875
64564
|
silent: Boolean(flags.json),
|
|
64876
64565
|
concurrency: resolveParallelFlag(flags.parallel),
|
|
64877
64566
|
maxDurationMs: resolveMaxDurationFlag(flags.maxDuration),
|
|
64878
|
-
categoryFilters: resolveCliCategories(flags.category)
|
|
64879
|
-
includedTags: isDesignScan ? new Set(["design"]) : void 0,
|
|
64880
|
-
includeTagDefaults: isDesignScan ? true : void 0,
|
|
64881
|
-
scoreDisabledMessage: isDesignScan ? "Design scans do not affect the React health score." : void 0
|
|
64567
|
+
categoryFilters: resolveCliCategories(flags.category)
|
|
64882
64568
|
};
|
|
64883
64569
|
};
|
|
64884
64570
|
//#endregion
|
|
@@ -65296,7 +64982,7 @@ const maybeMigrateLegacyConfig = async (requestedDirectory, { isQuiet, isStaged
|
|
|
65296
64982
|
if (!(!isQuiet && !isStaged && process.stdout.isTTY === true && !isCiOrCodingAgentEnvironment())) return;
|
|
65297
64983
|
await runProjectMigrations(requestedDirectory);
|
|
65298
64984
|
};
|
|
65299
|
-
const inspectAction = async (directory, flags
|
|
64985
|
+
const inspectAction = async (directory, flags) => {
|
|
65300
64986
|
const isScoreOnly = Boolean(flags.score);
|
|
65301
64987
|
const isJsonMode = Boolean(flags.json);
|
|
65302
64988
|
const isQuiet = isScoreOnly || isJsonMode;
|
|
@@ -65310,7 +64996,7 @@ const inspectAction = async (directory, flags, invocationCommand = "inspect") =>
|
|
|
65310
64996
|
});
|
|
65311
64997
|
if (flags.jsonOut) recordCount(METRIC.jsonOutUsed, 1);
|
|
65312
64998
|
}
|
|
65313
|
-
recordCount(METRIC.cliInvoked, 1, { command:
|
|
64999
|
+
recordCount(METRIC.cliInvoked, 1, { command: "inspect" });
|
|
65314
65000
|
try {
|
|
65315
65001
|
validateModeFlags(flags);
|
|
65316
65002
|
if (flags.staged) setJsonReportMode("staged");
|
|
@@ -65622,13 +65308,6 @@ const inspectAction = async (directory, flags, invocationCommand = "inspect") =>
|
|
|
65622
65308
|
}
|
|
65623
65309
|
};
|
|
65624
65310
|
//#endregion
|
|
65625
|
-
//#region src/cli/commands/design.ts
|
|
65626
|
-
const designAction = async (directory, flags) => inspectAction(directory, {
|
|
65627
|
-
...flags,
|
|
65628
|
-
design: true,
|
|
65629
|
-
lint: flags.lint ?? true
|
|
65630
|
-
}, "design");
|
|
65631
|
-
//#endregion
|
|
65632
65311
|
//#region src/cli/commands/install.ts
|
|
65633
65312
|
const installAction = async (options, command) => {
|
|
65634
65313
|
recordCount(METRIC.cliInvoked, 1, { command: "install" });
|
|
@@ -66465,7 +66144,6 @@ const INSTALL_FLAG_SPEC = {
|
|
|
66465
66144
|
shortOptionsWithRequiredValues: new Set(["-c"])
|
|
66466
66145
|
};
|
|
66467
66146
|
const COMMAND_FLAG_SPECS = new Map([
|
|
66468
|
-
["design", ROOT_FLAG_SPEC],
|
|
66469
66147
|
["install", INSTALL_FLAG_SPEC],
|
|
66470
66148
|
["setup", INSTALL_FLAG_SPEC],
|
|
66471
66149
|
["version", {
|
|
@@ -66622,7 +66300,6 @@ ${formatExampleLines([
|
|
|
66622
66300
|
["react-doctor --scope changed --base main", "scan only new issues vs. main"],
|
|
66623
66301
|
["react-doctor --project modules/a,modules/b", "score each module separately (names or paths)"],
|
|
66624
66302
|
["react-doctor --staged", "scan staged files (pre-commit hook)"],
|
|
66625
|
-
["react-doctor design", "run the focused UI design audit"],
|
|
66626
66303
|
["react-doctor --category Security", "show only one diagnostic category"],
|
|
66627
66304
|
["react-doctor --blocking warning", "fail CI on warnings too (default: error)"],
|
|
66628
66305
|
["react-doctor --json > report.json", "write a machine-readable report"],
|
|
@@ -66656,20 +66333,6 @@ ${highlighter.dim("Managing CI:")}
|
|
|
66656
66333
|
${highlighter.dim("Learn more:")}
|
|
66657
66334
|
${highlighter.info(CANONICAL_GITHUB_URL)}
|
|
66658
66335
|
`;
|
|
66659
|
-
const renderDesignHelpEpilog = () => `
|
|
66660
|
-
${highlighter.dim("Examples:")}
|
|
66661
|
-
${formatExampleLines([
|
|
66662
|
-
["react-doctor design", "audit UI design in the current project"],
|
|
66663
|
-
["react-doctor design ./apps/web", "audit one application"],
|
|
66664
|
-
["react-doctor design --verbose", "show every design finding"],
|
|
66665
|
-
["react-doctor design --json", "write a design-only JSON report"]
|
|
66666
|
-
])}
|
|
66667
|
-
|
|
66668
|
-
${highlighter.dim("Scope:")}
|
|
66669
|
-
Runs only rules tagged ${highlighter.info("design")}, including focused rules that stay opt-in during a general health scan.
|
|
66670
|
-
Dead-code, supply-chain, external lint-config, custom-plugin, and health-score passes are skipped.
|
|
66671
|
-
Standard scan flags such as ${highlighter.info("--scope")}, ${highlighter.info("--project")}, ${highlighter.info("--verbose")}, and ${highlighter.info("--json")} still work.
|
|
66672
|
-
`;
|
|
66673
66336
|
const renderCiHelpEpilog = () => `
|
|
66674
66337
|
${highlighter.dim("Examples:")}
|
|
66675
66338
|
${formatExampleLines([
|
|
@@ -66691,7 +66354,6 @@ ${highlighter.dim("Learn more:")}
|
|
|
66691
66354
|
const collectCategoryOption = (value, previousValues) => [...previousValues ?? [], value];
|
|
66692
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);
|
|
66693
66356
|
program.action(inspectAction);
|
|
66694
|
-
program.command("design [directory]").description("Run only the focused UI design diagnostics").addHelpText("after", renderDesignHelpEpilog).action((directory, _options, command) => designAction(directory ?? ".", command.optsWithGlobals()));
|
|
66695
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));
|
|
66696
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);
|
|
66697
66359
|
const providerOption = ["--provider <name>", "ci provider: github-actions or gitlab-ci (auto-detected by default)"];
|
|
@@ -66740,4 +66402,4 @@ Promise.resolve().then(() => assertNoRemovedFlags(process.argv)).then(() => prog
|
|
|
66740
66402
|
export {};
|
|
66741
66403
|
|
|
66742
66404
|
//# sourceMappingURL=cli.js.map
|
|
66743
|
-
//# debugId=
|
|
66405
|
+
//# debugId=f6c63ef7-3eca-54f6-80d8-221d85cea09b
|