eslint-import-resolver-node 0.3.7 → 0.3.8

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.
Files changed (2) hide show
  1. package/index.js +7 -10
  2. package/package.json +3 -3
package/index.js CHANGED
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- const resolve = require('resolve');
3
+ const resolve = require('resolve/sync');
4
4
  const isCoreModule = require('is-core-module');
5
5
  const path = require('path');
6
6
 
@@ -19,7 +19,7 @@ exports.resolve = function (source, file, config) {
19
19
 
20
20
  try {
21
21
  const cachedFilter = function (pkg, dir) { return packageFilter(pkg, dir, config); };
22
- resolvedPath = resolve.sync(source, opts(file, config, cachedFilter));
22
+ resolvedPath = resolve(source, opts(file, config, cachedFilter));
23
23
  log('Resolved to:', resolvedPath);
24
24
  return { found: true, path: resolvedPath };
25
25
  } catch (err) {
@@ -29,17 +29,14 @@ exports.resolve = function (source, file, config) {
29
29
  };
30
30
 
31
31
  function opts(file, config, packageFilter) {
32
- return Object.assign({
33
- // more closely matches Node (#333)
32
+ return { // more closely matches Node (#333)
34
33
  // plus 'mjs' for native modules! (#939)
35
34
  extensions: ['.mjs', '.js', '.json', '.node'],
36
- },
37
- config,
38
- {
35
+ ...config,
39
36
  // path.resolve will handle paths relative to CWD
40
37
  basedir: path.dirname(path.resolve(file)),
41
38
  packageFilter,
42
- });
39
+ };
43
40
  }
44
41
 
45
42
  function identity(x) { return x; }
@@ -49,7 +46,7 @@ function packageFilter(pkg, dir, config) {
49
46
  const file = path.join(dir, 'dummy.js');
50
47
  if (pkg.module) {
51
48
  try {
52
- resolve.sync(String(pkg.module).replace(/^(?:\.\/)?/, './'), opts(file, config, identity));
49
+ resolve(String(pkg.module).replace(/^(?:\.\/)?/, './'), opts(file, config, identity));
53
50
  pkg.main = pkg.module;
54
51
  found = true;
55
52
  } catch (err) {
@@ -58,7 +55,7 @@ function packageFilter(pkg, dir, config) {
58
55
  }
59
56
  if (!found && pkg['jsnext:main']) {
60
57
  try {
61
- resolve.sync(String(pkg['jsnext:main']).replace(/^(?:\.\/)?/, './'), opts(file, config, identity));
58
+ resolve(String(pkg['jsnext:main']).replace(/^(?:\.\/)?/, './'), opts(file, config, identity));
62
59
  pkg.main = pkg['jsnext:main'];
63
60
  found = true;
64
61
  } catch (err) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "eslint-import-resolver-node",
3
- "version": "0.3.7",
3
+ "version": "0.3.8",
4
4
  "description": "Node default behavior import resolution plugin for eslint-plugin-import.",
5
5
  "main": "index.js",
6
6
  "files": [
@@ -30,8 +30,8 @@
30
30
  "homepage": "https://github.com/import-js/eslint-plugin-import",
31
31
  "dependencies": {
32
32
  "debug": "^3.2.7",
33
- "is-core-module": "^2.11.0",
34
- "resolve": "^1.22.1"
33
+ "is-core-module": "^2.13.0",
34
+ "resolve": "^1.22.4"
35
35
  },
36
36
  "devDependencies": {
37
37
  "chai": "^3.5.0",