mirror of
https://github.com/atom/atom.git
synced 2026-04-28 03:01:47 -04:00
Use the generated snapshot source map in source-map-support
This will report the correct file and line numbers on stack traces instead of always showing `<embedded>:absoluteLineNumber`. As a result, it will also fix the `notifications` package, which will be able again to identify which package threw an exception and to create an issue on its repository.
This commit is contained in:
@@ -58,12 +58,12 @@ module.exports = function (packagedAppPath) {
|
||||
relativePath == path.join('..', 'node_modules', 'tmp', 'lib', 'tmp.js')
|
||||
)
|
||||
}
|
||||
}).then((snapshotScriptContent) => {
|
||||
fs.writeFileSync(snapshotScriptPath, snapshotScriptContent)
|
||||
}).then(({snapshotScript, sourceMap}) => {
|
||||
fs.writeFileSync(snapshotScriptPath, snapshotScript)
|
||||
process.stdout.write('\n')
|
||||
|
||||
console.log('Verifying if snapshot can be executed via `mksnapshot`')
|
||||
vm.runInNewContext(snapshotScriptContent, undefined, {filename: snapshotScriptPath, displayErrors: true})
|
||||
vm.runInNewContext(snapshotScript, undefined, {filename: snapshotScriptPath, displayErrors: true})
|
||||
|
||||
const generatedStartupBlobPath = path.join(CONFIG.buildOutputPath, 'snapshot_blob.bin')
|
||||
console.log(`Generating startup blob at "${generatedStartupBlobPath}"`)
|
||||
@@ -72,15 +72,23 @@ module.exports = function (packagedAppPath) {
|
||||
[snapshotScriptPath, '--startup_blob', generatedStartupBlobPath]
|
||||
)
|
||||
|
||||
let startupBlobDestinationPath
|
||||
let startupBlobDestinationPath, startupBlobSourceMapDestinationPath
|
||||
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.18",
|
||||
"electron-link": "0.0.19",
|
||||
"electron-mksnapshot": "~1.3",
|
||||
"electron-packager": "7.3.0",
|
||||
"electron-winstaller": "2.5.1",
|
||||
|
||||
Reference in New Issue
Block a user