lib/di.js
function _require(requireMe, provides, injects, currentDirectory, next) {

    var requireResult =  _requireFile (requireMe, currentDirectory) ||
                         _requireFile (requireMe, defaultDirectory) ||
                         _requireFile (requireMe, __dirname) ||
                         _requireFile (requireMe, process.cwd()) ||
                         _requireFile (requireMe, (void 0));

    if(!exists(requireResult)) {
      var directories = 'directories:(';
      directories += exists(currentDirectory) ? currentDirectory + ', ' : '';
      directories += exists(defaultDirectory) ? defaultDirectory + ', ' : '';
      directories += __dirname + ')';
      throw new Error('dihelper incapable of finding specified file for require filename:' +
          requireMe + ', ' + directories);
    }

    if (typeof provides === 'undefined' && !exists(requireResult.$provide)) {
    //TODO(@davequick): also look for annotations once ES6, for now can't because you would
    // receive a different di instance if you did require('di/dist/cjs/annotations') so class
    // equalities would not work.  Once all is ES6, then instanceof for the classes should work
    // and add it here.  For now you have to have a string or object on yourmodule.$provide or
    // it will be overwritten.

      provides = requireMe;
    }

    return next(requireResult, provides, injects);
  }
function _require(requireMe, provides, injects, currentDirectory, next) {

    var requireResult =  _requireFile (requireMe, currentDirectory) ||
                         _requireFile (requireMe, defaultDirectory) ||
                         _requireFile (requireMe, __dirname) ||
                         _requireFile (requireMe, process.cwd()) ||
                         _requireFile (requireMe, (void 0));

    if(!exists(requireResult)) {
      var directories = 'directories:(';
      directories += exists(currentDirectory) ? currentDirectory + ', ' : '';
      directories += exists(defaultDirectory) ? defaultDirectory + ', ' : '';
      directories += __dirname + ')';
      throw new Error('dihelper incapable of finding specified file for require filename:' +
          requireMe + ', ' + directories);
    }

    if (typeof provides === 'undefined' && !exists(requireResult.$provide)) {
    //TODO(@davequick): also look for annotations once ES6, for now can't because you would
    // receive a different di instance if you did require('di/dist/cjs/annotations') so class
    // equalities would not work.  Once all is ES6, then instanceof for the classes should work
    // and add it here.  For now you have to have a string or object on yourmodule.$provide or
    // it will be overwritten.

      provides = requireMe;
    }

    return next(requireResult, provides, injects);
  }
function _require ( requireMe , provides , injects , currentDirectory , next ) { var requireResult = _requireFile ( requireMe , currentDirectory ) || _requireFile ( requireMe , defaultDirectory ) || _requireFile ( requireMe , __dirname ) || _requireFile ( requireMe , process . cwd ( ) ) || _requireFile ( requireMe , ( void 0 ) ) ; if ( ! exists ( requireResult ) ) { var directories = 'directories:(' ; directories += exists ( currentDirectory ) ? currentDirectory + ', ' : '' ; directories += exists ( defaultDirectory ) ? defaultDirectory + ', ' : '' ; directories += __dirname + ')' ; throw new Error ( 'dihelper incapable of finding specified file for require filename:' + requireMe + ', ' + directories ) ; } if ( typeof provides === 'undefined' && ! exists ( requireResult . $provide ) ) { //TODO(@davequick): also look for annotations once ES6, for now can't because you would // receive a different di instance if you did require('di/dist/cjs/annotations') so class // equalities would not work.  Once all is ES6, then instanceof for the classes should work // and add it here.  For now you have to have a string or object on yourmodule.$provide or // it will be overwritten. provides = requireMe ; } return next ( requireResult , provides , injects ) ; }
internal helper for the exposed require helpers to cut down on replication of code.
@private
@param {string} requireMe is string passed to require()
@param {string|object} [provides] - is either an array or string of things this object provides
@param {string|string[]|object|objects[]} [injects] - is either a single string or array of
strings of module names to be injected
@param {string} [currentDirectory] - directory to attempt first require from
@param {function} next function (wrap or override) to call with the result of the require
@returns {*}
internal helper for the exposed require helpers to cut down on replication of code .