diff --git a/exports/atom.js b/exports/atom.js index 7bb7cdb1e..b22a4cdfb 100644 --- a/exports/atom.js +++ b/exports/atom.js @@ -37,7 +37,7 @@ if (process.platform === 'win32') { // The following classes can't be used from a Task handler and should therefore // only be exported when not running as a child node process -if (!process.env.ATOM_SHELL_INTERNAL_RUN_AS_NODE) { +if (process.type === 'renderer') { atomExport.Task = require('../src/task') const TextEditor = (params) => { diff --git a/exports/clipboard.js b/exports/clipboard.js new file mode 100644 index 000000000..3594b3342 --- /dev/null +++ b/exports/clipboard.js @@ -0,0 +1,7 @@ +module.exports = require('electron').clipboard + +const Grim = require('grim') +Grim.deprecate('Use `require("electron").clipboard` instead of `require("clipboard")`') + +// Ensure each package that requires this shim causes a deprecation warning +delete require.cache[__filename] diff --git a/exports/ipc.js b/exports/ipc.js new file mode 100644 index 000000000..9d1b1e3ee --- /dev/null +++ b/exports/ipc.js @@ -0,0 +1,7 @@ +module.exports = require('electron').ipcRenderer + +const Grim = require('grim') +Grim.deprecate('Use `require("electron").ipcRenderer` instead of `require("ipc")`') + +// Ensure each package that requires this shim causes a deprecation warning +delete require.cache[__filename] diff --git a/exports/remote.js b/exports/remote.js new file mode 100644 index 000000000..379ee43f6 --- /dev/null +++ b/exports/remote.js @@ -0,0 +1,7 @@ +module.exports = require('electron').remote + +const Grim = require('grim') +Grim.deprecate('Use `require("electron").remote` instead of `require("remote")`') + +// Ensure each package that requires this shim causes a deprecation warning +delete require.cache[__filename] diff --git a/exports/shell.js b/exports/shell.js new file mode 100644 index 000000000..2424455a6 --- /dev/null +++ b/exports/shell.js @@ -0,0 +1,7 @@ +module.exports = require('electron').shell + +const Grim = require('grim') +Grim.deprecate('Use `require("electron").shell` instead of `require("shell")`') + +// Ensure each package that requires this shim causes a deprecation warning +delete require.cache[__filename] diff --git a/exports/web-frame.js b/exports/web-frame.js new file mode 100644 index 000000000..0c97debfd --- /dev/null +++ b/exports/web-frame.js @@ -0,0 +1,7 @@ +module.exports = require('electron').webFrame + +const Grim = require('grim') +Grim.deprecate('Use `require("electron").webFrame` instead of `require("web-frame")`') + +// Ensure each package that requires this shim causes a deprecation warning +delete require.cache[__filename] diff --git a/package.json b/package.json index 81d01d0fb..d9b0650cf 100644 --- a/package.json +++ b/package.json @@ -12,7 +12,7 @@ "url": "https://github.com/atom/atom/issues" }, "license": "MIT", - "electronVersion": "0.37.8", + "electronVersion": "1.3.5", "dependencies": { "async": "0.2.6", "atom-keymap": "6.3.2", @@ -27,7 +27,7 @@ "devtron": "1.1.0", "event-kit": "^2.1.0", "find-parent-dir": "^0.3.0", - "first-mate": "^5.1.1", + "first-mate": "6.0.0", "fs-plus": "2.9.1", "fstream": "0.1.24", "fuzzaldrin": "^2.1", @@ -43,7 +43,7 @@ "mocha": "2.5.1", "normalize-package-data": "^2.0.0", "nslog": "^3", - "oniguruma": "^5", + "oniguruma": "6.1.0", "pathwatcher": "~6.5", "property-accessors": "^1.1.3", "random-words": "0.0.1", @@ -82,13 +82,13 @@ "autocomplete-atom-api": "0.10.0", "autocomplete-css": "0.11.2", "autocomplete-html": "0.7.2", - "autocomplete-plus": "2.31.1", + "autocomplete-plus": "2.31.2", "autocomplete-snippets": "1.11.0", "autoflow": "0.27.0", "autosave": "0.23.1", "background-tips": "0.26.1", "bookmarks": "0.42.0", - "bracket-matcher": "0.82.1", + "bracket-matcher": "0.82.2", "command-palette": "0.38.0", "deprecation-cop": "0.54.1", "dev-live-reload": "0.47.0", @@ -103,7 +103,7 @@ "incompatible-packages": "0.26.1", "keybinding-resolver": "0.35.0", "line-ending-selector": "0.5.0", - "link": "0.31.1", + "link": "0.31.2", "markdown-preview": "0.158.3", "metrics": "1.0.0", "notifications": "0.65.1", @@ -113,7 +113,7 @@ "snippets": "1.0.2", "spell-check": "0.68.2", "status-bar": "1.4.1", - "styleguide": "0.47.0", + "styleguide": "0.47.2", "symbols-view": "0.113.1", "tabs": "0.101.0", "timecop": "0.33.2", diff --git a/spec/atom-environment-spec.coffee b/spec/atom-environment-spec.coffee index cd8408a73..f3cb83bf0 100644 --- a/spec/atom-environment-spec.coffee +++ b/spec/atom-environment-spec.coffee @@ -407,7 +407,7 @@ describe "AtomEnvironment", -> updateAvailableHandler = jasmine.createSpy("update-available-handler") subscription = atom.onUpdateAvailable updateAvailableHandler - autoUpdater = require('electron').remote.require('auto-updater') + autoUpdater = require('electron').remote.autoUpdater autoUpdater.emit 'update-downloaded', null, "notes", "version" waitsFor -> diff --git a/spec/main-process/atom-application.test.js b/spec/main-process/atom-application.test.js index 408ea84ff..7fd68e038 100644 --- a/spec/main-process/atom-application.test.js +++ b/spec/main-process/atom-application.test.js @@ -223,9 +223,7 @@ describe('AtomApplication', function () { const window1 = atomApplication.launch(parseCommandLine([dirAPath, dirBPath])) await focusWindow(window1) - await new Promise(function (resolve) { - setTimeout(resolve, 1000) - }) + await timeoutPromise(1000) let treeViewPaths = await evalInWebContents(window1.browserWindow.webContents, function (sendBackToMainProcess) { sendBackToMainProcess( diff --git a/spec/workspace-element-spec.coffee b/spec/workspace-element-spec.coffee index cfe21cb18..b5812b7b2 100644 --- a/spec/workspace-element-spec.coffee +++ b/spec/workspace-element-spec.coffee @@ -48,12 +48,12 @@ describe "WorkspaceElement", -> it "updates the font-family based on the 'editor.fontFamily' config value", -> initialCharWidth = editor.getDefaultCharWidth() fontFamily = atom.config.get('editor.fontFamily') - fontFamily += ", 'Apple Color Emoji'" if process.platform is 'darwin' + fontFamily += ', "Apple Color Emoji"' if process.platform is 'darwin' expect(getComputedStyle(editorElement).fontFamily).toBe fontFamily atom.config.set('editor.fontFamily', 'sans-serif') fontFamily = atom.config.get('editor.fontFamily') - fontFamily += ", 'Apple Color Emoji'" if process.platform is 'darwin' + fontFamily += ', "Apple Color Emoji"' if process.platform is 'darwin' expect(getComputedStyle(editorElement).fontFamily).toBe fontFamily expect(editor.getDefaultCharWidth()).not.toBe initialCharWidth diff --git a/src/electron-shims.js b/src/electron-shims.js new file mode 100644 index 000000000..3f8e1c215 --- /dev/null +++ b/src/electron-shims.js @@ -0,0 +1,80 @@ +const path = require('path') +const electron = require('electron') + +const dirname = path.dirname +path.dirname = function (path) { + if (typeof path !== 'string') { + path = '' + path + const Grim = require('grim') + Grim.deprecate('Argument to `path.dirname` must be a string') + } + + return dirname(path) +} + +const extname = path.extname +path.extname = function (path) { + if (typeof path !== 'string') { + path = '' + path + const Grim = require('grim') + Grim.deprecate('Argument to `path.extname` must be a string') + } + + return extname(path) +} + +const basename = path.basename +path.basename = function (path, ext) { + if (typeof path !== 'string' || (ext !== undefined && typeof ext !== 'string')) { + path = '' + path + const Grim = require('grim') + Grim.deprecate('Arguments to `path.basename` must be strings') + } + + return basename(path, ext) +} + +electron.ipcRenderer.sendChannel = function () { + const Grim = require('grim') + Grim.deprecate('Use `ipcRenderer.send` instead of `ipcRenderer.sendChannel`') + return this.send.apply(this, arguments) +} + +const remoteRequire = electron.remote.require +electron.remote.require = function (moduleName) { + const Grim = require('grim') + switch (moduleName) { + case 'menu': + Grim.deprecate('Use `remote.Menu` instead of `remote.require("menu")`') + return this.Menu + case 'menu-item': + Grim.deprecate('Use `remote.MenuItem` instead of `remote.require("menu-item")`') + return this.MenuItem + case 'browser-window': + Grim.deprecate('Use `remote.BrowserWindow` instead of `remote.require("browser-window")`') + return this.BrowserWindow + case 'dialog': + Grim.deprecate('Use `remote.Dialog` instead of `remote.require("dialog")`') + return this.Dialog + case 'app': + Grim.deprecate('Use `remote.app` instead of `remote.require("app")`') + return this.app + case 'crash-reporter': + Grim.deprecate('Use `remote.crashReporter` instead of `remote.require("crashReporter")`') + return this.crashReporter + case 'global-shortcut': + Grim.deprecate('Use `remote.globalShortcut` instead of `remote.require("global-shortcut")`') + return this.globalShortcut + case 'clipboard': + Grim.deprecate('Use `remote.clipboard` instead of `remote.require("clipboard")`') + return this.clipboard + case 'native-image': + Grim.deprecate('Use `remote.nativeImage` instead of `remote.require("native-image")`') + return this.nativeImage + case 'tray': + Grim.deprecate('Use `remote.Tray` instead of `remote.require("tray")`') + return this.Tray + default: + return remoteRequire.call(this, moduleName) + } +} diff --git a/src/initialize-application-window.coffee b/src/initialize-application-window.coffee index 9787977e2..04784efa0 100644 --- a/src/initialize-application-window.coffee +++ b/src/initialize-application-window.coffee @@ -6,6 +6,7 @@ module.exports = ({blobStore}) -> {getWindowLoadSettings} = require './window-load-settings-helpers' {ipcRenderer} = require 'electron' {resourcePath, isSpec, devMode, env} = getWindowLoadSettings() + require '../src/electron-shims' updateProcessEnv(env) diff --git a/src/initialize-test-window.coffee b/src/initialize-test-window.coffee index d5423a5a5..a775ec3fb 100644 --- a/src/initialize-test-window.coffee +++ b/src/initialize-test-window.coffee @@ -19,6 +19,7 @@ module.exports = ({blobStore}) -> {getWindowLoadSettings} = require './window-load-settings-helpers' AtomEnvironment = require '../src/atom-environment' ApplicationDelegate = require '../src/application-delegate' + require '../src/electron-shims' {testRunnerPath, legacyTestRunnerPath, headless, logFile, testPaths} = getWindowLoadSettings() diff --git a/src/window-event-handler.coffee b/src/window-event-handler.coffee index ea17cb41f..1a138bcaf 100644 --- a/src/window-event-handler.coffee +++ b/src/window-event-handler.coffee @@ -164,7 +164,8 @@ class WindowEventHandler else @applicationDelegate.didCancelWindowUnload() - confirmed + # Returning any non-void value stops the window from unloading + return true unless confirmed handleWindowUnload: => @atomEnvironment.destroy() diff --git a/static/panes.less b/static/panes.less index 89c9569a8..d2290d42c 100644 --- a/static/panes.less +++ b/static/panes.less @@ -16,8 +16,12 @@ atom-pane-container { min-width: 0; & > atom-pane-resize-handle { - position: absolute; - z-index: 3; + position: relative; + &:before { + content: ""; + position: absolute; + z-index: 3; + } } } @@ -25,11 +29,14 @@ atom-pane-container { flex-direction: column; & > atom-pane-resize-handle { - width: 100%; - height: 8px; - margin-top: -4px; - cursor: row-resize; border-bottom: none; + &:before { + height: 8px; + top: -4px; + left: 0; + right: 0; + cursor: row-resize; + } } } @@ -37,11 +44,14 @@ atom-pane-container { flex-direction: row; & > atom-pane-resize-handle { - width: 8px; - height: 100%; - margin-left: -4px; - cursor: col-resize; border-right: none; + &:before { + width: 8px; + left: -4px; + top: 0; + bottom: 0; + cursor: col-resize; + } } }