Socket
Socket
Sign inDemoInstall

enhanced-resolve

Package Overview
Dependencies
Maintainers
1
Versions
130
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

enhanced-resolve - npm Package Compare versions

Comparing version 0.4.5 to 0.4.6

test/fixtures/dirOrFile.js

8

lib/resolve.js

@@ -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);

2

package.json
{
"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"));
});
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc