knip 5.52.0 → 5.54.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.
Files changed (105) hide show
  1. package/dist/ConfigurationChief.d.ts +1 -0
  2. package/dist/IssueFixer.d.ts +1 -1
  3. package/dist/IssueFixer.js +13 -3
  4. package/dist/PrincipalFactory.js +3 -17
  5. package/dist/ProjectPrincipal.d.ts +2 -2
  6. package/dist/ProjectPrincipal.js +14 -3
  7. package/dist/WorkspaceWorker.d.ts +0 -1
  8. package/dist/WorkspaceWorker.js +4 -19
  9. package/dist/cli.js +10 -6
  10. package/dist/compilers/index.d.ts +10 -0
  11. package/dist/graph/build.js +12 -7
  12. package/dist/index.js +15 -4
  13. package/dist/plugins/ava/index.d.ts +1 -2
  14. package/dist/plugins/ava/index.js +2 -7
  15. package/dist/plugins/bun/index.d.ts +2 -2
  16. package/dist/plugins/bun/index.js +2 -2
  17. package/dist/plugins/cucumber/index.d.ts +1 -2
  18. package/dist/plugins/cucumber/index.js +2 -5
  19. package/dist/plugins/cypress/index.d.ts +1 -2
  20. package/dist/plugins/cypress/index.js +6 -9
  21. package/dist/plugins/cypress/types.d.ts +8 -0
  22. package/dist/plugins/eleventy/helpers.d.ts +10 -2
  23. package/dist/plugins/eleventy/index.d.ts +3 -6
  24. package/dist/plugins/eleventy/index.js +11 -16
  25. package/dist/plugins/eleventy/types.d.ts +9 -7
  26. package/dist/plugins/expo/index.d.ts +2 -5
  27. package/dist/plugins/expo/index.js +4 -6
  28. package/dist/plugins/github-action/index.d.ts +2 -2
  29. package/dist/plugins/github-action/index.js +2 -2
  30. package/dist/plugins/index.d.ts +20 -28
  31. package/dist/plugins/index.js +2 -0
  32. package/dist/plugins/jest/index.d.ts +1 -2
  33. package/dist/plugins/jest/index.js +4 -12
  34. package/dist/plugins/karma/index.d.ts +1 -3
  35. package/dist/plugins/karma/index.js +0 -10
  36. package/dist/plugins/ladle/index.d.ts +1 -2
  37. package/dist/plugins/ladle/index.js +4 -7
  38. package/dist/plugins/metro/index.d.ts +2 -3
  39. package/dist/plugins/metro/index.js +17 -14
  40. package/dist/plugins/mocha/index.d.ts +1 -2
  41. package/dist/plugins/mocha/index.js +2 -6
  42. package/dist/plugins/msw/index.d.ts +2 -2
  43. package/dist/plugins/msw/index.js +2 -2
  44. package/dist/plugins/netlify/index.d.ts +1 -2
  45. package/dist/plugins/netlify/index.js +4 -7
  46. package/dist/plugins/node/index.d.ts +2 -2
  47. package/dist/plugins/node/index.js +2 -2
  48. package/dist/plugins/nuxt/index.d.ts +2 -2
  49. package/dist/plugins/nuxt/index.js +2 -2
  50. package/dist/plugins/playwright/index.d.ts +1 -3
  51. package/dist/plugins/playwright/index.js +5 -7
  52. package/dist/plugins/playwright-ct/index.d.ts +0 -1
  53. package/dist/plugins/playwright-ct/index.js +1 -2
  54. package/dist/plugins/postcss/index.js +3 -1
  55. package/dist/plugins/preconstruct/index.d.ts +1 -1
  56. package/dist/plugins/preconstruct/index.js +2 -2
  57. package/dist/plugins/react-cosmos/index.d.ts +1 -2
  58. package/dist/plugins/react-cosmos/index.js +4 -6
  59. package/dist/plugins/react-router/index.d.ts +2 -2
  60. package/dist/plugins/react-router/index.js +2 -2
  61. package/dist/plugins/relay/index.d.ts +2 -2
  62. package/dist/plugins/relay/index.js +2 -2
  63. package/dist/plugins/rspack/index.js +2 -3
  64. package/dist/plugins/size-limit/index.d.ts +2 -1
  65. package/dist/plugins/size-limit/index.js +10 -0
  66. package/dist/plugins/storybook/index.d.ts +1 -2
  67. package/dist/plugins/storybook/index.js +2 -5
  68. package/dist/plugins/svelte/index.d.ts +2 -1
  69. package/dist/plugins/svelte/index.js +7 -0
  70. package/dist/plugins/svgo/index.d.ts +8 -0
  71. package/dist/plugins/svgo/index.js +11 -0
  72. package/dist/plugins/vite/index.d.ts +0 -1
  73. package/dist/plugins/vite/index.js +1 -2
  74. package/dist/plugins/vitest/index.d.ts +1 -3
  75. package/dist/plugins/vitest/index.js +35 -24
  76. package/dist/plugins/vitest/types.d.ts +12 -0
  77. package/dist/plugins/vue/index.js +2 -5
  78. package/dist/plugins/webpack/index.d.ts +1 -5
  79. package/dist/plugins/webpack/index.js +36 -17
  80. package/dist/plugins/wrangler/index.d.ts +2 -2
  81. package/dist/plugins/wrangler/index.js +2 -2
  82. package/dist/plugins.js +1 -1
  83. package/dist/reporters/watch.js +1 -1
  84. package/dist/schema/configuration.d.ts +56 -0
  85. package/dist/schema/plugins.d.ts +23 -0
  86. package/dist/schema/plugins.js +1 -0
  87. package/dist/types/PluginNames.d.ts +2 -2
  88. package/dist/types/PluginNames.js +1 -0
  89. package/dist/types/cli.d.ts +1 -0
  90. package/dist/types/config.d.ts +0 -2
  91. package/dist/types/project.d.ts +0 -1
  92. package/dist/util/Performance.d.ts +25 -7
  93. package/dist/util/Performance.js +70 -34
  94. package/dist/util/cli-arguments.d.ts +4 -1
  95. package/dist/util/cli-arguments.js +7 -1
  96. package/dist/util/glob-core.d.ts +5 -6
  97. package/dist/util/glob-core.js +30 -29
  98. package/dist/util/input.d.ts +7 -1
  99. package/dist/util/input.js +7 -0
  100. package/dist/util/string.d.ts +1 -0
  101. package/dist/util/string.js +10 -0
  102. package/dist/version.d.ts +1 -1
  103. package/dist/version.js +1 -1
  104. package/package.json +2 -2
  105. package/schema.json +4 -0
@@ -1,5 +1,5 @@
1
- import { toDeferResolve, toDependency, toEntry } from '../../util/input.js';
2
- import { join } from '../../util/path.js';
1
+ import { toAlias, toDeferResolve, toDependency, toEntry } from '../../util/input.js';
2
+ import { join, toPosix } from '../../util/path.js';
3
3
  import { hasDependency } from '../../util/plugin.js';
4
4
  import { getEnvPackageName, getExternalReporters } from './helpers.js';
5
5
  const title = 'Vitest';
@@ -14,7 +14,7 @@ const hasScriptWithCoverage = (scripts) => scripts
14
14
  })
15
15
  : false;
16
16
  const findConfigDependencies = (localConfig, options) => {
17
- const { manifest, configFileDir } = options;
17
+ const { manifest, cwd: dir } = options;
18
18
  const testConfig = localConfig.test;
19
19
  if (!testConfig)
20
20
  return [];
@@ -22,7 +22,6 @@ const findConfigDependencies = (localConfig, options) => {
22
22
  const reporters = getExternalReporters(testConfig.reporters);
23
23
  const hasCoverageEnabled = (testConfig.coverage && testConfig.coverage.enabled !== false) || hasScriptWithCoverage(manifest.scripts);
24
24
  const coverage = hasCoverageEnabled ? [`@vitest/coverage-${testConfig.coverage?.provider ?? 'v8'}`] : [];
25
- const dir = join(configFileDir, testConfig.root ?? '.');
26
25
  const setupFiles = [testConfig.setupFiles ?? []].flat().map(specifier => ({ ...toDeferResolve(specifier), dir }));
27
26
  const globalSetup = [testConfig.globalSetup ?? []].flat().map(specifier => ({ ...toDeferResolve(specifier), dir }));
28
27
  const workspaceDependencies = [];
@@ -57,32 +56,45 @@ const getConfigs = async (localConfig) => {
57
56
  }
58
57
  return configs;
59
58
  };
60
- export const resolveEntryPaths = async (localConfig, options) => {
59
+ export const resolveConfig = async (localConfig, options) => {
61
60
  const inputs = new Set();
62
61
  inputs.add(toEntry(join(options.cwd, 'src/vite-env.d.ts')));
63
62
  const configs = await getConfigs(localConfig);
64
- for (const cfg of configs) {
65
- const dir = join(options.configFileDir, cfg.test?.root ?? '.');
66
- if (cfg.test?.include) {
67
- for (const dependency of cfg.test.include)
68
- dependency[0] !== '!' && inputs.add(toEntry(join(dir, dependency)));
63
+ const addStar = (value) => (value.endsWith('*') ? value : join(value, '*').replace(/\/\*\*$/, '/*'));
64
+ const addAliases = (aliasOptions) => {
65
+ for (const [alias, value] of Object.entries(aliasOptions)) {
66
+ if (!value)
67
+ continue;
68
+ const prefixes = [value].flat().map(prefix => {
69
+ if (toPosix(prefix).startsWith(options.cwd))
70
+ return prefix;
71
+ return join(options.cwd, prefix);
72
+ });
73
+ if (alias.length > 1)
74
+ inputs.add(toAlias(alias, prefixes));
75
+ inputs.add(toAlias(addStar(alias), prefixes.map(addStar)));
69
76
  }
70
- else {
71
- for (const dependency of options.config.entry ?? entry)
72
- inputs.add(toEntry(join(dir, dependency)));
73
- }
74
- }
75
- return Array.from(inputs);
76
- };
77
- export const resolveConfig = async (localConfig, options) => {
78
- const inputs = new Set();
79
- const configs = await getConfigs(localConfig);
77
+ };
80
78
  for (const cfg of configs) {
79
+ const dir = join(options.cwd, cfg.test?.root ?? '.');
80
+ if (cfg.test) {
81
+ if (cfg.test?.include) {
82
+ for (const dependency of cfg.test.include)
83
+ dependency[0] !== '!' && inputs.add(toEntry(join(dir, dependency)));
84
+ }
85
+ else {
86
+ for (const dependency of options.config.entry ?? entry)
87
+ inputs.add(toEntry(join(dir, dependency)));
88
+ }
89
+ if (cfg.test.alias)
90
+ addAliases(cfg.test.alias);
91
+ }
92
+ if (cfg.resolve?.alias)
93
+ addAliases(cfg.resolve.alias);
81
94
  for (const dependency of findConfigDependencies(cfg, options))
82
95
  inputs.add(dependency);
83
- const entry = cfg.build?.lib?.entry ?? [];
84
- const dir = join(options.configFileDir, cfg.test?.root ?? '.');
85
- const deps = (typeof entry === 'string' ? [entry] : Object.values(entry))
96
+ const _entry = cfg.build?.lib?.entry ?? [];
97
+ const deps = (typeof _entry === 'string' ? [_entry] : Object.values(_entry))
86
98
  .map(specifier => join(dir, specifier))
87
99
  .map(id => toEntry(id));
88
100
  for (const dependency of deps)
@@ -99,7 +111,6 @@ export default {
99
111
  isEnabled,
100
112
  config,
101
113
  entry,
102
- resolveEntryPaths,
103
114
  resolveConfig,
104
115
  args,
105
116
  };
@@ -1,3 +1,11 @@
1
+ interface Alias {
2
+ find: string | RegExp;
3
+ replacement: string;
4
+ customResolver?: any;
5
+ }
6
+ export type AliasOptions = readonly Alias[] | {
7
+ [find: string]: string;
8
+ };
1
9
  interface VitestConfig {
2
10
  test: {
3
11
  include: string[];
@@ -15,6 +23,7 @@ interface VitestConfig {
15
23
  workspace: never;
16
24
  };
17
25
  })[];
26
+ alias?: AliasOptions;
18
27
  };
19
28
  }
20
29
  export interface ViteConfig extends VitestConfig {
@@ -26,6 +35,9 @@ export interface ViteConfig extends VitestConfig {
26
35
  };
27
36
  };
28
37
  };
38
+ resolve?: {
39
+ alias?: AliasOptions;
40
+ };
29
41
  }
30
42
  export type COMMAND = 'dev' | 'serve' | 'build';
31
43
  export type MODE = 'development' | 'production';
@@ -6,7 +6,7 @@ const enablers = ['vue'];
6
6
  const isEnabled = ({ dependencies }) => hasDependency(dependencies, enablers);
7
7
  const config = ['vue.config.{js,ts}'];
8
8
  const resolveConfig = async (config, options) => {
9
- const { cwd, manifest } = options;
9
+ const { manifest } = options;
10
10
  const inputs = [];
11
11
  if (config.configureWebpack) {
12
12
  const baseConfig = {
@@ -17,10 +17,7 @@ const resolveConfig = async (config, options) => {
17
17
  module: { rules: [] },
18
18
  };
19
19
  const modifiedConfig = typeof config.configureWebpack === 'function' ? config.configureWebpack(baseConfig) : config.configureWebpack;
20
- const inputsFromConfig = await findWebpackDependenciesFromConfig({
21
- config: modifiedConfig ?? baseConfig,
22
- cwd,
23
- });
20
+ const inputsFromConfig = await findWebpackDependenciesFromConfig(modifiedConfig ?? baseConfig, options);
24
21
  for (const input of inputsFromConfig)
25
22
  inputs.push(input);
26
23
  }
@@ -1,10 +1,6 @@
1
1
  import type { IsPluginEnabled, ResolveConfig } from '../../types/config.js';
2
- import { type Input } from '../../util/input.js';
3
2
  import type { WebpackConfig } from './types.js';
4
- export declare const findWebpackDependenciesFromConfig: ({ config, cwd }: {
5
- config: WebpackConfig;
6
- cwd: string;
7
- }) => Promise<Set<Input>>;
3
+ export declare const findWebpackDependenciesFromConfig: ResolveConfig<WebpackConfig>;
8
4
  declare const _default: {
9
5
  title: string;
10
6
  enablers: string[];
@@ -1,6 +1,6 @@
1
1
  import { compact } from '../../util/array.js';
2
- import { toDeferResolve, toDeferResolveEntry, toDeferResolveProductionEntry, toDependency, } from '../../util/input.js';
3
- import { isInternal } from '../../util/path.js';
2
+ import { toAlias, toDeferResolve, toDeferResolveEntry, toDeferResolveProductionEntry, toDependency, } from '../../util/input.js';
3
+ import { isInternal, join, toAbsolute } from '../../util/path.js';
4
4
  import { hasDependency } from '../../util/plugin.js';
5
5
  import { getDependenciesFromConfig } from '../babel/index.js';
6
6
  const title = 'webpack';
@@ -47,7 +47,8 @@ const resolveUseItem = (use) => {
47
47
  return [use.loader];
48
48
  return [];
49
49
  };
50
- export const findWebpackDependenciesFromConfig = async ({ config, cwd }) => {
50
+ export const findWebpackDependenciesFromConfig = async (config, options) => {
51
+ const { cwd } = options;
51
52
  const passes = typeof config === 'function' ? [false, true] : [false];
52
53
  const inputs = new Set();
53
54
  for (const isProduction of passes) {
@@ -55,12 +56,12 @@ export const findWebpackDependenciesFromConfig = async ({ config, cwd }) => {
55
56
  const env = { production: isProduction, mode };
56
57
  const argv = { mode };
57
58
  const resolvedConfig = typeof config === 'function' ? await config(env, argv) : config;
58
- for (const options of [resolvedConfig].flat()) {
59
+ for (const opts of [resolvedConfig].flat()) {
59
60
  const entries = [];
60
- for (const loader of options.module?.rules?.flatMap(resolveRuleSetDependencies) ?? []) {
61
+ for (const loader of opts.module?.rules?.flatMap(resolveRuleSetDependencies) ?? []) {
61
62
  inputs.add(toDeferResolve(loader.replace(/\?.*/, '')));
62
63
  }
63
- for (const plugin of options?.plugins ?? []) {
64
+ for (const plugin of opts?.plugins ?? []) {
64
65
  if (plugin && plugin.constructor.name === 'ProvidePlugin') {
65
66
  const providePluginInstance = plugin;
66
67
  if (providePluginInstance.definitions) {
@@ -71,12 +72,12 @@ export const findWebpackDependenciesFromConfig = async ({ config, cwd }) => {
71
72
  }
72
73
  }
73
74
  }
74
- if (typeof options.entry === 'string')
75
- entries.push(options.entry);
76
- else if (Array.isArray(options.entry))
77
- entries.push(...options.entry);
78
- else if (typeof options.entry === 'object') {
79
- for (const entry of Object.values(options.entry)) {
75
+ if (typeof opts.entry === 'string')
76
+ entries.push(opts.entry);
77
+ else if (Array.isArray(opts.entry))
78
+ entries.push(...opts.entry);
79
+ else if (typeof opts.entry === 'object') {
80
+ for (const entry of Object.values(opts.entry)) {
80
81
  if (typeof entry === 'string')
81
82
  entries.push(entry);
82
83
  else if (Array.isArray(entry))
@@ -92,20 +93,38 @@ export const findWebpackDependenciesFromConfig = async ({ config, cwd }) => {
92
93
  inputs.add(toDependency(entry));
93
94
  }
94
95
  else {
95
- const dir = options.context ? options.context : cwd;
96
- const input = options.mode === 'development'
96
+ const dir = opts.context ? opts.context : cwd;
97
+ const input = opts.mode === 'development'
97
98
  ? toDeferResolveEntry(entry, { dir })
98
99
  : toDeferResolveProductionEntry(entry, { dir });
99
100
  inputs.add(input);
100
101
  }
101
102
  }
103
+ if (opts.resolve?.alias) {
104
+ const addStar = (value) => (value.endsWith('*') ? value : join(value, '*').replace(/\/\*\*$/, '/*'));
105
+ for (const [alias, value] of Object.entries(opts.resolve.alias)) {
106
+ if (!value)
107
+ continue;
108
+ const prefixes = Array.isArray(value) ? value : [value];
109
+ if (alias.endsWith('$')) {
110
+ inputs.add(toAlias(alias.slice(0, -1), prefixes));
111
+ }
112
+ else {
113
+ if (alias.length > 1)
114
+ inputs.add(toAlias(alias, prefixes));
115
+ for (const prefix of prefixes) {
116
+ inputs.add(toAlias(addStar(alias), [addStar(toAbsolute(prefix, options.configFileDir))]));
117
+ }
118
+ }
119
+ }
120
+ }
102
121
  }
103
122
  }
104
- return inputs;
123
+ return Array.from(inputs);
105
124
  };
106
125
  const resolveConfig = async (localConfig, options) => {
107
- const { cwd, manifest } = options;
108
- const inputs = await findWebpackDependenciesFromConfig({ config: localConfig, cwd });
126
+ const { manifest } = options;
127
+ const inputs = await findWebpackDependenciesFromConfig(localConfig, options);
109
128
  const scripts = Object.values(manifest.scripts ?? {});
110
129
  const webpackCLI = scripts.some(script => script && /(?<=^|\s)webpack(?=\s|$)/.test(script)) ? ['webpack-cli'] : [];
111
130
  const webpackDevServer = scripts.some(script => script?.includes('webpack serve')) ? ['webpack-dev-server'] : [];
@@ -1,10 +1,10 @@
1
- import type { IsPluginEnabled, ResolveEntryPaths } from '../../types/config.js';
1
+ import type { IsPluginEnabled, ResolveConfig } from '../../types/config.js';
2
2
  import type { WranglerConfig } from './types.js';
3
3
  declare const _default: {
4
4
  title: string;
5
5
  enablers: string[];
6
6
  isEnabled: IsPluginEnabled;
7
7
  config: string[];
8
- resolveEntryPaths: ResolveEntryPaths<WranglerConfig>;
8
+ resolveConfig: ResolveConfig<WranglerConfig>;
9
9
  };
10
10
  export default _default;
@@ -4,7 +4,7 @@ const title = 'Wrangler';
4
4
  const enablers = ['wrangler'];
5
5
  const isEnabled = ({ dependencies }) => hasDependency(dependencies, enablers);
6
6
  const config = ['wrangler.{json,toml}'];
7
- const resolveEntryPaths = async (config) => {
7
+ const resolveConfig = async (config) => {
8
8
  return (config.main ? [config.main] : []).map(id => toProductionEntry(id));
9
9
  };
10
10
  export default {
@@ -12,5 +12,5 @@ export default {
12
12
  enablers,
13
13
  isEnabled,
14
14
  config,
15
- resolveEntryPaths,
15
+ resolveConfig,
16
16
  };
package/dist/plugins.js CHANGED
@@ -3,7 +3,7 @@ import { timerify } from './util/Performance.js';
3
3
  import parsedArgValues from './util/cli-arguments.js';
4
4
  const PMap = Plugins;
5
5
  const { performance: isEnabled = false } = parsedArgValues;
6
- const timerifyMethods = ['resolve', 'resolveConfig', 'resolveEntryPaths'];
6
+ const timerifyMethods = ['resolve', 'resolveConfig', 'resolveAST'];
7
7
  const PluginEntries = Object.entries(PMap);
8
8
  if (isEnabled) {
9
9
  for (const [, plugin] of PluginEntries) {
@@ -1,7 +1,7 @@
1
1
  import picocolors from 'picocolors';
2
- import prettyMilliseconds from 'pretty-ms';
3
2
  import { perfObserver } from '../util/Performance.js';
4
3
  import { relative } from '../util/path.js';
4
+ import { prettyMilliseconds } from '../util/string.js';
5
5
  import { getTitle } from './util.js';
6
6
  export default ({ report, issues, streamer, startTime, size, isDebug }) => {
7
7
  const reportMultipleGroups = Object.values(report).filter(Boolean).length > 1;
@@ -1047,6 +1047,19 @@ export declare const knipConfigurationSchema: z.ZodObject<z.objectUtil.extendSha
1047
1047
  entry?: string | string[] | undefined;
1048
1048
  project?: string | string[] | undefined;
1049
1049
  }>]>>;
1050
+ svgo: z.ZodOptional<z.ZodUnion<[z.ZodBoolean, z.ZodUnion<[z.ZodString, z.ZodArray<z.ZodString, "many">]>, z.ZodObject<{
1051
+ config: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodArray<z.ZodString, "many">]>>;
1052
+ entry: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodArray<z.ZodString, "many">]>>;
1053
+ project: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodArray<z.ZodString, "many">]>>;
1054
+ }, "strip", z.ZodTypeAny, {
1055
+ config?: string | string[] | undefined;
1056
+ entry?: string | string[] | undefined;
1057
+ project?: string | string[] | undefined;
1058
+ }, {
1059
+ config?: string | string[] | undefined;
1060
+ entry?: string | string[] | undefined;
1061
+ project?: string | string[] | undefined;
1062
+ }>]>>;
1050
1063
  syncpack: z.ZodOptional<z.ZodUnion<[z.ZodBoolean, z.ZodUnion<[z.ZodString, z.ZodArray<z.ZodString, "many">]>, z.ZodObject<{
1051
1064
  config: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodArray<z.ZodString, "many">]>>;
1052
1065
  entry: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodArray<z.ZodString, "many">]>>;
@@ -1726,6 +1739,11 @@ export declare const knipConfigurationSchema: z.ZodObject<z.objectUtil.extendSha
1726
1739
  entry?: string | string[] | undefined;
1727
1740
  project?: string | string[] | undefined;
1728
1741
  } | undefined;
1742
+ svgo?: string | boolean | string[] | {
1743
+ config?: string | string[] | undefined;
1744
+ entry?: string | string[] | undefined;
1745
+ project?: string | string[] | undefined;
1746
+ } | undefined;
1729
1747
  syncpack?: string | boolean | string[] | {
1730
1748
  config?: string | string[] | undefined;
1731
1749
  entry?: string | string[] | undefined;
@@ -2236,6 +2254,11 @@ export declare const knipConfigurationSchema: z.ZodObject<z.objectUtil.extendSha
2236
2254
  entry?: string | string[] | undefined;
2237
2255
  project?: string | string[] | undefined;
2238
2256
  } | undefined;
2257
+ svgo?: string | boolean | string[] | {
2258
+ config?: string | string[] | undefined;
2259
+ entry?: string | string[] | undefined;
2260
+ project?: string | string[] | undefined;
2261
+ } | undefined;
2239
2262
  syncpack?: string | boolean | string[] | {
2240
2263
  config?: string | string[] | undefined;
2241
2264
  entry?: string | string[] | undefined;
@@ -3369,6 +3392,19 @@ export declare const knipConfigurationSchema: z.ZodObject<z.objectUtil.extendSha
3369
3392
  entry?: string | string[] | undefined;
3370
3393
  project?: string | string[] | undefined;
3371
3394
  }>]>>;
3395
+ svgo: z.ZodOptional<z.ZodUnion<[z.ZodBoolean, z.ZodUnion<[z.ZodString, z.ZodArray<z.ZodString, "many">]>, z.ZodObject<{
3396
+ config: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodArray<z.ZodString, "many">]>>;
3397
+ entry: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodArray<z.ZodString, "many">]>>;
3398
+ project: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodArray<z.ZodString, "many">]>>;
3399
+ }, "strip", z.ZodTypeAny, {
3400
+ config?: string | string[] | undefined;
3401
+ entry?: string | string[] | undefined;
3402
+ project?: string | string[] | undefined;
3403
+ }, {
3404
+ config?: string | string[] | undefined;
3405
+ entry?: string | string[] | undefined;
3406
+ project?: string | string[] | undefined;
3407
+ }>]>>;
3372
3408
  syncpack: z.ZodOptional<z.ZodUnion<[z.ZodBoolean, z.ZodUnion<[z.ZodString, z.ZodArray<z.ZodString, "many">]>, z.ZodObject<{
3373
3409
  config: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodArray<z.ZodString, "many">]>>;
3374
3410
  entry: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodArray<z.ZodString, "many">]>>;
@@ -4051,6 +4087,11 @@ export declare const knipConfigurationSchema: z.ZodObject<z.objectUtil.extendSha
4051
4087
  entry?: string | string[] | undefined;
4052
4088
  project?: string | string[] | undefined;
4053
4089
  } | undefined;
4090
+ svgo?: string | boolean | string[] | {
4091
+ config?: string | string[] | undefined;
4092
+ entry?: string | string[] | undefined;
4093
+ project?: string | string[] | undefined;
4094
+ } | undefined;
4054
4095
  syncpack?: string | boolean | string[] | {
4055
4096
  config?: string | string[] | undefined;
4056
4097
  entry?: string | string[] | undefined;
@@ -4569,6 +4610,11 @@ export declare const knipConfigurationSchema: z.ZodObject<z.objectUtil.extendSha
4569
4610
  entry?: string | string[] | undefined;
4570
4611
  project?: string | string[] | undefined;
4571
4612
  } | undefined;
4613
+ svgo?: string | boolean | string[] | {
4614
+ config?: string | string[] | undefined;
4615
+ entry?: string | string[] | undefined;
4616
+ project?: string | string[] | undefined;
4617
+ } | undefined;
4572
4618
  syncpack?: string | boolean | string[] | {
4573
4619
  config?: string | string[] | undefined;
4574
4620
  entry?: string | string[] | undefined;
@@ -5083,6 +5129,11 @@ export declare const knipConfigurationSchema: z.ZodObject<z.objectUtil.extendSha
5083
5129
  entry?: string | string[] | undefined;
5084
5130
  project?: string | string[] | undefined;
5085
5131
  } | undefined;
5132
+ svgo?: string | boolean | string[] | {
5133
+ config?: string | string[] | undefined;
5134
+ entry?: string | string[] | undefined;
5135
+ project?: string | string[] | undefined;
5136
+ } | undefined;
5086
5137
  syncpack?: string | boolean | string[] | {
5087
5138
  config?: string | string[] | undefined;
5088
5139
  entry?: string | string[] | undefined;
@@ -5601,6 +5652,11 @@ export declare const knipConfigurationSchema: z.ZodObject<z.objectUtil.extendSha
5601
5652
  entry?: string | string[] | undefined;
5602
5653
  project?: string | string[] | undefined;
5603
5654
  } | undefined;
5655
+ svgo?: string | boolean | string[] | {
5656
+ config?: string | string[] | undefined;
5657
+ entry?: string | string[] | undefined;
5658
+ project?: string | string[] | undefined;
5659
+ } | undefined;
5604
5660
  syncpack?: string | boolean | string[] | {
5605
5661
  config?: string | string[] | undefined;
5606
5662
  entry?: string | string[] | undefined;
@@ -1028,6 +1028,19 @@ export declare const pluginsSchema: z.ZodObject<{
1028
1028
  entry?: string | string[] | undefined;
1029
1029
  project?: string | string[] | undefined;
1030
1030
  }>]>;
1031
+ svgo: z.ZodUnion<[z.ZodBoolean, z.ZodUnion<[z.ZodString, z.ZodArray<z.ZodString, "many">]>, z.ZodObject<{
1032
+ config: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodArray<z.ZodString, "many">]>>;
1033
+ entry: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodArray<z.ZodString, "many">]>>;
1034
+ project: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodArray<z.ZodString, "many">]>>;
1035
+ }, "strip", z.ZodTypeAny, {
1036
+ config?: string | string[] | undefined;
1037
+ entry?: string | string[] | undefined;
1038
+ project?: string | string[] | undefined;
1039
+ }, {
1040
+ config?: string | string[] | undefined;
1041
+ entry?: string | string[] | undefined;
1042
+ project?: string | string[] | undefined;
1043
+ }>]>;
1031
1044
  syncpack: z.ZodUnion<[z.ZodBoolean, z.ZodUnion<[z.ZodString, z.ZodArray<z.ZodString, "many">]>, z.ZodObject<{
1032
1045
  config: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodArray<z.ZodString, "many">]>>;
1033
1046
  entry: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodArray<z.ZodString, "many">]>>;
@@ -1705,6 +1718,11 @@ export declare const pluginsSchema: z.ZodObject<{
1705
1718
  entry?: string | string[] | undefined;
1706
1719
  project?: string | string[] | undefined;
1707
1720
  };
1721
+ svgo: string | boolean | string[] | {
1722
+ config?: string | string[] | undefined;
1723
+ entry?: string | string[] | undefined;
1724
+ project?: string | string[] | undefined;
1725
+ };
1708
1726
  syncpack: string | boolean | string[] | {
1709
1727
  config?: string | string[] | undefined;
1710
1728
  entry?: string | string[] | undefined;
@@ -2206,6 +2224,11 @@ export declare const pluginsSchema: z.ZodObject<{
2206
2224
  entry?: string | string[] | undefined;
2207
2225
  project?: string | string[] | undefined;
2208
2226
  };
2227
+ svgo: string | boolean | string[] | {
2228
+ config?: string | string[] | undefined;
2229
+ entry?: string | string[] | undefined;
2230
+ project?: string | string[] | undefined;
2231
+ };
2209
2232
  syncpack: string | boolean | string[] | {
2210
2233
  config?: string | string[] | undefined;
2211
2234
  entry?: string | string[] | undefined;
@@ -88,6 +88,7 @@ export const pluginsSchema = z.object({
88
88
  stryker: pluginSchema,
89
89
  stylelint: pluginSchema,
90
90
  svelte: pluginSchema,
91
+ svgo: pluginSchema,
91
92
  syncpack: pluginSchema,
92
93
  tailwind: pluginSchema,
93
94
  travis: pluginSchema,
@@ -1,2 +1,2 @@
1
- export type PluginName = 'angular' | 'astro' | 'ava' | 'babel' | 'bun' | 'c8' | 'capacitor' | 'changesets' | 'commitizen' | 'commitlint' | 'create-typescript-app' | 'cspell' | 'cucumber' | 'cypress' | 'dependency-cruiser' | 'dotenv' | 'drizzle' | 'eleventy' | 'eslint' | 'expo' | 'gatsby' | 'github-action' | 'github-actions' | 'glob' | 'graphql-codegen' | 'husky' | 'i18next-parser' | 'jest' | 'karma' | 'ladle' | 'lefthook' | 'lint-staged' | 'linthtml' | 'lockfile-lint' | 'lost-pixel' | 'markdownlint' | 'metro' | 'mocha' | 'moonrepo' | 'msw' | 'nano-staged' | 'nest' | 'netlify' | 'next' | 'node' | 'nodemon' | 'npm-package-json-lint' | 'nuxt' | 'nx' | 'nyc' | 'oclif' | 'oxlint' | 'playwright' | 'playwright-ct' | 'playwright-test' | 'plop' | 'postcss' | 'preconstruct' | 'prettier' | 'react-cosmos' | 'react-router' | 'relay' | 'release-it' | 'remark' | 'remix' | 'rollup' | 'rsbuild' | 'rspack' | 'semantic-release' | 'sentry' | 'simple-git-hooks' | 'size-limit' | 'sst' | 'starlight' | 'storybook' | 'stryker' | 'stylelint' | 'svelte' | 'syncpack' | 'tailwind' | 'travis' | 'ts-node' | 'tsup' | 'tsx' | 'typedoc' | 'typescript' | 'unbuild' | 'unocss' | 'vercel-og' | 'vike' | 'vite' | 'vitest' | 'vue' | 'webdriver-io' | 'webpack' | 'wireit' | 'wrangler' | 'xo' | 'yarn' | 'yorkie';
2
- export declare const pluginNames: readonly ["angular", "astro", "ava", "babel", "bun", "c8", "capacitor", "changesets", "commitizen", "commitlint", "create-typescript-app", "cspell", "cucumber", "cypress", "dependency-cruiser", "dotenv", "drizzle", "eleventy", "eslint", "expo", "gatsby", "github-action", "github-actions", "glob", "graphql-codegen", "husky", "i18next-parser", "jest", "karma", "ladle", "lefthook", "lint-staged", "linthtml", "lockfile-lint", "lost-pixel", "markdownlint", "metro", "mocha", "moonrepo", "msw", "nano-staged", "nest", "netlify", "next", "node", "nodemon", "npm-package-json-lint", "nuxt", "nx", "nyc", "oclif", "oxlint", "playwright", "playwright-ct", "playwright-test", "plop", "postcss", "preconstruct", "prettier", "react-cosmos", "react-router", "relay", "release-it", "remark", "remix", "rollup", "rsbuild", "rspack", "semantic-release", "sentry", "simple-git-hooks", "size-limit", "sst", "starlight", "storybook", "stryker", "stylelint", "svelte", "syncpack", "tailwind", "travis", "ts-node", "tsup", "tsx", "typedoc", "typescript", "unbuild", "unocss", "vercel-og", "vike", "vite", "vitest", "vue", "webdriver-io", "webpack", "wireit", "wrangler", "xo", "yarn", "yorkie"];
1
+ export type PluginName = 'angular' | 'astro' | 'ava' | 'babel' | 'bun' | 'c8' | 'capacitor' | 'changesets' | 'commitizen' | 'commitlint' | 'create-typescript-app' | 'cspell' | 'cucumber' | 'cypress' | 'dependency-cruiser' | 'dotenv' | 'drizzle' | 'eleventy' | 'eslint' | 'expo' | 'gatsby' | 'github-action' | 'github-actions' | 'glob' | 'graphql-codegen' | 'husky' | 'i18next-parser' | 'jest' | 'karma' | 'ladle' | 'lefthook' | 'lint-staged' | 'linthtml' | 'lockfile-lint' | 'lost-pixel' | 'markdownlint' | 'metro' | 'mocha' | 'moonrepo' | 'msw' | 'nano-staged' | 'nest' | 'netlify' | 'next' | 'node' | 'nodemon' | 'npm-package-json-lint' | 'nuxt' | 'nx' | 'nyc' | 'oclif' | 'oxlint' | 'playwright' | 'playwright-ct' | 'playwright-test' | 'plop' | 'postcss' | 'preconstruct' | 'prettier' | 'react-cosmos' | 'react-router' | 'relay' | 'release-it' | 'remark' | 'remix' | 'rollup' | 'rsbuild' | 'rspack' | 'semantic-release' | 'sentry' | 'simple-git-hooks' | 'size-limit' | 'sst' | 'starlight' | 'storybook' | 'stryker' | 'stylelint' | 'svelte' | 'svgo' | 'syncpack' | 'tailwind' | 'travis' | 'ts-node' | 'tsup' | 'tsx' | 'typedoc' | 'typescript' | 'unbuild' | 'unocss' | 'vercel-og' | 'vike' | 'vite' | 'vitest' | 'vue' | 'webdriver-io' | 'webpack' | 'wireit' | 'wrangler' | 'xo' | 'yarn' | 'yorkie';
2
+ export declare const pluginNames: readonly ["angular", "astro", "ava", "babel", "bun", "c8", "capacitor", "changesets", "commitizen", "commitlint", "create-typescript-app", "cspell", "cucumber", "cypress", "dependency-cruiser", "dotenv", "drizzle", "eleventy", "eslint", "expo", "gatsby", "github-action", "github-actions", "glob", "graphql-codegen", "husky", "i18next-parser", "jest", "karma", "ladle", "lefthook", "lint-staged", "linthtml", "lockfile-lint", "lost-pixel", "markdownlint", "metro", "mocha", "moonrepo", "msw", "nano-staged", "nest", "netlify", "next", "node", "nodemon", "npm-package-json-lint", "nuxt", "nx", "nyc", "oclif", "oxlint", "playwright", "playwright-ct", "playwright-test", "plop", "postcss", "preconstruct", "prettier", "react-cosmos", "react-router", "relay", "release-it", "remark", "remix", "rollup", "rsbuild", "rspack", "semantic-release", "sentry", "simple-git-hooks", "size-limit", "sst", "starlight", "storybook", "stryker", "stylelint", "svelte", "svgo", "syncpack", "tailwind", "travis", "ts-node", "tsup", "tsx", "typedoc", "typescript", "unbuild", "unocss", "vercel-og", "vike", "vite", "vitest", "vue", "webdriver-io", "webpack", "wireit", "wrangler", "xo", "yarn", "yorkie"];
@@ -77,6 +77,7 @@ export const pluginNames = [
77
77
  'stryker',
78
78
  'stylelint',
79
79
  'svelte',
80
+ 'svgo',
80
81
  'syncpack',
81
82
  'tailwind',
82
83
  'travis',
@@ -11,6 +11,7 @@ export interface CommandLineOptions {
11
11
  isExportsShorthand: boolean;
12
12
  isFilesShorthand: boolean;
13
13
  isFix: boolean;
14
+ isFormat: boolean;
14
15
  isDisableConfigHints: boolean;
15
16
  isIncludeEntryExports: boolean;
16
17
  isIncludeLibs: boolean;
@@ -90,7 +90,6 @@ export interface PluginOptions extends BaseOptions {
90
90
  enabledPlugins: string[];
91
91
  getInputsFromScripts: GetInputsFromScriptsPartial;
92
92
  }
93
- export type ResolveEntryPaths<T = any> = (config: T, options: PluginOptions) => Promise<Input[]> | Input[];
94
93
  export type ResolveConfig<T = any> = (config: T, options: PluginOptions) => Promise<Input[]> | Input[];
95
94
  export type Resolve = (options: PluginOptions) => Promise<Input[]> | Input[];
96
95
  export type GetSourceFile = (filePath: string) => ts.SourceFile | undefined;
@@ -110,7 +109,6 @@ export interface Plugin {
110
109
  entry?: string[];
111
110
  production?: string[];
112
111
  project?: string[];
113
- resolveEntryPaths?: ResolveEntryPaths;
114
112
  resolveConfig?: ResolveConfig;
115
113
  resolve?: Resolve;
116
114
  resolveFromAST?: ResolveFromAST;
@@ -6,7 +6,6 @@ export type PrincipalOptions = {
6
6
  cwd: string;
7
7
  isFile: boolean;
8
8
  compilerOptions: ts.CompilerOptions;
9
- paths: Paths;
10
9
  compilers: [SyncCompilers, AsyncCompilers];
11
10
  pkgName: string;
12
11
  isIsolateWorkspaces: boolean;
@@ -1,24 +1,42 @@
1
1
  import { type PerformanceEntry, PerformanceObserver } from 'node:perf_hooks';
2
2
  import { memoryUsage } from 'node:process';
3
3
  export declare const timerify: <T extends (...params: any[]) => any>(fn: T, name?: string) => T;
4
+ type MemInfo = {
5
+ heapUsed: number;
6
+ heapTotal: number;
7
+ freemem: number;
8
+ };
9
+ interface MemoryEntry extends PerformanceEntry {
10
+ detail: MemInfo;
11
+ }
4
12
  declare class Performance {
5
13
  isEnabled: boolean;
14
+ isPerformanceEnabled: boolean;
15
+ isMemoryEnabled: boolean;
6
16
  startTime: number;
7
17
  endTime: number;
8
- entries: PerformanceEntry[];
9
- instanceId?: number;
18
+ perfEntries: PerformanceEntry[];
19
+ memEntries: MemoryEntry[];
20
+ perfId?: string;
21
+ memId?: string;
10
22
  fnObserver?: PerformanceObserver;
11
- gcObserver?: PerformanceObserver;
23
+ memObserver?: PerformanceObserver;
12
24
  memoryUsageStart?: ReturnType<typeof memoryUsage>;
13
- constructor(isEnabled: boolean);
25
+ freeMemoryStart?: number;
26
+ constructor({ isPerformanceEnabled, isMemoryEnabled }: {
27
+ isPerformanceEnabled?: boolean | undefined;
28
+ isMemoryEnabled?: boolean | undefined;
29
+ });
14
30
  private setMark;
15
31
  private clearMark;
16
32
  private flush;
17
- private getEntriesByName;
18
- getTable(): string;
33
+ private getPerfEntriesByName;
34
+ getPerformanceTable(): string;
35
+ addMemoryMark(index: number): void;
36
+ getMemoryTable(): string;
19
37
  getCurrentDurationInMs(startTime?: number): number;
20
38
  getMemHeapUsage(): number;
21
- getCurrentMemUsageInMb(): number;
39
+ getCurrentMemUsageInMb(): any;
22
40
  finalize(): Promise<void>;
23
41
  reset(): void;
24
42
  }