mirror of
https://github.com/atom/atom.git
synced 2026-01-23 13:58:08 -05:00
Add sourceURL comment to all compiled js files
This commit is contained in:
@@ -61,7 +61,7 @@ function compileFileAtPath (compiler, filePath, extension) {
|
||||
var cachePath = compiler.getCachePath(sourceCode, filePath)
|
||||
var compiledCode = readCachedJavascript(cachePath)
|
||||
if (compiledCode == null) {
|
||||
compiledCode = compiler.compile(sourceCode, filePath)
|
||||
compiledCode = addSourceURL(compiler.compile(sourceCode, filePath), filePath)
|
||||
writeCachedJavascript(cachePath, compiledCode)
|
||||
}
|
||||
return compiledCode
|
||||
@@ -84,6 +84,12 @@ function writeCachedJavascript (relativeCachePath, code) {
|
||||
fs.writeFileSync(cachePath, code, 'utf8')
|
||||
}
|
||||
|
||||
function addSourceURL (jsCode, filePath) {
|
||||
if (process.platform === 'win32')
|
||||
filePath = '/' + path.resolve(filePath).replace(/\\/g, '/')
|
||||
return jsCode + '\n' + '//# sourceURL=' + encodeURI(filePath) + '\n'
|
||||
}
|
||||
|
||||
var INLINE_SOURCE_MAP_REGEXP = /\/\/[#@]\s*sourceMappingURL=([^'"\n]+)\s*$/mg
|
||||
|
||||
require('source-map-support').install({
|
||||
|
||||
Reference in New Issue
Block a user