Skip to content
This repository has been archived by the owner on Oct 9, 2020. It is now read-only.

Commit

Permalink
source maps debugging
Browse files Browse the repository at this point in the history
  • Loading branch information
guybedford committed May 18, 2016
1 parent a4fd3ec commit 6ba5476
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 8 deletions.
2 changes: 1 addition & 1 deletion compilers/esm.js
Expand Up @@ -89,7 +89,7 @@ exports.compile = function(load, opts, loader) {
var babelOptions = {
babelrc: false,
plugins: [[require('babel-plugin-transform-es2015-modules-systemjs'), { systemGlobal: opts.systemGlobal }]],
filename: load.address,
filename: load.path,
sourceMaps: opts.sourceMaps,
inputSourceMap: load.metadata.sourceMap,
moduleIds: !opts.anonymous,
Expand Down
16 changes: 9 additions & 7 deletions lib/sourcemaps.js
Expand Up @@ -59,7 +59,7 @@ exports.concatenateSourceMaps = function(outFile, mapsWithOffsets, basePath, sou
}

wrapSourceMap(map).eachMapping(function(mapping) {
if (mapping.source.match(/(\/|^)@traceur/))
if (!mapping.originalLine || !mapping.originalColumn || !mapping.source || mapping.source.match(/(\/|^)@traceur/))
return;

generated.addMapping({
Expand All @@ -82,13 +82,15 @@ exports.concatenateSourceMaps = function(outFile, mapsWithOffsets, basePath, sou

if (sourceMapContents) {
normalized.sourcesContent = normalized.sources.map(function(source) {
//if (contentsBySource[source])
// return contentsBySource[source];
if (contentsBySource[source])
return contentsBySource[source];

try { return fs.readFileSync(path.resolve(basePath, source)).toString(); } catch (e) {}

// remove this if optimistic return is reliable
return contentsBySource[source];
try {
return fs.readFileSync(path.resolve(basePath, source)).toString();
}
catch (e) {
return "";
}
});
}

Expand Down

0 comments on commit 6ba5476

Please sign in to comment.