Socket
Socket
Sign inDemoInstall

enhanced-resolve

Package Overview
Dependencies
13
Maintainers
4
Versions
128
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 4.0.0-beta.2 to 4.0.0-beta.3

30

lib/AliasPlugin.js

@@ -27,5 +27,3 @@ /*

this.source = source;
this.name = options.name;
this.alias = options.alias;
this.onlyModule = options.onlyModule;
this.options = options;
this.target = target;

@@ -39,15 +37,17 @@ }

if(!innerRequest) return callback();
if(innerRequest === this.name || (!this.onlyModule && startsWith(innerRequest, this.name + "/"))) {
if(innerRequest !== this.alias && !startsWith(innerRequest, this.alias + "/")) {
const newRequestStr = this.alias + innerRequest.substr(this.name.length);
const obj = Object.assign({}, request, {
request: newRequestStr
});
return resolver.doResolve(target, obj, "aliased with mapping '" + this.name + "': '" + this.alias + "' to '" + newRequestStr + "'", resolveContext, (err, result) => {
if(err) return callback(err);
for(const item of this.options) {
if(innerRequest === item.name || (!item.onlyModule && startsWith(innerRequest, item.name + "/"))) {
if(innerRequest !== item.alias && !startsWith(innerRequest, item.alias + "/")) {
const newRequestStr = item.alias + innerRequest.substr(item.name.length);
const obj = Object.assign({}, request, {
request: newRequestStr
});
return resolver.doResolve(target, obj, "aliased with mapping '" + item.name + "': '" + item.alias + "' to '" + newRequestStr + "'", resolveContext, (err, result) => {
if(err) return callback(err);
// Don't allow other aliasing or raw request
if(result === undefined) return callback(null, null);
callback(null, result);
});
// Don't allow other aliasing or raw request
if(result === undefined) return callback(null, null);
callback(null, result);
});
}
}

@@ -54,0 +54,0 @@ }

@@ -118,3 +118,3 @@ /*

mainFields = mainFields.map(item => {
if(typeof item === "string") {
if(typeof item === "string" || Array.isArray(item)) {
item = {

@@ -183,5 +183,4 @@ name: item,

// described-resolve
alias.forEach(item => {
plugins.push(new AliasPlugin("described-resolve", item, "resolve"));
});
if(alias.length > 0)
plugins.push(new AliasPlugin("described-resolve", alias, "resolve"));
if(enableConcord) {

@@ -256,5 +255,4 @@ plugins.push(new ConcordModulesPlugin("described-resolve", {}, "resolve"));

// file
alias.forEach(item => {
plugins.push(new AliasPlugin("file", item, "resolve"));
});
if(alias.length > 0)
plugins.push(new AliasPlugin("file", alias, "resolve"));
if(enableConcord) {

@@ -261,0 +259,0 @@ plugins.push(new ConcordModulesPlugin("file", {}, "resolve"));

{
"name": "enhanced-resolve",
"version": "4.0.0-beta.2",
"version": "4.0.0-beta.3",
"author": "Tobias Koppers @sokra",

@@ -5,0 +5,0 @@ "description": "Offers a async require.resolve function. It's highly configurable.",

SocketSocket SOC 2 Logo

Product

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc