@neovici/cfg 1.10.0 → 1.12.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/eslint/index.js CHANGED
@@ -1,3 +1,5 @@
1
+ const path = require('path');
2
+
1
3
  module.exports = {
2
4
  env: {
3
5
  browser: true,
@@ -133,5 +135,10 @@ module.exports = {
133
135
  files: ['**/*.test.js'],
134
136
  extends: './test'
135
137
  }
136
- ]
138
+ ],
139
+ settings: {
140
+ 'import/resolver': {
141
+ [path.resolve('./eslint/node-enhanced.js')]: {},
142
+ }
143
+ }
137
144
  };
@@ -0,0 +1,60 @@
1
+ /* eslint-disable */
2
+ const resolve = require('enhanced-resolve'),
3
+ path = require('path'),
4
+ isCore = require('is-core-module');
5
+
6
+ exports.interfaceVersion = 2;
7
+
8
+ exports.resolve = function (source, file, config) {
9
+ let resolvedPath;
10
+
11
+ if (isCore(source)) {
12
+ return { found: true, path: null };
13
+ }
14
+
15
+ try {
16
+ const cachedFilter = function (pkg, dir) { return packageFilter(pkg, dir, config); };
17
+ resolvedPath = resolve.sync(source, opts(file, config, cachedFilter));
18
+ return { found: true, path: resolvedPath };
19
+ } catch (err) {
20
+ return { found: false };
21
+ }
22
+ };
23
+
24
+ function opts(file, config, packageFilter) {
25
+ return Object.assign({
26
+ // more closely matches Node (#333)
27
+ // plus 'mjs' for native modules! (#939)
28
+ extensions: ['.mjs', '.js', '.json', '.node'],
29
+ },
30
+ config,
31
+ {
32
+ // path.resolve will handle paths relative to CWD
33
+ basedir: path.dirname(path.resolve(file)),
34
+ packageFilter,
35
+ });
36
+ }
37
+
38
+ function identity(x) { return x; }
39
+
40
+ function packageFilter(pkg, dir, config) {
41
+ let found = false;
42
+ const file = path.join(dir, 'dummy.js');
43
+ if (pkg.module) {
44
+ try {
45
+ resolve.sync(String(pkg.module).replace(/^(?:\.\/)?/, './'), opts(file, config, identity));
46
+ pkg.main = pkg.module;
47
+ found = true;
48
+ } catch (err) {
49
+ }
50
+ }
51
+ if (!found && pkg['jsnext:main']) {
52
+ try {
53
+ resolve.sync(String(pkg['jsnext:main']).replace(/^(?:\.\/)?/, './'), opts(file, config, identity));
54
+ pkg.main = pkg['jsnext:main'];
55
+ found = true;
56
+ } catch (err) {
57
+ }
58
+ }
59
+ return pkg;
60
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@neovici/cfg",
3
- "version": "1.10.0",
3
+ "version": "1.12.0",
4
4
  "description": "Configuration for Neovici packages",
5
5
  "homepage": "https://github.com/Neovici/cfg#readme",
6
6
  "bugs": {
@@ -48,11 +48,14 @@
48
48
  "@babel/core": "^7.16.0",
49
49
  "@babel/eslint-parser": "^7.16.0",
50
50
  "@web/test-runner-playwright": "^0.8.8",
51
+ "enhanced-resolve": "^5.9.1",
51
52
  "eslint": "^8.2.0",
52
53
  "eslint-config-prettier": "^8.4.0",
54
+ "eslint-import-resolver-alias": "^1.1.2",
53
55
  "eslint-plugin-html": "^6.2.0",
54
56
  "eslint-plugin-import": "^2.25.0",
55
57
  "eslint-plugin-mocha": "^10.0.0",
58
+ "is-core-module": "^2.8.1",
56
59
  "prettier": "^2.5.0"
57
60
  },
58
61
  "devDependencies": {
package/prettier/index.js CHANGED
@@ -1,4 +1,4 @@
1
1
  module.exports = {
2
- singleQuote: true,
3
- useTabs: true
4
- }
2
+ singleQuote: true,
3
+ useTabs: true,
4
+ };
File without changes