index.js
function(nodePath, state) {
        var replacements = [];

        if ( nodePath.node.source.value.match(/^[\./]/) ) {
          nodePath.node.specifiers.forEach(function(specifier) {
            var expr = getGlobalExpression(
              state,
              removeExtensions(nodePath.node.source.value),
              specifier.imported ? specifier.imported.name : null,
              t.isImportNamespaceSpecifier(specifier)
            );
            replacements.push(t.variableDeclaration('var', [
              t.variableDeclarator(specifier.local, expr)
            ]));
          });
        }
        nodePath.replaceWithMultiple(replacements);
      }
function(nodePath, state) {
        var replacements = [];

        if ( nodePath.node.source.value.match(/^[\./]/) ) {
          nodePath.node.specifiers.forEach(function(specifier) {
            var expr = getGlobalExpression(
              state,
              removeExtensions(nodePath.node.source.value),
              specifier.imported ? specifier.imported.name : null,
              t.isImportNamespaceSpecifier(specifier)
            );
            replacements.push(t.variableDeclaration('var', [
              t.variableDeclarator(specifier.local, expr)
            ]));
          });
        }
        nodePath.replaceWithMultiple(replacements);
      }
function ( nodePath , state ) { var replacements = [ ] ; if ( nodePath . node . source . value . match ( / ^[\./] / ) ) { nodePath . node . specifiers . forEach ( function ( specifier ) { var expr = getGlobalExpression ( state , removeExtensions ( nodePath . node . source . value ) , specifier . imported ? specifier . imported . name : null , t . isImportNamespaceSpecifier ( specifier ) ) ; replacements . push ( t . variableDeclaration ( 'var' , [ t . variableDeclarator ( specifier . local , expr ) ] ) ) ; } ) ; } nodePath . replaceWithMultiple ( replacements ) ; }
Replaces import declarations with assignments from global to local variables.
@param {!NodePath} nodePath
@param {!Object} state
Replaces import declarations with assignments from global to local variables .