lib/graph/make_graph_with_bundles.js
function mergeIntoMasterAndAddBundle(opts) {
	var mains = opts.mains;
	var loader = opts.loader;
	var newGraph = opts.newGraph;
	var bundleName = opts.bundleName;
	var masterGraph = opts.masterGraph;

	for(var name in newGraph) {
		var oldNode = masterGraph[name];
		var newNode = newGraph[name];

		if(!oldNode || hasNewDeps(oldNode, newNode)) {
			masterGraph[name] = newGraph[name];
		}
		// If it's a plugin we'll use the new node but need to copy any previous
		// bundles onto the new node
		else if(masterGraph[name] && masterGraph[name].isPlugin) {
			var oldBundle = masterGraph[name].bundles || [];
			masterGraph[name] = newGraph[name];
			oldBundle.forEach(function(bundle){
				addBundle(masterGraph[name], bundle);
			});
		}
		// If this is the configMain like package.json!npm we need to override
		// the source every time because it continuously changes.
		else if(masterGraph[name] && name === loader.configMain) {
			var node = masterGraph[name];
			node.load.source = newGraph[name].load.source;
		}

		// do not track bundles of entry point modules (a.k.a mains) unless
		// it is its own bundle.
		if (name === bundleName || !includes(mains, name)) {
			addBundle(masterGraph[name], bundleName);
		}
	}
}
function mergeIntoMasterAndAddBundle(opts) {
	var mains = opts.mains;
	var loader = opts.loader;
	var newGraph = opts.newGraph;
	var bundleName = opts.bundleName;
	var masterGraph = opts.masterGraph;

	for(var name in newGraph) {
		var oldNode = masterGraph[name];
		var newNode = newGraph[name];

		if(!oldNode || hasNewDeps(oldNode, newNode)) {
			masterGraph[name] = newGraph[name];
		}
		// If it's a plugin we'll use the new node but need to copy any previous
		// bundles onto the new node
		else if(masterGraph[name] && masterGraph[name].isPlugin) {
			var oldBundle = masterGraph[name].bundles || [];
			masterGraph[name] = newGraph[name];
			oldBundle.forEach(function(bundle){
				addBundle(masterGraph[name], bundle);
			});
		}
		// If this is the configMain like package.json!npm we need to override
		// the source every time because it continuously changes.
		else if(masterGraph[name] && name === loader.configMain) {
			var node = masterGraph[name];
			node.load.source = newGraph[name].load.source;
		}

		// do not track bundles of entry point modules (a.k.a mains) unless
		// it is its own bundle.
		if (name === bundleName || !includes(mains, name)) {
			addBundle(masterGraph[name], bundleName);
		}
	}
}
function mergeIntoMasterAndAddBundle ( opts ) { var mains = opts . mains ; var loader = opts . loader ; var newGraph = opts . newGraph ; var bundleName = opts . bundleName ; var masterGraph = opts . masterGraph ; for ( var name in newGraph ) { var oldNode = masterGraph [ name ] ; var newNode = newGraph [ name ] ; if ( ! oldNode || hasNewDeps ( oldNode , newNode ) ) { masterGraph [ name ] = newGraph [ name ] ; } // If it's a plugin we'll use the new node but need to copy any previous // bundles onto the new node else if ( masterGraph [ name ] && masterGraph [ name ] . isPlugin ) { var oldBundle = masterGraph [ name ] . bundles || [ ] ; masterGraph [ name ] = newGraph [ name ] ; oldBundle . forEach ( function ( bundle ) { addBundle ( masterGraph [ name ] , bundle ) ; } ) ; } // If this is the configMain like package.json!npm we need to override // the source every time because it continuously changes. else if ( masterGraph [ name ] && name === loader . configMain ) { var node = masterGraph [ name ] ; node . load . source = newGraph [ name ] . load . source ; } // do not track bundles of entry point modules (a.k.a mains) unless // it is its own bundle. if ( name === bundleName || ! includes ( mains , name ) ) { addBundle ( masterGraph [ name ] , bundleName ) ; } } }
merges everything in `newGraph` into `masterGraph` and make sure it lists `bundle` as one of its bundles.
merges everything in newGraph into masterGraph and make sure it lists bundle as one of its bundles .