eslint-import-resolver-node 0.3.9 → 0.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.js +26 -20
- package/package.json +5 -4
package/index.js
CHANGED
|
@@ -8,30 +8,16 @@ const log = require('debug')('eslint-plugin-import:resolver:node');
|
|
|
8
8
|
|
|
9
9
|
exports.interfaceVersion = 2;
|
|
10
10
|
|
|
11
|
-
exports.resolve = function (source, file, config) {
|
|
12
|
-
log('Resolving:', source, 'from:', file);
|
|
13
|
-
let resolvedPath;
|
|
14
|
-
|
|
15
|
-
if (isCoreModule(source)) {
|
|
16
|
-
log('resolved to core');
|
|
17
|
-
return { found: true, path: null };
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
try {
|
|
21
|
-
const cachedFilter = function (pkg, dir) { return packageFilter(pkg, dir, config); };
|
|
22
|
-
resolvedPath = resolve(source, opts(file, config, cachedFilter));
|
|
23
|
-
log('Resolved to:', resolvedPath);
|
|
24
|
-
return { found: true, path: resolvedPath };
|
|
25
|
-
} catch (err) {
|
|
26
|
-
log('resolve threw error:', err);
|
|
27
|
-
return { found: false };
|
|
28
|
-
}
|
|
29
|
-
};
|
|
30
|
-
|
|
31
11
|
function opts(file, config, packageFilter) {
|
|
32
12
|
return Object.assign({ // more closely matches Node (#333)
|
|
33
13
|
// plus 'mjs' for native modules! (#939)
|
|
34
14
|
extensions: ['.mjs', '.js', '.json', '.node'],
|
|
15
|
+
// TODO: semver-major: remove this to match Node's default behavior
|
|
16
|
+
preserveSymlinks: true,
|
|
17
|
+
// Use the consumer's engines.node to determine exports resolution behavior.
|
|
18
|
+
// Falls back to traditional resolution when engines.node is absent.
|
|
19
|
+
// Set engines: false in resolver config to opt out.
|
|
20
|
+
engines: true,
|
|
35
21
|
}, config, {
|
|
36
22
|
// path.resolve will handle paths relative to CWD
|
|
37
23
|
basedir: path.dirname(path.resolve(file)),
|
|
@@ -64,3 +50,23 @@ function packageFilter(pkg, dir, config) {
|
|
|
64
50
|
}
|
|
65
51
|
return pkg;
|
|
66
52
|
}
|
|
53
|
+
|
|
54
|
+
exports.resolve = function (source, file, config) {
|
|
55
|
+
log('Resolving:', source, 'from:', file);
|
|
56
|
+
let resolvedPath;
|
|
57
|
+
|
|
58
|
+
if (isCoreModule(source)) {
|
|
59
|
+
log('resolved to core');
|
|
60
|
+
return { found: true, path: null };
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
try {
|
|
64
|
+
const cachedFilter = function (pkg, pkgFileOrDir, maybeDir) { return packageFilter(pkg, maybeDir || pkgFileOrDir, config); };
|
|
65
|
+
resolvedPath = resolve(source, opts(file, config, cachedFilter));
|
|
66
|
+
log('Resolved to:', resolvedPath);
|
|
67
|
+
return { found: true, path: resolvedPath };
|
|
68
|
+
} catch (err) {
|
|
69
|
+
log('resolve threw error:', err);
|
|
70
|
+
return { found: false };
|
|
71
|
+
}
|
|
72
|
+
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "eslint-import-resolver-node",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.4.0",
|
|
4
4
|
"description": "Node default behavior import resolution plugin for eslint-plugin-import.",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"files": [
|
|
@@ -13,7 +13,8 @@
|
|
|
13
13
|
},
|
|
14
14
|
"repository": {
|
|
15
15
|
"type": "git",
|
|
16
|
-
"url": "https://github.com/import-js/eslint-plugin-import"
|
|
16
|
+
"url": "https://github.com/import-js/eslint-plugin-import",
|
|
17
|
+
"directory": "resolvers/node"
|
|
17
18
|
},
|
|
18
19
|
"keywords": [
|
|
19
20
|
"eslint",
|
|
@@ -30,8 +31,8 @@
|
|
|
30
31
|
"homepage": "https://github.com/import-js/eslint-plugin-import",
|
|
31
32
|
"dependencies": {
|
|
32
33
|
"debug": "^3.2.7",
|
|
33
|
-
"is-core-module": "^2.
|
|
34
|
-
"resolve": "^
|
|
34
|
+
"is-core-module": "^2.16.2",
|
|
35
|
+
"resolve": "^2.0.0-next.7"
|
|
35
36
|
},
|
|
36
37
|
"devDependencies": {
|
|
37
38
|
"chai": "^3.5.0",
|