Option to load only specific plugins in dev mode
Summary: Currently we load all the plugins even if they are not required in dev mode, e.g. when you are developing a specific plugin. This diff adds an env var and command-line option to specify exact list of plugins to load. This makes dev mode startup faster and consume less memory. Reviewed By: passy Differential Revision: D24394146 fbshipit-source-id: 42a78c1ffb2632e657c2411e34e9c80fff18df3a
This commit is contained in:
committed by
Facebook GitHub Bot
parent
966d748ace
commit
2d9cf5a905
@@ -158,21 +158,34 @@ export const checkGK = (gatekeepedPlugins: Array<PluginDetails>) => (
|
||||
return result;
|
||||
};
|
||||
|
||||
export const checkDisabled = (disabledPlugins: Array<PluginDetails>) => (
|
||||
plugin: PluginDetails,
|
||||
): boolean => {
|
||||
export const checkDisabled = (disabledPlugins: Array<PluginDetails>) => {
|
||||
const enabledList = process.env.FLIPPER_ENABLED_PLUGINS
|
||||
? new Set<string>(process.env.FLIPPER_ENABLED_PLUGINS.split(','))
|
||||
: null;
|
||||
let disabledList: Set<string> = new Set();
|
||||
try {
|
||||
disabledList = config().disabledPlugins;
|
||||
} catch (e) {
|
||||
console.error(e);
|
||||
}
|
||||
|
||||
if (disabledList.has(plugin.name)) {
|
||||
disabledPlugins.push(plugin);
|
||||
}
|
||||
|
||||
return !disabledList.has(plugin.name);
|
||||
return (plugin: PluginDetails): boolean => {
|
||||
if (disabledList.has(plugin.name)) {
|
||||
disabledPlugins.push(plugin);
|
||||
return false;
|
||||
}
|
||||
if (
|
||||
enabledList &&
|
||||
!(
|
||||
enabledList.has(plugin.name) ||
|
||||
enabledList.has(plugin.id) ||
|
||||
enabledList.has(plugin.name.replace('flipper-plugin-', ''))
|
||||
)
|
||||
) {
|
||||
disabledPlugins.push(plugin);
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
};
|
||||
};
|
||||
|
||||
export const createRequirePluginFunction = (
|
||||
|
||||
Reference in New Issue
Block a user