diff --git a/desktop/flipper-plugin/src/__tests__/api.node.tsx b/desktop/flipper-plugin/src/__tests__/api.node.tsx index bf03a3c5b..f10f2ba0a 100644 --- a/desktop/flipper-plugin/src/__tests__/api.node.tsx +++ b/desktop/flipper-plugin/src/__tests__/api.node.tsx @@ -112,7 +112,7 @@ test('Correct top level API exposed', () => { "NormalizedMenuEntry", "Notification", "PluginClient", - "RemoteNodeAPI", + "RemoteServerContext", ] `); }); diff --git a/desktop/flipper-plugin/src/index.ts b/desktop/flipper-plugin/src/index.ts index d8a083d36..956bf0321 100644 --- a/desktop/flipper-plugin/src/index.ts +++ b/desktop/flipper-plugin/src/index.ts @@ -39,7 +39,7 @@ export { setFlipperLibImplementation as _setFlipperLibImplementation, FileDescriptor, FileEncoding, - RemoteNodeAPI, + RemoteServerContext, } from './plugin/FlipperLib'; export { MenuEntry, diff --git a/desktop/flipper-plugin/src/plugin/FlipperLib.tsx b/desktop/flipper-plugin/src/plugin/FlipperLib.tsx index fde710068..f73bd914a 100644 --- a/desktop/flipper-plugin/src/plugin/FlipperLib.tsx +++ b/desktop/flipper-plugin/src/plugin/FlipperLib.tsx @@ -28,7 +28,7 @@ export interface FileDescriptor { path?: string; } -export type RemoteNodeAPI = { +export type RemoteServerContext = { childProcess: { exec( command: string, @@ -134,7 +134,7 @@ export interface FlipperLib { homePath: string; appPath: string; }; - removeNodeAPI: RemoteNodeAPI; + remoteServerContext: RemoteServerContext; } export let flipperLibInstance: FlipperLib | undefined; diff --git a/desktop/flipper-plugin/src/test-utils/test-utils.tsx b/desktop/flipper-plugin/src/test-utils/test-utils.tsx index 68f01d3af..f7a1c3b81 100644 --- a/desktop/flipper-plugin/src/test-utils/test-utils.tsx +++ b/desktop/flipper-plugin/src/test-utils/test-utils.tsx @@ -389,7 +389,7 @@ export function createMockFlipperLib(options?: StartPluginOptions): FlipperLib { appPath: process.cwd(), homePath: `/dev/null`, }, - removeNodeAPI: { + remoteServerContext: { childProcess: { exec: jest.fn(), }, diff --git a/desktop/flipper-ui-core/src/utils/flipperLibImplementation.tsx b/desktop/flipper-ui-core/src/utils/flipperLibImplementation.tsx index de79f2bb8..d1b87e9f3 100644 --- a/desktop/flipper-ui-core/src/utils/flipperLibImplementation.tsx +++ b/desktop/flipper-ui-core/src/utils/flipperLibImplementation.tsx @@ -7,7 +7,10 @@ * @format */ -import {_setFlipperLibImplementation, RemoteNodeAPI} from 'flipper-plugin'; +import { + _setFlipperLibImplementation, + RemoteServerContext, +} from 'flipper-plugin'; import type { BufferEncoding, ExecOptions, @@ -68,17 +71,12 @@ export function initializeFlipperLibImplementation( appPath: renderHost.serverConfig.paths.appPath, homePath: renderHost.serverConfig.paths.homePath, }, - removeNodeAPI: { + remoteServerContext: { childProcess: { - exec: (async ( + exec: async ( command: string, options?: ExecOptions & {encoding?: BufferEncoding}, - ) => - renderHost.flipperServer.exec( - 'node-api-exec', - command, - options, - )) as RemoteNodeAPI['childProcess']['exec'], + ) => renderHost.flipperServer.exec('node-api-exec', command, options), }, fs: { access: async (path: string, mode?: number) => @@ -95,7 +93,7 @@ export function initializeFlipperLibImplementation( 'node-api-fs-mkdir', path, options, - )) as RemoteNodeAPI['fs']['mkdir'], + )) as RemoteServerContext['fs']['mkdir'], copyFile: async (src: string, dest: string, flags?: number) => renderHost.flipperServer.exec( 'node-api-fs-copyFile', diff --git a/desktop/plugins/public/kaios-allocations/index.tsx b/desktop/plugins/public/kaios-allocations/index.tsx index c612edaf2..291e760ea 100644 --- a/desktop/plugins/public/kaios-allocations/index.tsx +++ b/desktop/plugins/public/kaios-allocations/index.tsx @@ -262,7 +262,7 @@ export default class AllocationsPlugin extends FlipperDevicePlugin< } async init() { - await getFlipperLib().removeNodeAPI.childProcess.exec( + await getFlipperLib().remoteServerContext.childProcess.exec( 'adb forward tcp:6000 localfilesystem:/data/local/debugger-socket', ); await this.connectToDebugApi(); diff --git a/desktop/plugins/public/kaios-ram/index.tsx b/desktop/plugins/public/kaios-ram/index.tsx index 31670bb3d..a4c1b4b8c 100644 --- a/desktop/plugins/public/kaios-ram/index.tsx +++ b/desktop/plugins/public/kaios-ram/index.tsx @@ -81,7 +81,7 @@ export default class KaiOSGraphs extends FlipperDevicePlugin { async init() { try { - await getFlipperLib().removeNodeAPI.childProcess.exec('adb root'); + await getFlipperLib().remoteServerContext.childProcess.exec('adb root'); } catch (e) { console.error('Error obtaining root on the device', e); } diff --git a/desktop/plugins/public/reactdevtools/index.tsx b/desktop/plugins/public/reactdevtools/index.tsx index 511a55793..b0d4ec6cb 100644 --- a/desktop/plugins/public/reactdevtools/index.tsx +++ b/desktop/plugins/public/reactdevtools/index.tsx @@ -33,7 +33,9 @@ const DEV_TOOLS_PORT = 8097; // hardcoded in RN async function findGlobalDevTools(): Promise { try { const {stdout: basePath} = - await getFlipperLib().removeNodeAPI.childProcess.exec('npm root -g'); + await getFlipperLib().remoteServerContext.childProcess.exec( + 'npm root -g', + ); const devToolsPath = path.join( basePath.trim(), 'react-devtools',