diff --git a/docs/api/process.md b/docs/api/process.md index bf5dc57fe7..db15496916 100644 --- a/docs/api/process.md +++ b/docs/api/process.md @@ -111,7 +111,11 @@ A `Boolean` that controls whether or not process warnings printed to `stderr` in ### `process.type` _Readonly_ -A `String` representing the current process's type, can be `"browser"` (i.e. main process), `"renderer"`, or `"worker"` (i.e. web worker). +A `String` representing the current process's type, can be: + +* `browser` - The main process +* `renderer` - A renderer process +* `worker` - In a web worker ### `process.versions.chrome` _Readonly_ diff --git a/lib/common/reset-search-paths.ts b/lib/common/reset-search-paths.ts index 7cdd9c31ec..cad6d37d1e 100644 --- a/lib/common/reset-search-paths.ts +++ b/lib/common/reset-search-paths.ts @@ -22,19 +22,29 @@ Module._nodeModulePaths = function (from: string) { }; // Make a fake Electron module that we will insert into the module cache -const electronModule = new Module('electron', null); -electronModule.id = 'electron'; -electronModule.loaded = true; -electronModule.filename = 'electron'; -Object.defineProperty(electronModule, 'exports', { - get: () => require('electron') -}); +const makeElectronModule = (name: string) => { + const electronModule = new Module('electron', null); + electronModule.id = 'electron'; + electronModule.loaded = true; + electronModule.filename = name; + Object.defineProperty(electronModule, 'exports', { + get: () => require('electron') + }); + Module._cache[name] = electronModule; +}; -Module._cache.electron = electronModule; +makeElectronModule('electron'); +makeElectronModule('electron/common'); +if (process.type === 'browser') { + makeElectronModule('electron/main'); +} +if (process.type === 'renderer') { + makeElectronModule('electron/renderer'); +} const originalResolveFilename = Module._resolveFilename; Module._resolveFilename = function (request: string, parent: NodeModule, isMain: boolean) { - if (request === 'electron') { + if (request === 'electron' || request.startsWith('electron/')) { return 'electron'; } else { return originalResolveFilename(request, parent, isMain); diff --git a/package.json b/package.json index 2dc070fb29..0951c1d08a 100644 --- a/package.json +++ b/package.json @@ -5,7 +5,7 @@ "description": "Build cross platform desktop apps with JavaScript, HTML, and CSS", "devDependencies": { "@electron/docs-parser": "^0.7.2", - "@electron/typescript-definitions": "^8.6.4", + "@electron/typescript-definitions": "^8.7.2", "@octokit/rest": "^16.3.2", "@primer/octicons": "^9.1.1", "@types/basic-auth": "^1.1.3", diff --git a/spec-main/ambient.d.ts b/spec-main/ambient.d.ts index a7efd44d76..625eff7e83 100644 --- a/spec-main/ambient.d.ts +++ b/spec-main/ambient.d.ts @@ -29,6 +29,12 @@ declare namespace Electron { class WebContentsView { constructor(webContents: WebContents) } + + namespace Main { + class TopLevelWindow extends Electron.TopLevelWindow {} + class View extends Electron.View {} + class WebContentsView extends Electron.WebContentsView {} + } } declare module 'dbus-native'; diff --git a/spec-main/api-app-spec.ts b/spec-main/api-app-spec.ts index a23881f652..57eb129a5d 100644 --- a/spec-main/api-app-spec.ts +++ b/spec-main/api-app-spec.ts @@ -5,7 +5,7 @@ import * as http from 'http'; import * as net from 'net'; import * as fs from 'fs'; import * as path from 'path'; -import { app, BrowserWindow, Menu, session } from 'electron'; +import { app, BrowserWindow, Menu, session } from 'electron/main'; import { emittedOnce } from './events-helpers'; import { closeWindow, closeAllWindows } from './window-helpers'; import { ifdescribe } from './spec-helpers'; diff --git a/spec-main/api-auto-updater-spec.ts b/spec-main/api-auto-updater-spec.ts index bb6d491650..4d1e19fcbb 100644 --- a/spec-main/api-auto-updater-spec.ts +++ b/spec-main/api-auto-updater-spec.ts @@ -1,4 +1,4 @@ -import { autoUpdater } from 'electron'; +import { autoUpdater } from 'electron/main'; import { expect } from 'chai'; import { ifit, ifdescribe } from './spec-helpers'; diff --git a/spec-main/api-browser-view-spec.ts b/spec-main/api-browser-view-spec.ts index 85c3c78079..19e0ab3212 100644 --- a/spec-main/api-browser-view-spec.ts +++ b/spec-main/api-browser-view-spec.ts @@ -2,7 +2,7 @@ import { expect } from 'chai'; import * as ChildProcess from 'child_process'; import * as path from 'path'; import { emittedOnce } from './events-helpers'; -import { BrowserView, BrowserWindow } from 'electron'; +import { BrowserView, BrowserWindow } from 'electron/main'; import { closeWindow } from './window-helpers'; describe('BrowserView module', () => { diff --git a/spec-main/api-browser-window-affinity-spec.ts b/spec-main/api-browser-window-affinity-spec.ts index 18db25af77..e8f4b5dc92 100644 --- a/spec-main/api-browser-window-affinity-spec.ts +++ b/spec-main/api-browser-window-affinity-spec.ts @@ -1,7 +1,7 @@ import { expect } from 'chai'; import * as path from 'path'; -import { ipcMain, BrowserWindow, WebPreferences, app } from 'electron'; +import { ipcMain, BrowserWindow, WebPreferences, app } from 'electron/main'; import { closeWindow } from './window-helpers'; describe('BrowserWindow with affinity module', () => { diff --git a/spec-main/api-browser-window-spec.ts b/spec-main/api-browser-window-spec.ts index f8838dca6a..ba61317385 100644 --- a/spec-main/api-browser-window-spec.ts +++ b/spec-main/api-browser-window-spec.ts @@ -5,7 +5,7 @@ import * as os from 'os'; import * as qs from 'querystring'; import * as http from 'http'; import { AddressInfo } from 'net'; -import { app, BrowserWindow, BrowserView, ipcMain, OnBeforeSendHeadersListenerDetails, protocol, screen, webContents, session, WebContents } from 'electron'; +import { app, BrowserWindow, BrowserView, ipcMain, OnBeforeSendHeadersListenerDetails, protocol, screen, webContents, session, WebContents } from 'electron/main'; import { emittedOnce } from './events-helpers'; import { ifit, ifdescribe } from './spec-helpers'; diff --git a/spec-main/api-content-tracing-spec.ts b/spec-main/api-content-tracing-spec.ts index d997bfa5ef..bcdd1cfc5c 100644 --- a/spec-main/api-content-tracing-spec.ts +++ b/spec-main/api-content-tracing-spec.ts @@ -1,5 +1,5 @@ import { expect } from 'chai'; -import { app, contentTracing, TraceConfig, TraceCategoriesAndOptions } from 'electron'; +import { app, contentTracing, TraceConfig, TraceCategoriesAndOptions } from 'electron/main'; import * as fs from 'fs'; import * as path from 'path'; import { ifdescribe } from './spec-helpers'; diff --git a/spec-main/api-context-bridge-spec.ts b/spec-main/api-context-bridge-spec.ts index 0454928789..f081f4602d 100644 --- a/spec-main/api-context-bridge-spec.ts +++ b/spec-main/api-context-bridge-spec.ts @@ -1,4 +1,5 @@ -import { contextBridge, BrowserWindow, ipcMain } from 'electron'; +import { BrowserWindow, ipcMain } from 'electron/main'; +import { contextBridge } from 'electron/renderer'; import { expect } from 'chai'; import * as fs from 'fs-extra'; import * as os from 'os'; @@ -45,10 +46,10 @@ describe('contextBridge', () => { const generateTests = (useSandbox: boolean) => { describe(`with sandbox=${useSandbox}`, () => { const makeBindingWindow = async (bindingCreator: Function) => { - const preloadContent = `const electron_1 = require('electron'); + const preloadContent = `const renderer_1 = require('electron'); ${useSandbox ? '' : `require('v8').setFlagsFromString('--expose_gc'); const gc=require('vm').runInNewContext('gc'); - electron_1.contextBridge.exposeInMainWorld('GCRunner', { + renderer_1.contextBridge.exposeInMainWorld('GCRunner', { run: () => gc() });`} (${bindingCreator.toString()})();`; diff --git a/spec-main/api-crash-reporter-spec.ts b/spec-main/api-crash-reporter-spec.ts index 995d076734..2abce6796d 100644 --- a/spec-main/api-crash-reporter-spec.ts +++ b/spec-main/api-crash-reporter-spec.ts @@ -7,7 +7,8 @@ import * as path from 'path'; import { ifdescribe, ifit } from './spec-helpers'; import * as temp from 'temp'; import * as url from 'url'; -import { ipcMain, app, BrowserWindow, crashReporter, BrowserWindowConstructorOptions } from 'electron'; +import { ipcMain, app, BrowserWindow, BrowserWindowConstructorOptions } from 'electron/main'; +import { crashReporter } from 'electron/common'; import { AddressInfo } from 'net'; import { closeWindow, closeAllWindows } from './window-helpers'; import { EventEmitter } from 'events'; diff --git a/spec-main/api-debugger-spec.ts b/spec-main/api-debugger-spec.ts index 86231d01ed..45bbbc6afb 100644 --- a/spec-main/api-debugger-spec.ts +++ b/spec-main/api-debugger-spec.ts @@ -2,7 +2,7 @@ import { expect } from 'chai'; import * as http from 'http'; import * as path from 'path'; import { AddressInfo } from 'net'; -import { BrowserWindow } from 'electron'; +import { BrowserWindow } from 'electron/main'; import { closeAllWindows } from './window-helpers'; import { emittedOnce } from './events-helpers'; diff --git a/spec-main/api-deprecate-spec.ts b/spec-main/api-deprecate-spec.ts index d02af05c0c..056a18edaa 100644 --- a/spec-main/api-deprecate-spec.ts +++ b/spec-main/api-deprecate-spec.ts @@ -1,5 +1,5 @@ import { expect } from 'chai'; -import { deprecate } from 'electron'; +import { deprecate } from 'electron/main'; describe('deprecate', () => { let throwing: boolean; diff --git a/spec-main/api-desktop-capturer-spec.ts b/spec-main/api-desktop-capturer-spec.ts index 7cc938cdfc..ac43c69eff 100644 --- a/spec-main/api-desktop-capturer-spec.ts +++ b/spec-main/api-desktop-capturer-spec.ts @@ -1,5 +1,6 @@ import { expect } from 'chai'; -import { desktopCapturer, screen, BrowserWindow, SourcesOptions } from 'electron'; +import { screen, BrowserWindow, SourcesOptions } from 'electron/main'; +import { desktopCapturer } from 'electron/renderer'; import { emittedOnce } from './events-helpers'; import { ifdescribe, ifit } from './spec-helpers'; import { closeAllWindows } from './window-helpers'; diff --git a/spec-main/api-dialog-spec.ts b/spec-main/api-dialog-spec.ts index da5810e40e..96fd277903 100644 --- a/spec-main/api-dialog-spec.ts +++ b/spec-main/api-dialog-spec.ts @@ -1,5 +1,5 @@ import { expect } from 'chai'; -import { dialog, BrowserWindow } from 'electron'; +import { dialog, BrowserWindow } from 'electron/main'; import { closeAllWindows } from './window-helpers'; import { ifit } from './spec-helpers'; diff --git a/spec-main/api-global-shortcut-spec.ts b/spec-main/api-global-shortcut-spec.ts index 65c6e9994c..9d1713d6a6 100644 --- a/spec-main/api-global-shortcut-spec.ts +++ b/spec-main/api-global-shortcut-spec.ts @@ -1,5 +1,5 @@ import { expect } from 'chai'; -import { globalShortcut } from 'electron'; +import { globalShortcut } from 'electron/main'; import { ifdescribe } from './spec-helpers'; ifdescribe(process.platform !== 'win32')('globalShortcut module', () => { diff --git a/spec-main/api-in-app-purchase-spec.ts b/spec-main/api-in-app-purchase-spec.ts index c15768ffe1..e75046051f 100644 --- a/spec-main/api-in-app-purchase-spec.ts +++ b/spec-main/api-in-app-purchase-spec.ts @@ -1,5 +1,5 @@ import { expect } from 'chai'; -import { inAppPurchase } from 'electron'; +import { inAppPurchase } from 'electron/main'; describe('inAppPurchase module', function () { if (process.platform !== 'darwin') return; diff --git a/spec-main/api-ipc-main-spec.ts b/spec-main/api-ipc-main-spec.ts index 429565c555..3f54527a5b 100644 --- a/spec-main/api-ipc-main-spec.ts +++ b/spec-main/api-ipc-main-spec.ts @@ -3,7 +3,7 @@ import * as path from 'path'; import * as cp from 'child_process'; import { closeAllWindows } from './window-helpers'; import { emittedOnce } from './events-helpers'; -import { ipcMain, BrowserWindow } from 'electron'; +import { ipcMain, BrowserWindow } from 'electron/main'; describe('ipc main module', () => { const fixtures = path.join(__dirname, 'fixtures'); diff --git a/spec-main/api-ipc-renderer-spec.ts b/spec-main/api-ipc-renderer-spec.ts index cb933bb7fc..99675e66fa 100644 --- a/spec-main/api-ipc-renderer-spec.ts +++ b/spec-main/api-ipc-renderer-spec.ts @@ -1,6 +1,6 @@ import { expect } from 'chai'; import * as path from 'path'; -import { ipcMain, BrowserWindow, WebContents, WebPreferences, webContents } from 'electron'; +import { ipcMain, BrowserWindow, WebContents, WebPreferences, webContents } from 'electron/main'; import { emittedOnce } from './events-helpers'; import { closeWindow } from './window-helpers'; diff --git a/spec-main/api-ipc-spec.ts b/spec-main/api-ipc-spec.ts index 5a32273e00..0c3eea166f 100644 --- a/spec-main/api-ipc-spec.ts +++ b/spec-main/api-ipc-spec.ts @@ -1,6 +1,6 @@ import { EventEmitter } from 'events'; import { expect } from 'chai'; -import { BrowserWindow, ipcMain, IpcMainInvokeEvent, MessageChannelMain } from 'electron'; +import { BrowserWindow, ipcMain, IpcMainInvokeEvent, MessageChannelMain } from 'electron/main'; import { closeAllWindows } from './window-helpers'; import { emittedOnce } from './events-helpers'; diff --git a/spec-main/api-menu-item-spec.ts b/spec-main/api-menu-item-spec.ts index f74d2139b1..461529fc3a 100644 --- a/spec-main/api-menu-item-spec.ts +++ b/spec-main/api-menu-item-spec.ts @@ -1,4 +1,4 @@ -import { BrowserWindow, app, Menu, MenuItem, MenuItemConstructorOptions } from 'electron'; +import { BrowserWindow, app, Menu, MenuItem, MenuItemConstructorOptions } from 'electron/main'; import { expect } from 'chai'; import { closeAllWindows } from './window-helpers'; const { roleList, execute } = require('../lib/browser/api/menu-item-roles'); diff --git a/spec-main/api-menu-spec.ts b/spec-main/api-menu-spec.ts index ba95856410..20c7937a14 100644 --- a/spec-main/api-menu-spec.ts +++ b/spec-main/api-menu-spec.ts @@ -1,7 +1,7 @@ import * as cp from 'child_process'; import * as path from 'path'; import { expect } from 'chai'; -import { BrowserWindow, Menu, MenuItem } from 'electron'; +import { BrowserWindow, Menu, MenuItem } from 'electron/main'; import { sortMenuItems } from '../lib/browser/api/menu-utils'; import { emittedOnce } from './events-helpers'; import { ifit } from './spec-helpers'; diff --git a/spec-main/api-native-theme-spec.ts b/spec-main/api-native-theme-spec.ts index 9ec2679719..f4b63851cd 100644 --- a/spec-main/api-native-theme-spec.ts +++ b/spec-main/api-native-theme-spec.ts @@ -1,5 +1,5 @@ import { expect } from 'chai'; -import { nativeTheme, systemPreferences, BrowserWindow } from 'electron'; +import { nativeTheme, systemPreferences, BrowserWindow } from 'electron/main'; import * as os from 'os'; import * as path from 'path'; import * as semver from 'semver'; diff --git a/spec-main/api-net-log-spec.ts b/spec-main/api-net-log-spec.ts index 2789909f92..fd0de523d2 100644 --- a/spec-main/api-net-log-spec.ts +++ b/spec-main/api-net-log-spec.ts @@ -4,7 +4,7 @@ import * as fs from 'fs'; import * as os from 'os'; import * as path from 'path'; import * as ChildProcess from 'child_process'; -import { session, net } from 'electron'; +import { session, net } from 'electron/main'; import { Socket, AddressInfo } from 'net'; import { ifit } from './spec-helpers'; import { emittedOnce } from './events-helpers'; diff --git a/spec-main/api-net-spec.ts b/spec-main/api-net-spec.ts index 8c66a5c110..924b90dd33 100644 --- a/spec-main/api-net-spec.ts +++ b/spec-main/api-net-spec.ts @@ -1,5 +1,5 @@ import { expect } from 'chai'; -import { net, session, ClientRequest, BrowserWindow } from 'electron'; +import { net, session, ClientRequest, BrowserWindow } from 'electron/main'; import * as http from 'http'; import * as url from 'url'; import { AddressInfo, Socket } from 'net'; diff --git a/spec-main/api-notification-dbus-spec.ts b/spec-main/api-notification-dbus-spec.ts index 5cf4dcb6c3..9e56a1729b 100644 --- a/spec-main/api-notification-dbus-spec.ts +++ b/spec-main/api-notification-dbus-spec.ts @@ -8,7 +8,7 @@ import { expect } from 'chai'; import * as dbus from 'dbus-native'; -import { app } from 'electron'; +import { app } from 'electron/main'; import { ifdescribe } from './spec-helpers'; import { promisify } from 'util'; diff --git a/spec-main/api-notification-spec.ts b/spec-main/api-notification-spec.ts index 9862eabcc3..0ec2861963 100644 --- a/spec-main/api-notification-spec.ts +++ b/spec-main/api-notification-spec.ts @@ -1,5 +1,5 @@ import { expect } from 'chai'; -import { Notification } from 'electron'; +import { Notification } from 'electron/main'; import { emittedOnce } from './events-helpers'; import { ifit } from './spec-helpers'; diff --git a/spec-main/api-power-save-blocker-spec.ts b/spec-main/api-power-save-blocker-spec.ts index efb95b9f55..36a35726ad 100644 --- a/spec-main/api-power-save-blocker-spec.ts +++ b/spec-main/api-power-save-blocker-spec.ts @@ -1,5 +1,5 @@ import { expect } from 'chai'; -import { powerSaveBlocker } from 'electron'; +import { powerSaveBlocker } from 'electron/main'; describe('powerSaveBlocker module', () => { it('can be started and stopped', () => { diff --git a/spec-main/api-protocol-spec.ts b/spec-main/api-protocol-spec.ts index d7194fcffd..4008f44e08 100644 --- a/spec-main/api-protocol-spec.ts +++ b/spec-main/api-protocol-spec.ts @@ -1,5 +1,5 @@ import { expect } from 'chai'; -import { protocol, webContents, WebContents, session, BrowserWindow, ipcMain } from 'electron'; +import { protocol, webContents, WebContents, session, BrowserWindow, ipcMain } from 'electron/main'; import { promisify } from 'util'; import { AddressInfo } from 'net'; import * as ChildProcess from 'child_process'; diff --git a/spec-main/api-remote-spec.ts b/spec-main/api-remote-spec.ts index 571cc7c5b9..7d3c9b4337 100644 --- a/spec-main/api-remote-spec.ts +++ b/spec-main/api-remote-spec.ts @@ -3,7 +3,7 @@ import { expect } from 'chai'; import { closeAllWindows } from './window-helpers'; import { ifdescribe } from './spec-helpers'; -import { ipcMain, BrowserWindow } from 'electron'; +import { ipcMain, BrowserWindow } from 'electron/main'; import { emittedOnce } from './events-helpers'; const features = process.electronBinding('features'); diff --git a/spec-main/api-screen-spec.ts b/spec-main/api-screen-spec.ts index 220abf715f..a138a409da 100644 --- a/spec-main/api-screen-spec.ts +++ b/spec-main/api-screen-spec.ts @@ -1,5 +1,5 @@ import { expect } from 'chai'; -import { screen } from 'electron'; +import { screen } from 'electron/main'; describe('screen module', () => { describe('screen.getCursorScreenPoint()', () => { diff --git a/spec-main/api-service-workers-spec.ts b/spec-main/api-service-workers-spec.ts index 0c5231b0e2..66e15d3ee1 100644 --- a/spec-main/api-service-workers-spec.ts +++ b/spec-main/api-service-workers-spec.ts @@ -1,7 +1,7 @@ import * as fs from 'fs'; import * as http from 'http'; import * as path from 'path'; -import { session, BrowserWindow } from 'electron'; +import { session, BrowserWindow } from 'electron/main'; import { expect } from 'chai'; import { v4 } from 'uuid'; import { AddressInfo } from 'net'; diff --git a/spec-main/api-session-spec.ts b/spec-main/api-session-spec.ts index 298c363dc9..bad8634afc 100644 --- a/spec-main/api-session-spec.ts +++ b/spec-main/api-session-spec.ts @@ -4,7 +4,7 @@ import * as https from 'https'; import * as path from 'path'; import * as fs from 'fs'; import * as ChildProcess from 'child_process'; -import { session, BrowserWindow, net, ipcMain, Session } from 'electron'; +import { session, BrowserWindow, net, ipcMain, Session } from 'electron/main'; import * as send from 'send'; import * as auth from 'basic-auth'; import { closeAllWindows } from './window-helpers'; diff --git a/spec-main/api-shell-spec.ts b/spec-main/api-shell-spec.ts index 08f7ecce35..747add42f9 100644 --- a/spec-main/api-shell-spec.ts +++ b/spec-main/api-shell-spec.ts @@ -1,4 +1,5 @@ -import { BrowserWindow, shell } from 'electron'; +import { BrowserWindow } from 'electron/main'; +import { shell } from 'electron/common'; import { closeAllWindows } from './window-helpers'; import { emittedOnce } from './events-helpers'; import * as http from 'http'; diff --git a/spec-main/api-subframe-spec.ts b/spec-main/api-subframe-spec.ts index b9673ee058..e5623d79a4 100644 --- a/spec-main/api-subframe-spec.ts +++ b/spec-main/api-subframe-spec.ts @@ -3,7 +3,7 @@ import * as path from 'path'; import * as http from 'http'; import { emittedNTimes, emittedOnce } from './events-helpers'; import { closeWindow } from './window-helpers'; -import { app, BrowserWindow, ipcMain } from 'electron'; +import { app, BrowserWindow, ipcMain } from 'electron/main'; import { AddressInfo } from 'net'; import { ifdescribe } from './spec-helpers'; diff --git a/spec-main/api-system-preferences-spec.ts b/spec-main/api-system-preferences-spec.ts index a7eb08386a..ed7533aca8 100644 --- a/spec-main/api-system-preferences-spec.ts +++ b/spec-main/api-system-preferences-spec.ts @@ -1,5 +1,5 @@ import { expect } from 'chai'; -import { systemPreferences } from 'electron'; +import { systemPreferences } from 'electron/main'; import { ifdescribe } from './spec-helpers'; describe('systemPreferences module', () => { diff --git a/spec-main/api-touch-bar-spec.ts b/spec-main/api-touch-bar-spec.ts index 81fc84b775..40980820e7 100644 --- a/spec-main/api-touch-bar-spec.ts +++ b/spec-main/api-touch-bar-spec.ts @@ -1,5 +1,5 @@ import * as path from 'path'; -import { BrowserWindow, TouchBar } from 'electron'; +import { BrowserWindow, TouchBar } from 'electron/main'; import { closeWindow } from './window-helpers'; import { expect } from 'chai'; diff --git a/spec-main/api-tray-spec.ts b/spec-main/api-tray-spec.ts index 890a3fde23..45d65e32f2 100644 --- a/spec-main/api-tray-spec.ts +++ b/spec-main/api-tray-spec.ts @@ -1,5 +1,6 @@ import { expect } from 'chai'; -import { Menu, Tray, nativeImage } from 'electron'; +import { Menu, Tray } from 'electron/main'; +import { nativeImage } from 'electron/common'; import { ifdescribe, ifit } from './spec-helpers'; import * as path from 'path'; diff --git a/spec-main/api-view-spec.ts b/spec-main/api-view-spec.ts index 5496640d8e..e29abbe48e 100644 --- a/spec-main/api-view-spec.ts +++ b/spec-main/api-view-spec.ts @@ -1,5 +1,5 @@ import { closeWindow } from './window-helpers'; -import { TopLevelWindow, View } from 'electron'; +import { TopLevelWindow, View } from 'electron/main'; describe('View', () => { let w: TopLevelWindow; diff --git a/spec-main/api-web-contents-spec.ts b/spec-main/api-web-contents-spec.ts index d4315e7db5..9cabad454e 100644 --- a/spec-main/api-web-contents-spec.ts +++ b/spec-main/api-web-contents-spec.ts @@ -4,7 +4,8 @@ import * as path from 'path'; import * as fs from 'fs'; import * as http from 'http'; import * as ChildProcess from 'child_process'; -import { BrowserWindow, ipcMain, webContents, session, WebContents, app, clipboard } from 'electron'; +import { BrowserWindow, ipcMain, webContents, session, WebContents, app } from 'electron/main'; +import { clipboard } from 'electron/common'; import { emittedOnce } from './events-helpers'; import { closeAllWindows } from './window-helpers'; import { ifdescribe, ifit } from './spec-helpers'; diff --git a/spec-main/api-web-contents-view-spec.ts b/spec-main/api-web-contents-view-spec.ts index b83acb45cb..0be0c7a671 100644 --- a/spec-main/api-web-contents-view-spec.ts +++ b/spec-main/api-web-contents-view-spec.ts @@ -4,7 +4,7 @@ import * as path from 'path'; import { emittedOnce } from './events-helpers'; import { closeWindow } from './window-helpers'; -import { webContents, TopLevelWindow, WebContentsView } from 'electron'; +import { webContents, TopLevelWindow, WebContentsView } from 'electron/main'; describe('WebContentsView', () => { let w: TopLevelWindow; diff --git a/spec-main/api-web-frame-spec.ts b/spec-main/api-web-frame-spec.ts index 53d3c2c6f6..6cafbf4146 100644 --- a/spec-main/api-web-frame-spec.ts +++ b/spec-main/api-web-frame-spec.ts @@ -1,6 +1,6 @@ import { expect } from 'chai'; import * as path from 'path'; -import { BrowserWindow, ipcMain } from 'electron'; +import { BrowserWindow, ipcMain } from 'electron/main'; import { closeAllWindows } from './window-helpers'; describe('webFrame module', () => { diff --git a/spec-main/api-web-request-spec.ts b/spec-main/api-web-request-spec.ts index 89fd829cba..6fd76ddf78 100644 --- a/spec-main/api-web-request-spec.ts +++ b/spec-main/api-web-request-spec.ts @@ -4,7 +4,7 @@ import * as qs from 'querystring'; import * as path from 'path'; import * as url from 'url'; import * as WebSocket from 'ws'; -import { ipcMain, protocol, session, WebContents, webContents } from 'electron'; +import { ipcMain, protocol, session, WebContents, webContents } from 'electron/main'; import { AddressInfo } from 'net'; import { emittedOnce } from './events-helpers'; diff --git a/spec-main/asar-spec.ts b/spec-main/asar-spec.ts index 7a1af71592..831ea36935 100644 --- a/spec-main/asar-spec.ts +++ b/spec-main/asar-spec.ts @@ -1,6 +1,6 @@ import { expect } from 'chai'; import * as path from 'path'; -import { BrowserWindow, ipcMain } from 'electron'; +import { BrowserWindow, ipcMain } from 'electron/main'; import { closeAllWindows } from './window-helpers'; describe('asar package', () => { diff --git a/spec-main/chromium-spec.ts b/spec-main/chromium-spec.ts index f3a61a9d1d..327142fe24 100644 --- a/spec-main/chromium-spec.ts +++ b/spec-main/chromium-spec.ts @@ -1,5 +1,5 @@ import { expect } from 'chai'; -import { BrowserWindow, WebContents, session, ipcMain, app, protocol, webContents } from 'electron'; +import { BrowserWindow, WebContents, session, ipcMain, app, protocol, webContents } from 'electron/main'; import { emittedOnce } from './events-helpers'; import { closeAllWindows } from './window-helpers'; import * as https from 'https'; diff --git a/spec-main/extensions-spec.ts b/spec-main/extensions-spec.ts index da48e590b0..0059470ae3 100644 --- a/spec-main/extensions-spec.ts +++ b/spec-main/extensions-spec.ts @@ -1,5 +1,5 @@ import { expect } from 'chai'; -import { app, session, BrowserWindow, ipcMain, WebContents, Extension } from 'electron'; +import { app, session, BrowserWindow, ipcMain, WebContents, Extension } from 'electron/main'; import { closeAllWindows, closeWindow } from './window-helpers'; import * as http from 'http'; import { AddressInfo } from 'net'; diff --git a/spec-main/modules-spec.ts b/spec-main/modules-spec.ts index 217273c965..3e1be72524 100644 --- a/spec-main/modules-spec.ts +++ b/spec-main/modules-spec.ts @@ -1,7 +1,7 @@ import { expect } from 'chai'; import * as path from 'path'; import * as fs from 'fs'; -import { BrowserWindow } from 'electron'; +import { BrowserWindow } from 'electron/main'; import { ifdescribe, ifit } from './spec-helpers'; import { closeAllWindows } from './window-helpers'; import * as childProcess from 'child_process'; diff --git a/spec-main/node-spec.ts b/spec-main/node-spec.ts index dd01975060..d6030e76f7 100644 --- a/spec-main/node-spec.ts +++ b/spec-main/node-spec.ts @@ -4,7 +4,7 @@ import * as path from 'path'; import * as util from 'util'; import { emittedOnce } from './events-helpers'; import { ifdescribe, ifit } from './spec-helpers'; -import { webContents, WebContents } from 'electron'; +import { webContents, WebContents } from 'electron/main'; const features = process.electronBinding('features'); diff --git a/spec-main/security-warnings-spec.ts b/spec-main/security-warnings-spec.ts index 06f4f921ce..40c8a990d0 100644 --- a/spec-main/security-warnings-spec.ts +++ b/spec-main/security-warnings-spec.ts @@ -4,7 +4,7 @@ import * as fs from 'fs'; import * as path from 'path'; import * as url from 'url'; -import { BrowserWindow, WebPreferences } from 'electron'; +import { BrowserWindow, WebPreferences } from 'electron/main'; import { closeWindow } from './window-helpers'; import { AddressInfo } from 'net'; diff --git a/spec-main/spellchecker-spec.ts b/spec-main/spellchecker-spec.ts index 5ef1c782d0..d106595882 100644 --- a/spec-main/spellchecker-spec.ts +++ b/spec-main/spellchecker-spec.ts @@ -1,4 +1,4 @@ -import { BrowserWindow, Session, session } from 'electron'; +import { BrowserWindow, Session, session } from 'electron/main'; import { expect } from 'chai'; import * as path from 'path'; diff --git a/spec-main/visibility-state-spec.ts b/spec-main/visibility-state-spec.ts index 69dff52332..906ac2f98d 100644 --- a/spec-main/visibility-state-spec.ts +++ b/spec-main/visibility-state-spec.ts @@ -1,6 +1,6 @@ import { expect } from 'chai'; import * as cp from 'child_process'; -import { BrowserWindow, BrowserWindowConstructorOptions, ipcMain } from 'electron'; +import { BrowserWindow, BrowserWindowConstructorOptions, ipcMain } from 'electron/main'; import * as path from 'path'; import { emittedOnce } from './events-helpers'; diff --git a/spec-main/webview-spec.ts b/spec-main/webview-spec.ts index e2d5c5476b..5d79d6b5c1 100644 --- a/spec-main/webview-spec.ts +++ b/spec-main/webview-spec.ts @@ -1,5 +1,5 @@ import * as path from 'path'; -import { BrowserWindow, session, ipcMain, app, WebContents } from 'electron'; +import { BrowserWindow, session, ipcMain, app, WebContents } from 'electron/main'; import { closeAllWindows } from './window-helpers'; import { emittedOnce } from './events-helpers'; import { expect } from 'chai'; diff --git a/spec-main/window-helpers.ts b/spec-main/window-helpers.ts index a3b3dcccc6..ddc8d9f5b7 100644 --- a/spec-main/window-helpers.ts +++ b/spec-main/window-helpers.ts @@ -1,5 +1,5 @@ import { expect } from 'chai'; -import { BrowserWindow } from 'electron'; +import { BrowserWindow } from 'electron/main'; import { emittedOnce } from './events-helpers'; async function ensureWindowIsClosed (window: BrowserWindow | null) { diff --git a/typings/internal-electron.d.ts b/typings/internal-electron.d.ts index 932f4eaaad..ac3ba5b01a 100644 --- a/typings/internal-electron.d.ts +++ b/typings/internal-electron.d.ts @@ -73,6 +73,10 @@ declare namespace Electron { } const deprecate: ElectronInternal.DeprecationUtil; + + namespace Main { + const deprecate: ElectronInternal.DeprecationUtil; + } } declare namespace ElectronInternal { diff --git a/yarn.lock b/yarn.lock index c388bc4802..8ca6952b11 100644 --- a/yarn.lock +++ b/yarn.lock @@ -25,21 +25,6 @@ dependencies: regenerator-runtime "^0.13.2" -"@electron/docs-parser@^0.4.1": - version "0.4.4" - resolved "https://registry.yarnpkg.com/@electron/docs-parser/-/docs-parser-0.4.4.tgz#4b22be74aa9073315241d2d4b06b22e7ff487106" - integrity sha512-EGQMXBIkW6JtwaxbmuWrmJivmrR420dX1cEy5I5Az71aVIz/E4gxlLmlT5L/jOzWwJ+1rbpri9LKVWPl0Bnasw== - dependencies: - "@types/markdown-it" "^0.0.9" - chai "^4.2.0" - chalk "^3.0.0" - fs-extra "^8.1.0" - lodash.camelcase "^4.3.0" - markdown-it "^10.0.0" - minimist "^1.2.0" - ora "^4.0.3" - pretty-ms "^5.1.0" - "@electron/docs-parser@^0.7.2": version "0.7.2" resolved "https://registry.yarnpkg.com/@electron/docs-parser/-/docs-parser-0.7.2.tgz#f0d5b9f314db519ac1f83359c07c6ec42d3123d1" @@ -55,12 +40,11 @@ ora "^4.0.3" pretty-ms "^5.1.0" -"@electron/typescript-definitions@^8.6.4": - version "8.6.4" - resolved "https://registry.yarnpkg.com/@electron/typescript-definitions/-/typescript-definitions-8.6.4.tgz#d4727c825afcebf6ff00a7d18416878288cac632" - integrity sha512-Fb4o56fikSE3id61U0MbPVBPcweVw8YwzO+JtT9aOorJR4baJZGmpsGxuaHeLSGv+D0Zd5XiWk13cEM/nv9fFw== +"@electron/typescript-definitions@^8.7.2": + version "8.7.2" + resolved "https://registry.yarnpkg.com/@electron/typescript-definitions/-/typescript-definitions-8.7.2.tgz#a653859975c6a19721b3f47f4f7953876498a8ed" + integrity sha512-AE1NjiP2nZsUGYMU78+W6QPCZCRKQe54Tee6qJnBW42rZktZ0hwYXglfpIavpo9dRp4pWncgCo56PXj2rKwCSA== dependencies: - "@electron/docs-parser" "^0.4.1" "@types/node" "^11.13.7" chalk "^2.4.2" colors "^1.1.2"