Skip to content

Commit

Permalink
Inspector proxy: Add reactNative.openDebuggerPath to json/list resp…
Browse files Browse the repository at this point in the history
…onses

Summary:
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 4273571 commit e83376b
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 0 deletions.
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?appId=bar-app&device=device1',
},
title: 'bar-title',
type: 'node',
Expand All @@ -205,6 +206,7 @@ describe('inspector proxy HTTP API', () => {
reactNative: {
capabilities: {},
logicalDeviceId: 'device2',
openDebuggerPath: '/open-debugger?appId=bar-app&device=device2',
},
title: 'bar-title',
type: 'node',
Expand Down
3 changes: 3 additions & 0 deletions packages/dev-middleware/src/inspector-proxy/InspectorProxy.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ import type {Timeout} from 'timers';

import Device from './Device';
import nullthrows from 'nullthrows';
import qs from 'querystring';
// Import these from node:timers to get the correct Flow types.
// $FlowFixMe[cannot-resolve-module] libdef missing in RN OSS
import {clearTimeout, setTimeout} from 'timers';
Expand Down Expand Up @@ -169,6 +170,8 @@ export default class InspectorProxy implements InspectorProxyQueries {
reactNative: {
logicalDeviceId: deviceId,
capabilities: nullthrows(page.capabilities),
openDebuggerPath:
'/open-debugger?' + qs.stringify({appId: page.app, device: deviceId}),
},
};
}
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 e83376b

Please sign in to comment.