npm-crawl.js
function(){
		// If a task is currently loading this fileUrl,
		// wait for it to complete
		var loadingTask = this.context.loadingPaths[this.fileUrl];
		if (!loadingTask) return;

		var task = this;
		return loadingTask.promise.then(function() {
			task._fetchedPackage = loadingTask.getPackage();

			var firstTaskFailed = loadingTask.hadErrorLoading();
			var currentTaskIsCompatible = task.isCompatibleVersion();
			var firstTaskIsNotCompatible = !loadingTask.isCompatibleVersion();

			// Do not flag the current task as failed if:
			//
			//	- Current task fetches a version in rage and
			//	- First task had no error loading at all or
			//	- First task fetched an incompatible version
			//
			// otherwise, assume current task will fail for the same reason as
			// the first did
			if (currentTaskIsCompatible && (!firstTaskFailed || firstTaskIsNotCompatible)) {
				task.failed = false;
				task.error = null;
			}
			else if (!currentTaskIsCompatible) {
				task.failed = true;
				task.error = new Error("Incompatible package version requested");
			}
			else if (firstTaskFailed) {
				task.failed = true;
				task.error = loadingTask.error;
			}
		});
	}
function(){
		// If a task is currently loading this fileUrl,
		// wait for it to complete
		var loadingTask = this.context.loadingPaths[this.fileUrl];
		if (!loadingTask) return;

		var task = this;
		return loadingTask.promise.then(function() {
			task._fetchedPackage = loadingTask.getPackage();

			var firstTaskFailed = loadingTask.hadErrorLoading();
			var currentTaskIsCompatible = task.isCompatibleVersion();
			var firstTaskIsNotCompatible = !loadingTask.isCompatibleVersion();

			// Do not flag the current task as failed if:
			//
			//	- Current task fetches a version in rage and
			//	- First task had no error loading at all or
			//	- First task fetched an incompatible version
			//
			// otherwise, assume current task will fail for the same reason as
			// the first did
			if (currentTaskIsCompatible && (!firstTaskFailed || firstTaskIsNotCompatible)) {
				task.failed = false;
				task.error = null;
			}
			else if (!currentTaskIsCompatible) {
				task.failed = true;
				task.error = new Error("Incompatible package version requested");
			}
			else if (firstTaskFailed) {
				task.failed = true;
				task.error = loadingTask.error;
			}
		});
	}
function ( ) { // If a task is currently loading this fileUrl, // wait for it to complete var loadingTask = this . context . loadingPaths [ this . fileUrl ] ; if ( ! loadingTask ) return ; var task = this ; return loadingTask . promise . then ( function ( ) { task . _fetchedPackage = loadingTask . getPackage ( ) ; var firstTaskFailed = loadingTask . hadErrorLoading ( ) ; var currentTaskIsCompatible = task . isCompatibleVersion ( ) ; var firstTaskIsNotCompatible = ! loadingTask . isCompatibleVersion ( ) ; // Do not flag the current task as failed if: // //	- Current task fetches a version in rage and //	- First task had no error loading at all or //	- First task fetched an incompatible version // // otherwise, assume current task will fail for the same reason as // the first did if ( currentTaskIsCompatible && ( ! firstTaskFailed || firstTaskIsNotCompatible ) ) { task . failed = false ; task . error = null ; } else if ( ! currentTaskIsCompatible ) { task . failed = true ; task . error = new Error ( "Incompatible package version requested" ) ; } else if ( firstTaskFailed ) { task . failed = true ; task . error = loadingTask . error ; } } ) ; }
Handle the case where this fileUrl is already loading
Handle the case where this fileUrl is already loading