knip 2.41.4 → 2.41.6
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/eslint/helpers.js +5 -11
- package/dist/typescript/resolveModuleNames.js +3 -0
- package/dist/util/fs.js +1 -1
- package/dist/util/modules.js +5 -2
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/package.json +20 -20
|
@@ -3,6 +3,7 @@ import { getPackageNameFromModuleSpecifier } from '../../util/modules.js';
|
|
|
3
3
|
import { isInternal, dirname, toAbsolute } from '../../util/path.js';
|
|
4
4
|
import { load } from '../../util/plugin.js';
|
|
5
5
|
import { _resolve } from '../../util/require.js';
|
|
6
|
+
import { getDependenciesFromConfig } from '../babel/index.js';
|
|
6
7
|
import { fallback } from './fallback.js';
|
|
7
8
|
import { PACKAGE_JSON_PATH } from './index.js';
|
|
8
9
|
const getDependencies = (config) => {
|
|
@@ -11,19 +12,12 @@ const getDependencies = (config) => {
|
|
|
11
12
|
extendsSpecifiers.push('eslint-config-prettier');
|
|
12
13
|
const plugins = config.plugins ? config.plugins.map(resolvePluginSpecifier) : [];
|
|
13
14
|
const parser = config.parser;
|
|
14
|
-
const
|
|
15
|
-
|
|
15
|
+
const babelDependencies = config.parserOptions?.babelOptions
|
|
16
|
+
? getDependenciesFromConfig(config.parserOptions.babelOptions)
|
|
17
|
+
: [];
|
|
16
18
|
const settings = config.settings ? getDependenciesFromSettings(config.settings) : [];
|
|
17
19
|
const overrides = config.overrides ? [config.overrides].flat().flatMap(getDependencies) : [];
|
|
18
|
-
return compact([
|
|
19
|
-
...extendsSpecifiers,
|
|
20
|
-
...plugins,
|
|
21
|
-
...extraPlugins,
|
|
22
|
-
parser,
|
|
23
|
-
...extraParsers,
|
|
24
|
-
...settings,
|
|
25
|
-
...overrides,
|
|
26
|
-
]);
|
|
20
|
+
return compact([...extendsSpecifiers, ...plugins, parser, ...babelDependencies, ...settings, ...overrides]);
|
|
27
21
|
};
|
|
28
22
|
export const getDependenciesDeep = async (configFilePath, options, dependencies = new Set()) => {
|
|
29
23
|
const addAll = (deps) => deps.forEach(dependency => dependencies.add(dependency));
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { existsSync } from 'node:fs';
|
|
2
|
+
import { isBuiltin } from 'node:module';
|
|
2
3
|
import ts from 'typescript';
|
|
3
4
|
import { sanitizeSpecifier } from '../util/modules.js';
|
|
4
5
|
import { dirname, extname, isAbsolute, isInternal, join } from '../util/path.js';
|
|
@@ -21,6 +22,8 @@ export function createCustomModuleResolver(customSys, compilerOptions, virtualFi
|
|
|
21
22
|
}
|
|
22
23
|
function resolveModuleName(name, containingFile) {
|
|
23
24
|
const sanitizedSpecifier = sanitizeSpecifier(name);
|
|
25
|
+
if (isBuiltin(sanitizedSpecifier))
|
|
26
|
+
return undefined;
|
|
24
27
|
const tsResolvedModule = ts.resolveModuleName(sanitizedSpecifier, containingFile, compilerOptions, ts.sys).resolvedModule;
|
|
25
28
|
if (!tsResolvedModule) {
|
|
26
29
|
const extension = extname(sanitizedSpecifier);
|
package/dist/util/fs.js
CHANGED
|
@@ -34,7 +34,7 @@ export const parseJSON = async (filePath, contents) => {
|
|
|
34
34
|
return JSON.parse(stripJsonComments(contents, { trailingCommas: true }));
|
|
35
35
|
}
|
|
36
36
|
catch (error) {
|
|
37
|
-
throw new LoaderError(`Error
|
|
37
|
+
throw new LoaderError(`Error parsing ${filePath}`, { cause: error });
|
|
38
38
|
}
|
|
39
39
|
};
|
|
40
40
|
export const parseYAML = async (contents) => {
|
package/dist/util/modules.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
|
+
import { isBuiltin } from 'module';
|
|
1
2
|
import { _glob } from './glob.js';
|
|
2
3
|
import { getStringValues } from './object.js';
|
|
3
|
-
import { toPosix } from './path.js';
|
|
4
|
+
import { isAbsolute, toPosix } from './path.js';
|
|
4
5
|
export const getPackageNameFromModuleSpecifier = (moduleSpecifier) => {
|
|
5
6
|
if (!isMaybePackageName(moduleSpecifier))
|
|
6
7
|
return;
|
|
@@ -52,7 +53,9 @@ export const getEntryPathFromManifest = (manifest, sharedGlobOptions) => {
|
|
|
52
53
|
return _glob({ ...sharedGlobOptions, patterns: Array.from(entryPaths) });
|
|
53
54
|
};
|
|
54
55
|
export const sanitizeSpecifier = (specifier) => {
|
|
55
|
-
if (specifier
|
|
56
|
+
if (isBuiltin(specifier))
|
|
57
|
+
return specifier;
|
|
58
|
+
if (isAbsolute(specifier))
|
|
56
59
|
return specifier;
|
|
57
60
|
return specifier.replace(/^([?!|-]+)?([^!?:]+).*/, '$2');
|
|
58
61
|
};
|
package/dist/version.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const version = "2.41.
|
|
1
|
+
export declare const version = "2.41.6";
|
package/dist/version.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const version = '2.41.
|
|
1
|
+
export const version = '2.41.6';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "knip",
|
|
3
|
-
"version": "2.41.
|
|
3
|
+
"version": "2.41.6",
|
|
4
4
|
"description": "Find unused files, dependencies and exports in your TypeScript and JavaScript projects",
|
|
5
5
|
"homepage": "https://github.com/webpro/knip",
|
|
6
6
|
"repository": "github:webpro/knip",
|
|
@@ -46,11 +46,11 @@
|
|
|
46
46
|
"@npmcli/map-workspaces": "^3.0.4",
|
|
47
47
|
"@pkgjs/parseargs": "0.11.0",
|
|
48
48
|
"@pnpm/logger": "5.0.0",
|
|
49
|
-
"@pnpm/workspace.pkgs-graph": "2.0.
|
|
49
|
+
"@pnpm/workspace.pkgs-graph": "2.0.11",
|
|
50
50
|
"@snyk/github-codeowners": "^1.1.0",
|
|
51
51
|
"chalk": "^5.2.0",
|
|
52
52
|
"easy-table": "^1.2.0",
|
|
53
|
-
"fast-glob": "
|
|
53
|
+
"fast-glob": "3.3.2",
|
|
54
54
|
"globby": "^13.1.3",
|
|
55
55
|
"jiti": "1.21.0",
|
|
56
56
|
"js-yaml": "^4.1.0",
|
|
@@ -67,30 +67,30 @@
|
|
|
67
67
|
"@jest/types": "29.6.3",
|
|
68
68
|
"@npmcli/package-json": "5.0.0",
|
|
69
69
|
"@release-it/bumper": "5.1.0",
|
|
70
|
-
"@swc/cli": "0.1.
|
|
71
|
-
"@swc/core": "1.3.
|
|
72
|
-
"@types/eslint": "8.44.
|
|
73
|
-
"@types/js-yaml": "4.0.
|
|
74
|
-
"@types/micromatch": "4.0.
|
|
75
|
-
"@types/minimist": "1.2.
|
|
76
|
-
"@types/node": "20.
|
|
77
|
-
"@types/npmcli__map-workspaces": "3.0.
|
|
78
|
-
"@types/pkgjs__parseargs": "0.10.
|
|
79
|
-
"@types/webpack": "5.28.
|
|
80
|
-
"@typescript-eslint/eslint-plugin": "6.
|
|
81
|
-
"@typescript-eslint/parser": "6.
|
|
70
|
+
"@swc/cli": "0.1.63",
|
|
71
|
+
"@swc/core": "1.3.99",
|
|
72
|
+
"@types/eslint": "8.44.7",
|
|
73
|
+
"@types/js-yaml": "4.0.9",
|
|
74
|
+
"@types/micromatch": "4.0.6",
|
|
75
|
+
"@types/minimist": "1.2.5",
|
|
76
|
+
"@types/node": "20.9.4",
|
|
77
|
+
"@types/npmcli__map-workspaces": "3.0.4",
|
|
78
|
+
"@types/pkgjs__parseargs": "0.10.3",
|
|
79
|
+
"@types/webpack": "5.28.5",
|
|
80
|
+
"@typescript-eslint/eslint-plugin": "6.12.0",
|
|
81
|
+
"@typescript-eslint/parser": "6.12.0",
|
|
82
82
|
"c8": "8.0.1",
|
|
83
|
-
"eslint": "8.
|
|
83
|
+
"eslint": "8.54.0",
|
|
84
84
|
"eslint-import-resolver-typescript": "3.6.1",
|
|
85
85
|
"eslint-plugin-import": "2.29.0",
|
|
86
|
-
"eslint-plugin-n": "16.
|
|
87
|
-
"playwright": "1.
|
|
88
|
-
"prettier": "3.0
|
|
86
|
+
"eslint-plugin-n": "16.3.1",
|
|
87
|
+
"playwright": "1.40.0",
|
|
88
|
+
"prettier": "3.1.0",
|
|
89
89
|
"release-it": "16.2.1",
|
|
90
90
|
"remark-cli": "12.0.0",
|
|
91
91
|
"remark-preset-webpro": "1.0.0",
|
|
92
92
|
"tsx": "3.14.0",
|
|
93
|
-
"type-fest": "4.
|
|
93
|
+
"type-fest": "4.8.2"
|
|
94
94
|
},
|
|
95
95
|
"engines": {
|
|
96
96
|
"node": ">=16.17.0 <17 || >=18.6.0"
|