@react-native/dev-middleware 0.74.0-nightly-20231022-02397763f → 0.74.0-nightly-20231023-1923a4e2f
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/InspectorProxy.js +3 -0
- package/dist/inspector-proxy/types.d.ts +1 -0
- package/dist/inspector-proxy/types.js.flow +4 -0
- package/dist/middleware/openDebuggerMiddleware.js +18 -6
- package/dist/types/EventReporter.d.ts +3 -3
- package/dist/types/EventReporter.js.flow +1 -1
- package/package.json +2 -2
|
@@ -38,6 +38,7 @@ export type PageDescription = {
|
|
|
38
38
|
devtoolsFrontendUrl: string;
|
|
39
39
|
type: string;
|
|
40
40
|
webSocketDebuggerUrl: string;
|
|
41
|
+
reactNative: { logicalDeviceId: string };
|
|
41
42
|
};
|
|
42
43
|
export type JsonPagesListResponse = Array<PageDescription>;
|
|
43
44
|
export type JsonVersionResponse = {
|
|
@@ -79,6 +79,10 @@ export type PageDescription = {
|
|
|
79
79
|
devtoolsFrontendUrl: string,
|
|
80
80
|
type: string,
|
|
81
81
|
webSocketDebuggerUrl: string,
|
|
82
|
+
// Metadata specific to React Native
|
|
83
|
+
reactNative: {
|
|
84
|
+
logicalDeviceId: string,
|
|
85
|
+
},
|
|
82
86
|
...
|
|
83
87
|
};
|
|
84
88
|
export type JsonPagesListResponse = Array<PageDescription>;
|
|
@@ -45,7 +45,7 @@ function openDebuggerMiddleware({
|
|
|
45
45
|
(experiments.enableOpenDebuggerRedirect && req.method === "GET")
|
|
46
46
|
) {
|
|
47
47
|
const { query } = _url.default.parse(req.url, true);
|
|
48
|
-
const { appId } = query;
|
|
48
|
+
const { appId, device } = query;
|
|
49
49
|
const targets = inspectorProxy.getPageDescriptions().filter(
|
|
50
50
|
// Only use targets with better reloading support
|
|
51
51
|
(app) =>
|
|
@@ -53,12 +53,19 @@ function openDebuggerMiddleware({
|
|
|
53
53
|
);
|
|
54
54
|
let target;
|
|
55
55
|
const launchType = req.method === "POST" ? "launch" : "redirect";
|
|
56
|
-
if (typeof appId === "string") {
|
|
56
|
+
if (typeof appId === "string" || typeof device === "string") {
|
|
57
57
|
logger?.info(
|
|
58
58
|
(launchType === "launch" ? "Launching" : "Redirecting to") +
|
|
59
59
|
" JS debugger (experimental)..."
|
|
60
60
|
);
|
|
61
|
-
|
|
61
|
+
if (typeof device === "string") {
|
|
62
|
+
target = targets.find(
|
|
63
|
+
(_target) => _target.reactNative.logicalDeviceId === device
|
|
64
|
+
);
|
|
65
|
+
}
|
|
66
|
+
if (!target && typeof appId === "string") {
|
|
67
|
+
target = targets.find((_target) => _target.description === appId);
|
|
68
|
+
}
|
|
62
69
|
} else {
|
|
63
70
|
logger?.info(
|
|
64
71
|
(launchType === "launch" ? "Launching" : "Redirecting to") +
|
|
@@ -83,9 +90,13 @@ function openDebuggerMiddleware({
|
|
|
83
90
|
try {
|
|
84
91
|
switch (launchType) {
|
|
85
92
|
case "launch":
|
|
86
|
-
|
|
93
|
+
const frontendInstanceId =
|
|
94
|
+
device != null
|
|
95
|
+
? "device:" + device
|
|
96
|
+
: "app:" + (appId ?? "<null>");
|
|
97
|
+
await debuggerInstances.get(frontendInstanceId)?.kill();
|
|
87
98
|
debuggerInstances.set(
|
|
88
|
-
|
|
99
|
+
frontendInstanceId,
|
|
89
100
|
await browserLauncher.launchDebuggerAppWindow(
|
|
90
101
|
(0, _getDevToolsFrontendUrl.default)(
|
|
91
102
|
target.webSocketDebuggerUrl,
|
|
@@ -111,7 +122,8 @@ function openDebuggerMiddleware({
|
|
|
111
122
|
type: "launch_debugger_frontend",
|
|
112
123
|
launchType,
|
|
113
124
|
status: "success",
|
|
114
|
-
appId,
|
|
125
|
+
appId: appId ?? null,
|
|
126
|
+
deviceId: device ?? null,
|
|
115
127
|
});
|
|
116
128
|
return;
|
|
117
129
|
} catch (e) {
|
|
@@ -30,10 +30,10 @@ export type ReportableEvent =
|
|
|
30
30
|
| /**
|
|
31
31
|
* > 38 | ...
|
|
32
32
|
* | ^^^
|
|
33
|
-
* > 39 | | SuccessResult<{ appId: string }>
|
|
34
|
-
* |
|
|
33
|
+
* > 39 | | SuccessResult<{ appId: string | null, deviceId: string | null }>
|
|
34
|
+
* | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
|
35
35
|
* > 40 | | ErrorResult<mixed>
|
|
36
|
-
* |
|
|
36
|
+
* | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
|
37
37
|
* > 41 | | CodedErrorResult<"NO_APPS_FOUND">,
|
|
38
38
|
* | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Unsupported feature: Translating "object types with spreads in the middle or at the end" is currently not supported.
|
|
39
39
|
**/
|
|
@@ -36,7 +36,7 @@ export type ReportableEvent =
|
|
|
36
36
|
type: "launch_debugger_frontend",
|
|
37
37
|
launchType: "launch" | "redirect",
|
|
38
38
|
...
|
|
39
|
-
| SuccessResult<{ appId: string }>
|
|
39
|
+
| SuccessResult<{ appId: string | null, deviceId: string | null }>
|
|
40
40
|
| ErrorResult<mixed>
|
|
41
41
|
| CodedErrorResult<"NO_APPS_FOUND">,
|
|
42
42
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@react-native/dev-middleware",
|
|
3
|
-
"version": "0.74.0-nightly-
|
|
3
|
+
"version": "0.74.0-nightly-20231023-1923a4e2f",
|
|
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.74.0-nightly-
|
|
26
|
+
"@react-native/debugger-frontend": "0.74.0-nightly-20231023-1923a4e2f",
|
|
27
27
|
"chrome-launcher": "^0.15.2",
|
|
28
28
|
"chromium-edge-launcher": "^1.0.0",
|
|
29
29
|
"connect": "^3.6.5",
|