eslint-import-resolver-node 0.3.9 → 0.3.10
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 +22 -20
- package/package.json +5 -4
package/index.js
CHANGED
|
@@ -8,30 +8,12 @@ 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,
|
|
35
17
|
}, config, {
|
|
36
18
|
// path.resolve will handle paths relative to CWD
|
|
37
19
|
basedir: path.dirname(path.resolve(file)),
|
|
@@ -64,3 +46,23 @@ function packageFilter(pkg, dir, config) {
|
|
|
64
46
|
}
|
|
65
47
|
return pkg;
|
|
66
48
|
}
|
|
49
|
+
|
|
50
|
+
exports.resolve = function (source, file, config) {
|
|
51
|
+
log('Resolving:', source, 'from:', file);
|
|
52
|
+
let resolvedPath;
|
|
53
|
+
|
|
54
|
+
if (isCoreModule(source)) {
|
|
55
|
+
log('resolved to core');
|
|
56
|
+
return { found: true, path: null };
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
try {
|
|
60
|
+
const cachedFilter = function (pkg, pkgFileOrDir, maybeDir) { return packageFilter(pkg, maybeDir || pkgFileOrDir, config); };
|
|
61
|
+
resolvedPath = resolve(source, opts(file, config, cachedFilter));
|
|
62
|
+
log('Resolved to:', resolvedPath);
|
|
63
|
+
return { found: true, path: resolvedPath };
|
|
64
|
+
} catch (err) {
|
|
65
|
+
log('resolve threw error:', err);
|
|
66
|
+
return { found: false };
|
|
67
|
+
}
|
|
68
|
+
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "eslint-import-resolver-node",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.10",
|
|
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.1",
|
|
35
|
+
"resolve": "^2.0.0-next.6"
|
|
35
36
|
},
|
|
36
37
|
"devDependencies": {
|
|
37
38
|
"chai": "^3.5.0",
|