react-doctor 0.7.4-dev.d4f2209 → 0.7.4-dev.dfccac4
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 +0 -8
- package/dist/cli.js +81 -290
- package/dist/index.d.ts +6 -55
- package/dist/index.js +66 -265
- package/dist/lsp.js +35 -188
- package/package.json +3 -3
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]="f9a61243-36ed-57c7-ba8a-6c5318b59172")}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";
|
|
@@ -8,8 +8,8 @@ import path from "node:path";
|
|
|
8
8
|
import * as NFS from "node:fs";
|
|
9
9
|
import fs, { mkdtempSync, rmSync } from "node:fs";
|
|
10
10
|
import process$1 from "node:process";
|
|
11
|
-
import
|
|
12
|
-
import
|
|
11
|
+
import * as ts from "typescript";
|
|
12
|
+
import reactDoctorPlugin, { ALL_REACT_DOCTOR_RULE_KEYS, CROSS_FILE_DEPENDENCY_COLLECTORS, CROSS_FILE_RULE_IDS, FRAMEWORK_SPECIFIC_RULE_KEYS, MOTION_LIBRARY_PACKAGES, REACT_COMPILER_RULES, REACT_DOCTOR_RULES, classifySecurityScanFile, collectCrossFileDependencyProbes, resetManifestCaches, shouldReadSecurityScanContent } from "oxlint-plugin-react-doctor";
|
|
13
13
|
import * as OS from "node:os";
|
|
14
14
|
import os, { tmpdir } from "node:os";
|
|
15
15
|
import { parseJSON5 } from "confbox";
|
|
@@ -22411,45 +22411,12 @@ var Diagnostic = class extends Class("Diagnostic")({
|
|
|
22411
22411
|
relatedLocations: optional(ArraySchema(DiagnosticRelatedLocation)),
|
|
22412
22412
|
fixGroupId: optional(String$1)
|
|
22413
22413
|
}) {};
|
|
22414
|
-
var JsonReportDiagnosticV3 = class extends Class("JsonReportDiagnosticV3")({
|
|
22415
|
-
id: String$1,
|
|
22416
|
-
normalizedFilePath: String$1,
|
|
22417
|
-
filePath: String$1,
|
|
22418
|
-
plugin: String$1,
|
|
22419
|
-
rule: String$1,
|
|
22420
|
-
severity: Severity,
|
|
22421
|
-
tags: ArraySchema(String$1),
|
|
22422
|
-
title: optional(String$1),
|
|
22423
|
-
message: String$1,
|
|
22424
|
-
help: String$1,
|
|
22425
|
-
url: optional(String$1),
|
|
22426
|
-
line: Number$1,
|
|
22427
|
-
column: Number$1,
|
|
22428
|
-
offset: optional(Number$1),
|
|
22429
|
-
length: optional(Number$1),
|
|
22430
|
-
endLine: optional(Number$1),
|
|
22431
|
-
endColumn: optional(Number$1),
|
|
22432
|
-
category: String$1,
|
|
22433
|
-
matchByOccurrence: optional(Boolean$1),
|
|
22434
|
-
fileContext: optional(Literals(["test", "story"])),
|
|
22435
|
-
suppressionHint: optional(String$1),
|
|
22436
|
-
relatedLocations: optional(ArraySchema(DiagnosticRelatedLocation)),
|
|
22437
|
-
fixGroupId: optional(String$1)
|
|
22438
|
-
}) {};
|
|
22439
|
-
/**
|
|
22440
|
-
* Deterministic identity string for a diagnostic. Same diagnostic
|
|
22441
|
-
* across two scans yields the same identity; lets baselines,
|
|
22442
|
-
* suppression files, content-hash caches, and IDE "ignore this"
|
|
22443
|
-
* actions all key off one shared shape.
|
|
22444
|
-
*/
|
|
22445
|
-
const buildDiagnosticIdentity = (input) => `${input.filePath}::${input.line}:${input.column}::${input.plugin}/${input.rule}`;
|
|
22446
22414
|
const JsonReportMode = Literals([
|
|
22447
22415
|
"full",
|
|
22448
22416
|
"diff",
|
|
22449
22417
|
"staged",
|
|
22450
22418
|
"baseline"
|
|
22451
22419
|
]);
|
|
22452
|
-
const Framework = Literals(FRAMEWORK_TOKENS);
|
|
22453
22420
|
var JsonReportSummary = class extends Class("JsonReportSummary")({
|
|
22454
22421
|
errorCount: Number$1,
|
|
22455
22422
|
warningCount: Number$1,
|
|
@@ -22487,22 +22454,13 @@ var JsonReportProjectEntry = class extends Class("JsonReportProjectEntry")({
|
|
|
22487
22454
|
scannedFileCount: optional(Number$1),
|
|
22488
22455
|
elapsedMilliseconds: Number$1
|
|
22489
22456
|
}) {};
|
|
22490
|
-
|
|
22491
|
-
|
|
22492
|
-
|
|
22493
|
-
|
|
22494
|
-
|
|
22495
|
-
|
|
22496
|
-
|
|
22497
|
-
skippedChecks: ArraySchema(String$1),
|
|
22498
|
-
skippedCheckReasons: optional(Record$1(String$1, String$1)),
|
|
22499
|
-
analyzedFiles: ArraySchema(String$1),
|
|
22500
|
-
analyzedFileCount: Number$1,
|
|
22501
|
-
complete: Boolean$1,
|
|
22502
|
-
scannedFileCount: optional(Number$1),
|
|
22503
|
-
elapsedMilliseconds: Number$1
|
|
22504
|
-
}) {};
|
|
22505
|
-
/** Original full, diff, and staged report contract. */
|
|
22457
|
+
/**
|
|
22458
|
+
* Versioned JsonReport schema. `JsonReport` is a `Schema.Union` so we
|
|
22459
|
+
* can add `schemaVersion: 2` later as one new union member without
|
|
22460
|
+
* breaking existing v1 consumers (the GitHub Action keys off the
|
|
22461
|
+
* version literal). Today's union is single-arm; the shape is
|
|
22462
|
+
* intentional.
|
|
22463
|
+
*/
|
|
22506
22464
|
var JsonReportV1 = class extends Class("JsonReportV1")({
|
|
22507
22465
|
schemaVersion: Literal(1),
|
|
22508
22466
|
version: String$1,
|
|
@@ -22563,27 +22521,7 @@ var JsonReportV2 = class extends Class("JsonReportV2")({
|
|
|
22563
22521
|
elapsedMilliseconds: Number$1,
|
|
22564
22522
|
error: NullOr(JsonReportError)
|
|
22565
22523
|
}) {};
|
|
22566
|
-
|
|
22567
|
-
schemaVersion: Literal(3),
|
|
22568
|
-
version: String$1,
|
|
22569
|
-
ok: Boolean$1,
|
|
22570
|
-
directory: String$1,
|
|
22571
|
-
mode: JsonReportMode,
|
|
22572
|
-
baselineDegraded: optional(Boolean$1),
|
|
22573
|
-
reactDetected: optional(Boolean$1),
|
|
22574
|
-
diff: NullOr(JsonReportDiffInfo),
|
|
22575
|
-
baseline: optional(JsonReportBaseline),
|
|
22576
|
-
projects: ArraySchema(JsonReportProjectEntryV3),
|
|
22577
|
-
diagnostics: ArraySchema(JsonReportDiagnosticV3),
|
|
22578
|
-
summary: JsonReportSummary,
|
|
22579
|
-
elapsedMilliseconds: Number$1,
|
|
22580
|
-
error: NullOr(JsonReportError)
|
|
22581
|
-
}) {};
|
|
22582
|
-
Union([
|
|
22583
|
-
JsonReportV1,
|
|
22584
|
-
JsonReportV2,
|
|
22585
|
-
JsonReportV3
|
|
22586
|
-
]);
|
|
22524
|
+
Union([JsonReportV1, JsonReportV2]);
|
|
22587
22525
|
//#endregion
|
|
22588
22526
|
//#region ../../node_modules/.pnpm/semver@7.7.4/node_modules/semver/internal/constants.js
|
|
22589
22527
|
var require_constants$1 = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
|
|
@@ -37147,22 +37085,6 @@ const isPackageJsonReanimatedAware = (packageJson) => {
|
|
|
37147
37085
|
};
|
|
37148
37086
|
return Object.hasOwn(allDependencies, REANIMATED_DEPENDENCY_NAME$1);
|
|
37149
37087
|
};
|
|
37150
|
-
const SSR_DEPENDENCY_NAMES = new Set([
|
|
37151
|
-
"@react-router/cloudflare",
|
|
37152
|
-
"@react-router/node",
|
|
37153
|
-
"@react-router/serve",
|
|
37154
|
-
"vike",
|
|
37155
|
-
"vite-plugin-ssr"
|
|
37156
|
-
]);
|
|
37157
|
-
const isPackageJsonSsrAware = (packageJson) => {
|
|
37158
|
-
const allDependencies = {
|
|
37159
|
-
...packageJson.peerDependencies,
|
|
37160
|
-
...packageJson.dependencies,
|
|
37161
|
-
...packageJson.devDependencies,
|
|
37162
|
-
...packageJson.optionalDependencies
|
|
37163
|
-
};
|
|
37164
|
-
return Object.keys(allDependencies).some((packageName) => SSR_DEPENDENCY_NAMES.has(packageName));
|
|
37165
|
-
};
|
|
37166
37088
|
const getWorkspacePatterns = (rootDirectory, packageJson) => {
|
|
37167
37089
|
const pnpmPatterns = parsePnpmWorkspacePatterns(rootDirectory);
|
|
37168
37090
|
if (pnpmPatterns.length > 0) return pnpmPatterns;
|
|
@@ -37303,7 +37225,6 @@ const evaluateManifestFacts = (facts, packageJson, directory) => {
|
|
|
37303
37225
|
}
|
|
37304
37226
|
facts.hasReactNativeAwarePackage = facts.hasReactNativeAwarePackage || isPackageJsonReactNativeAware(packageJson);
|
|
37305
37227
|
facts.hasReanimatedAwarePackage = facts.hasReanimatedAwarePackage || isPackageJsonReanimatedAware(packageJson);
|
|
37306
|
-
facts.hasSsrDependency = facts.hasSsrDependency || isPackageJsonSsrAware(packageJson);
|
|
37307
37228
|
};
|
|
37308
37229
|
const collectWorkspaceFacts = (rootDirectory, rootPackageJson, { collectReactGroup }) => {
|
|
37309
37230
|
const facts = {
|
|
@@ -37325,7 +37246,6 @@ const collectWorkspaceFacts = (rootDirectory, rootPackageJson, { collectReactGro
|
|
|
37325
37246
|
},
|
|
37326
37247
|
hasReactNativeAwarePackage: false,
|
|
37327
37248
|
hasReanimatedAwarePackage: false,
|
|
37328
|
-
hasSsrDependency: false,
|
|
37329
37249
|
reanimatedVersion: null
|
|
37330
37250
|
};
|
|
37331
37251
|
evaluateManifestFacts(facts, rootPackageJson, rootDirectory);
|
|
@@ -37562,7 +37482,6 @@ const discoverProjectWithoutPackageJson = (directory) => {
|
|
|
37562
37482
|
hasTypeScript: hasOwnTsConfig,
|
|
37563
37483
|
hasReactCompiler: false,
|
|
37564
37484
|
hasTanStackQuery: false,
|
|
37565
|
-
hasSsrDependency: false,
|
|
37566
37485
|
preactVersion: null,
|
|
37567
37486
|
preactMajorVersion: null,
|
|
37568
37487
|
hasReactNativeWorkspace: false,
|
|
@@ -37682,7 +37601,6 @@ const discoverProject = (directory) => {
|
|
|
37682
37601
|
hasTypeScript,
|
|
37683
37602
|
hasReactCompiler: detectReactCompiler(directory, packageJson),
|
|
37684
37603
|
hasTanStackQuery: hasTanStackQuery(packageJson),
|
|
37685
|
-
hasSsrDependency: workspaceFacts.hasSsrDependency,
|
|
37686
37604
|
preactVersion,
|
|
37687
37605
|
preactMajorVersion: parseReactMajor(preactVersion),
|
|
37688
37606
|
hasReactNativeWorkspace,
|
|
@@ -38769,14 +38687,6 @@ var AmbiguousProject = class extends TaggedErrorClass()("AmbiguousProject", {
|
|
|
38769
38687
|
return `Ambiguous project at ${this.directory}: found ${this.candidates.length} candidates (${this.candidates.join(", ")})`;
|
|
38770
38688
|
}
|
|
38771
38689
|
};
|
|
38772
|
-
var ProjectDiscoveryFailed = class extends TaggedErrorClass()("ProjectDiscoveryFailed", {
|
|
38773
|
-
directory: String$1,
|
|
38774
|
-
cause: Unknown
|
|
38775
|
-
}) {
|
|
38776
|
-
get message() {
|
|
38777
|
-
return `Project discovery failed for ${this.directory}: ${pretty(fail$6(this.cause))}`;
|
|
38778
|
-
}
|
|
38779
|
-
};
|
|
38780
38690
|
var DeadCodeAnalysisFailed = class extends TaggedErrorClass()("DeadCodeAnalysisFailed", { cause: Unknown }) {
|
|
38781
38691
|
get message() {
|
|
38782
38692
|
return `Dead-code analysis failed: ${pretty(fail$6(this.cause))}`;
|
|
@@ -38811,7 +38721,6 @@ const ReactDoctorErrorReason = Union([
|
|
|
38811
38721
|
ProjectNotFound,
|
|
38812
38722
|
NoReactDependency,
|
|
38813
38723
|
AmbiguousProject,
|
|
38814
|
-
ProjectDiscoveryFailed,
|
|
38815
38724
|
DeadCodeAnalysisFailed,
|
|
38816
38725
|
GitInvocationFailed,
|
|
38817
38726
|
GitBaseBranchMissing,
|
|
@@ -40536,12 +40445,6 @@ const CLIENT_ONLY_FRAMEWORKS = new Set([
|
|
|
40536
40445
|
"react-native",
|
|
40537
40446
|
"expo"
|
|
40538
40447
|
]);
|
|
40539
|
-
const SSR_FRAMEWORKS = new Set([
|
|
40540
|
-
"nextjs",
|
|
40541
|
-
"remix",
|
|
40542
|
-
"gatsby",
|
|
40543
|
-
"tanstack-start"
|
|
40544
|
-
]);
|
|
40545
40448
|
const addMajorLadder = (capabilities, name, major, earliest, latest) => {
|
|
40546
40449
|
if (major === null) return;
|
|
40547
40450
|
const cappedMajor = Math.min(major, latest);
|
|
@@ -40554,7 +40457,6 @@ const buildCapabilities = (project) => {
|
|
|
40554
40457
|
if (project.framework === "expo" || project.framework === "react-native" || project.hasReactNativeWorkspace) capabilities.add("react-native");
|
|
40555
40458
|
if (project.expoVersion !== null) capabilities.add("expo");
|
|
40556
40459
|
if ((project.framework === "nextjs" || project.framework === "tanstack-start" || project.framework === "remix") && !project.isStaticExport) capabilities.add("server-actions");
|
|
40557
|
-
if (SSR_FRAMEWORKS.has(project.framework) || project.hasSsrDependency) capabilities.add("ssr");
|
|
40558
40460
|
if (CLIENT_ONLY_FRAMEWORKS.has(project.framework)) capabilities.add("client-only");
|
|
40559
40461
|
if (project.isStaticExport) capabilities.add("nextjs:static-export");
|
|
40560
40462
|
if (project.nextjsMajorVersion !== null && project.nextjsMajorVersion >= 15) capabilities.add("nextjs:15");
|
|
@@ -43975,8 +43877,6 @@ const spawnLintBatches = async (input) => {
|
|
|
43975
43877
|
const reasonHint = firstDropReason ? ` — first failure: ${firstDropReason}` : "";
|
|
43976
43878
|
reportSkippedFiles(droppedFiles, (fileListPreview) => `${droppedFiles.length} file(s) failed to lint and were skipped (${fileListPreview})${reasonHint}`);
|
|
43977
43879
|
reportSkippedFiles(outcome.deadlineSkippedFiles, (fileListPreview) => `${outcome.deadlineSkippedFiles.length} file(s) skipped — max scan duration reached before they were linted (${fileListPreview})`);
|
|
43978
|
-
const unavailableFiles = new Set([...droppedFiles, ...outcome.deadlineSkippedFiles]);
|
|
43979
|
-
input.onAnalyzedFiles?.([...new Set(fileBatches.flat().filter((filePath) => !unavailableFiles.has(filePath)))].sort());
|
|
43980
43880
|
return dedupeDiagnostics(diagnostics);
|
|
43981
43881
|
};
|
|
43982
43882
|
let didValidate = false;
|
|
@@ -44233,18 +44133,12 @@ const reactHooksJsPluginDropNote = (error) => {
|
|
|
44233
44133
|
* 6. always restore disable directives + clean up the temp dir
|
|
44234
44134
|
*/
|
|
44235
44135
|
const runOxlint = async (options) => {
|
|
44236
|
-
const { rootDirectory, project, includePaths, nodeBinaryPath = process.execPath, customRulesOnly = false, respectInlineDisables = true, adoptExistingLintConfig = true, ignoredTags = /* @__PURE__ */ new Set(), userConfig, configSourceDirectory = rootDirectory, onPartialFailure,
|
|
44136
|
+
const { rootDirectory, project, includePaths, nodeBinaryPath = process.execPath, customRulesOnly = false, respectInlineDisables = true, adoptExistingLintConfig = true, ignoredTags = /* @__PURE__ */ new Set(), userConfig, configSourceDirectory = rootDirectory, onPartialFailure, perFileLintCacheEnabled = false, sidecarLintCacheEnabled = false, onCacheStats, onSidecarStats, spawnTimeoutMs, outputMaxBytes, lintBatchOrdering = "cost" } = options;
|
|
44237
44137
|
const serverAuthFunctionNames = Array.isArray(userConfig?.serverAuthFunctionNames) ? userConfig.serverAuthFunctionNames.filter((entry) => typeof entry === "string" && entry.length > 0) : void 0;
|
|
44238
44138
|
const severityControls = buildRuleSeverityControls(userConfig);
|
|
44239
44139
|
validateRuleRegistration();
|
|
44240
44140
|
resetManifestCaches();
|
|
44241
|
-
if (includePaths !== void 0 && includePaths.length === 0)
|
|
44242
|
-
onFileCoverage?.({
|
|
44243
|
-
candidateFiles: [],
|
|
44244
|
-
analyzedFiles: []
|
|
44245
|
-
});
|
|
44246
|
-
return [];
|
|
44247
|
-
}
|
|
44141
|
+
if (includePaths !== void 0 && includePaths.length === 0) return [];
|
|
44248
44142
|
const pluginPath = resolvePluginPath();
|
|
44249
44143
|
const extendsPaths = (adoptExistingLintConfig && !customRulesOnly ? detectUserLintConfigPaths(rootDirectory) : []).filter(canOxlintExtendConfig);
|
|
44250
44144
|
const userPlugins = resolveUserPlugins(userConfig?.plugins, configSourceDirectory);
|
|
@@ -44305,7 +44199,6 @@ const runOxlint = async (options) => {
|
|
|
44305
44199
|
const runConfigOverFiles = async (buildConfigForPass, configFileName, files, fileProgress) => {
|
|
44306
44200
|
if (files.length === 0) return {
|
|
44307
44201
|
diagnostics: [],
|
|
44308
|
-
analyzedFiles: [],
|
|
44309
44202
|
didDropReactHooksJsPlugin: false,
|
|
44310
44203
|
hadPartialFailure: false
|
|
44311
44204
|
};
|
|
@@ -44317,32 +44210,24 @@ const runOxlint = async (options) => {
|
|
|
44317
44210
|
const passConfigPath = Path.join(configDirectory, configFileName);
|
|
44318
44211
|
const passBaseArgs = makeBaseArgs(passConfigPath);
|
|
44319
44212
|
const passFileBatches = buildFileBatches(passBaseArgs, files);
|
|
44320
|
-
|
|
44321
|
-
|
|
44322
|
-
|
|
44323
|
-
|
|
44324
|
-
|
|
44325
|
-
|
|
44326
|
-
|
|
44327
|
-
|
|
44328
|
-
|
|
44329
|
-
|
|
44330
|
-
|
|
44331
|
-
|
|
44332
|
-
|
|
44333
|
-
|
|
44334
|
-
spawnTimeoutMs,
|
|
44335
|
-
outputMaxBytes,
|
|
44336
|
-
concurrency: options.concurrency,
|
|
44337
|
-
signal: options.signal,
|
|
44338
|
-
deadlineEpochMs: options.deadlineEpochMs
|
|
44339
|
-
});
|
|
44340
|
-
};
|
|
44213
|
+
const spawnPass = () => spawnLintBatches({
|
|
44214
|
+
baseArgs: passBaseArgs,
|
|
44215
|
+
fileBatches: passFileBatches,
|
|
44216
|
+
rootDirectory,
|
|
44217
|
+
nodeBinaryPath,
|
|
44218
|
+
project,
|
|
44219
|
+
onPartialFailure: reportPartialFailure,
|
|
44220
|
+
onFileProgress: fileProgress,
|
|
44221
|
+
spawnTimeoutMs,
|
|
44222
|
+
outputMaxBytes,
|
|
44223
|
+
concurrency: options.concurrency,
|
|
44224
|
+
signal: options.signal,
|
|
44225
|
+
deadlineEpochMs: options.deadlineEpochMs
|
|
44226
|
+
});
|
|
44341
44227
|
writeOxlintConfig(passConfigPath, buildConfigForPass({}));
|
|
44342
44228
|
try {
|
|
44343
44229
|
return {
|
|
44344
44230
|
diagnostics: await spawnPass(),
|
|
44345
|
-
analyzedFiles,
|
|
44346
44231
|
didDropReactHooksJsPlugin: false,
|
|
44347
44232
|
hadPartialFailure
|
|
44348
44233
|
};
|
|
@@ -44354,7 +44239,6 @@ const runOxlint = async (options) => {
|
|
|
44354
44239
|
reportPartialFailure(reactHooksJsDropNote);
|
|
44355
44240
|
return {
|
|
44356
44241
|
diagnostics,
|
|
44357
|
-
analyzedFiles,
|
|
44358
44242
|
didDropReactHooksJsPlugin: true,
|
|
44359
44243
|
hadPartialFailure
|
|
44360
44244
|
};
|
|
@@ -44430,7 +44314,6 @@ const runOxlint = async (options) => {
|
|
|
44430
44314
|
const missFileSet = new Set(missFiles);
|
|
44431
44315
|
const hitFiles = candidateFiles.filter((candidateFile) => !missFileSet.has(candidateFile));
|
|
44432
44316
|
const sidecarReplayedDiagnostics = [];
|
|
44433
|
-
const sidecarReplayedFiles = [];
|
|
44434
44317
|
const sidecarLintFiles = [];
|
|
44435
44318
|
if (sidecarCache === null) sidecarLintFiles.push(...hitFiles);
|
|
44436
44319
|
else {
|
|
@@ -44438,10 +44321,8 @@ const runOxlint = async (options) => {
|
|
|
44438
44321
|
for (const hitFile of hitFiles) {
|
|
44439
44322
|
const cacheKey = cacheKeyByFile.get(hitFile);
|
|
44440
44323
|
const entry = cacheKey === void 0 ? null : sidecarCache.lookup(cacheKey);
|
|
44441
|
-
if (entry !== null && entry.probes.every((probe) => probeAnswers.answerFor(probe.kind, probe.path) === probe.answer))
|
|
44442
|
-
|
|
44443
|
-
sidecarReplayedDiagnostics.push(...entry.diagnostics);
|
|
44444
|
-
} else sidecarLintFiles.push(hitFile);
|
|
44324
|
+
if (entry !== null && entry.probes.every((probe) => probeAnswers.answerFor(probe.kind, probe.path) === probe.answer)) sidecarReplayedDiagnostics.push(...entry.diagnostics);
|
|
44325
|
+
else sidecarLintFiles.push(hitFile);
|
|
44445
44326
|
if (performance.now() - verifySliceStartedAt >= 12) {
|
|
44446
44327
|
await yieldToEventLoop();
|
|
44447
44328
|
verifySliceStartedAt = performance.now();
|
|
@@ -44467,7 +44348,6 @@ const runOxlint = async (options) => {
|
|
|
44467
44348
|
sidecarRuleIdFilter: new Set(unboundedSidecarRuleIds)
|
|
44468
44349
|
}), "oxlintrc.sidecar-unbounded.json", hitFiles, void 0) : {
|
|
44469
44350
|
diagnostics: [],
|
|
44470
|
-
analyzedFiles: [],
|
|
44471
44351
|
didDropReactHooksJsPlugin: false,
|
|
44472
44352
|
hadPartialFailure: false
|
|
44473
44353
|
};
|
|
@@ -44498,15 +44378,6 @@ const runOxlint = async (options) => {
|
|
|
44498
44378
|
probesByFile: await missProbesTask
|
|
44499
44379
|
}]
|
|
44500
44380
|
});
|
|
44501
|
-
const analyzedFileSet = new Set(fullResult.analyzedFiles);
|
|
44502
|
-
const boundedSidecarAnalyzedFileSet = new Set(boundedSidecarResult.analyzedFiles);
|
|
44503
|
-
const unboundedSidecarAnalyzedFileSet = new Set(unboundedSidecarResult.analyzedFiles);
|
|
44504
|
-
const sidecarReplayedFileSet = new Set(sidecarReplayedFiles);
|
|
44505
|
-
for (const hitFile of hitFiles) if (useSidecarCache ? (sidecarReplayedFileSet.has(hitFile) || boundedSidecarAnalyzedFileSet.has(hitFile)) && (unboundedSidecarRuleIds.length === 0 || unboundedSidecarAnalyzedFileSet.has(hitFile)) : boundedSidecarAnalyzedFileSet.has(hitFile)) analyzedFileSet.add(hitFile);
|
|
44506
|
-
onFileCoverage?.({
|
|
44507
|
-
candidateFiles,
|
|
44508
|
-
analyzedFiles: candidateFiles.filter((candidateFile) => analyzedFileSet.has(candidateFile))
|
|
44509
|
-
});
|
|
44510
44381
|
return dedupeDiagnostics([
|
|
44511
44382
|
...replayedDiagnostics,
|
|
44512
44383
|
...fullResult.diagnostics,
|
|
@@ -44517,7 +44388,6 @@ const runOxlint = async (options) => {
|
|
|
44517
44388
|
}
|
|
44518
44389
|
const baseArgs = makeBaseArgs(configPath);
|
|
44519
44390
|
const fileBatches = buildFileBatches(baseArgs, candidateFiles);
|
|
44520
|
-
let analyzedFiles = [];
|
|
44521
44391
|
const runBatches = () => spawnLintBatches({
|
|
44522
44392
|
baseArgs,
|
|
44523
44393
|
fileBatches,
|
|
@@ -44525,9 +44395,6 @@ const runOxlint = async (options) => {
|
|
|
44525
44395
|
nodeBinaryPath,
|
|
44526
44396
|
project,
|
|
44527
44397
|
onPartialFailure,
|
|
44528
|
-
onAnalyzedFiles: (filePaths) => {
|
|
44529
|
-
analyzedFiles = filePaths;
|
|
44530
|
-
},
|
|
44531
44398
|
onFileProgress: options.onFileProgress,
|
|
44532
44399
|
spawnTimeoutMs,
|
|
44533
44400
|
outputMaxBytes,
|
|
@@ -44537,12 +44404,7 @@ const runOxlint = async (options) => {
|
|
|
44537
44404
|
});
|
|
44538
44405
|
writeOxlintConfig(configPath, buildConfig({ extendsPaths }));
|
|
44539
44406
|
try {
|
|
44540
|
-
|
|
44541
|
-
onFileCoverage?.({
|
|
44542
|
-
candidateFiles,
|
|
44543
|
-
analyzedFiles
|
|
44544
|
-
});
|
|
44545
|
-
return diagnostics;
|
|
44407
|
+
return await runBatches();
|
|
44546
44408
|
} catch (error) {
|
|
44547
44409
|
const reactHooksJsDropNote = reactHooksJsPluginDropNote(error);
|
|
44548
44410
|
if (reactHooksJsDropNote !== null) {
|
|
@@ -44552,20 +44414,11 @@ const runOxlint = async (options) => {
|
|
|
44552
44414
|
}));
|
|
44553
44415
|
const diagnostics = await runBatches();
|
|
44554
44416
|
onPartialFailure?.(reactHooksJsDropNote);
|
|
44555
|
-
onFileCoverage?.({
|
|
44556
|
-
candidateFiles,
|
|
44557
|
-
analyzedFiles
|
|
44558
|
-
});
|
|
44559
44417
|
return diagnostics;
|
|
44560
44418
|
}
|
|
44561
44419
|
if (extendsPaths.length === 0) throw error;
|
|
44562
44420
|
writeOxlintConfig(configPath, buildConfig({ extendsPaths: [] }));
|
|
44563
|
-
|
|
44564
|
-
onFileCoverage?.({
|
|
44565
|
-
candidateFiles,
|
|
44566
|
-
analyzedFiles
|
|
44567
|
-
});
|
|
44568
|
-
return diagnostics;
|
|
44421
|
+
return await runBatches();
|
|
44569
44422
|
}
|
|
44570
44423
|
} finally {
|
|
44571
44424
|
restoreDisableDirectives();
|
|
@@ -44645,7 +44498,6 @@ var Linter = class Linter extends Service()("react-doctor/Linter") {
|
|
|
44645
44498
|
onPartialFailure: (reason) => {
|
|
44646
44499
|
collectedFailures.push(reason);
|
|
44647
44500
|
},
|
|
44648
|
-
onFileCoverage: input.onFileCoverage,
|
|
44649
44501
|
onFileProgress: input.onFileProgress,
|
|
44650
44502
|
perFileLintCacheEnabled,
|
|
44651
44503
|
sidecarLintCacheEnabled,
|
|
@@ -44738,10 +44590,7 @@ const translateProjectInfoError = (cause, directory) => {
|
|
|
44738
44590
|
directory: cause.directory,
|
|
44739
44591
|
candidates: cause.candidates
|
|
44740
44592
|
}) });
|
|
44741
|
-
return new ReactDoctorError({ reason: new
|
|
44742
|
-
directory,
|
|
44743
|
-
cause
|
|
44744
|
-
}) });
|
|
44593
|
+
return new ReactDoctorError({ reason: new ProjectNotFound({ directory }) });
|
|
44745
44594
|
};
|
|
44746
44595
|
var Project = class Project extends Service()("react-doctor/Project") {
|
|
44747
44596
|
static layerNode = succeed$3(Project, Project.of({ discover: fn("Project.discover")(function* (directory) {
|
|
@@ -45353,7 +45202,6 @@ const resolveGithubActionsScoreMetadata = (environment = process.env) => {
|
|
|
45353
45202
|
...actorAssociation !== void 0 ? { githubActorAssociation: actorAssociation } : {}
|
|
45354
45203
|
};
|
|
45355
45204
|
};
|
|
45356
|
-
const toNormalizedRelativePath = (filePath, rootDirectory) => Path.relative(Path.resolve(rootDirectory), Path.resolve(rootDirectory, filePath)).replaceAll("\\", "/") || ".";
|
|
45357
45205
|
const NO_HOOKS = {
|
|
45358
45206
|
beforeLint: () => void_,
|
|
45359
45207
|
afterLint: () => void_
|
|
@@ -45452,7 +45300,7 @@ const runInspect = (input, hooks = {}) => gen(function* () {
|
|
|
45452
45300
|
repo
|
|
45453
45301
|
}).pipe(orElseSucceed(() => null)) : succeed$2(null));
|
|
45454
45302
|
const lintIncludePaths = (input.skipJsxIncludeFilter ? input.includePaths.length > 0 ? [...input.includePaths] : void 0 : computeExplicitLintIncludePaths([...input.includePaths], project)) ?? resolveLintIncludePaths(scanDirectory, resolvedConfig.config, project);
|
|
45455
|
-
const
|
|
45303
|
+
const scannedFilePaths = input.suppressScanSummary ? (lintIncludePaths ?? (yield* filesService.listSourceFiles(scanDirectory))).map((relativePath) => Path.resolve(scanDirectory, relativePath)) : [];
|
|
45456
45304
|
const beforeLint = hooks.beforeLint ?? NO_HOOKS.beforeLint;
|
|
45457
45305
|
const afterLint = hooks.afterLint ?? NO_HOOKS.afterLint;
|
|
45458
45306
|
yield* beforeLint(project, lintIncludePaths ?? void 0);
|
|
@@ -45557,7 +45405,6 @@ const runInspect = (input, hooks = {}) => gen(function* () {
|
|
|
45557
45405
|
let deadCodeCacheHit = null;
|
|
45558
45406
|
let deadCodeSummaryCacheHits = null;
|
|
45559
45407
|
let deadCodeSummaryCacheMisses = null;
|
|
45560
|
-
const lintFileCoverageState = { value: null };
|
|
45561
45408
|
const baseLintStream = linterService.run({
|
|
45562
45409
|
rootDirectory: scanDirectory,
|
|
45563
45410
|
project,
|
|
@@ -45573,9 +45420,6 @@ const runInspect = (input, hooks = {}) => gen(function* () {
|
|
|
45573
45420
|
lastReportedTotalFileCount = totalFileCount;
|
|
45574
45421
|
runSync(scanProgress.update(`Scanning files (${scannedFileCount}/${totalFileCount})${workerCountSuffix}...`));
|
|
45575
45422
|
},
|
|
45576
|
-
onFileCoverage: (coverage) => {
|
|
45577
|
-
lintFileCoverageState.value = coverage;
|
|
45578
|
-
},
|
|
45579
45423
|
onCacheStats: (cacheHitFileCount, totalConsideredFileCount) => {
|
|
45580
45424
|
lintCacheHitFileCount = cacheHitFileCount;
|
|
45581
45425
|
lintCacheTotalFileCount = totalConsideredFileCount;
|
|
@@ -45606,10 +45450,7 @@ const runInspect = (input, hooks = {}) => gen(function* () {
|
|
|
45606
45450
|
const lintFailureState = yield* get$2(lintFailure);
|
|
45607
45451
|
yield* afterLint(lintFailureState.didFail);
|
|
45608
45452
|
if (lintFailureState.didFail) yield* scanProgress.fail(formatLintFailText(lintFailureState.reasonTag, process.version));
|
|
45609
|
-
const
|
|
45610
|
-
const analyzedFiles = lintFileCoverageState.value === null ? [] : [...new Set(lintFileCoverageState.value.analyzedFiles.map((filePath) => toNormalizedRelativePath(filePath, scanDirectory)))].sort();
|
|
45611
|
-
const totalFileCount = candidateFiles.length || lastReportedTotalFileCount || (lintIncludePaths?.length ?? project.sourceFileCount);
|
|
45612
|
-
const scannedFilePaths = input.suppressScanSummary ? candidateFiles.length > 0 ? candidateFiles.map((filePath) => Path.resolve(scanDirectory, filePath)) : fallbackScannedFilePaths : [];
|
|
45453
|
+
const totalFileCount = lastReportedTotalFileCount || (lintIncludePaths?.length ?? project.sourceFileCount);
|
|
45613
45454
|
const scannedFilesLabel = `${totalFileCount} ${totalFileCount === 1 ? "file" : "files"}`;
|
|
45614
45455
|
let deadCodeCollected = [];
|
|
45615
45456
|
if (lintFailureState.didFail) {
|
|
@@ -45691,7 +45532,6 @@ const runInspect = (input, hooks = {}) => gen(function* () {
|
|
|
45691
45532
|
deadCodeOverlapped: shouldOverlapDeadCode,
|
|
45692
45533
|
scannedFileCount: totalFileCount,
|
|
45693
45534
|
scannedFilePaths,
|
|
45694
|
-
analyzedFiles,
|
|
45695
45535
|
scanElapsedMilliseconds,
|
|
45696
45536
|
scanConcurrency,
|
|
45697
45537
|
supplyChainOverlapTimedOut: supplyChainResult.timedOut,
|
|
@@ -45967,7 +45807,7 @@ const buildJsonReportError = (input) => {
|
|
|
45967
45807
|
sentryEventId
|
|
45968
45808
|
};
|
|
45969
45809
|
return {
|
|
45970
|
-
schemaVersion:
|
|
45810
|
+
schemaVersion: 1,
|
|
45971
45811
|
version: input.version,
|
|
45972
45812
|
ok: false,
|
|
45973
45813
|
directory: input.directory,
|
|
@@ -46012,7 +45852,6 @@ const summarizeDiagnostics = (diagnostics, worstScore = null, worstScoreLabel =
|
|
|
46012
45852
|
* React-runtime rule family was gated off for the project.
|
|
46013
45853
|
*/
|
|
46014
45854
|
const hasReactRuntime = (project) => project.reactVersion !== null || project.preactVersion !== null;
|
|
46015
|
-
const isScanComplete = (input) => input.analyzedFileCount !== void 0 && input.scannedFileCount !== void 0 && input.skippedCheckCount === 0 && input.skippedCheckReasonCount === 0 && input.analyzedFileCount === input.scannedFileCount;
|
|
46016
45855
|
const toJsonDiff = (diff) => {
|
|
46017
45856
|
if (!diff) return null;
|
|
46018
45857
|
return {
|
|
@@ -46035,68 +45874,21 @@ const findWorstScoredProject = (projects) => {
|
|
|
46035
45874
|
}
|
|
46036
45875
|
return worst;
|
|
46037
45876
|
};
|
|
46038
|
-
const toJsonReportDiagnostic = (diagnostic, projectRoot, reportRoot) => {
|
|
46039
|
-
const normalizedFilePath = toNormalizedRelativePath(diagnostic.filePath, projectRoot);
|
|
46040
|
-
const reportRelativeFilePath = toNormalizedRelativePath(Path.resolve(projectRoot, diagnostic.filePath), reportRoot);
|
|
46041
|
-
const ruleIdentity = getDiagnosticRuleIdentity(diagnostic);
|
|
46042
|
-
return {
|
|
46043
|
-
...diagnostic,
|
|
46044
|
-
id: buildDiagnosticIdentity({
|
|
46045
|
-
filePath: reportRelativeFilePath,
|
|
46046
|
-
line: diagnostic.line,
|
|
46047
|
-
column: diagnostic.column,
|
|
46048
|
-
plugin: diagnostic.plugin,
|
|
46049
|
-
rule: diagnostic.rule
|
|
46050
|
-
}),
|
|
46051
|
-
normalizedFilePath,
|
|
46052
|
-
category: ruleIdentity.category,
|
|
46053
|
-
tags: [...new Set(ruleIdentity.tags)].sort()
|
|
46054
|
-
};
|
|
46055
|
-
};
|
|
46056
45877
|
const buildJsonReport = (input) => {
|
|
46057
|
-
const projects = input.scans.map(({ directory, result }) => {
|
|
46058
|
-
|
|
46059
|
-
|
|
46060
|
-
|
|
46061
|
-
|
|
46062
|
-
|
|
46063
|
-
|
|
46064
|
-
|
|
46065
|
-
|
|
46066
|
-
|
|
46067
|
-
score: result.score,
|
|
46068
|
-
skippedChecks,
|
|
46069
|
-
...result.skippedCheckReasons ? { skippedCheckReasons: result.skippedCheckReasons } : {},
|
|
46070
|
-
analyzedFiles,
|
|
46071
|
-
analyzedFileCount: analyzedFiles.length,
|
|
46072
|
-
complete: isScanComplete({
|
|
46073
|
-
analyzedFileCount: result.analyzedFiles === void 0 ? void 0 : analyzedFiles.length,
|
|
46074
|
-
scannedFileCount,
|
|
46075
|
-
skippedCheckCount: skippedChecks.length,
|
|
46076
|
-
skippedCheckReasonCount: Object.keys(result.skippedCheckReasons ?? {}).length
|
|
46077
|
-
}),
|
|
46078
|
-
...typeof result.scannedFileCount === "number" ? { scannedFileCount } : {},
|
|
46079
|
-
elapsedMilliseconds: result.elapsedMilliseconds
|
|
46080
|
-
};
|
|
46081
|
-
});
|
|
45878
|
+
const projects = input.scans.map(({ directory, result }) => ({
|
|
45879
|
+
directory,
|
|
45880
|
+
project: result.project,
|
|
45881
|
+
diagnostics: result.diagnostics,
|
|
45882
|
+
score: result.score,
|
|
45883
|
+
skippedChecks: result.skippedChecks,
|
|
45884
|
+
...result.skippedCheckReasons ? { skippedCheckReasons: result.skippedCheckReasons } : {},
|
|
45885
|
+
...typeof result.scannedFileCount === "number" ? { scannedFileCount: result.scannedFileCount } : {},
|
|
45886
|
+
elapsedMilliseconds: result.elapsedMilliseconds
|
|
45887
|
+
}));
|
|
46082
45888
|
const flattenedDiagnostics = projects.flatMap((entry) => entry.diagnostics);
|
|
46083
45889
|
const worstScoredProject = findWorstScoredProject(projects);
|
|
46084
|
-
const
|
|
46085
|
-
const
|
|
46086
|
-
const summary = {
|
|
46087
|
-
...diagnosticSummary,
|
|
46088
|
-
affectedFileCount
|
|
46089
|
-
};
|
|
46090
|
-
return {
|
|
46091
|
-
schemaVersion: 3,
|
|
46092
|
-
mode: input.baseline !== void 0 ? "baseline" : input.baselineDegraded && input.mode === "baseline" ? "diff" : input.mode,
|
|
46093
|
-
...input.baseline ? { baseline: {
|
|
46094
|
-
baseRef: input.baseline.baseRef,
|
|
46095
|
-
newCount: summary.totalDiagnosticCount,
|
|
46096
|
-
fixedCount: input.baseline.fixedCount,
|
|
46097
|
-
baseTotalCount: input.baseline.baseTotalCount
|
|
46098
|
-
} } : {},
|
|
46099
|
-
...input.baselineDegraded ? { baselineDegraded: true } : {},
|
|
45890
|
+
const summary = summarizeDiagnostics(flattenedDiagnostics, worstScoredProject?.score?.score ?? null, worstScoredProject?.score?.label ?? null);
|
|
45891
|
+
const shared = {
|
|
46100
45892
|
...input.scans.length > 0 ? { reactDetected: input.scans.some((scan) => hasReactRuntime(scan.result.project)) } : {},
|
|
46101
45893
|
version: input.version,
|
|
46102
45894
|
ok: true,
|
|
@@ -46108,26 +45900,39 @@ const buildJsonReport = (input) => {
|
|
|
46108
45900
|
elapsedMilliseconds: input.totalElapsedMilliseconds,
|
|
46109
45901
|
error: null
|
|
46110
45902
|
};
|
|
45903
|
+
if (input.baseline) return {
|
|
45904
|
+
schemaVersion: 2,
|
|
45905
|
+
mode: "baseline",
|
|
45906
|
+
baseline: {
|
|
45907
|
+
baseRef: input.baseline.baseRef,
|
|
45908
|
+
newCount: summary.totalDiagnosticCount,
|
|
45909
|
+
fixedCount: input.baseline.fixedCount,
|
|
45910
|
+
baseTotalCount: input.baseline.baseTotalCount
|
|
45911
|
+
},
|
|
45912
|
+
...shared
|
|
45913
|
+
};
|
|
45914
|
+
return {
|
|
45915
|
+
schemaVersion: 1,
|
|
45916
|
+
mode: input.mode,
|
|
45917
|
+
...input.baselineDegraded ? { baselineDegraded: true } : {},
|
|
45918
|
+
...shared
|
|
45919
|
+
};
|
|
46111
45920
|
};
|
|
46112
45921
|
/**
|
|
46113
45922
|
* Single source of truth for the skipped-check accounting shared by the
|
|
46114
45923
|
* CLI renderer (`react-doctor/src/inspect.ts → finalizeAndRender`) and the
|
|
46115
45924
|
* programmatic shell (`@react-doctor/api → diagnose()`). Both surface a
|
|
46116
|
-
* failed
|
|
45925
|
+
* failed lint / dead-code pass instead of a false "all clear", so the
|
|
46117
45926
|
* branch logic lives here once.
|
|
46118
45927
|
*/
|
|
46119
45928
|
const buildSkippedChecks = (input) => {
|
|
46120
45929
|
const skippedChecks = [];
|
|
46121
45930
|
if (input.didLintFail) skippedChecks.push("lint");
|
|
46122
45931
|
if (input.didDeadCodeFail) skippedChecks.push("dead-code");
|
|
46123
|
-
if (input.supplyChainOverlapTimedOut) skippedChecks.push("supply-chain");
|
|
46124
|
-
if (input.securityScanFailed) skippedChecks.push("security-scan");
|
|
46125
45932
|
const skippedCheckReasons = {};
|
|
46126
45933
|
if (input.didLintFail && input.lintFailureReason !== null) skippedCheckReasons.lint = input.lintFailureReason;
|
|
46127
45934
|
else if (input.lintPartialFailures.length > 0) skippedCheckReasons["lint:partial"] = input.lintPartialFailures.join("; ");
|
|
46128
45935
|
if (input.didDeadCodeFail && input.deadCodeFailureReason !== null) skippedCheckReasons["dead-code"] = input.deadCodeFailureReason;
|
|
46129
|
-
if (input.supplyChainOverlapTimedOut) skippedCheckReasons["supply-chain"] = "Supply-chain analysis timed out and was skipped.";
|
|
46130
|
-
if (input.securityScanFailed) skippedCheckReasons["security-scan"] = "Security scan failed and was skipped.";
|
|
46131
45936
|
return {
|
|
46132
45937
|
skippedChecks,
|
|
46133
45938
|
skippedCheckReasons
|
|
@@ -46542,7 +46347,7 @@ const GH_DEFAULT_BRANCH_PROBE_TIMEOUT_MS = 5e3;
|
|
|
46542
46347
|
const CI_TRUST_COMPANIES = "PayPal, Rippling, and Alibaba";
|
|
46543
46348
|
const WELCOME_EXPLANATION_HOLD_MS = 1e3;
|
|
46544
46349
|
const CATEGORY_COUNTUP_SETTLE_HOLD_MS = 1e3;
|
|
46545
|
-
const INTERNAL_ERROR_JSON_FALLBACK = "{\"schemaVersion\":
|
|
46350
|
+
const INTERNAL_ERROR_JSON_FALLBACK = "{\"schemaVersion\":1,\"ok\":false,\"error\":{\"message\":\"Internal error\",\"name\":\"Error\",\"chain\":[]}}\n";
|
|
46546
46351
|
const SENTRY_FLUSH_TIMEOUT_MS = 2e3;
|
|
46547
46352
|
const NANOSECONDS_PER_SECOND = 1000000000n;
|
|
46548
46353
|
const METRIC = {
|
|
@@ -46629,7 +46434,7 @@ const makeNoopConsole = () => ({
|
|
|
46629
46434
|
});
|
|
46630
46435
|
//#endregion
|
|
46631
46436
|
//#region src/cli/utils/version.ts
|
|
46632
|
-
const VERSION = "0.7.4-dev.
|
|
46437
|
+
const VERSION = "0.7.4-dev.dfccac4";
|
|
46633
46438
|
//#endregion
|
|
46634
46439
|
//#region src/cli/utils/json-mode.ts
|
|
46635
46440
|
let context = null;
|
|
@@ -46998,13 +46803,13 @@ const isDevVersion = (version) => version === "0.0.0" || version.includes("-");
|
|
|
46998
46803
|
* uploads source-map artifacts under, so stack frames symbolicate. Honors the
|
|
46999
46804
|
* standard `SENTRY_RELEASE` override.
|
|
47000
46805
|
*/
|
|
47001
|
-
const resolveSentryRelease = () => process.env.SENTRY_RELEASE || `react-doctor@0.7.4-dev.
|
|
46806
|
+
const resolveSentryRelease = () => process.env.SENTRY_RELEASE || `react-doctor@0.7.4-dev.dfccac4`;
|
|
47002
46807
|
/**
|
|
47003
46808
|
* Deployment environment shown in Sentry's environment filter. Defaults to
|
|
47004
46809
|
* `production` for tagged releases and `development` for dev/unbuilt versions,
|
|
47005
46810
|
* overridable via the standard `SENTRY_ENVIRONMENT` env var.
|
|
47006
46811
|
*/
|
|
47007
|
-
const resolveSentryEnvironment = () => process.env.SENTRY_ENVIRONMENT || (isDevVersion("0.7.4-dev.
|
|
46812
|
+
const resolveSentryEnvironment = () => process.env.SENTRY_ENVIRONMENT || (isDevVersion("0.7.4-dev.dfccac4") ? "development" : "production");
|
|
47008
46813
|
/**
|
|
47009
46814
|
* Performance-tracing sample rate in `[0, 1]`. Reads `SENTRY_TRACES_SAMPLE_RATE`
|
|
47010
46815
|
* (set to `0` to disable tracing) and falls back to
|
|
@@ -59214,12 +59019,12 @@ const resolveCacheFilePath = (projectDirectory) => path.join(resolveReactDoctorC
|
|
|
59214
59019
|
const readPersistedCache = (cacheFilePath) => {
|
|
59215
59020
|
try {
|
|
59216
59021
|
const parsed = JSON.parse(fs.readFileSync(cacheFilePath, "utf8"));
|
|
59217
|
-
if (!isRecord(parsed) || parsed.version !==
|
|
59218
|
-
version:
|
|
59022
|
+
if (!isRecord(parsed) || parsed.version !== 4) return {
|
|
59023
|
+
version: 4,
|
|
59219
59024
|
entries: []
|
|
59220
59025
|
};
|
|
59221
59026
|
if (!Array.isArray(parsed.entries)) return {
|
|
59222
|
-
version:
|
|
59027
|
+
version: 4,
|
|
59223
59028
|
entries: []
|
|
59224
59029
|
};
|
|
59225
59030
|
const entries = [];
|
|
@@ -59229,12 +59034,12 @@ const readPersistedCache = (cacheFilePath) => {
|
|
|
59229
59034
|
entries.push(entry);
|
|
59230
59035
|
}
|
|
59231
59036
|
return {
|
|
59232
|
-
version:
|
|
59037
|
+
version: 4,
|
|
59233
59038
|
entries
|
|
59234
59039
|
};
|
|
59235
59040
|
} catch {
|
|
59236
59041
|
return {
|
|
59237
|
-
version:
|
|
59042
|
+
version: 4,
|
|
59238
59043
|
entries: []
|
|
59239
59044
|
};
|
|
59240
59045
|
}
|
|
@@ -59296,7 +59101,7 @@ const buildScanResultCacheKey = (input) => {
|
|
|
59296
59101
|
if (headSha === null) return null;
|
|
59297
59102
|
if (stringifyStableJson(input.userConfig) === null) return null;
|
|
59298
59103
|
const cacheKeyJson = stringifyStableJson({
|
|
59299
|
-
schemaVersion:
|
|
59104
|
+
schemaVersion: 4,
|
|
59300
59105
|
projectIdentity: resolveProjectIdentity(input.projectDirectory),
|
|
59301
59106
|
headSha,
|
|
59302
59107
|
worktreeFingerprint,
|
|
@@ -59337,7 +59142,7 @@ const createScanResultCache = (projectDirectory) => {
|
|
|
59337
59142
|
for (const entry of persistedCache.entries) entries.set(entry.key, entry);
|
|
59338
59143
|
const persist = () => {
|
|
59339
59144
|
writePersistedCache(cacheFilePath, {
|
|
59340
|
-
version:
|
|
59145
|
+
version: 4,
|
|
59341
59146
|
entries: [...entries.values()].sort((firstEntry, secondEntry) => secondEntry.createdAtMs - firstEntry.createdAtMs).slice(0, 20)
|
|
59342
59147
|
});
|
|
59343
59148
|
};
|
|
@@ -59478,7 +59283,6 @@ const buildOutcomeAttributes = (input) => {
|
|
|
59478
59283
|
return withNamespace("outcome", {
|
|
59479
59284
|
status: "error",
|
|
59480
59285
|
exitCode: 1,
|
|
59481
|
-
complete: false,
|
|
59482
59286
|
knownError: known,
|
|
59483
59287
|
errorTag: known ? error.reason._tag : error instanceof Error ? error.name : null
|
|
59484
59288
|
});
|
|
@@ -59488,13 +59292,8 @@ const buildOutcomeAttributes = (input) => {
|
|
|
59488
59292
|
const blockingLevel = resolveTelemetryBlocking(input.userConfig);
|
|
59489
59293
|
const gateDiagnostics = filterDiagnosticsForSurface(result.diagnostics, "ciFailure", input.userConfig);
|
|
59490
59294
|
const wouldBlock = !input.scoreOnly && !input.gateExempt && shouldBlockCi(gateDiagnostics, blockingLevel);
|
|
59491
|
-
const
|
|
59492
|
-
|
|
59493
|
-
scannedFileCount: result.scannedFileCount,
|
|
59494
|
-
skippedCheckCount: result.skippedChecks.length,
|
|
59495
|
-
skippedCheckReasonCount: Object.keys(result.skippedCheckReasons ?? {}).length
|
|
59496
|
-
});
|
|
59497
|
-
const isClean = result.diagnostics.length === 0 && complete;
|
|
59295
|
+
const hasSkippedChecks = result.skippedChecks.length > 0;
|
|
59296
|
+
const isClean = result.diagnostics.length === 0 && !hasSkippedChecks;
|
|
59498
59297
|
const outcome = wouldBlock ? "blocked" : isClean ? "clean" : "ok";
|
|
59499
59298
|
const firings = summarizeRuleFirings(result.diagnostics);
|
|
59500
59299
|
const countByRule = /* @__PURE__ */ new Map();
|
|
@@ -59544,7 +59343,6 @@ const buildOutcomeAttributes = (input) => {
|
|
|
59544
59343
|
wouldBlock,
|
|
59545
59344
|
blocking: blockingLevel,
|
|
59546
59345
|
clean: isClean,
|
|
59547
|
-
complete,
|
|
59548
59346
|
skippedChecks: result.skippedChecks.length
|
|
59549
59347
|
}),
|
|
59550
59348
|
...withNamespace("diag", {
|
|
@@ -61195,7 +60993,6 @@ const runInspectWithRuntime = async (directory, options, userConfig, hasConfigOv
|
|
|
61195
60993
|
directory: output.resolvedDirectory,
|
|
61196
60994
|
scannedFileCount: output.scannedFileCount,
|
|
61197
60995
|
scannedFilePaths: output.scannedFilePaths,
|
|
61198
|
-
analyzedFiles: output.analyzedFiles,
|
|
61199
60996
|
scanElapsedMilliseconds: output.scanElapsedMilliseconds,
|
|
61200
60997
|
scanConcurrency: output.scanConcurrency,
|
|
61201
60998
|
baselineDelta,
|
|
@@ -61250,12 +61047,9 @@ const renderAndRecordScan = async (input) => {
|
|
|
61250
61047
|
lintPartialFailures: input.payload.lintPartialFailures,
|
|
61251
61048
|
didDeadCodeFail: input.payload.didDeadCodeFail,
|
|
61252
61049
|
deadCodeFailureReason: input.payload.deadCodeFailureReason,
|
|
61253
|
-
supplyChainOverlapTimedOut: input.payload.supplyChainOverlapTimedOut,
|
|
61254
|
-
securityScanFailed: input.payload.securityScanFailed ?? false,
|
|
61255
61050
|
directory: input.payload.directory,
|
|
61256
61051
|
scannedFileCount: input.payload.scannedFileCount,
|
|
61257
61052
|
scannedFilePaths: input.payload.scannedFilePaths,
|
|
61258
|
-
analyzedFiles: input.payload.analyzedFiles ?? [],
|
|
61259
61053
|
scanElapsedMilliseconds: input.payload.scanElapsedMilliseconds,
|
|
61260
61054
|
lintCacheHitFileCount: input.lintCacheHitFileCount ?? null,
|
|
61261
61055
|
lintCacheTotalFileCount: input.lintCacheTotalFileCount ?? null,
|
|
@@ -61303,15 +61097,13 @@ const renderAndRecordScan = async (input) => {
|
|
|
61303
61097
|
return result;
|
|
61304
61098
|
};
|
|
61305
61099
|
const finalizeAndRender = (input) => gen(function* () {
|
|
61306
|
-
const { options, elapsedMilliseconds, diagnostics, score, project, userConfig, didLintFail, lintFailureReason, lintPartialFailures, didDeadCodeFail, deadCodeFailureReason,
|
|
61100
|
+
const { options, elapsedMilliseconds, diagnostics, score, project, userConfig, didLintFail, lintFailureReason, lintPartialFailures, didDeadCodeFail, deadCodeFailureReason, directory, scannedFileCount, scannedFilePaths, scanElapsedMilliseconds, lintCacheHitFileCount, lintCacheTotalFileCount, lintSidecarReplayedFileCount, lintSidecarTotalFileCount, deadCodeCacheHit, deadCodeSummaryCacheHits, deadCodeSummaryCacheMisses, baselineDelta } = input;
|
|
61307
61101
|
const { skippedChecks, skippedCheckReasons } = buildSkippedChecks({
|
|
61308
61102
|
didLintFail,
|
|
61309
61103
|
lintFailureReason,
|
|
61310
61104
|
lintPartialFailures,
|
|
61311
61105
|
didDeadCodeFail,
|
|
61312
|
-
deadCodeFailureReason
|
|
61313
|
-
supplyChainOverlapTimedOut,
|
|
61314
|
-
securityScanFailed
|
|
61106
|
+
deadCodeFailureReason
|
|
61315
61107
|
});
|
|
61316
61108
|
const hasSkippedChecks = skippedChecks.length > 0;
|
|
61317
61109
|
const noScoreMessage = buildNoScoreMessage(options.noScore);
|
|
@@ -61324,7 +61116,6 @@ const finalizeAndRender = (input) => gen(function* () {
|
|
|
61324
61116
|
elapsedMilliseconds,
|
|
61325
61117
|
scannedFileCount,
|
|
61326
61118
|
scannedFilePaths,
|
|
61327
|
-
analyzedFiles,
|
|
61328
61119
|
scanElapsedMilliseconds,
|
|
61329
61120
|
...lintCacheTotalFileCount !== null ? {
|
|
61330
61121
|
lintCacheHitFileCount,
|
|
@@ -65193,4 +64984,4 @@ Promise.resolve().then(() => assertNoRemovedFlags(process.argv)).then(() => prog
|
|
|
65193
64984
|
export {};
|
|
65194
64985
|
|
|
65195
64986
|
//# sourceMappingURL=cli.js.map
|
|
65196
|
-
//# debugId=
|
|
64987
|
+
//# debugId=f9a61243-36ed-57c7-ba8a-6c5318b59172
|