Skip to content

Commit

Permalink
Inspector: Add reactNative.openDebuggerPath to json/list responses (#…
Browse files Browse the repository at this point in the history
…45136)

Summary:
Pull Request resolved: #45136

Adds a URL path (`/open-debugger?some-query-params`) for each of the debug targets listed by `/list/json` that may be used to trigger opening the debugger frontend via a POST to the inspector server.

Changelog:
[General][Added] Inspector: Add reactNative.openDebuggerPath to /json/list responses

Differential Revision: D58949662
  • Loading branch information
robhogan authored and facebook-github-bot committed Jun 24, 2024
1 parent 6e01fa4 commit 15041b1
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,7 @@ describe('inspector proxy HTTP API', () => {
reactNative: {
capabilities: {},
logicalDeviceId: 'device1',
openDebuggerPath: '/open-debugger?target=device1-page1',
},
title: 'bar-title',
type: 'node',
Expand All @@ -205,6 +206,7 @@ describe('inspector proxy HTTP API', () => {
reactNative: {
capabilities: {},
logicalDeviceId: 'device2',
openDebuggerPath: '/open-debugger?target=device1-page1',
},
title: 'bar-title',
type: 'node',
Expand Down
1 change: 1 addition & 0 deletions packages/dev-middleware/src/index.flow.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,4 @@ export type {
CustomMessageHandlerConnection,
CreateCustomMessageHandlerFn,
} from './inspector-proxy/CustomMessageHandler';
export type {PageDescription} from './inspector-proxy/types';
Original file line number Diff line number Diff line change
Expand Up @@ -157,8 +157,10 @@ export default class InspectorProxy implements InspectorProxyQueries {
`devtools://devtools/bundled/js_app.html?experiments=true&v8only=true&${webSocketScheme}=` +
encodeURIComponent(webSocketUrlWithoutProtocol);

const id = `${deviceId}-${page.id}`;

return {
id: `${deviceId}-${page.id}`,
id,
title: page.title,
description: page.app,
type: 'node',
Expand All @@ -169,6 +171,7 @@ export default class InspectorProxy implements InspectorProxyQueries {
reactNative: {
logicalDeviceId: deviceId,
capabilities: nullthrows(page.capabilities),
openDebuggerPath: '/open-debugger?target=' + encodeURIComponent(id),
},
};
}
Expand Down
1 change: 1 addition & 0 deletions packages/dev-middleware/src/inspector-proxy/types.js
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,7 @@ export type PageDescription = $ReadOnly<{
reactNative: $ReadOnly<{
logicalDeviceId: string,
capabilities: Page['capabilities'],
openDebuggerPath: string,
}>,
}>;

Expand Down

0 comments on commit 15041b1

Please sign in to comment.