knip 4.3.1 → 4.4.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/dist/plugins/nx/index.js +24 -1
- package/dist/plugins/nx/types.d.ts +7 -0
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/package.json +5 -5
package/dist/plugins/nx/index.js
CHANGED
|
@@ -1,14 +1,37 @@
|
|
|
1
1
|
import { compact } from '../../util/array.js';
|
|
2
|
+
import { getPackageNameFromModuleSpecifier } from '../../util/modules.js';
|
|
2
3
|
import { timerify } from '../../util/Performance.js';
|
|
3
4
|
import { getDependenciesFromScripts, hasDependency, load } from '../../util/plugin.js';
|
|
4
5
|
const NAME = 'Nx';
|
|
5
6
|
const ENABLERS = ['nx', /^@nrwl\//, /^@nx\//];
|
|
6
7
|
const isEnabled = ({ dependencies }) => hasDependency(dependencies, ENABLERS);
|
|
7
|
-
const CONFIG_FILE_PATTERNS = ['project.json', '{apps,libs}/**/project.json'];
|
|
8
|
+
const CONFIG_FILE_PATTERNS = ['nx.json', 'project.json', '{apps,libs}/**/project.json'];
|
|
9
|
+
const findNxDependenciesInNxJson = async (configFilePath) => {
|
|
10
|
+
const localConfig = await load(configFilePath);
|
|
11
|
+
if (!localConfig)
|
|
12
|
+
return [];
|
|
13
|
+
const targetsDefault = localConfig.targetDefaults
|
|
14
|
+
? Object.keys(localConfig.targetDefaults)
|
|
15
|
+
.filter(it => it.includes(':') && it.startsWith('@'))
|
|
16
|
+
.map(it => it.split(':')[0])
|
|
17
|
+
: [];
|
|
18
|
+
const plugins = localConfig.plugins && Array.isArray(localConfig.plugins)
|
|
19
|
+
? localConfig.plugins.map(it => getPackageNameFromModuleSpecifier(it.plugin)).filter(value => value !== undefined)
|
|
20
|
+
: [];
|
|
21
|
+
const generators = localConfig.generators
|
|
22
|
+
? Object.keys(localConfig.generators)
|
|
23
|
+
.map(it => getPackageNameFromModuleSpecifier(it))
|
|
24
|
+
.filter(value => value !== undefined)
|
|
25
|
+
: [];
|
|
26
|
+
return compact([...targetsDefault, ...plugins, ...generators]);
|
|
27
|
+
};
|
|
8
28
|
const findNxDependencies = async (configFilePath, options) => {
|
|
9
29
|
const { isProduction } = options;
|
|
10
30
|
if (isProduction)
|
|
11
31
|
return [];
|
|
32
|
+
if (configFilePath.endsWith('nx.json')) {
|
|
33
|
+
return findNxDependenciesInNxJson(configFilePath, options);
|
|
34
|
+
}
|
|
12
35
|
const localConfig = await load(configFilePath);
|
|
13
36
|
if (!localConfig)
|
|
14
37
|
return [];
|
package/dist/version.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const version = "4.
|
|
1
|
+
export declare const version = "4.4.0";
|
package/dist/version.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const version = '4.
|
|
1
|
+
export const version = '4.4.0';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "knip",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.4.0",
|
|
4
4
|
"description": "Find unused files, dependencies and exports in your TypeScript and JavaScript projects",
|
|
5
5
|
"homepage": "https://knip.dev",
|
|
6
6
|
"repository": {
|
|
@@ -85,7 +85,7 @@
|
|
|
85
85
|
"@knip/eslint-config": "0.0.0",
|
|
86
86
|
"@release-it/bumper": "^6.0.1",
|
|
87
87
|
"@swc/cli": "^0.1.65",
|
|
88
|
-
"@swc/core": "^1.
|
|
88
|
+
"@swc/core": "^1.4.0",
|
|
89
89
|
"@types/js-yaml": "^4.0.9",
|
|
90
90
|
"@types/micromatch": "^4.0.6",
|
|
91
91
|
"@types/minimist": "^1.2.5",
|
|
@@ -94,11 +94,11 @@
|
|
|
94
94
|
"@types/webpack": "^5.28.5",
|
|
95
95
|
"c8": "9.1.0",
|
|
96
96
|
"eslint": "^8.56.0",
|
|
97
|
-
"playwright": "^1.41.
|
|
98
|
-
"prettier": "^3.2.
|
|
97
|
+
"playwright": "^1.41.2",
|
|
98
|
+
"prettier": "^3.2.5",
|
|
99
99
|
"release-it": "^17.0.3",
|
|
100
100
|
"tsx": "^4.7.0",
|
|
101
|
-
"type-fest": "^4.10.
|
|
101
|
+
"type-fest": "^4.10.2",
|
|
102
102
|
"typescript": "5.3.3"
|
|
103
103
|
},
|
|
104
104
|
"engines": {
|