Split flipper-plugin package
Summary: flipper-server-companion depends on flipper-plugin. flipper-plugin includes dependencies that run only in a browser. Splitting flipper-plugin into core and browser packages helps to avoid including browser-only dependencies into flipper-server bundle. As a result, bundle size could be cut in half. Subsequently, RSS usage drops as there is twice as less code to process for V8. Note: it currently breaks external flipper-data-source package. It will be restored in subsequent diffs Reviewed By: lblasa Differential Revision: D38658285 fbshipit-source-id: 751b11fa9f3a2d938ce166687b8310ba8b059dee
This commit is contained in:
committed by
Facebook GitHub Bot
parent
2090120cda
commit
97b8b8a1c4
@@ -30,7 +30,7 @@ import {
|
||||
_SandyPluginInstance,
|
||||
getFlipperLib,
|
||||
_SandyPluginDefinition,
|
||||
} from 'flipper-plugin';
|
||||
} from 'flipper-plugin-core';
|
||||
import {createServerAddOnControls} from './utils/createServerAddOnControls';
|
||||
import isProduction from './utils/isProduction';
|
||||
|
||||
@@ -135,17 +135,23 @@ export default abstract class AbstractClient extends EventEmitter {
|
||||
initialState?: Record<string, any>,
|
||||
) {
|
||||
try {
|
||||
this.sandyPluginStates.set(
|
||||
plugin.id,
|
||||
new _SandyPluginInstance(
|
||||
this.serverAddOnControls,
|
||||
getFlipperLib(),
|
||||
plugin,
|
||||
this,
|
||||
getPluginKey(this.id, {serial: this.query.device_id}, plugin.id),
|
||||
initialState,
|
||||
),
|
||||
const pluginInstance = new _SandyPluginInstance(
|
||||
this.serverAddOnControls,
|
||||
getFlipperLib(),
|
||||
plugin,
|
||||
this,
|
||||
getPluginKey(this.id, {serial: this.query.device_id}, plugin.id),
|
||||
initialState,
|
||||
);
|
||||
pluginInstance.events.on('error', (message) => {
|
||||
const error: ClientErrorType = {
|
||||
message,
|
||||
name: 'Plugin Error',
|
||||
stacktrace: '',
|
||||
};
|
||||
this.emit('error', error);
|
||||
});
|
||||
this.sandyPluginStates.set(plugin.id, pluginInstance);
|
||||
} catch (e) {
|
||||
console.error(`Failed to start plugin '${plugin.id}': `, e);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user