mirror of
https://github.com/atom/atom.git
synced 2026-04-06 03:02:13 -04:00
Bake source maps into the snapshot
This commit is contained in:
@@ -58,7 +58,7 @@ module.exports = function (packagedAppPath) {
|
||||
relativePath == path.join('..', 'node_modules', 'tmp', 'lib', 'tmp.js')
|
||||
)
|
||||
}
|
||||
}).then(({snapshotScript, sourceMap}) => {
|
||||
}).then((snapshotScript) => {
|
||||
fs.writeFileSync(snapshotScriptPath, snapshotScript)
|
||||
process.stdout.write('\n')
|
||||
|
||||
@@ -72,23 +72,15 @@ module.exports = function (packagedAppPath) {
|
||||
[snapshotScriptPath, '--startup_blob', generatedStartupBlobPath]
|
||||
)
|
||||
|
||||
let startupBlobDestinationPath, startupBlobSourceMapDestinationPath
|
||||
let startupBlobDestinationPath
|
||||
if (process.platform === 'darwin') {
|
||||
startupBlobDestinationPath = `${packagedAppPath}/Contents/Frameworks/Electron Framework.framework/Resources/snapshot_blob.bin`
|
||||
startupBlobSourceMapDestinationPath = path.join(packagedAppPath, 'Contents', 'Resources', 'snapshot_sourcemap.json')
|
||||
} else if (process.platform === 'linux') {
|
||||
startupBlobDestinationPath = path.join(packagedAppPath, 'snapshot_blob.bin')
|
||||
startupBlobSourceMapDestinationPath = path.join(packagedAppPath, 'resources', 'snapshot_sourcemap.json')
|
||||
} else {
|
||||
startupBlobDestinationPath = path.join(packagedAppPath, 'snapshot_blob.bin')
|
||||
startupBlobSourceMapDestinationPath = path.join(packagedAppPath, 'resources', 'snapshot_sourcemap.json')
|
||||
}
|
||||
|
||||
console.log(`Moving generated startup blob into "${startupBlobDestinationPath}"`)
|
||||
fs.unlinkSync(startupBlobDestinationPath)
|
||||
fs.renameSync(generatedStartupBlobPath, startupBlobDestinationPath)
|
||||
|
||||
console.log(`Moving generated startup blob sourcemap into "${startupBlobSourceMapDestinationPath}"`)
|
||||
fs.writeFileSync(startupBlobSourceMapDestinationPath, sourceMap)
|
||||
})
|
||||
}
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
"csslint": "1.0.2",
|
||||
"donna": "1.0.13",
|
||||
"electron-chromedriver": "~1.3",
|
||||
"electron-link": "0.0.19",
|
||||
"electron-link": "0.0.20",
|
||||
"electron-mksnapshot": "~1.3",
|
||||
"electron-packager": "7.3.0",
|
||||
"electron-winstaller": "2.5.1",
|
||||
|
||||
@@ -115,7 +115,7 @@ function writeCachedJavascript (relativeCachePath, code) {
|
||||
var INLINE_SOURCE_MAP_REGEXP = /\/\/[#@]\s*sourceMappingURL=([^'"\n]+)\s*$/mg
|
||||
let snapshotSourceMap = null
|
||||
|
||||
exports.install = function (nodeRequire) {
|
||||
exports.install = function (resourcesPath, nodeRequire) {
|
||||
sourceMapSupport.install({
|
||||
handleUncaughtExceptions: false,
|
||||
|
||||
@@ -124,14 +124,9 @@ exports.install = function (nodeRequire) {
|
||||
// code from our cache directory.
|
||||
retrieveSourceMap: function (filePath) {
|
||||
if (filePath === '<embedded>') {
|
||||
if (snapshotSourceMap == null) {
|
||||
const snapshotSourceMapContent = fs.readFileSync(path.join(process.resourcesPath, 'snapshot_sourcemap.json'), 'utf8')
|
||||
snapshotSourceMap = JSON.parse(snapshotSourceMapContent)
|
||||
}
|
||||
|
||||
return {
|
||||
map: snapshotSourceMap,
|
||||
url: path.join(process.resourcesPath, 'app', 'static', 'index.js')
|
||||
map: snapshotResult.sourceMap,
|
||||
url: path.join(resourcesPath, 'app', 'static', 'index.js')
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -83,5 +83,5 @@ function handleStartupEventWithSquirrel () {
|
||||
function setupCompileCache () {
|
||||
const CompileCache = require('../compile-cache')
|
||||
CompileCache.setAtomHomeDirectory(process.env.ATOM_HOME)
|
||||
CompileCache.install(require)
|
||||
CompileCache.install(process.resourcesPath, require)
|
||||
}
|
||||
|
||||
@@ -76,7 +76,7 @@ class Task
|
||||
|
||||
CompileCache = #{compileCacheRequire}
|
||||
CompileCache.setCacheDirectory('#{compileCachePath}');
|
||||
CompileCache.install(require)
|
||||
CompileCache.install("#{process.resourcesPath}", require)
|
||||
#{taskBootstrapRequire}
|
||||
"""
|
||||
bootstrap = bootstrap.replace(/\\/g, "\\\\")
|
||||
|
||||
@@ -90,7 +90,7 @@
|
||||
function setupWindow () {
|
||||
const CompileCache = useSnapshot ? snapshotResult.customRequire('../src/compile-cache.js') : require('../src/compile-cache') // eslint-disable-line no-undef
|
||||
CompileCache.setAtomHomeDirectory(process.env.ATOM_HOME)
|
||||
CompileCache.install(require)
|
||||
CompileCache.install(process.resourcesPath, require)
|
||||
|
||||
const ModuleCache = useSnapshot ? snapshotResult.customRequire('../src/module-cache.js') : require('../src/module-cache') // eslint-disable-line no-undef
|
||||
ModuleCache.register(getWindowLoadSettings())
|
||||
|
||||
Reference in New Issue
Block a user