From e453b04105abdea29fefb3a85bc11636471b027f Mon Sep 17 00:00:00 2001 From: Antonio Scandurra Date: Mon, 27 Feb 2017 16:37:48 +0100 Subject: [PATCH] Put back code that was commented out --- script/build | 2 +- script/lib/transpile-babel-paths.js | 1 - src/atom-environment.coffee | 8 +++++++- src/coffee-script.js | 3 ++- src/initialize-application-window.coffee | 4 ++-- src/package.coffee | 1 + static/index.js | 11 ++++++----- 7 files changed, 19 insertions(+), 11 deletions(-) diff --git a/script/build b/script/build index 7ceb239b9..2b45e425d 100755 --- a/script/build +++ b/script/build @@ -4,7 +4,7 @@ // Run bootstrap first to ensure all the dependencies used later in this script // are installed. -//require('./bootstrap') +require('./bootstrap') // Needed so we can require src/module-cache.coffee during generateModuleCache require('coffee-script/register') diff --git a/script/lib/transpile-babel-paths.js b/script/lib/transpile-babel-paths.js index 0a6a15f93..3c440a4bd 100644 --- a/script/lib/transpile-babel-paths.js +++ b/script/lib/transpile-babel-paths.js @@ -28,7 +28,6 @@ function getPathsToTranspile () { paths = paths.concat(glob.sync(path.join(CONFIG.intermediateAppPath, 'benchmarks', '**', '*.js'))) paths = paths.concat(glob.sync(path.join(CONFIG.intermediateAppPath, 'exports', '**', '*.js'))) paths = paths.concat(glob.sync(path.join(CONFIG.intermediateAppPath, 'src', '**', '*.js'))) - paths = paths.concat(glob.sync(path.join(CONFIG.intermediateAppPath, '**', 'atom-select-list', 'src', 'select-list-view.js'))) for (let packageName of Object.keys(CONFIG.appMetadata.packageDependencies)) { paths = paths.concat(glob.sync( path.join(CONFIG.intermediateAppPath, 'node_modules', packageName, '**', '*.js'), diff --git a/src/atom-environment.coffee b/src/atom-environment.coffee index dae45f7a2..3133b5af8 100644 --- a/src/atom-environment.coffee +++ b/src/atom-environment.coffee @@ -131,7 +131,7 @@ class AtomEnvironment extends Model # Call .loadOrCreate instead constructor: (params={}) -> - {@applicationDelegate, @window, @document, @clipboard, @configDirPath, @enablePersistence, onlyLoadBaseStyleSheets} = params + {@blobStore, @applicationDelegate, @window, @document, @clipboard, @configDirPath, @enablePersistence, onlyLoadBaseStyleSheets} = params @unloaded = false @loadTime = null @@ -733,6 +733,7 @@ class AtomEnvironment extends Model @storeWindowBackground() @packages.deactivatePackages() + @saveBlobStoreSync() @unloaded = true openInitialEmptyEditorIfNecessary: -> @@ -866,6 +867,11 @@ class AtomEnvironment extends Model showSaveDialogSync: (options={}) -> @applicationDelegate.showSaveDialog(options) + saveBlobStoreSync: -> + return unless @enablePersistence + + @blobStore.save() + saveState: (options) -> new Promise (resolve, reject) => if @enablePersistence and @project diff --git a/src/coffee-script.js b/src/coffee-script.js index 45f55e219..0437e787f 100644 --- a/src/coffee-script.js +++ b/src/coffee-script.js @@ -35,7 +35,8 @@ exports.compile = function (sourceCode, filePath) { var output = CoffeeScript.compile(sourceCode, { filename: filePath, - sourceFiles: [filePath] + sourceFiles: [filePath], + inlineMap: true }) // Strip sourceURL from output so there wouldn't be duplicate entries diff --git a/src/initialize-application-window.coffee b/src/initialize-application-window.coffee index 24039ac4e..a3a57e886 100644 --- a/src/initialize-application-window.coffee +++ b/src/initialize-application-window.coffee @@ -51,7 +51,7 @@ require('whitespace') require('wrap-guide') # Like sands through the hourglass, so are the days of our lives. -module.exports = -> +module.exports = ({blobStore}) -> {updateProcessEnv} = require('./update-process-env') path = require 'path' require './window' @@ -72,7 +72,7 @@ module.exports = -> TextEditor.setClipboard(clipboard) window.atom = new AtomEnvironment({ - window, document, clipboard, + window, document, clipboard, blobStore, applicationDelegate: new ApplicationDelegate, configDirPath: process.env.ATOM_HOME, enablePersistence: true, diff --git a/src/package.coffee b/src/package.coffee index 386cc0018..dea9c0e58 100644 --- a/src/package.coffee +++ b/src/package.coffee @@ -7,6 +7,7 @@ fs = require 'fs-plus' {Emitter, CompositeDisposable} = require 'event-kit' CompileCache = require './compile-cache' +ModuleCache = require './module-cache' ScopedProperties = require './scoped-properties' BufferedProcess = require './buffered-process' diff --git a/static/index.js b/static/index.js index 8809bf436..8d5263c00 100644 --- a/static/index.js +++ b/static/index.js @@ -34,13 +34,14 @@ } } } else if (useSnapshot) { - Module.prototype.require = function (modulePath) { - const absoluteFilePath = Module._resolveFilename(modulePath, this, false) - const relativeFilePath = path.relative(entryPointDirPath, absoluteFilePath) - return snapshotResult.customRequire(relativeFilePath) + Module.prototype.require = function (path) { + const absoluteFilePath = Module._resolveFilename(path, this, false) + const relativeFilePath = Path.relative(entryPointDirPath, absoluteFilePath) + const cachedModule = snapshotResult.customRequire.cache[relativeFilePath] + return cachedModule ? cachedModule : Module._load(path, this, false) } - snapshotResult.setGlobals(global, process, window, document, Module._load) + snapshotResult.setGlobals(global, process, window, document, require) } const FileSystemBlobStore = requireFunction('../src/file-system-blob-store.js')