@react-native/dev-middleware 0.82.0-nightly-20250727-df3f0967b → 0.82.0-nightly-20250729-e17e3e3f3

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.
@@ -5,16 +5,16 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.default = createDevMiddleware;
7
7
  var _InspectorProxy = _interopRequireDefault(
8
- require("./inspector-proxy/InspectorProxy")
8
+ require("./inspector-proxy/InspectorProxy"),
9
9
  );
10
10
  var _openDebuggerMiddleware = _interopRequireDefault(
11
- require("./middleware/openDebuggerMiddleware")
11
+ require("./middleware/openDebuggerMiddleware"),
12
12
  );
13
13
  var _DefaultBrowserLauncher = _interopRequireDefault(
14
- require("./utils/DefaultBrowserLauncher")
14
+ require("./utils/DefaultBrowserLauncher"),
15
15
  );
16
16
  var _debuggerFrontend = _interopRequireDefault(
17
- require("@react-native/debugger-frontend")
17
+ require("@react-native/debugger-frontend"),
18
18
  );
19
19
  var _connect = _interopRequireDefault(require("connect"));
20
20
  var _path = _interopRequireDefault(require("path"));
@@ -35,7 +35,7 @@ function createDevMiddleware({
35
35
  const experiments = getExperiments(experimentConfig);
36
36
  const eventReporter = createWrappedEventReporter(
37
37
  unstable_eventReporter,
38
- logger
38
+ logger,
39
39
  );
40
40
  const inspectorProxy = new _InspectorProxy.default(
41
41
  projectRoot,
@@ -44,7 +44,7 @@ function createDevMiddleware({
44
44
  experiments,
45
45
  logger,
46
46
  unstable_customInspectorMessageHandler,
47
- unstable_trackInspectorProxyEventLoopPerf
47
+ unstable_trackInspectorProxyEventLoopPerf,
48
48
  );
49
49
  const middleware = (0, _connect.default)()
50
50
  .use(
@@ -56,20 +56,20 @@ function createDevMiddleware({
56
56
  eventReporter,
57
57
  experiments,
58
58
  logger,
59
- })
59
+ }),
60
60
  )
61
61
  .use(
62
62
  "/debugger-frontend/embedder-static/embedderScript.js",
63
63
  (_req, res) => {
64
64
  res.setHeader("Content-Type", "application/javascript");
65
65
  res.end("");
66
- }
66
+ },
67
67
  )
68
68
  .use(
69
69
  "/debugger-frontend",
70
70
  (0, _serveStatic.default)(_path.default.join(_debuggerFrontend.default), {
71
71
  fallthrough: false,
72
- })
72
+ }),
73
73
  )
74
74
  .use((...args) => inspectorProxy.processRequest(...args));
75
75
  return {
@@ -91,7 +91,7 @@ function createWrappedEventReporter(reporter, logger) {
91
91
  case "profiling_target_registered":
92
92
  logger?.info(
93
93
  "Profiling build target '%s' registered for debugging",
94
- event.appId ?? "unknown"
94
+ event.appId ?? "unknown",
95
95
  );
96
96
  break;
97
97
  case "fusebox_console_notice":
@@ -99,7 +99,7 @@ function createWrappedEventReporter(reporter, logger) {
99
99
  "\u001B[1m\u001B[7m💡 JavaScript logs have moved!\u001B[22m They can now be " +
100
100
  "viewed in React Native DevTools. Tip: Type \u001B[1mj\u001B[22m in " +
101
101
  "the terminal to open (requires Google Chrome or Microsoft Edge)." +
102
- "\u001B[27m"
102
+ "\u001B[27m",
103
103
  );
104
104
  break;
105
105
  }
@@ -70,5 +70,5 @@ type DevMiddlewareAPI = $ReadOnly<{
70
70
  }>;
71
71
 
72
72
  declare export default function createDevMiddleware(
73
- $$PARAM_0$$: Options
73
+ $$PARAM_0$$: Options,
74
74
  ): DevMiddlewareAPI;
package/dist/index.js CHANGED
@@ -10,7 +10,7 @@ Object.defineProperty(exports, "createDevMiddleware", {
10
10
  },
11
11
  });
12
12
  var _createDevMiddleware = _interopRequireDefault(
13
- require("./createDevMiddleware")
13
+ require("./createDevMiddleware"),
14
14
  );
15
15
  function _interopRequireDefault(e) {
16
16
  return e && e.__esModule ? e : { default: e };
@@ -18,13 +18,13 @@ function getCDPLogPrefix(destination) {
18
18
  destination === "DebuggerToProxy"
19
19
  ? "->"
20
20
  : destination === "ProxyToDebugger"
21
- ? "<-"
22
- : " ",
21
+ ? "<-"
22
+ : " ",
23
23
  destination === "ProxyToDevice"
24
24
  ? "->"
25
25
  : destination === "DeviceToProxy"
26
- ? "<-"
27
- : " "
26
+ ? "<-"
27
+ : " ",
28
28
  );
29
29
  }
30
30
  class CdpDebugLogging {
@@ -73,14 +73,14 @@ class CdpDebugLogging {
73
73
  return value;
74
74
  }),
75
75
  null,
76
- 2
76
+ 2,
77
77
  );
78
78
  debug(
79
79
  "%s A large message (%s MB) was %s- %s",
80
80
  getCDPLogPrefix(destination),
81
81
  (message.length / (1024 * 1024)).toFixed(2),
82
82
  destination.startsWith("Proxy") ? " sent " : "received",
83
- messagePreview
83
+ messagePreview,
84
84
  );
85
85
  }
86
86
  if (timeout == null) {
@@ -90,10 +90,10 @@ class CdpDebugLogging {
90
90
  getCDPLogPrefix(destination),
91
91
  String(batchingCounters[destination].count).padStart(4),
92
92
  String(
93
- (batchingCounters[destination].size / (1024 * 1024)).toFixed(2)
93
+ (batchingCounters[destination].size / (1024 * 1024)).toFixed(2),
94
94
  ).padStart(6),
95
95
  destination.startsWith("Proxy") ? " sent " : "received",
96
- CDP_MESSAGES_BATCH_DEBUGGING_THROTTLE_MS / 1000
96
+ CDP_MESSAGES_BATCH_DEBUGGING_THROTTLE_MS / 1000,
97
97
  );
98
98
  batchingCounters[destination].count = 0;
99
99
  batchingCounters[destination].size = 0;
@@ -25,7 +25,7 @@ export type CustomMessageHandlerConnection = Readonly<{
25
25
  debugger: ExposedDebugger;
26
26
  }>;
27
27
  export type CreateCustomMessageHandlerFn = (
28
- connection: CustomMessageHandlerConnection
28
+ connection: CustomMessageHandlerConnection,
29
29
  ) => null | undefined | CustomMessageHandler;
30
30
  /**
31
31
  * The device message middleware allows implementers to handle unsupported CDP messages.
@@ -29,7 +29,7 @@ export type CustomMessageHandlerConnection = $ReadOnly<{
29
29
  }>;
30
30
 
31
31
  export type CreateCustomMessageHandlerFn = (
32
- connection: CustomMessageHandlerConnection
32
+ connection: CustomMessageHandlerConnection,
33
33
  ) => ?CustomMessageHandler;
34
34
 
35
35
  /**
@@ -56,7 +56,7 @@ declare class Device {
56
56
  $$PARAM_2$$: Readonly<{
57
57
  debuggerRelativeBaseUrl: URL;
58
58
  userAgent: string | null;
59
- }>
59
+ }>,
60
60
  ): void;
61
61
  dangerouslyGetSocket(): WS;
62
62
  }
@@ -6,7 +6,7 @@ Object.defineProperty(exports, "__esModule", {
6
6
  exports.default = exports.WS_CLOSE_REASON = void 0;
7
7
  var _CdpDebugLogging = _interopRequireDefault(require("./CdpDebugLogging"));
8
8
  var _DeviceEventReporter = _interopRequireDefault(
9
- require("./DeviceEventReporter")
9
+ require("./DeviceEventReporter"),
10
10
  );
11
11
  var fs = _interopRequireWildcard(require("fs"));
12
12
  var _invariant = _interopRequireDefault(require("invariant"));
@@ -33,7 +33,7 @@ function _interopRequireWildcard(e, r) {
33
33
  var i = a ? Object.getOwnPropertyDescriptor(e, u) : null;
34
34
  i && (i.get || i.set) ? Object.defineProperty(n, u, i) : (n[u] = e[u]);
35
35
  }
36
- return (n.default = e), t && t.set(e, n), n;
36
+ return ((n.default = e), t && t.set(e, n), n);
37
37
  }
38
38
  function _interopRequireDefault(e) {
39
39
  return e && e.__esModule ? e : { default: e };
@@ -125,12 +125,12 @@ class Device {
125
125
  this.#deviceEventReporter?.logProxyMessageHandlingError(
126
126
  "device",
127
127
  error,
128
- message
128
+ message,
129
129
  );
130
130
  } catch (loggingError) {
131
131
  debug(
132
132
  "Error logging message handling error to reporter: %O",
133
- loggingError
133
+ loggingError,
134
134
  );
135
135
  }
136
136
  }
@@ -140,14 +140,14 @@ class Device {
140
140
  this.#sendMessageToDevice({
141
141
  event: "getPages",
142
142
  }),
143
- PAGES_POLLING_INTERVAL
143
+ PAGES_POLLING_INTERVAL,
144
144
  );
145
145
  this.#deviceSocket.on("close", () => {
146
146
  if (socket === this.#deviceSocket) {
147
147
  this.#deviceEventReporter?.logDisconnection("device");
148
148
  this.#terminateDebuggerConnection(
149
149
  WS_CLOSURE_CODE.NORMAL,
150
- WS_CLOSE_REASON.CONNECTION_LOST
150
+ WS_CLOSE_REASON.CONNECTION_LOST,
151
151
  );
152
152
  clearInterval(this.#pagesPollingIntervalId);
153
153
  }
@@ -157,7 +157,7 @@ class Device {
157
157
  const debuggerConnection = this.#debuggerConnection;
158
158
  if (debuggerConnection) {
159
159
  this.#sendDisconnectEventToDevice(
160
- this.#mapToDevicePageId(debuggerConnection.pageId)
160
+ this.#mapToDevicePageId(debuggerConnection.pageId),
161
161
  );
162
162
  debuggerConnection.socket.close(code, reason);
163
163
  this.#debuggerConnection = null;
@@ -166,17 +166,17 @@ class Device {
166
166
  dangerouslyRecreateDevice(deviceOptions) {
167
167
  (0, _invariant.default)(
168
168
  deviceOptions.id === this.#id,
169
- "dangerouslyRecreateDevice() can only be used for the same device ID"
169
+ "dangerouslyRecreateDevice() can only be used for the same device ID",
170
170
  );
171
171
  const oldDebugger = this.#debuggerConnection;
172
172
  if (this.#app !== deviceOptions.app || this.#name !== deviceOptions.name) {
173
173
  this.#deviceSocket.close(
174
174
  WS_CLOSURE_CODE.NORMAL,
175
- WS_CLOSE_REASON.RECREATING_DEVICE
175
+ WS_CLOSE_REASON.RECREATING_DEVICE,
176
176
  );
177
177
  this.#terminateDebuggerConnection(
178
178
  WS_CLOSURE_CODE.NORMAL,
179
- WS_CLOSE_REASON.RECREATING_DEVICE
179
+ WS_CLOSE_REASON.RECREATING_DEVICE,
180
180
  );
181
181
  }
182
182
  this.#debuggerConnection = null;
@@ -184,7 +184,7 @@ class Device {
184
184
  oldDebugger.socket.removeAllListeners();
185
185
  this.#deviceSocket.close(
186
186
  WS_CLOSURE_CODE.NORMAL,
187
- WS_CLOSE_REASON.RECREATING_DEVICE
187
+ WS_CLOSE_REASON.RECREATING_DEVICE,
188
188
  );
189
189
  this.handleDebuggerConnection(oldDebugger.socket, oldDebugger.pageId, {
190
190
  debuggerRelativeBaseUrl: oldDebugger.debuggerRelativeBaseUrl,
@@ -209,7 +209,7 @@ class Device {
209
209
  handleDebuggerConnection(
210
210
  socket,
211
211
  pageId,
212
- { debuggerRelativeBaseUrl, userAgent }
212
+ { debuggerRelativeBaseUrl, userAgent },
213
213
  ) {
214
214
  const page =
215
215
  pageId === REACT_NATIVE_RELOADABLE_PAGE_ID
@@ -218,18 +218,18 @@ class Device {
218
218
  if (!page) {
219
219
  debug(
220
220
  `Got new debugger connection via ${debuggerRelativeBaseUrl.href} for ` +
221
- `page ${pageId} of ${this.#name}, but no such page exists`
221
+ `page ${pageId} of ${this.#name}, but no such page exists`,
222
222
  );
223
223
  socket.close(
224
224
  WS_CLOSURE_CODE.INTERNAL_ERROR,
225
- WS_CLOSE_REASON.PAGE_NOT_FOUND
225
+ WS_CLOSE_REASON.PAGE_NOT_FOUND,
226
226
  );
227
227
  return;
228
228
  }
229
229
  this.#deviceEventReporter?.logDisconnection("debugger");
230
230
  this.#terminateDebuggerConnection(
231
231
  WS_CLOSURE_CODE.NORMAL,
232
- WS_CLOSE_REASON.NEW_DEBUGGER_OPENED
232
+ WS_CLOSE_REASON.NEW_DEBUGGER_OPENED,
233
233
  );
234
234
  this.#deviceEventReporter?.logConnection("debugger", {
235
235
  pageId,
@@ -246,7 +246,7 @@ class Device {
246
246
  this.#debuggerConnection = debuggerInfo;
247
247
  debug(
248
248
  `Got new debugger connection via ${debuggerRelativeBaseUrl.href} for ` +
249
- `page ${pageId} of ${this.#name}`
249
+ `page ${pageId} of ${this.#name}`,
250
250
  );
251
251
  if (this.#debuggerConnection && this.#createCustomMessageHandler) {
252
252
  this.#debuggerConnection.customHandler = this.#createCustomMessageHandler(
@@ -280,13 +280,13 @@ class Device {
280
280
  } catch {}
281
281
  },
282
282
  },
283
- }
283
+ },
284
284
  );
285
285
  if (this.#debuggerConnection.customHandler) {
286
286
  debug("Created new custom message handler for debugger connection");
287
287
  } else {
288
288
  debug(
289
- "Skipping new custom message handler for debugger connection, factory function returned null"
289
+ "Skipping new custom message handler for debugger connection, factory function returned null",
290
290
  );
291
291
  }
292
292
  }
@@ -298,13 +298,13 @@ class Device {
298
298
  pageId: this.#debuggerConnection?.pageId ?? null,
299
299
  frontendUserAgent: userAgent,
300
300
  prefersFuseboxFrontend: this.#isPageFuseboxFrontend(
301
- this.#debuggerConnection?.pageId
301
+ this.#debuggerConnection?.pageId,
302
302
  ),
303
303
  });
304
304
  let processedReq = debuggerRequest;
305
305
  if (
306
306
  this.#debuggerConnection?.customHandler?.handleDebuggerMessage(
307
- debuggerRequest
307
+ debuggerRequest,
308
308
  ) === true
309
309
  ) {
310
310
  return;
@@ -313,7 +313,7 @@ class Device {
313
313
  processedReq = this.#interceptClientMessageForSourceFetching(
314
314
  debuggerRequest,
315
315
  debuggerInfo,
316
- socket
316
+ socket,
317
317
  );
318
318
  }
319
319
  if (processedReq) {
@@ -385,7 +385,7 @@ class Device {
385
385
  ...page,
386
386
  capabilities: capabilities ?? {},
387
387
  },
388
- ])
388
+ ]),
389
389
  );
390
390
  if (message.payload.length !== this.#pages.size) {
391
391
  const duplicateIds = new Set();
@@ -398,9 +398,7 @@ class Device {
398
398
  }
399
399
  }
400
400
  debug(
401
- `Received duplicate page IDs from device: ${[...duplicateIds].join(
402
- ", "
403
- )}`
401
+ `Received duplicate page IDs from device: ${[...duplicateIds].join(", ")}`,
404
402
  );
405
403
  }
406
404
  for (const page of this.#pages.values()) {
@@ -433,7 +431,7 @@ class Device {
433
431
  debuggerSocket.send(
434
432
  JSON.stringify({
435
433
  method: "reload",
436
- })
434
+ }),
437
435
  );
438
436
  }
439
437
  }
@@ -461,7 +459,7 @@ class Device {
461
459
  if (debuggerConnection != null) {
462
460
  if (
463
461
  debuggerConnection.customHandler?.handleDeviceMessage(
464
- parsedPayload
462
+ parsedPayload,
465
463
  ) === true
466
464
  ) {
467
465
  return;
@@ -469,7 +467,7 @@ class Device {
469
467
  this.#processMessageFromDeviceLegacy(
470
468
  parsedPayload,
471
469
  debuggerConnection,
472
- pageId
470
+ pageId,
473
471
  );
474
472
  const messageToSend = JSON.stringify(parsedPayload);
475
473
  debuggerSocket.send(messageToSend);
@@ -531,7 +529,7 @@ class Device {
531
529
  }
532
530
  #debuggerRelativeToDeviceRelativeUrl(
533
531
  debuggerRelativeUrl,
534
- { debuggerRelativeBaseUrl }
532
+ { debuggerRelativeBaseUrl },
535
533
  ) {
536
534
  const deviceRelativeUrl = new URL(debuggerRelativeUrl.href);
537
535
  if (debuggerRelativeUrl.origin === debuggerRelativeBaseUrl.origin) {
@@ -543,7 +541,7 @@ class Device {
543
541
  }
544
542
  #deviceRelativeUrlToDebuggerRelativeUrl(
545
543
  deviceRelativeUrl,
546
- { debuggerRelativeBaseUrl }
544
+ { debuggerRelativeBaseUrl },
547
545
  ) {
548
546
  const debuggerRelativeUrl = new URL(deviceRelativeUrl.href);
549
547
  if (deviceRelativeUrl.origin === this.#deviceRelativeBaseUrl.origin) {
@@ -576,7 +574,7 @@ class Device {
576
574
  payload.params.sourceMapURL =
577
575
  this.#deviceRelativeUrlToDebuggerRelativeUrl(
578
576
  sourceMapURL,
579
- debuggerInfo
577
+ debuggerInfo,
580
578
  ).href;
581
579
  }
582
580
  }
@@ -586,7 +584,7 @@ class Device {
586
584
  if (parsedUrl) {
587
585
  payload.params.url = this.#deviceRelativeUrlToDebuggerRelativeUrl(
588
586
  parsedUrl,
589
- debuggerInfo
587
+ debuggerInfo,
590
588
  ).href;
591
589
  serverRelativeUrl =
592
590
  this.#deviceRelativeUrlToServerRelativeUrl(parsedUrl).href;
@@ -598,7 +596,7 @@ class Device {
598
596
  if ("scriptId" in params && params.scriptId != null) {
599
597
  this.#scriptIdToSourcePathMapping.set(
600
598
  params.scriptId,
601
- serverRelativeUrl
599
+ serverRelativeUrl,
602
600
  );
603
601
  }
604
602
  }
@@ -610,7 +608,7 @@ class Device {
610
608
  debuggerInfo.socket.send(
611
609
  JSON.stringify({
612
610
  method: "Runtime.executionContextsCleared",
613
- })
611
+ }),
614
612
  );
615
613
  const resumeMessage = {
616
614
  method: "Debugger.resume",
@@ -620,7 +618,7 @@ class Device {
620
618
  pageId: this.#debuggerConnection?.pageId ?? null,
621
619
  frontendUserAgent: this.#debuggerConnection?.userAgent ?? null,
622
620
  prefersFuseboxFrontend: this.#isPageFuseboxFrontend(
623
- this.#debuggerConnection?.pageId
621
+ this.#debuggerConnection?.pageId,
624
622
  ),
625
623
  });
626
624
  this.#sendMessageToDevice({
@@ -640,7 +638,7 @@ class Device {
640
638
  if (parsedUrl) {
641
639
  callFrame.url = this.#deviceRelativeUrlToDebuggerRelativeUrl(
642
640
  parsedUrl,
643
- debuggerInfo
641
+ debuggerInfo,
644
642
  ).href;
645
643
  }
646
644
  }
@@ -691,7 +689,7 @@ class Device {
691
689
  if (httpUrl) {
692
690
  processedReq.params.url = this.#debuggerRelativeToDeviceRelativeUrl(
693
691
  httpUrl,
694
- debuggerInfo
692
+ debuggerInfo,
695
693
  ).href;
696
694
  } else if (
697
695
  originalUrlParam.startsWith(FILE_PREFIX) &&
@@ -702,14 +700,14 @@ class Device {
702
700
  }
703
701
  if (
704
702
  new Set(["10.0.2.2", "10.0.3.2"]).has(
705
- this.#deviceRelativeBaseUrl.hostname
703
+ this.#deviceRelativeBaseUrl.hostname,
706
704
  ) &&
707
705
  debuggerRelativeBaseUrl.hostname === "localhost" &&
708
706
  processedReq.params.urlRegex != null
709
707
  ) {
710
708
  processedReq.params.urlRegex = processedReq.params.urlRegex.replaceAll(
711
709
  "localhost",
712
- this.#deviceRelativeBaseUrl.hostname.replaceAll(".", "\\.")
710
+ this.#deviceRelativeBaseUrl.hostname.replaceAll(".", "\\."),
713
711
  );
714
712
  }
715
713
  return processedReq;
@@ -749,7 +747,7 @@ class Device {
749
747
  });
750
748
  };
751
749
  const pathToSource = this.#scriptIdToSourcePathMapping.get(
752
- req.params.scriptId
750
+ req.params.scriptId,
753
751
  );
754
752
  if (pathToSource != null) {
755
753
  const httpURL = this.#tryParseHTTPURL(pathToSource);
@@ -758,19 +756,19 @@ class Device {
758
756
  (text) => sendSuccessResponse(text),
759
757
  (err) =>
760
758
  sendErrorResponse(
761
- `Failed to fetch source url ${pathToSource}: ${err.message}`
762
- )
759
+ `Failed to fetch source url ${pathToSource}: ${err.message}`,
760
+ ),
763
761
  );
764
762
  } else {
765
763
  let file;
766
764
  try {
767
765
  file = fs.readFileSync(
768
766
  path.resolve(this.#projectRoot, pathToSource),
769
- "utf8"
767
+ "utf8",
770
768
  );
771
769
  } catch (err) {
772
770
  sendErrorResponse(
773
- `Failed to fetch source file ${pathToSource}: ${err.message}`
771
+ `Failed to fetch source file ${pathToSource}: ${err.message}`,
774
772
  );
775
773
  }
776
774
  if (file != null) {
@@ -827,7 +825,7 @@ class Device {
827
825
  executionContextId: 0,
828
826
  type: "error",
829
827
  },
830
- })
828
+ }),
831
829
  );
832
830
  }
833
831
  }
@@ -65,7 +65,7 @@ declare export default class Device {
65
65
  $$PARAM_2$$: $ReadOnly<{
66
66
  debuggerRelativeBaseUrl: URL,
67
67
  userAgent: string | null,
68
- }>
68
+ }>,
69
69
  ): void;
70
70
  dangerouslyGetSocket(): WS;
71
71
  }
@@ -31,23 +31,23 @@ declare class DeviceEventReporter {
31
31
  logRequest(
32
32
  req: Readonly<{ id: number; method: string }>,
33
33
  origin: "debugger" | "proxy",
34
- metadata: RequestMetadata
34
+ metadata: RequestMetadata,
35
35
  ): void;
36
36
  logResponse(
37
37
  res: DeepReadOnly<CDPResponse>,
38
38
  origin: "device" | "proxy",
39
- metadata: ResponseMetadata
39
+ metadata: ResponseMetadata,
40
40
  ): void;
41
41
  logProfilingTargetRegistered(): void;
42
42
  logConnection(
43
43
  connectedEntity: "debugger",
44
- metadata: Readonly<{ pageId: string; frontendUserAgent: string | null }>
44
+ metadata: Readonly<{ pageId: string; frontendUserAgent: string | null }>,
45
45
  ): void;
46
46
  logDisconnection(disconnectedEntity: "device" | "debugger"): void;
47
47
  logProxyMessageHandlingError(
48
48
  messageOrigin: "device" | "debugger",
49
49
  error: Error,
50
- message: string
50
+ message: string,
51
51
  ): void;
52
52
  logFuseboxConsoleNotice(): void;
53
53
  }
@@ -35,12 +35,12 @@ declare class DeviceEventReporter {
35
35
  logRequest(
36
36
  req: $ReadOnly<{ id: number, method: string, ... }>,
37
37
  origin: "debugger" | "proxy",
38
- metadata: RequestMetadata
38
+ metadata: RequestMetadata,
39
39
  ): void;
40
40
  logResponse(
41
41
  res: DeepReadOnly<CDPResponse<>>,
42
42
  origin: "device" | "proxy",
43
- metadata: ResponseMetadata
43
+ metadata: ResponseMetadata,
44
44
  ): void;
45
45
  logProfilingTargetRegistered(): void;
46
46
  logConnection(
@@ -48,13 +48,13 @@ declare class DeviceEventReporter {
48
48
  metadata: $ReadOnly<{
49
49
  pageId: string,
50
50
  frontendUserAgent: string | null,
51
- }>
51
+ }>,
52
52
  ): void;
53
53
  logDisconnection(disconnectedEntity: "device" | "debugger"): void;
54
54
  logProxyMessageHandlingError(
55
55
  messageOrigin: "device" | "debugger",
56
56
  error: Error,
57
- message: string
57
+ message: string,
58
58
  ): void;
59
59
  logFuseboxConsoleNotice(): void;
60
60
  }
@@ -25,7 +25,7 @@ declare class EventLoopPerfTracker {
25
25
  constructor(args: EventLoopPerfTrackerArgs);
26
26
  trackPerfThrottled(
27
27
  debuggerSessionIDs: DebuggerSessionIDs,
28
- connectionUptime: number
28
+ connectionUptime: number,
29
29
  ): void;
30
30
  }
31
31
  export default EventLoopPerfTracker;
@@ -32,7 +32,7 @@ class EventLoopPerfTracker {
32
32
  h.disable();
33
33
  const eventLoopUtilization = Math.floor(eluEnd.utilization * 100);
34
34
  const maxEventLoopDelayPercent = Math.floor(
35
- (h.max / 1e6 / this.#perfMeasurementDuration) * 100
35
+ (h.max / 1e6 / this.#perfMeasurementDuration) * 100,
36
36
  );
37
37
  if (maxEventLoopDelayPercent >= this.#minDelayPercentToReport) {
38
38
  this.#onHighDelay({
@@ -29,6 +29,6 @@ declare export default class EventLoopPerfTracker {
29
29
  constructor(args: EventLoopPerfTrackerArgs): void;
30
30
  trackPerfThrottled(
31
31
  debuggerSessionIDs: DebuggerSessionIDs,
32
- connectionUptime: number
32
+ connectionUptime: number,
33
33
  ): void;
34
34
  }
@@ -25,7 +25,7 @@ export interface InspectorProxyQueries {
25
25
  * page addition order.
26
26
  */
27
27
  getPageDescriptions(
28
- config: GetPageDescriptionsConfig
28
+ config: GetPageDescriptionsConfig,
29
29
  ): Array<PageDescription>;
30
30
  }
31
31
  /**
@@ -39,15 +39,15 @@ declare class InspectorProxy implements InspectorProxyQueries {
39
39
  experiments: Experiments,
40
40
  logger?: Logger,
41
41
  customMessageHandler: null | undefined | CreateCustomMessageHandlerFn,
42
- trackEventLoopPerf?: boolean
42
+ trackEventLoopPerf?: boolean,
43
43
  );
44
44
  getPageDescriptions(
45
- $$PARAM_0$$: GetPageDescriptionsConfig
45
+ $$PARAM_0$$: GetPageDescriptionsConfig,
46
46
  ): Array<PageDescription>;
47
47
  processRequest(
48
48
  request: IncomingMessage,
49
49
  response: ServerResponse,
50
- next: ($$PARAM_0$$: null | undefined | Error) => unknown
50
+ next: ($$PARAM_0$$: null | undefined | Error) => unknown,
51
51
  ): void;
52
52
  createWebSocketListeners(): { [path: string]: WS.Server };
53
53
  }
@@ -5,17 +5,17 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.default = void 0;
7
7
  var _getBaseUrlFromRequest = _interopRequireDefault(
8
- require("../utils/getBaseUrlFromRequest")
8
+ require("../utils/getBaseUrlFromRequest"),
9
9
  );
10
10
  var _getDevToolsFrontendUrl = _interopRequireDefault(
11
- require("../utils/getDevToolsFrontendUrl")
11
+ require("../utils/getDevToolsFrontendUrl"),
12
12
  );
13
13
  var _Device = _interopRequireDefault(require("./Device"));
14
14
  var _EventLoopPerfTracker = _interopRequireDefault(
15
- require("./EventLoopPerfTracker")
15
+ require("./EventLoopPerfTracker"),
16
16
  );
17
17
  var _InspectorProxyHeartbeat = _interopRequireDefault(
18
- require("./InspectorProxyHeartbeat")
18
+ require("./InspectorProxyHeartbeat"),
19
19
  );
20
20
  var _nullthrows = _interopRequireDefault(require("nullthrows"));
21
21
  var _url = _interopRequireDefault(require("url"));
@@ -59,7 +59,7 @@ class InspectorProxy {
59
59
  experiments,
60
60
  logger,
61
61
  customMessageHandler,
62
- trackEventLoopPerf = false
62
+ trackEventLoopPerf = false,
63
63
  ) {
64
64
  this.#projectRoot = projectRoot;
65
65
  this.#serverBaseUrl = new URL(serverBaseUrl);
@@ -83,7 +83,7 @@ class InspectorProxy {
83
83
  "[perf] high event loop delay in the last %ds- event loop utilization='%d%' max event loop delay percent='%d%'",
84
84
  duration / 1000,
85
85
  eventLoopUtilization,
86
- maxEventLoopDelayPercent
86
+ maxEventLoopDelayPercent,
87
87
  );
88
88
  this.#eventReporter?.logEvent({
89
89
  type: "high_event_loop_delay",
@@ -110,8 +110,8 @@ class InspectorProxy {
110
110
  deviceId,
111
111
  device,
112
112
  page,
113
- requestorRelativeBaseUrl
114
- )
113
+ requestorRelativeBaseUrl,
114
+ ),
115
115
  );
116
116
  if (
117
117
  logNoPagesForConnectedDevice &&
@@ -127,7 +127,7 @@ class InspectorProxy {
127
127
  - Ensure that the app is built in a mode that supports debugging.
128
128
  - Take the app out of running in the background.`,
129
129
  device.getApp(),
130
- device.getName()
130
+ device.getName(),
131
131
  );
132
132
  this.#eventReporter?.logEvent({
133
133
  type: "no_debug_pages_for_device",
@@ -153,7 +153,7 @@ class InspectorProxy {
153
153
  requestorRelativeBaseUrl:
154
154
  (0, _getBaseUrlFromRequest.default)(request) ?? this.#serverBaseUrl,
155
155
  logNoPagesForConnectedDevice: true,
156
- })
156
+ }),
157
157
  );
158
158
  } else if (pathname === PAGES_LIST_JSON_VERSION_URL) {
159
159
  this.#sendJsonResponse(response, {
@@ -182,7 +182,7 @@ class InspectorProxy {
182
182
  {
183
183
  relative: true,
184
184
  useFuseboxEntryPoint: page.capabilities.prefersFuseboxFrontend,
185
- }
185
+ },
186
186
  );
187
187
  return {
188
188
  id: `${deviceId}-${page.id}`,
@@ -221,7 +221,7 @@ class InspectorProxy {
221
221
  #onMessageFromDeviceOrDebugger(
222
222
  message,
223
223
  debuggerSessionIDs,
224
- connectionUptime
224
+ connectionUptime,
225
225
  ) {
226
226
  if (message.includes('"event":"getPages"')) {
227
227
  return;
@@ -229,7 +229,7 @@ class InspectorProxy {
229
229
  this.#lastMessageTimestamp = Date.now();
230
230
  this.#eventLoopPerfTracker?.trackPerfThrottled(
231
231
  debuggerSessionIDs,
232
- connectionUptime
232
+ connectionUptime,
233
233
  );
234
234
  }
235
235
  #createDeviceConnectionWSServer() {
@@ -273,14 +273,14 @@ class InspectorProxy {
273
273
  this.#logger?.info(
274
274
  "Connection established to app='%s' on device='%s'.",
275
275
  appName,
276
- deviceName
276
+ deviceName,
277
277
  );
278
278
  debug(
279
279
  "Got new device connection: name='%s', app=%s, device=%s, via=%s",
280
280
  deviceName,
281
281
  appName,
282
282
  deviceId,
283
- deviceRelativeBaseUrl.origin
283
+ deviceRelativeBaseUrl.origin,
284
284
  );
285
285
  const debuggerSessionIDs = {
286
286
  appId: newDevice?.getApp() || null,
@@ -298,7 +298,7 @@ class InspectorProxy {
298
298
  "[high ping] [ Device ] %sms for app='%s' on device='%s'",
299
299
  String(roundtripDuration).padStart(5),
300
300
  debuggerSessionIDs.appId,
301
- debuggerSessionIDs.deviceName
301
+ debuggerSessionIDs.deviceName,
302
302
  );
303
303
  this.#eventReporter?.logEvent({
304
304
  type: "device_high_ping",
@@ -314,7 +314,7 @@ class InspectorProxy {
314
314
  "[timeout] connection terminated with Device for app='%s' on device='%s' after not responding for %s seconds.",
315
315
  debuggerSessionIDs.appId ?? "unknown",
316
316
  debuggerSessionIDs.deviceName ?? "unknown",
317
- String(roundtripDuration / 1000)
317
+ String(roundtripDuration / 1000),
318
318
  );
319
319
  this.#eventReporter?.logEvent({
320
320
  type: "device_timeout",
@@ -330,8 +330,8 @@ class InspectorProxy {
330
330
  this.#onMessageFromDeviceOrDebugger(
331
331
  message.toString(),
332
332
  debuggerSessionIDs,
333
- Date.now() - wssTimestamp
334
- )
333
+ Date.now() - wssTimestamp,
334
+ ),
335
335
  );
336
336
  socket.on("close", (code, reason) => {
337
337
  this.#logger?.info(
@@ -339,7 +339,7 @@ class InspectorProxy {
339
339
  deviceName,
340
340
  appName,
341
341
  String(code),
342
- reason
342
+ reason,
343
343
  );
344
344
  this.#eventReporter?.logEvent({
345
345
  type: "device_connection_closed",
@@ -358,7 +358,7 @@ class InspectorProxy {
358
358
  "Connection failed to be established with app='%s' on device='%s' with error:",
359
359
  appName,
360
360
  deviceName,
361
- error
361
+ error,
362
362
  );
363
363
  socket.close(INTERNAL_ERROR_CODE, error?.toString() ?? "Unknown error");
364
364
  }
@@ -395,7 +395,7 @@ class InspectorProxy {
395
395
  this.#logger?.info(
396
396
  "Connection established to DevTools for app='%s' on device='%s'.",
397
397
  device.getApp() || "unknown",
398
- device.getName() || "unknown"
398
+ device.getName() || "unknown",
399
399
  );
400
400
  const heartbeat = new _InspectorProxyHeartbeat.default({
401
401
  socket,
@@ -407,7 +407,7 @@ class InspectorProxy {
407
407
  "[high ping] [DevTools] %sms for app='%s' on device='%s'",
408
408
  String(roundtripDuration).padStart(5),
409
409
  debuggerSessionIDs.appId,
410
- debuggerSessionIDs.deviceName
410
+ debuggerSessionIDs.deviceName,
411
411
  );
412
412
  this.#eventReporter?.logEvent({
413
413
  type: "debugger_high_ping",
@@ -423,7 +423,7 @@ class InspectorProxy {
423
423
  "[timeout] connection terminated with DevTools for app='%s' on device='%s' after not responding for %s seconds.",
424
424
  debuggerSessionIDs.appId ?? "unknown",
425
425
  debuggerSessionIDs.deviceName ?? "unknown",
426
- String(roundtripDuration / 1000)
426
+ String(roundtripDuration / 1000),
427
427
  );
428
428
  this.#eventReporter?.logEvent({
429
429
  type: "debugger_timeout",
@@ -439,8 +439,8 @@ class InspectorProxy {
439
439
  this.#onMessageFromDeviceOrDebugger(
440
440
  message.toString(),
441
441
  debuggerSessionIDs,
442
- Date.now() - wssTimestamp
443
- )
442
+ Date.now() - wssTimestamp,
443
+ ),
444
444
  );
445
445
  device.handleDebuggerConnection(socket, pageId, {
446
446
  debuggerRelativeBaseUrl,
@@ -452,7 +452,7 @@ class InspectorProxy {
452
452
  device.getApp() || "unknown",
453
453
  device.getName() || "unknown",
454
454
  String(code),
455
- reason
455
+ reason,
456
456
  );
457
457
  this.#eventReporter?.logEvent({
458
458
  type: "debugger_connection_closed",
@@ -469,7 +469,7 @@ class InspectorProxy {
469
469
  device?.getApp() || "unknown",
470
470
  device?.getName() || "unknown",
471
471
  deviceId,
472
- error
472
+ error,
473
473
  );
474
474
  socket.close(INTERNAL_ERROR_CODE, error?.toString() ?? "Unknown error");
475
475
  this.#eventReporter?.logEvent({
@@ -28,7 +28,7 @@ export interface InspectorProxyQueries {
28
28
  * page addition order.
29
29
  */
30
30
  getPageDescriptions(
31
- config: GetPageDescriptionsConfig
31
+ config: GetPageDescriptionsConfig,
32
32
  ): Array<PageDescription>;
33
33
  }
34
34
 
@@ -43,10 +43,10 @@ declare export default class InspectorProxy implements InspectorProxyQueries {
43
43
  experiments: Experiments,
44
44
  logger?: Logger,
45
45
  customMessageHandler: ?CreateCustomMessageHandlerFn,
46
- trackEventLoopPerf?: boolean
46
+ trackEventLoopPerf?: boolean,
47
47
  ): void;
48
48
  getPageDescriptions(
49
- $$PARAM_0$$: GetPageDescriptionsConfig
49
+ $$PARAM_0$$: GetPageDescriptionsConfig,
50
50
  ): Array<PageDescription>;
51
51
  // Process HTTP request sent to server. We only respond to 2 HTTP requests:
52
52
  // 1. /json/version returns Chrome debugger protocol version that we use
@@ -55,7 +55,7 @@ declare export default class InspectorProxy implements InspectorProxyQueries {
55
55
  processRequest(
56
56
  request: IncomingMessage,
57
57
  response: ServerResponse,
58
- next: (?Error) => mixed
58
+ next: (?Error) => mixed,
59
59
  ): void;
60
60
  createWebSocketListeners(): {
61
61
  [path: string]: WS.Server,
@@ -31,6 +31,6 @@ type Options = Readonly<{
31
31
  * @see https://chromedevtools.github.io/devtools-protocol/
32
32
  */
33
33
  declare function openDebuggerMiddleware(
34
- $$PARAM_0$$: Options
34
+ $$PARAM_0$$: Options,
35
35
  ): NextHandleFunction;
36
36
  export default openDebuggerMiddleware;
@@ -5,7 +5,7 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.default = openDebuggerMiddleware;
7
7
  var _getDevToolsFrontendUrl = _interopRequireDefault(
8
- require("../utils/getDevToolsFrontendUrl")
8
+ require("../utils/getDevToolsFrontendUrl"),
9
9
  );
10
10
  var _url = _interopRequireDefault(require("url"));
11
11
  function _interopRequireDefault(e) {
@@ -41,7 +41,7 @@ function openDebuggerMiddleware({
41
41
  "Ignoring DevTools app debug target for '%s' with title '%s' and 'nativePageReloads' capability set to '%s'. ",
42
42
  app.appId,
43
43
  app.title,
44
- String(app.reactNative.capabilities?.nativePageReloads)
44
+ String(app.reactNative.capabilities?.nativePageReloads),
45
45
  );
46
46
  }
47
47
  return betterReloadingSupport;
@@ -55,7 +55,7 @@ function openDebuggerMiddleware({
55
55
  ) {
56
56
  logger?.info(
57
57
  (launchType === "launch" ? "Launching" : "Redirecting to") +
58
- " DevTools..."
58
+ " DevTools...",
59
59
  );
60
60
  target = targets.find(
61
61
  (_target) =>
@@ -64,14 +64,12 @@ function openDebuggerMiddleware({
64
64
  (_target.appId === query.appId &&
65
65
  _target.title === LEGACY_SYNTHETIC_PAGE_TITLE)) &&
66
66
  (query.device == null ||
67
- _target.reactNative.logicalDeviceId === query.device)
67
+ _target.reactNative.logicalDeviceId === query.device),
68
68
  );
69
69
  } else if (targets.length > 0) {
70
70
  logger?.info(
71
71
  (launchType === "launch" ? "Launching" : "Redirecting to") +
72
- ` DevTools${
73
- targets.length === 1 ? "" : " for most recently connected target"
74
- }...`
72
+ ` DevTools${targets.length === 1 ? "" : " for most recently connected target"}...`,
75
73
  );
76
74
  target = targets[targets.length - 1];
77
75
  }
@@ -79,7 +77,7 @@ function openDebuggerMiddleware({
79
77
  res.writeHead(404);
80
78
  res.end("Unable to find debugger target");
81
79
  logger?.warn(
82
- "No compatible apps connected. React Native DevTools can only be used with the Hermes engine."
80
+ "No compatible apps connected. React Native DevTools can only be used with the Hermes engine.",
83
81
  );
84
82
  eventReporter?.logEvent({
85
83
  type: "launch_debugger_frontend",
@@ -103,7 +101,7 @@ function openDebuggerMiddleware({
103
101
  telemetryInfo: query.telemetryInfo,
104
102
  appId: target.appId,
105
103
  useFuseboxEntryPoint,
106
- }
104
+ },
107
105
  );
108
106
  if (
109
107
  useFuseboxEntryPoint &&
@@ -116,12 +114,12 @@ function openDebuggerMiddleware({
116
114
  ].join("-");
117
115
  if (!browserLauncher.unstable_showFuseboxShell) {
118
116
  throw new Error(
119
- "Fusebox shell is not supported by the current browser launcher"
117
+ "Fusebox shell is not supported by the current browser launcher",
120
118
  );
121
119
  }
122
120
  await browserLauncher.unstable_showFuseboxShell(
123
121
  frontendUrl,
124
- windowKey
122
+ windowKey,
125
123
  );
126
124
  } else {
127
125
  await browserLauncher.launchDebuggerAppWindow(frontendUrl);
@@ -142,7 +140,7 @@ function openDebuggerMiddleware({
142
140
  telemetryInfo: query.telemetryInfo,
143
141
  appId: target.appId,
144
142
  useFuseboxEntryPoint,
145
- }
143
+ },
146
144
  ),
147
145
  });
148
146
  res.end();
@@ -163,7 +161,7 @@ function openDebuggerMiddleware({
163
161
  return;
164
162
  } catch (e) {
165
163
  logger?.error(
166
- "Error launching DevTools: " + e.message ?? "Unknown error"
164
+ "Error launching DevTools: " + e.message ?? "Unknown error",
167
165
  );
168
166
  res.writeHead(500);
169
167
  res.end();
@@ -32,5 +32,5 @@ type Options = $ReadOnly<{
32
32
  * @see https://chromedevtools.github.io/devtools-protocol/
33
33
  */
34
34
  declare export default function openDebuggerMiddleware(
35
- $$PARAM_0$$: Options
35
+ $$PARAM_0$$: Options,
36
36
  ): NextHandleFunction;
@@ -33,8 +33,8 @@ const DefaultBrowserLauncher = {
33
33
  if (code !== 0) {
34
34
  reject(
35
35
  new Error(
36
- `Failed to launch debugger app window: ${chromePath} exited with code ${code}`
37
- )
36
+ `Failed to launch debugger app window: ${chromePath} exited with code ${code}`,
37
+ ),
38
38
  );
39
39
  }
40
40
  });
@@ -9,6 +9,6 @@
9
9
  */
10
10
 
11
11
  declare function getBaseUrlFromRequest(
12
- req: http$IncomingMessage<tls$TLSSocket> | http$IncomingMessage<net$Socket>
12
+ req: http$IncomingMessage<tls$TLSSocket> | http$IncomingMessage<net$Socket>,
13
13
  ): null | undefined | URL;
14
14
  export default getBaseUrlFromRequest;
@@ -13,5 +13,5 @@
13
13
  //
14
14
  // TODO: Support X-Forwarded-Host, etc. for trusted proxies
15
15
  declare export default function getBaseUrlFromRequest(
16
- req: http$IncomingMessage<tls$TLSSocket> | http$IncomingMessage<net$Socket>
16
+ req: http$IncomingMessage<tls$TLSSocket> | http$IncomingMessage<net$Socket>,
17
17
  ): ?URL;
@@ -23,6 +23,6 @@ declare function getDevToolsFrontendUrl(
23
23
  /** Whether to use the modern `rn_fusebox.html` entry point. */
24
24
  useFuseboxEntryPoint?: boolean;
25
25
  appId?: string;
26
- }>
26
+ }>,
27
27
  ): string;
28
28
  export default getDevToolsFrontendUrl;
@@ -8,7 +8,7 @@ function getDevToolsFrontendUrl(
8
8
  experiments,
9
9
  webSocketDebuggerUrl,
10
10
  devServerUrl,
11
- options
11
+ options,
12
12
  ) {
13
13
  const wsParam = getWsParam({
14
14
  webSocketDebuggerUrl,
@@ -24,5 +24,5 @@ declare export default function getDevToolsFrontendUrl(
24
24
  /** Whether to use the modern `rn_fusebox.html` entry point. */
25
25
  useFuseboxEntryPoint?: boolean,
26
26
  appId?: string,
27
- }>
27
+ }>,
28
28
  ): string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@react-native/dev-middleware",
3
- "version": "0.82.0-nightly-20250727-df3f0967b",
3
+ "version": "0.82.0-nightly-20250729-e17e3e3f3",
4
4
  "description": "Dev server middleware for React Native",
5
5
  "keywords": [
6
6
  "react-native",
@@ -23,7 +23,7 @@
23
23
  ],
24
24
  "dependencies": {
25
25
  "@isaacs/ttlcache": "^1.4.1",
26
- "@react-native/debugger-frontend": "0.82.0-nightly-20250727-df3f0967b",
26
+ "@react-native/debugger-frontend": "0.82.0-nightly-20250729-e17e3e3f3",
27
27
  "chrome-launcher": "^0.15.2",
28
28
  "chromium-edge-launcher": "^0.2.0",
29
29
  "connect": "^3.6.5",