knip 4.3.1 → 4.5.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/ConfigurationChief.d.ts +1 -0
- package/dist/ConfigurationValidator.d.ts +56 -0
- package/dist/ConfigurationValidator.js +1 -0
- package/dist/WorkspaceWorker.d.ts +2 -2
- package/dist/compilers/index.d.ts +10 -0
- package/dist/constants.js +1 -1
- package/dist/index.js +3 -3
- package/dist/plugins/index.d.ts +1 -0
- package/dist/plugins/index.js +1 -0
- package/dist/plugins/nx/index.js +24 -1
- package/dist/plugins/nx/types.d.ts +7 -0
- package/dist/plugins/vercel-og/index.d.ts +9 -0
- package/dist/plugins/vercel-og/index.js +22 -0
- package/dist/plugins/webpack/index.js +1 -1
- package/dist/reporters/markdown.js +13 -6
- package/dist/util/globby.d.ts +1 -1
- package/dist/util/globby.js +1 -1
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/package.json +6 -6
- package/schema.json +4 -0
|
@@ -122,6 +122,7 @@ export declare class ConfigurationChief {
|
|
|
122
122
|
playwrightCt?: (boolean | import("./types/config.js").EnsuredPluginConfiguration) | undefined;
|
|
123
123
|
releaseIt?: (boolean | import("./types/config.js").EnsuredPluginConfiguration) | undefined;
|
|
124
124
|
semanticRelease?: (boolean | import("./types/config.js").EnsuredPluginConfiguration) | undefined;
|
|
125
|
+
vercelOg?: (boolean | import("./types/config.js").EnsuredPluginConfiguration) | undefined;
|
|
125
126
|
entry: string[];
|
|
126
127
|
project: string[];
|
|
127
128
|
paths: any;
|
|
@@ -647,6 +647,19 @@ export declare const ConfigurationValidator: z.ZodObject<{
|
|
|
647
647
|
entry?: string | string[] | undefined;
|
|
648
648
|
project?: string | string[] | undefined;
|
|
649
649
|
}>]>>;
|
|
650
|
+
'vercel-og': z.ZodOptional<z.ZodUnion<[z.ZodBoolean, z.ZodUnion<[z.ZodString, z.ZodArray<z.ZodString, "many">]>, z.ZodObject<{
|
|
651
|
+
config: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodArray<z.ZodString, "many">]>>;
|
|
652
|
+
entry: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodArray<z.ZodString, "many">]>>;
|
|
653
|
+
project: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodArray<z.ZodString, "many">]>>;
|
|
654
|
+
}, "strip", z.ZodTypeAny, {
|
|
655
|
+
config?: string | string[] | undefined;
|
|
656
|
+
entry?: string | string[] | undefined;
|
|
657
|
+
project?: string | string[] | undefined;
|
|
658
|
+
}, {
|
|
659
|
+
config?: string | string[] | undefined;
|
|
660
|
+
entry?: string | string[] | undefined;
|
|
661
|
+
project?: string | string[] | undefined;
|
|
662
|
+
}>]>>;
|
|
650
663
|
vue: z.ZodOptional<z.ZodUnion<[z.ZodBoolean, z.ZodUnion<[z.ZodString, z.ZodArray<z.ZodString, "many">]>, z.ZodObject<{
|
|
651
664
|
config: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodArray<z.ZodString, "many">]>>;
|
|
652
665
|
entry: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodArray<z.ZodString, "many">]>>;
|
|
@@ -968,6 +981,11 @@ export declare const ConfigurationValidator: z.ZodObject<{
|
|
|
968
981
|
entry?: string | string[] | undefined;
|
|
969
982
|
project?: string | string[] | undefined;
|
|
970
983
|
} | undefined;
|
|
984
|
+
'vercel-og'?: string | boolean | string[] | {
|
|
985
|
+
config?: string | string[] | undefined;
|
|
986
|
+
entry?: string | string[] | undefined;
|
|
987
|
+
project?: string | string[] | undefined;
|
|
988
|
+
} | undefined;
|
|
971
989
|
vue?: string | boolean | string[] | {
|
|
972
990
|
config?: string | string[] | undefined;
|
|
973
991
|
entry?: string | string[] | undefined;
|
|
@@ -1241,6 +1259,11 @@ export declare const ConfigurationValidator: z.ZodObject<{
|
|
|
1241
1259
|
entry?: string | string[] | undefined;
|
|
1242
1260
|
project?: string | string[] | undefined;
|
|
1243
1261
|
} | undefined;
|
|
1262
|
+
'vercel-og'?: string | boolean | string[] | {
|
|
1263
|
+
config?: string | string[] | undefined;
|
|
1264
|
+
entry?: string | string[] | undefined;
|
|
1265
|
+
project?: string | string[] | undefined;
|
|
1266
|
+
} | undefined;
|
|
1244
1267
|
vue?: string | boolean | string[] | {
|
|
1245
1268
|
config?: string | string[] | undefined;
|
|
1246
1269
|
entry?: string | string[] | undefined;
|
|
@@ -1883,6 +1906,19 @@ export declare const ConfigurationValidator: z.ZodObject<{
|
|
|
1883
1906
|
entry?: string | string[] | undefined;
|
|
1884
1907
|
project?: string | string[] | undefined;
|
|
1885
1908
|
}>]>>;
|
|
1909
|
+
'vercel-og': z.ZodOptional<z.ZodUnion<[z.ZodBoolean, z.ZodUnion<[z.ZodString, z.ZodArray<z.ZodString, "many">]>, z.ZodObject<{
|
|
1910
|
+
config: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodArray<z.ZodString, "many">]>>;
|
|
1911
|
+
entry: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodArray<z.ZodString, "many">]>>;
|
|
1912
|
+
project: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodArray<z.ZodString, "many">]>>;
|
|
1913
|
+
}, "strip", z.ZodTypeAny, {
|
|
1914
|
+
config?: string | string[] | undefined;
|
|
1915
|
+
entry?: string | string[] | undefined;
|
|
1916
|
+
project?: string | string[] | undefined;
|
|
1917
|
+
}, {
|
|
1918
|
+
config?: string | string[] | undefined;
|
|
1919
|
+
entry?: string | string[] | undefined;
|
|
1920
|
+
project?: string | string[] | undefined;
|
|
1921
|
+
}>]>>;
|
|
1886
1922
|
vue: z.ZodOptional<z.ZodUnion<[z.ZodBoolean, z.ZodUnion<[z.ZodString, z.ZodArray<z.ZodString, "many">]>, z.ZodObject<{
|
|
1887
1923
|
config: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodArray<z.ZodString, "many">]>>;
|
|
1888
1924
|
entry: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodArray<z.ZodString, "many">]>>;
|
|
@@ -2220,6 +2256,11 @@ export declare const ConfigurationValidator: z.ZodObject<{
|
|
|
2220
2256
|
entry?: string | string[] | undefined;
|
|
2221
2257
|
project?: string | string[] | undefined;
|
|
2222
2258
|
} | undefined;
|
|
2259
|
+
'vercel-og'?: string | boolean | string[] | {
|
|
2260
|
+
config?: string | string[] | undefined;
|
|
2261
|
+
entry?: string | string[] | undefined;
|
|
2262
|
+
project?: string | string[] | undefined;
|
|
2263
|
+
} | undefined;
|
|
2223
2264
|
vue?: string | boolean | string[] | {
|
|
2224
2265
|
config?: string | string[] | undefined;
|
|
2225
2266
|
entry?: string | string[] | undefined;
|
|
@@ -2486,6 +2527,11 @@ export declare const ConfigurationValidator: z.ZodObject<{
|
|
|
2486
2527
|
entry?: string | string[] | undefined;
|
|
2487
2528
|
project?: string | string[] | undefined;
|
|
2488
2529
|
} | undefined;
|
|
2530
|
+
'vercel-og'?: string | boolean | string[] | {
|
|
2531
|
+
config?: string | string[] | undefined;
|
|
2532
|
+
entry?: string | string[] | undefined;
|
|
2533
|
+
project?: string | string[] | undefined;
|
|
2534
|
+
} | undefined;
|
|
2489
2535
|
vue?: string | boolean | string[] | {
|
|
2490
2536
|
config?: string | string[] | undefined;
|
|
2491
2537
|
entry?: string | string[] | undefined;
|
|
@@ -2775,6 +2821,11 @@ export declare const ConfigurationValidator: z.ZodObject<{
|
|
|
2775
2821
|
entry?: string | string[] | undefined;
|
|
2776
2822
|
project?: string | string[] | undefined;
|
|
2777
2823
|
} | undefined;
|
|
2824
|
+
'vercel-og'?: string | boolean | string[] | {
|
|
2825
|
+
config?: string | string[] | undefined;
|
|
2826
|
+
entry?: string | string[] | undefined;
|
|
2827
|
+
project?: string | string[] | undefined;
|
|
2828
|
+
} | undefined;
|
|
2778
2829
|
vue?: string | boolean | string[] | {
|
|
2779
2830
|
config?: string | string[] | undefined;
|
|
2780
2831
|
entry?: string | string[] | undefined;
|
|
@@ -3041,6 +3092,11 @@ export declare const ConfigurationValidator: z.ZodObject<{
|
|
|
3041
3092
|
entry?: string | string[] | undefined;
|
|
3042
3093
|
project?: string | string[] | undefined;
|
|
3043
3094
|
} | undefined;
|
|
3095
|
+
'vercel-og'?: string | boolean | string[] | {
|
|
3096
|
+
config?: string | string[] | undefined;
|
|
3097
|
+
entry?: string | string[] | undefined;
|
|
3098
|
+
project?: string | string[] | undefined;
|
|
3099
|
+
} | undefined;
|
|
3044
3100
|
vue?: string | boolean | string[] | {
|
|
3045
3101
|
config?: string | string[] | undefined;
|
|
3046
3102
|
entry?: string | string[] | undefined;
|
|
@@ -27,7 +27,7 @@ export declare class WorkspaceWorker {
|
|
|
27
27
|
isStrict: boolean;
|
|
28
28
|
rootIgnore: Configuration['ignore'];
|
|
29
29
|
negatedWorkspacePatterns: string[];
|
|
30
|
-
enabledPluginsMap: Record<"typescript" | "astro" | "svelte" | "vue" | "angular" | "ava" | "babel" | "capacitor" | "changesets" | "commitizen" | "commitlint" | "cspell" | "cypress" | "eleventy" | "eslint" | "gatsby" | "husky" | "jest" | "lefthook" | "linthtml" | "markdownlint" | "mocha" | "netlify" | "next" | "nx" | "nyc" | "playwright" | "postcss" | "prettier" | "remark" | "remix" | "rollup" | "sentry" | "storybook" | "stryker" | "stylelint" | "tailwind" | "tsup" | "typedoc" | "unbuild" | "vite" | "vitest" | "webpack" | "wireit" | "yorkie" | "drizzle" | "githubActions" | "graphqlCodegen" | "lintStaged" | "nodeTestRunner" | "npmPackageJsonLint" | "playwrightCt" | "releaseIt" | "semanticRelease", boolean>;
|
|
30
|
+
enabledPluginsMap: Record<"typescript" | "astro" | "svelte" | "vue" | "angular" | "ava" | "babel" | "capacitor" | "changesets" | "commitizen" | "commitlint" | "cspell" | "cypress" | "eleventy" | "eslint" | "gatsby" | "husky" | "jest" | "lefthook" | "linthtml" | "markdownlint" | "mocha" | "netlify" | "next" | "nx" | "nyc" | "playwright" | "postcss" | "prettier" | "remark" | "remix" | "rollup" | "sentry" | "storybook" | "stryker" | "stylelint" | "tailwind" | "tsup" | "typedoc" | "unbuild" | "vite" | "vitest" | "webpack" | "wireit" | "yorkie" | "drizzle" | "githubActions" | "graphqlCodegen" | "lintStaged" | "nodeTestRunner" | "npmPackageJsonLint" | "playwrightCt" | "releaseIt" | "semanticRelease" | "vercelOg", boolean>;
|
|
31
31
|
enabledPlugins: PluginName[];
|
|
32
32
|
enabledPluginsInAncestors: string[];
|
|
33
33
|
constructor({ name, dir, cwd, config, manifest, dependencies, isProduction, isStrict, rootIgnore, negatedWorkspacePatterns, enabledPluginsInAncestors, }: WorkspaceManagerOptions);
|
|
@@ -46,7 +46,7 @@ export declare class WorkspaceWorker {
|
|
|
46
46
|
entryFilePatterns: Set<string>;
|
|
47
47
|
productionEntryFilePatterns: Set<string>;
|
|
48
48
|
referencedDependencies: ReferencedDependencies;
|
|
49
|
-
enabledPlugins: ("typescript" | "astro" | "svelte" | "vue" | "angular" | "ava" | "babel" | "capacitor" | "changesets" | "commitizen" | "commitlint" | "cspell" | "cypress" | "eleventy" | "eslint" | "gatsby" | "husky" | "jest" | "lefthook" | "linthtml" | "markdownlint" | "mocha" | "netlify" | "next" | "nx" | "nyc" | "playwright" | "postcss" | "prettier" | "remark" | "remix" | "rollup" | "sentry" | "storybook" | "stryker" | "stylelint" | "tailwind" | "tsup" | "typedoc" | "unbuild" | "vite" | "vitest" | "webpack" | "wireit" | "yorkie" | "drizzle" | "githubActions" | "graphqlCodegen" | "lintStaged" | "nodeTestRunner" | "npmPackageJsonLint" | "playwrightCt" | "releaseIt" | "semanticRelease")[];
|
|
49
|
+
enabledPlugins: ("typescript" | "astro" | "svelte" | "vue" | "angular" | "ava" | "babel" | "capacitor" | "changesets" | "commitizen" | "commitlint" | "cspell" | "cypress" | "eleventy" | "eslint" | "gatsby" | "husky" | "jest" | "lefthook" | "linthtml" | "markdownlint" | "mocha" | "netlify" | "next" | "nx" | "nyc" | "playwright" | "postcss" | "prettier" | "remark" | "remix" | "rollup" | "sentry" | "storybook" | "stryker" | "stylelint" | "tailwind" | "tsup" | "typedoc" | "unbuild" | "vite" | "vitest" | "webpack" | "wireit" | "yorkie" | "drizzle" | "githubActions" | "graphqlCodegen" | "lintStaged" | "nodeTestRunner" | "npmPackageJsonLint" | "playwrightCt" | "releaseIt" | "semanticRelease" | "vercelOg")[];
|
|
50
50
|
}>;
|
|
51
51
|
}
|
|
52
52
|
export {};
|
|
@@ -260,6 +260,11 @@ export declare const partitionCompilers: (rawLocalConfig: RawConfiguration) => {
|
|
|
260
260
|
entry?: string | string[] | undefined;
|
|
261
261
|
project?: string | string[] | undefined;
|
|
262
262
|
} | undefined;
|
|
263
|
+
'vercel-og'?: string | boolean | string[] | {
|
|
264
|
+
config?: string | string[] | undefined;
|
|
265
|
+
entry?: string | string[] | undefined;
|
|
266
|
+
project?: string | string[] | undefined;
|
|
267
|
+
} | undefined;
|
|
263
268
|
vue?: string | boolean | string[] | {
|
|
264
269
|
config?: string | string[] | undefined;
|
|
265
270
|
entry?: string | string[] | undefined;
|
|
@@ -526,6 +531,11 @@ export declare const partitionCompilers: (rawLocalConfig: RawConfiguration) => {
|
|
|
526
531
|
entry?: string | string[] | undefined;
|
|
527
532
|
project?: string | string[] | undefined;
|
|
528
533
|
} | undefined;
|
|
534
|
+
'vercel-og'?: string | boolean | string[] | {
|
|
535
|
+
config?: string | string[] | undefined;
|
|
536
|
+
entry?: string | string[] | undefined;
|
|
537
|
+
project?: string | string[] | undefined;
|
|
538
|
+
} | undefined;
|
|
529
539
|
vue?: string | boolean | string[] | {
|
|
530
540
|
config?: string | string[] | undefined;
|
|
531
541
|
entry?: string | string[] | undefined;
|
package/dist/constants.js
CHANGED
|
@@ -68,7 +68,7 @@ export const IGNORED_FILE_EXTENSIONS = new Set([
|
|
|
68
68
|
'.yml',
|
|
69
69
|
...DUMMY_VIRTUAL_FILE_EXTENSIONS,
|
|
70
70
|
]);
|
|
71
|
-
export const IGNORE_DEFINITELY_TYPED = ['node'];
|
|
71
|
+
export const IGNORE_DEFINITELY_TYPED = ['node', 'bun'];
|
|
72
72
|
export const ISSUE_TYPES = [
|
|
73
73
|
'files',
|
|
74
74
|
'dependencies',
|
package/dist/index.js
CHANGED
|
@@ -11,7 +11,7 @@ import { PrincipalFactory } from './PrincipalFactory.js';
|
|
|
11
11
|
import { ProjectPrincipal } from './ProjectPrincipal.js';
|
|
12
12
|
import { debugLogObject, debugLogArray, debugLog, exportLookupLog } from './util/debug.js';
|
|
13
13
|
import { _glob, negate } from './util/glob.js';
|
|
14
|
-
import {
|
|
14
|
+
import { getGitIgnoredFn } from './util/globby.js';
|
|
15
15
|
import { getEntryPathFromManifest, getPackageNameFromFilePath, getPackageNameFromModuleSpecifier, normalizeSpecifierFromFilePath, } from './util/modules.js';
|
|
16
16
|
import { dirname, isInNodeModules, join, isInternal } from './util/path.js';
|
|
17
17
|
import { fromBinary, isBinary } from './util/protocols.js';
|
|
@@ -26,7 +26,7 @@ export const main = async (unresolvedConfiguration) => {
|
|
|
26
26
|
const deputy = new DependencyDeputy({ isProduction, isStrict });
|
|
27
27
|
const factory = new PrincipalFactory();
|
|
28
28
|
const streamer = new ConsoleStreamer({ isEnabled: isShowProgress });
|
|
29
|
-
const isGitIgnored = await
|
|
29
|
+
const isGitIgnored = await getGitIgnoredFn({ cwd, gitignore });
|
|
30
30
|
streamer.cast('Reading workspace configuration(s)...');
|
|
31
31
|
await chief.init();
|
|
32
32
|
const workspaces = chief.getIncludedWorkspaces();
|
|
@@ -236,7 +236,7 @@ export const main = async (unresolvedConfiguration) => {
|
|
|
236
236
|
const workspace = chief.findWorkspaceByFilePath(specifierFilePath);
|
|
237
237
|
if (workspace) {
|
|
238
238
|
const principal = factory.getPrincipalByPackageName(workspace.pkgName);
|
|
239
|
-
if (principal && !
|
|
239
|
+
if (principal && !isGitIgnored(specifierFilePath)) {
|
|
240
240
|
specifierFilePaths.add(specifierFilePath);
|
|
241
241
|
}
|
|
242
242
|
}
|
package/dist/plugins/index.d.ts
CHANGED
|
@@ -46,6 +46,7 @@ export { default as tsup } from './tsup/index.js';
|
|
|
46
46
|
export { default as typedoc } from './typedoc/index.js';
|
|
47
47
|
export { default as typescript } from './typescript/index.js';
|
|
48
48
|
export { default as unbuild } from './unbuild/index.js';
|
|
49
|
+
export { default as vercelOg } from './vercel-og/index.js';
|
|
49
50
|
export { default as vite } from './vite/index.js';
|
|
50
51
|
export { default as vitest } from './vitest/index.js';
|
|
51
52
|
export { default as vue } from './vue/index.js';
|
package/dist/plugins/index.js
CHANGED
|
@@ -46,6 +46,7 @@ export { default as tsup } from './tsup/index.js';
|
|
|
46
46
|
export { default as typedoc } from './typedoc/index.js';
|
|
47
47
|
export { default as typescript } from './typescript/index.js';
|
|
48
48
|
export { default as unbuild } from './unbuild/index.js';
|
|
49
|
+
export { default as vercelOg } from './vercel-og/index.js';
|
|
49
50
|
export { default as vite } from './vite/index.js';
|
|
50
51
|
export { default as vitest } from './vitest/index.js';
|
|
51
52
|
export { default as vue } from './vue/index.js';
|
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 [];
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { GenericPluginCallback, IsPluginEnabledCallback } from '../../types/plugins.js';
|
|
2
|
+
declare const _default: {
|
|
3
|
+
NAME: string;
|
|
4
|
+
ENABLERS: string[];
|
|
5
|
+
isEnabled: IsPluginEnabledCallback;
|
|
6
|
+
PRODUCTION_ENTRY_FILE_PATTERNS: string[];
|
|
7
|
+
findDependencies: GenericPluginCallback;
|
|
8
|
+
};
|
|
9
|
+
export default _default;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { hasDependency } from '../../util/plugin.js';
|
|
2
|
+
import { toProductionEntryPattern } from '../../util/protocols.js';
|
|
3
|
+
const NAME = 'Vercel OG';
|
|
4
|
+
const ENABLERS = ['next', '@vercel/og'];
|
|
5
|
+
const isEnabled = ({ dependencies }) => hasDependency(dependencies, ENABLERS);
|
|
6
|
+
const PRODUCTION_ENTRY_FILE_PATTERNS = [
|
|
7
|
+
'{src/,}pages/api/og.{jsx,tsx}',
|
|
8
|
+
'{src/,}app/api/og/route.{jsx,tsx}',
|
|
9
|
+
];
|
|
10
|
+
const findDependencies = async (configFilePath, options) => {
|
|
11
|
+
const { config } = options;
|
|
12
|
+
return config.entry
|
|
13
|
+
? config.entry.map(toProductionEntryPattern)
|
|
14
|
+
: PRODUCTION_ENTRY_FILE_PATTERNS.map(toProductionEntryPattern);
|
|
15
|
+
};
|
|
16
|
+
export default {
|
|
17
|
+
NAME,
|
|
18
|
+
ENABLERS,
|
|
19
|
+
isEnabled,
|
|
20
|
+
PRODUCTION_ENTRY_FILE_PATTERNS,
|
|
21
|
+
findDependencies,
|
|
22
|
+
};
|
|
@@ -5,7 +5,7 @@ import { hasDependency, load } from '../../util/plugin.js';
|
|
|
5
5
|
import { toEntryPattern, toProductionEntryPattern } from '../../util/protocols.js';
|
|
6
6
|
import { getDependenciesFromConfig } from '../babel/index.js';
|
|
7
7
|
const NAME = 'Webpack';
|
|
8
|
-
const ENABLERS = ['webpack'];
|
|
8
|
+
const ENABLERS = ['webpack', 'webpack-cli'];
|
|
9
9
|
const isEnabled = ({ dependencies }) => hasDependency(dependencies, ENABLERS);
|
|
10
10
|
const CONFIG_FILE_PATTERNS = ['webpack.config*.{js,ts,mjs,cjs,mts,cts}'];
|
|
11
11
|
const hasBabelOptions = (use) => Boolean(use) &&
|
|
@@ -2,6 +2,13 @@ import { relative, toRelative } from '../util/path.js';
|
|
|
2
2
|
import { getTitle } from './util.js';
|
|
3
3
|
export default ({ report, issues }) => {
|
|
4
4
|
console.log('# Knip report\n');
|
|
5
|
+
const getFilePath = (issue) => {
|
|
6
|
+
if (!issue.line || !issue.col)
|
|
7
|
+
return relative(issue.filePath);
|
|
8
|
+
return `${relative(issue.filePath)}:${issue.line}:${issue.col}`;
|
|
9
|
+
};
|
|
10
|
+
const sortLongestSymbol = (a, b) => b.symbol.length - a.symbol.length;
|
|
11
|
+
const sortLongestFilePath = (a, b) => getFilePath(b).length - getFilePath(a).length;
|
|
5
12
|
for (const [reportType, isReportType] of Object.entries(report)) {
|
|
6
13
|
if (isReportType) {
|
|
7
14
|
const title = getTitle(reportType);
|
|
@@ -17,13 +24,13 @@ export default ({ report, issues }) => {
|
|
|
17
24
|
});
|
|
18
25
|
}
|
|
19
26
|
else {
|
|
20
|
-
const longestSymbol = issuesForType.sort(
|
|
21
|
-
const
|
|
22
|
-
const
|
|
23
|
-
console.log(`| ${`Name`.padEnd(longestSymbol)} | ${`Location`.padEnd(longestFilePath)} |`);
|
|
24
|
-
console.log(
|
|
27
|
+
const longestSymbol = issuesForType.sort(sortLongestSymbol)[0].symbol.length;
|
|
28
|
+
const sortedByFilePath = issuesForType.sort(sortLongestFilePath);
|
|
29
|
+
const longestFilePath = getFilePath(sortedByFilePath[0]).length;
|
|
30
|
+
console.log(`| ${`Name`.padEnd(longestSymbol)} | ${`Location`.padEnd(longestFilePath)} | Severity |`);
|
|
31
|
+
console.log(`| :${'-'.repeat(longestSymbol - 1)} | :${'-'.repeat(longestFilePath - 1)} | :------- |`);
|
|
25
32
|
sortedByFilePath.forEach((issue) => {
|
|
26
|
-
console.log(`| ${issue.symbol.padEnd(longestSymbol)} | ${
|
|
33
|
+
console.log(`| ${issue.symbol.padEnd(longestSymbol)} | ${getFilePath(issue).padEnd(longestFilePath)} | ${(issue.severity ?? '').padEnd(8)} |`);
|
|
27
34
|
});
|
|
28
35
|
}
|
|
29
36
|
console.log('');
|
package/dist/util/globby.d.ts
CHANGED
|
@@ -10,5 +10,5 @@ type GlobOptions = {
|
|
|
10
10
|
} & FastGlobOptionsWithoutCwd;
|
|
11
11
|
type FastGlobOptionsWithoutCwd = Pick<FastGlobOptions, 'onlyDirectories' | 'ignore' | 'absolute' | 'dot'>;
|
|
12
12
|
export declare function globby(patterns: string | string[], options: GlobOptions): Promise<string[]>;
|
|
13
|
-
export declare function
|
|
13
|
+
export declare function getGitIgnoredFn(options: Options): Promise<(path: string) => boolean>;
|
|
14
14
|
export {};
|
package/dist/util/globby.js
CHANGED
|
@@ -121,7 +121,7 @@ export async function globby(patterns, options) {
|
|
|
121
121
|
debugLogObject(relative(options.cwd, dir) || ROOT_WORKSPACE_NAME, `Glob options`, { patterns, ...options });
|
|
122
122
|
return fastGlob(patterns, fastGlobOptions);
|
|
123
123
|
}
|
|
124
|
-
export async function
|
|
124
|
+
export async function getGitIgnoredFn(options) {
|
|
125
125
|
cachedIgnores.clear();
|
|
126
126
|
if (options.gitignore === false)
|
|
127
127
|
return () => false;
|
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.5.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": {
|
|
@@ -68,7 +68,7 @@
|
|
|
68
68
|
"micromatch": "4.0.5",
|
|
69
69
|
"minimist": "1.2.8",
|
|
70
70
|
"picocolors": "1.0.0",
|
|
71
|
-
"picomatch": "
|
|
71
|
+
"picomatch": "4.0.1",
|
|
72
72
|
"pretty-ms": "9.0.0",
|
|
73
73
|
"smol-toml": "1.1.4",
|
|
74
74
|
"strip-json-comments": "5.0.1",
|
|
@@ -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": {
|
package/schema.json
CHANGED
|
@@ -458,6 +458,10 @@
|
|
|
458
458
|
"title": "unbuild plugin configuration (https://github.com/webpro/knip/blob/main/src/plugins/unbuild/README.md)",
|
|
459
459
|
"$ref": "#/definitions/plugin"
|
|
460
460
|
},
|
|
461
|
+
"vercel-og": {
|
|
462
|
+
"title": "vercel-og plugin configuration (https://github.com/webpro/knip/blob/main/src/plugins/vercel-og/README.md)",
|
|
463
|
+
"$ref": "#/definitions/plugin"
|
|
464
|
+
},
|
|
461
465
|
"vite": {
|
|
462
466
|
"title": "vite plugin configuration (https://github.com/webpro/knip/blob/main/src/plugins/vite/README.md)",
|
|
463
467
|
"$ref": "#/definitions/plugin"
|