knip 3.10.0 → 3.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.
@@ -36,6 +36,19 @@ export declare const ConfigurationValidator: z.ZodObject<{
36
36
  ignoreBinaries: z.ZodOptional<z.ZodArray<z.ZodUnion<[z.ZodString, z.ZodType<RegExp, z.ZodTypeDef, RegExp>]>, "many">>;
37
37
  ignoreDependencies: z.ZodOptional<z.ZodArray<z.ZodUnion<[z.ZodString, z.ZodType<RegExp, z.ZodTypeDef, RegExp>]>, "many">>;
38
38
  includeEntryExports: z.ZodOptional<z.ZodBoolean>;
39
+ vue: z.ZodOptional<z.ZodUnion<[z.ZodBoolean, z.ZodUnion<[z.ZodString, z.ZodArray<z.ZodString, "many">]>, z.ZodObject<{
40
+ config: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodArray<z.ZodString, "many">]>>;
41
+ entry: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodArray<z.ZodString, "many">]>>;
42
+ project: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodArray<z.ZodString, "many">]>>;
43
+ }, "strip", z.ZodTypeAny, {
44
+ config?: string | string[] | undefined;
45
+ entry?: string | string[] | undefined;
46
+ project?: string | string[] | undefined;
47
+ }, {
48
+ config?: string | string[] | undefined;
49
+ entry?: string | string[] | undefined;
50
+ project?: string | string[] | undefined;
51
+ }>]>>;
39
52
  astro: z.ZodOptional<z.ZodUnion<[z.ZodBoolean, z.ZodUnion<[z.ZodString, z.ZodArray<z.ZodString, "many">]>, z.ZodObject<{
40
53
  config: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodArray<z.ZodString, "many">]>>;
41
54
  entry: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodArray<z.ZodString, "many">]>>;
@@ -668,6 +681,11 @@ export declare const ConfigurationValidator: z.ZodObject<{
668
681
  ignoreBinaries?: (string | RegExp)[] | undefined;
669
682
  ignoreDependencies?: (string | RegExp)[] | undefined;
670
683
  includeEntryExports?: boolean | undefined;
684
+ vue?: string | boolean | string[] | {
685
+ config?: string | string[] | undefined;
686
+ entry?: string | string[] | undefined;
687
+ project?: string | string[] | undefined;
688
+ } | undefined;
671
689
  astro?: string | boolean | string[] | {
672
690
  config?: string | string[] | undefined;
673
691
  entry?: string | string[] | undefined;
@@ -916,6 +934,11 @@ export declare const ConfigurationValidator: z.ZodObject<{
916
934
  ignoreBinaries?: (string | RegExp)[] | undefined;
917
935
  ignoreDependencies?: (string | RegExp)[] | undefined;
918
936
  includeEntryExports?: boolean | undefined;
937
+ vue?: string | boolean | string[] | {
938
+ config?: string | string[] | undefined;
939
+ entry?: string | string[] | undefined;
940
+ project?: string | string[] | undefined;
941
+ } | undefined;
919
942
  astro?: string | boolean | string[] | {
920
943
  config?: string | string[] | undefined;
921
944
  entry?: string | string[] | undefined;
@@ -1157,6 +1180,19 @@ export declare const ConfigurationValidator: z.ZodObject<{
1157
1180
  project?: string | string[] | undefined;
1158
1181
  } | undefined;
1159
1182
  }>>>;
1183
+ vue: z.ZodOptional<z.ZodUnion<[z.ZodBoolean, z.ZodUnion<[z.ZodString, z.ZodArray<z.ZodString, "many">]>, z.ZodObject<{
1184
+ config: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodArray<z.ZodString, "many">]>>;
1185
+ entry: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodArray<z.ZodString, "many">]>>;
1186
+ project: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodArray<z.ZodString, "many">]>>;
1187
+ }, "strip", z.ZodTypeAny, {
1188
+ config?: string | string[] | undefined;
1189
+ entry?: string | string[] | undefined;
1190
+ project?: string | string[] | undefined;
1191
+ }, {
1192
+ config?: string | string[] | undefined;
1193
+ entry?: string | string[] | undefined;
1194
+ project?: string | string[] | undefined;
1195
+ }>]>>;
1160
1196
  astro: z.ZodOptional<z.ZodUnion<[z.ZodBoolean, z.ZodUnion<[z.ZodString, z.ZodArray<z.ZodString, "many">]>, z.ZodObject<{
1161
1197
  config: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodArray<z.ZodString, "many">]>>;
1162
1198
  entry: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodArray<z.ZodString, "many">]>>;
@@ -1805,6 +1841,11 @@ export declare const ConfigurationValidator: z.ZodObject<{
1805
1841
  ignoreBinaries?: (string | RegExp)[] | undefined;
1806
1842
  ignoreDependencies?: (string | RegExp)[] | undefined;
1807
1843
  includeEntryExports?: boolean | undefined;
1844
+ vue?: string | boolean | string[] | {
1845
+ config?: string | string[] | undefined;
1846
+ entry?: string | string[] | undefined;
1847
+ project?: string | string[] | undefined;
1848
+ } | undefined;
1808
1849
  astro?: string | boolean | string[] | {
1809
1850
  config?: string | string[] | undefined;
1810
1851
  entry?: string | string[] | undefined;
@@ -2046,6 +2087,11 @@ export declare const ConfigurationValidator: z.ZodObject<{
2046
2087
  project?: string | string[] | undefined;
2047
2088
  } | undefined;
2048
2089
  }> | undefined;
2090
+ vue?: string | boolean | string[] | {
2091
+ config?: string | string[] | undefined;
2092
+ entry?: string | string[] | undefined;
2093
+ project?: string | string[] | undefined;
2094
+ } | undefined;
2049
2095
  astro?: string | boolean | string[] | {
2050
2096
  config?: string | string[] | undefined;
2051
2097
  entry?: string | string[] | undefined;
@@ -2310,6 +2356,11 @@ export declare const ConfigurationValidator: z.ZodObject<{
2310
2356
  ignoreBinaries?: (string | RegExp)[] | undefined;
2311
2357
  ignoreDependencies?: (string | RegExp)[] | undefined;
2312
2358
  includeEntryExports?: boolean | undefined;
2359
+ vue?: string | boolean | string[] | {
2360
+ config?: string | string[] | undefined;
2361
+ entry?: string | string[] | undefined;
2362
+ project?: string | string[] | undefined;
2363
+ } | undefined;
2313
2364
  astro?: string | boolean | string[] | {
2314
2365
  config?: string | string[] | undefined;
2315
2366
  entry?: string | string[] | undefined;
@@ -2551,6 +2602,11 @@ export declare const ConfigurationValidator: z.ZodObject<{
2551
2602
  project?: string | string[] | undefined;
2552
2603
  } | undefined;
2553
2604
  }> | undefined;
2605
+ vue?: string | boolean | string[] | {
2606
+ config?: string | string[] | undefined;
2607
+ entry?: string | string[] | undefined;
2608
+ project?: string | string[] | undefined;
2609
+ } | undefined;
2554
2610
  astro?: string | boolean | string[] | {
2555
2611
  config?: string | string[] | undefined;
2556
2612
  entry?: string | string[] | undefined;
@@ -62,6 +62,7 @@ export const pluginSchema = z.union([
62
62
  }),
63
63
  ]);
64
64
  const pluginsSchema = z.object({
65
+ vue: pluginSchema,
65
66
  astro: pluginSchema,
66
67
  angular: pluginSchema,
67
68
  ava: pluginSchema,
@@ -52,7 +52,7 @@ export declare class WorkspaceWorker {
52
52
  installedBinaries: InstalledBinaries;
53
53
  referencedDependencies: ReferencedDependencies;
54
54
  hasTypesIncluded: Set<string>;
55
- enabledPlugins: ("astro" | "angular" | "ava" | "babel" | "capacitor" | "changesets" | "commitizen" | "commitlint" | "cspell" | "cypress" | "eleventy" | "eslint" | "gatsby" | "husky" | "jest" | "lefthook" | "linthtml" | "markdownlint" | "mocha" | "next" | "nx" | "nyc" | "playwright" | "postcss" | "prettier" | "remark" | "remix" | "rollup" | "sentry" | "storybook" | "stryker" | "stylelint" | "svelte" | "tailwind" | "tsup" | "typedoc" | "typescript" | "vite" | "vitest" | "webpack" | "wireit" | "drizzle" | "githubActions" | "graphqlCodegen" | "lintStaged" | "nodeTestRunner" | "npmPackageJsonLint" | "playwrightCt" | "releaseIt" | "semanticRelease")[];
55
+ enabledPlugins: ("vue" | "astro" | "angular" | "ava" | "babel" | "capacitor" | "changesets" | "commitizen" | "commitlint" | "cspell" | "cypress" | "eleventy" | "eslint" | "gatsby" | "husky" | "jest" | "lefthook" | "linthtml" | "markdownlint" | "mocha" | "next" | "nx" | "nyc" | "playwright" | "postcss" | "prettier" | "remark" | "remix" | "rollup" | "sentry" | "storybook" | "stryker" | "stylelint" | "svelte" | "tailwind" | "tsup" | "typedoc" | "typescript" | "vite" | "vitest" | "webpack" | "wireit" | "drizzle" | "githubActions" | "graphqlCodegen" | "lintStaged" | "nodeTestRunner" | "npmPackageJsonLint" | "playwrightCt" | "releaseIt" | "semanticRelease")[];
56
56
  entryFilePatterns: string[];
57
57
  productionEntryFilePatterns: string[];
58
58
  }>;
@@ -3,7 +3,7 @@ import { compact } from '../util/array.js';
3
3
  import { getPackageNameFromModuleSpecifier } from '../util/modules.js';
4
4
  import { extname, isInternal } from '../util/path.js';
5
5
  import { timerify } from '../util/Performance.js';
6
- import { isBinary } from '../util/protocols.js';
6
+ import { fromBinary, isBinary } from '../util/protocols.js';
7
7
  import { getBinariesFromScript } from './bash-parser.js';
8
8
  const defaultCwd = process.cwd();
9
9
  const getDependenciesFromScripts = (npmScripts, options = {}) => {
@@ -13,8 +13,11 @@ const getDependenciesFromScripts = (npmScripts, options = {}) => {
13
13
  return compact(results.map(identifier => {
14
14
  if (identifier.startsWith('http'))
15
15
  return;
16
- if (isBinary(identifier))
16
+ if (isBinary(identifier)) {
17
+ if (!/^\b/.test(fromBinary(identifier)))
18
+ return;
17
19
  return identifier;
20
+ }
18
21
  if (isInternal(identifier)) {
19
22
  const ext = extname(identifier);
20
23
  if (ext && IGNORED_FILE_EXTENSIONS.has(ext))
@@ -5,7 +5,7 @@ export const NAME = 'Eleventy';
5
5
  export const ENABLERS = ['@11ty/eleventy'];
6
6
  export const isEnabled = ({ dependencies }) => hasDependency(dependencies, ENABLERS);
7
7
  export const ENTRY_FILE_PATTERNS = ['.eleventy.js', 'eleventy.config.{js,cjs}'];
8
- export const PRODUCTION_ENTRY_FILE_PATTERNS = ['_includes', '_data'];
8
+ export const PRODUCTION_ENTRY_FILE_PATTERNS = ['posts/**/*.11tydata.js', '_data/**/*.{js,cjs,mjs}'];
9
9
  const findEleventyDependencies = async (configFilePath, options) => {
10
10
  const { config } = options;
11
11
  return config.entry
@@ -11,7 +11,7 @@ const getDependencies = (config) => {
11
11
  if (extendsSpecifiers.some(specifier => specifier?.startsWith('eslint-plugin-prettier')))
12
12
  extendsSpecifiers.push('eslint-config-prettier');
13
13
  const plugins = config.plugins ? config.plugins.map(resolvePluginSpecifier) : [];
14
- const parser = config.parser;
14
+ const parser = config.parser ?? config.parserOptions?.parser;
15
15
  const babelDependencies = config.parserOptions?.babelOptions
16
16
  ? getDependenciesFromConfig(config.parserOptions.babelOptions)
17
17
  : [];
@@ -1,5 +1,6 @@
1
1
  type ParserOptions = {
2
2
  project?: string;
3
+ parser?: string;
3
4
  babelOptions?: {
4
5
  plugins: string[];
5
6
  presets: string[];
@@ -48,3 +48,4 @@ export * as vite from './vite/index.js';
48
48
  export * as vitest from './vitest/index.js';
49
49
  export * as webpack from './webpack/index.js';
50
50
  export * as wireit from './wireit/index.js';
51
+ export * as vue from './vue/index.js';
@@ -48,3 +48,4 @@ export * as vite from './vite/index.js';
48
48
  export * as vitest from './vitest/index.js';
49
49
  export * as webpack from './webpack/index.js';
50
50
  export * as wireit from './wireit/index.js';
51
+ export * as vue from './vue/index.js';
@@ -5,5 +5,10 @@ export declare const ENABLERS: string[];
5
5
  export declare const isEnabled: IsPluginEnabledCallback;
6
6
  export declare const CONFIG_FILE_PATTERNS: string[];
7
7
  export declare const ENTRY_FILE_PATTERNS: string[];
8
- export declare const toEntryPatterns: (testMatch: string | RegExp | Array<string | RegExp> | undefined, cwd: string, configFilePath: string, config: PlaywrightTestConfig) => string[];
8
+ export declare const findPlaywrightDependenciesFromConfig: ({ config, cwd, configFilePath, defaultPatterns, }: {
9
+ config: PlaywrightTestConfig;
10
+ cwd: string;
11
+ configFilePath: string;
12
+ defaultPatterns: string[];
13
+ }) => string[];
9
14
  export declare const findDependencies: GenericPluginCallback;
@@ -7,22 +7,32 @@ export const ENABLERS = ['@playwright/test'];
7
7
  export const isEnabled = ({ dependencies }) => hasDependency(dependencies, ENABLERS);
8
8
  export const CONFIG_FILE_PATTERNS = ['playwright.config.{js,ts}'];
9
9
  export const ENTRY_FILE_PATTERNS = ['**/*.@(spec|test).?(c|m)[jt]s?(x)'];
10
- export const toEntryPatterns = (testMatch, cwd, configFilePath, config) => {
10
+ const toEntryPatterns = (testMatch, cwd, configFilePath, config) => {
11
11
  if (!testMatch)
12
12
  return [];
13
13
  const dir = relative(cwd, config.testDir ? join(dirname(configFilePath), config.testDir) : dirname(configFilePath));
14
14
  const patterns = [testMatch].flat().filter((p) => typeof p === 'string');
15
15
  return patterns.map(pattern => toEntryPattern(join(dir, pattern)));
16
16
  };
17
+ const builtinReporters = ['dot', 'line', 'list', 'junit', 'html', 'blob', 'json', 'github'];
18
+ export const findPlaywrightDependenciesFromConfig = ({ config, cwd, configFilePath, defaultPatterns, }) => {
19
+ const projects = config.projects ? [config, ...config.projects] : [config];
20
+ const patterns = projects.flatMap(config => toEntryPatterns(config.testMatch, cwd, configFilePath, config));
21
+ const reporters = [config.reporter].flat().flatMap(reporter => {
22
+ const name = typeof reporter === 'string' ? reporter : reporter?.[0];
23
+ if (!name || builtinReporters.includes(name))
24
+ return [];
25
+ return [name];
26
+ });
27
+ return [...(patterns.length > 0 ? patterns : defaultPatterns), ...reporters];
28
+ };
17
29
  const findPlaywrightDependencies = async (configFilePath, options) => {
18
30
  const { cwd, config } = options;
19
31
  const localConfig = await load(configFilePath);
32
+ const defaultPatterns = (config?.entry ?? ENTRY_FILE_PATTERNS).map(toEntryPattern);
20
33
  if (localConfig) {
21
- const projects = localConfig.projects ? [localConfig, ...localConfig.projects] : [localConfig];
22
- const patterns = projects.flatMap(config => toEntryPatterns(config.testMatch, cwd, configFilePath, config));
23
- if (patterns.length > 0)
24
- return patterns;
34
+ return findPlaywrightDependenciesFromConfig({ cwd, configFilePath, config: localConfig, defaultPatterns });
25
35
  }
26
- return (config?.entry ?? ENTRY_FILE_PATTERNS).map(toEntryPattern);
36
+ return defaultPatterns;
27
37
  };
28
38
  export const findDependencies = timerify(findPlaywrightDependencies);
@@ -1,7 +1,7 @@
1
1
  import { timerify } from '../../util/Performance.js';
2
2
  import { hasDependency, load } from '../../util/plugin.js';
3
3
  import { toEntryPattern } from '../../util/protocols.js';
4
- import { toEntryPatterns } from '../playwright/index.js';
4
+ import { findPlaywrightDependenciesFromConfig } from '../playwright/index.js';
5
5
  export const NAME = 'Playwright for components';
6
6
  export const ENABLERS = [/^@playwright\/experimental-ct-/];
7
7
  export const isEnabled = ({ dependencies }) => hasDependency(dependencies, ENABLERS);
@@ -10,12 +10,10 @@ export const ENTRY_FILE_PATTERNS = ['**/*.@(spec|test).?(c|m)[jt]s?(x)'];
10
10
  const findPlaywrightCTDependencies = async (configFilePath, options) => {
11
11
  const { cwd, config } = options;
12
12
  const localConfig = await load(configFilePath);
13
+ const defaultPatterns = (config?.entry ?? ENTRY_FILE_PATTERNS).map(toEntryPattern);
13
14
  if (localConfig) {
14
- const projects = localConfig.projects ? [localConfig, ...localConfig.projects] : [localConfig];
15
- const patterns = projects.flatMap(config => toEntryPatterns(config.testMatch, cwd, configFilePath, config));
16
- if (patterns.length > 0)
17
- return patterns;
15
+ return findPlaywrightDependenciesFromConfig({ config: localConfig, cwd, configFilePath, defaultPatterns });
18
16
  }
19
- return (config?.entry ?? ENTRY_FILE_PATTERNS).map(toEntryPattern);
17
+ return defaultPatterns;
20
18
  };
21
19
  export const findDependencies = timerify(findPlaywrightCTDependencies);
@@ -0,0 +1,9 @@
1
+ import type { IsPluginEnabledCallback, GenericPluginCallback } from '../../types/plugins.js';
2
+ export declare const NAME = "Vue";
3
+ export declare const ENABLERS: string[];
4
+ export declare const isEnabled: IsPluginEnabledCallback;
5
+ export declare const CONFIG_FILE_PATTERNS: string[];
6
+ export declare const ENTRY_FILE_PATTERNS: never[];
7
+ export declare const PRODUCTION_ENTRY_FILE_PATTERNS: never[];
8
+ export declare const PROJECT_FILE_PATTERNS: never[];
9
+ export declare const findDependencies: GenericPluginCallback;
@@ -0,0 +1,44 @@
1
+ import { timerify } from '../../util/Performance.js';
2
+ import { hasDependency, load } from '../../util/plugin.js';
3
+ import { toEntryPattern, toProductionEntryPattern } from '../../util/protocols.js';
4
+ import { findWebpackDependenciesFromConfig } from '../webpack/index.js';
5
+ export const NAME = 'Vue';
6
+ export const ENABLERS = ['vue'];
7
+ export const isEnabled = ({ dependencies }) => hasDependency(dependencies, ENABLERS);
8
+ export const CONFIG_FILE_PATTERNS = ['vue.config.{js,ts}'];
9
+ export const ENTRY_FILE_PATTERNS = [];
10
+ export const PRODUCTION_ENTRY_FILE_PATTERNS = [];
11
+ export const PROJECT_FILE_PATTERNS = [];
12
+ const findPluginDependencies = async (configFilePath, options) => {
13
+ const { config, isProduction, cwd, manifest } = options;
14
+ const localConfig = await load(configFilePath);
15
+ const deps = config.entry
16
+ ? config.entry.map(toProductionEntryPattern)
17
+ : [...ENTRY_FILE_PATTERNS.map(toEntryPattern), ...PRODUCTION_ENTRY_FILE_PATTERNS.map(toProductionEntryPattern)];
18
+ if (isProduction || !localConfig)
19
+ return deps;
20
+ if (localConfig.configureWebpack) {
21
+ const baseConfig = {
22
+ mode: 'development',
23
+ entry: {},
24
+ resolve: {},
25
+ plugins: [],
26
+ module: { rules: [] },
27
+ };
28
+ const modifiedConfig = typeof localConfig.configureWebpack === 'function'
29
+ ? localConfig.configureWebpack(baseConfig)
30
+ : localConfig.configureWebpack;
31
+ const { dependencies } = await findWebpackDependenciesFromConfig({
32
+ config: modifiedConfig ?? baseConfig,
33
+ cwd,
34
+ });
35
+ dependencies.forEach(dependency => deps.push(dependency));
36
+ }
37
+ if (!isProduction &&
38
+ manifest.scripts &&
39
+ Object.values(manifest.scripts).some(script => /(?<=^|\s)vue-cli-service(\s|\s.+\s)lint(?=\s|$)/.test(script))) {
40
+ deps.push('@vue/cli-plugin-eslint');
41
+ }
42
+ return deps;
43
+ };
44
+ export const findDependencies = timerify(findPluginDependencies);
@@ -0,0 +1,5 @@
1
+ import type { Configuration } from 'webpack';
2
+ export type VueConfig = {
3
+ configureWebpack?: Configuration | ((config: Configuration) => Configuration | void);
4
+ };
5
+ export type { Configuration as WebpackConfiguration };
@@ -0,0 +1 @@
1
+ export {};
@@ -1,6 +1,14 @@
1
+ import type { WebpackConfig } from './types.js';
1
2
  import type { IsPluginEnabledCallback, GenericPluginCallback } from '../../types/plugins.js';
2
3
  export declare const NAME = "Webpack";
3
4
  export declare const ENABLERS: string[];
4
5
  export declare const isEnabled: IsPluginEnabledCallback;
5
6
  export declare const CONFIG_FILE_PATTERNS: string[];
7
+ export declare const findWebpackDependenciesFromConfig: ({ config, cwd }: {
8
+ config: WebpackConfig;
9
+ cwd: string;
10
+ }) => Promise<{
11
+ dependencies: Set<string>;
12
+ entryPatterns: Set<string>;
13
+ }>;
6
14
  export declare const findDependencies: GenericPluginCallback;
@@ -44,18 +44,14 @@ const resolveUseItem = (use) => {
44
44
  return [use.loader];
45
45
  return [];
46
46
  };
47
- const findWebpackDependencies = async (configFilePath, options) => {
48
- const { manifest, isProduction, cwd } = options;
49
- const localConfig = await load(configFilePath);
50
- if (!localConfig)
51
- return [];
52
- const passes = typeof localConfig === 'function' ? [false, true] : [false];
47
+ export const findWebpackDependenciesFromConfig = async ({ config, cwd }) => {
48
+ const passes = typeof config === 'function' ? [false, true] : [false];
53
49
  const dependencies = new Set();
54
50
  const entryPatterns = new Set();
55
51
  for (const isProduction of passes) {
56
52
  const env = { production: isProduction };
57
53
  const argv = { mode: isProduction ? 'production' : 'development' };
58
- const resolvedConfig = typeof localConfig === 'function' ? await localConfig(env, argv) : localConfig;
54
+ const resolvedConfig = typeof config === 'function' ? await config(env, argv) : config;
59
55
  for (const options of [resolvedConfig].flat()) {
60
56
  const entries = [];
61
57
  for (const loader of options.module?.rules?.flatMap(resolveRuleSetDependencies) ?? []) {
@@ -84,6 +80,14 @@ const findWebpackDependencies = async (configFilePath, options) => {
84
80
  });
85
81
  }
86
82
  }
83
+ return { dependencies, entryPatterns };
84
+ };
85
+ const findWebpackDependencies = async (configFilePath, options) => {
86
+ const { manifest, isProduction, cwd } = options;
87
+ const localConfig = await load(configFilePath);
88
+ if (!localConfig)
89
+ return [];
90
+ const { dependencies, entryPatterns } = await findWebpackDependenciesFromConfig({ config: localConfig, cwd });
87
91
  if (isProduction)
88
92
  return [...entryPatterns];
89
93
  const scripts = Object.values(manifest.scripts ?? {});
@@ -3,5 +3,6 @@ declare const _default: {
3
3
  compact: ({ report, issues, isShowProgress }: import("../index.js").ReporterOptions) => void;
4
4
  codeowners: ({ report, issues, isShowProgress, options }: import("../index.js").ReporterOptions) => void;
5
5
  json: ({ report, issues, options }: import("../index.js").ReporterOptions) => Promise<void>;
6
+ markdown: ({ report, issues }: import("../index.js").ReporterOptions) => void;
6
7
  };
7
8
  export default _default;
@@ -1,10 +1,12 @@
1
1
  import codeowners from './codeowners.js';
2
2
  import compact from './compact.js';
3
3
  import json from './json.js';
4
+ import markdown from './markdown.js';
4
5
  import symbols from './symbols.js';
5
6
  export default {
6
7
  symbols,
7
8
  compact,
8
9
  codeowners,
9
10
  json,
11
+ markdown,
10
12
  };
@@ -0,0 +1,3 @@
1
+ import type { ReporterOptions } from '../types/issues.js';
2
+ declare const _default: ({ report, issues }: ReporterOptions) => void;
3
+ export default _default;
@@ -0,0 +1,33 @@
1
+ import { relative, toRelative } from '../util/path.js';
2
+ import { getTitle } from './util.js';
3
+ export default ({ report, issues }) => {
4
+ console.log('# Knip report\n');
5
+ for (const [reportType, isReportType] of Object.entries(report)) {
6
+ if (isReportType) {
7
+ const title = getTitle(reportType);
8
+ const isSet = issues[reportType] instanceof Set;
9
+ const issuesForType = isSet
10
+ ? Array.from(issues[reportType])
11
+ : Object.values(issues[reportType]).map(Object.values).flat();
12
+ if (issuesForType.length > 0) {
13
+ console.log(`## ${title} (${issuesForType.length})\n`);
14
+ if (isSet) {
15
+ issuesForType.sort().forEach((issue) => {
16
+ console.log(`* ${toRelative(issue)}`);
17
+ });
18
+ }
19
+ else {
20
+ const longestSymbol = issuesForType.sort((a, b) => b.symbol.length - a.symbol.length)[0].symbol.length;
21
+ const longestFilePath = relative(issuesForType.sort((a, b) => relative(b.filePath).length - relative(a.filePath).length)[0].filePath).length;
22
+ const sortedByFilePath = issuesForType.sort((a, b) => (a.filePath > b.filePath ? 1 : -1));
23
+ console.log(`| ${`Name`.padEnd(longestSymbol)} | ${`Location`.padEnd(longestFilePath)} |`);
24
+ console.log(`|:${'-'.repeat(longestSymbol + 1)}|:${'-'.repeat(longestFilePath + 1)}|`);
25
+ sortedByFilePath.forEach((issue) => {
26
+ console.log(`| ${issue.symbol.padEnd(longestSymbol)} | ${relative(issue.filePath).padEnd(longestFilePath)} |`);
27
+ });
28
+ }
29
+ console.log('');
30
+ }
31
+ }
32
+ }
33
+ };
@@ -24,6 +24,11 @@ export declare const partitionCompilers: (rawLocalConfig: RawConfiguration) => {
24
24
  ignoreBinaries?: (string | RegExp)[] | undefined;
25
25
  ignoreDependencies?: (string | RegExp)[] | undefined;
26
26
  includeEntryExports?: boolean | undefined;
27
+ vue?: string | boolean | string[] | {
28
+ config?: string | string[] | undefined;
29
+ entry?: string | string[] | undefined;
30
+ project?: string | string[] | undefined;
31
+ } | undefined;
27
32
  astro?: string | boolean | string[] | {
28
33
  config?: string | string[] | undefined;
29
34
  entry?: string | string[] | undefined;
@@ -265,6 +270,11 @@ export declare const partitionCompilers: (rawLocalConfig: RawConfiguration) => {
265
270
  project?: string | string[] | undefined;
266
271
  } | undefined;
267
272
  }> | undefined;
273
+ vue?: string | boolean | string[] | {
274
+ config?: string | string[] | undefined;
275
+ entry?: string | string[] | undefined;
276
+ project?: string | string[] | undefined;
277
+ } | undefined;
268
278
  astro?: string | boolean | string[] | {
269
279
  config?: string | string[] | undefined;
270
280
  entry?: string | string[] | undefined;
package/dist/version.d.ts CHANGED
@@ -1 +1 @@
1
- export declare const version = "3.10.0";
1
+ export declare const version = "3.12.0";
package/dist/version.js CHANGED
@@ -1 +1 @@
1
- export const version = '3.10.0';
1
+ export const version = '3.12.0';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "knip",
3
- "version": "3.10.0",
3
+ "version": "3.12.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": {
package/schema.json CHANGED
@@ -422,6 +422,10 @@
422
422
  "title": "vitest plugin configuration (https://github.com/webpro/knip/blob/main/src/plugins/vitest/README.md)",
423
423
  "$ref": "#/definitions/plugin"
424
424
  },
425
+ "vue": {
426
+ "title": "vue plugin configuration (https://github.com/webpro/knip/blob/main/src/plugins/vue/README.md)",
427
+ "$ref": "#/definitions/plugin"
428
+ },
425
429
  "webpack": {
426
430
  "title": "Webpack plugin configuration (https://github.com/webpro/knip/blob/main/src/plugins/webpack/README.md)",
427
431
  "$ref": "#/definitions/plugin"