@react-native/dev-middleware 0.75.0-nightly-20240324-4c8e253d8 → 0.75.0-nightly-20240327-2af1da42f
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/inspector-proxy/Device.js +27 -22
- package/package.json +2 -2
|
@@ -90,6 +90,11 @@ class Device {
|
|
|
90
90
|
// Package name of the app.
|
|
91
91
|
#app;
|
|
92
92
|
|
|
93
|
+
// Sequences async processing of messages from device to preserve order. Only
|
|
94
|
+
// necessary while we need to accommodate #processMessageFromDeviceLegacy's
|
|
95
|
+
// async fetch.
|
|
96
|
+
#messageFromDeviceQueue = Promise.resolve();
|
|
97
|
+
|
|
93
98
|
// Stores socket connection between Inspector Proxy and device.
|
|
94
99
|
#deviceSocket;
|
|
95
100
|
|
|
@@ -146,20 +151,24 @@ class Device {
|
|
|
146
151
|
|
|
147
152
|
// $FlowFixMe[incompatible-call]
|
|
148
153
|
this.#deviceSocket.on("message", (message) => {
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
154
|
+
this.#messageFromDeviceQueue = this.#messageFromDeviceQueue.then(
|
|
155
|
+
async () => {
|
|
156
|
+
const parsedMessage = JSON.parse(message);
|
|
157
|
+
if (parsedMessage.event === "getPages") {
|
|
158
|
+
// There's a 'getPages' message every second, so only show them if they change
|
|
159
|
+
if (message !== this.#lastGetPagesMessage) {
|
|
160
|
+
debug(
|
|
161
|
+
"(Debugger) (Proxy) <- (Device), getPages ping has changed: " +
|
|
162
|
+
message
|
|
163
|
+
);
|
|
164
|
+
this.#lastGetPagesMessage = message;
|
|
165
|
+
}
|
|
166
|
+
} else {
|
|
167
|
+
debug("(Debugger) (Proxy) <- (Device): " + message);
|
|
168
|
+
}
|
|
169
|
+
await this.#handleMessageFromDevice(parsedMessage);
|
|
158
170
|
}
|
|
159
|
-
|
|
160
|
-
debug("(Debugger) (Proxy) <- (Device): " + message);
|
|
161
|
-
}
|
|
162
|
-
this.#handleMessageFromDevice(parsedMessage);
|
|
171
|
+
);
|
|
163
172
|
});
|
|
164
173
|
// Sends 'getPages' request to device every PAGES_POLLING_INTERVAL milliseconds.
|
|
165
174
|
this.#pagesPollingIntervalId = setInterval(
|
|
@@ -388,7 +397,7 @@ class Device {
|
|
|
388
397
|
// In the future more logic will be added to this method for modifying
|
|
389
398
|
// some of the messages (like updating messages with source maps and file
|
|
390
399
|
// locations).
|
|
391
|
-
#handleMessageFromDevice(message) {
|
|
400
|
+
async #handleMessageFromDevice(message) {
|
|
392
401
|
if (message.event === "getPages") {
|
|
393
402
|
this.#pages = new Map(
|
|
394
403
|
message.payload.map(({ capabilities, ...page }) => [
|
|
@@ -492,17 +501,13 @@ class Device {
|
|
|
492
501
|
) {
|
|
493
502
|
return;
|
|
494
503
|
}
|
|
495
|
-
|
|
496
|
-
// Wrapping just to make flow happy :)
|
|
497
|
-
// $FlowFixMe[unused-promise]
|
|
498
|
-
this.#processMessageFromDeviceLegacy(
|
|
504
|
+
await this.#processMessageFromDeviceLegacy(
|
|
499
505
|
parsedPayload,
|
|
500
506
|
debuggerConnection,
|
|
501
507
|
pageId
|
|
502
|
-
)
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
});
|
|
508
|
+
);
|
|
509
|
+
const messageToSend = JSON.stringify(parsedPayload);
|
|
510
|
+
debuggerSocket.send(messageToSend);
|
|
506
511
|
} else {
|
|
507
512
|
debuggerSocket.send(message.payload.wrappedEvent);
|
|
508
513
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@react-native/dev-middleware",
|
|
3
|
-
"version": "0.75.0-nightly-
|
|
3
|
+
"version": "0.75.0-nightly-20240327-2af1da42f",
|
|
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.75.0-nightly-
|
|
26
|
+
"@react-native/debugger-frontend": "0.75.0-nightly-20240327-2af1da42f",
|
|
27
27
|
"chrome-launcher": "^0.15.2",
|
|
28
28
|
"chromium-edge-launcher": "^0.2.0",
|
|
29
29
|
"connect": "^3.6.5",
|