refactor: remove electron.asar and embed JS in binary (#18577)

* refactor: remove electron.asar and embed JS in binary

* chore: update DEPS to merged node sha

* chore: remove unneeded eslint ignore
This commit is contained in:
Samuel Attard 2019-06-03 17:03:59 -07:00 committed by GitHub
parent 901cdb22e3
commit 24b3d66767
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
16 changed files with 44 additions and 62 deletions

View file

@ -14,8 +14,9 @@ require('../common/reset-search-paths')
require('@electron/internal/common/init')
// Export node bindings to global.
global.require = __non_webpack_require__ // eslint-disable-line
global.module = Module._cache[__filename]
const { makeRequireFunction } = __non_webpack_require__('internal/modules/cjs/helpers') // eslint-disable-line
global.module = new Module('electron/js2c/worker_init')
global.require = makeRequireFunction(global.module)
// Set the __filename to the path of html file if it is file: protocol.
if (self.location.protocol === 'file:') {
@ -27,8 +28,9 @@ if (self.location.protocol === 'file:') {
global.module.filename = global.__filename
// Also search for module under the html file.
global.module.paths = global.module.paths.concat(Module._nodeModulePaths(global.__dirname))
global.module.paths = Module._nodeModulePaths(global.__dirname)
} else {
global.__filename = __filename
global.__dirname = __dirname
// For backwards compatibility we fake these two paths here
global.__filename = path.join(process.resourcesPath, 'electron.asar', 'worker', 'init.js')
global.__dirname = path.join(process.resourcesPath, 'electron.asar', 'worker')
}