browser-resolve
Advanced tools
Comparing version 1.9.1 to 1.10.0
32
index.js
@@ -54,20 +54,19 @@ // builtin | ||
Object.keys(replacements).forEach(function(key) { | ||
var val; | ||
if (replacements[key] === false) { | ||
return shims[key] = __dirname + '/empty.js'; | ||
val = __dirname + '/empty.js'; | ||
} | ||
var val = replacements[key]; | ||
// if target is a relative path, then resolve | ||
// otherwise we assume target is a module | ||
if (val[0] === '.') { | ||
val = path.resolve(cur_path, val); | ||
else { | ||
val = replacements[key]; | ||
// if target is a relative path, then resolve | ||
// otherwise we assume target is a module | ||
if (val[0] === '.') { | ||
val = path.resolve(cur_path, val); | ||
} | ||
} | ||
// if does not begin with / ../ or ./ then it is a module | ||
if (key[0] !== '/' && key[0] !== '.') { | ||
return shims[key] = val; | ||
if (key[0] === '/' || key[0] === '.') { | ||
// if begins with / ../ or ./ then we must resolve to a full path | ||
key = path.resolve(cur_path, key); | ||
} | ||
key = path.resolve(cur_path, key); | ||
shims[key] = val; | ||
@@ -173,3 +172,3 @@ }); | ||
var pathFilter = opts.pathFilter; | ||
opts.pathFilter = function(info, path, relativePath) { | ||
opts.pathFilter = function(info, resvPath, relativePath) { | ||
if (relativePath[0] != '.') { | ||
@@ -192,4 +191,7 @@ relativePath = './' + relativePath; | ||
mappedPath = replacements[relativePath]; | ||
if (!mappedPath && (relativePath.lastIndexOf('.js') === relativePath.length - 3)) { | ||
if (!mappedPath && path.extname(relativePath) === '') { | ||
mappedPath = replacements[relativePath + '.js']; | ||
if (!mappedPath) { | ||
mappedPath = replacements[relativePath + '.json']; | ||
} | ||
} | ||
@@ -196,0 +198,0 @@ return mappedPath; |
{ | ||
"name": "browser-resolve", | ||
"version": "1.9.1", | ||
"version": "1.10.0", | ||
"description": "resolve which handles browser field support in package.json", | ||
@@ -5,0 +5,0 @@ "main": "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
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
12783
266
0