eslint-import-resolver-node 0.3.4 → 0.3.5

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 (3) hide show
  1. package/index.js +32 -28
  2. package/package.json +8 -13
  3. package/CHANGELOG.md +0 -63
package/index.js CHANGED
@@ -1,47 +1,51 @@
1
- var resolve = require('resolve')
2
- , path = require('path')
1
+ 'use strict';
3
2
 
4
- var log = require('debug')('eslint-plugin-import:resolver:node')
3
+ const resolve = require('resolve');
4
+ const path = require('path');
5
5
 
6
- exports.interfaceVersion = 2
6
+ const log = require('debug')('eslint-plugin-import:resolver:node');
7
+
8
+ exports.interfaceVersion = 2;
7
9
 
8
10
  exports.resolve = function (source, file, config) {
9
- log('Resolving:', source, 'from:', file)
10
- var resolvedPath
11
+ log('Resolving:', source, 'from:', file);
12
+ let resolvedPath;
11
13
 
12
14
  if (resolve.isCore(source)) {
13
- log('resolved to core')
14
- return { found: true, path: null }
15
+ log('resolved to core');
16
+ return { found: true, path: null };
15
17
  }
16
18
 
17
19
  try {
18
- resolvedPath = resolve.sync(source, opts(file, config))
19
- log('Resolved to:', resolvedPath)
20
- return { found: true, path: resolvedPath }
20
+ resolvedPath = resolve.sync(source, opts(file, config));
21
+ log('Resolved to:', resolvedPath);
22
+ return { found: true, path: resolvedPath };
21
23
  } catch (err) {
22
- log('resolve threw error:', err)
23
- return { found: false }
24
+ log('resolve threw error:', err);
25
+ return { found: false };
24
26
  }
25
- }
27
+ };
26
28
 
27
29
  function opts(file, config) {
28
30
  return Object.assign({
29
- // more closely matches Node (#333)
30
- // plus 'mjs' for native modules! (#939)
31
- extensions: ['.mjs', '.js', '.json', '.node'],
32
- },
33
- config,
34
- {
35
- // path.resolve will handle paths relative to CWD
36
- basedir: path.dirname(path.resolve(file)),
37
- packageFilter: packageFilter,
38
-
39
- })
31
+ // more closely matches Node (#333)
32
+ // plus 'mjs' for native modules! (#939)
33
+ extensions: ['.mjs', '.js', '.json', '.node'],
34
+ },
35
+ config,
36
+ {
37
+ // path.resolve will handle paths relative to CWD
38
+ basedir: path.dirname(path.resolve(file)),
39
+ packageFilter: packageFilter,
40
+
41
+ });
40
42
  }
41
43
 
42
44
  function packageFilter(pkg) {
43
- if (pkg['jsnext:main']) {
44
- pkg['main'] = pkg['jsnext:main']
45
+ if (pkg.module) {
46
+ pkg.main = pkg.module;
47
+ } else if (pkg['jsnext:main']) {
48
+ pkg.main = pkg['jsnext:main'];
45
49
  }
46
- return pkg
50
+ return pkg;
47
51
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "eslint-import-resolver-node",
3
- "version": "0.3.4",
3
+ "version": "0.3.5",
4
4
  "description": "Node default behavior import resolution plugin for eslint-plugin-import.",
5
5
  "main": "index.js",
6
6
  "files": [
@@ -14,7 +14,7 @@
14
14
  },
15
15
  "repository": {
16
16
  "type": "git",
17
- "url": "https://github.com/benmosher/eslint-plugin-import"
17
+ "url": "https://github.com/import-js/eslint-plugin-import"
18
18
  },
19
19
  "keywords": [
20
20
  "eslint",
@@ -26,22 +26,17 @@
26
26
  "author": "Ben Mosher (me@benmosher.com)",
27
27
  "license": "MIT",
28
28
  "bugs": {
29
- "url": "https://github.com/benmosher/eslint-plugin-import/issues"
29
+ "url": "https://github.com/import-js/eslint-plugin-import/issues"
30
30
  },
31
- "homepage": "https://github.com/benmosher/eslint-plugin-import",
31
+ "homepage": "https://github.com/import-js/eslint-plugin-import",
32
32
  "dependencies": {
33
- "debug": "^2.6.9",
34
- "resolve": "^1.13.1"
33
+ "debug": "^3.2.7",
34
+ "resolve": "^1.20.0"
35
35
  },
36
36
  "devDependencies": {
37
37
  "chai": "^3.5.0",
38
- "coveralls": "^3.0.0",
38
+ "coveralls": "^3.1.0",
39
39
  "mocha": "^3.5.3",
40
- "nyc": "^11.7.1"
41
- },
42
- "nyc": {
43
- "exclude": [
44
- "test/"
45
- ]
40
+ "nyc": "^11.9.0"
46
41
  }
47
42
  }
package/CHANGELOG.md DELETED
@@ -1,63 +0,0 @@
1
- # Change Log
2
- All notable changes to this resolver will be documented in this file.
3
- This project adheres to [Semantic Versioning](http://semver.org/).
4
- This change log adheres to standards from [Keep a CHANGELOG](http://keepachangelog.com).
5
-
6
- ## Unreleased
7
-
8
- ## v0.3.4 - 2020-06-16
9
- ### Added
10
- - add `.node` extension ([#1663])
11
-
12
- ## v0.3.3 - 2020-01-10
13
- ### Changed
14
- - [meta] copy LICENSE file to all npm packages on prepublish ([#1595], thanks [@opichals])
15
-
16
- ## v0.3.2 - 2018-01-05
17
- ### Added
18
- - `.mjs` extension detected by default to support `experimental-modules` ([#939])
19
-
20
- ### Deps
21
- - update `debug`, `resolve`
22
-
23
- ## v0.3.1 - 2017-06-23
24
- ### Changed
25
- - bumped `debug` dep to match other packages
26
-
27
- ## v0.3.0 - 2016-12-15
28
- ### Changed
29
- - bumped `resolve` to fix issues with Node builtins (thanks [@SkeLLLa] and [@ljharb])
30
-
31
- ### Fixed
32
- - use `files` in `package.json` to ship only `index.js` ([#531], thanks for noticing [@lukeapage])
33
-
34
- ## v0.2.3 - 2016-08-20
35
- ### Added
36
- - debug logging (use `DEBUG=eslint-plugin-import:resolver:node eslint [...]`)
37
-
38
- ## v0.2.2 - 2016-07-14
39
- ### Fixed
40
- - Node resolver no longer declares the import plugin as a `peerDependency`. See [#437]
41
- for a well-articulated and thoughtful expression of why this doesn't make sense.
42
- Thanks [@jasonkarns] for the issue and the PR to fix it ([#438]).
43
-
44
- Also, apologies to the others who expressed this before, but I never understood
45
- what the problem was.😅
46
-
47
- ## v0.2.1
48
- ### Fixed
49
- - find files with `.json` extensions (#333, thanks for noticing @jfmengels)
50
-
51
- [#438]: https://github.com/benmosher/eslint-plugin-import/pull/438
52
-
53
- [#1663]: https://github.com/benmosher/eslint-plugin-import/issues/1663
54
- [#1595]: https://github.com/benmosher/eslint-plugin-import/pull/1595
55
- [#939]: https://github.com/benmosher/eslint-plugin-import/issues/939
56
- [#531]: https://github.com/benmosher/eslint-plugin-import/issues/531
57
- [#437]: https://github.com/benmosher/eslint-plugin-import/issues/437
58
-
59
- [@jasonkarns]: https://github.com/jasonkarns
60
- [@lukeapage]: https://github.com/lukeapage
61
- [@SkeLLLa]: https://github.com/SkeLLLa
62
- [@ljharb]: https://github.com/ljharb
63
- [@opichals]: https://github.com/opichals