docs: function flagBundlesIncludedByCommonParentModule(modules,bundles) {
  	var
  		 bundleToModule = extractBundleToModuleMap(modules),
  		 bundleMap = extractBundleMap(bundles.bundlesArray),
  		 moduleAncestors = {},
  		 modulesArray, x, commonAncestor;
  	
  	for( x in bundleToModule ) {
  		if( !bundleToModule.hasOwnProperty(x) ) continue;
  		modulesArray = bundleToModule[x];
  		commonAncestor = extractCommonAncestor(modulesArray);
  		if( commonAncestor != null ) {
  			includeBundleInModule(bundleMap[x], commonAncestor);
  		}
  	}
  	
  	
  	function extractBundleToModuleMap(modules) {
  		var x, i, ret = {}, bundleDeps, dependentModules;
  		for( x in modules ) {
  			if( !modules.hasOwnProperty(x) ) continue;
  			bundleDeps = modules[x].bundleDeps;
  			for( i=0; i < bundleDeps.length; i++ ) {
  				if( bundleDeps[i].exclusive ) continue;
  				dependentModules = ret[bundleDeps[i].id];
  				if( dependentModules == null ) {
  					dependentModules = [];
  					ret[bundleDeps[i].id] = dependentModules;
  				}
  				dependentModules.push(modules[x]);
  			}
  		}
  		return ret;
  	}
  	
  	function extractBundleMap(bundlesArray) {
  		var i, ret = {};
  		for( i=0; i < bundlesArray.length; i++ ) {
  			ret[bundlesArray[i].id] = bundlesArray[i];
  		}
  		return ret;
  	}
  	
  	function findAllAncestors(module) {
  		var ret = moduleAncestors[module.name];
  		if( ret == null ) {
  			ret = [];
  			moduleAncestors[module.name] = ret;
  			addParents(ret, module);
  		}
  		return ret;
  		
  		function addParents(ret, module) {
  			var i, j, grandParents;
  			for( i=0; i < module.parents.length; i++ ) {
  				if( ret.indexOf(module.parents[i]) < 0 ) {
  					ret.push(module.parents[i]);
  					grandParents = findAllAncestors(modules[module.parents[i]]);
  					for( j=0; j < grandParents.length; j++ ) {
  						if( ret.indexOf(grandParents[j]) < 0 ) ret.push(grandParents[j]);
  					}
  				}
  				
  			}
  		}
  	}
  	
  	function isAncestor(potentialAncestorModuleName, module) {
  		if( typeof(module) === "string" ) module = modules[module];
  		var a = findAllAncestors(module);
  		return a.indexOf(potentialAncestorModuleName) >= 0;
  	}
  	
  	function extractCommonAncestor(modulesArray) {
  		var i, j, foundNonAncestor;
  		for( i=0; i < modulesArray.length; i++ ) {
  			foundNonAncestor = false;
  			for( j=0; j < modulesArray.length; j++ ) {
  				if( i !== j ) {
  					if( !isAncestor(modulesArray[i].name, modulesArray[j]) ) {
  						foundNonAncestor = true;
  						break;
  					}
  				}
  			}
  			if( !foundNonAncestor ) {
  				return modulesArray[i];
  			}
  		}
  		return null;
  	}
  	
  	function includeBundleInModule(bundle, module) {
  		var i, index, newExcludedDeps = [];
  		bundle.includedIn = module.name;
  		// re-enable bundle deps in module
  		for( i=0; i < bundle.deps.length; i++ ) {
  			index = module.excludedDeps.indexOf(bundle.deps[i]);
  			module.excludedDeps[index] = false
  		}
  		for( i=0; i < module.excludedDeps.length; i++ ) {
  			if( module.excludedDeps[i] === false ) continue;
  			newExcludedDeps.push(module.excludedDeps[i]);
  		}
  		module.excludedDeps = newExcludedDeps;
  	}
  }