knip 5.52.0 → 5.53.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/ConfigurationChief.d.ts +1 -0
- package/dist/cli.js +8 -5
- package/dist/compilers/index.d.ts +10 -0
- package/dist/graph/build.js +4 -2
- package/dist/plugins/index.d.ts +6 -0
- package/dist/plugins/index.js +2 -0
- package/dist/plugins/svgo/index.d.ts +8 -0
- package/dist/plugins/svgo/index.js +11 -0
- package/dist/reporters/watch.js +1 -1
- package/dist/schema/configuration.d.ts +56 -0
- package/dist/schema/plugins.d.ts +23 -0
- package/dist/schema/plugins.js +1 -0
- package/dist/types/PluginNames.d.ts +2 -2
- package/dist/types/PluginNames.js +1 -0
- package/dist/util/Performance.d.ts +25 -7
- package/dist/util/Performance.js +70 -34
- package/dist/util/cli-arguments.d.ts +3 -1
- package/dist/util/cli-arguments.js +5 -1
- package/dist/util/glob-core.js +10 -8
- package/dist/util/string.d.ts +1 -0
- package/dist/util/string.js +10 -0
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/package.json +1 -2
- package/schema.json +4 -0
|
@@ -150,6 +150,7 @@ export declare class ConfigurationChief {
|
|
|
150
150
|
stryker?: (boolean | import("./types/config.js").EnsuredPluginConfiguration) | undefined;
|
|
151
151
|
stylelint?: (boolean | import("./types/config.js").EnsuredPluginConfiguration) | undefined;
|
|
152
152
|
svelte?: (boolean | import("./types/config.js").EnsuredPluginConfiguration) | undefined;
|
|
153
|
+
svgo?: (boolean | import("./types/config.js").EnsuredPluginConfiguration) | undefined;
|
|
153
154
|
syncpack?: (boolean | import("./types/config.js").EnsuredPluginConfiguration) | undefined;
|
|
154
155
|
tailwind?: (boolean | import("./types/config.js").EnsuredPluginConfiguration) | undefined;
|
|
155
156
|
travis?: (boolean | import("./types/config.js").EnsuredPluginConfiguration) | undefined;
|
package/dist/cli.js
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import prettyMilliseconds from 'pretty-ms';
|
|
2
1
|
import { main } from './index.js';
|
|
3
2
|
import { perfObserver } from './util/Performance.js';
|
|
4
3
|
import parsedArgValues, { helpText } from './util/cli-arguments.js';
|
|
@@ -6,6 +5,7 @@ import { getKnownError, isConfigurationError, isDisplayReason, isKnownError } fr
|
|
|
6
5
|
import { logError, logWarning } from './util/log.js';
|
|
7
6
|
import { cwd, join, toPosix } from './util/path.js';
|
|
8
7
|
import { runPreprocessors, runReporters } from './util/reporter.js';
|
|
8
|
+
import { prettyMilliseconds } from './util/string.js';
|
|
9
9
|
import { splitTags } from './util/tag.js';
|
|
10
10
|
import { isTrace } from './util/trace.js';
|
|
11
11
|
import { version } from './version.js';
|
|
@@ -70,12 +70,15 @@ const run = async () => {
|
|
|
70
70
|
const totalErrorCount = Object.keys(finalData.report)
|
|
71
71
|
.filter(reportGroup => finalData.report[reportGroup] && rules[reportGroup] === 'error')
|
|
72
72
|
.reduce((errorCount, reportGroup) => errorCount + finalData.counters[reportGroup], 0);
|
|
73
|
-
if (perfObserver.isEnabled)
|
|
73
|
+
if (perfObserver.isEnabled)
|
|
74
74
|
await perfObserver.finalize();
|
|
75
|
-
|
|
76
|
-
|
|
75
|
+
if (perfObserver.isPerformanceEnabled)
|
|
76
|
+
console.log(`\n${perfObserver.getPerformanceTable()}`);
|
|
77
|
+
if (perfObserver.isMemoryEnabled)
|
|
78
|
+
console.log(`\n${perfObserver.getMemoryTable()}`);
|
|
79
|
+
if (perfObserver.isEnabled) {
|
|
77
80
|
const duration = perfObserver.getCurrentDurationInMs();
|
|
78
|
-
console.log('\nTotal running time:', prettyMilliseconds(duration)
|
|
81
|
+
console.log('\nTotal running time:', prettyMilliseconds(duration));
|
|
79
82
|
perfObserver.reset();
|
|
80
83
|
}
|
|
81
84
|
if (experimentalTags.length > 0) {
|
|
@@ -399,6 +399,11 @@ export declare const partitionCompilers: (rawLocalConfig: RawConfiguration) => {
|
|
|
399
399
|
entry?: string | string[] | undefined;
|
|
400
400
|
project?: string | string[] | undefined;
|
|
401
401
|
} | undefined;
|
|
402
|
+
svgo?: string | boolean | string[] | {
|
|
403
|
+
config?: string | string[] | undefined;
|
|
404
|
+
entry?: string | string[] | undefined;
|
|
405
|
+
project?: string | string[] | undefined;
|
|
406
|
+
} | undefined;
|
|
402
407
|
syncpack?: string | boolean | string[] | {
|
|
403
408
|
config?: string | string[] | undefined;
|
|
404
409
|
entry?: string | string[] | undefined;
|
|
@@ -915,6 +920,11 @@ export declare const partitionCompilers: (rawLocalConfig: RawConfiguration) => {
|
|
|
915
920
|
entry?: string | string[] | undefined;
|
|
916
921
|
project?: string | string[] | undefined;
|
|
917
922
|
} | undefined;
|
|
923
|
+
svgo?: string | boolean | string[] | {
|
|
924
|
+
config?: string | string[] | undefined;
|
|
925
|
+
entry?: string | string[] | undefined;
|
|
926
|
+
project?: string | string[] | undefined;
|
|
927
|
+
} | undefined;
|
|
918
928
|
syncpack?: string | boolean | string[] | {
|
|
919
929
|
config?: string | string[] | undefined;
|
|
920
930
|
entry?: string | string[] | undefined;
|
package/dist/graph/build.js
CHANGED
|
@@ -2,6 +2,7 @@ import { WorkspaceWorker } from '../WorkspaceWorker.js';
|
|
|
2
2
|
import { _getInputsFromScripts } from '../binaries/index.js';
|
|
3
3
|
import { getCompilerExtensions, getIncludedCompilers } from '../compilers/index.js';
|
|
4
4
|
import { DEFAULT_EXTENSIONS } from '../constants.js';
|
|
5
|
+
import { perfObserver } from '../util/Performance.js';
|
|
5
6
|
import { debugLog, debugLogArray } from '../util/debug.js';
|
|
6
7
|
import { getReferencedInputsHandler } from '../util/get-referenced-inputs.js';
|
|
7
8
|
import { _glob, negate } from '../util/glob.js';
|
|
@@ -291,12 +292,13 @@ export async function build({ cacheLocation, chief, collector, cwd, deputy, fact
|
|
|
291
292
|
for (const filePath of principal.entryPaths)
|
|
292
293
|
entryPaths.add(filePath);
|
|
293
294
|
principal.reconcileCache(graph);
|
|
294
|
-
if (
|
|
295
|
+
if (isIsolateWorkspaces || (isSkipLibs && !isWatch)) {
|
|
295
296
|
factory.deletePrincipal(principal);
|
|
296
297
|
principals[i] = undefined;
|
|
297
298
|
}
|
|
299
|
+
perfObserver.addMemoryMark(factory.principals.size);
|
|
298
300
|
}
|
|
299
|
-
if (isIsolateWorkspaces) {
|
|
301
|
+
if (!isWatch && isSkipLibs && !isIsolateWorkspaces) {
|
|
300
302
|
for (const principal of principals) {
|
|
301
303
|
if (principal)
|
|
302
304
|
factory.deletePrincipal(principal);
|
package/dist/plugins/index.d.ts
CHANGED
|
@@ -635,6 +635,12 @@ export declare const Plugins: {
|
|
|
635
635
|
entry: string[];
|
|
636
636
|
production: string[];
|
|
637
637
|
};
|
|
638
|
+
svgo: {
|
|
639
|
+
title: string;
|
|
640
|
+
enablers: string[];
|
|
641
|
+
isEnabled: import("../types/config.js").IsPluginEnabled;
|
|
642
|
+
entry: string[];
|
|
643
|
+
};
|
|
638
644
|
syncpack: {
|
|
639
645
|
title: string;
|
|
640
646
|
enablers: string[];
|
package/dist/plugins/index.js
CHANGED
|
@@ -76,6 +76,7 @@ import { default as storybook } from './storybook/index.js';
|
|
|
76
76
|
import { default as stryker } from './stryker/index.js';
|
|
77
77
|
import { default as stylelint } from './stylelint/index.js';
|
|
78
78
|
import { default as svelte } from './svelte/index.js';
|
|
79
|
+
import { default as svgo } from './svgo/index.js';
|
|
79
80
|
import { default as syncpack } from './syncpack/index.js';
|
|
80
81
|
import { default as tailwind } from './tailwind/index.js';
|
|
81
82
|
import { default as travis } from './travis/index.js';
|
|
@@ -177,6 +178,7 @@ export const Plugins = {
|
|
|
177
178
|
stryker,
|
|
178
179
|
stylelint,
|
|
179
180
|
svelte,
|
|
181
|
+
svgo,
|
|
180
182
|
syncpack,
|
|
181
183
|
tailwind,
|
|
182
184
|
travis,
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { hasDependency } from '../../util/plugin.js';
|
|
2
|
+
const title = 'SVGO';
|
|
3
|
+
const enablers = ['svgo'];
|
|
4
|
+
const isEnabled = ({ dependencies }) => hasDependency(dependencies, enablers);
|
|
5
|
+
const entry = ['svgo.config.{js,cjs,mjs}'];
|
|
6
|
+
export default {
|
|
7
|
+
title,
|
|
8
|
+
enablers,
|
|
9
|
+
isEnabled,
|
|
10
|
+
entry,
|
|
11
|
+
};
|
package/dist/reporters/watch.js
CHANGED
|
@@ -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;
|
package/dist/schema/plugins.d.ts
CHANGED
|
@@ -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;
|
package/dist/schema/plugins.js
CHANGED
|
@@ -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"];
|
|
@@ -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
|
-
|
|
9
|
-
|
|
18
|
+
perfEntries: PerformanceEntry[];
|
|
19
|
+
memEntries: MemoryEntry[];
|
|
20
|
+
perfId?: string;
|
|
21
|
+
memId?: string;
|
|
10
22
|
fnObserver?: PerformanceObserver;
|
|
11
|
-
|
|
23
|
+
memObserver?: PerformanceObserver;
|
|
12
24
|
memoryUsageStart?: ReturnType<typeof memoryUsage>;
|
|
13
|
-
|
|
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
|
|
18
|
-
|
|
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():
|
|
39
|
+
getCurrentMemUsageInMb(): any;
|
|
22
40
|
finalize(): Promise<void>;
|
|
23
41
|
reset(): void;
|
|
24
42
|
}
|
package/dist/util/Performance.js
CHANGED
|
@@ -1,54 +1,69 @@
|
|
|
1
|
+
import os from 'node:os';
|
|
1
2
|
import { PerformanceObserver, performance } from 'node:perf_hooks';
|
|
2
|
-
import { constants } from 'node:perf_hooks';
|
|
3
3
|
import { memoryUsage } from 'node:process';
|
|
4
|
-
import prettyMilliseconds from 'pretty-ms';
|
|
5
4
|
import parsedArgValues from './cli-arguments.js';
|
|
6
|
-
import { debugLog } from './debug.js';
|
|
7
5
|
import { getStats } from './math.js';
|
|
8
6
|
import { Table } from './table.js';
|
|
9
|
-
const { performance:
|
|
7
|
+
const { performance: isPerformanceEnabled = false, memory: isMemoryEnabled = false, 'memory-realtime': memoryRealtime = false, } = parsedArgValues;
|
|
10
8
|
export const timerify = (fn, name = fn.name) => {
|
|
11
|
-
if (!
|
|
9
|
+
if (!isPerformanceEnabled)
|
|
12
10
|
return fn;
|
|
13
11
|
return performance.timerify(Object.defineProperty(fn, 'name', { get: () => name }));
|
|
14
12
|
};
|
|
13
|
+
const getMemInfo = () => Object.assign({ freemem: os.freemem() }, memoryUsage());
|
|
14
|
+
const twoFixed = (value) => (typeof value === 'number' ? value.toFixed(2) : value);
|
|
15
|
+
const inMB = (bytes) => bytes / 1024 / 1024;
|
|
16
|
+
const keys = ['heapUsed', 'heapTotal', 'freemem'];
|
|
17
|
+
const logHead = () => console.log(keys.map(key => key.padStart(10)).join(' '));
|
|
18
|
+
const log = (memInfo) => console.log(keys.map(key => twoFixed(inMB(memInfo[key])).padStart(10)).join(' '));
|
|
15
19
|
class Performance {
|
|
16
20
|
isEnabled;
|
|
21
|
+
isPerformanceEnabled;
|
|
22
|
+
isMemoryEnabled;
|
|
17
23
|
startTime = 0;
|
|
18
24
|
endTime = 0;
|
|
19
|
-
|
|
20
|
-
|
|
25
|
+
perfEntries = [];
|
|
26
|
+
memEntries = [];
|
|
27
|
+
perfId;
|
|
28
|
+
memId;
|
|
21
29
|
fnObserver;
|
|
22
|
-
|
|
30
|
+
memObserver;
|
|
23
31
|
memoryUsageStart;
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
32
|
+
freeMemoryStart;
|
|
33
|
+
constructor({ isPerformanceEnabled = false, isMemoryEnabled = false }) {
|
|
34
|
+
this.isEnabled = isPerformanceEnabled || isMemoryEnabled;
|
|
35
|
+
this.isPerformanceEnabled = isPerformanceEnabled;
|
|
36
|
+
this.isMemoryEnabled = isMemoryEnabled;
|
|
37
|
+
this.startTime = performance.now();
|
|
38
|
+
const instanceId = Math.floor(performance.now() * 100);
|
|
39
|
+
this.perfId = `perf-${instanceId}`;
|
|
40
|
+
this.memId = `mem-${instanceId}`;
|
|
41
|
+
if (isPerformanceEnabled) {
|
|
28
42
|
this.fnObserver = new PerformanceObserver(items => {
|
|
29
43
|
for (const entry of items.getEntries()) {
|
|
30
|
-
this.
|
|
44
|
+
this.perfEntries.push(entry);
|
|
31
45
|
}
|
|
32
46
|
});
|
|
33
|
-
this.fnObserver.observe({
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
47
|
+
this.fnObserver.observe({ type: 'function' });
|
|
48
|
+
}
|
|
49
|
+
if (isMemoryEnabled) {
|
|
50
|
+
this.memObserver = new PerformanceObserver(items => {
|
|
51
|
+
for (const entry of items.getEntries()) {
|
|
52
|
+
this.memEntries.push(entry);
|
|
39
53
|
}
|
|
40
54
|
});
|
|
41
|
-
this.
|
|
42
|
-
|
|
55
|
+
this.memObserver.observe({ type: 'mark' });
|
|
56
|
+
if (memoryRealtime)
|
|
57
|
+
logHead();
|
|
58
|
+
this.addMemoryMark(0);
|
|
43
59
|
}
|
|
44
|
-
this.isEnabled = isEnabled;
|
|
45
60
|
}
|
|
46
61
|
setMark(name) {
|
|
47
|
-
const id = `${this.
|
|
62
|
+
const id = `${this.perfId}:${name}`;
|
|
48
63
|
performance.mark(`${id}:start`);
|
|
49
64
|
}
|
|
50
65
|
clearMark(name) {
|
|
51
|
-
const id = `${this.
|
|
66
|
+
const id = `${this.perfId}:${name}`;
|
|
52
67
|
performance.mark(`${id}:end`);
|
|
53
68
|
performance.measure(id, `${id}:start`, `${id}:end`);
|
|
54
69
|
performance.clearMarks(`${id}:start`);
|
|
@@ -59,18 +74,17 @@ class Performance {
|
|
|
59
74
|
await new Promise(resolve => setTimeout(resolve, 1));
|
|
60
75
|
this.clearMark('_flush');
|
|
61
76
|
}
|
|
62
|
-
|
|
63
|
-
return this.
|
|
64
|
-
const name = entry.name.replace(`${this.
|
|
77
|
+
getPerfEntriesByName() {
|
|
78
|
+
return this.perfEntries.reduce((entries, entry) => {
|
|
79
|
+
const name = entry.name.replace(`${this.perfId}:`, '');
|
|
65
80
|
entries[name] = entries[name] ?? [];
|
|
66
81
|
entries[name].push(entry.duration);
|
|
67
82
|
return entries;
|
|
68
83
|
}, {});
|
|
69
84
|
}
|
|
70
|
-
|
|
71
|
-
const entriesByName = this.
|
|
85
|
+
getPerformanceTable() {
|
|
86
|
+
const entriesByName = this.getPerfEntriesByName();
|
|
72
87
|
const table = new Table({ header: true });
|
|
73
|
-
const twoFixed = (value) => (typeof value === 'number' ? value.toFixed(2) : value);
|
|
74
88
|
for (const [name, values] of Object.entries(entriesByName)) {
|
|
75
89
|
const stats = getStats(values);
|
|
76
90
|
table.newRow();
|
|
@@ -82,7 +96,28 @@ class Performance {
|
|
|
82
96
|
table.cell('sum', stats.sum, twoFixed);
|
|
83
97
|
}
|
|
84
98
|
table.sort('sum|desc');
|
|
85
|
-
return table.toString()
|
|
99
|
+
return table.toString();
|
|
100
|
+
}
|
|
101
|
+
addMemoryMark(index) {
|
|
102
|
+
if (!this.isMemoryEnabled)
|
|
103
|
+
return;
|
|
104
|
+
const id = `${this.memId}:${index}`;
|
|
105
|
+
const detail = getMemInfo();
|
|
106
|
+
performance.mark(id, { detail });
|
|
107
|
+
if (memoryRealtime && detail)
|
|
108
|
+
log(detail);
|
|
109
|
+
}
|
|
110
|
+
getMemoryTable() {
|
|
111
|
+
const table = new Table({ header: true });
|
|
112
|
+
for (const entry of this.memEntries) {
|
|
113
|
+
if (!entry.detail)
|
|
114
|
+
continue;
|
|
115
|
+
table.newRow();
|
|
116
|
+
table.cell('heapUsed', inMB(entry.detail.heapUsed), twoFixed);
|
|
117
|
+
table.cell('heapTotal', inMB(entry.detail.heapTotal), twoFixed);
|
|
118
|
+
table.cell('freemem', inMB(entry.detail.freemem), twoFixed);
|
|
119
|
+
}
|
|
120
|
+
return table.toString();
|
|
86
121
|
}
|
|
87
122
|
getCurrentDurationInMs(startTime) {
|
|
88
123
|
return performance.now() - (startTime ?? this.startTime);
|
|
@@ -91,7 +126,7 @@ class Performance {
|
|
|
91
126
|
return (memoryUsage().heapUsed ?? 0) - (this.memoryUsageStart?.heapUsed ?? 0);
|
|
92
127
|
}
|
|
93
128
|
getCurrentMemUsageInMb() {
|
|
94
|
-
return
|
|
129
|
+
return twoFixed(inMB(this.getMemHeapUsage()));
|
|
95
130
|
}
|
|
96
131
|
async finalize() {
|
|
97
132
|
if (!this.isEnabled)
|
|
@@ -99,8 +134,9 @@ class Performance {
|
|
|
99
134
|
await this.flush();
|
|
100
135
|
}
|
|
101
136
|
reset() {
|
|
102
|
-
this.
|
|
137
|
+
this.perfEntries = [];
|
|
103
138
|
this.fnObserver?.disconnect();
|
|
139
|
+
this.memObserver?.disconnect();
|
|
104
140
|
}
|
|
105
141
|
}
|
|
106
|
-
export const perfObserver = new Performance(
|
|
142
|
+
export const perfObserver = new Performance({ isPerformanceEnabled, isMemoryEnabled });
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export declare const helpText = "\u2702\uFE0F Find unused dependencies, exports and files in your JavaScript and TypeScript projects\n\nUsage: knip [options]\n\nOptions:\n -c, --config [file] Configuration file path (default: [.]knip.json[c], knip.(js|ts), knip.config.(js|ts) or package.json#knip)\n -t, --tsConfig [file] TypeScript configuration path (default: tsconfig.json)\n --production Analyze only production source files (e.g. no test files, devDependencies)\n --strict Consider only direct dependencies of workspace (not devDependencies, not other workspaces)\n -W, --workspace [dir] Analyze a single workspace (default: analyze all configured workspaces)\n --directory [dir] Run process from a different directory (default: cwd)\n --cache Enable caching\n --cache-location Change cache location (default: node_modules/.cache/knip)\n --watch Watch mode\n --no-gitignore Don't use .gitignore\n --include Report only provided issue type(s), can be comma-separated or repeated (1)\n --exclude Exclude provided issue type(s) from report, can be comma-separated or repeated (1)\n --dependencies Shortcut for --include dependencies,unlisted,binaries,unresolved\n --exports Shortcut for --include exports,nsExports,classMembers,types,nsTypes,enumMembers,duplicates\n --files Shortcut for --include files\n --fix Fix issues\n --fix-type Fix only issues of type, can be comma-separated or repeated (2)\n --allow-remove-files Allow Knip to remove files (with --fix)\n --include-libs Include type definitions from external dependencies (default: false)\n --include-entry-exports Include entry files when reporting unused exports\n --isolate-workspaces Isolate workspaces into separate programs\n -n, --no-progress Don't show dynamic progress updates (automatically enabled in CI environments)\n --preprocessor Preprocess the results before providing it to the reporter(s), can be repeated\n --preprocessor-options Pass extra options to the preprocessor (as JSON string, see --reporter-options example)\n --reporter Select reporter: symbols, compact, codeowners, json, codeclimate, markdown, disclosure, can be repeated (default: symbols)\n --reporter-options Pass extra options to the reporter (as JSON string, see example)\n --tags Include or exclude tagged exports\n --no-config-hints Suppress configuration hints\n --treat-config-hints-as-errors Exit with non-zero code (1) if there are any configuration hints\n --no-exit-code Always exit with code zero (0)\n --max-issues Maximum number of issues before non-zero exit code (default: 0)\n -d, --debug Show debug output\n --trace Show trace output\n --trace-export [name] Show trace output for named export(s)\n --trace-file [file] Show trace output for exports in file\n --performance Measure count and running time of
|
|
1
|
+
export declare const helpText = "\u2702\uFE0F Find unused dependencies, exports and files in your JavaScript and TypeScript projects\n\nUsage: knip [options]\n\nOptions:\n -c, --config [file] Configuration file path (default: [.]knip.json[c], knip.(js|ts), knip.config.(js|ts) or package.json#knip)\n -t, --tsConfig [file] TypeScript configuration path (default: tsconfig.json)\n --production Analyze only production source files (e.g. no test files, devDependencies)\n --strict Consider only direct dependencies of workspace (not devDependencies, not other workspaces)\n -W, --workspace [dir] Analyze a single workspace (default: analyze all configured workspaces)\n --directory [dir] Run process from a different directory (default: cwd)\n --cache Enable caching\n --cache-location Change cache location (default: node_modules/.cache/knip)\n --watch Watch mode\n --no-gitignore Don't use .gitignore\n --include Report only provided issue type(s), can be comma-separated or repeated (1)\n --exclude Exclude provided issue type(s) from report, can be comma-separated or repeated (1)\n --dependencies Shortcut for --include dependencies,unlisted,binaries,unresolved\n --exports Shortcut for --include exports,nsExports,classMembers,types,nsTypes,enumMembers,duplicates\n --files Shortcut for --include files\n --fix Fix issues\n --fix-type Fix only issues of type, can be comma-separated or repeated (2)\n --allow-remove-files Allow Knip to remove files (with --fix)\n --include-libs Include type definitions from external dependencies (default: false)\n --include-entry-exports Include entry files when reporting unused exports\n --isolate-workspaces Isolate workspaces into separate programs\n -n, --no-progress Don't show dynamic progress updates (automatically enabled in CI environments)\n --preprocessor Preprocess the results before providing it to the reporter(s), can be repeated\n --preprocessor-options Pass extra options to the preprocessor (as JSON string, see --reporter-options example)\n --reporter Select reporter: symbols, compact, codeowners, json, codeclimate, markdown, disclosure, can be repeated (default: symbols)\n --reporter-options Pass extra options to the reporter (as JSON string, see example)\n --tags Include or exclude tagged exports\n --no-config-hints Suppress configuration hints\n --treat-config-hints-as-errors Exit with non-zero code (1) if there are any configuration hints\n --no-exit-code Always exit with code zero (0)\n --max-issues Maximum number of issues before non-zero exit code (default: 0)\n -d, --debug Show debug output\n --trace Show trace output\n --trace-export [name] Show trace output for named export(s)\n --trace-file [file] Show trace output for exports in file\n --performance Measure count and running time of key functions and display stats table\n --memory Measure memory usage and display data table\n --memory-realtime Log memory usage in realtime\n -h, --help Print this help text\n -V, --version Print version\n\n(1) Issue types: files, dependencies, unlisted, unresolved, exports, nsExports, classMembers, types, nsTypes, enumMembers, duplicates\n(2) Fixable issue types: dependencies, exports, types\n\nExamples:\n\n$ knip\n$ knip --production\n$ knip --workspace packages/client --include files,dependencies\n$ knip -c ./config/knip.json --reporter compact\n$ knip --reporter codeowners --reporter-options '{\"path\":\".github/CODEOWNERS\"}'\n$ knip --tags=-lintignore\n\nWebsite: https://knip.dev";
|
|
2
2
|
declare const _default: {
|
|
3
3
|
cache?: boolean | undefined;
|
|
4
4
|
'cache-location'?: string | undefined;
|
|
@@ -21,6 +21,8 @@ declare const _default: {
|
|
|
21
21
|
'include-entry-exports'?: boolean | undefined;
|
|
22
22
|
'isolate-workspaces'?: boolean | undefined;
|
|
23
23
|
'max-issues'?: string | undefined;
|
|
24
|
+
memory?: boolean | undefined;
|
|
25
|
+
'memory-realtime'?: boolean | undefined;
|
|
24
26
|
'no-config-hints'?: boolean | undefined;
|
|
25
27
|
'no-exit-code'?: boolean | undefined;
|
|
26
28
|
'no-gitignore'?: boolean | undefined;
|
|
@@ -39,7 +39,9 @@ Options:
|
|
|
39
39
|
--trace Show trace output
|
|
40
40
|
--trace-export [name] Show trace output for named export(s)
|
|
41
41
|
--trace-file [file] Show trace output for exports in file
|
|
42
|
-
--performance Measure count and running time of
|
|
42
|
+
--performance Measure count and running time of key functions and display stats table
|
|
43
|
+
--memory Measure memory usage and display data table
|
|
44
|
+
--memory-realtime Log memory usage in realtime
|
|
43
45
|
-h, --help Print this help text
|
|
44
46
|
-V, --version Print version
|
|
45
47
|
|
|
@@ -81,6 +83,8 @@ try {
|
|
|
81
83
|
'include-entry-exports': { type: 'boolean' },
|
|
82
84
|
'isolate-workspaces': { type: 'boolean' },
|
|
83
85
|
'max-issues': { type: 'string' },
|
|
86
|
+
memory: { type: 'boolean' },
|
|
87
|
+
'memory-realtime': { type: 'boolean' },
|
|
84
88
|
'no-config-hints': { type: 'boolean' },
|
|
85
89
|
'no-exit-code': { type: 'boolean' },
|
|
86
90
|
'no-gitignore': { type: 'boolean' },
|
package/dist/util/glob-core.js
CHANGED
|
@@ -79,20 +79,22 @@ export const findAndParseGitignores = async (cwd) => {
|
|
|
79
79
|
dirIgnores.add(pattern2);
|
|
80
80
|
}
|
|
81
81
|
else {
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
82
|
+
if (!(pattern1.startsWith('**/') && ignores.has(pattern1))) {
|
|
83
|
+
const ignore = join(base, pattern1);
|
|
84
|
+
const extraIgnore = join(base, pattern2);
|
|
85
|
+
ignores.add(ignore);
|
|
86
|
+
ignores.add(extraIgnore);
|
|
87
|
+
dirIgnores.add(ignore);
|
|
88
|
+
dirIgnores.add(extraIgnore);
|
|
89
|
+
}
|
|
88
90
|
}
|
|
89
91
|
}
|
|
90
92
|
}
|
|
91
93
|
const cacheDir = ancestor ? cwd : dir;
|
|
92
|
-
const cacheForDir = cachedGitIgnores.get(
|
|
94
|
+
const cacheForDir = cachedGitIgnores.get(cacheDir);
|
|
93
95
|
if (cacheForDir) {
|
|
94
96
|
for (const pattern of dirIgnores)
|
|
95
|
-
cacheForDir
|
|
97
|
+
cacheForDir.ignores.add(pattern);
|
|
96
98
|
cacheForDir.unignores = Array.from(new Set([...cacheForDir.unignores, ...dirUnignores]));
|
|
97
99
|
}
|
|
98
100
|
else {
|
package/dist/util/string.d.ts
CHANGED
|
@@ -1,3 +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
3
|
export declare const pad: (value: string, width: number, fillString?: string, align?: "left" | "center" | "right") => string;
|
|
4
|
+
export declare const prettyMilliseconds: (ms: number) => string;
|
package/dist/util/string.js
CHANGED
|
@@ -5,3 +5,13 @@ export const pad = (value, width, fillString, align) => align === 'right'
|
|
|
5
5
|
: align === 'center'
|
|
6
6
|
? value.padStart((value.length + width) / 2, fillString).padEnd(width, fillString)
|
|
7
7
|
: value.padEnd(width, fillString);
|
|
8
|
+
export const prettyMilliseconds = (ms) => {
|
|
9
|
+
const seconds = ms / 1000;
|
|
10
|
+
const minutes = Math.floor(seconds / 60);
|
|
11
|
+
const hours = Math.floor(minutes / 60);
|
|
12
|
+
if (hours > 0)
|
|
13
|
+
return `${hours}h ${minutes % 60}m ${Math.floor(seconds % 60)}s`;
|
|
14
|
+
if (minutes > 0)
|
|
15
|
+
return `${minutes}m ${Math.floor(seconds % 60)}s`;
|
|
16
|
+
return seconds % 1 ? `${seconds.toFixed(1)}s` : `${Math.floor(seconds)}s`;
|
|
17
|
+
};
|
package/dist/version.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const version = "5.
|
|
1
|
+
export declare const version = "5.53.0";
|
package/dist/version.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const version = '5.
|
|
1
|
+
export const version = '5.53.0';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "knip",
|
|
3
|
-
"version": "5.
|
|
3
|
+
"version": "5.53.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": {
|
|
@@ -68,7 +68,6 @@
|
|
|
68
68
|
"minimist": "^1.2.8",
|
|
69
69
|
"picocolors": "^1.1.0",
|
|
70
70
|
"picomatch": "^4.0.1",
|
|
71
|
-
"pretty-ms": "^9.0.0",
|
|
72
71
|
"smol-toml": "^1.3.1",
|
|
73
72
|
"strip-json-comments": "5.0.1",
|
|
74
73
|
"zod": "^3.22.4",
|
package/schema.json
CHANGED
|
@@ -607,6 +607,10 @@
|
|
|
607
607
|
"title": "svelte plugin configuration (https://knip.dev/reference/plugins/svelte)",
|
|
608
608
|
"$ref": "#/definitions/plugin"
|
|
609
609
|
},
|
|
610
|
+
"svgo": {
|
|
611
|
+
"title": "svgo plugin configuration (https://knip.dev/reference/plugins/svgo)",
|
|
612
|
+
"$ref": "#/definitions/plugin"
|
|
613
|
+
},
|
|
610
614
|
"syncpack": {
|
|
611
615
|
"title": "syncpack plugin configuration (https://knip.dev/reference/plugins/syncpack)",
|
|
612
616
|
"$ref": "#/definitions/plugin"
|