Differentiate Flipper in logging from standalone app

Summary:
This commit makes it so when we load DevTools from within Flipper we log it as a Flipper load and not a regular standalone app load.

Note that the logging only applies internally.

Reviewed By: bvaughn

Differential Revision: D32884616

fbshipit-source-id: 90d0962bac9c1abdde36a70fd361251d7e607b57
This commit is contained in:
Juan Tejada
2021-12-06 12:40:16 -08:00
committed by Facebook GitHub Bot
parent f9547e024e
commit 4a93224151
2 changed files with 18 additions and 2 deletions

View File

@@ -237,7 +237,9 @@ export function devicePlugin(client: DevicePluginClient) {
// TODO: since devToolsInstance is an instance, we are probably leaking memory here
setStatus(ConnectionStatus.Initializing, status);
})
.startServer(DEV_TOOLS_PORT) as any;
.startServer(DEV_TOOLS_PORT, 'localhost', undefined, {
surface: 'flipper',
});
setStatus(ConnectionStatus.Initializing, 'Waiting for device...');
} catch (e) {
console.error('Failed to initalize React DevTools' + e);

View File

@@ -7,10 +7,24 @@
* @format
*/
type ServerOptions = {
key?: string;
cert?: string;
};
type LoggerOptions = {
surface?: string;
};
declare module 'react-devtools-core/standalone' {
interface DevTools {
setContentDOMNode(node: HTMLElement): this;
startServer(port: number): this;
startServer(
port?: number,
host?: string,
httpsOptions?: ServerOptions,
loggerOptions?: LoggerOptions,
): {close: () => void};
setStatusListener(listener: (message: string) => void): this;
}
const DevTools: DevTools;