src/utils/index.js
function buildDependencyTreeFromSources(filenames, sourcesObject) {
  const orgnizedFlat = {};

  // build tree object
  filenames.forEach(sourceFileName => {
    orgnizedFlat[sourceFileName] = {
      path: sourceFileName,
      source: sourcesObject[sourceFileName],
      dependencies: buildDependencyTreeFromSources(allImportPaths(sourcesObject[sourceFileName]), sourcesObject),
    };
  });

  // return organized object
  return orgnizedFlat;
}
function buildDependencyTreeFromSources(filenames, sourcesObject) {
  const orgnizedFlat = {};

  // build tree object
  filenames.forEach(sourceFileName => {
    orgnizedFlat[sourceFileName] = {
      path: sourceFileName,
      source: sourcesObject[sourceFileName],
      dependencies: buildDependencyTreeFromSources(allImportPaths(sourcesObject[sourceFileName]), sourcesObject),
    };
  });

  // return organized object
  return orgnizedFlat;
}
function buildDependencyTreeFromSources ( filenames , sourcesObject ) { const orgnizedFlat = { } ; // build tree object filenames . forEach ( sourceFileName => { orgnizedFlat [ sourceFileName ] = { path : sourceFileName , source : sourcesObject [ sourceFileName ] , dependencies : buildDependencyTreeFromSources ( allImportPaths ( sourcesObject [ sourceFileName ] ) , sourcesObject ) , } ; } ) ; // return organized object return orgnizedFlat ; }
build dependency tree, returns a complex object
build dependency tree returns a complex object