Bumped electron version

Summary:
We in React VR were need newer Chrome DevTools version to make our plugin work properly. Chromium version with required fixes were shipped in electron 5.0.0.

This diff bumps electron version and explicitly allows node integration (accessing require, process and other node related functions from window object in index.html), because it was disabled by default in 5.0.0.

Reviewed By: jknoxville

Differential Revision: D15693539

fbshipit-source-id: 4f71a07b2afaa489aec46940c924f4ad30ad0413
This commit is contained in:
Daniel Büchele
2019-06-10 10:31:42 -07:00
committed by Facebook Github Bot
parent 844cabd5d3
commit 79414aa3e1
16 changed files with 382 additions and 169 deletions

View File

@@ -5,9 +5,6 @@
* @format
*/
type Electron$BrowserWindow = any;
type Electron$NativeImage = any;
type Electron$MenuRoles =
| 'undo'
| 'redo'
@@ -38,7 +35,7 @@ type Electron$MenuType =
| 'checkbox'
| 'radio';
type Electron$MenuItemOptions = {
type MenuItemConstructorOptions = {|
click?: (
menuItem: Electron$MenuItem,
browserWindow: Object,
@@ -53,33 +50,14 @@ type Electron$MenuItemOptions = {
enabled?: boolean,
visible?: boolean,
checked?: boolean,
submenu?: Electron$Menu | Array<Electron$MenuItemOptions>,
submenu?: Array<MenuItemConstructorOptions>,
id?: string,
position?: string,
};
|};
declare class Electron$MenuItem {
constructor(options: Electron$MenuItemOptions): Electron$MenuItem;
constructor(options: MenuItemConstructorOptions): Electron$MenuItem;
enabled: boolean;
visible: boolean;
checked: boolean;
}
declare class Electron$Menu {
static setApplicationMenu: (menu: Electron$Menu) => void;
static getApplicationMenu: () => ?Electron$Menu;
static sendActionToFirstResponder: (action: string) => void;
static buildFromTemplate: (
templates: Array<Electron$MenuItemOptions>,
) => Electron$Menu;
popup: (
browserWindow: Object,
x?: number,
y?: number,
positioningItem?: number,
) => void;
popup: (x?: number, y?: number, positioningItem?: number) => void;
append: (menuItem: Electron$MenuItem) => void;
insert: (pos: number, menuItem: Electron$MenuItem) => void;
items: Array<Electron$MenuItem>;
}

View File

@@ -5,33 +5,44 @@
* @format
* @flow
*
* This is an autogenerated libdef for: electron-v4.0.5 renderer process
* This is an autogenerated libdef for: electron-v5.0.2 renderer process
*/
declare module 'electron' {
declare module.exports: {
clipboard: {
readText: (type?: ?string) => string,
writeText: (text: string, type?: ?string) => void,
readHTML: (type?: ?string) => string,
writeHTML: (markup: string, type?: ?string) => void,
readImage: (type?: ?string) => NativeImage,
writeImage: (image: NativeImage, type?: ?string) => void,
readRTF: (type?: ?string) => string,
writeRTF: (text: string, type?: ?string) => void,
readText: (type?: ?'selection' | 'clipboard') => string,
writeText: (text: string, type?: ?'selection' | 'clipboard') => void,
readHTML: (type?: ?'selection' | 'clipboard') => string,
writeHTML: (markup: string, type?: ?'selection' | 'clipboard') => void,
readImage: (type?: ?'selection' | 'clipboard') => NativeImage,
writeImage: (
image: NativeImage,
type?: ?'selection' | 'clipboard',
) => void,
readRTF: (type?: ?'selection' | 'clipboard') => string,
writeRTF: (text: string, type?: ?'selection' | 'clipboard') => void,
readBookmark: () => {
title: string,
url: string,
},
writeBookmark: (title: string, url: string, type?: ?string) => void,
writeBookmark: (
title: string,
url: string,
type?: ?'selection' | 'clipboard',
) => void,
readFindText: () => string,
writeFindText: (text: string) => void,
clear: (type?: ?string) => void,
availableFormats: (type?: ?string) => Array<string>,
has: (format: string, type?: ?string) => boolean,
clear: (type?: ?'selection' | 'clipboard') => void,
availableFormats: (type?: ?'selection' | 'clipboard') => Array<string>,
has: (format: string, type?: ?'selection' | 'clipboard') => boolean,
read: (format: string) => string,
readBuffer: (format: string) => Buffer,
writeBuffer: (format: string, buffer: Buffer, type?: ?string) => void,
writeBuffer: (
format: string,
buffer: Buffer,
type?: ?'selection' | 'clipboard',
) => void,
write: (
data: {
text?: ?string,
@@ -40,7 +51,7 @@ declare module 'electron' {
rtf?: ?string,
bookmark?: ?string,
},
type?: ?string,
type?: ?'selection' | 'clipboard',
) => void,
},
crashReporter: {
@@ -66,9 +77,15 @@ declare module 'electron' {
options: {
types: Array<string>,
thumbnailSize?: ?Size,
fetchWindowIcons?: ?boolean,
},
callback: Function,
) => void,
getSources: (options: {
types: Array<string>,
thumbnailSize?: ?Size,
fetchWindowIcons?: ?boolean,
}) => Promise<any>,
},
ipcRenderer: {
on: (channel: string, listener: Function) => void,
@@ -134,9 +151,11 @@ declare module 'electron' {
on: (eventName: 'loaded', callback: () => void) => void,
once: (eventName: 'loaded', callback: () => void) => void,
defaultApp?: ?boolean,
isMainFrame?: ?boolean,
mas?: ?boolean,
noAsar?: ?boolean,
noDeprecation?: ?boolean,
enablePromiseAPIs?: ?boolean,
resourcesPath?: ?string,
sandboxed?: ?boolean,
throwDeprecation?: ?boolean,
@@ -178,11 +197,18 @@ declare module 'electron' {
},
callback: Function,
) => void,
getFileIcon: (
path: string,
options?: ?{
size: 'small' | 'normal' | 'large',
},
) => Promise<any>,
setPath: (name: string, path: string) => void,
getVersion: () => string,
getName: () => string,
setName: (name: string) => void,
getLocale: () => string,
getLocaleCountryCode: () => string,
addRecentDocument: (path: string) => void,
clearRecentDocuments: () => void,
setAsDefaultProtocolClient: (
@@ -262,14 +288,15 @@ declare module 'electron' {
applicationName?: ?string,
applicationVersion?: ?string,
copyright?: ?string,
credits?: ?string,
version?: ?string,
credits?: ?string,
website?: ?string,
iconPath?: ?string,
}) => void,
startAccessingSecurityScopedResource: (
bookmarkData: string,
) => Function,
enableSandbox: () => void,
enableMixedSandbox: () => void,
isInApplicationsFolder: () => boolean,
moveToApplicationsFolder: () => boolean,
on: ((
@@ -403,6 +430,10 @@ declare module 'electron' {
workingDirectory: string,
) => void,
) => void) &
((
eventName: 'desktop-capturer-get-sources',
callback: (event: Event, webContents: WebContents) => void,
) => void) &
((
eventName: 'remote-require',
callback: (
@@ -574,6 +605,10 @@ declare module 'electron' {
workingDirectory: string,
) => void,
) => void) &
((
eventName: 'desktop-capturer-get-sources',
callback: (event: Event, webContents: WebContents) => void,
) => void) &
((
eventName: 'remote-require',
callback: (
@@ -618,6 +653,8 @@ declare module 'electron' {
commandLine: {
appendSwitch?: ?Function,
appendArgument?: ?Function,
hasSwitch?: ?Function,
getSwitchValue?: ?Function,
},
dock: {
bounce?: ?Function,
@@ -673,27 +710,38 @@ declare module 'electron' {
((eventName: 'before-quit-for-update', callback: () => void) => void),
},
clipboard: {
readText: (type?: ?string) => string,
writeText: (text: string, type?: ?string) => void,
readHTML: (type?: ?string) => string,
writeHTML: (markup: string, type?: ?string) => void,
readImage: (type?: ?string) => NativeImage,
writeImage: (image: NativeImage, type?: ?string) => void,
readRTF: (type?: ?string) => string,
writeRTF: (text: string, type?: ?string) => void,
readText: (type?: ?'selection' | 'clipboard') => string,
writeText: (text: string, type?: ?'selection' | 'clipboard') => void,
readHTML: (type?: ?'selection' | 'clipboard') => string,
writeHTML: (markup: string, type?: ?'selection' | 'clipboard') => void,
readImage: (type?: ?'selection' | 'clipboard') => NativeImage,
writeImage: (
image: NativeImage,
type?: ?'selection' | 'clipboard',
) => void,
readRTF: (type?: ?'selection' | 'clipboard') => string,
writeRTF: (text: string, type?: ?'selection' | 'clipboard') => void,
readBookmark: () => {
title: string,
url: string,
},
writeBookmark: (title: string, url: string, type?: ?string) => void,
writeBookmark: (
title: string,
url: string,
type?: ?'selection' | 'clipboard',
) => void,
readFindText: () => string,
writeFindText: (text: string) => void,
clear: (type?: ?string) => void,
availableFormats: (type?: ?string) => Array<string>,
has: (format: string, type?: ?string) => boolean,
clear: (type?: ?'selection' | 'clipboard') => void,
availableFormats: (type?: ?'selection' | 'clipboard') => Array<string>,
has: (format: string, type?: ?'selection' | 'clipboard') => boolean,
read: (format: string) => string,
readBuffer: (format: string) => Buffer,
writeBuffer: (format: string, buffer: Buffer, type?: ?string) => void,
writeBuffer: (
format: string,
buffer: Buffer,
type?: ?'selection' | 'clipboard',
) => void,
write: (
data: {
text?: ?string,
@@ -702,28 +750,21 @@ declare module 'electron' {
rtf?: ?string,
bookmark?: ?string,
},
type?: ?string,
type?: ?'selection' | 'clipboard',
) => void,
},
contentTracing: {
getCategories: (callback: Function) => void,
getCategories: () => Promise<any>,
startRecording: (
options: TraceCategoriesAndOptions | TraceConfig,
callback: Function,
) => void,
startRecording: (
options: TraceCategoriesAndOptions | TraceConfig,
) => Promise<any>,
stopRecording: (resultFilePath: string, callback: Function) => void,
startMonitoring: (
options: {
categoryFilter: string,
traceOptions: string,
},
callback: Function,
) => void,
stopMonitoring: (callback: Function) => void,
captureMonitoringSnapshot: (
resultFilePath: string,
callback: Function,
) => void,
stopRecording: (resultFilePath: string) => Promise<any>,
getTraceBufferUsage: (callback: Function) => void,
},
crashReporter: {
@@ -766,7 +807,7 @@ declare module 'electron' {
securityScopedBookmarks?: ?boolean,
},
callback?: ?Function,
) => Array<string>) &
) => Array<String> | typeof undefined) &
((
options: {
title?: ?string,
@@ -787,7 +828,7 @@ declare module 'electron' {
securityScopedBookmarks?: ?boolean,
},
callback?: ?Function,
) => Array<string>),
) => Array<String> | typeof undefined),
showSaveDialog: ((
browserWindow?: ?BrowserWindow,
options: {
@@ -801,7 +842,7 @@ declare module 'electron' {
securityScopedBookmarks?: ?boolean,
},
callback?: ?Function,
) => string) &
) => string | typeof undefined) &
((
options: {
title?: ?string,
@@ -814,7 +855,7 @@ declare module 'electron' {
securityScopedBookmarks?: ?boolean,
},
callback?: ?Function,
) => string),
) => string | typeof undefined),
showMessageBox: ((
browserWindow?: ?BrowserWindow,
options: {
@@ -868,7 +909,8 @@ declare module 'electron' {
) => void),
},
globalShortcut: {
register: (accelerator: Accelerator, callback: Function) => void,
register: (accelerator: Accelerator, callback: Function) => boolean,
registerAll: (accelerators: Array<string>, callback: Function) => void,
isRegistered: (accelerator: Accelerator) => boolean,
unregister: (accelerator: Accelerator) => void,
unregisterAll: () => void,
@@ -981,9 +1023,11 @@ declare module 'electron' {
on: (eventName: 'loaded', callback: () => void) => void,
once: (eventName: 'loaded', callback: () => void) => void,
defaultApp?: ?boolean,
isMainFrame?: ?boolean,
mas?: ?boolean,
noAsar?: ?boolean,
noDeprecation?: ?boolean,
enablePromiseAPIs?: ?boolean,
resourcesPath?: ?string,
sandboxed?: ?boolean,
throwDeprecation?: ?boolean,
@@ -997,13 +1041,9 @@ declare module 'electron' {
},
},
protocol: {
registerStandardSchemes: (
schemes: Array<string>,
options?: ?{
secure?: ?boolean,
},
registerSchemesAsPrivileged: (
customSchemes: Array<CustomScheme>,
) => void,
registerServiceWorkerSchemes: (schemes: Array<string>) => void,
registerFileProtocol: (
scheme: string,
handler: Function,
@@ -1031,6 +1071,7 @@ declare module 'electron' {
) => void,
unregisterProtocol: (scheme: string, completion?: ?Function) => void,
isProtocolHandled: (scheme: string, callback: Function) => void,
isProtocolHandled: (scheme: string) => Promise<any>,
interceptFileProtocol: (
scheme: string,
handler: Function,
@@ -1119,14 +1160,20 @@ declare module 'electron' {
shell: {
showItemInFolder: (fullPath: string) => boolean,
openItem: (fullPath: string) => boolean,
openExternalSync: (
url: string,
options?: ?{
activate?: ?boolean,
workingDirectory?: ?string,
},
) => boolean,
openExternal: (
url: string,
options?: ?{
activate?: ?boolean,
workingDirectory?: ?string,
},
callback?: ?Function,
) => boolean,
) => Promise<any>,
moveItemToTrash: (fullPath: string) => boolean,
beep: () => void,
writeShortcutLink: (
@@ -1139,7 +1186,11 @@ declare module 'electron' {
systemPreferences: {
isDarkMode: () => boolean,
isSwipeTrackingFromScrollEventsEnabled: () => boolean,
postNotification: (event: string, userInfo: {}) => void,
postNotification: (
event: string,
userInfo: {},
deliverImmediately?: ?boolean,
) => void,
postLocalNotification: (event: string, userInfo: {}) => void,
postWorkspaceNotification: (event: string, userInfo: {}) => void,
subscribeNotification: (event: string, callback: Function) => number,
@@ -1173,6 +1224,7 @@ declare module 'electron' {
getAccentColor: () => string,
getColor: (
color:
| '3d-dark-shadow'
| '3d-dark-shadow'
| '3d-face'
| '3d-highlight'
@@ -1202,9 +1254,56 @@ declare module 'electron' {
| 'scrollbar'
| 'window'
| 'window-frame'
| 'window-text',
| 'window-text'
| 'alternate-selected-control-text'
| 'alternate-selected-control-text'
| 'control-background'
| 'control'
| 'control-text'
| 'disabled-control-text'
| 'find-highlight'
| 'grid'
| 'header-text'
| 'highlight'
| 'keyboard-focus-indicator'
| 'label'
| 'link'
| 'placeholder-text'
| 'quaternary-label'
| 'scrubber-textured-background'
| 'secondary-label'
| 'selected-content-background'
| 'selected-control'
| 'selected-control-text'
| 'selected-menu-item'
| 'selected-text-background'
| 'selected-text'
| 'separator'
| 'shadow'
| 'tertiary-label'
| 'text-background'
| 'text'
| 'under-page-background'
| 'unemphasized-selected-content-background'
| 'unemphasized-selected-text-background'
| 'unemphasized-selected-text'
| 'window-background'
| 'window-frame-text',
) => string,
getSystemColor: (
color:
| 'blue'
| 'brown'
| 'gray'
| 'green'
| 'orange'
| 'pink'
| 'purple'
| 'red'
| 'yellow',
) => void,
isInvertedColorScheme: () => boolean,
isHighContrastColorScheme: () => boolean,
getEffectiveAppearance: () => 'dark' | 'light' | 'unknown',
getAppLevelAppearance: () => 'dark' | 'light' | 'unknown',
setAppLevelAppearance: (appearance: string | null) => void,
@@ -1225,6 +1324,10 @@ declare module 'electron' {
eventName: 'inverted-color-scheme-changed',
callback: (event: Event, invertedColorScheme: boolean) => void,
) => void) &
((
eventName: 'high-contrast-color-scheme-changed',
callback: (event: Event, highContrastColorScheme: boolean) => void,
) => void) &
((
eventName: 'appearance-changed',
callback: (newAppearance: 'dark' | 'light') => void,
@@ -1241,6 +1344,10 @@ declare module 'electron' {
eventName: 'inverted-color-scheme-changed',
callback: (event: Event, invertedColorScheme: boolean) => void,
) => void) &
((
eventName: 'high-contrast-color-scheme-changed',
callback: (event: Event, highContrastColorScheme: boolean) => void,
) => void) &
((
eventName: 'appearance-changed',
callback: (newAppearance: 'dark' | 'light') => void,
@@ -1320,14 +1427,20 @@ declare module 'electron' {
shell: {
showItemInFolder: (fullPath: string) => boolean,
openItem: (fullPath: string) => boolean,
openExternalSync: (
url: string,
options?: ?{
activate?: ?boolean,
workingDirectory?: ?string,
},
) => boolean,
openExternal: (
url: string,
options?: ?{
activate?: ?boolean,
workingDirectory?: ?string,
},
callback?: ?Function,
) => boolean,
) => Promise<any>,
moveItemToTrash: (fullPath: string) => boolean,
beep: () => void,
writeShortcutLink: (
@@ -1352,22 +1465,10 @@ declare module 'electron' {
) => void,
setSpellCheckProvider: (
language: string,
autoCorrectWord: boolean,
provider: {
spellCheck: Function,
},
) => void,
registerURLSchemeAsBypassingCSP: (scheme: string) => void,
registerURLSchemeAsPrivileged: (
scheme: string,
options?: ?{
secure?: ?boolean,
bypassCSP?: ?boolean,
allowServiceWorkers?: ?boolean,
supportFetchAPI?: ?boolean,
corsEnabled?: ?boolean,
},
) => void,
insertText: (text: string) => void,
executeJavaScript: (
code: string,
@@ -1392,6 +1493,14 @@ declare module 'electron' {
worldId: number,
securityOrigin: string,
) => void,
setIsolatedWorldInfo: (
worldId: number,
info: {
securityOrigin?: ?string,
csp?: ?string,
name?: ?string,
},
) => void,
getResourceUsage: () => {
images: MemoryUsageDetails,
scripts: MemoryUsageDetails,
@@ -1457,11 +1566,23 @@ declare module 'electron' {
date: Date,
id: string,
};
declare type CustomScheme = {
scheme: string,
privileges?: ?{
standard?: ?boolean,
secure?: ?boolean,
bypassCSP?: ?boolean,
allowServiceWorkers?: ?boolean,
supportFetchAPI?: ?boolean,
corsEnabled?: ?boolean,
},
};
declare type DesktopCapturerSource = {
id: string,
name: string,
thumbnail: NativeImage,
display_id: string,
appIcon: NativeImage,
};
declare type Display = {
id: number,
@@ -1774,13 +1895,14 @@ declare module 'electron' {
callback: Function,
) => void;
capturePage: ((rect?: ?Rectangle, callback: Function) => void) &
((callback: Function) => void);
((callback: Function) => void) &
((rect?: ?Rectangle) => void);
send: (channel: string, ...args: Array<any>) => void;
sendInputEvent: (event: {}) => void;
setZoomFactor: (factor: number) => void;
setZoomLevel: (level: number) => void;
getZoomFactor: (callback: Function) => void;
getZoomLevel: (callback: Function) => void;
getZoomFactor: () => number;
getZoomLevel: () => number;
setVisualZoomLevelLimits: (
minimumLevel: number,
maximumLevel: number,
@@ -1868,7 +1990,6 @@ declare module 'electron' {
callback: (channel: string, args: Array<any>) => void,
) => void) &
((eventName: 'crashed', callback: () => void) => void) &
((eventName: 'gpu-crashed', callback: () => void) => void) &
((
eventName: 'plugin-crashed',
callback: (name: string, version: string) => void,
@@ -1964,7 +2085,6 @@ declare module 'electron' {
callback: (channel: string, args: Array<any>) => void,
) => void) &
((eventName: 'crashed', callback: () => void) => void) &
((eventName: 'gpu-crashed', callback: () => void) => void) &
((
eventName: 'plugin-crashed',
callback: (name: string, version: string) => void,
@@ -2069,6 +2189,7 @@ declare module 'electron' {
devTools?: ?boolean,
nodeIntegration?: ?boolean,
nodeIntegrationInWorker?: ?boolean,
nodeIntegrationInSubFrames?: ?boolean,
preload?: ?string,
sandbox?: ?boolean,
enableRemoteModule?: ?boolean,
@@ -2109,6 +2230,10 @@ declare module 'electron' {
safeDialogs?: ?boolean,
safeDialogsMessage?: ?string,
navigateOnDragDrop?: ?boolean,
autoplayPolicy?:
| ?'no-user-gesture-required'
| 'user-gesture-required'
| 'document-user-activation-required',
},
},
): BrowserWindow;
@@ -2212,7 +2337,8 @@ declare module 'electron' {
focusOnWebView: () => void;
blurWebView: () => void;
capturePage: ((rect?: ?Rectangle, callback: Function) => void) &
((callback: Function) => void);
((callback: Function) => void) &
((rect?: ?Rectangle) => void);
loadURL: (
url: string,
options?: ?{
@@ -2225,7 +2351,7 @@ declare module 'electron' {
| Array<UploadBlob>,
baseURLForDataURL?: ?string,
},
) => void;
) => Promise<any>;
loadFile: (
filePath: string,
options?: ?{
@@ -2233,9 +2359,10 @@ declare module 'electron' {
search?: ?string,
hash?: ?string,
},
) => void;
) => Promise<any>;
reload: () => void;
setMenu: (menu: Menu | null) => void;
removeMenu: () => void;
setProgressBar: (
progress: number,
options?: ?{
@@ -2306,11 +2433,14 @@ declare module 'electron' {
setTouchBar: (touchBar: TouchBar) => void;
setBrowserView: (browserView: BrowserView) => void;
getBrowserView: () => BrowserView | null;
addBrowserView: (browserView: BrowserView) => void;
removeBrowserView: (browserView: BrowserView) => void;
getBrowserViews: () => void;
webContents: WebContents;
id: number;
on: ((
eventName: 'page-title-updated',
callback: (event: Event, title: string) => void,
callback: (event: Event, title: string, explicitSet: boolean) => void,
) => void) &
((eventName: 'close', callback: (event: Event) => void) => void) &
((eventName: 'closed', callback: () => void) => void) &
@@ -2361,7 +2491,7 @@ declare module 'electron' {
((eventName: 'new-window-for-tab', callback: () => void) => void);
once: ((
eventName: 'page-title-updated',
callback: (event: Event, title: string) => void,
callback: (event: Event, title: string, explicitSet: boolean) => void,
) => void) &
((eventName: 'close', callback: (event: Event) => void) => void) &
((eventName: 'closed', callback: () => void) => void) &
@@ -2512,6 +2642,14 @@ declare module 'electron' {
) => void);
}
declare class Cookies {
get: (filter: {
url?: ?string,
name?: ?string,
domain?: ?string,
path?: ?string,
secure?: ?boolean,
session?: ?boolean,
}) => Promise<any>;
get: (
filter: {
url?: ?string,
@@ -2523,6 +2661,16 @@ declare module 'electron' {
},
callback: Function,
) => void;
set: (details: {
url: string,
name?: ?string,
value?: ?string,
domain?: ?string,
path?: ?string,
secure?: ?boolean,
httpOnly?: ?boolean,
expirationDate?: ?number,
}) => Promise<any>;
set: (
details: {
url: string,
@@ -2536,7 +2684,9 @@ declare module 'electron' {
},
callback: Function,
) => void;
remove: (url: string, name: string) => Promise<any>;
remove: (url: string, name: string, callback: Function) => void;
flushStore: () => Promise<any>;
flushStore: (callback: Function) => void;
on: (
eventName: 'changed',
@@ -2576,6 +2726,7 @@ declare module 'electron' {
commandParams?: ?{},
callback?: ?Function,
) => void;
sendCommand: (method: string, commandParams?: ?{}) => Promise<any>;
on: ((
eventName: 'detach',
callback: (event: Event, reason: string) => void,
@@ -2596,6 +2747,8 @@ declare module 'electron' {
declare class DownloadItem {
setSavePath: (path: string) => void;
getSavePath: () => string;
setSaveDialogOptions: (options: SaveDialogOptions) => void;
getSaveDialogOptions: () => SaveDialogOptions;
pause: () => void;
isPaused: () => boolean;
resume: () => void;
@@ -2658,7 +2811,7 @@ declare module 'electron' {
static getApplicationMenu: () => Menu | null;
static sendActionToFirstResponder: (action: string) => void;
static buildFromTemplate: (
template: Array<MenuItemConstructorOptions>,
template: Array<MenuItemConstructorOptions> | Array<MenuItem>,
) => Menu;
popup: (
options?: ?{
@@ -2694,7 +2847,38 @@ declare module 'electron' {
declare class MenuItem {
constructor(options: {
click?: ?Function,
role?: ?string,
role?:
| ?'undo'
| 'redo'
| 'cut'
| 'copy'
| 'paste'
| 'pasteandmatchstyle'
| 'delete'
| 'selectall'
| 'reload'
| 'forcereload'
| 'toggledevtools'
| 'resetzoom'
| 'zoomin'
| 'zoomout'
| 'togglefullscreen'
| 'window'
| 'minimize'
| 'close'
| 'help'
| 'about'
| 'services'
| 'hide'
| 'hideothers'
| 'unhide'
| 'quit'
| 'startspeaking'
| 'stopspeaking'
| 'close'
| 'minimize'
| 'zoom'
| 'front',
type?: ?'normal' | 'separator' | 'submenu' | 'checkbox' | 'radio',
label?: ?string,
sublabel?: ?string,
@@ -3021,7 +3205,7 @@ declare module 'electron' {
| Array<UploadBlob>,
baseURLForDataURL?: ?string,
},
) => void;
) => Promise<any>;
loadFile: (
filePath: string,
options?: ?{
@@ -3029,7 +3213,7 @@ declare module 'electron' {
search?: ?string,
hash?: ?string,
},
) => void;
) => Promise<any>;
downloadURL: (url: string) => void;
getURL: () => string;
getTitle: () => string;
@@ -3064,9 +3248,9 @@ declare module 'electron' {
isAudioMuted: () => boolean;
isCurrentlyAudible: () => boolean;
setZoomFactor: (factor: number) => void;
getZoomFactor: (callback: Function) => void;
getZoomFactor: () => number;
setZoomLevel: (level: number) => void;
getZoomLevel: (callback: Function) => void;
getZoomLevel: () => number;
setVisualZoomLevelLimits: (
minimumLevel: number,
maximumLevel: number,
@@ -3103,6 +3287,7 @@ declare module 'electron' {
) => void;
capturePage: ((rect?: ?Rectangle, callback: Function) => void) &
((callback: Function) => void);
capturePage: (rect?: ?Rectangle) => void;
hasServiceWorker: (callback: Function) => void;
unregisterServiceWorker: (callback: Function) => void;
getPrinters: () => Array<PrinterInfo>;
@@ -3131,6 +3316,7 @@ declare module 'electron' {
openDevTools: (
options?: ?{
mode: 'right' | 'bottom' | 'undocked' | 'detach',
activate?: ?boolean,
},
) => void;
closeDevTools: () => void;
@@ -3140,6 +3326,11 @@ declare module 'electron' {
inspectElement: (x: number, y: number) => void;
inspectServiceWorker: () => void;
send: (channel: string, ...args: Array<any>) => void;
sendToFrame: (
frameId: number,
channel: string,
...args: Array<any>
) => void;
enableDeviceEmulation: (parameters: {
screenPosition: 'desktop' | 'mobile',
screenSize: Size,
@@ -3235,6 +3426,10 @@ declare module 'electron' {
((eventName: 'did-start-loading', callback: () => void) => void) &
((eventName: 'did-stop-loading', callback: () => void) => void) &
((eventName: 'dom-ready', callback: (event: Event) => void) => void) &
((
eventName: 'page-title-updated',
callback: (event: Event, title: string, explicitSet: boolean) => void,
) => void) &
((
eventName: 'page-favicon-updated',
callback: (event: Event, favicons: Array<string>) => void,
@@ -3521,6 +3716,22 @@ declare module 'electron' {
sourceId: string,
) => void,
) => void) &
((
eventName: 'preload-error',
callback: (event: Event, preloadPath: string, error: Error) => void,
) => void) &
((
eventName: 'ipc-message',
callback: (event: Event, channel: string, ...args: Array<any>) => void,
) => void) &
((
eventName: 'ipc-message-sync',
callback: (event: Event, channel: string, ...args: Array<any>) => void,
) => void) &
((
eventName: 'desktop-capturer-get-sources',
callback: (event: Event) => void,
) => void) &
((
eventName: 'remote-require',
callback: (event: Event, moduleName: string) => void,
@@ -3570,6 +3781,10 @@ declare module 'electron' {
((eventName: 'did-start-loading', callback: () => void) => void) &
((eventName: 'did-stop-loading', callback: () => void) => void) &
((eventName: 'dom-ready', callback: (event: Event) => void) => void) &
((
eventName: 'page-title-updated',
callback: (event: Event, title: string, explicitSet: boolean) => void,
) => void) &
((
eventName: 'page-favicon-updated',
callback: (event: Event, favicons: Array<string>) => void,
@@ -3856,6 +4071,22 @@ declare module 'electron' {
sourceId: string,
) => void,
) => void) &
((
eventName: 'preload-error',
callback: (event: Event, preloadPath: string, error: Error) => void,
) => void) &
((
eventName: 'ipc-message',
callback: (event: Event, channel: string, ...args: Array<any>) => void,
) => void) &
((
eventName: 'ipc-message-sync',
callback: (event: Event, channel: string, ...args: Array<any>) => void,
) => void) &
((
eventName: 'desktop-capturer-get-sources',
callback: (event: Event) => void,
) => void) &
((
eventName: 'remote-require',
callback: (event: Event, moduleName: string) => void,
@@ -3886,58 +4117,58 @@ declare module 'electron' {
filter?: ?{
urls: Array<string>,
},
listener: Function,
listener: Function | null,
) => void) &
((listener: Function) => void);
((listener: Function | null) => void);
onBeforeSendHeaders: ((
filter?: ?{
urls: Array<string>,
},
listener: Function,
listener: Function | null,
) => void) &
((listener: Function) => void);
((listener: Function | null) => void);
onSendHeaders: ((
filter?: ?{
urls: Array<string>,
},
listener: Function,
listener: Function | null,
) => void) &
((listener: Function) => void);
((listener: Function | null) => void);
onHeadersReceived: ((
filter?: ?{
urls: Array<string>,
},
listener: Function,
listener: Function | null,
) => void) &
((listener: Function) => void);
((listener: Function | null) => void);
onResponseStarted: ((
filter?: ?{
urls: Array<string>,
},
listener: Function,
listener: Function | null,
) => void) &
((listener: Function) => void);
((listener: Function | null) => void);
onBeforeRedirect: ((
filter?: ?{
urls: Array<string>,
},
listener: Function,
listener: Function | null,
) => void) &
((listener: Function) => void);
((listener: Function | null) => void);
onCompleted: ((
filter?: ?{
urls: Array<string>,
},
listener: Function,
listener: Function | null,
) => void) &
((listener: Function) => void);
((listener: Function | null) => void);
onErrorOccurred: ((
filter?: ?{
urls: Array<string>,
},
listener: Function,
listener: Function | null,
) => void) &
((listener: Function) => void);
((listener: Function | null) => void);
}
declare class TouchBarButton {
constructor(options: {
@@ -4039,10 +4270,12 @@ declare module 'electron' {
size?: ?'small' | 'large' | 'flexible',
}): TouchBarSpacer;
}
declare type URL = any;
declare type Accelerator = any;
declare type WebFrame = any;
declare type ReadableStream = any;
declare type MenuItemConstructorOptions = any;
declare type SaveDialogOptions = any;
declare type Protocol = any;
declare type NetLog = any;
declare type TouchBarItem = any;

View File

@@ -36,7 +36,7 @@
]
},
"resolutions": {
"@jest-runner/electron/electron": "4.0.8"
"@jest-runner/electron/electron": "5.0.2"
},
"jest": {
"transform": {
@@ -50,9 +50,9 @@
}
},
"devDependencies": {
"@jest-runner/electron": "^1.1.1",
"@jest-runner/electron": "^2.0.1",
"babel-eslint": "^10.0.1",
"electron": "^4.0.8",
"electron": "^5.0.2",
"electron-builder": "^20.38.5",
"eslint": "^5.12.1",
"eslint-config-fbjs": "^2.0.1",

View File

@@ -127,7 +127,7 @@ export function setupMenuBar(
}
function appendMenuItem(
template: Array<MenuItem>,
template: Array<MenuItemConstructorOptions>,
actionHandler: (action: string) => void,
item: ?KeyboardAction,
) {
@@ -185,7 +185,7 @@ function getTemplate(
app: Object,
shell: Object,
store: Store,
): Array<MenuItem> {
): Array<MenuItemConstructorOptions> {
const exportSubmenu = [
{
label: 'File...',

View File

@@ -62,7 +62,7 @@ exports[`Empty app state matches snapshot 1`] = `
className="css-1swhxtd"
onClick={[Function]}
>
4.0.8-dev
5.0.2-dev
</span>
<div
className="css-1cecbfb"

View File

@@ -57,7 +57,7 @@ class UserAccount extends PureComponent<UserAccountProps> {
};
showDetails = () => {
const menuTemplate = [
const menuTemplate: Array<MenuItemConstructorOptions> = [
{
label: 'Sign Out',
click: this.props.logout,

View File

@@ -190,7 +190,7 @@ type Props = {
/**
* Dropdown menu template shown on click.
*/
dropdown?: Array<Electron$MenuItemOptions>,
dropdown?: Array<MenuItemConstructorOptions>,
/**
* Name of the icon dispalyed next to the text
*/

View File

@@ -9,7 +9,7 @@ import * as React from 'react';
import FlexColumn from './FlexColumn.js';
import PropTypes from 'prop-types';
export type MenuTemplate = Array<Electron$MenuItemOptions>;
export type MenuTemplate = Array<MenuItemConstructorOptions>;
type Props = {
/** List of items in the context menu. Used for static menus. */

View File

@@ -11,7 +11,7 @@ import electron from 'electron';
const PropTypes = require('prop-types');
type MenuTemplate = Array<Electron$MenuItemOptions>;
type MenuTemplate = Array<MenuItemConstructorOptions>;
const Container = styled('div')({
display: 'contents',

View File

@@ -178,17 +178,17 @@ const defaultValueExtractor: DataValueExtractor = (value: any) => {
const rootContextMenuCache: WeakMap<
Object,
Array<Electron$MenuItemOptions>,
Array<MenuItemConstructorOptions>,
> = new WeakMap();
function getRootContextMenu(data: Object): Array<Electron$MenuItemOptions> {
function getRootContextMenu(data: Object): Array<MenuItemConstructorOptions> {
const cached = rootContextMenuCache.get(data);
if (cached != null) {
return cached;
}
const stringValue = JSON.stringify(data, null, 2);
const menu: Array<Electron$MenuItemOptions> = [
const menu: Array<MenuItemConstructorOptions> = [
{
label: 'Copy entire tree',
click: () => clipboard.writeText(stringValue),

View File

@@ -221,7 +221,7 @@ class ElementsRow extends PureComponent<ElementsRowProps, ElementsRowState> {
interaction: (name: string, data: any) => void;
getContextMenu = (): Array<Electron$MenuItemOptions> => {
getContextMenu = (): Array<MenuItemConstructorOptions> => {
const {props} = this;
const items = [
{

View File

@@ -105,7 +105,7 @@ export default class FilterToken extends PureComponent<Props> {
};
showDetails = () => {
const menuTemplate = [];
const menuTemplate: Array<MenuItemConstructorOptions> = [];
if (this.props.filter.type === 'enum') {
menuTemplate.push(

View File

@@ -469,7 +469,7 @@ class ManagedTable extends React.Component<
clipboard.writeText(cellText);
};
buildContextMenuItems: () => Array<Electron$MenuItemOptions> = () => {
buildContextMenuItems: () => Array<MenuItemConstructorOptions> = () => {
const {highlightedRows} = this.state;
if (highlightedRows.size === 0) {
return [];

View File

@@ -25,7 +25,7 @@ import FlexRow from '../FlexRow.js';
const invariant = require('invariant');
type MenuTemplate = Array<Electron$MenuItemOptions>;
type MenuTemplate = Array<MenuItemConstructorOptions>;
const TableHeaderArrow = styled('span')({
float: 'right',

View File

@@ -251,6 +251,7 @@ function tryCreateWindow() {
webSecurity: false,
scrollBounce: true,
experimentalFeatures: true,
nodeIntegration: true,
},
});
win.once('ready-to-show', () => win.show());

View File

@@ -900,38 +900,39 @@
version "0.8.1"
resolved "https://registry.yarnpkg.com/@emotion/utils/-/utils-0.8.1.tgz#f3a81587ad8d0ef33cdad6f3b4310774fcc1053e"
"@jest-runner/core@^1.0.2":
version "1.0.2"
resolved "https://registry.yarnpkg.com/@jest-runner/core/-/core-1.0.2.tgz#0e21d082c4b3489c8e632a4a722168826fae40b0"
integrity sha512-LR4XiSFawSWO9qyx4/J7D09XTy0PKDvSf3maXXXkxlPavcjUOnsmL5ReI86LJ4YyxJCFSKpQj3eriZSGqrjcng==
"@jest-runner/core@^2.0.0":
version "2.0.0"
resolved "https://registry.yarnpkg.com/@jest-runner/core/-/core-2.0.0.tgz#444d0351d0872c0981ee4e87252ccb408cf27543"
integrity sha512-EEc+W5t1hj0uNga8aoEkrBhLnrXS7JBxTabkTz+29VrUxBjCfgKSas+lLaqS+bnqIknRHoKrhZ3N6PIXungDdw==
dependencies:
jest-message-util "^24.0.0"
node-ipc "^9.1.1"
"@jest-runner/electron@^1.1.1":
version "1.1.1"
resolved "https://registry.yarnpkg.com/@jest-runner/electron/-/electron-1.1.1.tgz#01b7b15435306da0aee235763bae584d532dea86"
integrity sha512-+yfDVoOzuuhubSG9oRENrv0muPuqQvVz8bIqb/tW/omSwi5WGZY5zENFr27043nnTx7cNxTWu/6soAHZM/ELIg==
"@jest-runner/electron@^2.0.1":
version "2.0.1"
resolved "https://registry.yarnpkg.com/@jest-runner/electron/-/electron-2.0.1.tgz#083003afccfe066ceefe37007081951c4ea60509"
integrity sha512-py1YWlRnvMTJXjdJQP2uWD4/MWDVyl7UkXTQ3LnAjamlS2ct+9R4tUBME3ZG3caW2jjNn7zsjYoqCb+nSNhd+A==
dependencies:
"@jest-runner/core" "^1.0.2"
"@jest-runner/rpc" "^1.1.0"
electron "^2.0.8"
"@jest-runner/core" "^2.0.0"
"@jest-runner/rpc" "^2.0.0"
jest-haste-map "^24.0.0"
jest-mock "^24.0.0"
jest-runner "^24.0.0"
jest-runtime "^24.0.0"
jest-util "^24.0.0"
throat "^4.1.0"
"@jest-runner/rpc@^1.1.0":
version "1.1.0"
resolved "https://registry.yarnpkg.com/@jest-runner/rpc/-/rpc-1.1.0.tgz#fa998ec51779d9cf17ebc49800fd68faa08a3b90"
integrity sha512-u7ZCQ1MpTPPCy12xQXm9K1LNZbUHWsttm7JPLuH+SP5JgU+5+WykCOBIKJ33giITHNj8tib/DGxiXWWkVo7VYw==
"@jest-runner/rpc@^2.0.0":
version "2.0.0"
resolved "https://registry.yarnpkg.com/@jest-runner/rpc/-/rpc-2.0.0.tgz#aebbd8a1fae96b37acfb28da8ce9b1ab9a90dfc0"
integrity sha512-EP1ljCKb0Z3hWlDgFv5MW0PTogs5MOh8EFb5lsS/UP72R6fM4cYlE3GT3xYaGjZS8vawCgSqF475TRK8noDAFA==
dependencies:
"@jest-runner/core" "^1.0.2"
"@jest-runner/core" "^2.0.0"
glob "^7.1.3"
jscodeshift "^0.6.3"
node-ipc "^9.1.1"
prettier "^1.14.2"
uuid "^3.3.2"
yargs "^12.0.1"
"@jest/console@^24.7.1":
@@ -2740,10 +2741,10 @@ electron-to-chromium@^1.3.122:
resolved "https://registry.yarnpkg.com/electron-to-chromium/-/electron-to-chromium-1.3.124.tgz#861fc0148748a11b3e5ccebdf8b795ff513fa11f"
integrity sha512-glecGr/kFdfeXUHOHAWvGcXrxNU+1wSO/t5B23tT1dtlvYB26GY8aHzZSWD7HqhqC800Lr+w/hQul6C5AF542w==
electron@4.0.8, electron@^2.0.8, electron@^4.0.8:
version "4.0.8"
resolved "https://registry.yarnpkg.com/electron/-/electron-4.0.8.tgz#b7998b16543d2094f081757a0c5afdb8875ea510"
integrity sha512-FOBJIHkuv8wc15N+ZyqwDzPavYVu5CHMBEf14jHDWv7QW2vkEIpJjVK+PIT31kfZfvjsIP0j2wvA/FBsiqB7pw==
electron@5.0.2, electron@^5.0.2:
version "5.0.2"
resolved "https://registry.yarnpkg.com/electron/-/electron-5.0.2.tgz#0f6b38ae7e344b94f433d9171e50568f56962fc7"
integrity sha512-bUHKQhyuOen/q8iHTkrnzqB9CAwBDI+vHbeu21kpq2bqAD+t25yfrmUEcYHaPL4fZOAhk6nnRqskF6/Xd+aZxg==
dependencies:
"@types/node" "^10.12.18"
electron-download "^4.1.0"
@@ -7632,7 +7633,7 @@ text-table@^0.2.0:
resolved "https://registry.yarnpkg.com/text-table/-/text-table-0.2.0.tgz#7f5ee823ae805207c00af2df4a84ec3fcfa570b4"
integrity sha1-f17oI66AUgfACvLfSoTsP8+lcLQ=
throat@^4.0.0:
throat@^4.0.0, throat@^4.1.0:
version "4.1.0"
resolved "https://registry.yarnpkg.com/throat/-/throat-4.1.0.tgz#89037cbc92c56ab18926e6ba4cbb200e15672a6a"
integrity sha1-iQN8vJLFarGJJua6TLsgDhVnKmo=