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

Commit

Permalink
fixed a bug
Browse files Browse the repository at this point in the history
  • Loading branch information
idmitriev committed Jul 15, 2016
1 parent 88ec9db commit e67283f
Showing 1 changed file with 11 additions and 7 deletions.
18 changes: 11 additions & 7 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ export default function ramda ( options ) {
name: 'ramda',

transform(code, id){
let ast;
let ast

try {
ast = parse( code, {
Expand All @@ -22,24 +22,28 @@ export default function ramda ( options ) {
})
} catch ( err ) {
err.message += ` in ${id}`
throw err;
throw err
}

const magicString = new MagicString( code )

ast.body.forEach( node => {
if ( node.type === 'ImportDeclaration' ) {
if(node.source.value === 'ramda'){
let imports = []
let imports = {}
node.specifiers.forEach( specifier => {
if(specifier.imported != null) {
imports[specifier.imported.name] = specifier.local.name;
imports[specifier.imported.name] = specifier.local.name
}
});
})

if(Object.keys(imports).length == 0){
return
}

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

const importStatements = Object.keys(imports).map(
Expand Down

0 comments on commit e67283f

Please sign in to comment.