lib/findExports.js
function findAliasesForExports(nodes) {
  const result = new Set(['exports']);
  nodes.forEach((node) => {
    if (node.type !== 'VariableDeclaration') {
      return;
    }
    node.declarations.forEach(({ id, init }) => {
      if (!init) {
        return;
      }
      if (init.type !== 'Identifier') {
        return;
      }
      if (init.name !== 'exports') {
        return;
      }
      // We have something like
      // var foo = exports;
      result.add(id.name);
    });
  });
  return result;
}
function findAliasesForExports(nodes) {
  const result = new Set(['exports']);
  nodes.forEach((node) => {
    if (node.type !== 'VariableDeclaration') {
      return;
    }
    node.declarations.forEach(({ id, init }) => {
      if (!init) {
        return;
      }
      if (init.type !== 'Identifier') {
        return;
      }
      if (init.name !== 'exports') {
        return;
      }
      // We have something like
      // var foo = exports;
      result.add(id.name);
    });
  });
  return result;
}
function findAliasesForExports ( nodes ) { const result = new Set ( [ 'exports' ] ) ; nodes . forEach ( ( node ) => { if ( node . type !== 'VariableDeclaration' ) { return ; } node . declarations . forEach ( ( { id , init } ) => { if ( ! init ) { return ; } if ( init . type !== 'Identifier' ) { return ; } if ( init . name !== 'exports' ) { return ; } // We have something like // var foo = exports; result . add ( id . name ) ; } ) ; } ) ; return result ; }
This function will find variable declarations where `exports` is redefined as
something else. E.g.

const moduleName = exports;
This function will find variable declarations where exports is redefined as something else . E . g .