knip 5.54.1 → 5.55.1

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 (40) hide show
  1. package/dist/ConfigurationChief.d.ts +1 -0
  2. package/dist/ConsoleStreamer.d.ts +1 -1
  3. package/dist/ConsoleStreamer.js +2 -2
  4. package/dist/compilers/index.d.ts +10 -0
  5. package/dist/constants.js +1 -0
  6. package/dist/graph/analyze.js +1 -1
  7. package/dist/graph/build.js +3 -3
  8. package/dist/index.js +1 -1
  9. package/dist/plugins/astro/index.d.ts +2 -1
  10. package/dist/plugins/astro/index.js +15 -1
  11. package/dist/plugins/astro/resolveFromAST.d.ts +2 -0
  12. package/dist/plugins/astro/resolveFromAST.js +25 -0
  13. package/dist/plugins/index.d.ts +13 -0
  14. package/dist/plugins/index.js +2 -0
  15. package/dist/plugins/prisma/index.d.ts +14 -0
  16. package/dist/plugins/prisma/index.js +23 -0
  17. package/dist/plugins/prisma/types.d.ts +3 -0
  18. package/dist/plugins/prisma/types.js +1 -0
  19. package/dist/plugins/vite/helpers.d.ts +2 -0
  20. package/dist/plugins/vite/helpers.js +76 -0
  21. package/dist/plugins/vite/index.d.ts +2 -1
  22. package/dist/plugins/vite/index.js +7 -0
  23. package/dist/plugins/vitest/index.js +1 -1
  24. package/dist/plugins/webpack/index.js +19 -10
  25. package/dist/reporters/symbols.js +3 -8
  26. package/dist/schema/configuration.d.ts +56 -0
  27. package/dist/schema/plugins.d.ts +23 -0
  28. package/dist/schema/plugins.js +1 -0
  29. package/dist/types/PluginNames.d.ts +2 -2
  30. package/dist/types/PluginNames.js +1 -0
  31. package/dist/util/get-referenced-inputs.js +2 -3
  32. package/dist/util/input.d.ts +1 -1
  33. package/dist/util/input.js +2 -2
  34. package/dist/util/string.d.ts +1 -1
  35. package/dist/util/string.js +58 -7
  36. package/dist/util/table.js +4 -1
  37. package/dist/version.d.ts +1 -1
  38. package/dist/version.js +1 -1
  39. package/package.json +4 -3
  40. package/schema.json +4 -0
@@ -131,6 +131,7 @@ export declare class ConfigurationChief {
131
131
  postcss?: (boolean | import("./types/config.js").EnsuredPluginConfiguration) | undefined;
132
132
  preconstruct?: (boolean | import("./types/config.js").EnsuredPluginConfiguration) | undefined;
133
133
  prettier?: (boolean | import("./types/config.js").EnsuredPluginConfiguration) | undefined;
134
+ prisma?: (boolean | import("./types/config.js").EnsuredPluginConfiguration) | undefined;
134
135
  "react-cosmos"?: (boolean | import("./types/config.js").EnsuredPluginConfiguration) | undefined;
135
136
  "react-router"?: (boolean | import("./types/config.js").EnsuredPluginConfiguration) | undefined;
136
137
  relay?: (boolean | import("./types/config.js").EnsuredPluginConfiguration) | undefined;
@@ -7,6 +7,6 @@ export declare class ConsoleStreamer {
7
7
  private clearLines;
8
8
  private resetLines;
9
9
  private update;
10
- cast(message: string | string[]): void;
10
+ cast(message: string | string[], sub?: string): void;
11
11
  clear(): void;
12
12
  }
@@ -21,13 +21,13 @@ export class ConsoleStreamer {
21
21
  process.stdout.write(`${messages.join('\n')}\n`);
22
22
  this.lines = messages.length;
23
23
  }
24
- cast(message) {
24
+ cast(message, sub) {
25
25
  if (!this.isEnabled)
26
26
  return;
27
27
  if (Array.isArray(message))
28
28
  this.update(message);
29
29
  else
30
- this.update([message]);
30
+ this.update([`${message}${!sub || sub === '.' ? '' : ` (${sub})`}…`]);
31
31
  }
32
32
  clear() {
33
33
  if (!this.isEnabled)
@@ -304,6 +304,11 @@ export declare const partitionCompilers: (rawLocalConfig: RawConfiguration) => {
304
304
  entry?: string | string[] | undefined;
305
305
  project?: string | string[] | undefined;
306
306
  } | undefined;
307
+ prisma?: string | boolean | string[] | {
308
+ config?: string | string[] | undefined;
309
+ entry?: string | string[] | undefined;
310
+ project?: string | string[] | undefined;
311
+ } | undefined;
307
312
  'react-cosmos'?: string | boolean | string[] | {
308
313
  config?: string | string[] | undefined;
309
314
  entry?: string | string[] | undefined;
@@ -825,6 +830,11 @@ export declare const partitionCompilers: (rawLocalConfig: RawConfiguration) => {
825
830
  entry?: string | string[] | undefined;
826
831
  project?: string | string[] | undefined;
827
832
  } | undefined;
833
+ prisma?: string | boolean | string[] | {
834
+ config?: string | string[] | undefined;
835
+ entry?: string | string[] | undefined;
836
+ project?: string | string[] | undefined;
837
+ } | undefined;
828
838
  'react-cosmos'?: string | boolean | string[] | {
829
839
  config?: string | string[] | undefined;
830
840
  entry?: string | string[] | undefined;
package/dist/constants.js CHANGED
@@ -50,6 +50,7 @@ export const IGNORED_GLOBAL_BINARIES = new Set([
50
50
  'exec',
51
51
  'exit',
52
52
  'expand',
53
+ 'export',
53
54
  'expr',
54
55
  'factor',
55
56
  'false',
@@ -23,7 +23,7 @@ export const analyze = async (options) => {
23
23
  : ignoreExportsUsedInFile));
24
24
  const analyzeGraph = async () => {
25
25
  if (isReportValues || isReportTypes) {
26
- streamer.cast('Connecting the dots...');
26
+ streamer.cast('Connecting the dots');
27
27
  for (const [filePath, file] of graph.entries()) {
28
28
  const exportItems = file.exports;
29
29
  if (!exportItems || exportItems.size === 0)
@@ -29,7 +29,7 @@ export async function build({ cacheLocation, chief, collector, cwd, deputy, fact
29
29
  }
30
30
  for (const workspace of workspaces) {
31
31
  const { name, dir, ancestors, pkgName } = workspace;
32
- streamer.cast(`Analyzing workspace (${name})...`);
32
+ streamer.cast('Analyzing workspace', name);
33
33
  const manifest = chief.getManifestForWorkspace(name);
34
34
  if (!manifest) {
35
35
  continue;
@@ -276,10 +276,10 @@ export async function build({ cacheLocation, chief, collector, cwd, deputy, fact
276
276
  continue;
277
277
  principal.init();
278
278
  if (principal.asyncCompilers.size > 0) {
279
- streamer.cast('Running async compilers...');
279
+ streamer.cast('Running async compilers');
280
280
  await principal.runAsyncCompilers();
281
281
  }
282
- streamer.cast(`Analyzing source files (${toRelative(principal.cwd) || '.'})...`);
282
+ streamer.cast('Analyzing source files', toRelative(principal.cwd));
283
283
  let size = principal.entryPaths.size;
284
284
  let round = 0;
285
285
  do {
package/dist/index.js CHANGED
@@ -18,7 +18,7 @@ export const main = async (unresolvedConfiguration) => {
18
18
  const deputy = new DependencyDeputy({ isProduction, isStrict });
19
19
  const factory = new PrincipalFactory();
20
20
  const streamer = new ConsoleStreamer({ isEnabled: isShowProgress });
21
- streamer.cast('Reading workspace configuration(s)...');
21
+ streamer.cast('Reading workspace configuration');
22
22
  await chief.init();
23
23
  const workspaces = chief.getWorkspaces();
24
24
  const report = chief.getIncludedIssueTypes({
@@ -1,4 +1,4 @@
1
- import type { IsPluginEnabled, Resolve } from '../../types/config.js';
1
+ import type { IsPluginEnabled, Resolve, ResolveFromAST } from '../../types/config.js';
2
2
  export declare const config: string[];
3
3
  declare const _default: {
4
4
  title: string;
@@ -7,6 +7,7 @@ declare const _default: {
7
7
  config: string[];
8
8
  entry: string[];
9
9
  production: string[];
10
+ resolveFromAST: ResolveFromAST;
10
11
  resolve: Resolve;
11
12
  };
12
13
  export default _default;
@@ -1,5 +1,6 @@
1
- import { toDependency } from '../../util/input.js';
1
+ import { toDependency, toEntry, toProductionEntry } from '../../util/input.js';
2
2
  import { hasDependency } from '../../util/plugin.js';
3
+ import { getSrcDir } from './resolveFromAST.js';
3
4
  const title = 'Astro';
4
5
  const enablers = ['astro'];
5
6
  const isEnabled = ({ dependencies }) => hasDependency(dependencies, enablers);
@@ -11,6 +12,18 @@ const production = [
11
12
  'src/middleware.{js,ts}',
12
13
  'src/actions/index.{js,ts}',
13
14
  ];
15
+ const resolveFromAST = sourceFile => {
16
+ const srcDir = getSrcDir(sourceFile);
17
+ return [
18
+ ...[`${srcDir}/content/config.ts`, `${srcDir}/content.config.ts`].map(path => toEntry(path)),
19
+ ...[
20
+ `${srcDir}/pages/**/*.{astro,mdx,js,ts}`,
21
+ `${srcDir}/content/**/*.mdx`,
22
+ `${srcDir}/middleware.{js,ts}`,
23
+ `${srcDir}/actions/index.{js,ts}`,
24
+ ].map(path => toProductionEntry(path)),
25
+ ];
26
+ };
14
27
  const resolve = options => {
15
28
  const { manifest, isProduction } = options;
16
29
  const inputs = [];
@@ -28,5 +41,6 @@ export default {
28
41
  config,
29
42
  entry,
30
43
  production,
44
+ resolveFromAST,
31
45
  resolve,
32
46
  };
@@ -0,0 +1,2 @@
1
+ import ts from 'typescript';
2
+ export declare const getSrcDir: (sourceFile: ts.SourceFile) => string;
@@ -0,0 +1,25 @@
1
+ import ts from 'typescript';
2
+ import { getPropertyValues } from '../../typescript/ast-helpers.js';
3
+ export const getSrcDir = (sourceFile) => {
4
+ const srcDir = 'src';
5
+ function visit(node) {
6
+ if (ts.isObjectLiteralExpression(node)) {
7
+ const values = getPropertyValues(node, 'srcDir');
8
+ if (values.size > 0) {
9
+ return Array.from(values)[0];
10
+ }
11
+ }
12
+ let result;
13
+ ts.forEachChild(node, innerNode => {
14
+ const innerValue = visit(innerNode);
15
+ if (innerValue) {
16
+ result = innerValue;
17
+ return true;
18
+ }
19
+ return false;
20
+ });
21
+ return result;
22
+ }
23
+ const foundValue = visit(sourceFile);
24
+ return foundValue ?? srcDir;
25
+ };
@@ -13,6 +13,7 @@ export declare const Plugins: {
13
13
  config: string[];
14
14
  entry: string[];
15
15
  production: string[];
16
+ resolveFromAST: import("../types/config.js").ResolveFromAST;
16
17
  resolve: import("../types/config.js").Resolve;
17
18
  };
18
19
  ava: {
@@ -479,6 +480,17 @@ export declare const Plugins: {
479
480
  config: string[];
480
481
  resolveConfig: import("../types/config.js").ResolveConfig<import("./prettier/types.js").PrettierConfig>;
481
482
  };
483
+ prisma: {
484
+ title: string;
485
+ enablers: (string | RegExp)[];
486
+ isEnabled: import("../types/config.js").IsPluginEnabled;
487
+ config: string[];
488
+ args: {
489
+ binaries: string[];
490
+ config: boolean;
491
+ };
492
+ resolveConfig: import("../types/config.js").ResolveConfig<import("./prisma/types.js").PrismaConfig>;
493
+ };
482
494
  'react-cosmos': {
483
495
  title: string;
484
496
  enablers: string[];
@@ -740,6 +752,7 @@ export declare const Plugins: {
740
752
  isEnabled: import("../types/config.js").IsPluginEnabled;
741
753
  config: string[];
742
754
  resolveConfig: import("../types/config.js").ResolveConfig<import("./vitest/types.js").ViteConfigOrFn | import("./vitest/types.js").VitestWorkspaceConfig>;
755
+ resolveFromAST: import("../types/config.js").ResolveFromAST;
743
756
  };
744
757
  vitest: {
745
758
  title: string;
@@ -57,6 +57,7 @@ import { default as plop } from './plop/index.js';
57
57
  import { default as postcss } from './postcss/index.js';
58
58
  import { default as preconstruct } from './preconstruct/index.js';
59
59
  import { default as prettier } from './prettier/index.js';
60
+ import { default as prisma } from './prisma/index.js';
60
61
  import { default as reactCosmos } from './react-cosmos/index.js';
61
62
  import { default as reactRouter } from './react-router/index.js';
62
63
  import { default as relay } from './relay/index.js';
@@ -159,6 +160,7 @@ export const Plugins = {
159
160
  postcss,
160
161
  preconstruct,
161
162
  prettier,
163
+ prisma,
162
164
  'react-cosmos': reactCosmos,
163
165
  'react-router': reactRouter,
164
166
  relay,
@@ -0,0 +1,14 @@
1
+ import type { IsPluginEnabled, ResolveConfig } from '../../types/config.js';
2
+ import type { PrismaConfig } from './types.js';
3
+ declare const _default: {
4
+ title: string;
5
+ enablers: (string | RegExp)[];
6
+ isEnabled: IsPluginEnabled;
7
+ config: string[];
8
+ args: {
9
+ binaries: string[];
10
+ config: boolean;
11
+ };
12
+ resolveConfig: ResolveConfig<PrismaConfig>;
13
+ };
14
+ export default _default;
@@ -0,0 +1,23 @@
1
+ import { hasDependency } from '../../util/plugin.js';
2
+ const title = 'Prisma';
3
+ const enablers = ['prisma', /^@prisma\/.*/];
4
+ const isEnabled = ({ dependencies }) => hasDependency(dependencies, enablers);
5
+ const config = ['prisma.config.ts', 'package.json'];
6
+ const resolveConfig = async (config, options) => {
7
+ if (options.configFileName === 'package.json' && config.seed) {
8
+ return options.getInputsFromScripts(config.seed);
9
+ }
10
+ return [];
11
+ };
12
+ const args = {
13
+ binaries: ['prisma'],
14
+ config: true,
15
+ };
16
+ export default {
17
+ title,
18
+ enablers,
19
+ isEnabled,
20
+ config,
21
+ args,
22
+ resolveConfig,
23
+ };
@@ -0,0 +1,3 @@
1
+ export type PrismaConfig = {
2
+ seed?: string;
3
+ };
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,2 @@
1
+ import ts from 'typescript';
2
+ export declare const getReactBabelPlugins: (sourceFile: ts.SourceFile) => string[];
@@ -0,0 +1,76 @@
1
+ import ts from 'typescript';
2
+ import { findDescendants, getDefaultImportName, getImportMap, stripQuotes } from '../../typescript/ast-helpers.js';
3
+ export const getReactBabelPlugins = (sourceFile) => {
4
+ const babelPlugins = [];
5
+ const importMap = getImportMap(sourceFile);
6
+ const reactPluginNames = new Set();
7
+ for (const [importName, importPath] of importMap.entries()) {
8
+ if (importPath.includes('@vitejs/plugin-react')) {
9
+ reactPluginNames.add(importName);
10
+ }
11
+ }
12
+ if (reactPluginNames.size === 0) {
13
+ const defaultImportName = getDefaultImportName(importMap, '@vitejs/plugin-react');
14
+ if (defaultImportName) {
15
+ reactPluginNames.add(defaultImportName);
16
+ }
17
+ else {
18
+ reactPluginNames.add('react');
19
+ }
20
+ }
21
+ const callExpressions = findDescendants(sourceFile, node => ts.isCallExpression(node));
22
+ const defineConfigCall = callExpressions.find(node => ts.isIdentifier(node.expression) && node.expression.text === 'defineConfig');
23
+ if (!defineConfigCall || defineConfigCall.arguments.length === 0) {
24
+ return babelPlugins;
25
+ }
26
+ const configObject = defineConfigCall.arguments[0];
27
+ if (!ts.isObjectLiteralExpression(configObject)) {
28
+ return babelPlugins;
29
+ }
30
+ const pluginsProperty = configObject.properties.find(prop => ts.isPropertyAssignment(prop) && prop.name.getText() === 'plugins');
31
+ if (!pluginsProperty ||
32
+ !ts.isPropertyAssignment(pluginsProperty) ||
33
+ !ts.isArrayLiteralExpression(pluginsProperty.initializer)) {
34
+ return babelPlugins;
35
+ }
36
+ const pluginsArray = pluginsProperty.initializer;
37
+ for (const pluginElement of pluginsArray.elements) {
38
+ let isReactPlugin = false;
39
+ if (ts.isCallExpression(pluginElement)) {
40
+ if (ts.isIdentifier(pluginElement.expression)) {
41
+ isReactPlugin = reactPluginNames.has(pluginElement.expression.text);
42
+ }
43
+ if (isReactPlugin) {
44
+ if (pluginElement.arguments.length === 0 || !ts.isObjectLiteralExpression(pluginElement.arguments[0])) {
45
+ continue;
46
+ }
47
+ const reactConfig = pluginElement.arguments[0];
48
+ const babelProperty = reactConfig.properties.find(prop => ts.isPropertyAssignment(prop) && ts.isIdentifier(prop.name) && prop.name.text === 'babel');
49
+ if (!babelProperty ||
50
+ !ts.isPropertyAssignment(babelProperty) ||
51
+ !ts.isObjectLiteralExpression(babelProperty.initializer)) {
52
+ continue;
53
+ }
54
+ const babelObject = babelProperty.initializer;
55
+ const babelPluginsProperty = babelObject.properties.find(prop => ts.isPropertyAssignment(prop) && ts.isIdentifier(prop.name) && prop.name.text === 'plugins');
56
+ if (!babelPluginsProperty ||
57
+ !ts.isPropertyAssignment(babelPluginsProperty) ||
58
+ !ts.isArrayLiteralExpression(babelPluginsProperty.initializer)) {
59
+ continue;
60
+ }
61
+ const pluginsArray = babelPluginsProperty.initializer;
62
+ for (const element of pluginsArray.elements) {
63
+ if (ts.isStringLiteral(element)) {
64
+ babelPlugins.push(stripQuotes(element.text));
65
+ }
66
+ else if (ts.isArrayLiteralExpression(element) &&
67
+ element.elements.length > 0 &&
68
+ ts.isStringLiteral(element.elements[0])) {
69
+ babelPlugins.push(stripQuotes(element.elements[0].text));
70
+ }
71
+ }
72
+ }
73
+ }
74
+ }
75
+ return babelPlugins;
76
+ };
@@ -1,4 +1,4 @@
1
- import type { IsPluginEnabled } from '../../types/config.js';
1
+ import type { IsPluginEnabled, ResolveFromAST } from '../../types/config.js';
2
2
  export declare const config: string[];
3
3
  declare const _default: {
4
4
  title: string;
@@ -6,5 +6,6 @@ declare const _default: {
6
6
  isEnabled: IsPluginEnabled;
7
7
  config: string[];
8
8
  resolveConfig: import("../../types/config.js").ResolveConfig<import("../vitest/types.js").ViteConfigOrFn | import("../vitest/types.js").VitestWorkspaceConfig>;
9
+ resolveFromAST: ResolveFromAST;
9
10
  };
10
11
  export default _default;
@@ -1,13 +1,20 @@
1
+ import { toDependency } from '../../util/input.js';
1
2
  import { hasDependency } from '../../util/plugin.js';
2
3
  import { resolveConfig } from '../vitest/index.js';
4
+ import { getReactBabelPlugins } from './helpers.js';
3
5
  const title = 'Vite';
4
6
  const enablers = ['vite', 'vitest'];
5
7
  const isEnabled = ({ dependencies }) => hasDependency(dependencies, enablers);
6
8
  export const config = ['vite.config.{js,mjs,ts,cjs,mts,cts}'];
9
+ const resolveFromAST = (sourceFile) => {
10
+ const babelPlugins = getReactBabelPlugins(sourceFile);
11
+ return babelPlugins.map(plugin => toDependency(plugin));
12
+ };
7
13
  export default {
8
14
  title,
9
15
  enablers,
10
16
  isEnabled,
11
17
  config,
12
18
  resolveConfig,
19
+ resolveFromAST,
13
20
  };
@@ -6,7 +6,7 @@ const title = 'Vitest';
6
6
  const enablers = ['vitest'];
7
7
  const isEnabled = ({ dependencies }) => hasDependency(dependencies, enablers);
8
8
  const config = ['vitest.config.{js,mjs,ts,cjs,mts,cts}', 'vitest.{workspace,projects}.{js,mjs,ts,cjs,mts,cts,json}'];
9
- const entry = ['**/*.{bench,test,test-d,spec}.?(c|m)[jt]s?(x)'];
9
+ const entry = ['**/*.{bench,test,test-d,spec}.?(c|m)[jt]s?(x)', '**/__mocks__/**/*.[jt]s?(x)'];
10
10
  const isVitestCoverageCommand = /vitest(.+)--coverage(?:\.enabled(?:=true)?)?/;
11
11
  const hasScriptWithCoverage = (scripts) => scripts
12
12
  ? Object.values(scripts).some(script => {
@@ -13,7 +13,16 @@ const hasBabelOptions = (use) => Boolean(use) &&
13
13
  typeof use.loader === 'string' &&
14
14
  use.loader === 'babel-loader' &&
15
15
  typeof use.options === 'object';
16
- const info = { compiler: '', issuer: '', realResource: '', resource: '', resourceQuery: '' };
16
+ const info = {
17
+ compiler: '',
18
+ issuer: '',
19
+ realResource: '',
20
+ resource: '',
21
+ resourceQuery: '',
22
+ dependency: '',
23
+ descriptionData: {},
24
+ issuerLayer: '',
25
+ };
17
26
  const resolveRuleSetDependencies = (rule) => {
18
27
  if (!rule || typeof rule === 'string')
19
28
  return [];
@@ -48,8 +57,8 @@ const resolveUseItem = (use) => {
48
57
  return [];
49
58
  };
50
59
  export const findWebpackDependenciesFromConfig = async (config, options) => {
51
- const { cwd } = options;
52
- const passes = typeof config === 'function' ? [false, true] : [false];
60
+ const { cwd, isProduction } = options;
61
+ const passes = typeof config === 'function' ? [false, true] : [isProduction];
53
62
  const inputs = new Set();
54
63
  for (const isProduction of passes) {
55
64
  const mode = isProduction ? 'production' : 'development';
@@ -89,16 +98,16 @@ export const findWebpackDependenciesFromConfig = async (config, options) => {
89
98
  }
90
99
  }
91
100
  for (const entry of entries) {
92
- if (!isInternal(entry)) {
93
- inputs.add(toDependency(entry));
94
- }
95
- else {
101
+ if (isInternal(entry)) {
96
102
  const dir = opts.context ? opts.context : cwd;
97
- const input = opts.mode === 'development'
98
- ? toDeferResolveEntry(entry, { dir })
99
- : toDeferResolveProductionEntry(entry, { dir });
103
+ const input = isProduction
104
+ ? toDeferResolveProductionEntry(entry, { dir })
105
+ : toDeferResolveEntry(entry, { dir });
100
106
  inputs.add(input);
101
107
  }
108
+ else {
109
+ inputs.add(toDeferResolve(entry));
110
+ }
102
111
  }
103
112
  if (opts.resolve?.alias) {
104
113
  const addStar = (value) => (value.endsWith('*') ? value : join(value, '*').replace(/\/\*\*$/, '/*'));
@@ -2,25 +2,20 @@ import picocolors from 'picocolors';
2
2
  import { ROOT_WORKSPACE_NAME } from '../constants.js';
3
3
  import { SymbolType } from '../types/issues.js';
4
4
  import { relative, toRelative } from '../util/path.js';
5
- import { truncate } from '../util/string.js';
6
5
  import { Table } from '../util/table.js';
7
6
  import { getTitle, identity, logTitle, logTitleDimmed } from './util.js';
8
7
  const dim = picocolors.gray;
9
8
  const bright = picocolors.whiteBright;
10
- const TRUNCATE_WIDTH = 40;
11
- const truncateStart = (text, width) => (text.length > width ? `...${text.slice(-(width - 3))}` : text);
12
9
  const sortByPos = (a, b) => {
13
10
  const [f, r, c] = a.filePath.value.split(':');
14
11
  const [f2, r2, c2] = b.filePath.value.split(':');
15
12
  return f === f2 ? (Number(r) === Number(r2) ? Number(c) - Number(c2) : Number(r) - Number(r2)) : f.localeCompare(f2);
16
13
  };
17
- const hl = (issue) => {
14
+ const highlightPkg = (issue) => (_) => {
18
15
  if (issue.specifier && issue.specifier !== issue.symbol && issue.specifier.includes(issue.symbol)) {
19
16
  const parts = issue.specifier.split(issue.symbol);
17
+ const left = parts[0];
20
18
  const right = parts.slice(1).join('');
21
- const max = TRUNCATE_WIDTH - issue.symbol.length - right.length;
22
- const part = parts[0];
23
- const left = part.length > 3 ? (max <= 3 ? `...${part.slice(-3)}` : truncateStart(part, max)) : part;
24
19
  return [dim(left), bright(issue.symbol), dim(right)].join('');
25
20
  }
26
21
  return issue.symbol;
@@ -31,7 +26,7 @@ const logIssueRecord = (issues) => {
31
26
  table.newRow();
32
27
  const print = issue.isFixed || issue.severity === 'warn' ? dim : identity;
33
28
  const symbols = issue.symbols;
34
- table.cell('symbol', print(symbols ? truncate(symbols.map(s => s.symbol).join(', '), TRUNCATE_WIDTH) : hl(issue)));
29
+ table.cell('symbol', print(symbols ? symbols.map(s => s.symbol).join(', ') : issue.symbol), highlightPkg(issue));
35
30
  table.cell('parentSymbol', issue.parentSymbol && print(issue.parentSymbol));
36
31
  table.cell('symbolType', issue.symbolType && issue.symbolType !== SymbolType.UNKNOWN && print(issue.symbolType));
37
32
  const pos = issue.line === undefined ? '' : `:${issue.line}${issue.col === undefined ? '' : `:${issue.col}`}`;
@@ -800,6 +800,19 @@ export declare const knipConfigurationSchema: z.ZodObject<{
800
800
  entry?: string | string[] | undefined;
801
801
  project?: string | string[] | undefined;
802
802
  }>]>>;
803
+ prisma: z.ZodOptional<z.ZodUnion<[z.ZodBoolean, z.ZodUnion<[z.ZodString, z.ZodArray<z.ZodString, "many">]>, z.ZodObject<{
804
+ config: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodArray<z.ZodString, "many">]>>;
805
+ entry: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodArray<z.ZodString, "many">]>>;
806
+ project: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodArray<z.ZodString, "many">]>>;
807
+ }, "strip", z.ZodTypeAny, {
808
+ config?: string | string[] | undefined;
809
+ entry?: string | string[] | undefined;
810
+ project?: string | string[] | undefined;
811
+ }, {
812
+ config?: string | string[] | undefined;
813
+ entry?: string | string[] | undefined;
814
+ project?: string | string[] | undefined;
815
+ }>]>>;
803
816
  'react-cosmos': z.ZodOptional<z.ZodUnion<[z.ZodBoolean, z.ZodUnion<[z.ZodString, z.ZodArray<z.ZodString, "many">]>, z.ZodObject<{
804
817
  config: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodArray<z.ZodString, "many">]>>;
805
818
  entry: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodArray<z.ZodString, "many">]>>;
@@ -1644,6 +1657,11 @@ export declare const knipConfigurationSchema: z.ZodObject<{
1644
1657
  entry?: string | string[] | undefined;
1645
1658
  project?: string | string[] | undefined;
1646
1659
  } | undefined;
1660
+ prisma?: string | boolean | string[] | {
1661
+ config?: string | string[] | undefined;
1662
+ entry?: string | string[] | undefined;
1663
+ project?: string | string[] | undefined;
1664
+ } | undefined;
1647
1665
  'react-cosmos'?: string | boolean | string[] | {
1648
1666
  config?: string | string[] | undefined;
1649
1667
  entry?: string | string[] | undefined;
@@ -2159,6 +2177,11 @@ export declare const knipConfigurationSchema: z.ZodObject<{
2159
2177
  entry?: string | string[] | undefined;
2160
2178
  project?: string | string[] | undefined;
2161
2179
  } | undefined;
2180
+ prisma?: string | boolean | string[] | {
2181
+ config?: string | string[] | undefined;
2182
+ entry?: string | string[] | undefined;
2183
+ project?: string | string[] | undefined;
2184
+ } | undefined;
2162
2185
  'react-cosmos'?: string | boolean | string[] | {
2163
2186
  config?: string | string[] | undefined;
2164
2187
  entry?: string | string[] | undefined;
@@ -3145,6 +3168,19 @@ export declare const knipConfigurationSchema: z.ZodObject<{
3145
3168
  entry?: string | string[] | undefined;
3146
3169
  project?: string | string[] | undefined;
3147
3170
  }>]>>;
3171
+ prisma: z.ZodOptional<z.ZodUnion<[z.ZodBoolean, z.ZodUnion<[z.ZodString, z.ZodArray<z.ZodString, "many">]>, z.ZodObject<{
3172
+ config: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodArray<z.ZodString, "many">]>>;
3173
+ entry: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodArray<z.ZodString, "many">]>>;
3174
+ project: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodArray<z.ZodString, "many">]>>;
3175
+ }, "strip", z.ZodTypeAny, {
3176
+ config?: string | string[] | undefined;
3177
+ entry?: string | string[] | undefined;
3178
+ project?: string | string[] | undefined;
3179
+ }, {
3180
+ config?: string | string[] | undefined;
3181
+ entry?: string | string[] | undefined;
3182
+ project?: string | string[] | undefined;
3183
+ }>]>>;
3148
3184
  'react-cosmos': z.ZodOptional<z.ZodUnion<[z.ZodBoolean, z.ZodUnion<[z.ZodString, z.ZodArray<z.ZodString, "many">]>, z.ZodObject<{
3149
3185
  config: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodArray<z.ZodString, "many">]>>;
3150
3186
  entry: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodArray<z.ZodString, "many">]>>;
@@ -3992,6 +4028,11 @@ export declare const knipConfigurationSchema: z.ZodObject<{
3992
4028
  entry?: string | string[] | undefined;
3993
4029
  project?: string | string[] | undefined;
3994
4030
  } | undefined;
4031
+ prisma?: string | boolean | string[] | {
4032
+ config?: string | string[] | undefined;
4033
+ entry?: string | string[] | undefined;
4034
+ project?: string | string[] | undefined;
4035
+ } | undefined;
3995
4036
  'react-cosmos'?: string | boolean | string[] | {
3996
4037
  config?: string | string[] | undefined;
3997
4038
  entry?: string | string[] | undefined;
@@ -4515,6 +4556,11 @@ export declare const knipConfigurationSchema: z.ZodObject<{
4515
4556
  entry?: string | string[] | undefined;
4516
4557
  project?: string | string[] | undefined;
4517
4558
  } | undefined;
4559
+ prisma?: string | boolean | string[] | {
4560
+ config?: string | string[] | undefined;
4561
+ entry?: string | string[] | undefined;
4562
+ project?: string | string[] | undefined;
4563
+ } | undefined;
4518
4564
  'react-cosmos'?: string | boolean | string[] | {
4519
4565
  config?: string | string[] | undefined;
4520
4566
  entry?: string | string[] | undefined;
@@ -5034,6 +5080,11 @@ export declare const knipConfigurationSchema: z.ZodObject<{
5034
5080
  entry?: string | string[] | undefined;
5035
5081
  project?: string | string[] | undefined;
5036
5082
  } | undefined;
5083
+ prisma?: string | boolean | string[] | {
5084
+ config?: string | string[] | undefined;
5085
+ entry?: string | string[] | undefined;
5086
+ project?: string | string[] | undefined;
5087
+ } | undefined;
5037
5088
  'react-cosmos'?: string | boolean | string[] | {
5038
5089
  config?: string | string[] | undefined;
5039
5090
  entry?: string | string[] | undefined;
@@ -5557,6 +5608,11 @@ export declare const knipConfigurationSchema: z.ZodObject<{
5557
5608
  entry?: string | string[] | undefined;
5558
5609
  project?: string | string[] | undefined;
5559
5610
  } | undefined;
5611
+ prisma?: string | boolean | string[] | {
5612
+ config?: string | string[] | undefined;
5613
+ entry?: string | string[] | undefined;
5614
+ project?: string | string[] | undefined;
5615
+ } | undefined;
5560
5616
  'react-cosmos'?: string | boolean | string[] | {
5561
5617
  config?: string | string[] | undefined;
5562
5618
  entry?: string | string[] | undefined;
@@ -781,6 +781,19 @@ export declare const pluginsSchema: z.ZodObject<{
781
781
  entry?: string | string[] | undefined;
782
782
  project?: string | string[] | undefined;
783
783
  }>]>;
784
+ prisma: z.ZodUnion<[z.ZodBoolean, z.ZodUnion<[z.ZodString, z.ZodArray<z.ZodString, "many">]>, z.ZodObject<{
785
+ config: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodArray<z.ZodString, "many">]>>;
786
+ entry: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodArray<z.ZodString, "many">]>>;
787
+ project: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodArray<z.ZodString, "many">]>>;
788
+ }, "strip", z.ZodTypeAny, {
789
+ config?: string | string[] | undefined;
790
+ entry?: string | string[] | undefined;
791
+ project?: string | string[] | undefined;
792
+ }, {
793
+ config?: string | string[] | undefined;
794
+ entry?: string | string[] | undefined;
795
+ project?: string | string[] | undefined;
796
+ }>]>;
784
797
  'react-cosmos': z.ZodUnion<[z.ZodBoolean, z.ZodUnion<[z.ZodString, z.ZodArray<z.ZodString, "many">]>, z.ZodObject<{
785
798
  config: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodArray<z.ZodString, "many">]>>;
786
799
  entry: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodArray<z.ZodString, "many">]>>;
@@ -1623,6 +1636,11 @@ export declare const pluginsSchema: z.ZodObject<{
1623
1636
  entry?: string | string[] | undefined;
1624
1637
  project?: string | string[] | undefined;
1625
1638
  };
1639
+ prisma: string | boolean | string[] | {
1640
+ config?: string | string[] | undefined;
1641
+ entry?: string | string[] | undefined;
1642
+ project?: string | string[] | undefined;
1643
+ };
1626
1644
  'react-cosmos': string | boolean | string[] | {
1627
1645
  config?: string | string[] | undefined;
1628
1646
  entry?: string | string[] | undefined;
@@ -2129,6 +2147,11 @@ export declare const pluginsSchema: z.ZodObject<{
2129
2147
  entry?: string | string[] | undefined;
2130
2148
  project?: string | string[] | undefined;
2131
2149
  };
2150
+ prisma: string | boolean | string[] | {
2151
+ config?: string | string[] | undefined;
2152
+ entry?: string | string[] | undefined;
2153
+ project?: string | string[] | undefined;
2154
+ };
2132
2155
  'react-cosmos': string | boolean | string[] | {
2133
2156
  config?: string | string[] | undefined;
2134
2157
  entry?: string | string[] | undefined;
@@ -69,6 +69,7 @@ export const pluginsSchema = z.object({
69
69
  postcss: pluginSchema,
70
70
  preconstruct: pluginSchema,
71
71
  prettier: pluginSchema,
72
+ prisma: pluginSchema,
72
73
  'react-cosmos': pluginSchema,
73
74
  'react-router': pluginSchema,
74
75
  relay: 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' | '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"];
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' | 'prisma' | '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", "prisma", "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"];
@@ -58,6 +58,7 @@ export const pluginNames = [
58
58
  'postcss',
59
59
  'preconstruct',
60
60
  'prettier',
61
+ 'prisma',
61
62
  'react-cosmos',
62
63
  'react-router',
63
64
  'relay',
@@ -1,7 +1,6 @@
1
1
  import { IGNORED_RUNTIME_DEPENDENCIES } from '../constants.js';
2
2
  import { debugLog } from './debug.js';
3
- import { isDeferResolve, toDebugString } from './input.js';
4
- import { fromBinary, isBinary, isConfig, isDeferResolveEntry, isDependency } from './input.js';
3
+ import { fromBinary, isBinary, isConfig, isDeferResolve, isDeferResolveEntry, isDependency, toDebugString, } from './input.js';
5
4
  import { getPackageNameFromSpecifier } from './modules.js';
6
5
  import { dirname, isAbsolute, isInternal, join } from './path.js';
7
6
  import { _resolveSync } from './resolve.js';
@@ -28,7 +27,7 @@ export const getReferencedInputsHandler = (collector, deputy, chief, isGitIgnore
28
27
  return;
29
28
  }
30
29
  const packageName = getPackageNameFromSpecifier(specifier);
31
- if (packageName) {
30
+ if (packageName && (isDependency(input) || isDeferResolve(input) || isConfig(input))) {
32
31
  const isWorkspace = chief.workspacesByPkgName.has(packageName);
33
32
  const inputWorkspace = getWorkspaceFor(input, chief, workspace);
34
33
  if (inputWorkspace) {
@@ -45,7 +45,7 @@ export declare const toDeferResolveProductionEntry: (specifier: string, options?
45
45
  export declare const isDeferResolveProductionEntry: (input: Input) => boolean;
46
46
  export declare const toDeferResolveEntry: (specifier: string, options?: Options) => Input;
47
47
  export declare const isDeferResolveEntry: (input: Input) => boolean;
48
- export declare const toAlias: (specifier: string, prefixes: string[], options?: Options) => AliasInput;
48
+ export declare const toAlias: (specifier: string, prefix: string | string[], options?: Options) => AliasInput;
49
49
  export declare const isAlias: (input: Input) => input is AliasInput;
50
50
  export declare const toDebugString: (input: Input) => string;
51
51
  export {};
@@ -50,10 +50,10 @@ export const toDeferResolveEntry = (specifier, options = {}) => ({
50
50
  ...options,
51
51
  });
52
52
  export const isDeferResolveEntry = (input) => input.type === 'deferResolveEntry';
53
- export const toAlias = (specifier, prefixes, options = {}) => ({
53
+ export const toAlias = (specifier, prefix, options = {}) => ({
54
54
  type: 'alias',
55
55
  specifier,
56
- prefixes,
56
+ prefixes: Array.isArray(prefix) ? prefix : [prefix],
57
57
  ...options,
58
58
  });
59
59
  export const isAlias = (input) => input.type === 'alias';
@@ -1,4 +1,4 @@
1
1
  export declare const truncate: (text: string, width: number) => string;
2
2
  export declare const truncateStart: (text: string, width: number) => string;
3
- export declare const pad: (value: string, width: number, fillString?: string, align?: "left" | "center" | "right") => string;
3
+ export declare const pad: (text: string, width: number, fillString?: string, align?: "left" | "center" | "right") => string;
4
4
  export declare const prettyMilliseconds: (ms: number) => string;
@@ -1,10 +1,61 @@
1
- export const truncate = (text, width) => text.length > width ? `${text.slice(0, width - 3)}...` : text;
2
- export const truncateStart = (text, width) => text.length > width ? `...${text.slice(-(width - 3))}` : text;
3
- export const pad = (value, width, fillString, align) => align === 'right'
4
- ? value.padStart(width, fillString)
5
- : align === 'center'
6
- ? value.padStart((value.length + width) / 2, fillString).padEnd(width, fillString)
7
- : value.padEnd(width, fillString);
1
+ import { stripVTControlCharacters } from 'node:util';
2
+ const CONTROL_CHARACTERS = /\u001b\[[0-9;]+m/g;
3
+ const ELLIPSIS = '';
4
+ const getTruncatedParts = (input, limit, fromStart) => {
5
+ const parts = [];
6
+ let width = 0;
7
+ let index = 0;
8
+ let truncated = false;
9
+ while (index < input.length) {
10
+ CONTROL_CHARACTERS.lastIndex = index;
11
+ const match = CONTROL_CHARACTERS.exec(input);
12
+ if (match && match.index === index) {
13
+ index = CONTROL_CHARACTERS.lastIndex;
14
+ parts.push(match[0]);
15
+ continue;
16
+ }
17
+ if (fromStart && width >= limit)
18
+ truncated = true;
19
+ else
20
+ parts.push(input[index]);
21
+ width++;
22
+ index++;
23
+ }
24
+ if (fromStart)
25
+ return { parts, truncated };
26
+ let indexRight = 0;
27
+ const toKeep = (value) => value.length > 1 || indexRight++ < limit;
28
+ const _parts = parts.reverse().filter(toKeep);
29
+ return { parts: _parts.reverse(), truncated: indexRight > limit };
30
+ };
31
+ export const truncate = (text, width) => {
32
+ if (stripVTControlCharacters(text).length <= width)
33
+ return text;
34
+ const { parts, truncated } = getTruncatedParts(text, width - ELLIPSIS.length, true);
35
+ if (!truncated)
36
+ return text;
37
+ if (parts.at(-1)?.length === 1)
38
+ return parts.join('') + ELLIPSIS;
39
+ return [...parts.slice(0, -1), ELLIPSIS, parts.at(-1)].join('');
40
+ };
41
+ export const truncateStart = (text, width) => {
42
+ if (stripVTControlCharacters(text).length <= width)
43
+ return text;
44
+ const { parts, truncated } = getTruncatedParts(text, width - ELLIPSIS.length, false);
45
+ if (!truncated)
46
+ return text;
47
+ if (parts[0].length === 1)
48
+ return ELLIPSIS + parts.join('');
49
+ return [parts[0], ELLIPSIS, ...parts.slice(1)].join('');
50
+ };
51
+ export const pad = (text, width, fillString, align) => {
52
+ const escapedWidth = width + (text.length - stripVTControlCharacters(text).length);
53
+ return align === 'right'
54
+ ? text.padStart(escapedWidth, fillString)
55
+ : align === 'center'
56
+ ? text.padStart((text.length + escapedWidth) / 2, fillString).padEnd(escapedWidth, fillString)
57
+ : text.padEnd(escapedWidth, fillString);
58
+ };
8
59
  export const prettyMilliseconds = (ms) => {
9
60
  const seconds = ms / 1000;
10
61
  const minutes = Math.floor(seconds / 60);
@@ -1,3 +1,4 @@
1
+ import { stripVTControlCharacters } from 'node:util';
1
2
  import { pad, truncate, truncateStart } from './string.js';
2
3
  const DEFAULT_MAX_WIDTH = process.stdout.columns || 120;
3
4
  const MIN_TRUNCATED_WIDTH = 4;
@@ -60,7 +61,9 @@ export class Table {
60
61
  this.rows.unshift(headerRow);
61
62
  }
62
63
  const columnWidths = columns.reduce((acc, col) => {
63
- acc[col] = Math.max(...this.rows.map(row => String(row[col]?.formatted || row[col]?.value || '').length));
64
+ acc[col] = Math.max(...this.rows.map(row => row[col]?.formatted
65
+ ? stripVTControlCharacters(row[col].formatted).length
66
+ : String(row[col]?.value || '').length));
64
67
  return acc;
65
68
  }, {});
66
69
  const separatorWidth = (columns.length - 1) * COLUMN_SEPARATOR.length;
package/dist/version.d.ts CHANGED
@@ -1 +1 @@
1
- export declare const version = "5.54.1";
1
+ export declare const version = "5.55.1";
package/dist/version.js CHANGED
@@ -1 +1 @@
1
- export const version = '5.54.1';
1
+ export const version = '5.55.1';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "knip",
3
- "version": "5.54.1",
3
+ "version": "5.55.1",
4
4
  "description": "Find and fix unused dependencies, exports and files in your TypeScript and JavaScript projects",
5
5
  "homepage": "https://knip.dev",
6
6
  "repository": {
@@ -43,8 +43,8 @@
43
43
  "test": "bun test test/*.test.ts test/**/*.test.ts",
44
44
  "test:watch": "bun test test/*.test.ts test/**/*.test.ts --reporter=junit --reporter-outfile=junit.xml || bun test --watch $(grep -o 'name=\"[^\"]*\".*failures=\"[^0]' junit.xml | grep -v 'name=\"bun test\"' | grep -o 'name=\"[^\"]*\"' | cut -d'\"' -f2)",
45
45
  "test:smoke": "bun test test/*.test.ts test/{plugins,util}/*.test.ts",
46
- "test:node": "tsx --test --import ./transform-test.js test/**/*.test.ts test/*.test.ts",
47
- "test:node:smoke": "tsx --test --import ./transform-test.js {test/*.test.ts,test/plugins/*.test.ts,test/util/*.test.ts}",
46
+ "test:node": "glob -c \"tsx --test --import ./transform-test.js\" \"test/**/*.test.ts\"",
47
+ "test:node:smoke": "glob -c \"tsx --test --import ./transform-test.js\" \"test/*.test.ts\" && glob -c \"tsx --test --import ./transform-test.js\" \"test/{plugins,util}/*.test.ts\"",
48
48
  "watch": "npm link && tsc --watch",
49
49
  "prebuild": "npm run generate-plugin-defs && node rmdir.js dist",
50
50
  "build": "tsc",
@@ -89,6 +89,7 @@
89
89
  "@types/webpack": "^5.28.5",
90
90
  "@wdio/types": "^9.5.0",
91
91
  "codeclimate-types": "^0.3.1",
92
+ "glob": "^11.0.2",
92
93
  "release-it": "^19.0.1",
93
94
  "tsx": "^4.19.4",
94
95
  "type-fest": "^4.31.0",
package/schema.json CHANGED
@@ -531,6 +531,10 @@
531
531
  "title": "Prettier plugin configuration (https://knip.dev/reference/plugins/prettier)",
532
532
  "$ref": "#/definitions/plugin"
533
533
  },
534
+ "prisma": {
535
+ "title": "Prisma plugin configuration (https://knip.dev/reference/plugins/prisma)",
536
+ "$ref": "#/definitions/plugin"
537
+ },
534
538
  "react-cosmos": {
535
539
  "title": "react-cosmos plugin configuration (https://knip.dev/reference/plugins/react-cosmos)",
536
540
  "$ref": "#/definitions/plugin"