@depup/react-native__dev-middleware 0.84.1-depup.1 → 0.85.0-depup.1
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/README.md +3 -3
- package/changes.json +3 -3
- package/dist/createDevMiddleware.d.ts +18 -9
- package/dist/createDevMiddleware.js +7 -17
- package/dist/createDevMiddleware.js.flow +21 -12
- package/dist/index.d.ts +4 -3
- package/dist/index.js +4 -4
- package/dist/index.js.flow +4 -3
- package/dist/inspector-proxy/CustomMessageHandler.js.flow +3 -3
- package/dist/inspector-proxy/Device.d.ts +6 -3
- package/dist/inspector-proxy/Device.js +197 -161
- package/dist/inspector-proxy/Device.js.flow +9 -6
- package/dist/inspector-proxy/DeviceEventReporter.d.ts +0 -3
- package/dist/inspector-proxy/DeviceEventReporter.js +0 -10
- package/dist/inspector-proxy/DeviceEventReporter.js.flow +5 -8
- package/dist/inspector-proxy/InspectorProxy.d.ts +3 -2
- package/dist/inspector-proxy/InspectorProxy.js +47 -15
- package/dist/inspector-proxy/InspectorProxy.js.flow +3 -2
- package/dist/inspector-proxy/__docs__/README.md +324 -0
- package/dist/inspector-proxy/cdp-types/messages.js.flow +3 -3
- package/dist/inspector-proxy/types.d.ts +24 -9
- package/dist/inspector-proxy/types.js.flow +36 -22
- package/dist/middleware/openDebuggerMiddleware.d.ts +4 -6
- package/dist/middleware/openDebuggerMiddleware.js +12 -22
- package/dist/middleware/openDebuggerMiddleware.js.flow +5 -7
- package/dist/types/{BrowserLauncher.js.flow → DevToolLauncher.d.ts} +10 -13
- package/dist/types/{BrowserLauncher.d.ts → DevToolLauncher.js.flow} +14 -12
- package/dist/types/EventReporter.d.ts +24 -27
- package/dist/types/EventReporter.js.flow +1 -7
- package/dist/types/Experiments.d.ts +8 -4
- package/dist/types/Experiments.js.flow +9 -5
- package/dist/types/Logger.js.flow +1 -1
- package/dist/types/ReadonlyURL.d.ts +53 -0
- package/dist/types/ReadonlyURL.js +1 -0
- package/dist/types/ReadonlyURL.js.flow +54 -0
- package/dist/utils/{DefaultBrowserLauncher.d.ts → DefaultToolLauncher.d.ts} +7 -11
- package/dist/utils/{DefaultBrowserLauncher.js → DefaultToolLauncher.js} +21 -4
- package/dist/utils/DefaultToolLauncher.js.flow +25 -0
- package/dist/utils/getDevToolsFrontendUrl.d.ts +2 -3
- package/dist/utils/getDevToolsFrontendUrl.js +3 -6
- package/dist/utils/getDevToolsFrontendUrl.js.flow +3 -4
- package/package.json +12 -12
- package/dist/utils/DefaultBrowserLauncher.js.flow +0 -29
- /package/dist/types/{BrowserLauncher.js → DevToolLauncher.js} +0 -0
|
@@ -30,11 +30,14 @@ export type TargetCapabilityFlags = Readonly<{
|
|
|
30
30
|
*/
|
|
31
31
|
nativeSourceCodeFetching?: boolean;
|
|
32
32
|
/**
|
|
33
|
-
* The target supports
|
|
33
|
+
* The target supports multiple concurrent debugger connections.
|
|
34
34
|
*
|
|
35
|
-
*
|
|
35
|
+
* When true, the proxy allows multiple debuggers to connect to the same
|
|
36
|
+
* page simultaneously, each identified by a unique session ID.
|
|
37
|
+
* When false (default/legacy), connecting a new debugger disconnects
|
|
38
|
+
* any existing debugger connection to that page.
|
|
36
39
|
*/
|
|
37
|
-
|
|
40
|
+
supportsMultipleDebuggers?: boolean;
|
|
38
41
|
}>;
|
|
39
42
|
export type PageFromDevice = Readonly<{
|
|
40
43
|
id: string;
|
|
@@ -52,17 +55,29 @@ export type Page = Readonly<
|
|
|
52
55
|
keyof { capabilities: NonNullable<PageFromDevice["capabilities"]> }
|
|
53
56
|
> & { capabilities: NonNullable<PageFromDevice["capabilities"]> }
|
|
54
57
|
>;
|
|
55
|
-
export type
|
|
58
|
+
export type WrappedEventFromDevice = Readonly<{
|
|
56
59
|
event: "wrappedEvent";
|
|
57
|
-
payload: Readonly<{
|
|
60
|
+
payload: Readonly<{
|
|
61
|
+
pageId: string;
|
|
62
|
+
wrappedEvent: string;
|
|
63
|
+
sessionId?: string;
|
|
64
|
+
}>;
|
|
65
|
+
}>;
|
|
66
|
+
export type WrappedEventToDevice = Readonly<{
|
|
67
|
+
event: "wrappedEvent";
|
|
68
|
+
payload: Readonly<{
|
|
69
|
+
pageId: string;
|
|
70
|
+
wrappedEvent: string;
|
|
71
|
+
sessionId: string;
|
|
72
|
+
}>;
|
|
58
73
|
}>;
|
|
59
74
|
export type ConnectRequest = Readonly<{
|
|
60
75
|
event: "connect";
|
|
61
|
-
payload: Readonly<{ pageId: string }>;
|
|
76
|
+
payload: Readonly<{ pageId: string; sessionId: string }>;
|
|
62
77
|
}>;
|
|
63
78
|
export type DisconnectRequest = Readonly<{
|
|
64
79
|
event: "disconnect";
|
|
65
|
-
payload: Readonly<{ pageId: string }>;
|
|
80
|
+
payload: Readonly<{ pageId: string; sessionId: string }>;
|
|
66
81
|
}>;
|
|
67
82
|
export type GetPagesRequest = { event: "getPages" };
|
|
68
83
|
export type GetPagesResponse = {
|
|
@@ -71,11 +86,11 @@ export type GetPagesResponse = {
|
|
|
71
86
|
};
|
|
72
87
|
export type MessageFromDevice =
|
|
73
88
|
| GetPagesResponse
|
|
74
|
-
|
|
|
89
|
+
| WrappedEventFromDevice
|
|
75
90
|
| DisconnectRequest;
|
|
76
91
|
export type MessageToDevice =
|
|
77
92
|
| GetPagesRequest
|
|
78
|
-
|
|
|
93
|
+
| WrappedEventToDevice
|
|
79
94
|
| ConnectRequest
|
|
80
95
|
| DisconnectRequest;
|
|
81
96
|
export type PageDescription = Readonly<{
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
* A capability flag disables a specific feature/hack in the InspectorProxy
|
|
13
13
|
* layer by indicating that the target supports one or more modern CDP features.
|
|
14
14
|
*/
|
|
15
|
-
export type TargetCapabilityFlags =
|
|
15
|
+
export type TargetCapabilityFlags = Readonly<{
|
|
16
16
|
/**
|
|
17
17
|
* The target supports a stable page representation across reloads.
|
|
18
18
|
*
|
|
@@ -32,18 +32,21 @@ export type TargetCapabilityFlags = $ReadOnly<{
|
|
|
32
32
|
nativeSourceCodeFetching?: boolean,
|
|
33
33
|
|
|
34
34
|
/**
|
|
35
|
-
* The target supports
|
|
35
|
+
* The target supports multiple concurrent debugger connections.
|
|
36
36
|
*
|
|
37
|
-
*
|
|
37
|
+
* When true, the proxy allows multiple debuggers to connect to the same
|
|
38
|
+
* page simultaneously, each identified by a unique session ID.
|
|
39
|
+
* When false (default/legacy), connecting a new debugger disconnects
|
|
40
|
+
* any existing debugger connection to that page.
|
|
38
41
|
*/
|
|
39
|
-
|
|
42
|
+
supportsMultipleDebuggers?: boolean,
|
|
40
43
|
}>;
|
|
41
44
|
|
|
42
45
|
// Page information received from the device. New page is created for
|
|
43
46
|
// each new instance of VM and can appear when user reloads React Native
|
|
44
47
|
// application.
|
|
45
48
|
|
|
46
|
-
export type PageFromDevice =
|
|
49
|
+
export type PageFromDevice = Readonly<{
|
|
47
50
|
id: string,
|
|
48
51
|
title: string,
|
|
49
52
|
/** Sent from modern targets only */
|
|
@@ -54,32 +57,43 @@ export type PageFromDevice = $ReadOnly<{
|
|
|
54
57
|
capabilities?: TargetCapabilityFlags,
|
|
55
58
|
}>;
|
|
56
59
|
|
|
57
|
-
export type Page =
|
|
60
|
+
export type Page = Readonly<{
|
|
58
61
|
...PageFromDevice,
|
|
59
62
|
capabilities: NonNullable<PageFromDevice["capabilities"]>,
|
|
60
63
|
}>;
|
|
61
64
|
|
|
62
|
-
// Chrome Debugger Protocol message/event passed
|
|
63
|
-
export type
|
|
65
|
+
// Chrome Debugger Protocol message/event passed from device to proxy.
|
|
66
|
+
export type WrappedEventFromDevice = Readonly<{
|
|
64
67
|
event: "wrappedEvent",
|
|
65
|
-
payload:
|
|
68
|
+
payload: Readonly<{
|
|
66
69
|
pageId: string,
|
|
67
70
|
wrappedEvent: string,
|
|
71
|
+
sessionId?: string,
|
|
72
|
+
}>,
|
|
73
|
+
}>;
|
|
74
|
+
|
|
75
|
+
// Chrome Debugger Protocol message/event passed from proxy to device.
|
|
76
|
+
export type WrappedEventToDevice = Readonly<{
|
|
77
|
+
event: "wrappedEvent",
|
|
78
|
+
payload: Readonly<{
|
|
79
|
+
pageId: string,
|
|
80
|
+
wrappedEvent: string,
|
|
81
|
+
sessionId: string,
|
|
68
82
|
}>,
|
|
69
83
|
}>;
|
|
70
84
|
|
|
71
85
|
// Request sent from Inspector Proxy to Device when new debugger is connected
|
|
72
86
|
// to particular page.
|
|
73
|
-
export type ConnectRequest =
|
|
87
|
+
export type ConnectRequest = Readonly<{
|
|
74
88
|
event: "connect",
|
|
75
|
-
payload:
|
|
89
|
+
payload: Readonly<{ pageId: string, sessionId: string }>,
|
|
76
90
|
}>;
|
|
77
91
|
|
|
78
92
|
// Request sent from Inspector Proxy to Device to notify that debugger is
|
|
79
93
|
// disconnected.
|
|
80
|
-
export type DisconnectRequest =
|
|
94
|
+
export type DisconnectRequest = Readonly<{
|
|
81
95
|
event: "disconnect",
|
|
82
|
-
payload:
|
|
96
|
+
payload: Readonly<{ pageId: string, sessionId: string }>,
|
|
83
97
|
}>;
|
|
84
98
|
|
|
85
99
|
// Request sent from Inspector Proxy to Device to get a list of pages.
|
|
@@ -88,24 +102,24 @@ export type GetPagesRequest = { event: "getPages" };
|
|
|
88
102
|
// Response to GetPagesRequest containing a list of page infos.
|
|
89
103
|
export type GetPagesResponse = {
|
|
90
104
|
event: "getPages",
|
|
91
|
-
payload:
|
|
105
|
+
payload: ReadonlyArray<PageFromDevice>,
|
|
92
106
|
};
|
|
93
107
|
|
|
94
108
|
// Union type for all possible messages sent from device to Inspector Proxy.
|
|
95
109
|
export type MessageFromDevice =
|
|
96
110
|
| GetPagesResponse
|
|
97
|
-
|
|
|
111
|
+
| WrappedEventFromDevice
|
|
98
112
|
| DisconnectRequest;
|
|
99
113
|
|
|
100
114
|
// Union type for all possible messages sent from Inspector Proxy to device.
|
|
101
115
|
export type MessageToDevice =
|
|
102
116
|
| GetPagesRequest
|
|
103
|
-
|
|
|
117
|
+
| WrappedEventToDevice
|
|
104
118
|
| ConnectRequest
|
|
105
119
|
| DisconnectRequest;
|
|
106
120
|
|
|
107
121
|
// Page description object that is sent in response to /json HTTP request from debugger.
|
|
108
|
-
export type PageDescription =
|
|
122
|
+
export type PageDescription = Readonly<{
|
|
109
123
|
id: string,
|
|
110
124
|
title: string,
|
|
111
125
|
appId: string,
|
|
@@ -121,7 +135,7 @@ export type PageDescription = $ReadOnly<{
|
|
|
121
135
|
vm?: string,
|
|
122
136
|
|
|
123
137
|
// React Native specific metadata
|
|
124
|
-
reactNative:
|
|
138
|
+
reactNative: Readonly<{
|
|
125
139
|
logicalDeviceId: string,
|
|
126
140
|
capabilities: Page["capabilities"],
|
|
127
141
|
}>,
|
|
@@ -131,7 +145,7 @@ export type JsonPagesListResponse = Array<PageDescription>;
|
|
|
131
145
|
|
|
132
146
|
// Response to /json/version HTTP request from the debugger specifying browser type and
|
|
133
147
|
// Chrome protocol version.
|
|
134
|
-
export type JsonVersionResponse =
|
|
148
|
+
export type JsonVersionResponse = Readonly<{
|
|
135
149
|
Browser: string,
|
|
136
150
|
"Protocol-Version": string,
|
|
137
151
|
}>;
|
|
@@ -141,12 +155,12 @@ export type JSONSerializable =
|
|
|
141
155
|
| number
|
|
142
156
|
| string
|
|
143
157
|
| null
|
|
144
|
-
|
|
|
158
|
+
| ReadonlyArray<JSONSerializable>
|
|
145
159
|
| { +[string]: JSONSerializable };
|
|
146
160
|
|
|
147
161
|
export type DeepReadOnly<T> =
|
|
148
|
-
T extends
|
|
149
|
-
?
|
|
162
|
+
T extends ReadonlyArray<infer V>
|
|
163
|
+
? ReadonlyArray<DeepReadOnly<V>>
|
|
150
164
|
: T extends { ... }
|
|
151
165
|
? { +[K in keyof T]: DeepReadOnly<T[K]> }
|
|
152
166
|
: T;
|
|
@@ -9,15 +9,16 @@
|
|
|
9
9
|
*/
|
|
10
10
|
|
|
11
11
|
import type { InspectorProxyQueries } from "../inspector-proxy/InspectorProxy";
|
|
12
|
-
import type {
|
|
12
|
+
import type { DevToolLauncher } from "../types/DevToolLauncher";
|
|
13
13
|
import type { EventReporter } from "../types/EventReporter";
|
|
14
14
|
import type { Experiments } from "../types/Experiments";
|
|
15
15
|
import type { Logger } from "../types/Logger";
|
|
16
|
+
import type { ReadonlyURL } from "../types/ReadonlyURL";
|
|
16
17
|
import type { NextHandleFunction } from "connect";
|
|
17
18
|
type Options = Readonly<{
|
|
18
|
-
serverBaseUrl:
|
|
19
|
+
serverBaseUrl: ReadonlyURL;
|
|
19
20
|
logger?: Logger;
|
|
20
|
-
|
|
21
|
+
toolLauncher: DevToolLauncher;
|
|
21
22
|
eventReporter?: EventReporter;
|
|
22
23
|
experiments: Experiments;
|
|
23
24
|
inspectorProxy: InspectorProxyQueries;
|
|
@@ -25,9 +26,6 @@ type Options = Readonly<{
|
|
|
25
26
|
/**
|
|
26
27
|
* Open the debugger frontend for a given CDP target.
|
|
27
28
|
*
|
|
28
|
-
* Currently supports React Native DevTools (rn_fusebox.html) and legacy Hermes
|
|
29
|
-
* (rn_inspector.html) targets.
|
|
30
|
-
*
|
|
31
29
|
* @see https://chromedevtools.github.io/devtools-protocol/
|
|
32
30
|
*/
|
|
33
31
|
declare function openDebuggerMiddleware(
|
|
@@ -8,7 +8,6 @@ var _getDevToolsFrontendUrl = _interopRequireDefault(
|
|
|
8
8
|
require("../utils/getDevToolsFrontendUrl"),
|
|
9
9
|
);
|
|
10
10
|
var _crypto = require("crypto");
|
|
11
|
-
var _url = _interopRequireDefault(require("url"));
|
|
12
11
|
function _interopRequireDefault(e) {
|
|
13
12
|
return e && e.__esModule ? e : { default: e };
|
|
14
13
|
}
|
|
@@ -17,7 +16,7 @@ const LEGACY_SYNTHETIC_PAGE_TITLE =
|
|
|
17
16
|
function openDebuggerMiddleware({
|
|
18
17
|
serverBaseUrl,
|
|
19
18
|
logger,
|
|
20
|
-
|
|
19
|
+
toolLauncher,
|
|
21
20
|
eventReporter,
|
|
22
21
|
experiments,
|
|
23
22
|
inspectorProxy,
|
|
@@ -25,7 +24,7 @@ function openDebuggerMiddleware({
|
|
|
25
24
|
let shellPreparationPromise;
|
|
26
25
|
if (experiments.enableStandaloneFuseboxShell) {
|
|
27
26
|
shellPreparationPromise =
|
|
28
|
-
|
|
27
|
+
toolLauncher?.prepareDebuggerShell?.() ??
|
|
29
28
|
Promise.resolve({
|
|
30
29
|
code: "not_implemented",
|
|
31
30
|
});
|
|
@@ -42,11 +41,11 @@ function openDebuggerMiddleware({
|
|
|
42
41
|
req.method === "POST" ||
|
|
43
42
|
(experiments.enableOpenDebuggerRedirect && req.method === "GET")
|
|
44
43
|
) {
|
|
45
|
-
const
|
|
46
|
-
const query =
|
|
44
|
+
const { searchParams } = new URL(req.url, "http://example.com");
|
|
45
|
+
const query = Object.fromEntries(searchParams);
|
|
47
46
|
const targets = inspectorProxy
|
|
48
47
|
.getPageDescriptions({
|
|
49
|
-
requestorRelativeBaseUrl:
|
|
48
|
+
requestorRelativeBaseUrl: serverBaseUrl,
|
|
50
49
|
})
|
|
51
50
|
.filter((app) => {
|
|
52
51
|
const betterReloadingSupport =
|
|
@@ -103,25 +102,22 @@ function openDebuggerMiddleware({
|
|
|
103
102
|
});
|
|
104
103
|
return;
|
|
105
104
|
}
|
|
106
|
-
const useFuseboxEntryPoint =
|
|
107
|
-
target.reactNative.capabilities?.prefersFuseboxFrontend ?? false;
|
|
108
105
|
try {
|
|
109
106
|
switch (launchType) {
|
|
110
107
|
case "launch": {
|
|
111
108
|
const frontendUrl = (0, _getDevToolsFrontendUrl.default)(
|
|
112
109
|
experiments,
|
|
113
110
|
target.webSocketDebuggerUrl,
|
|
114
|
-
serverBaseUrl,
|
|
111
|
+
new URL(serverBaseUrl),
|
|
115
112
|
{
|
|
116
113
|
launchId: query.launchId,
|
|
117
114
|
telemetryInfo: query.telemetryInfo,
|
|
118
115
|
appId: target.appId,
|
|
119
|
-
useFuseboxEntryPoint,
|
|
120
116
|
panel: query.panel,
|
|
121
117
|
},
|
|
122
118
|
);
|
|
123
119
|
let shouldUseStandaloneFuseboxShell =
|
|
124
|
-
|
|
120
|
+
experiments.enableStandaloneFuseboxShell;
|
|
125
121
|
if (shouldUseStandaloneFuseboxShell) {
|
|
126
122
|
const shellPreparationResult = await shellPreparationPromise;
|
|
127
123
|
switch (shellPreparationResult.code) {
|
|
@@ -148,17 +144,14 @@ function openDebuggerMiddleware({
|
|
|
148
144
|
].join("-"),
|
|
149
145
|
)
|
|
150
146
|
.digest("hex");
|
|
151
|
-
if (!
|
|
147
|
+
if (!toolLauncher.launchDebuggerShell) {
|
|
152
148
|
throw new Error(
|
|
153
|
-
"Fusebox shell is not supported by the current
|
|
149
|
+
"Fusebox shell is not supported by the current app launcher",
|
|
154
150
|
);
|
|
155
151
|
}
|
|
156
|
-
await
|
|
157
|
-
frontendUrl,
|
|
158
|
-
windowKey,
|
|
159
|
-
);
|
|
152
|
+
await toolLauncher.launchDebuggerShell(frontendUrl, windowKey);
|
|
160
153
|
} else {
|
|
161
|
-
await
|
|
154
|
+
await toolLauncher.launchDebuggerAppWindow(frontendUrl);
|
|
162
155
|
}
|
|
163
156
|
res.writeHead(200);
|
|
164
157
|
res.end();
|
|
@@ -169,13 +162,12 @@ function openDebuggerMiddleware({
|
|
|
169
162
|
Location: (0, _getDevToolsFrontendUrl.default)(
|
|
170
163
|
experiments,
|
|
171
164
|
target.webSocketDebuggerUrl,
|
|
172
|
-
serverBaseUrl,
|
|
165
|
+
new URL(serverBaseUrl),
|
|
173
166
|
{
|
|
174
167
|
relative: true,
|
|
175
168
|
launchId: query.launchId,
|
|
176
169
|
telemetryInfo: query.telemetryInfo,
|
|
177
170
|
appId: target.appId,
|
|
178
|
-
useFuseboxEntryPoint,
|
|
179
171
|
},
|
|
180
172
|
),
|
|
181
173
|
});
|
|
@@ -192,7 +184,6 @@ function openDebuggerMiddleware({
|
|
|
192
184
|
pageId: target.id,
|
|
193
185
|
deviceName: target.deviceName,
|
|
194
186
|
targetDescription: target.description,
|
|
195
|
-
prefersFuseboxFrontend: useFuseboxEntryPoint,
|
|
196
187
|
});
|
|
197
188
|
return;
|
|
198
189
|
} catch (e) {
|
|
@@ -206,7 +197,6 @@ function openDebuggerMiddleware({
|
|
|
206
197
|
launchType,
|
|
207
198
|
status: "error",
|
|
208
199
|
error: e,
|
|
209
|
-
prefersFuseboxFrontend: useFuseboxEntryPoint,
|
|
210
200
|
});
|
|
211
201
|
return;
|
|
212
202
|
}
|
|
@@ -9,15 +9,16 @@
|
|
|
9
9
|
*/
|
|
10
10
|
|
|
11
11
|
import type { InspectorProxyQueries } from "../inspector-proxy/InspectorProxy";
|
|
12
|
-
import type {
|
|
12
|
+
import type { DevToolLauncher } from "../types/DevToolLauncher";
|
|
13
13
|
import type { EventReporter } from "../types/EventReporter";
|
|
14
14
|
import type { Experiments } from "../types/Experiments";
|
|
15
15
|
import type { Logger } from "../types/Logger";
|
|
16
|
+
import type { ReadonlyURL } from "../types/ReadonlyURL";
|
|
16
17
|
import type { NextHandleFunction } from "connect";
|
|
17
|
-
type Options =
|
|
18
|
-
serverBaseUrl:
|
|
18
|
+
type Options = Readonly<{
|
|
19
|
+
serverBaseUrl: ReadonlyURL,
|
|
19
20
|
logger?: Logger,
|
|
20
|
-
|
|
21
|
+
toolLauncher: DevToolLauncher,
|
|
21
22
|
eventReporter?: EventReporter,
|
|
22
23
|
experiments: Experiments,
|
|
23
24
|
inspectorProxy: InspectorProxyQueries,
|
|
@@ -26,9 +27,6 @@ type Options = $ReadOnly<{
|
|
|
26
27
|
/**
|
|
27
28
|
* Open the debugger frontend for a given CDP target.
|
|
28
29
|
*
|
|
29
|
-
* Currently supports React Native DevTools (rn_fusebox.html) and legacy Hermes
|
|
30
|
-
* (rn_inspector.html) targets.
|
|
31
|
-
*
|
|
32
30
|
* @see https://chromedevtools.github.io/devtools-protocol/
|
|
33
31
|
*/
|
|
34
32
|
declare export default function openDebuggerMiddleware(
|
|
@@ -4,30 +4,28 @@
|
|
|
4
4
|
* This source code is licensed under the MIT license found in the
|
|
5
5
|
* LICENSE file in the root directory of this source tree.
|
|
6
6
|
*
|
|
7
|
-
*
|
|
7
|
+
*
|
|
8
8
|
* @format
|
|
9
9
|
*/
|
|
10
10
|
|
|
11
11
|
import type { DebuggerShellPreparationResult } from "@react-native/debugger-shell";
|
|
12
|
-
|
|
13
12
|
export type { DebuggerShellPreparationResult };
|
|
14
|
-
|
|
15
13
|
/**
|
|
16
14
|
* An interface for integrators to provide a custom implementation for
|
|
17
|
-
*
|
|
15
|
+
* launching external applications on the host machine (or target dev machine).
|
|
16
|
+
*
|
|
17
|
+
* This is an unstable API with no semver guarantees.
|
|
18
18
|
*/
|
|
19
|
-
export interface
|
|
19
|
+
export interface DevToolLauncher {
|
|
20
20
|
/**
|
|
21
|
-
* Attempt to open a debugger frontend URL in a browser app window
|
|
22
|
-
*
|
|
23
|
-
* The browser used should be capable of running Chrome DevTools.
|
|
21
|
+
* Attempt to open a debugger frontend URL in a browser app window. The
|
|
22
|
+
* browser used should be capable of running Chrome DevTools.
|
|
24
23
|
*
|
|
25
24
|
* The provided URL is based on serverBaseUrl, and therefore reachable from
|
|
26
25
|
* the host of dev-middleware. Implementations are responsible for rewriting
|
|
27
26
|
* this as necessary where the server is remote.
|
|
28
27
|
*/
|
|
29
|
-
launchDebuggerAppWindow: (url: string) => Promise<void>;
|
|
30
|
-
|
|
28
|
+
readonly launchDebuggerAppWindow: (url: string) => Promise<void>;
|
|
31
29
|
/**
|
|
32
30
|
* Attempt to open a debugger frontend URL in a standalone shell window
|
|
33
31
|
* designed specifically for React Native DevTools. The provided windowKey
|
|
@@ -46,11 +44,10 @@ export interface BrowserLauncher {
|
|
|
46
44
|
* the host of dev-middleware. Implementations are responsible for rewriting
|
|
47
45
|
* this as necessary where the server is remote.
|
|
48
46
|
*/
|
|
49
|
-
|
|
47
|
+
readonly launchDebuggerShell?: (
|
|
50
48
|
url: string,
|
|
51
49
|
windowKey: string,
|
|
52
50
|
) => Promise<void>;
|
|
53
|
-
|
|
54
51
|
/**
|
|
55
52
|
* Attempt to prepare the debugger shell for use and returns a coded result
|
|
56
53
|
* that can be used to advise the user on how to proceed in case of failure.
|
|
@@ -62,5 +59,5 @@ export interface BrowserLauncher {
|
|
|
62
59
|
* SHOULD NOT return a rejecting promise in any case, and instead SHOULD report
|
|
63
60
|
* errors via the returned result object.
|
|
64
61
|
*/
|
|
65
|
-
|
|
62
|
+
readonly prepareDebuggerShell?: () => Promise<DebuggerShellPreparationResult>;
|
|
66
63
|
}
|
|
@@ -4,27 +4,31 @@
|
|
|
4
4
|
* This source code is licensed under the MIT license found in the
|
|
5
5
|
* LICENSE file in the root directory of this source tree.
|
|
6
6
|
*
|
|
7
|
-
*
|
|
7
|
+
* @flow strict-local
|
|
8
8
|
* @format
|
|
9
9
|
*/
|
|
10
10
|
|
|
11
11
|
import type { DebuggerShellPreparationResult } from "@react-native/debugger-shell";
|
|
12
|
+
|
|
12
13
|
export type { DebuggerShellPreparationResult };
|
|
14
|
+
|
|
13
15
|
/**
|
|
14
16
|
* An interface for integrators to provide a custom implementation for
|
|
15
|
-
*
|
|
17
|
+
* launching external applications on the host machine (or target dev machine).
|
|
18
|
+
*
|
|
19
|
+
* This is an unstable API with no semver guarantees.
|
|
16
20
|
*/
|
|
17
|
-
export interface
|
|
21
|
+
export interface DevToolLauncher {
|
|
18
22
|
/**
|
|
19
|
-
* Attempt to open a debugger frontend URL in a browser app window
|
|
20
|
-
*
|
|
21
|
-
* The browser used should be capable of running Chrome DevTools.
|
|
23
|
+
* Attempt to open a debugger frontend URL in a browser app window. The
|
|
24
|
+
* browser used should be capable of running Chrome DevTools.
|
|
22
25
|
*
|
|
23
26
|
* The provided URL is based on serverBaseUrl, and therefore reachable from
|
|
24
27
|
* the host of dev-middleware. Implementations are responsible for rewriting
|
|
25
28
|
* this as necessary where the server is remote.
|
|
26
29
|
*/
|
|
27
|
-
launchDebuggerAppWindow: (url: string) => Promise<void>;
|
|
30
|
+
+launchDebuggerAppWindow: (url: string) => Promise<void>;
|
|
31
|
+
|
|
28
32
|
/**
|
|
29
33
|
* Attempt to open a debugger frontend URL in a standalone shell window
|
|
30
34
|
* designed specifically for React Native DevTools. The provided windowKey
|
|
@@ -43,10 +47,8 @@ export interface BrowserLauncher {
|
|
|
43
47
|
* the host of dev-middleware. Implementations are responsible for rewriting
|
|
44
48
|
* this as necessary where the server is remote.
|
|
45
49
|
*/
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
windowKey: string,
|
|
49
|
-
) => Promise<void>;
|
|
50
|
+
+launchDebuggerShell?: (url: string, windowKey: string) => Promise<void>;
|
|
51
|
+
|
|
50
52
|
/**
|
|
51
53
|
* Attempt to prepare the debugger shell for use and returns a coded result
|
|
52
54
|
* that can be used to advise the user on how to proceed in case of failure.
|
|
@@ -58,5 +60,5 @@ export interface BrowserLauncher {
|
|
|
58
60
|
* SHOULD NOT return a rejecting promise in any case, and instead SHOULD report
|
|
59
61
|
* errors via the returned result object.
|
|
60
62
|
*/
|
|
61
|
-
|
|
63
|
+
+prepareDebuggerShell?: () => Promise<DebuggerShellPreparationResult>;
|
|
62
64
|
}
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
* @format
|
|
9
9
|
*/
|
|
10
10
|
|
|
11
|
-
import type { DebuggerShellPreparationResult } from "./
|
|
11
|
+
import type { DebuggerShellPreparationResult } from "./DevToolLauncher";
|
|
12
12
|
type SuccessResult<Props extends {} | void = {}> =
|
|
13
13
|
/**
|
|
14
14
|
* > 15 | ...Props,
|
|
@@ -17,7 +17,7 @@ type SuccessResult<Props extends {} | void = {}> =
|
|
|
17
17
|
any;
|
|
18
18
|
type ErrorResult<ErrorT = unknown, Props extends {} | void = {}> =
|
|
19
19
|
/**
|
|
20
|
-
* >
|
|
20
|
+
* > 21 | ...Props,
|
|
21
21
|
* | ^^^^^^^^ Unsupported feature: Translating "object types with spreads in the middle or at the end" is currently not supported.
|
|
22
22
|
**/
|
|
23
23
|
any;
|
|
@@ -35,77 +35,74 @@ export type DebuggerSessionIDs = {
|
|
|
35
35
|
export type ConnectionUptime = { connectionUptime: number };
|
|
36
36
|
export type ReportableEvent =
|
|
37
37
|
| /**
|
|
38
|
-
* >
|
|
38
|
+
* > 45 | ...
|
|
39
39
|
* | ^^^
|
|
40
|
-
* >
|
|
40
|
+
* > 46 | | SuccessResult<{
|
|
41
41
|
* | ^^^^^^^^^^^^^^^^^^^^^^^^^
|
|
42
|
-
* >
|
|
42
|
+
* > 47 | targetDescription: string,
|
|
43
43
|
* | ^^^^^^^^^^^^^^^^^^^^^^^^^
|
|
44
|
-
* >
|
|
44
|
+
* > 48 | ...DebuggerSessionIDs,
|
|
45
45
|
* | ^^^^^^^^^^^^^^^^^^^^^^^^^
|
|
46
|
-
* >
|
|
46
|
+
* > 49 | }>
|
|
47
47
|
* | ^^^^^^^^^^^^^^^^^^^^^^^^^
|
|
48
|
-
* >
|
|
48
|
+
* > 50 | | ErrorResult<unknown>
|
|
49
49
|
* | ^^^^^^^^^^^^^^^^^^^^^^^^^
|
|
50
|
-
* >
|
|
51
|
-
* | ^^^^^^^^^^^^^^^^^^^^^^^^^
|
|
52
|
-
* > 53 | | CodedErrorResult<"NO_APPS_FOUND">,
|
|
50
|
+
* > 51 | | CodedErrorResult<"NO_APPS_FOUND">,
|
|
53
51
|
* | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Unsupported feature: Translating "object types with spreads in the middle or at the end" is currently not supported.
|
|
54
52
|
**/
|
|
55
53
|
any
|
|
56
54
|
| /**
|
|
57
|
-
* >
|
|
55
|
+
* > 55 | ...
|
|
58
56
|
* | ^^^
|
|
59
|
-
* >
|
|
57
|
+
* > 56 | | SuccessResult<{
|
|
60
58
|
* | ^^^^^^^^^^^^^^^^^^^^^^^^^
|
|
61
|
-
* >
|
|
59
|
+
* > 57 | ...DebuggerSessionIDs,
|
|
62
60
|
* | ^^^^^^^^^^^^^^^^^^^^^^^^^
|
|
63
|
-
* >
|
|
61
|
+
* > 58 | frontendUserAgent: string | null,
|
|
64
62
|
* | ^^^^^^^^^^^^^^^^^^^^^^^^^
|
|
65
|
-
* >
|
|
63
|
+
* > 59 | }>
|
|
66
64
|
* | ^^^^^^^^^^^^^^^^^^^^^^^^^
|
|
67
|
-
* >
|
|
65
|
+
* > 60 | | ErrorResult<unknown, DebuggerSessionIDs>,
|
|
68
66
|
* | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Unsupported feature: Translating "object types with spreads in the middle or at the end" is currently not supported.
|
|
69
67
|
**/
|
|
70
68
|
any
|
|
71
69
|
| /**
|
|
72
|
-
* >
|
|
70
|
+
* > 70 | ...DebuggerSessionIDs,
|
|
73
71
|
* | ^^^^^^^^^^^^^^^^^^^^^ Unsupported feature: Translating "object types with spreads in the middle or at the end" is currently not supported.
|
|
74
72
|
**/
|
|
75
73
|
any
|
|
76
74
|
| /**
|
|
77
|
-
* >
|
|
75
|
+
* > 86 | ...DebuggerSessionIDs,
|
|
78
76
|
* | ^^^^^^^^^^^^^^^^^^^^^ Unsupported feature: Translating "object types with spreads in the middle or at the end" is currently not supported.
|
|
79
77
|
**/
|
|
80
78
|
any
|
|
81
|
-
| { type: "fusebox_console_notice" }
|
|
82
79
|
| /**
|
|
83
|
-
* >
|
|
80
|
+
* > 90 | ...DebuggerSessionIDs,
|
|
84
81
|
* | ^^^^^^^^^^^^^^^^^^^^^ Unsupported feature: Translating "object types with spreads in the middle or at the end" is currently not supported.
|
|
85
82
|
**/
|
|
86
83
|
any
|
|
87
84
|
| /**
|
|
88
|
-
* >
|
|
89
|
-
*
|
|
85
|
+
* > 99 | ...ConnectionUptime,
|
|
86
|
+
* | ^^^^^^^^^^^^^^^^^^^ Unsupported feature: Translating "object types with spreads in the middle or at the end" is currently not supported.
|
|
90
87
|
**/
|
|
91
88
|
any
|
|
92
89
|
| /**
|
|
93
|
-
* >
|
|
90
|
+
* > 106 | ...ConnectionUptime,
|
|
94
91
|
* | ^^^^^^^^^^^^^^^^^^^ Unsupported feature: Translating "object types with spreads in the middle or at the end" is currently not supported.
|
|
95
92
|
**/
|
|
96
93
|
any
|
|
97
94
|
| /**
|
|
98
|
-
* >
|
|
95
|
+
* > 113 | ...ConnectionUptime,
|
|
99
96
|
* | ^^^^^^^^^^^^^^^^^^^ Unsupported feature: Translating "object types with spreads in the middle or at the end" is currently not supported.
|
|
100
97
|
**/
|
|
101
98
|
any
|
|
102
99
|
| /**
|
|
103
|
-
* >
|
|
100
|
+
* > 121 | ...ConnectionUptime,
|
|
104
101
|
* | ^^^^^^^^^^^^^^^^^^^ Unsupported feature: Translating "object types with spreads in the middle or at the end" is currently not supported.
|
|
105
102
|
**/
|
|
106
103
|
any
|
|
107
104
|
| /**
|
|
108
|
-
* >
|
|
105
|
+
* > 129 | ...ConnectionUptime,
|
|
109
106
|
* | ^^^^^^^^^^^^^^^^^^^ Unsupported feature: Translating "object types with spreads in the middle or at the end" is currently not supported.
|
|
110
107
|
**/
|
|
111
108
|
any
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
* @format
|
|
9
9
|
*/
|
|
10
10
|
|
|
11
|
-
import type { DebuggerShellPreparationResult } from "./
|
|
11
|
+
import type { DebuggerShellPreparationResult } from "./DevToolLauncher";
|
|
12
12
|
|
|
13
13
|
type SuccessResult<Props: { ... } | void = {}> = {
|
|
14
14
|
status: "success",
|
|
@@ -18,7 +18,6 @@ type SuccessResult<Props: { ... } | void = {}> = {
|
|
|
18
18
|
type ErrorResult<ErrorT = unknown, Props: { ... } | void = {}> = {
|
|
19
19
|
status: "error",
|
|
20
20
|
error: ErrorT,
|
|
21
|
-
prefersFuseboxFrontend?: ?boolean,
|
|
22
21
|
...Props,
|
|
23
22
|
};
|
|
24
23
|
|
|
@@ -46,7 +45,6 @@ export type ReportableEvent =
|
|
|
46
45
|
...
|
|
47
46
|
| SuccessResult<{
|
|
48
47
|
targetDescription: string,
|
|
49
|
-
prefersFuseboxFrontend: boolean,
|
|
50
48
|
...DebuggerSessionIDs,
|
|
51
49
|
}>
|
|
52
50
|
| ErrorResult<unknown>
|
|
@@ -72,7 +70,6 @@ export type ReportableEvent =
|
|
|
72
70
|
...DebuggerSessionIDs,
|
|
73
71
|
...ConnectionUptime,
|
|
74
72
|
frontendUserAgent: string | null,
|
|
75
|
-
prefersFuseboxFrontend: boolean | null,
|
|
76
73
|
...
|
|
77
74
|
| SuccessResult<void>
|
|
78
75
|
| CodedErrorResult<
|
|
@@ -88,9 +85,6 @@ export type ReportableEvent =
|
|
|
88
85
|
status: "success",
|
|
89
86
|
...DebuggerSessionIDs,
|
|
90
87
|
}
|
|
91
|
-
| {
|
|
92
|
-
type: "fusebox_console_notice",
|
|
93
|
-
}
|
|
94
88
|
| {
|
|
95
89
|
type: "no_debug_pages_for_device",
|
|
96
90
|
...DebuggerSessionIDs,
|