Load bundled server add-ons

Reviewed By: antonk52

Differential Revision: D34238883

fbshipit-source-id: 01b4b1c1c0a63cbfb639e903f6a77307ae370330
This commit is contained in:
Andrey Goncharov
2022-02-28 03:50:34 -08:00
committed by Facebook GitHub Bot
parent b655efc78e
commit 2ce037d96b
3 changed files with 26 additions and 19 deletions

View File

@@ -16,13 +16,22 @@ import {
} from 'flipper-common';
import {ServerAddOnDesktopToModuleConnection} from './ServerAddOnDesktopToModuleConnection';
import {ServerAddOnModuleToDesktopConnection} from './ServerAddOnModuleToDesktopConnection';
// @ts-ignore
import defaultPlugins from '../defaultPlugins';
interface ServerAddOnModule {
default?: ServerAddOnFn;
default: ServerAddOnFn;
}
const loadPlugin = (_pluginName: string): ServerAddOnModule => {
// TODO: Implement me
const loadPlugin = (pluginName: string): ServerAddOnModule => {
console.debug('loadPlugin', pluginName);
const bundledPlugin = defaultPlugins[pluginName];
if (bundledPlugin) {
return bundledPlugin;
}
// TODO: Use getInstalledPlugin
return {default: async () => async () => {}};
};
@@ -51,7 +60,7 @@ export class ServerAddOn {
assertNotNull(serverAddOn);
assert(
typeof serverAddOn === 'function',
`ServerAddOn ${pluginName} must export "serverAddOn" function.`,
`ServerAddOn ${pluginName} must export "serverAddOn" function as a default export.`,
);
const serverAddOnModuleToDesktopConnection =