index.js
function(nodePath, state) {
        var replacements = [];
        var expr = getGlobalExpression(state, getFilenameNoExt(state.file.opts.filename));
        var expression = nodePath.node.declaration;
        if (expression.id &&
          (t.isFunctionDeclaration(expression) || t.isClassDeclaration(expression))) {
          replacements.push(expression);
          expression = expression.id;
        }
        assignToGlobal(expr, replacements, expression);
        nodePath.replaceWithMultiple(replacements);
      }
function(nodePath, state) {
        var replacements = [];
        var expr = getGlobalExpression(state, getFilenameNoExt(state.file.opts.filename));
        var expression = nodePath.node.declaration;
        if (expression.id &&
          (t.isFunctionDeclaration(expression) || t.isClassDeclaration(expression))) {
          replacements.push(expression);
          expression = expression.id;
        }
        assignToGlobal(expr, replacements, expression);
        nodePath.replaceWithMultiple(replacements);
      }
function ( nodePath , state ) { var replacements = [ ] ; var expr = getGlobalExpression ( state , getFilenameNoExt ( state . file . opts . filename ) ) ; var expression = nodePath . node . declaration ; if ( expression . id && ( t . isFunctionDeclaration ( expression ) || t . isClassDeclaration ( expression ) ) ) { replacements . push ( expression ) ; expression = expression . id ; } assignToGlobal ( expr , replacements , expression ) ; nodePath . replaceWithMultiple ( replacements ) ; }
Replaces default export declarations with assignments to global variables.
@param {!NodePath} nodePath
@param {!Object} state
Replaces default export declarations with assignments to global variables .