electron update

Summary:
Started with upgrading electron from 3.0.0 to 4.0.5. This required a bunch of subsequent updates:
* upgrading `electron-builder` to latest version, because the old version couldn't build electron 4 apps.
  * `appDir` is deprecated in builder config, `projectDir` is used instead, which we already had set, so its fine to just remove this ([see GitHub commit](a5e457163e)).
* upgrading `jest-runner/electron` because the old version couldn't run electron 4 tests.
  * upgrading our custom dependency resolution to use electron 4.0.5, because the test runner still resolves to 2.0.8 ([see GitHub issue](https://github.com/facebook-atom/jest-electron-runner/issues/31)).
* updating `sandcastle.sh` to use the new cache files from D14131344.
* removing `package-lock.json` as is was causing warnings. We use `yarn` and `yarn.lock` anyways. This file must have been committed by accident.
* updating our check to only run one version of Flipper at a time to use the new electron API `app.requestSingleInstanceLock` as the old one was removed in electron 4.
* updating the snapshot test that checks App rendering, which changed a little due to the electron upgrade.
* upgrading flow-type definitions to `electron-v4.0.5.js` generated by [electron-flowtype-definitions](https://github.com/danielbuechele/electron-flowtype-definitions).

**PS: Best new feature in Electron 4: Copy&paste working in dev tools**

Reviewed By: jknoxville

Differential Revision: D14131360

fbshipit-source-id: d7ed9643875629a1fa1860bb61b11dd0c64112ab
This commit is contained in:
Daniel Büchele
2019-02-21 02:43:37 -08:00
committed by Facebook Github Bot
parent 0a59dc2918
commit 13f7444013
9 changed files with 1279 additions and 11195 deletions

View File

@@ -5,7 +5,7 @@
* @format * @format
* @flow * @flow
* *
* This is an autogenerated libdef for: electron-v3.0.0-beta.4 renderer process * This is an autogenerated libdef for: electron-v4.0.5 renderer process
*/ */
declare module 'electron' { declare module 'electron' {
@@ -45,7 +45,7 @@ declare module 'electron' {
}, },
crashReporter: { crashReporter: {
start: (options: { start: (options: {
companyName?: ?string, companyName: string,
submitURL: string, submitURL: string,
productName?: ?string, productName?: ?string,
uploadToServer?: ?boolean, uploadToServer?: ?boolean,
@@ -77,7 +77,11 @@ declare module 'electron' {
removeAllListeners: (channel: string) => void, removeAllListeners: (channel: string) => void,
send: (channel: string, ...args: Array<any>) => void, send: (channel: string, ...args: Array<any>) => void,
sendSync: (channel: string, ...args: Array<any>) => any, sendSync: (channel: string, ...args: Array<any>) => any,
sendTo: (windowId: number, channel: string, ...args: Array<any>) => void, sendTo: (
webContentsId: number,
channel: string,
...args: Array<any>
) => void,
sendToHost: (channel: string, ...args: Array<any>) => void, sendToHost: (channel: string, ...args: Array<any>) => void,
}, },
nativeImage: { nativeImage: {
@@ -99,6 +103,7 @@ declare module 'electron' {
}, },
process: { process: {
crash: () => void, crash: () => void,
getCreationTime: () => number | null,
getCPUUsage: () => CPUUsage, getCPUUsage: () => CPUUsage,
getIOCounters: () => IOCounters, getIOCounters: () => IOCounters,
getHeapStatistics: () => { getHeapStatistics: () => {
@@ -113,10 +118,9 @@ declare module 'electron' {
doesZapGarbage: boolean, doesZapGarbage: boolean,
}, },
getProcessMemoryInfo: () => { getProcessMemoryInfo: () => {
workingSetSize: number, residentSet: number,
peakWorkingSetSize: number, private: number,
privateBytes: number, shared: number,
sharedBytes: number,
}, },
getSystemMemoryInfo: () => { getSystemMemoryInfo: () => {
total: number, total: number,
@@ -124,6 +128,7 @@ declare module 'electron' {
swapTotal: number, swapTotal: number,
swapFree: number, swapFree: number,
}, },
takeHeapSnapshot: (filePath: string) => boolean,
hang: () => void, hang: () => void,
setFdLimit: (maxDescriptors: number) => void, setFdLimit: (maxDescriptors: number) => void,
on: (eventName: 'loaded', callback: () => void) => void, on: (eventName: 'loaded', callback: () => void) => void,
@@ -133,6 +138,7 @@ declare module 'electron' {
noAsar?: ?boolean, noAsar?: ?boolean,
noDeprecation?: ?boolean, noDeprecation?: ?boolean,
resourcesPath?: ?string, resourcesPath?: ?string,
sandboxed?: ?boolean,
throwDeprecation?: ?boolean, throwDeprecation?: ?boolean,
traceDeprecation?: ?boolean, traceDeprecation?: ?boolean,
traceProcessWarnings?: ?boolean, traceProcessWarnings?: ?boolean,
@@ -223,6 +229,7 @@ declare module 'electron' {
disableDomainBlockingFor3DAPIs: () => void, disableDomainBlockingFor3DAPIs: () => void,
getAppMetrics: () => Array<ProcessMetric>, getAppMetrics: () => Array<ProcessMetric>,
getGPUFeatureStatus: () => GPUFeatureStatus, getGPUFeatureStatus: () => GPUFeatureStatus,
getGPUInfo: (infoType: string) => Promise<any>,
setBadgeCount: (count: number) => boolean, setBadgeCount: (count: number) => boolean,
getBadgeCount: () => number, getBadgeCount: () => number,
isUnityRunning: () => boolean, isUnityRunning: () => boolean,
@@ -250,6 +257,7 @@ declare module 'electron' {
}) => void, }) => void,
isAccessibilitySupportEnabled: () => boolean, isAccessibilitySupportEnabled: () => boolean,
setAccessibilitySupportEnabled: (enabled: boolean) => void, setAccessibilitySupportEnabled: (enabled: boolean) => void,
showAboutPanel: () => void,
setAboutPanelOptions: (options: { setAboutPanelOptions: (options: {
applicationName?: ?string, applicationName?: ?string,
applicationVersion?: ?string, applicationVersion?: ?string,
@@ -260,6 +268,7 @@ declare module 'electron' {
startAccessingSecurityScopedResource: ( startAccessingSecurityScopedResource: (
bookmarkData: string, bookmarkData: string,
) => Function, ) => Function,
enableSandbox: () => void,
enableMixedSandbox: () => void, enableMixedSandbox: () => void,
isInApplicationsFolder: () => boolean, isInApplicationsFolder: () => boolean,
moveToApplicationsFolder: () => boolean, moveToApplicationsFolder: () => boolean,
@@ -384,7 +393,7 @@ declare module 'electron' {
) => void) & ) => void) &
(( ((
eventName: 'session-created', eventName: 'session-created',
callback: (event: Event, session: Session) => void, callback: (session: Session) => void,
) => void) & ) => void) &
(( ((
eventName: 'second-instance', eventName: 'second-instance',
@@ -393,6 +402,46 @@ declare module 'electron' {
argv: Array<string>, argv: Array<string>,
workingDirectory: string, workingDirectory: string,
) => void, ) => void,
) => void) &
((
eventName: 'remote-require',
callback: (
event: Event,
webContents: WebContents,
moduleName: string,
) => void,
) => void) &
((
eventName: 'remote-get-global',
callback: (
event: Event,
webContents: WebContents,
globalName: string,
) => void,
) => void) &
((
eventName: 'remote-get-builtin',
callback: (
event: Event,
webContents: WebContents,
moduleName: string,
) => void,
) => void) &
((
eventName: 'remote-get-current-window',
callback: (event: Event, webContents: WebContents) => void,
) => void) &
((
eventName: 'remote-get-current-web-contents',
callback: (event: Event, webContents: WebContents) => void,
) => void) &
((
eventName: 'remote-get-guest-web-contents',
callback: (
event: Event,
webContents: WebContents,
guestWebContents: WebContents,
) => void,
) => void), ) => void),
once: (( once: ((
eventName: 'will-finish-launching', eventName: 'will-finish-launching',
@@ -515,7 +564,7 @@ declare module 'electron' {
) => void) & ) => void) &
(( ((
eventName: 'session-created', eventName: 'session-created',
callback: (event: Event, session: Session) => void, callback: (session: Session) => void,
) => void) & ) => void) &
(( ((
eventName: 'second-instance', eventName: 'second-instance',
@@ -524,6 +573,46 @@ declare module 'electron' {
argv: Array<string>, argv: Array<string>,
workingDirectory: string, workingDirectory: string,
) => void, ) => void,
) => void) &
((
eventName: 'remote-require',
callback: (
event: Event,
webContents: WebContents,
moduleName: string,
) => void,
) => void) &
((
eventName: 'remote-get-global',
callback: (
event: Event,
webContents: WebContents,
globalName: string,
) => void,
) => void) &
((
eventName: 'remote-get-builtin',
callback: (
event: Event,
webContents: WebContents,
moduleName: string,
) => void,
) => void) &
((
eventName: 'remote-get-current-window',
callback: (event: Event, webContents: WebContents) => void,
) => void) &
((
eventName: 'remote-get-current-web-contents',
callback: (event: Event, webContents: WebContents) => void,
) => void) &
((
eventName: 'remote-get-guest-web-contents',
callback: (
event: Event,
webContents: WebContents,
guestWebContents: WebContents,
) => void,
) => void), ) => void),
isPackaged?: ?boolean, isPackaged?: ?boolean,
commandLine: { commandLine: {
@@ -619,10 +708,7 @@ declare module 'electron' {
contentTracing: { contentTracing: {
getCategories: (callback: Function) => void, getCategories: (callback: Function) => void,
startRecording: ( startRecording: (
options: { options: TraceCategoriesAndOptions | TraceConfig,
categoryFilter: string,
traceOptions: string,
},
callback: Function, callback: Function,
) => void, ) => void,
stopRecording: (resultFilePath: string, callback: Function) => void, stopRecording: (resultFilePath: string, callback: Function) => void,
@@ -642,7 +728,7 @@ declare module 'electron' {
}, },
crashReporter: { crashReporter: {
start: (options: { start: (options: {
companyName?: ?string, companyName: string,
submitURL: string, submitURL: string,
productName?: ?string, productName?: ?string,
uploadToServer?: ?boolean, uploadToServer?: ?boolean,
@@ -864,6 +950,7 @@ declare module 'electron' {
}, },
process: { process: {
crash: () => void, crash: () => void,
getCreationTime: () => number | null,
getCPUUsage: () => CPUUsage, getCPUUsage: () => CPUUsage,
getIOCounters: () => IOCounters, getIOCounters: () => IOCounters,
getHeapStatistics: () => { getHeapStatistics: () => {
@@ -878,10 +965,9 @@ declare module 'electron' {
doesZapGarbage: boolean, doesZapGarbage: boolean,
}, },
getProcessMemoryInfo: () => { getProcessMemoryInfo: () => {
workingSetSize: number, residentSet: number,
peakWorkingSetSize: number, private: number,
privateBytes: number, shared: number,
sharedBytes: number,
}, },
getSystemMemoryInfo: () => { getSystemMemoryInfo: () => {
total: number, total: number,
@@ -889,6 +975,7 @@ declare module 'electron' {
swapTotal: number, swapTotal: number,
swapFree: number, swapFree: number,
}, },
takeHeapSnapshot: (filePath: string) => boolean,
hang: () => void, hang: () => void,
setFdLimit: (maxDescriptors: number) => void, setFdLimit: (maxDescriptors: number) => void,
on: (eventName: 'loaded', callback: () => void) => void, on: (eventName: 'loaded', callback: () => void) => void,
@@ -898,6 +985,7 @@ declare module 'electron' {
noAsar?: ?boolean, noAsar?: ?boolean,
noDeprecation?: ?boolean, noDeprecation?: ?boolean,
resourcesPath?: ?string, resourcesPath?: ?string,
sandboxed?: ?boolean,
throwDeprecation?: ?boolean, throwDeprecation?: ?boolean,
traceDeprecation?: ?boolean, traceDeprecation?: ?boolean,
traceProcessWarnings?: ?boolean, traceProcessWarnings?: ?boolean,
@@ -978,8 +1066,14 @@ declare module 'electron' {
getDisplayMatching: (rect: Rectangle) => Display, getDisplayMatching: (rect: Rectangle) => Display,
screenToDipPoint: (point: Point) => Point, screenToDipPoint: (point: Point) => Point,
dipToScreenPoint: (point: Point) => Point, dipToScreenPoint: (point: Point) => Point,
screenToDipRect: (window: BrowserWindow, rect: Rectangle) => Rectangle, screenToDipRect: (
dipToScreenRect: (window: BrowserWindow, rect: Rectangle) => Rectangle, window: BrowserWindow | null,
rect: Rectangle,
) => Rectangle,
dipToScreenRect: (
window: BrowserWindow | null,
rect: Rectangle,
) => Rectangle,
on: (( on: ((
eventName: 'display-added', eventName: 'display-added',
callback: (event: Event, newDisplay: Display) => void, callback: (event: Event, newDisplay: Display) => void,
@@ -1028,7 +1122,8 @@ declare module 'electron' {
openExternal: ( openExternal: (
url: string, url: string,
options?: ?{ options?: ?{
activate: boolean, activate?: ?boolean,
workingDirectory?: ?string,
}, },
callback?: ?Function, callback?: ?Function,
) => boolean, ) => boolean,
@@ -1047,8 +1142,11 @@ declare module 'electron' {
postNotification: (event: string, userInfo: {}) => void, postNotification: (event: string, userInfo: {}) => void,
postLocalNotification: (event: string, userInfo: {}) => void, postLocalNotification: (event: string, userInfo: {}) => void,
postWorkspaceNotification: (event: string, userInfo: {}) => void, postWorkspaceNotification: (event: string, userInfo: {}) => void,
subscribeNotification: (event: string, callback: Function) => void, subscribeNotification: (event: string, callback: Function) => number,
subscribeLocalNotification: (event: string, callback: Function) => void, subscribeLocalNotification: (
event: string,
callback: Function,
) => number,
subscribeWorkspaceNotification: ( subscribeWorkspaceNotification: (
event: string, event: string,
callback: Function, callback: Function,
@@ -1107,6 +1205,14 @@ declare module 'electron' {
| 'window-text', | 'window-text',
) => string, ) => string,
isInvertedColorScheme: () => boolean, isInvertedColorScheme: () => boolean,
getEffectiveAppearance: () => 'dark' | 'light' | 'unknown',
getAppLevelAppearance: () => 'dark' | 'light' | 'unknown',
setAppLevelAppearance: (appearance: string | null) => void,
isTrustedAccessibilityClient: (prompt: boolean) => boolean,
getMediaAccessStatus: (
mediaType: string,
) => 'not-determined' | 'granted' | 'denied' | 'restricted' | 'unknown',
askForMediaAccess: (mediaType: 'microphone' | 'camera') => Promise<any>,
on: (( on: ((
eventName: 'accent-color-changed', eventName: 'accent-color-changed',
callback: (event: Event, newColor: string) => void, callback: (event: Event, newColor: string) => void,
@@ -1118,6 +1224,10 @@ declare module 'electron' {
(( ((
eventName: 'inverted-color-scheme-changed', eventName: 'inverted-color-scheme-changed',
callback: (event: Event, invertedColorScheme: boolean) => void, callback: (event: Event, invertedColorScheme: boolean) => void,
) => void) &
((
eventName: 'appearance-changed',
callback: (newAppearance: 'dark' | 'light') => void,
) => void), ) => void),
once: (( once: ((
eventName: 'accent-color-changed', eventName: 'accent-color-changed',
@@ -1130,6 +1240,10 @@ declare module 'electron' {
(( ((
eventName: 'inverted-color-scheme-changed', eventName: 'inverted-color-scheme-changed',
callback: (event: Event, invertedColorScheme: boolean) => void, callback: (event: Event, invertedColorScheme: boolean) => void,
) => void) &
((
eventName: 'appearance-changed',
callback: (newAppearance: 'dark' | 'light') => void,
) => void), ) => void),
}, },
webContents: { webContents: {
@@ -1162,8 +1276,14 @@ declare module 'electron' {
getDisplayMatching: (rect: Rectangle) => Display, getDisplayMatching: (rect: Rectangle) => Display,
screenToDipPoint: (point: Point) => Point, screenToDipPoint: (point: Point) => Point,
dipToScreenPoint: (point: Point) => Point, dipToScreenPoint: (point: Point) => Point,
screenToDipRect: (window: BrowserWindow, rect: Rectangle) => Rectangle, screenToDipRect: (
dipToScreenRect: (window: BrowserWindow, rect: Rectangle) => Rectangle, window: BrowserWindow | null,
rect: Rectangle,
) => Rectangle,
dipToScreenRect: (
window: BrowserWindow | null,
rect: Rectangle,
) => Rectangle,
on: (( on: ((
eventName: 'display-added', eventName: 'display-added',
callback: (event: Event, newDisplay: Display) => void, callback: (event: Event, newDisplay: Display) => void,
@@ -1203,7 +1323,8 @@ declare module 'electron' {
openExternal: ( openExternal: (
url: string, url: string,
options?: ?{ options?: ?{
activate: boolean, activate?: ?boolean,
workingDirectory?: ?string,
}, },
callback?: ?Function, callback?: ?Function,
) => boolean, ) => boolean,
@@ -1273,6 +1394,7 @@ declare module 'electron' {
) => void, ) => void,
getResourceUsage: () => { getResourceUsage: () => {
images: MemoryUsageDetails, images: MemoryUsageDetails,
scripts: MemoryUsageDetails,
cssStyleSheets: MemoryUsageDetails, cssStyleSheets: MemoryUsageDetails,
xslStyleSheets: MemoryUsageDetails, xslStyleSheets: MemoryUsageDetails,
fonts: MemoryUsageDetails, fonts: MemoryUsageDetails,
@@ -1426,7 +1548,6 @@ declare module 'electron' {
declare type ProcessMetric = { declare type ProcessMetric = {
pid: number, pid: number,
type: string, type: string,
memory: MemoryInfo,
cpu: CPUUsage, cpu: CPUUsage,
}; };
declare type Product = { declare type Product = {
@@ -1510,6 +1631,15 @@ declare module 'electron' {
tooltip?: ?string, tooltip?: ?string,
flags?: ?Array<string>, flags?: ?Array<string>,
}; };
declare type TraceCategoriesAndOptions = {
categoryFilter: string,
traceOptions: string,
};
declare type TraceConfig = {
included_categories?: ?Array<string>,
excluded_categories?: ?Array<string>,
memory_dump_config?: ?{},
};
declare type Transaction = { declare type Transaction = {
transactionIdentifier: string, transactionIdentifier: string,
transactionDate: string, transactionDate: string,
@@ -1566,9 +1696,11 @@ declare module 'electron' {
baseURLForDataURL?: ?string, baseURLForDataURL?: ?string,
}, },
) => void; ) => void;
downloadURL: (url: string) => void;
getURL: () => string; getURL: () => string;
getTitle: () => string; getTitle: () => string;
isLoading: () => boolean; isLoading: () => boolean;
isLoadingMainFrame: () => boolean;
isWaitingForResponse: () => boolean; isWaitingForResponse: () => boolean;
stop: () => void; stop: () => void;
reload: () => void; reload: () => void;
@@ -1598,6 +1730,7 @@ declare module 'electron' {
inspectServiceWorker: () => void; inspectServiceWorker: () => void;
setAudioMuted: (muted: boolean) => void; setAudioMuted: (muted: boolean) => void;
isAudioMuted: () => boolean; isAudioMuted: () => boolean;
isCurrentlyAudible: () => boolean;
undo: () => void; undo: () => void;
redo: () => void; redo: () => void;
cut: () => void; cut: () => void;
@@ -1633,7 +1766,7 @@ declare module 'electron' {
printToPDF: ( printToPDF: (
options: { options: {
marginsType?: ?number, marginsType?: ?number,
pageSize?: ?string, pageSize?: ?string | Size,
printBackground?: ?boolean, printBackground?: ?boolean,
printSelectionOnly?: ?boolean, printSelectionOnly?: ?boolean,
landscape?: ?boolean, landscape?: ?boolean,
@@ -1646,6 +1779,16 @@ declare module 'electron' {
sendInputEvent: (event: {}) => void; sendInputEvent: (event: {}) => void;
setZoomFactor: (factor: number) => void; setZoomFactor: (factor: number) => void;
setZoomLevel: (level: number) => void; setZoomLevel: (level: number) => void;
getZoomFactor: (callback: Function) => void;
getZoomLevel: (callback: Function) => void;
setVisualZoomLevelLimits: (
minimumLevel: number,
maximumLevel: number,
) => void;
setLayoutZoomLevelLimits: (
minimumLevel: number,
maximumLevel: number,
) => void;
showDefinitionForSelection: () => void; showDefinitionForSelection: () => void;
getWebContents: () => WebContents; getWebContents: () => WebContents;
on: (( on: ((
@@ -1928,6 +2071,7 @@ declare module 'electron' {
nodeIntegrationInWorker?: ?boolean, nodeIntegrationInWorker?: ?boolean,
preload?: ?string, preload?: ?string,
sandbox?: ?boolean, sandbox?: ?boolean,
enableRemoteModule?: ?boolean,
session?: ?Session, session?: ?Session,
partition?: ?string, partition?: ?string,
affinity?: ?string, affinity?: ?string,
@@ -1941,7 +2085,6 @@ declare module 'electron' {
webaudio?: ?boolean, webaudio?: ?boolean,
plugins?: ?boolean, plugins?: ?boolean,
experimentalFeatures?: ?boolean, experimentalFeatures?: ?boolean,
experimentalCanvasFeatures?: ?boolean,
scrollBounce?: ?boolean, scrollBounce?: ?boolean,
enableBlinkFeatures?: ?string, enableBlinkFeatures?: ?string,
disableBlinkFeatures?: ?string, disableBlinkFeatures?: ?string,
@@ -2001,13 +2144,16 @@ declare module 'electron' {
isFullScreen: () => boolean; isFullScreen: () => boolean;
setSimpleFullScreen: (flag: boolean) => void; setSimpleFullScreen: (flag: boolean) => void;
isSimpleFullScreen: () => boolean; isSimpleFullScreen: () => boolean;
isNormal: () => boolean;
setAspectRatio: (aspectRatio: number, extraSize: Size) => void; setAspectRatio: (aspectRatio: number, extraSize: Size) => void;
setBackgroundColor: (backgroundColor: string) => void;
previewFile: (path: string, displayName?: ?string) => void; previewFile: (path: string, displayName?: ?string) => void;
closeFilePreview: () => void; closeFilePreview: () => void;
setBounds: (bounds: Rectangle, animate?: ?boolean) => void; setBounds: (bounds: Rectangle, animate?: ?boolean) => void;
getBounds: () => Rectangle; getBounds: () => Rectangle;
setContentBounds: (bounds: Rectangle, animate?: ?boolean) => void; setContentBounds: (bounds: Rectangle, animate?: ?boolean) => void;
getContentBounds: () => Rectangle; getContentBounds: () => Rectangle;
getNormalBounds: () => Rectangle;
setEnabled: (enable: boolean) => void; setEnabled: (enable: boolean) => void;
setSize: (width: number, height: number, animate?: ?boolean) => void; setSize: (width: number, height: number, animate?: ?boolean) => void;
getSize: () => Array<number>; getSize: () => Array<number>;
@@ -2080,7 +2226,14 @@ declare module 'electron' {
baseURLForDataURL?: ?string, baseURLForDataURL?: ?string,
}, },
) => void; ) => void;
loadFile: (filePath: string) => void; loadFile: (
filePath: string,
options?: ?{
query?: ?{},
search?: ?string,
hash?: ?string,
},
) => void;
reload: () => void; reload: () => void;
setMenu: (menu: Menu | null) => void; setMenu: (menu: Menu | null) => void;
setProgressBar: ( setProgressBar: (
@@ -2094,6 +2247,7 @@ declare module 'electron' {
hasShadow: () => boolean; hasShadow: () => boolean;
setOpacity: (opacity: number) => void; setOpacity: (opacity: number) => void;
getOpacity: () => number; getOpacity: () => number;
setShape: (rects: Array<Rectangle>) => void;
setThumbarButtons: (buttons: Array<ThumbarButton>) => boolean; setThumbarButtons: (buttons: Array<ThumbarButton>) => boolean;
setThumbnailClip: (region: Rectangle) => void; setThumbnailClip: (region: Rectangle) => void;
setThumbnailToolTip: (toolTip: string) => void; setThumbnailToolTip: (toolTip: string) => void;
@@ -2106,11 +2260,17 @@ declare module 'electron' {
}) => void; }) => void;
showDefinitionForSelection: () => void; showDefinitionForSelection: () => void;
setIcon: (icon: NativeImage) => void; setIcon: (icon: NativeImage) => void;
setWindowButtonVisibility: (visible: boolean) => void;
setAutoHideMenuBar: (hide: boolean) => void; setAutoHideMenuBar: (hide: boolean) => void;
isMenuBarAutoHide: () => boolean; isMenuBarAutoHide: () => boolean;
setMenuBarVisibility: (visible: boolean) => void; setMenuBarVisibility: (visible: boolean) => void;
isMenuBarVisible: () => boolean; isMenuBarVisible: () => boolean;
setVisibleOnAllWorkspaces: (visible: boolean) => void; setVisibleOnAllWorkspaces: (
visible: boolean,
options?: ?{
visibleOnFullScreen?: ?boolean,
},
) => void;
isVisibleOnAllWorkspaces: () => boolean; isVisibleOnAllWorkspaces: () => boolean;
setIgnoreMouseEvents: ( setIgnoreMouseEvents: (
ignore: boolean, ignore: boolean,
@@ -2166,13 +2326,25 @@ declare module 'electron' {
((eventName: 'unmaximize', callback: () => void) => void) & ((eventName: 'unmaximize', callback: () => void) => void) &
((eventName: 'minimize', callback: () => void) => void) & ((eventName: 'minimize', callback: () => void) => void) &
((eventName: 'restore', callback: () => void) => void) & ((eventName: 'restore', callback: () => void) => void) &
((
eventName: 'will-resize',
callback: (event: Event, newBounds: Rectangle) => void,
) => void) &
((eventName: 'resize', callback: () => void) => void) & ((eventName: 'resize', callback: () => void) => void) &
((
eventName: 'will-move',
callback: (event: Event, newBounds: Rectangle) => void,
) => void) &
((eventName: 'move', callback: () => void) => void) & ((eventName: 'move', callback: () => void) => void) &
((eventName: 'moved', callback: () => void) => void) & ((eventName: 'moved', callback: () => void) => void) &
((eventName: 'enter-full-screen', callback: () => void) => void) & ((eventName: 'enter-full-screen', callback: () => void) => void) &
((eventName: 'leave-full-screen', callback: () => void) => void) & ((eventName: 'leave-full-screen', callback: () => void) => void) &
((eventName: 'enter-html-full-screen', callback: () => void) => void) & ((eventName: 'enter-html-full-screen', callback: () => void) => void) &
((eventName: 'leave-html-full-screen', callback: () => void) => void) & ((eventName: 'leave-html-full-screen', callback: () => void) => void) &
((
eventName: 'always-on-top-changed',
callback: (event: Event, isAlwaysOnTop: boolean) => void,
) => void) &
(( ((
eventName: 'app-command', eventName: 'app-command',
callback: (event: Event, command: string) => void, callback: (event: Event, command: string) => void,
@@ -2205,13 +2377,25 @@ declare module 'electron' {
((eventName: 'unmaximize', callback: () => void) => void) & ((eventName: 'unmaximize', callback: () => void) => void) &
((eventName: 'minimize', callback: () => void) => void) & ((eventName: 'minimize', callback: () => void) => void) &
((eventName: 'restore', callback: () => void) => void) & ((eventName: 'restore', callback: () => void) => void) &
((
eventName: 'will-resize',
callback: (event: Event, newBounds: Rectangle) => void,
) => void) &
((eventName: 'resize', callback: () => void) => void) & ((eventName: 'resize', callback: () => void) => void) &
((
eventName: 'will-move',
callback: (event: Event, newBounds: Rectangle) => void,
) => void) &
((eventName: 'move', callback: () => void) => void) & ((eventName: 'move', callback: () => void) => void) &
((eventName: 'moved', callback: () => void) => void) & ((eventName: 'moved', callback: () => void) => void) &
((eventName: 'enter-full-screen', callback: () => void) => void) & ((eventName: 'enter-full-screen', callback: () => void) => void) &
((eventName: 'leave-full-screen', callback: () => void) => void) & ((eventName: 'leave-full-screen', callback: () => void) => void) &
((eventName: 'enter-html-full-screen', callback: () => void) => void) & ((eventName: 'enter-html-full-screen', callback: () => void) => void) &
((eventName: 'leave-html-full-screen', callback: () => void) => void) & ((eventName: 'leave-html-full-screen', callback: () => void) => void) &
((
eventName: 'always-on-top-changed',
callback: (event: Event, isAlwaysOnTop: boolean) => void,
) => void) &
(( ((
eventName: 'app-command', eventName: 'app-command',
callback: (event: Event, command: string) => void, callback: (event: Event, command: string) => void,
@@ -2259,6 +2443,12 @@ declare module 'electron' {
((callback?: ?Function) => void)); ((callback?: ?Function) => void));
abort: () => void; abort: () => void;
followRedirect: () => void; followRedirect: () => void;
getUploadProgress: () => {
active: boolean,
started: boolean,
current: number,
total: number,
};
chunkedEncoding: boolean; chunkedEncoding: boolean;
on: (( on: ((
eventName: 'response', eventName: 'response',
@@ -2470,13 +2660,15 @@ declare module 'electron' {
static buildFromTemplate: ( static buildFromTemplate: (
template: Array<MenuItemConstructorOptions>, template: Array<MenuItemConstructorOptions>,
) => Menu; ) => Menu;
popup: (options: { popup: (
options?: ?{
window?: ?BrowserWindow, window?: ?BrowserWindow,
x?: ?number, x?: ?number,
y?: ?number, y?: ?number,
positioningItem?: ?number, positioningItem?: ?number,
callback?: ?Function, callback?: ?Function,
}) => void; },
) => void;
closePopup: (browserWindow?: ?BrowserWindow) => void; closePopup: (browserWindow?: ?BrowserWindow) => void;
append: (menuItem: MenuItem) => void; append: (menuItem: MenuItem) => void;
getMenuItemById: (id: string) => MenuItem; getMenuItemById: (id: string) => MenuItem;
@@ -2511,9 +2703,13 @@ declare module 'electron' {
enabled?: ?boolean, enabled?: ?boolean,
visible?: ?boolean, visible?: ?boolean,
checked?: ?boolean, checked?: ?boolean,
registerAccelerator?: ?boolean,
submenu?: ?Array<MenuItemConstructorOptions> | Menu, submenu?: ?Array<MenuItemConstructorOptions> | Menu,
id?: ?string, id?: ?string,
position?: ?string, before?: ?Array<string>,
after?: ?Array<string>,
beforeGroupContaining?: ?Array<string>,
afterGroupContaining?: ?Array<string>,
}): MenuItem; }): MenuItem;
enabled: boolean; enabled: boolean;
visible: boolean; visible: boolean;
@@ -2634,6 +2830,7 @@ declare module 'electron' {
disableNetworkEmulation: () => void; disableNetworkEmulation: () => void;
setCertificateVerifyProc: (proc: Function) => void; setCertificateVerifyProc: (proc: Function) => void;
setPermissionRequestHandler: (handler: Function | null) => void; setPermissionRequestHandler: (handler: Function | null) => void;
setPermissionCheckHandler: (handler: Function | null) => void;
clearHostResolverCache: (callback?: ?Function) => void; clearHostResolverCache: (callback?: ?Function) => void;
allowNTLMCredentialsForDomains: (domains: string) => void; allowNTLMCredentialsForDomains: (domains: string) => void;
setUserAgent: (userAgent: string, acceptLanguages?: ?string) => void; setUserAgent: (userAgent: string, acceptLanguages?: ?string) => void;
@@ -2658,6 +2855,7 @@ declare module 'electron' {
cookies: Cookies; cookies: Cookies;
webRequest: WebRequest; webRequest: WebRequest;
protocol: Protocol; protocol: Protocol;
netLog: NetLog;
on: ( on: (
eventName: 'will-download', eventName: 'will-download',
callback: ( callback: (
@@ -2728,7 +2926,7 @@ declare module 'electron' {
}) => void; }) => void;
popUpContextMenu: ((menu?: ?Menu, position?: ?Point) => void) & popUpContextMenu: ((menu?: ?Menu, position?: ?Point) => void) &
((position?: ?Point) => void); ((position?: ?Point) => void);
setContextMenu: (menu: Menu) => void; setContextMenu: (menu: Menu | null) => void;
getBounds: () => Rectangle; getBounds: () => Rectangle;
isDestroyed: () => boolean; isDestroyed: () => boolean;
on: (( on: ((
@@ -2824,7 +3022,14 @@ declare module 'electron' {
baseURLForDataURL?: ?string, baseURLForDataURL?: ?string,
}, },
) => void; ) => void;
loadFile: (filePath: string) => void; loadFile: (
filePath: string,
options?: ?{
query?: ?{},
search?: ?string,
hash?: ?string,
},
) => void;
downloadURL: (url: string) => void; downloadURL: (url: string) => void;
getURL: () => string; getURL: () => string;
getTitle: () => string; getTitle: () => string;
@@ -2857,6 +3062,7 @@ declare module 'electron' {
setIgnoreMenuShortcuts: (ignore: boolean) => void; setIgnoreMenuShortcuts: (ignore: boolean) => void;
setAudioMuted: (muted: boolean) => void; setAudioMuted: (muted: boolean) => void;
isAudioMuted: () => boolean; isAudioMuted: () => boolean;
isCurrentlyAudible: () => boolean;
setZoomFactor: (factor: number) => void; setZoomFactor: (factor: number) => void;
getZoomFactor: (callback: Function) => void; getZoomFactor: (callback: Function) => void;
setZoomLevel: (level: number) => void; setZoomLevel: (level: number) => void;
@@ -2912,7 +3118,7 @@ declare module 'electron' {
printToPDF: ( printToPDF: (
options: { options: {
marginsType?: ?number, marginsType?: ?number,
pageSize?: ?string, pageSize?: ?string | Size,
printBackground?: ?boolean, printBackground?: ?boolean,
printSelectionOnly?: ?boolean, printSelectionOnly?: ?boolean,
landscape?: ?boolean, landscape?: ?boolean,
@@ -2973,12 +3179,6 @@ declare module 'electron' {
callback: Function, callback: Function,
) => boolean; ) => boolean;
showDefinitionForSelection: () => void; showDefinitionForSelection: () => void;
setSize: (options: {
enableAutoSize?: ?boolean,
normal?: ?Size,
min?: ?Size,
max?: ?Size,
}) => void;
isOffscreen: () => boolean; isOffscreen: () => boolean;
startPainting: () => void; startPainting: () => void;
stopPainting: () => void; stopPainting: () => void;
@@ -2996,6 +3196,15 @@ declare module 'electron' {
) => void; ) => void;
getOSProcessId: () => number; getOSProcessId: () => number;
getProcessId: () => number; getProcessId: () => number;
takeHeapSnapshot: (filePath: string) => Promise<any>;
setBackgroundThrottling: (allowed: boolean) => void;
getType: () =>
| 'backgroundPage'
| 'window'
| 'browserView'
| 'remote'
| 'webview'
| 'offscreen';
id: number; id: number;
session: Session; session: Session;
hostWebContents: WebContents; hostWebContents: WebContents;
@@ -3055,6 +3264,29 @@ declare module 'electron' {
(( ((
eventName: 'did-start-navigation', eventName: 'did-start-navigation',
callback: ( callback: (
event: Event,
url: string,
isInPlace: boolean,
isMainFrame: boolean,
frameProcessId: number,
frameRoutingId: number,
) => void,
) => void) &
((
eventName: 'will-redirect',
callback: (
event: Event,
url: string,
isInPlace: boolean,
isMainFrame: boolean,
frameProcessId: number,
frameRoutingId: number,
) => void,
) => void) &
((
eventName: 'did-redirect-navigation',
callback: (
event: Event,
url: string, url: string,
isInPlace: boolean, isInPlace: boolean,
isMainFrame: boolean, isMainFrame: boolean,
@@ -3288,6 +3520,30 @@ declare module 'electron' {
line: number, line: number,
sourceId: string, sourceId: string,
) => void, ) => void,
) => void) &
((
eventName: 'remote-require',
callback: (event: Event, moduleName: string) => void,
) => void) &
((
eventName: 'remote-get-global',
callback: (event: Event, globalName: string) => void,
) => void) &
((
eventName: 'remote-get-builtin',
callback: (event: Event, moduleName: string) => void,
) => void) &
((
eventName: 'remote-get-current-window',
callback: (event: Event) => void,
) => void) &
((
eventName: 'remote-get-current-web-contents',
callback: (event: Event) => void,
) => void) &
((
eventName: 'remote-get-guest-web-contents',
callback: (event: Event, guestWebContents: WebContents) => void,
) => void); ) => void);
once: ((eventName: 'did-finish-load', callback: () => void) => void) & once: ((eventName: 'did-finish-load', callback: () => void) => void) &
(( ((
@@ -3343,6 +3599,29 @@ declare module 'electron' {
(( ((
eventName: 'did-start-navigation', eventName: 'did-start-navigation',
callback: ( callback: (
event: Event,
url: string,
isInPlace: boolean,
isMainFrame: boolean,
frameProcessId: number,
frameRoutingId: number,
) => void,
) => void) &
((
eventName: 'will-redirect',
callback: (
event: Event,
url: string,
isInPlace: boolean,
isMainFrame: boolean,
frameProcessId: number,
frameRoutingId: number,
) => void,
) => void) &
((
eventName: 'did-redirect-navigation',
callback: (
event: Event,
url: string, url: string,
isInPlace: boolean, isInPlace: boolean,
isMainFrame: boolean, isMainFrame: boolean,
@@ -3576,6 +3855,30 @@ declare module 'electron' {
line: number, line: number,
sourceId: string, sourceId: string,
) => void, ) => void,
) => void) &
((
eventName: 'remote-require',
callback: (event: Event, moduleName: string) => void,
) => void) &
((
eventName: 'remote-get-global',
callback: (event: Event, globalName: string) => void,
) => void) &
((
eventName: 'remote-get-builtin',
callback: (event: Event, moduleName: string) => void,
) => void) &
((
eventName: 'remote-get-current-window',
callback: (event: Event) => void,
) => void) &
((
eventName: 'remote-get-current-web-contents',
callback: (event: Event) => void,
) => void) &
((
eventName: 'remote-get-guest-web-contents',
callback: (event: Event, guestWebContents: WebContents) => void,
) => void); ) => void);
} }
declare class WebRequest { declare class WebRequest {
@@ -3741,5 +4044,6 @@ declare module 'electron' {
declare type ReadableStream = any; declare type ReadableStream = any;
declare type MenuItemConstructorOptions = any; declare type MenuItemConstructorOptions = any;
declare type Protocol = any; declare type Protocol = any;
declare type NetLog = any;
declare type TouchBarItem = any; declare type TouchBarItem = any;
} }

10457
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@@ -36,7 +36,7 @@
] ]
}, },
"resolutions": { "resolutions": {
"@jest-runner/electron/electron": "3.0.0" "@jest-runner/electron/electron": "4.0.5"
}, },
"jest": { "jest": {
"transform": { "transform": {
@@ -47,10 +47,10 @@
] ]
}, },
"devDependencies": { "devDependencies": {
"@jest-runner/electron": "^0.1.0", "@jest-runner/electron": "^1.0.3",
"babel-eslint": "^10.0.1", "babel-eslint": "^10.0.1",
"electron": "3.0.0", "electron": "^4.0.5",
"electron-builder": "^19.49.0", "electron-builder": "^20.38.5",
"eslint": "^5.12.1", "eslint": "^5.12.1",
"eslint-config-fbjs": "^2.0.1", "eslint-config-fbjs": "^2.0.1",
"eslint-plugin-babel": "^5.3.0", "eslint-plugin-babel": "^5.3.0",
@@ -62,7 +62,7 @@
"eslint-plugin-relay": "^1.0.0", "eslint-plugin-relay": "^1.0.0",
"flow-bin": "^0.91.0", "flow-bin": "^0.91.0",
"glob": "^7.1.2", "glob": "^7.1.2",
"jest": "^23.6.0", "jest": "^24.1.0",
"jest-fetch-mock": "^2.1.0", "jest-fetch-mock": "^2.1.0",
"prettier": "1.13.6", "prettier": "1.13.6",
"redux-mock-store": "^1.5.3" "redux-mock-store": "^1.5.3"
@@ -119,6 +119,7 @@
"yazl": "^2.5.1" "yazl": "^2.5.1"
}, },
"scripts": { "scripts": {
"preinstall": "yarn config set ignore-engines",
"postinstall": "node scripts/yarn-install.js", "postinstall": "node scripts/yarn-install.js",
"rm-dist": "rm -rf dist", "rm-dist": "rm -rf dist",
"rm-modules": "rm -rf node_modules static/node_modules", "rm-modules": "rm -rf node_modules static/node_modules",

View File

@@ -78,7 +78,6 @@ function buildDist(buildFolder) {
return builder return builder
.build({ .build({
appDir: buildFolder,
publish: 'never', publish: 'never',
config: { config: {
appId: `com.facebook.sonar`, appId: `com.facebook.sonar`,

View File

@@ -21,7 +21,7 @@ cd "$ROOT_DIR/xplat/sonar"
# If `node_modules` exists, we can't tell if it was created with # If `node_modules` exists, we can't tell if it was created with
# `--ignore-scripts` or not, so we play it safe, and avoid touching it. # `--ignore-scripts` or not, so we play it safe, and avoid touching it.
if [[ ! -d "node_modules" ]]; then if [[ ! -d "node_modules" ]]; then
"$ROOT_DIR/xplat/third-party/yarn/install-node-modules.sh" --ignore-scripts "$ROOT_DIR/xplat/third-party/yarn/install-node-modules.sh" --ignore-scripts --ignore-engines
fi fi
exec \ exec \

View File

@@ -21,7 +21,7 @@ cd "$ROOT_DIR/xplat/sonar"
# If `node_modules` exists, we can't tell if it was created with # If `node_modules` exists, we can't tell if it was created with
# `--ignore-scripts` or not, so we play it safe, and avoid touching it. # `--ignore-scripts` or not, so we play it safe, and avoid touching it.
if [[ ! -d "node_modules" ]]; then if [[ ! -d "node_modules" ]]; then
"$ROOT_DIR/xplat/third-party/yarn/install-node-modules.sh" --ignore-scripts "$ROOT_DIR/xplat/third-party/yarn/install-node-modules.sh" --ignore-scripts --ignore-engines
fi fi
# Prefer the internal version of Flow, which should be in the PATH - but # Prefer the internal version of Flow, which should be in the PATH - but

View File

@@ -61,7 +61,7 @@ exports[`Empty app state matches snapshot 1`] = `
<span <span
className="css-lli23c" className="css-lli23c"
> >
3.0.0 4.0.5
-dev -dev
</span> </span>
<div <div

View File

@@ -100,22 +100,23 @@ compilePlugins(
}); });
// check if we already have an instance of this app open // check if we already have an instance of this app open
const isSecondInstance = app.makeSingleInstance( const gotTheLock = app.requestSingleInstanceLock();
(commandLine, workingDirectory) => {
// someone tried to run a second instance, we should focus our window if (!gotTheLock) {
app.quit();
} else {
app.on('second-instance', (event, commandLine, workingDirectory) => {
// Someone tried to run a second instance, we should focus our window.
if (win) { if (win) {
if (win.isMinimized()) { if (win.isMinimized()) {
win.restore(); win.restore();
} }
win.focus(); win.focus();
} }
}, });
);
// if this is a second instance then quit the app to prevent collisions // Create myWindow, load the rest of the app, etc...
if (isSecondInstance) { app.on('ready', () => {});
app.quit();
} }
// quit app once all windows are closed // quit app once all windows are closed

1580
yarn.lock

File diff suppressed because it is too large Load Diff