Skip to content
This repository has been archived by the owner on Mar 16, 2022. It is now read-only.

Commit

Permalink
added addSourcemapLocation call on every ast node
Browse files Browse the repository at this point in the history
  • Loading branch information
idmitriev committed Jul 15, 2016
1 parent aa38c1a commit 4e74a37
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,11 @@ export default function ramda ( options ) {
const magicString = new MagicString( code )

ast.body.forEach( node => {
if ( sourceMap ) {
magicString.addSourcemapLocation( node.start )
magicString.addSourcemapLocation( node.end )
}

if ( node.type === 'ImportDeclaration' ) {
if(node.source.value === 'ramda'){
let imports = {}
Expand All @@ -41,11 +46,6 @@ export default function ramda ( options ) {
return
}

// if ( sourceMap ) {
// magicString.addSourcemapLocation( node.start )
// magicString.addSourcemapLocation( node.end )
// }

const importStatements = Object.keys(imports).map(
imported => `import ${imports[imported]} from 'ramda/src/${imported}';`
).join('\n')
Expand All @@ -61,7 +61,9 @@ export default function ramda ( options ) {

return {
code: magicString.toString(),
map: sourceMap ? magicString.generateMap() : null
map: sourceMap
? magicString.generateMap({ hires: true })
: null
}
}
}
Expand Down

0 comments on commit 4e74a37

Please sign in to comment.