Move desktop-related code to "desktop" subfolder (#872)
Summary: Pull Request resolved: https://github.com/facebook/flipper/pull/872 Move all the JS code related to desktop app to "desktop" subfolder. The structure of "desktop" folder: - `src` - JS code of Flipper desktop app executing in Electron Renderer (Chrome) process. This folder also contains all the Flipper plugins in subfolder "src/plugins". - `static` - JS code of Flipper desktop app bootstrapping executing in Electron Main (Node.js) process - `pkg` - Flipper packaging lib and CLI tool - `doctor` - Flipper diagnostics lib and CLI tool - `scripts` - Build scripts for Flipper desktop app - `headless` - Headless version of Flipper app - `headless-tests` - Integration tests running agains Flipper headless version Reviewed By: passy Differential Revision: D20249304 fbshipit-source-id: 9a51c63b51b92b758a02fc8ebf7d3d116770efe9
This commit is contained in:
committed by
Facebook GitHub Bot
parent
a60e6fee87
commit
85c13bb1f3
49
desktop/types/JSONStream.d.tsx
Normal file
49
desktop/types/JSONStream.d.tsx
Normal file
@@ -0,0 +1,49 @@
|
||||
/**
|
||||
* 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
|
||||
*/
|
||||
|
||||
declare module 'JSONStream' {
|
||||
export interface Options {
|
||||
recurse: boolean;
|
||||
}
|
||||
|
||||
export function parse(pattern: any): NodeJS.ReadWriteStream;
|
||||
export function parse(patterns: any[]): NodeJS.ReadWriteStream;
|
||||
|
||||
/**
|
||||
* Create a writable stream.
|
||||
* you may pass in custom open, close, and seperator strings. But, by default,
|
||||
* JSONStream.stringify() will create an array,
|
||||
* (with default options open='[\n', sep='\n,\n', close='\n]\n')
|
||||
*/
|
||||
export function stringify(): NodeJS.ReadWriteStream;
|
||||
|
||||
/** If you call JSONStream.stringify(false) the elements will only be seperated by a newline. */
|
||||
export function stringify(
|
||||
newlineOnly: NewlineOnlyIndicator,
|
||||
): NodeJS.ReadWriteStream;
|
||||
type NewlineOnlyIndicator = false;
|
||||
|
||||
/**
|
||||
* Create a writable stream.
|
||||
* you may pass in custom open, close, and seperator strings. But, by default,
|
||||
* JSONStream.stringify() will create an array,
|
||||
* (with default options open='[\n', sep='\n,\n', close='\n]\n')
|
||||
*/
|
||||
export function stringify(
|
||||
open: string,
|
||||
sep: string,
|
||||
close: string,
|
||||
): NodeJS.ReadWriteStream;
|
||||
export function stringifyObject(): NodeJS.ReadWriteStream;
|
||||
export function stringifyObject(
|
||||
open: string,
|
||||
sep: string,
|
||||
close: string,
|
||||
): NodeJS.ReadWriteStream;
|
||||
}
|
||||
20
desktop/types/ReactDebounceRender.d.tsx
Normal file
20
desktop/types/ReactDebounceRender.d.tsx
Normal file
@@ -0,0 +1,20 @@
|
||||
/**
|
||||
* 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
|
||||
*/
|
||||
|
||||
declare module 'react-debounce-render' {
|
||||
export default function<P>(
|
||||
component: React.ComponentType<P>,
|
||||
maxWait: number,
|
||||
options: {
|
||||
maxWait?: number;
|
||||
leading?: boolean;
|
||||
trailing?: boolean;
|
||||
},
|
||||
): React.ComponentType<P & {ref?: (ref: React.RefObject<any>) => void}>;
|
||||
}
|
||||
51
desktop/types/ResizeObserver.d.tsx
Normal file
51
desktop/types/ResizeObserver.d.tsx
Normal file
@@ -0,0 +1,51 @@
|
||||
/**
|
||||
* 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 ResizeObserver {
|
||||
new (callback: ResizeObserverCallback): ResizeObserver;
|
||||
observe: (target: Element) => void;
|
||||
unobserve: (target: Element) => void;
|
||||
disconnect: () => void;
|
||||
}
|
||||
|
||||
interface ResizeObserverCallback {
|
||||
(entries: ResizeObserverEntry[], observer: ResizeObserver): void;
|
||||
}
|
||||
|
||||
export interface ResizeObserverEntry {
|
||||
/**
|
||||
* @param target The Element whose size has changed.
|
||||
*/
|
||||
new (target: Element): ResizeObserverEntry;
|
||||
|
||||
/**
|
||||
* The Element whose size has changed.
|
||||
*/
|
||||
readonly target: Element;
|
||||
|
||||
/**
|
||||
* Element's content rect when ResizeObserverCallback is invoked.
|
||||
*/
|
||||
readonly contentRect: DOMRectReadOnly;
|
||||
}
|
||||
|
||||
interface DOMRectReadOnly {
|
||||
// static fromRect(other: DOMRectInit | undefined): DOMRectReadOnly;
|
||||
|
||||
readonly x: number;
|
||||
readonly y: number;
|
||||
readonly width: number;
|
||||
readonly height: number;
|
||||
readonly top: number;
|
||||
readonly right: number;
|
||||
readonly bottom: number;
|
||||
readonly left: number;
|
||||
|
||||
toJSON: () => any;
|
||||
}
|
||||
12
desktop/types/XmlBeautifier.d.tsx
Normal file
12
desktop/types/XmlBeautifier.d.tsx
Normal file
@@ -0,0 +1,12 @@
|
||||
/**
|
||||
* 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
|
||||
*/
|
||||
|
||||
declare module 'xml-beautifier' {
|
||||
export default function(xml: string, indent?: string): string;
|
||||
}
|
||||
68
desktop/types/adbkit-logcat.d.tsx
Normal file
68
desktop/types/adbkit-logcat.d.tsx
Normal file
@@ -0,0 +1,68 @@
|
||||
/**
|
||||
* 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
|
||||
*/
|
||||
|
||||
// This module declaration is a stub!
|
||||
// Please extend this as needed.
|
||||
|
||||
declare module 'adbkit-logcat' {
|
||||
type PriorityValue = number;
|
||||
|
||||
interface Reader extends NodeJS.EventEmitter {
|
||||
connect(stream: NodeJS.WriteStream): this;
|
||||
end(): this;
|
||||
exclude(tag: string): this;
|
||||
excludeAll(): this;
|
||||
include(tag: string, priority?: PriorityValue): this;
|
||||
includeAll(priority?: PriorityValue): this;
|
||||
resetFilters(): this;
|
||||
|
||||
on(event: 'error', listener: (err: Error) => void): this;
|
||||
on(event: 'end', listener: () => void): this;
|
||||
on(event: 'finish', listener: () => void): this;
|
||||
on(event: 'entry', listener: (entry: Entry) => void): this;
|
||||
}
|
||||
|
||||
interface Entry {
|
||||
date: Date;
|
||||
pid: number;
|
||||
tid: number;
|
||||
priority: PriorityValue;
|
||||
tag: string;
|
||||
message: string;
|
||||
toBinary(): Buffer;
|
||||
}
|
||||
|
||||
interface Priority {
|
||||
DEBUG: PriorityValue;
|
||||
DEFAULT: PriorityValue;
|
||||
ERROR: PriorityValue;
|
||||
FATAL: PriorityValue;
|
||||
INFO: PriorityValue;
|
||||
SILENT: PriorityValue;
|
||||
UNKNOWN: PriorityValue;
|
||||
VERBOSE: PriorityValue;
|
||||
WARN: PriorityValue;
|
||||
|
||||
fromLetter(letter: string): PriorityValue | undefined;
|
||||
fromName(name: string): PriorityValue | undefined;
|
||||
toLetter(value: PriorityValue): string;
|
||||
toName(value: PriorityValue): string;
|
||||
}
|
||||
|
||||
function readStream(
|
||||
stream: NodeJS.WriteStream,
|
||||
options?: {
|
||||
format: 'binary';
|
||||
fixLineFeeds: boolean;
|
||||
},
|
||||
): Reader;
|
||||
|
||||
const Priority: Priority;
|
||||
const Reader: Reader;
|
||||
}
|
||||
75
desktop/types/adbkit.d.tsx
Normal file
75
desktop/types/adbkit.d.tsx
Normal file
@@ -0,0 +1,75 @@
|
||||
/**
|
||||
* 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
|
||||
*/
|
||||
|
||||
interface Device {
|
||||
id: string;
|
||||
type: 'emulator' | 'device' | 'offline';
|
||||
}
|
||||
|
||||
interface Util {
|
||||
readAll: (stream: NodeJS.ReadStream) => Promise<Buffer>;
|
||||
}
|
||||
|
||||
// https://github.com/openstf/adbkit#pulltransfer
|
||||
interface PullTransfer extends NodeJS.WriteStream {
|
||||
cancel: () => this;
|
||||
on(
|
||||
event: 'progress',
|
||||
listener: (stats: {bytesTransferred: number}) => void,
|
||||
): this;
|
||||
on(event: 'error', listener: (err: Error) => void): this;
|
||||
on(event: 'end', listener: () => void): this;
|
||||
on(event: 'resize', listener: () => void): this;
|
||||
}
|
||||
|
||||
interface DeviceTracker extends NodeJS.EventEmitter {
|
||||
on(event: 'add', listener: (device: Device) => void): this;
|
||||
on(event: 'remove', listener: (device: Device) => void): this;
|
||||
on(event: 'change', listener: (device: Device) => void): this;
|
||||
on(
|
||||
event: 'changeSet',
|
||||
listener: (changes: {
|
||||
added: Device[];
|
||||
removed: Device[];
|
||||
changed: Device[];
|
||||
}) => void,
|
||||
): this;
|
||||
on(event: 'error', listener: (err: Error) => void): this;
|
||||
on(event: 'end', listener: () => void): this;
|
||||
}
|
||||
|
||||
declare module 'adbkit' {
|
||||
const util: Util;
|
||||
const adbkit: any;
|
||||
export interface Client {
|
||||
listDevices: () => Promise<Device[]>;
|
||||
reverse: (
|
||||
serial: string,
|
||||
remote: string,
|
||||
local: string,
|
||||
) => Promise<boolean>;
|
||||
shell: (
|
||||
serial: string,
|
||||
command: string | string[],
|
||||
) => Promise<NodeJS.ReadStream>;
|
||||
screencap: (serial: string) => Promise<NodeJS.WriteStream>;
|
||||
pull: (serial: string, path: string) => Promise<PullTransfer>;
|
||||
openLogcat: (
|
||||
serial: string,
|
||||
options?: {
|
||||
clear?: boolean;
|
||||
},
|
||||
callback?: any,
|
||||
) => Promise<import('adbkit-logcat').Reader>;
|
||||
getProperties: (serial: string) => Promise<{[key: string]: string}>;
|
||||
trackDevices: () => Promise<DeviceTracker>;
|
||||
kill: () => Promise<boolean>;
|
||||
}
|
||||
export function createClient(config: {port: number; host: string}): Client;
|
||||
}
|
||||
14
desktop/types/ansi-to-html.d.ts
vendored
Normal file
14
desktop/types/ansi-to-html.d.ts
vendored
Normal file
@@ -0,0 +1,14 @@
|
||||
/**
|
||||
* 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
|
||||
*/
|
||||
|
||||
declare module 'ansi-to-html' {
|
||||
export default class Filter {
|
||||
toHtml: (input: string) => string;
|
||||
}
|
||||
}
|
||||
12
desktop/types/decompress-targz.d.tsx
Normal file
12
desktop/types/decompress-targz.d.tsx
Normal file
@@ -0,0 +1,12 @@
|
||||
/**
|
||||
* 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
|
||||
*/
|
||||
|
||||
declare module 'decompress-targz' {
|
||||
export default function(): any;
|
||||
}
|
||||
12
desktop/types/decompress-unzip.d.tsx
Normal file
12
desktop/types/decompress-unzip.d.tsx
Normal file
@@ -0,0 +1,12 @@
|
||||
/**
|
||||
* 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
|
||||
*/
|
||||
|
||||
declare module 'decompress-unzip' {
|
||||
export default function(): any;
|
||||
}
|
||||
16
desktop/types/download-tarball.d.tsx
Normal file
16
desktop/types/download-tarball.d.tsx
Normal file
@@ -0,0 +1,16 @@
|
||||
/**
|
||||
* 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
|
||||
*/
|
||||
|
||||
declare module 'download-tarball' {
|
||||
export default function(options: {
|
||||
url: string;
|
||||
dir: string;
|
||||
gotOpts?: any;
|
||||
}): Promise<void>;
|
||||
}
|
||||
35
desktop/types/globals.tsx
Normal file
35
desktop/types/globals.tsx
Normal file
@@ -0,0 +1,35 @@
|
||||
/**
|
||||
* 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
|
||||
*/
|
||||
|
||||
import {StoreEnhancerStoreCreator} from 'redux';
|
||||
import {ResizeObserver} from './ResizeObserver.d';
|
||||
import {Store} from '../src/reducers';
|
||||
|
||||
export {};
|
||||
type RequestIdleHandle = number;
|
||||
|
||||
declare global {
|
||||
interface StoreEnhancerStateSanitizer {
|
||||
stateSanitizer: Function;
|
||||
}
|
||||
|
||||
interface Window {
|
||||
flipperGlobalStoreDispatch: Store['dispatch'];
|
||||
|
||||
__REDUX_DEVTOOLS_EXTENSION__:
|
||||
| undefined
|
||||
| (StoreEnhancerStoreCreator & StoreEnhancerStateSanitizer);
|
||||
|
||||
Flipper: {
|
||||
init: () => void;
|
||||
};
|
||||
|
||||
ResizeObserver: ResizeObserver;
|
||||
}
|
||||
}
|
||||
18
desktop/types/line-replace.d.ts
vendored
Normal file
18
desktop/types/line-replace.d.ts
vendored
Normal file
@@ -0,0 +1,18 @@
|
||||
/**
|
||||
* 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
|
||||
*/
|
||||
|
||||
declare module 'line-replace' {
|
||||
export default function(args: {
|
||||
file: string;
|
||||
line: number;
|
||||
text: string;
|
||||
addNewLine: boolean;
|
||||
callback: (args: {file: string; line: number; replacedText: string; text: string}) => void;
|
||||
}): void;
|
||||
}
|
||||
82
desktop/types/live-plugin-manager.d.tsx
Normal file
82
desktop/types/live-plugin-manager.d.tsx
Normal file
@@ -0,0 +1,82 @@
|
||||
/**
|
||||
* 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 declare class PluginManager {
|
||||
constructor(options?: Partial<LivePluginManager.PluginManagerOptions>);
|
||||
install(
|
||||
name: string,
|
||||
version?: string,
|
||||
): Promise<LivePluginManager.IPluginInfo>;
|
||||
installFromPath(
|
||||
location: string,
|
||||
options?: {
|
||||
force: boolean;
|
||||
},
|
||||
): Promise<LivePluginManager.IPluginInfo>;
|
||||
|
||||
readonly options: LivePluginManager.PluginManagerOptions;
|
||||
}
|
||||
|
||||
declare namespace LivePluginManager {
|
||||
interface IPluginInfo {
|
||||
readonly mainFile: string;
|
||||
readonly location: string;
|
||||
readonly name: string;
|
||||
readonly version: string;
|
||||
readonly dependencies: {[name: string]: string};
|
||||
}
|
||||
|
||||
interface PluginSandbox {
|
||||
env?: NodeJS.ProcessEnv;
|
||||
global?: NodeJS.Global;
|
||||
}
|
||||
|
||||
export interface NpmRegistryAuthToken {
|
||||
token: string;
|
||||
}
|
||||
|
||||
export interface NpmRegistryAuthBasic {
|
||||
username: string;
|
||||
password: string;
|
||||
}
|
||||
|
||||
interface NpmRegistryConfig {
|
||||
auth?: NpmRegistryAuthToken | NpmRegistryAuthBasic;
|
||||
userAgent?: string;
|
||||
}
|
||||
|
||||
export interface GithubAuthUserToken {
|
||||
type: 'token';
|
||||
token: string;
|
||||
}
|
||||
|
||||
export interface GithubAuthBasic {
|
||||
type: 'basic';
|
||||
username: string;
|
||||
password: string;
|
||||
}
|
||||
|
||||
export type GithubAuth = GithubAuthUserToken | GithubAuthBasic;
|
||||
|
||||
interface PluginManagerOptions {
|
||||
cwd: string;
|
||||
pluginsPath: string;
|
||||
sandbox: PluginSandbox;
|
||||
npmRegistryUrl: string;
|
||||
npmRegistryConfig: NpmRegistryConfig;
|
||||
npmInstallMode: 'useCache' | 'noCache';
|
||||
requireCoreModules: boolean;
|
||||
hostRequire?: NodeRequire;
|
||||
ignoredDependencies: Array<string | RegExp>;
|
||||
staticDependencies: {[key: string]: any};
|
||||
githubAuthentication?: GithubAuth;
|
||||
lockWait: number;
|
||||
lockStale: number;
|
||||
}
|
||||
}
|
||||
20
desktop/types/nodejs.tsx
Normal file
20
desktop/types/nodejs.tsx
Normal file
@@ -0,0 +1,20 @@
|
||||
/**
|
||||
* 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
|
||||
*/
|
||||
|
||||
declare module NodeJS {
|
||||
interface Global {
|
||||
__REVISION__: string | undefined;
|
||||
__VERSION__: string;
|
||||
electronRequire: (name: string) => any;
|
||||
window: Window | undefined;
|
||||
WebSocket: any;
|
||||
fetch: any;
|
||||
originalConsole: Console | undefined;
|
||||
}
|
||||
}
|
||||
38
desktop/types/npm-api.d.ts
vendored
Normal file
38
desktop/types/npm-api.d.ts
vendored
Normal file
@@ -0,0 +1,38 @@
|
||||
/**
|
||||
* 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
|
||||
*/
|
||||
|
||||
// Very incomplete stub with only the methods we use defined.
|
||||
declare module 'npm-api' {
|
||||
export default class NpmApi {
|
||||
constructor(...args: any[]);
|
||||
|
||||
list(...args: any[]): any;
|
||||
|
||||
maintainer(...args: any[]): any;
|
||||
|
||||
repo(name: string): Repository;
|
||||
|
||||
reset(...args: any[]): any;
|
||||
|
||||
use(...args: any[]): any;
|
||||
|
||||
view(...args: any[]): any;
|
||||
|
||||
}
|
||||
|
||||
export class Repository {
|
||||
package(): Promise<Package>;
|
||||
}
|
||||
|
||||
export interface Package {
|
||||
name: string;
|
||||
version: string;
|
||||
}
|
||||
|
||||
}
|
||||
29
desktop/types/openssl-wrapper.d.tsx
Normal file
29
desktop/types/openssl-wrapper.d.tsx
Normal file
@@ -0,0 +1,29 @@
|
||||
/**
|
||||
* 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
|
||||
*/
|
||||
|
||||
declare module 'openssl-wrapper' {
|
||||
export type Action =
|
||||
| 'cms.verify'
|
||||
| 'genrsa'
|
||||
| 'pkcs12'
|
||||
| 'req'
|
||||
| 'req.new'
|
||||
| 'req.verify'
|
||||
| 'verify'
|
||||
| 'rsa'
|
||||
| 'smime.verify'
|
||||
| 'x509.req'
|
||||
| 'x509';
|
||||
|
||||
export function exec(
|
||||
action: Action,
|
||||
options: {[key: string]: string},
|
||||
cb: (error: Error | undefined, buffer: Buffer | undefined) => any,
|
||||
): void;
|
||||
}
|
||||
12
desktop/types/string-natural-compare.d.tsx
Normal file
12
desktop/types/string-natural-compare.d.tsx
Normal file
@@ -0,0 +1,12 @@
|
||||
/**
|
||||
* 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
|
||||
*/
|
||||
|
||||
declare module 'string-natural-compare' {
|
||||
export default function naturalCompare(a: string, b: string): number;
|
||||
}
|
||||
Reference in New Issue
Block a user