knip 5.54.0 → 5.55.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.
@@ -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;
@@ -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;
@@ -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 => {
@@ -65,7 +65,10 @@ export const resolveConfig = async (localConfig, options) => {
65
65
  for (const [alias, value] of Object.entries(aliasOptions)) {
66
66
  if (!value)
67
67
  continue;
68
- const prefixes = [value].flat().map(prefix => {
68
+ const prefixes = [value]
69
+ .flat()
70
+ .filter(value => typeof value === 'string')
71
+ .map(prefix => {
69
72
  if (toPosix(prefix).startsWith(options.cwd))
70
73
  return prefix;
71
74
  return join(options.cwd, prefix);
@@ -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 [];
@@ -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}`}`;
@@ -1,5 +1,5 @@
1
1
  import { z } from 'zod';
2
- export declare const knipConfigurationSchema: z.ZodObject<z.objectUtil.extendShape<z.objectUtil.extendShape<z.objectUtil.extendShape<{
2
+ export declare const knipConfigurationSchema: z.ZodObject<{
3
3
  $schema: z.ZodOptional<z.ZodString>;
4
4
  rules: z.ZodOptional<z.ZodRecord<z.ZodUnion<[z.ZodLiteral<"files">, z.ZodLiteral<"dependencies">, z.ZodLiteral<"devDependencies">, z.ZodLiteral<"optionalPeerDependencies">, z.ZodLiteral<"unlisted">, z.ZodLiteral<"binaries">, z.ZodLiteral<"unresolved">, z.ZodLiteral<"exports">, z.ZodLiteral<"types">, z.ZodLiteral<"nsExports">, z.ZodLiteral<"nsTypes">, z.ZodLiteral<"duplicates">, z.ZodLiteral<"enumMembers">, z.ZodLiteral<"classMembers">]>, z.ZodEnum<["error", "warn", "off"]>>>;
5
5
  entry: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodArray<z.ZodString, "many">]>>;
@@ -18,11 +18,11 @@ export declare const knipConfigurationSchema: z.ZodObject<z.objectUtil.extendSha
18
18
  asyncCompilers: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodFunction<z.ZodTuple<[z.ZodString, z.ZodString], z.ZodUnknown>, z.ZodPromise<z.ZodString>>>>;
19
19
  tags: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
20
20
  treatConfigHintsAsErrors: z.ZodOptional<z.ZodBoolean>;
21
- }, {
21
+ } & {
22
22
  include: z.ZodOptional<z.ZodArray<z.ZodUnion<[z.ZodLiteral<"files">, z.ZodLiteral<"dependencies">, z.ZodLiteral<"devDependencies">, z.ZodLiteral<"optionalPeerDependencies">, z.ZodLiteral<"unlisted">, z.ZodLiteral<"binaries">, z.ZodLiteral<"unresolved">, z.ZodLiteral<"exports">, z.ZodLiteral<"types">, z.ZodLiteral<"nsExports">, z.ZodLiteral<"nsTypes">, z.ZodLiteral<"duplicates">, z.ZodLiteral<"enumMembers">, z.ZodLiteral<"classMembers">]>, "many">>;
23
23
  exclude: z.ZodOptional<z.ZodArray<z.ZodUnion<[z.ZodLiteral<"files">, z.ZodLiteral<"dependencies">, z.ZodLiteral<"devDependencies">, z.ZodLiteral<"optionalPeerDependencies">, z.ZodLiteral<"unlisted">, z.ZodLiteral<"binaries">, z.ZodLiteral<"unresolved">, z.ZodLiteral<"exports">, z.ZodLiteral<"types">, z.ZodLiteral<"nsExports">, z.ZodLiteral<"nsTypes">, z.ZodLiteral<"duplicates">, z.ZodLiteral<"enumMembers">, z.ZodLiteral<"classMembers">]>, "many">>;
24
- }>, {
25
- workspaces: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<z.objectUtil.extendShape<{
24
+ } & {
25
+ workspaces: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{
26
26
  entry: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodArray<z.ZodString, "many">]>>;
27
27
  project: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodArray<z.ZodString, "many">]>>;
28
28
  paths: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodArray<z.ZodString, "many">>>;
@@ -32,7 +32,7 @@ export declare const knipConfigurationSchema: z.ZodObject<z.objectUtil.extendSha
32
32
  ignoreMembers: z.ZodOptional<z.ZodArray<z.ZodUnion<[z.ZodString, z.ZodType<RegExp, z.ZodTypeDef, RegExp>]>, "many">>;
33
33
  ignoreUnresolved: z.ZodOptional<z.ZodArray<z.ZodUnion<[z.ZodString, z.ZodType<RegExp, z.ZodTypeDef, RegExp>]>, "many">>;
34
34
  includeEntryExports: z.ZodOptional<z.ZodBoolean>;
35
- }, {
35
+ } & {
36
36
  angular: z.ZodOptional<z.ZodUnion<[z.ZodBoolean, z.ZodUnion<[z.ZodString, z.ZodArray<z.ZodString, "many">]>, z.ZodObject<{
37
37
  config: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodArray<z.ZodString, "many">]>>;
38
38
  entry: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodArray<z.ZodString, "many">]>>;
@@ -800,6 +800,19 @@ export declare const knipConfigurationSchema: z.ZodObject<z.objectUtil.extendSha
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">]>>;
@@ -1346,7 +1359,7 @@ export declare const knipConfigurationSchema: z.ZodObject<z.objectUtil.extendSha
1346
1359
  entry?: string | string[] | undefined;
1347
1360
  project?: string | string[] | undefined;
1348
1361
  }>]>>;
1349
- }>, "strip", z.ZodTypeAny, {
1362
+ }, "strip", z.ZodTypeAny, {
1350
1363
  node?: string | boolean | string[] | {
1351
1364
  config?: string | string[] | undefined;
1352
1365
  entry?: string | string[] | undefined;
@@ -1644,6 +1657,11 @@ export declare const knipConfigurationSchema: z.ZodObject<z.objectUtil.extendSha
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<z.objectUtil.extendSha
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;
@@ -2377,7 +2400,7 @@ export declare const knipConfigurationSchema: z.ZodObject<z.objectUtil.extendSha
2377
2400
  ignoreUnresolved?: (string | RegExp)[] | undefined;
2378
2401
  includeEntryExports?: boolean | undefined;
2379
2402
  }>>>;
2380
- }>, {
2403
+ } & {
2381
2404
  angular: z.ZodOptional<z.ZodUnion<[z.ZodBoolean, z.ZodUnion<[z.ZodString, z.ZodArray<z.ZodString, "many">]>, z.ZodObject<{
2382
2405
  config: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodArray<z.ZodString, "many">]>>;
2383
2406
  entry: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodArray<z.ZodString, "many">]>>;
@@ -3145,6 +3168,19 @@ export declare const knipConfigurationSchema: z.ZodObject<z.objectUtil.extendSha
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">]>>;
@@ -3691,7 +3727,7 @@ export declare const knipConfigurationSchema: z.ZodObject<z.objectUtil.extendSha
3691
3727
  entry?: string | string[] | undefined;
3692
3728
  project?: string | string[] | undefined;
3693
3729
  }>]>>;
3694
- }>, "strict", z.ZodTypeAny, {
3730
+ }, "strict", z.ZodTypeAny, {
3695
3731
  exclude?: ("dependencies" | "exports" | "files" | "devDependencies" | "optionalPeerDependencies" | "unlisted" | "binaries" | "unresolved" | "types" | "nsExports" | "nsTypes" | "duplicates" | "enumMembers" | "classMembers")[] | undefined;
3696
3732
  tags?: string[] | undefined;
3697
3733
  include?: ("dependencies" | "exports" | "files" | "devDependencies" | "optionalPeerDependencies" | "unlisted" | "binaries" | "unresolved" | "types" | "nsExports" | "nsTypes" | "duplicates" | "enumMembers" | "classMembers")[] | undefined;
@@ -3992,6 +4028,11 @@ export declare const knipConfigurationSchema: z.ZodObject<z.objectUtil.extendSha
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<z.objectUtil.extendSha
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<z.objectUtil.extendSha
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<z.objectUtil.extendSha
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.0";
1
+ export declare const version = "5.55.0";
package/dist/version.js CHANGED
@@ -1 +1 @@
1
- export const version = '5.54.0';
1
+ export const version = '5.55.0';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "knip",
3
- "version": "5.54.0",
3
+ "version": "5.55.0",
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": {
@@ -42,8 +42,9 @@
42
42
  "format": "biome format --write .",
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
- "test:node": "glob -c \"npx -y tsx --test --import ./transform-test.js\" \"test/**/*.test.ts\"",
46
45
  "test:smoke": "bun test test/*.test.ts test/{plugins,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\"",
47
48
  "watch": "npm link && tsc --watch",
48
49
  "prebuild": "npm run generate-plugin-defs && node rmdir.js dist",
49
50
  "build": "tsc",
@@ -88,8 +89,9 @@
88
89
  "@types/webpack": "^5.28.5",
89
90
  "@wdio/types": "^9.5.0",
90
91
  "codeclimate-types": "^0.3.1",
91
- "glob": "^10.4.2",
92
+ "glob": "^11.0.2",
92
93
  "release-it": "^19.0.1",
94
+ "tsx": "^4.19.4",
93
95
  "type-fest": "^4.31.0",
94
96
  "typescript": "^5.5.2"
95
97
  },
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"