src/node/inline-module.js
function inlineAndCompile(filenames, options, reporter, callback, errback) {

  // The caller needs to do a chdir.
  var basePath = './';
  var depTarget = options && options.depTarget;

  var loadCount = 0;
  var elements = [];
  var project = new Project(basePath);
  var loader = new InlineCodeLoader(reporter, project, elements, depTarget);

  function loadNext() {
    var codeUnit = loader.load(filenames[loadCount]);
    startCodeUnit = codeUnit;

    codeUnit.addListener(function() {
      loadCount++;
      if (loadCount < filenames.length) {
        loadNext();
      } else if (depTarget) {
        callback(null);
      } else {
        var tree = allLoaded(basePath, reporter, elements);
        callback(tree);
      }
    }, function() {
      console.error(codeUnit.loader.error);
      errback(codeUnit.loader.error);
    });
  }

  loadNext();
}
function inlineAndCompile(filenames, options, reporter, callback, errback) {

  // The caller needs to do a chdir.
  var basePath = './';
  var depTarget = options && options.depTarget;

  var loadCount = 0;
  var elements = [];
  var project = new Project(basePath);
  var loader = new InlineCodeLoader(reporter, project, elements, depTarget);

  function loadNext() {
    var codeUnit = loader.load(filenames[loadCount]);
    startCodeUnit = codeUnit;

    codeUnit.addListener(function() {
      loadCount++;
      if (loadCount < filenames.length) {
        loadNext();
      } else if (depTarget) {
        callback(null);
      } else {
        var tree = allLoaded(basePath, reporter, elements);
        callback(tree);
      }
    }, function() {
      console.error(codeUnit.loader.error);
      errback(codeUnit.loader.error);
    });
  }

  loadNext();
}
function inlineAndCompile ( filenames , options , reporter , callback , errback ) { // The caller needs to do a chdir. var basePath = './' ; var depTarget = options && options . depTarget ; var loadCount = 0 ; var elements = [ ] ; var project = new Project ( basePath ) ; var loader = new InlineCodeLoader ( reporter , project , elements , depTarget ) ; function loadNext ( ) { var codeUnit = loader . load ( filenames [ loadCount ] ) ; startCodeUnit = codeUnit ; codeUnit . addListener ( function ( ) { loadCount ++ ; if ( loadCount < filenames . length ) { loadNext ( ) ; } else if ( depTarget ) { callback ( null ) ; } else { var tree = allLoaded ( basePath , reporter , elements ) ; callback ( tree ) ; } } , function ( ) { console . error ( codeUnit . loader . error ) ; errback ( codeUnit . loader . error ) ; } ) ; } loadNext ( ) ; }
Compiles the files in "filenames" along with any associated modules, into a
single js file, in proper module dependency order.

@param {Array.<string>} filenames The list of files to compile and concat.
@param {Object} options A container for misc options. 'depTarget' is the
only currently available option, which results in the dependencies for
'filenames' being printed to stdout, with 'depTarget' as the target.
@param {ErrorReporter} reporter
@param {Function} callback Callback used to return the result. A null result
indicates that inlineAndCompile has returned successfully from a
non-compile request.
@param {Function} errback Callback used to return errors.
Compiles the files in filenames along with any associated modules into a single js file in proper module dependency order .