react-doctor 0.5.8-dev.5f2bd72 → 0.5.8-dev.734c564

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.
Files changed (3) hide show
  1. package/dist/cli.js +53 -12
  2. package/dist/lsp.js +3 -2
  3. 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]="286954ee-f636-51ec-9cb7-a1bde0687a30")}catch(e){}}();
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]="89eea142-f3f2-5f35-a6b0-e9e10055d0cb")}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";
@@ -44849,6 +44849,7 @@ const NANOSECONDS_PER_SECOND = 1000000000n;
44849
44849
  const METRIC = {
44850
44850
  cliInvoked: "cli.invoked",
44851
44851
  cliError: "cli.error",
44852
+ cliEnvironmentError: "cli.env_error",
44852
44853
  projectDetected: "project.detected",
44853
44854
  projectPathSelected: "project.path_selected",
44854
44855
  projectConfigSelected: "project.config_selected",
@@ -44921,7 +44922,7 @@ const makeNoopConsole = () => ({
44921
44922
  });
44922
44923
  //#endregion
44923
44924
  //#region src/cli/utils/version.ts
44924
- const VERSION = "0.5.8-dev.5f2bd72";
44925
+ const VERSION = "0.5.8-dev.734c564";
44925
44926
  //#endregion
44926
44927
  //#region src/cli/utils/json-mode.ts
44927
44928
  let context = null;
@@ -45285,13 +45286,13 @@ const isDevVersion = (version) => version === "0.0.0" || version.includes("-");
45285
45286
  * uploads source-map artifacts under, so stack frames symbolicate. Honors the
45286
45287
  * standard `SENTRY_RELEASE` override.
45287
45288
  */
45288
- const resolveSentryRelease = () => process.env.SENTRY_RELEASE || `react-doctor@0.5.8-dev.5f2bd72`;
45289
+ const resolveSentryRelease = () => process.env.SENTRY_RELEASE || `react-doctor@0.5.8-dev.734c564`;
45289
45290
  /**
45290
45291
  * Deployment environment shown in Sentry's environment filter. Defaults to
45291
45292
  * `production` for tagged releases and `development` for dev/unbuilt versions,
45292
45293
  * overridable via the standard `SENTRY_ENVIRONMENT` env var.
45293
45294
  */
45294
- const resolveSentryEnvironment = () => process.env.SENTRY_ENVIRONMENT || (isDevVersion("0.5.8-dev.5f2bd72") ? "development" : "production");
45295
+ const resolveSentryEnvironment = () => process.env.SENTRY_ENVIRONMENT || (isDevVersion("0.5.8-dev.734c564") ? "development" : "production");
45295
45296
  /**
45296
45297
  * Performance-tracing sample rate in `[0, 1]`. Reads `SENTRY_TRACES_SAMPLE_RATE`
45297
45298
  * (set to `0` to disable tracing) and falls back to
@@ -51103,6 +51104,35 @@ const materializeStagedFiles = async (directory, stagedFiles, tempDirectory) =>
51103
51104
  };
51104
51105
  };
51105
51106
  //#endregion
51107
+ //#region src/cli/utils/is-environment-error.ts
51108
+ const isNodeSystemError = (error) => error instanceof Error && typeof error.code === "string";
51109
+ const ENVIRONMENT_ERROR_CODES = new Set([
51110
+ "ENOSPC",
51111
+ "EIO",
51112
+ "EROFS",
51113
+ "EACCES",
51114
+ "EPERM",
51115
+ "ENOTDIR"
51116
+ ]);
51117
+ const isEnvironmentError = (error) => {
51118
+ if (!isNodeSystemError(error)) return false;
51119
+ if (error.code === "ENOENT") return error.syscall?.startsWith("spawn") ?? false;
51120
+ return error.code !== void 0 && ENVIRONMENT_ERROR_CODES.has(error.code);
51121
+ };
51122
+ const formatEnvironmentError = (error) => {
51123
+ if (!isNodeSystemError(error)) return error instanceof Error ? error.message : String(error);
51124
+ switch (error.code) {
51125
+ case "ENOSPC": return "No space left on device. Free up disk space and try again.";
51126
+ case "EIO": return "I/O error: the filesystem or disk may be failing. Check your system logs.";
51127
+ case "EROFS": return "Read-only filesystem: cannot write to this location.";
51128
+ case "EACCES":
51129
+ case "EPERM": return error.path ? `Permission denied accessing ${error.path}. Check file permissions and try again.` : "Permission denied. Check file permissions and try again.";
51130
+ case "ENOTDIR": return error.path ? `A file exists at ${error.path} or one of its parent paths where a directory was expected.` : "A file exists where a directory was expected.";
51131
+ case "ENOENT": return "Required command not found. Ensure the tool (e.g. git) is installed and on your PATH.";
51132
+ default: return error.message;
51133
+ }
51134
+ };
51135
+ //#endregion
51106
51136
  //#region src/cli/utils/handle-error.ts
51107
51137
  const OTLP_ENDPOINT_ENVIRONMENT_VARIABLE = "REACT_DOCTOR_OTLP_ENDPOINT";
51108
51138
  const OTLP_AUTH_HEADER_ENVIRONMENT_VARIABLE = "REACT_DOCTOR_OTLP_AUTH_HEADER";
@@ -51185,15 +51215,19 @@ const handleError = (error, options = {}) => {
51185
51215
  process.exitCode = 1;
51186
51216
  };
51187
51217
  /**
51188
- * Renderer for expected, user-actionable failures — a bad `--diff` value or
51189
- * a base branch that isn't fetched. Prints just the (already human-readable)
51190
- * message no "Something went wrong", prefilled issue, Discord link, or
51191
- * Sentry reference because there is no bug to report.
51218
+ * Renderer for expected, user-actionable failures — a bad `--diff` value,
51219
+ * a base branch that isn't fetched, or environment errors like disk-full or
51220
+ * permission-denied. Prints just the (already human-readable) message no
51221
+ * "Something went wrong", prefilled issue, Discord link, or Sentry reference
51222
+ * — because there is no bug to report.
51192
51223
  */
51193
51224
  const handleUserError = (error, options = {}) => {
51225
+ const isEnvError = isEnvironmentError(error);
51226
+ if (isEnvError) recordCount(METRIC.cliEnvironmentError, 1, { code: error.code ?? "unknown" });
51227
+ const message = isEnvError ? formatEnvironmentError(error) : formatErrorForReport(error);
51194
51228
  runSync(gen(function* () {
51195
51229
  yield* error$1("");
51196
- yield* error$1(highlighter.error(formatErrorForReport(error)));
51230
+ yield* error$1(highlighter.error(message));
51197
51231
  yield* error$1("");
51198
51232
  }));
51199
51233
  if (options.shouldExit !== false) process.exit(1);
@@ -51208,7 +51242,7 @@ const handleUserError = (error, options = {}) => {
51208
51242
  * `handleUserError` (a plain message — no "Something went wrong", prefilled
51209
51243
  * issue, Discord link, or Sentry reference), since there is no bug to report.
51210
51244
  *
51211
- * Three distinct shapes reach the CLI's catch blocks:
51245
+ * Four distinct shapes reach the CLI's catch blocks:
51212
51246
  *
51213
51247
  * - **Project-discovery failures** (`NoReactDependencyError`,
51214
51248
  * `ProjectNotFoundError`, `PackageJsonNotFoundError`, `NotADirectoryError`,
@@ -51221,12 +51255,19 @@ const handleUserError = (error, options = {}) => {
51221
51255
  * `--project` name.
51222
51256
  * - **Bad `--diff` input** (`GitBaseBranchInvalid` / `GitBaseBranchMissing`)
51223
51257
  * stays the tagged `ReactDoctorError`, so dispatch on the reason `_tag`.
51258
+ * - **Environment failures** (`ENOSPC`, `EIO`, `EROFS`, `EACCES`, `EPERM`,
51259
+ * `ENOTDIR`, plus a `spawn`-scoped `ENOENT` for a missing binary) — disk
51260
+ * full / failing / read-only, permission denied, or a path blocked by a
51261
+ * file. React Doctor cannot fix the user's environment; exit cleanly with an
51262
+ * actionable message instead of crashing. See `is-environment-error.ts` for
51263
+ * why the set stays narrow (codes that usually mean our bug keep reaching
51264
+ * Sentry).
51224
51265
  *
51225
51266
  * This composes the existing core narrowers rather than introducing a new
51226
51267
  * error-shape helper (AGENTS.md): it encodes CLI-layer reporting policy, not
51227
51268
  * knowledge of the `ReactDoctorError` shape.
51228
51269
  */
51229
- const isExpectedUserError = (error) => error instanceof CliInputError || isProjectDiscoveryError(error) || isReactDoctorError(error) && (error.reason._tag === "GitBaseBranchInvalid" || error.reason._tag === "GitBaseBranchMissing");
51270
+ const isExpectedUserError = (error) => error instanceof CliInputError || isProjectDiscoveryError(error) || isEnvironmentError(error) || isReactDoctorError(error) && (error.reason._tag === "GitBaseBranchInvalid" || error.reason._tag === "GitBaseBranchMissing");
51230
51271
  //#endregion
51231
51272
  //#region src/cli/utils/build-handoff-payload.ts
51232
51273
  const buildHandoffPayload = (input) => {
@@ -55436,4 +55477,4 @@ Promise.resolve().then(() => assertNoRemovedFlags(process.argv)).then(() => prog
55436
55477
  export {};
55437
55478
 
55438
55479
  //# sourceMappingURL=cli.js.map
55439
- //# debugId=286954ee-f636-51ec-9cb7-a1bde0687a30
55480
+ //# debugId=89eea142-f3f2-5f35-a6b0-e9e10055d0cb
package/dist/lsp.js CHANGED
@@ -42913,6 +42913,7 @@ const SENTRY_FLUSH_TIMEOUT_MS = 2e3;
42913
42913
  const METRIC = {
42914
42914
  cliInvoked: "cli.invoked",
42915
42915
  cliError: "cli.error",
42916
+ cliEnvironmentError: "cli.env_error",
42916
42917
  projectDetected: "project.detected",
42917
42918
  projectPathSelected: "project.path_selected",
42918
42919
  projectConfigSelected: "project.config_selected",
@@ -43259,5 +43260,5 @@ const startLanguageServer = () => {
43259
43260
  };
43260
43261
  //#endregion
43261
43262
  export { startLanguageServer };
43262
- !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]="f9576947-f3ff-58f4-b9ff-de0e2898651c")}catch(e){}}();
43263
- //# debugId=f9576947-f3ff-58f4-b9ff-de0e2898651c
43263
+ !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]="1b85b637-9e6d-554c-a429-3652a14706b0")}catch(e){}}();
43264
+ //# debugId=1b85b637-9e6d-554c-a429-3652a14706b0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-doctor",
3
- "version": "0.5.8-dev.5f2bd72",
3
+ "version": "0.5.8-dev.734c564",
4
4
  "description": "Your agent writes bad React. This catches it",
5
5
  "keywords": [
6
6
  "accessibility",
@@ -64,7 +64,7 @@
64
64
  "vscode-languageserver-textdocument": "^1.0.12",
65
65
  "vscode-uri": "^3.1.0",
66
66
  "deslop-js": "0.5.8",
67
- "oxlint-plugin-react-doctor": "0.5.8-dev.5f2bd72"
67
+ "oxlint-plugin-react-doctor": "0.5.8-dev.734c564"
68
68
  },
69
69
  "devDependencies": {
70
70
  "@types/babel__code-frame": "^7.27.0",
@@ -73,8 +73,8 @@
73
73
  "commander": "^14.0.3",
74
74
  "ora": "^9.4.0",
75
75
  "@react-doctor/api": "0.5.8",
76
- "@react-doctor/core": "0.5.8",
77
- "@react-doctor/language-server": "0.5.8"
76
+ "@react-doctor/language-server": "0.5.8",
77
+ "@react-doctor/core": "0.5.8"
78
78
  },
79
79
  "engines": {
80
80
  "node": "^20.19.0 || >=22.13.0"