Socket
Socket
Sign inDemoInstall

eslint-import-resolver-node

Package Overview
Dependencies
Maintainers
3
Versions
16
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

eslint-import-resolver-node - npm Package Compare versions

Comparing version 0.3.5 to 0.3.6

33

index.js

@@ -20,3 +20,4 @@ 'use strict';

try {
resolvedPath = resolve.sync(source, opts(file, config));
const cachedFilter = function (pkg, dir) { return packageFilter(pkg, dir, config); };
resolvedPath = resolve.sync(source, opts(file, config, cachedFilter));
log('Resolved to:', resolvedPath);

@@ -30,3 +31,3 @@ return { found: true, path: resolvedPath };

function opts(file, config) {
function opts(file, config, packageFilter) {
return Object.assign({

@@ -41,14 +42,30 @@ // more closely matches Node (#333)

basedir: path.dirname(path.resolve(file)),
packageFilter: packageFilter,
packageFilter,
});
}
function packageFilter(pkg) {
function identity(x) { return x; }
function packageFilter(pkg, dir, config) {
let found = false;
const file = path.join(dir, 'dummy.js');
if (pkg.module) {
pkg.main = pkg.module;
} else if (pkg['jsnext:main']) {
pkg.main = pkg['jsnext:main'];
try {
resolve.sync(String(pkg.module).replace(/^(?:\.\/)?/, './'), opts(file, config, identity));
pkg.main = pkg.module;
found = true;
} catch (err) {
log('resolve threw error trying to find pkg.module:', err);
}
}
if (!found && pkg['jsnext:main']) {
try {
resolve.sync(String(pkg['jsnext:main']).replace(/^(?:\.\/)?/, './'), opts(file, config, identity));
pkg.main = pkg['jsnext:main'];
found = true;
} catch (err) {
log('resolve threw error trying to find pkg[\'jsnext:main\']:', err);
}
}
return pkg;
}
{
"name": "eslint-import-resolver-node",
"version": "0.3.5",
"version": "0.3.6",
"description": "Node default behavior import resolution plugin for eslint-plugin-import.",

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