Socket
Socket
Sign inDemoInstall

browser-resolve

Package Overview
Dependencies
Maintainers
2
Versions
42
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

browser-resolve - npm Package Compare versions

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",

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