enhanced-resolve
Advanced tools
Comparing version 4.0.0 to 4.1.0
@@ -34,3 +34,3 @@ /* | ||
resolver.getHook(this.source).tapAsync("AliasPlugin", (request, resolveContext, callback) => { | ||
const innerRequest = request.request; | ||
const innerRequest = request.request || request.path; | ||
if(!innerRequest) return callback(); | ||
@@ -37,0 +37,0 @@ for(const item of this.options) { |
@@ -9,2 +9,3 @@ /* | ||
// TODO remove in enhanced-resolve 5 | ||
module.exports = util.deprecate(function createInnerCallback(callback, options, message, messageOptional) { | ||
@@ -11,0 +12,0 @@ const log = options.log; |
@@ -0,0 +0,0 @@ /* |
@@ -13,11 +13,11 @@ /* | ||
path = path.substr(0, path.length - part.length - 1); | ||
paths.push(path); | ||
for(let i = parts.length - 2; i > 2; i -= 2) { | ||
paths.push(path); | ||
part = parts[i]; | ||
path = path.substr(0, path.length - part.length) || "/"; | ||
paths.push(path); | ||
seqments.push(part.substr(0, part.length - 1)); | ||
} | ||
part = parts[1]; | ||
seqments.push(part.length > 1 ? part.substr(0, part.length - 1) : part); | ||
seqments.push(part); | ||
paths.push(part); | ||
return { | ||
@@ -24,0 +24,0 @@ paths: paths, |
@@ -20,2 +20,3 @@ /* | ||
if(request.path !== request.descriptionFileRoot) return callback(); | ||
if(request.alreadyTriedMainField === request.descriptionFilePath) return callback(); | ||
const content = request.descriptionFileData; | ||
@@ -46,3 +47,4 @@ const filename = path.basename(request.descriptionFilePath); | ||
const obj = Object.assign({}, request, { | ||
request: mainModule | ||
request: mainModule, | ||
alreadyTriedMainField: request.descriptionFilePath | ||
}); | ||
@@ -49,0 +51,0 @@ return resolver.doResolve(target, obj, "use " + mainModule + " from " + this.options.name + " in " + filename, resolveContext, callback); |
@@ -0,0 +0,0 @@ /* |
@@ -33,11 +33,11 @@ /* | ||
set.add(item); | ||
}, "The missing array is now a Set. Use add instead of push."); | ||
}, "Resolver: 'missing' is now a Set. Use add instead of push."); | ||
const deprecatedResolveContextInCallback = util.deprecate((x) => { | ||
return x; | ||
}, "The callback argument was splitted into resolveContext and callback."); | ||
}, "Resolver: The callback argument was splitted into resolveContext and callback."); | ||
const deprecatedHookAsString = util.deprecate((x) => { | ||
return x; | ||
}, "The type arguments (string) is now a hook argument (Hook). Pass a reference to the hook instead."); | ||
}, "Resolver#doResolve: The type arguments (string) is now a hook argument (Hook). Pass a reference to the hook instead."); | ||
@@ -138,5 +138,8 @@ class Resolver extends Tapable { | ||
resolve(context, path, request, resolveContext, callback) { | ||
// TODO remove in enhanced-resolve 5 | ||
// For backward compatiblity START | ||
if(typeof callback !== "function") { | ||
callback = deprecatedResolveContextInCallback(resolveContext); | ||
// resolveContext is a function containing additional properties | ||
// It's now used for resolveContext and callback | ||
} | ||
@@ -189,5 +192,8 @@ // END | ||
doResolve(hook, request, message, resolveContext, callback) { | ||
// TODO remove in enhanced-resolve 5 | ||
// For backward compatiblity START | ||
if(typeof callback !== "function") { | ||
callback = deprecatedResolveContextInCallback(resolveContext); | ||
// resolveContext is a function containing additional properties | ||
// It's now used for resolveContext and callback | ||
} | ||
@@ -194,0 +200,0 @@ if(typeof hook === "string") { |
@@ -31,3 +31,3 @@ /* | ||
// Shortcut when absolute symlink found | ||
if(/^(\/|[a-zA-z]:($|\\))/.test(result)) | ||
if(/^(\/|[a-zA-Z]:($|\\))/.test(result)) | ||
return callback(null, idx); | ||
@@ -34,0 +34,0 @@ } |
{ | ||
"name": "enhanced-resolve", | ||
"version": "4.0.0", | ||
"version": "4.1.0", | ||
"author": "Tobias Koppers @sokra", | ||
@@ -34,3 +34,3 @@ "description": "Offers a async require.resolve function. It's highly configurable.", | ||
"engines": { | ||
"node": ">=6.11.5" | ||
"node": ">=6.9.0" | ||
}, | ||
@@ -37,0 +37,0 @@ "main": "lib/node.js", |
@@ -64,3 +64,3 @@ # enhanced-resolve | ||
| plugins | [] | A list of additional resolve plugins which should be applied | | ||
| symlinks | false | Whether to resolve symlinks to their symlinked location | | ||
| symlinks | true | Whether to resolve symlinks to their symlinked location | | ||
| cachePredicate | function() { return true }; | A function which decides whether a request should be cached or not. An object is passed to the function with `path` and `request` properties. | | ||
@@ -86,5 +86,6 @@ | moduleExtensions | [] | A list of module extensions which should be tried for modules | | ||
apply(resolver) { | ||
resolver.plugin(this.source, (request, callback) => { | ||
const target = resolver.ensureHook(this.target); | ||
resolver.getHook(this.source).tapAsync("MyResolverPlugin", (request, resolveContext, callback) => { | ||
// Any logic you need to create a new `request` can go here | ||
resolver.doResolve(this.target, request, null, callback); | ||
resolver.doResolve(target, request, null, resolveContext, callback); | ||
}); | ||
@@ -91,0 +92,0 @@ } |
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
2439
122
87286