eslint-import-resolver-node
Advanced tools
Comparing version 0.3.7 to 0.3.8
17
index.js
'use strict'; | ||
const resolve = require('resolve'); | ||
const resolve = require('resolve/sync'); | ||
const isCoreModule = require('is-core-module'); | ||
@@ -22,3 +22,3 @@ const path = require('path'); | ||
const cachedFilter = function (pkg, dir) { return packageFilter(pkg, dir, config); }; | ||
resolvedPath = resolve.sync(source, opts(file, config, cachedFilter)); | ||
resolvedPath = resolve(source, opts(file, config, cachedFilter)); | ||
log('Resolved to:', resolvedPath); | ||
@@ -33,13 +33,10 @@ return { found: true, path: resolvedPath }; | ||
function opts(file, config, packageFilter) { | ||
return Object.assign({ | ||
// more closely matches Node (#333) | ||
return { // more closely matches Node (#333) | ||
// plus 'mjs' for native modules! (#939) | ||
extensions: ['.mjs', '.js', '.json', '.node'], | ||
}, | ||
config, | ||
{ | ||
...config, | ||
// path.resolve will handle paths relative to CWD | ||
basedir: path.dirname(path.resolve(file)), | ||
packageFilter, | ||
}); | ||
}; | ||
} | ||
@@ -54,3 +51,3 @@ | ||
try { | ||
resolve.sync(String(pkg.module).replace(/^(?:\.\/)?/, './'), opts(file, config, identity)); | ||
resolve(String(pkg.module).replace(/^(?:\.\/)?/, './'), opts(file, config, identity)); | ||
pkg.main = pkg.module; | ||
@@ -64,3 +61,3 @@ found = true; | ||
try { | ||
resolve.sync(String(pkg['jsnext:main']).replace(/^(?:\.\/)?/, './'), opts(file, config, identity)); | ||
resolve(String(pkg['jsnext:main']).replace(/^(?:\.\/)?/, './'), opts(file, config, identity)); | ||
pkg.main = pkg['jsnext:main']; | ||
@@ -67,0 +64,0 @@ found = true; |
{ | ||
"name": "eslint-import-resolver-node", | ||
"version": "0.3.7", | ||
"version": "0.3.8", | ||
"description": "Node default behavior import resolution plugin for eslint-plugin-import.", | ||
@@ -33,4 +33,4 @@ "main": "index.js", | ||
"debug": "^3.2.7", | ||
"is-core-module": "^2.11.0", | ||
"resolve": "^1.22.1" | ||
"is-core-module": "^2.13.0", | ||
"resolve": "^1.22.4" | ||
}, | ||
@@ -37,0 +37,0 @@ "devDependencies": { |
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
5278
57
Updatedis-core-module@^2.13.0
Updatedresolve@^1.22.4