react-doctor 0.9.7-dev.13138a4 → 0.9.7
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/dist/cli.js +10780 -96
- package/dist/{devtools-DPRVRu3S.js → devtools-BQATi33M.js} +3 -3
- package/dist/{record-metric-CtlQma6P.js → exit-gracefully-BJRsqdaK.js} +11954 -6251
- package/dist/index.d.ts +4082 -4704
- package/dist/index.js +4386 -6069
- package/dist/lsp.js +4510 -6181
- package/dist/{run-scan-app-Drlqxtzl.js → run-scan-app-DawD5rhU.js} +29 -36
- package/package.json +3 -2
- package/dist/build-section-divider-QykRnrlR.js +0 -312
- package/dist/ci-BvGqcDKc.js +0 -7501
- package/dist/design-SGX69YQq.js +0 -14
- package/dist/exit-gracefully-CddufLS0.js +0 -47
- package/dist/inspect-DBJtHure.js +0 -1443
- package/dist/install-doctor-script-DxrteuEw.js +0 -3251
- package/dist/install-ffJ108LC.js +0 -32
- package/dist/install-github-workflow-BP6t3YBA.js +0 -267
- package/dist/install-react-doctor-BhfvyNZB.js +0 -1154
- package/dist/print-branded-header-Cw5AlicW.js +0 -22
- package/dist/read-object-file-ITGVjFKp.js +0 -24
- package/dist/report-error-DUoFKR7d.js +0 -158
- package/dist/report-workflow-result-D3GCowCN.js +0 -279
- package/dist/resolve-scope-gy72JH3h.js +0 -339
- package/dist/rules-6-d19pN1.js +0 -581
- package/dist/scan-C3Io41Dq.js +0 -53
- package/dist/should-fail-scan-gate-DImKUuu-.js +0 -3075
- package/dist/should-skip-prompts-CbIIaU8b.js +0 -10
- package/dist/unref-stdin-B5RnVeLa.js +0 -120
- package/dist/version-BFKBxkKV.js +0 -21
- package/dist/why-DO4CTn-R.js +0 -21
|
@@ -1,10 +0,0 @@
|
|
|
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]="3fe0b840-f5e4-50ba-8b18-dd1e195fdbba")}catch(e){}}();
|
|
3
|
-
import { P as isNonInteractiveEnvironment } from "./record-metric-CtlQma6P.js";
|
|
4
|
-
//#region src/cli/utils/should-skip-prompts.ts
|
|
5
|
-
const shouldSkipPrompts = (input = {}) => Boolean(input.yes) || Boolean(input.json) || isNonInteractiveEnvironment() || !process.stdin.isTTY;
|
|
6
|
-
//#endregion
|
|
7
|
-
export { shouldSkipPrompts as t };
|
|
8
|
-
|
|
9
|
-
//# sourceMappingURL=should-skip-prompts-CbIIaU8b.js.map
|
|
10
|
-
//# debugId=3fe0b840-f5e4-50ba-8b18-dd1e195fdbba
|
|
@@ -1,120 +0,0 @@
|
|
|
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]="102ac08f-58df-5d9c-8827-178db07fd8bc")}catch(e){}}();
|
|
3
|
-
import { N as CliInputError, cn as isReactDoctorError, nn as isErrnoException, sn as isProjectDiscoveryError, vn as messageFromUnknown } from "./record-metric-CtlQma6P.js";
|
|
4
|
-
//#region src/cli/utils/is-environment-error.ts
|
|
5
|
-
const ENVIRONMENT_ERROR_CODES = new Set([
|
|
6
|
-
"EACCES",
|
|
7
|
-
"EIO",
|
|
8
|
-
"ENOSPC",
|
|
9
|
-
"ENOTDIR",
|
|
10
|
-
"EPERM",
|
|
11
|
-
"EROFS"
|
|
12
|
-
]);
|
|
13
|
-
const ENVIRONMENT_FILESYSTEM_SYSCALLS = new Set([
|
|
14
|
-
"lstat",
|
|
15
|
-
"open",
|
|
16
|
-
"read",
|
|
17
|
-
"readdir",
|
|
18
|
-
"readlink",
|
|
19
|
-
"realpath",
|
|
20
|
-
"scandir",
|
|
21
|
-
"stat"
|
|
22
|
-
]);
|
|
23
|
-
const TRANSIENT_FILESYSTEM_ERROR_CODES = new Set([
|
|
24
|
-
"EBUSY",
|
|
25
|
-
"ETIMEDOUT",
|
|
26
|
-
"UNKNOWN"
|
|
27
|
-
]);
|
|
28
|
-
const findEnvironmentError = (error) => {
|
|
29
|
-
const pendingErrors = [error];
|
|
30
|
-
const visitedErrors = /* @__PURE__ */ new Set();
|
|
31
|
-
while (pendingErrors.length > 0) {
|
|
32
|
-
const currentError = pendingErrors.pop();
|
|
33
|
-
if (typeof currentError !== "object" || currentError === null) continue;
|
|
34
|
-
if (visitedErrors.has(currentError)) continue;
|
|
35
|
-
visitedErrors.add(currentError);
|
|
36
|
-
if (isErrnoException(currentError) && typeof currentError.code === "string") {
|
|
37
|
-
const syscall = currentError.syscall ?? "";
|
|
38
|
-
if (ENVIRONMENT_ERROR_CODES.has(currentError.code) || currentError.code === "ENOENT" && syscall.startsWith("spawn") || TRANSIENT_FILESYSTEM_ERROR_CODES.has(currentError.code) && ENVIRONMENT_FILESYSTEM_SYSCALLS.has(syscall)) return currentError;
|
|
39
|
-
}
|
|
40
|
-
if (currentError instanceof Error && currentError.cause !== void 0) pendingErrors.push(currentError.cause);
|
|
41
|
-
if (isReactDoctorError(currentError) && "cause" in currentError.reason) pendingErrors.push(currentError.reason.cause);
|
|
42
|
-
}
|
|
43
|
-
return null;
|
|
44
|
-
};
|
|
45
|
-
const isEnvironmentError = (error) => findEnvironmentError(error) !== null;
|
|
46
|
-
const formatEnvironmentError = (error) => {
|
|
47
|
-
const environmentError = findEnvironmentError(error);
|
|
48
|
-
if (!environmentError) return messageFromUnknown(error);
|
|
49
|
-
switch (environmentError.code) {
|
|
50
|
-
case "EBUSY": return environmentError.path ? `Resource busy or locked at ${environmentError.path}. Close the process using it and try again.` : "Resource busy or locked. Close the process using it and try again.";
|
|
51
|
-
case "ENOSPC": return "No space left on device. Free up disk space and try again.";
|
|
52
|
-
case "EIO": return "I/O error: the filesystem or disk may be failing. Check your system logs.";
|
|
53
|
-
case "EROFS": return "Read-only filesystem: cannot write to this location.";
|
|
54
|
-
case "EACCES":
|
|
55
|
-
case "EPERM": return environmentError.path ? `Permission denied accessing ${environmentError.path}. Check file permissions and try again.` : "Permission denied. Check file permissions and try again.";
|
|
56
|
-
case "ENOTDIR": return environmentError.path ? `A file exists at ${environmentError.path} or one of its parent paths where a directory was expected.` : "A file exists where a directory was expected.";
|
|
57
|
-
case "ENOENT": return "Required command not found. Ensure the tool (e.g. git) is installed and on your PATH.";
|
|
58
|
-
case "ETIMEDOUT": return environmentError.path ? `Timed out accessing ${environmentError.path}. Check the network or cloud drive and try again.` : "Filesystem access timed out. Check the network or cloud drive and try again.";
|
|
59
|
-
case "UNKNOWN": return environmentError.path ? `The operating system could not access ${environmentError.path}. Check the filesystem and try again.` : "The operating system could not access the filesystem. Check it and try again.";
|
|
60
|
-
default: return environmentError.message;
|
|
61
|
-
}
|
|
62
|
-
};
|
|
63
|
-
//#endregion
|
|
64
|
-
//#region src/cli/utils/is-expected-user-error.ts
|
|
65
|
-
/**
|
|
66
|
-
* Whether `error` is an expected, user-actionable failure — the user's project
|
|
67
|
-
* or input, not a react-doctor bug. Such failures must be kept out of crash
|
|
68
|
-
* reporting (Sentry + the alertable error-rate metric) and rendered via
|
|
69
|
-
* `handleUserError` (a plain message — no "Something went wrong", prefilled
|
|
70
|
-
* issue, Discord link, or Sentry reference), since there is no bug to report.
|
|
71
|
-
*
|
|
72
|
-
* Four distinct shapes reach the CLI's catch blocks:
|
|
73
|
-
*
|
|
74
|
-
* - **Project-discovery failures** (`NoReactDependencyError`,
|
|
75
|
-
* `ProjectNotFoundError`, `PackageJsonNotFoundError`, `NotADirectoryError`,
|
|
76
|
-
* `AmbiguousProjectError`) arrive as their plain legacy classes (so
|
|
77
|
-
* `isReactDoctorError` is `false` for them) — narrow with
|
|
78
|
-
* `isProjectDiscoveryError`. Running react-doctor against a directory that
|
|
79
|
-
* has no React, or a path that doesn't exist, is the canonical example.
|
|
80
|
-
* - **CLI invocation mistakes** (`CliInputError`): a malformed
|
|
81
|
-
* `<file>:<line>` argument, mutually exclusive flags, or an unknown
|
|
82
|
-
* `--project` name.
|
|
83
|
-
* - **Bad `--diff` input** (`GitBaseBranchInvalid` / `GitBaseBranchMissing`)
|
|
84
|
-
* stays the tagged `ReactDoctorError`, so dispatch on the reason `_tag`.
|
|
85
|
-
* - **Environment failures** (`ENOSPC`, `EIO`, `EROFS`, `EACCES`, `EPERM`,
|
|
86
|
-
* `ENOTDIR`, plus a `spawn`-scoped `ENOENT` for a missing binary) — disk
|
|
87
|
-
* full / failing / read-only, permission denied, or a path blocked by a
|
|
88
|
-
* file. React Doctor cannot fix the user's environment; exit cleanly with an
|
|
89
|
-
* actionable message instead of crashing. See `is-environment-error.ts` for
|
|
90
|
-
* why the set stays narrow (codes that usually mean our bug keep reaching
|
|
91
|
-
* Sentry).
|
|
92
|
-
*
|
|
93
|
-
* This composes the existing core narrowers rather than introducing a new
|
|
94
|
-
* error-shape helper (AGENTS.md): it encodes CLI-layer reporting policy, not
|
|
95
|
-
* knowledge of the `ReactDoctorError` shape.
|
|
96
|
-
*/
|
|
97
|
-
const isExpectedUserError = (error) => error instanceof CliInputError || isProjectDiscoveryError(error) || isEnvironmentError(error) || isReactDoctorError(error) && (error.reason._tag === "GitBaseBranchInvalid" || error.reason._tag === "GitBaseBranchMissing");
|
|
98
|
-
//#endregion
|
|
99
|
-
//#region src/cli/utils/active-run-trace.ts
|
|
100
|
-
let activeRunTrace = null;
|
|
101
|
-
const setActiveRunTrace = (trace) => {
|
|
102
|
-
activeRunTrace = trace;
|
|
103
|
-
};
|
|
104
|
-
const getActiveRunTrace = () => activeRunTrace;
|
|
105
|
-
let lastRunTraceId = null;
|
|
106
|
-
const recordRunTraceId = (traceId) => {
|
|
107
|
-
lastRunTraceId = traceId;
|
|
108
|
-
};
|
|
109
|
-
const getLastRunTraceId = () => lastRunTraceId;
|
|
110
|
-
//#endregion
|
|
111
|
-
//#region src/cli/utils/unref-stdin.ts
|
|
112
|
-
const unrefStdin = () => {
|
|
113
|
-
if (process.stdin.isTTY) return;
|
|
114
|
-
process.stdin.unref?.();
|
|
115
|
-
};
|
|
116
|
-
//#endregion
|
|
117
|
-
export { setActiveRunTrace as a, isEnvironmentError as c, recordRunTraceId as i, getActiveRunTrace as n, isExpectedUserError as o, getLastRunTraceId as r, formatEnvironmentError as s, unrefStdin as t };
|
|
118
|
-
|
|
119
|
-
//# sourceMappingURL=unref-stdin-B5RnVeLa.js.map
|
|
120
|
-
//# debugId=102ac08f-58df-5d9c-8827-178db07fd8bc
|
package/dist/version-BFKBxkKV.js
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
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]="6ffe9049-63c8-5820-913f-d95e78563a1f")}catch(e){}}();
|
|
3
|
-
import { m as VERSION, t as recordCount, y as METRIC } from "./record-metric-CtlQma6P.js";
|
|
4
|
-
//#region src/cli/commands/version.ts
|
|
5
|
-
/**
|
|
6
|
-
* oclif-style version line. 12-factor CLI Apps (#3, "What version am I
|
|
7
|
-
* on?"): the `version` command is the primary place users grab debugging
|
|
8
|
-
* info, so it carries the Node runtime and platform alongside the CLI
|
|
9
|
-
* version. The `-v` / `-V` / `--version` flags stay terse (just the
|
|
10
|
-
* number) so scripts can parse them.
|
|
11
|
-
*/
|
|
12
|
-
const buildVersionString = () => `react-doctor/${VERSION} ${process.platform}-${process.arch} node-${process.version}`;
|
|
13
|
-
const versionAction = () => {
|
|
14
|
-
recordCount(METRIC.cliInvoked, 1, { command: "version" });
|
|
15
|
-
process.stdout.write(`${buildVersionString()}\n`);
|
|
16
|
-
};
|
|
17
|
-
//#endregion
|
|
18
|
-
export { versionAction };
|
|
19
|
-
|
|
20
|
-
//# sourceMappingURL=version-BFKBxkKV.js.map
|
|
21
|
-
//# debugId=6ffe9049-63c8-5820-913f-d95e78563a1f
|
package/dist/why-DO4CTn-R.js
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
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]="85b8a54d-ad34-505b-8509-25cd897dbf95")}catch(e){}}();
|
|
3
|
-
import { t as inspectAction } from "./inspect-DBJtHure.js";
|
|
4
|
-
//#region src/cli/commands/why.ts
|
|
5
|
-
/**
|
|
6
|
-
* `why <file:line>` — explains why a rule fired (or why a suppression didn't
|
|
7
|
-
* apply) at a specific location. A thin wrapper over the inspect flow's
|
|
8
|
-
* single-location explain path so it reuses the same scan, config resolution,
|
|
9
|
-
* and clean error handling. (Replaces the former `--explain` / `--why` flags.)
|
|
10
|
-
*/
|
|
11
|
-
const whyAction = async (location, options) => {
|
|
12
|
-
await inspectAction(options.cwd ?? process.cwd(), {
|
|
13
|
-
explain: location,
|
|
14
|
-
project: options.project
|
|
15
|
-
});
|
|
16
|
-
};
|
|
17
|
-
//#endregion
|
|
18
|
-
export { whyAction };
|
|
19
|
-
|
|
20
|
-
//# sourceMappingURL=why-DO4CTn-R.js.map
|
|
21
|
-
//# debugId=85b8a54d-ad34-505b-8509-25cd897dbf95
|