@react-native/debugger-shell 0.85.0-nightly-20260112-0cda10b00 → 0.85.0-nightly-20260113-b60f533ac

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.
@@ -15,6 +15,7 @@ declare function unstable_spawnDebuggerShellWithArgs(
15
15
  mode?: "syncThenExit" | "detached";
16
16
  flavor?: DebuggerShellFlavor;
17
17
  prebuiltBinaryPath?: null | undefined | string;
18
+ silent?: boolean;
18
19
  }>,
19
20
  ): Promise<void>;
20
21
  export type DebuggerShellPreparationResult = Readonly<{
@@ -8,6 +8,7 @@ exports.unstable_spawnDebuggerShellWithArgs =
8
8
  unstable_spawnDebuggerShellWithArgs;
9
9
  var _LaunchUtils = require("./private/LaunchUtils");
10
10
  const { spawn } = require("cross-spawn");
11
+ const debug = require("debug")("Metro:DebuggerShell");
11
12
  const path = require("path");
12
13
  const DEVTOOLS_BINARY_DOTSLASH_FILE = path.join(
13
14
  __dirname,
@@ -19,6 +20,7 @@ async function unstable_spawnDebuggerShellWithArgs(
19
20
  mode = "detached",
20
21
  flavor = process.env.RNDT_DEV === "1" ? "dev" : "prebuilt",
21
22
  prebuiltBinaryPath,
23
+ silent = process.env.NODE_ENV === "test",
22
24
  } = {},
23
25
  ) {
24
26
  const [binaryPath, baseArgs] = getShellBinaryAndArgs(
@@ -28,17 +30,26 @@ async function unstable_spawnDebuggerShellWithArgs(
28
30
  return new Promise((resolve, reject) => {
29
31
  const { ELECTRON_RUN_AS_NODE: _, ...env } = process.env;
30
32
  const child = spawn(binaryPath, [...baseArgs, ...args], {
31
- stdio: "inherit",
33
+ stdio: ["ignore", "pipe", "pipe"],
32
34
  windowsHide: true,
33
35
  detached: mode === "detached",
34
36
  env,
35
37
  });
36
38
  if (mode === "detached") {
37
39
  child.on("spawn", () => {
40
+ debug("Debugger spawned in detached mode");
38
41
  resolve();
39
42
  });
40
- child.on("close", (code) => {
43
+ child.on("close", (code, signal) => {
44
+ debug("Debugger closed with code %s and signal %s", code, signal);
41
45
  if (code !== 0) {
46
+ if (!silent) {
47
+ console.error(
48
+ "Debugger exited with non-zero code (code: %s, signal: %s)",
49
+ code,
50
+ signal,
51
+ );
52
+ }
42
53
  reject(
43
54
  new Error(
44
55
  `Failed to open debugger shell: exited with code ${code}`,
@@ -46,17 +57,35 @@ async function unstable_spawnDebuggerShellWithArgs(
46
57
  );
47
58
  }
48
59
  });
60
+ child.on("error", (error) => {
61
+ debug("Debugger shell encountered error: %s", error);
62
+ reject(error);
63
+ });
64
+ if (!silent) {
65
+ child.stdout.on("data", (data) =>
66
+ console.log("[debugger-shell stdout] " + String(data)),
67
+ );
68
+ child.stderr.on("data", (data) =>
69
+ console.warn("[debugger-shell stderr] " + String(data)),
70
+ );
71
+ }
49
72
  child.unref();
50
73
  } else if (mode === "syncThenExit") {
51
74
  child.on("close", function (code, signal) {
52
- if (code === null) {
53
- console.error("Debugger shell exited with signal", signal);
75
+ debug("Debugger exited with code %s and signal %s", code, signal);
76
+ if (code === null && !silent) {
77
+ console.error(
78
+ "Debugger exited with code %s and signal %s",
79
+ code,
80
+ signal,
81
+ );
54
82
  process.exit(1);
55
83
  }
56
84
  process.exit(code);
57
85
  });
58
86
  const handleTerminationSignal = function (signal) {
59
87
  process.on(signal, function signalHandler() {
88
+ debug("Received signal %s. Killing debugger shell.", signal);
60
89
  if (!child.killed) {
61
90
  child.kill(signal);
62
91
  }
@@ -22,6 +22,7 @@ declare function unstable_spawnDebuggerShellWithArgs(
22
22
  mode?: "syncThenExit" | "detached",
23
23
  flavor?: DebuggerShellFlavor,
24
24
  prebuiltBinaryPath?: ?string,
25
+ silent?: boolean,
25
26
  }>,
26
27
  ): Promise<void>;
27
28
 
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@react-native/debugger-shell",
3
3
  "productName": "React Native DevTools",
4
- "version": "0.85.0-nightly-20260112-0cda10b00",
4
+ "version": "0.85.0-nightly-20260113-b60f533ac",
5
5
  "description": "Experimental debugger shell for React Native for use with @react-native/debugger-frontend",
6
6
  "keywords": [
7
7
  "react-native",