Remove fs.readFile from some plugins
Summary: 1. Remove fs.readFile from some plugins 2. Add "importFile" to FlipperLib and RenderHost See D32492149 for context Followups: 1. Decapitate Stella's sendToPhone 2. Decapitate crash reporter 3. Figure out how to approach navigation 4. Figure out how to approach FileSelector Reviewed By: mweststrate Differential Revision: D32496775 fbshipit-source-id: e150aa56a2c2c1eb12a4c03c801f76cd76485a9d
This commit is contained in:
committed by
Facebook GitHub Bot
parent
2c7bc0a952
commit
a279b9bc43
@@ -97,6 +97,7 @@ test('Correct top level API exposed', () => {
|
||||
"ElementSearchResultSet",
|
||||
"ElementsInspectorElement",
|
||||
"ElementsInspectorProps",
|
||||
"FileDescriptor",
|
||||
"FlipperLib",
|
||||
"HighlightManager",
|
||||
"Idler",
|
||||
|
||||
@@ -37,6 +37,7 @@ export {
|
||||
FlipperLib,
|
||||
getFlipperLib,
|
||||
setFlipperLibImplementation as _setFlipperLibImplementation,
|
||||
FileDescriptor,
|
||||
} from './plugin/FlipperLib';
|
||||
export {
|
||||
MenuEntry,
|
||||
|
||||
@@ -14,6 +14,11 @@ import {RealFlipperClient} from './Plugin';
|
||||
import {Notification} from './Notification';
|
||||
import {DetailSidebarProps} from '../ui/DetailSidebar';
|
||||
|
||||
export interface FileDescriptor {
|
||||
data: string;
|
||||
name: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* This interface exposes all global methods for which an implementation will be provided by Flipper itself
|
||||
*/
|
||||
@@ -42,6 +47,20 @@ export interface FlipperLib {
|
||||
name: string;
|
||||
};
|
||||
}): Promise<string | undefined>;
|
||||
/**
|
||||
* @returns
|
||||
* Imported file data.
|
||||
* If user cancelled a file selection - undefined.
|
||||
*/
|
||||
importFile(options: {
|
||||
defaultPath?: string;
|
||||
extensions?: string[];
|
||||
}): Promise<FileDescriptor | undefined>;
|
||||
/**
|
||||
* @returns
|
||||
* An exported file path (if available) or a file name.
|
||||
* If user cancelled a file selection - undefined.
|
||||
*/
|
||||
exportFile(
|
||||
data: string,
|
||||
options?: {
|
||||
|
||||
@@ -380,6 +380,7 @@ export function createMockFlipperLib(options?: StartPluginOptions): FlipperLib {
|
||||
openLink: jest.fn(),
|
||||
showNotification: jest.fn(),
|
||||
exportFile: jest.fn(),
|
||||
importFile: jest.fn(),
|
||||
paths: {
|
||||
appPath: process.cwd(),
|
||||
homePath: `/dev/null`,
|
||||
|
||||
Reference in New Issue
Block a user