enhanced-resolve
Advanced tools
Comparing version 0.3.0 to 0.3.1
@@ -282,3 +282,5 @@ /* | ||
} | ||
return callback(new Error("Non of this files exists: " + tries.join(", "))); | ||
var notFoundErr = new Error("Non of this files exists: " + tries.join(", ")); | ||
notFoundErr.notImportant = true; | ||
return callback(notFoundErr); | ||
} | ||
@@ -292,3 +294,5 @@ }); | ||
if(err || !stats || !stats.isDirectory()) { | ||
return callback(new Error(dirname + " is not a directory")); | ||
var notFoundErr = new Error(dirname + " is not a directory"); | ||
notFoundErr.notImportant = true; | ||
return callback(notFoundErr); | ||
} | ||
@@ -301,6 +305,11 @@ var packageJsonFile = join(split(dirname), ["package.json"]); | ||
if(err) { | ||
err.notImportant = true; | ||
callback(err); | ||
return; | ||
} | ||
content = JSON.parse(content); | ||
try { | ||
content = JSON.parse(content); | ||
} catch (jsonError) { | ||
return callback(jsonError); | ||
} | ||
var packageMains = type === "loader" ? options.loaderPackageMains : options.packageMains; | ||
@@ -317,4 +326,5 @@ for(var i = 0; i < packageMains.length; i++) { | ||
loadAsFile(join(split(dirname), [mainModule, "index"]), options, type, sync, function(err2, absoluteFilename) { | ||
if(err2) return callback(err); | ||
return callback(null, absoluteFilename); | ||
if(!err2) return callback(null, absoluteFilename); | ||
err.notImportant = true; | ||
return callback(err); | ||
}) | ||
@@ -335,5 +345,5 @@ }); | ||
loadAsFile(pathname, options, type, sync, function loadAsFileOrDirectoryFileResultCallback(err, absoluteFilename) { | ||
if(err) | ||
error = err; | ||
else { | ||
if(err) { | ||
if(!err.notImportant || !error) error = err; | ||
} else { | ||
fastExit = true; | ||
@@ -346,3 +356,3 @@ return callback(null, absoluteFilename); | ||
if(err) { | ||
if(!error) error = err; | ||
if(!error || (error.notImportant && !err.notImportant)) error = err; | ||
} else { | ||
@@ -363,2 +373,3 @@ result = absoluteFilename; | ||
function loadNodeModules(context, identifier, options, type, sync, callback) { | ||
var firstError = null; | ||
var moduleName = identifier.shift(); | ||
@@ -377,3 +388,3 @@ var postfixes = type === "loader" ? options.loaderPostfixes : options.postfixes; | ||
}, function() { | ||
callback(new Error("non in any path of paths")); | ||
callback(firstError || new Error("non in any path of paths")); | ||
}); | ||
@@ -393,2 +404,3 @@ }); | ||
(sync?statSync:statAsync)(pathname, function(err, stat) { | ||
if(err && !firstError) firstError = err; | ||
results[idx] = (err || !stat.isDirectory()) ? null : pathname; | ||
@@ -399,2 +411,3 @@ endOne(idx); | ||
loadAsFileOrDirectory(pathname, options, type, sync, function loadAsFileOrDirectoryCallback(err, absoluteFilename) { | ||
if(err && !firstError) firstError = err; | ||
results[idx] = err ? null : absoluteFilename; | ||
@@ -401,0 +414,0 @@ endOne(idx); |
{ | ||
"name": "enhanced-resolve", | ||
"version": "0.3.0", | ||
"version": "0.3.1", | ||
"author": "Tobias Koppers @sokra", | ||
@@ -5,0 +5,0 @@ "description": "Offers a async require.resolve function. It's highly configurable.", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Misc. License Issues
License(Experimental) A package's licensing information has fine-grained problems.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
24912
27
695
1