mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
a991ff3837
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
32 lines
733 B
JavaScript
32 lines
733 B
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 {NextHandleFunction} from 'connect';
|
|
import type {Logger} from './types/Logger';
|
|
|
|
import connect from 'connect';
|
|
import openDebuggerMiddleware from './middleware/openDebuggerMiddleware';
|
|
|
|
type Options = $ReadOnly<{
|
|
logger?: Logger,
|
|
}>;
|
|
|
|
export default function createDevMiddleware({logger}: Options = {}): {
|
|
middleware: NextHandleFunction,
|
|
} {
|
|
const middleware = connect().use(
|
|
'/open-debugger',
|
|
openDebuggerMiddleware({logger}),
|
|
);
|
|
|
|
return {middleware};
|
|
}
|