eslint-plugin-node-dependencies 0.8.0 → 0.9.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/README.md +2 -2
- package/dist/configs/recommended.js +1 -0
- package/dist/rules/compat-engines.js +1 -1
- package/dist/rules/no-dupe-deps.js +1 -1
- package/dist/rules/no-restricted-deps.js +32 -19
- package/dist/utils/meta.js +103 -97
- package/dist/utils/package-json/index.js +5 -0
- package/dist/utils/package-json/worker.js +18 -0
- package/package.json +101 -99
package/README.md
CHANGED
|
@@ -33,7 +33,7 @@ npm install --save-dev eslint eslint-plugin-node-dependencies
|
|
|
33
33
|
> **Requirements**
|
|
34
34
|
>
|
|
35
35
|
> - ESLint v6.0.0 and above
|
|
36
|
-
> - Node.js
|
|
36
|
+
> - Node.js v14.16.0 and above
|
|
37
37
|
|
|
38
38
|
<!--DOCS_IGNORE_END-->
|
|
39
39
|
|
|
@@ -119,7 +119,7 @@ The rules with the following star :star: are included in the `plugin:node-depend
|
|
|
119
119
|
| Rule ID | Description | |
|
|
120
120
|
|:--------|:------------|:---|
|
|
121
121
|
| [node-dependencies/compat-engines](https://ota-meshi.github.io/eslint-plugin-node-dependencies/rules/compat-engines.html) | enforce the versions of the engines of the dependencies to be compatible. | :star: |
|
|
122
|
-
| [node-dependencies/no-dupe-deps](https://ota-meshi.github.io/eslint-plugin-node-dependencies/rules/no-dupe-deps.html) | disallow duplicate dependencies. |
|
|
122
|
+
| [node-dependencies/no-dupe-deps](https://ota-meshi.github.io/eslint-plugin-node-dependencies/rules/no-dupe-deps.html) | disallow duplicate dependencies. | :star: |
|
|
123
123
|
| [node-dependencies/valid-semver](https://ota-meshi.github.io/eslint-plugin-node-dependencies/rules/valid-semver.html) | enforce versions that is valid as a semantic version. | :star: |
|
|
124
124
|
|
|
125
125
|
### Best Practices
|
|
@@ -160,7 +160,7 @@ exports.default = (0, utils_1.createRule)("compat-engines", {
|
|
|
160
160
|
}
|
|
161
161
|
function processDependencyModule(ctx, name, ver, modules, node) {
|
|
162
162
|
const currModules = [...modules, `${name}@${ver}`];
|
|
163
|
-
processMeta(ctx, (0, meta_1.getMetaFromNodeModules)(name, ver, context));
|
|
163
|
+
processMeta(ctx, (0, meta_1.getMetaFromNodeModules)(name, ver, { context }));
|
|
164
164
|
if (!ctx.hasInvalid() && ctx.isAllProcessed()) {
|
|
165
165
|
return;
|
|
166
166
|
}
|
|
@@ -17,20 +17,26 @@ class Deps {
|
|
|
17
17
|
this.map = Object.create(null);
|
|
18
18
|
this.list = [];
|
|
19
19
|
}
|
|
20
|
-
push(name, ver) {
|
|
21
|
-
const
|
|
22
|
-
if (
|
|
23
|
-
const
|
|
24
|
-
if (
|
|
25
|
-
const newRange = (0, semver_2.normalizeSemverRange)(range,
|
|
26
|
-
this.map[name] =
|
|
20
|
+
push(name, ver, ownerPackageJsonPath) {
|
|
21
|
+
const range = (0, semver_2.getSemverRange)(ver);
|
|
22
|
+
if (range) {
|
|
23
|
+
const data = this.map[name];
|
|
24
|
+
if (data) {
|
|
25
|
+
const newRange = (0, semver_2.normalizeSemverRange)(data.range, range);
|
|
26
|
+
this.map[name] = {
|
|
27
|
+
range: newRange,
|
|
28
|
+
ownerPackageJsonPath: ownerPackageJsonPath || data.ownerPackageJsonPath,
|
|
29
|
+
};
|
|
27
30
|
}
|
|
28
31
|
else {
|
|
29
|
-
this.map[name] =
|
|
32
|
+
this.map[name] = {
|
|
33
|
+
range,
|
|
34
|
+
ownerPackageJsonPath,
|
|
35
|
+
};
|
|
30
36
|
}
|
|
31
37
|
return;
|
|
32
38
|
}
|
|
33
|
-
this.list.push(
|
|
39
|
+
this.list.push({ name, ver, ownerPackageJsonPath });
|
|
34
40
|
}
|
|
35
41
|
pop() {
|
|
36
42
|
const resultForList = this.list.shift();
|
|
@@ -39,9 +45,13 @@ class Deps {
|
|
|
39
45
|
}
|
|
40
46
|
const [key] = Object.keys(this.map);
|
|
41
47
|
if (key) {
|
|
42
|
-
const
|
|
48
|
+
const data = this.map[key];
|
|
43
49
|
delete this.map[key];
|
|
44
|
-
return
|
|
50
|
+
return {
|
|
51
|
+
name: key,
|
|
52
|
+
ver: (0, semver_2.normalizeVer)(data.range),
|
|
53
|
+
ownerPackageJsonPath: data.ownerPackageJsonPath,
|
|
54
|
+
};
|
|
45
55
|
}
|
|
46
56
|
return null;
|
|
47
57
|
}
|
|
@@ -61,7 +71,7 @@ class DeepValidateContext {
|
|
|
61
71
|
depsQueue.push(packageName, version);
|
|
62
72
|
let dep;
|
|
63
73
|
while ((dep = depsQueue.pop())) {
|
|
64
|
-
const key = `${dep
|
|
74
|
+
const key = `${dep.name}@${dep.ver}`;
|
|
65
75
|
if (this.deepValidatedCache.has(key)) {
|
|
66
76
|
const result = this.deepValidatedCache.get(key);
|
|
67
77
|
if (result) {
|
|
@@ -69,7 +79,7 @@ class DeepValidateContext {
|
|
|
69
79
|
}
|
|
70
80
|
}
|
|
71
81
|
else {
|
|
72
|
-
const result = validateWithoutCache(dep
|
|
82
|
+
const result = validateWithoutCache(dep.name, dep.ver, dep.ownerPackageJsonPath);
|
|
73
83
|
this.deepValidatedCache.set(key, result);
|
|
74
84
|
if (result) {
|
|
75
85
|
return result;
|
|
@@ -77,22 +87,25 @@ class DeepValidateContext {
|
|
|
77
87
|
}
|
|
78
88
|
}
|
|
79
89
|
return null;
|
|
80
|
-
function validateWithoutCache(name, ver) {
|
|
90
|
+
function validateWithoutCache(name, ver, ownerPackageJsonPath) {
|
|
81
91
|
const result = validate(name, ver);
|
|
82
92
|
if (result) {
|
|
83
93
|
return result;
|
|
84
94
|
}
|
|
85
|
-
for (const
|
|
95
|
+
for (const { name: n, ver: v, packageJsonPath } of iterateDeps(name, ver, ownerPackageJsonPath)) {
|
|
86
96
|
const r = validate(n, v);
|
|
87
97
|
if (r) {
|
|
88
98
|
return r;
|
|
89
99
|
}
|
|
90
|
-
depsQueue.push(n, v);
|
|
100
|
+
depsQueue.push(n, v, packageJsonPath);
|
|
91
101
|
}
|
|
92
102
|
return null;
|
|
93
103
|
}
|
|
94
|
-
function* iterateDeps(name, ver) {
|
|
95
|
-
yield* iterateDepsForMeta((0, meta_1.getMetaFromNodeModules)(name, ver,
|
|
104
|
+
function* iterateDeps(name, ver, ownerPackageJsonPath) {
|
|
105
|
+
yield* iterateDepsForMeta((0, meta_1.getMetaFromNodeModules)(name, ver, {
|
|
106
|
+
context,
|
|
107
|
+
ownerPackageJsonPath,
|
|
108
|
+
}));
|
|
96
109
|
if (deepOption === "server") {
|
|
97
110
|
const metaData = (0, meta_1.getMetaFromNpm)(name, ver);
|
|
98
111
|
for (const meta of metaData.cache) {
|
|
@@ -117,7 +130,7 @@ class DeepValidateContext {
|
|
|
117
130
|
}
|
|
118
131
|
for (const [n, v] of Object.entries(deps)) {
|
|
119
132
|
if (typeof v === "string") {
|
|
120
|
-
yield
|
|
133
|
+
yield { name: n, ver: v, packageJsonPath: meta._where };
|
|
121
134
|
}
|
|
122
135
|
}
|
|
123
136
|
}
|
package/dist/utils/meta.js
CHANGED
|
@@ -1,37 +1,55 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
2
25
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
26
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
27
|
};
|
|
5
28
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
29
|
exports.getDependencies = exports.getEngines = exports.getMetaFromNpm = exports.getMetaFromNodeModules = void 0;
|
|
7
30
|
const module_1 = __importDefault(require("module"));
|
|
8
|
-
const
|
|
9
|
-
const path_1 = __importDefault(require("path"));
|
|
31
|
+
const path_1 = __importStar(require("path"));
|
|
10
32
|
const fs_1 = __importDefault(require("fs"));
|
|
11
33
|
const semver_1 = require("./semver");
|
|
12
34
|
const semver_2 = require("semver");
|
|
13
35
|
const npm_package_arg_1 = __importDefault(require("npm-package-arg"));
|
|
36
|
+
const package_json_1 = require("./package-json");
|
|
14
37
|
const TTL = 1000 * 60 * 60;
|
|
15
|
-
const NPM_INFO_PROPERTIES = [
|
|
16
|
-
"version",
|
|
17
|
-
"engines",
|
|
18
|
-
"deprecated",
|
|
19
|
-
"dependencies",
|
|
20
|
-
"peerDependencies",
|
|
21
|
-
"optionalDependencies",
|
|
22
|
-
"dist-tags",
|
|
23
|
-
];
|
|
24
38
|
const CACHED_META_ROOT = path_1.default.join(__dirname, `../../.cached_meta`);
|
|
25
|
-
function getMetaFromNodeModules(name, ver,
|
|
39
|
+
function getMetaFromNodeModules(name, ver, options) {
|
|
26
40
|
try {
|
|
27
|
-
const
|
|
28
|
-
const relativeTo = path_1.default.join(
|
|
41
|
+
const ownerJsonPath = options.ownerPackageJsonPath || options.context.getFilename();
|
|
42
|
+
const relativeTo = path_1.default.join(ownerJsonPath && path_1.default.isAbsolute(ownerJsonPath)
|
|
43
|
+
? (0, path_1.dirname)(ownerJsonPath)
|
|
44
|
+
: getCwd(options.context), "__placeholder__.js");
|
|
29
45
|
const req = module_1.default.createRequire(relativeTo);
|
|
30
|
-
const
|
|
46
|
+
const where = req.resolve(`${name}/package.json`);
|
|
47
|
+
const pkg = req(where);
|
|
31
48
|
if (maybeMeta(pkg)) {
|
|
32
49
|
const vr = (0, semver_1.getSemverRange)(ver);
|
|
33
50
|
if (typeof pkg.version === "string" &&
|
|
34
51
|
(!vr || (0, semver_2.satisfies)(pkg.version, vr))) {
|
|
52
|
+
pkg._where = where;
|
|
35
53
|
return pkg;
|
|
36
54
|
}
|
|
37
55
|
}
|
|
@@ -55,85 +73,91 @@ function getMetaFromNpm(name, ver) {
|
|
|
55
73
|
(parsed.type === "range" ||
|
|
56
74
|
parsed.type === "version" ||
|
|
57
75
|
parsed.type === "tag")) {
|
|
58
|
-
return
|
|
76
|
+
return getMetaFromNameAndSpec(parsed.name, (_a = parsed.fetchSpec) === null || _a === void 0 ? void 0 : _a.trim());
|
|
59
77
|
}
|
|
60
78
|
}
|
|
61
79
|
if (trimmed.includes("/") || trimmed.includes(":")) {
|
|
62
80
|
return { cache: [], get: () => [] };
|
|
63
81
|
}
|
|
64
|
-
return
|
|
82
|
+
return getMetaFromNameAndSpec(name, ver.trim());
|
|
65
83
|
}
|
|
66
84
|
exports.getMetaFromNpm = getMetaFromNpm;
|
|
67
|
-
function
|
|
68
|
-
const
|
|
85
|
+
function getMetaFromNameAndSpec(name, verOrTag) {
|
|
86
|
+
const cachedFilePath = path_1.default.join(CACHED_META_ROOT, `${name}.json`);
|
|
87
|
+
const { cache, get } = getMetaFromName(name, cachedFilePath);
|
|
88
|
+
let isTargetVersion;
|
|
89
|
+
let hasUnknown = false;
|
|
90
|
+
const range = (0, semver_1.getSemverRange)(verOrTag || "*");
|
|
69
91
|
if (range) {
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
92
|
+
isTargetVersion = (meta) => {
|
|
93
|
+
if (!meta.version) {
|
|
94
|
+
return true;
|
|
95
|
+
}
|
|
96
|
+
return range.test(meta.version);
|
|
97
|
+
};
|
|
98
|
+
}
|
|
99
|
+
else {
|
|
100
|
+
const parsed = npm_package_arg_1.default.resolve(name, verOrTag);
|
|
101
|
+
if (parsed.type === "tag") {
|
|
102
|
+
isTargetVersion = (meta) => {
|
|
103
|
+
var _a;
|
|
73
104
|
if (!meta.version) {
|
|
74
105
|
return true;
|
|
75
106
|
}
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
const { cache, get } = getMetaFromNpmViewWithPackageArg((minVer) => `${name}@>=${minVer}`, cachedFilePath, min);
|
|
80
|
-
if (cache) {
|
|
81
|
-
const metaList = cache.data.meta.filter(isTargetVersion);
|
|
82
|
-
let alive = cache.alive;
|
|
83
|
-
if (!alive) {
|
|
84
|
-
const maxNext = (0, semver_1.maxNextVersion)(range);
|
|
85
|
-
if (maxNext) {
|
|
86
|
-
alive = cache.data.meta.some((m) => m.version && maxNext.compare(m.version) <= 0);
|
|
87
|
-
}
|
|
88
|
-
}
|
|
89
|
-
if (alive) {
|
|
90
|
-
return {
|
|
91
|
-
cache: metaList,
|
|
92
|
-
get: () => metaList,
|
|
93
|
-
};
|
|
107
|
+
const v = (_a = meta["dist-tags"]) === null || _a === void 0 ? void 0 : _a[parsed.fetchSpec];
|
|
108
|
+
if (v == null) {
|
|
109
|
+
hasUnknown = true;
|
|
94
110
|
}
|
|
95
|
-
return
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
}
|
|
111
|
+
return v === meta.version;
|
|
112
|
+
};
|
|
113
|
+
}
|
|
114
|
+
else {
|
|
100
115
|
return {
|
|
101
116
|
cache: [],
|
|
102
|
-
get: () =>
|
|
117
|
+
get: () => null,
|
|
103
118
|
};
|
|
104
119
|
}
|
|
105
120
|
}
|
|
106
|
-
const packageArg = `${name}@${verOrTag || "*"}`;
|
|
107
|
-
const cachedFilePath = path_1.default.join(CACHED_META_ROOT, `${packageArg
|
|
108
|
-
.replace(/[^\d+\-./<=>@\\^a-z|~]/giu, "_")
|
|
109
|
-
.toLowerCase()}.json`);
|
|
110
|
-
const { cache, get } = getMetaFromNpmViewWithPackageArg(() => packageArg, cachedFilePath);
|
|
111
121
|
if (cache) {
|
|
112
|
-
|
|
122
|
+
let alive = cache.alive;
|
|
123
|
+
if (!alive && range) {
|
|
124
|
+
const maxNext = (0, semver_1.maxNextVersion)(range);
|
|
125
|
+
if (maxNext) {
|
|
126
|
+
alive = cache.data.meta.some((m) => m.version && maxNext.compare(m.version) <= 0);
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
const metaList = cache.data.meta.filter(isTargetVersion);
|
|
130
|
+
if (alive) {
|
|
113
131
|
return {
|
|
114
|
-
cache:
|
|
115
|
-
get: () =>
|
|
132
|
+
cache: metaList,
|
|
133
|
+
get: () => (hasUnknown ? null : metaList),
|
|
116
134
|
};
|
|
117
135
|
}
|
|
118
136
|
return {
|
|
119
|
-
cache:
|
|
120
|
-
get
|
|
137
|
+
cache: metaList,
|
|
138
|
+
get: () => {
|
|
139
|
+
var _a, _b;
|
|
140
|
+
const list = (_b = (_a = get()) === null || _a === void 0 ? void 0 : _a.filter(isTargetVersion)) !== null && _b !== void 0 ? _b : null;
|
|
141
|
+
return hasUnknown && !(list === null || list === void 0 ? void 0 : list.length) ? null : list;
|
|
142
|
+
},
|
|
121
143
|
};
|
|
122
144
|
}
|
|
123
145
|
return {
|
|
124
146
|
cache: [],
|
|
125
|
-
get
|
|
147
|
+
get: () => {
|
|
148
|
+
var _a, _b;
|
|
149
|
+
const list = (_b = (_a = get()) === null || _a === void 0 ? void 0 : _a.filter(isTargetVersion)) !== null && _b !== void 0 ? _b : null;
|
|
150
|
+
return hasUnknown && !(list === null || list === void 0 ? void 0 : list.length) ? null : list;
|
|
151
|
+
},
|
|
126
152
|
};
|
|
127
153
|
}
|
|
128
|
-
function
|
|
129
|
-
let minVer = min === null || min === void 0 ? void 0 : min.version;
|
|
154
|
+
function getMetaFromName(name, cachedFilePath) {
|
|
130
155
|
const cache = getCache();
|
|
131
|
-
if (cache === null || cache === void 0 ? void 0 : cache.data.minVersion) {
|
|
132
|
-
minVer = cache.data.minVersion;
|
|
133
|
-
}
|
|
134
156
|
return {
|
|
135
|
-
cache
|
|
136
|
-
get: () =>
|
|
157
|
+
cache,
|
|
158
|
+
get: () => {
|
|
159
|
+
return getMetaFromNameWithoutCache(name, cachedFilePath);
|
|
160
|
+
},
|
|
137
161
|
};
|
|
138
162
|
function getCache() {
|
|
139
163
|
makeDirs(path_1.default.dirname(cachedFilePath));
|
|
@@ -144,14 +168,6 @@ function getMetaFromNpmViewWithPackageArg(getPackageArg, cachedFilePath, min) {
|
|
|
144
168
|
if (data.meta == null) {
|
|
145
169
|
return null;
|
|
146
170
|
}
|
|
147
|
-
if (min) {
|
|
148
|
-
if (!data.minVersion) {
|
|
149
|
-
return null;
|
|
150
|
-
}
|
|
151
|
-
if (min.compare(data.minVersion) < 0) {
|
|
152
|
-
return null;
|
|
153
|
-
}
|
|
154
|
-
}
|
|
155
171
|
const alive = Boolean((typeof data.expired === "number" && data.expired >= Date.now()) ||
|
|
156
172
|
(typeof data.timestamp === "number" &&
|
|
157
173
|
data.timestamp + TTL >= Date.now()) ||
|
|
@@ -162,19 +178,23 @@ function getMetaFromNpmViewWithPackageArg(getPackageArg, cachedFilePath, min) {
|
|
|
162
178
|
};
|
|
163
179
|
}
|
|
164
180
|
}
|
|
165
|
-
function
|
|
181
|
+
function getMetaFromNameWithoutCache(name, cachedFilePath) {
|
|
166
182
|
let meta = [];
|
|
167
183
|
try {
|
|
168
|
-
const
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
184
|
+
const allMeta = (0, package_json_1.syncPackageJson)(name, {
|
|
185
|
+
allVersions: true,
|
|
186
|
+
});
|
|
187
|
+
meta = Object.values(allMeta.versions).map((vm) => {
|
|
188
|
+
return {
|
|
189
|
+
version: vm.version,
|
|
190
|
+
engines: vm.engines,
|
|
191
|
+
dependencies: vm.dependencies,
|
|
192
|
+
peerDependencies: vm.peerDependencies,
|
|
193
|
+
optionalDependencies: vm.optionalDependencies,
|
|
194
|
+
"dist-tags": allMeta["dist-tags"],
|
|
195
|
+
deprecated: vm.deprecated,
|
|
196
|
+
};
|
|
197
|
+
});
|
|
178
198
|
}
|
|
179
199
|
catch (e) {
|
|
180
200
|
return null;
|
|
@@ -184,7 +204,6 @@ function getMetaFromNpmViewWithPackageArgWithoutCache(packageArg, cachedFilePath
|
|
|
184
204
|
meta,
|
|
185
205
|
timestamp,
|
|
186
206
|
expired: timestamp + Math.floor(Math.random() * 1000 * 60),
|
|
187
|
-
minVersion: minVer,
|
|
188
207
|
};
|
|
189
208
|
fs_1.default.writeFileSync(cachedFilePath, JSON.stringify(content));
|
|
190
209
|
delete require.cache[cachedFilePath];
|
|
@@ -234,19 +253,6 @@ function makeDirs(dir) {
|
|
|
234
253
|
fs_1.default.mkdirSync(d);
|
|
235
254
|
}
|
|
236
255
|
}
|
|
237
|
-
function exec(command, args) {
|
|
238
|
-
const result = (0, child_process_1.spawnSync)(command, args, {
|
|
239
|
-
windowsHide: true,
|
|
240
|
-
maxBuffer: Infinity,
|
|
241
|
-
});
|
|
242
|
-
if (result.error) {
|
|
243
|
-
throw result.error;
|
|
244
|
-
}
|
|
245
|
-
if (result.status !== 0) {
|
|
246
|
-
throw new Error(`Failed:\n${result.stdout.toString()}\n${result.stderr.toString()}`);
|
|
247
|
-
}
|
|
248
|
-
return result.stdout.toString("utf8");
|
|
249
|
-
}
|
|
250
256
|
function getCwd(context) {
|
|
251
257
|
if (context.getCwd) {
|
|
252
258
|
return context.getCwd();
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
const synckit_1 = require("synckit");
|
|
13
|
+
const dynamicImport = new Function("m", "return import(m)");
|
|
14
|
+
(0, synckit_1.runAsWorker)((packageName, options) => __awaiter(void 0, void 0, void 0, function* () {
|
|
15
|
+
const m = yield dynamicImport("package-json");
|
|
16
|
+
const packageJson = (m === null || m === void 0 ? void 0 : m.default) || m;
|
|
17
|
+
return packageJson(packageName, options);
|
|
18
|
+
}));
|
package/package.json
CHANGED
|
@@ -1,101 +1,103 @@
|
|
|
1
1
|
{
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
2
|
+
"name": "eslint-plugin-node-dependencies",
|
|
3
|
+
"version": "0.9.0",
|
|
4
|
+
"description": "ESLint plugin to check Node.js dependencies.",
|
|
5
|
+
"engines": {
|
|
6
|
+
"node": ">=14.17.0"
|
|
7
|
+
},
|
|
8
|
+
"main": "dist/index.js",
|
|
9
|
+
"files": [
|
|
10
|
+
"dist"
|
|
11
|
+
],
|
|
12
|
+
"scripts": {
|
|
13
|
+
"prebuild": "npm run -s clean",
|
|
14
|
+
"build": "tsc --project ./tsconfig.build.json",
|
|
15
|
+
"clean": "rimraf .nyc_output dist coverage",
|
|
16
|
+
"lint": "eslint . --ext .js,.vue,.ts,.json,.yaml,.yml",
|
|
17
|
+
"eslint-fix": "eslint . --ext .js,.vue,.ts,.json,.yaml,.yml --fix",
|
|
18
|
+
"pretest": "npm run build",
|
|
19
|
+
"test:base": "mocha --require ts-node/register \"tests/**/*.ts\" --reporter dot --timeout 60000",
|
|
20
|
+
"test": "npm run test:nyc",
|
|
21
|
+
"test:nyc": "nyc --reporter=lcov npm run test:base",
|
|
22
|
+
"test:debug": "mocha --require ts-node/register/transpile-only \"tests/**/*.ts\" --reporter dot --timeout 60000",
|
|
23
|
+
"test:watch": "npm run test:base -- --watch",
|
|
24
|
+
"update": "ts-node --transpile-only ./tools/update.ts && npm run eslint-fix",
|
|
25
|
+
"new": "ts-node ./tools/new-rule.ts",
|
|
26
|
+
"docs:watch": "export NODE_OPTIONS=--openssl-legacy-provider && vuepress dev --debug docs",
|
|
27
|
+
"docs:build": "export NODE_OPTIONS=--openssl-legacy-provider && npm run build && vuepress build docs --no-cache",
|
|
28
|
+
"preversion": "npm test && git add .",
|
|
29
|
+
"version": "env-cmd -e version npm run update && git add ."
|
|
30
|
+
},
|
|
31
|
+
"repository": {
|
|
32
|
+
"type": "git",
|
|
33
|
+
"url": "git+https://github.com/ota-meshi/eslint-plugin-node-dependencies.git"
|
|
34
|
+
},
|
|
35
|
+
"keywords": [
|
|
36
|
+
"eslint",
|
|
37
|
+
"eslintplugin",
|
|
38
|
+
"eslint-plugin",
|
|
39
|
+
"nodejs",
|
|
40
|
+
"dependencies",
|
|
41
|
+
"json"
|
|
42
|
+
],
|
|
43
|
+
"author": "Yosuke Ota (https://github.com/ota-meshi)",
|
|
44
|
+
"funding": "https://github.com/sponsors/ota-meshi",
|
|
45
|
+
"license": "MIT",
|
|
46
|
+
"bugs": {
|
|
47
|
+
"url": "https://github.com/ota-meshi/eslint-plugin-node-dependencies/issues"
|
|
48
|
+
},
|
|
49
|
+
"homepage": "https://github.com/ota-meshi/eslint-plugin-node-dependencies#readme",
|
|
50
|
+
"peerDependencies": {
|
|
51
|
+
"eslint": ">=6.0.0"
|
|
52
|
+
},
|
|
53
|
+
"devDependencies": {
|
|
54
|
+
"@ota-meshi/eslint-plugin": "^0.11.0",
|
|
55
|
+
"@types/chai": "^4.2.18",
|
|
56
|
+
"@types/eslint": "^8.0.0",
|
|
57
|
+
"@types/eslint-scope": "^3.7.0",
|
|
58
|
+
"@types/eslint-visitor-keys": "^1.0.0",
|
|
59
|
+
"@types/estree": "^0.0.52",
|
|
60
|
+
"@types/mocha": "^9.0.0",
|
|
61
|
+
"@types/node": "^16.0.0",
|
|
62
|
+
"@types/npm-package-arg": "^6.1.1",
|
|
63
|
+
"@types/semver": "^7.3.8",
|
|
64
|
+
"@typescript-eslint/eslint-plugin": "^5.0.0",
|
|
65
|
+
"@typescript-eslint/parser": "^5.0.0",
|
|
66
|
+
"chai": "^4.3.4",
|
|
67
|
+
"env-cmd": "^10.1.0",
|
|
68
|
+
"eslint": "^8.0.0",
|
|
69
|
+
"eslint-config-prettier": "^8.0.0",
|
|
70
|
+
"eslint-plugin-eslint-comments": "^3.2.0",
|
|
71
|
+
"eslint-plugin-eslint-plugin": "^4.0.0",
|
|
72
|
+
"eslint-plugin-json-schema-validator": "^3.0.0",
|
|
73
|
+
"eslint-plugin-jsonc": "^2.0.0",
|
|
74
|
+
"eslint-plugin-node": "^11.1.0",
|
|
75
|
+
"eslint-plugin-node-dependencies": "^0.8.0",
|
|
76
|
+
"eslint-plugin-prettier": "^4.0.0",
|
|
77
|
+
"eslint-plugin-regexp": "^1.0.0",
|
|
78
|
+
"eslint-plugin-vue": "^9.0.0",
|
|
79
|
+
"eslint-plugin-yml": "^1.0.0",
|
|
80
|
+
"eslint4b": "^7.3.1",
|
|
81
|
+
"mocha": "^10.0.0",
|
|
82
|
+
"mocha-chai-jest-snapshot": "^1.1.2",
|
|
83
|
+
"nyc": "^15.1.0",
|
|
84
|
+
"prettier": "^2.0.5",
|
|
85
|
+
"raw-loader": "^4.0.1",
|
|
86
|
+
"stylelint": "^14.0.0",
|
|
87
|
+
"stylelint-config-recommended-vue": "^1.0.0",
|
|
88
|
+
"stylelint-config-standard": "^26.0.0",
|
|
89
|
+
"stylelint-stylus": "^0.16.0",
|
|
90
|
+
"ts-node": "^10.0.0",
|
|
91
|
+
"typescript": "^4.0.0",
|
|
92
|
+
"vue-eslint-editor": "^1.1.0",
|
|
93
|
+
"vue-eslint-parser": "^9.0.0",
|
|
94
|
+
"vuepress": "^1.5.2"
|
|
95
|
+
},
|
|
96
|
+
"dependencies": {
|
|
97
|
+
"jsonc-eslint-parser": "^2.0.2",
|
|
98
|
+
"npm-package-arg": "^9.0.0",
|
|
99
|
+
"package-json": "^8.1.0",
|
|
100
|
+
"semver": "^7.3.5",
|
|
101
|
+
"synckit": "^0.7.1"
|
|
102
|
+
}
|
|
101
103
|
}
|