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
85 lines
1.9 KiB
TypeScript
85 lines
1.9 KiB
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 BaseDevice from './BaseDevice';
|
|
import type {DeviceOS, DeviceType} from 'flipper-plugin-core';
|
|
|
|
export default class ArchivedDevice extends BaseDevice {
|
|
isArchived = true;
|
|
|
|
constructor(options: {
|
|
serial: string;
|
|
deviceType: DeviceType;
|
|
title: string;
|
|
os: DeviceOS;
|
|
screenshotHandle?: string | null;
|
|
source?: string;
|
|
supportRequestDetails?: object;
|
|
}) {
|
|
super(
|
|
{
|
|
async connect() {},
|
|
close() {},
|
|
exec(command, ..._args: any[]) {
|
|
throw new Error(
|
|
`[Archived device] Cannot invoke command ${command} on an archived device`,
|
|
);
|
|
},
|
|
on(event) {
|
|
console.warn(
|
|
`Cannot subscribe to server events from an Archived device: ${event}`,
|
|
);
|
|
},
|
|
off() {},
|
|
},
|
|
{
|
|
deviceType: options.deviceType,
|
|
title: options.title,
|
|
os: options.os,
|
|
serial: options.serial,
|
|
icon: 'box',
|
|
features: {
|
|
screenCaptureAvailable: false,
|
|
screenshotAvailable: false,
|
|
},
|
|
},
|
|
);
|
|
this.connected.set(false);
|
|
this.source = options.source || '';
|
|
this.supportRequestDetails = options.supportRequestDetails;
|
|
this.archivedScreenshotHandle = options.screenshotHandle ?? null;
|
|
}
|
|
|
|
archivedScreenshotHandle: string | null;
|
|
|
|
displayTitle(): string {
|
|
return `${this.title} ${this.source ? '(Imported)' : '(Offline)'}`;
|
|
}
|
|
|
|
supportRequestDetails?: object;
|
|
|
|
getArchivedScreenshotHandle(): string | null {
|
|
return this.archivedScreenshotHandle;
|
|
}
|
|
|
|
/**
|
|
* @override
|
|
*/
|
|
async startLogging() {
|
|
// No-op
|
|
}
|
|
|
|
/**
|
|
* @override
|
|
*/
|
|
async stopLogging() {
|
|
// No-op
|
|
}
|
|
}
|