enhanced-resolve
Advanced tools
Comparing version 0.4.5 to 0.4.6
@@ -55,3 +55,4 @@ /* | ||
} else { | ||
var pathname = resource.path[0] === "." ? join(split(context), split(resource.path)) : resource.path; | ||
var ending = resource.path.substr(-1); | ||
var pathname = resource.path[0] === "." ? join(split(context), split(resource.path)) : resource.path.replace(/[\\\/]$/, ""); | ||
if(type === "context" || type === "loader-context") { | ||
@@ -69,2 +70,4 @@ (sync?statSync:statAsync)(pathname, function(err, stat) { | ||
}); | ||
} else if(ending == "/" || ending == "\\") { | ||
loadAsDirectory(pathname, options, type, sync, finalResult); | ||
} else { | ||
@@ -77,2 +80,3 @@ loadAsFileOrDirectory(pathname, options, type, sync, finalResult); | ||
function applyAlias(resource, alias) { | ||
var lastModuleName = null; | ||
while(resource.path && resource.module) { | ||
@@ -86,2 +90,4 @@ var moduleName = resource.path, remaining = ""; | ||
if(!alias[moduleName]) return; | ||
if(lastModuleName == moduleName) return; | ||
lastModuleName = moduleName; | ||
resource.path = alias[moduleName] + remaining; | ||
@@ -88,0 +94,0 @@ resource.module = parse.isModule(resource.path); |
{ | ||
"name": "enhanced-resolve", | ||
"version": "0.4.5", | ||
"version": "0.4.6", | ||
"author": "Tobias Koppers @sokra", | ||
@@ -5,0 +5,0 @@ "description": "Offers a async require.resolve function. It's highly configurable.", |
@@ -10,2 +10,5 @@ /* | ||
var options = { | ||
alias: { | ||
"recursive-module": "recursive-module/file" | ||
}, | ||
loaders: [ | ||
@@ -138,2 +141,10 @@ {test: ".load1$", loader: "m2/b"}, | ||
fixtures, "m1/a?q1!./?q2", path.join(fixtures, "node_modules", "m1", "a.js") + "?q1!" + fixtures + "?q2"); | ||
testResolve("infinite loop by alias", | ||
fixtures, "recursive-module", path.join(fixtures, "node_modules", "recursive-module", "file.js")); | ||
testResolve("differ between directory and file, resolve file", | ||
fixtures, "./dirOrFile", path.join(fixtures, "dirOrFile.js")); | ||
testResolve("differ between directory and file, resolve directory", | ||
fixtures, "./dirOrFile/", path.join(fixtures, "dirOrFile", "index.js")); | ||
}); |
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
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
75999
50
2336