Move flipper plugin from flipper-lib types to flipper-common

Summary: Moved all types related to plugin descriptions from plugin-lib (which handles downloads and such) to flipper-common. The goal of that is to remove all plugin-lib usage from ui-core to server-core, so that the UI itself doesn't do any file operations anymore related to plugins. That will be done in next diffs, this just moves types but no code.

Reviewed By: nikoant, aigoncharov

Differential Revision: D32665064

fbshipit-source-id: 86d908e7264569b0229b09290a891171876c8e00
This commit is contained in:
Michel Weststrate
2021-12-08 04:25:28 -08:00
committed by Facebook GitHub Bot
parent 2bf8ae2364
commit e7f841b6d2
46 changed files with 72 additions and 72 deletions

View File

@@ -9,9 +9,7 @@
"license": "MIT",
"bugs": "https://github.com/facebook/flipper/issues",
"dependencies": {},
"devDependencies": {
"flipper-plugin-lib": "0.0.0"
},
"devDependencies": {},
"peerDependencies": {},
"scripts": {
"reset": "rimraf lib *.tsbuildinfo",

View File

@@ -0,0 +1,101 @@
/**
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
* @format
*/
export interface PluginDetails {
name: string;
specVersion: number;
version: string;
source: string;
main: string;
id: string;
gatekeeper?: string;
title: string;
icon?: string;
description?: string;
category?: string;
engines?: {
[name: string]: string;
};
bugs?: {
email?: string;
url?: string;
};
flipperSDKVersion?: string;
pluginType?: PluginType;
supportedDevices?: SupportedDevice[];
supportedApps?: SupportedApp[];
publishedDocs?: {
overview?: boolean;
setup?: boolean;
};
}
export interface SupportedDevice {
readonly os?: OS;
readonly type?: DeviceType;
readonly archived?: boolean;
readonly specs?: DeviceSpec[];
}
export interface SupportedApp {
readonly appID?: string;
readonly os?: OS;
readonly type?: DeviceType;
}
export type OS =
| 'iOS'
| 'Android'
| 'Metro'
| 'Windows'
| 'MacOS'
| 'Browser'
| 'Linux';
export type DeviceType = 'emulator' | 'physical' | 'dummy';
export type PluginType = 'client' | 'device';
export type DeviceSpec = 'KaiOS';
export interface ConcretePluginDetails extends PluginDetails {
// Determines whether the plugin is a part of the Flipper JS bundle.
isBundled: boolean;
// Determines whether the plugin is physically available for activation in Flipper.
isActivatable: boolean;
}
// Describes plugin which is a part of the Flipper JS bundle.
export interface BundledPluginDetails extends ConcretePluginDetails {
isBundled: true;
isActivatable: true;
}
// Describes plugin installed on the disk.
export interface InstalledPluginDetails extends ConcretePluginDetails {
isBundled: false;
isActivatable: true;
dir: string;
entry: string;
}
// Describes plugin physically available for activation in Flipper.
export type ActivatablePluginDetails =
| BundledPluginDetails
| InstalledPluginDetails;
// Describes plugin available for downloading. Until downloaded to the disk it is not available for activation in Flipper.
export interface DownloadablePluginDetails extends ConcretePluginDetails {
isActivatable: false;
isBundled: false;
downloadUrl: string;
lastUpdated: Date;
}
export default PluginDetails;

View File

@@ -45,3 +45,4 @@ export * from './user-session';
export * from './GK';
export * from './clientUtils';
export * from './settings';
export * from './PluginDetails';

View File

@@ -7,11 +7,7 @@
* @format
*/
import {
DeviceSpec,
DeviceType as PluginDeviceType,
OS as PluginOS,
} from 'flipper-plugin-lib';
import {DeviceSpec, DeviceType, OS as PluginOS} from './PluginDetails';
import {LauncherSettings, ProcessConfig, Settings} from './settings';
// In the future, this file would deserve it's own package, as it doesn't really relate to plugins.
@@ -24,9 +20,7 @@ export type FlipperServerState =
| 'error'
| 'closed';
export type DeviceType = PluginDeviceType;
export type DeviceOS = PluginOS | 'Windows' | 'MacOS' | 'Browser' | 'Linux';
export type DeviceOS = PluginOS;
export type DeviceDescription = {
readonly os: DeviceOS;

View File

@@ -4,9 +4,5 @@
"outDir": "lib",
"rootDir": "src"
},
"references": [
{
"path": "../plugin-lib"
}
]
"references": []
}