mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
Summary: Pull Request resolved: https://github.com/facebook/react-native/pull/38194 ## Context RFC: Decoupling Flipper from React Native core: https://github.com/react-native-community/discussions-and-proposals/pull/641 ## Changes Inits the `react-native/dev-middleware` package. Contains an initial implementation of `/open-debugger`, migrated from https://github.com/react-native-community/cli/commit/2535dbe2346a390b2c5034acf0b348347fce0b73. ## Attribution This implementation is greatly inspired by `expo/dev-server`: https://github.com/expo/expo/blob/1120c716f35cb28d88800e8f5d963d2b2ac94705/packages/%40expo/dev-server/src/JsInspector.ts#L18 Changelog: [Internal] Reviewed By: motiz88 Differential Revision: D46283818 fbshipit-source-id: 7b38ad2f6d7346366a7c599d16e289e04b7bd88d
39 lines
1.2 KiB
JavaScript
39 lines
1.2 KiB
JavaScript
/**
|
|
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
*
|
|
* This source code is licensed under the MIT license found in the
|
|
* LICENSE file in the root directory of this source tree.
|
|
*
|
|
* @flow strict
|
|
* @format
|
|
* @oncall react_native
|
|
*/
|
|
|
|
import type {LaunchedChrome} from 'chrome-launcher';
|
|
|
|
import launchDebuggerAppWindow from './launchDebuggerAppWindow';
|
|
|
|
/**
|
|
* The Chrome DevTools frontend revision to use. This should be set to the
|
|
* latest version known to be compatible with Hermes.
|
|
*
|
|
* Revision should be the full identifier from:
|
|
* https://chromium.googlesource.com/chromium/src.git
|
|
*/
|
|
const DEVTOOLS_FRONTEND_REV = 'd9568d04d7dd79269c5a655d7ada69650c5a8336'; // Chrome 100.0.4896.75
|
|
|
|
/**
|
|
* Attempt to launch Chrome DevTools on the host machine for a given CDP target.
|
|
*/
|
|
export default async function launchChromeDevTools(
|
|
webSocketDebuggerUrl: string,
|
|
): Promise<LaunchedChrome> {
|
|
const urlBase = `https://chrome-devtools-frontend.appspot.com/serve_rev/@${DEVTOOLS_FRONTEND_REV}/devtools_app.html`;
|
|
const ws = webSocketDebuggerUrl.replace(/^ws:\/\//, '');
|
|
|
|
return launchDebuggerAppWindow(
|
|
`${urlBase}?panel=console&ws=${encodeURIComponent(ws)}`,
|
|
'open-debugger',
|
|
);
|
|
}
|