UNPKG

@react-native/dev-middleware

Version:
64 lines (58 loc) 2 kB
/** * 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-local * @format */ import type { EventReporter } from "../types/EventReporter"; import type { Experiments } from "../types/Experiments"; import type { Logger } from "../types/Logger"; import type { CreateCustomMessageHandlerFn } from "./CustomMessageHandler"; import type { PageDescription } from "./types"; import type { IncomingMessage, ServerResponse } from "http"; import WS from "ws"; export type GetPageDescriptionsConfig = { requestorRelativeBaseUrl: URL, logNoPagesForConnectedDevice?: boolean, }; export interface InspectorProxyQueries { /** * Returns list of page descriptions ordered by device connection order, then * page addition order. */ getPageDescriptions( config: GetPageDescriptionsConfig ): Array<PageDescription>; } /** * Main Inspector Proxy class that connects JavaScript VM inside Android/iOS apps and JS debugger. */ declare export default class InspectorProxy implements InspectorProxyQueries { constructor( projectRoot: string, serverBaseUrl: string, eventReporter: ?EventReporter, experiments: Experiments, logger?: Logger, customMessageHandler: ?CreateCustomMessageHandlerFn, trackEventLoopPerf?: boolean ): void; getPageDescriptions( $$PARAM_0$$: GetPageDescriptionsConfig ): Array<PageDescription>; // Process HTTP request sent to server. We only respond to 2 HTTP requests: // 1. /json/version returns Chrome debugger protocol version that we use // 2. /json and /json/list returns list of page descriptions (list of inspectable apps). // This list is combined from all the connected devices. processRequest( request: IncomingMessage, response: ServerResponse, next: (?Error) => mixed ): void; createWebSocketListeners(): { [path: string]: WS.Server, }; }