Reviewed By: bhamodi Differential Revision: D33331422 fbshipit-source-id: 016e8dcc0c0c7f1fc353a348b54fda0d5e2ddc01
26 lines
732 B
TypeScript
26 lines
732 B
TypeScript
/**
|
|
* 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.
|
|
*
|
|
* @format
|
|
*/
|
|
|
|
import {PluginDetails} from 'flipper-common';
|
|
import semver from 'semver';
|
|
import {getRenderHostInstance} from '../RenderHost';
|
|
import {getAppVersion} from './info';
|
|
|
|
export function isPluginCompatible(plugin: PluginDetails) {
|
|
const flipperVersion = getAppVersion();
|
|
return (
|
|
getRenderHostInstance().GK('flipper_disable_plugin_compatibility_checks') ||
|
|
flipperVersion === '0.0.0' ||
|
|
!plugin.engines?.flipper ||
|
|
semver.lte(plugin.engines?.flipper, flipperVersion)
|
|
);
|
|
}
|
|
|
|
export default isPluginCompatible;
|