knip 6.1.1 → 6.3.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 +6 -0
- package/dist/ProjectPrincipal.js +14 -32
- package/dist/compilers/index.d.ts +10 -0
- package/dist/graph/build.js +2 -5
- package/dist/plugins/index.d.ts +1 -0
- package/dist/plugins/index.js +2 -0
- package/dist/plugins/rolldown/index.d.ts +3 -0
- package/dist/plugins/rolldown/index.js +19 -0
- package/dist/plugins/rolldown/resolveFromAST.d.ts +2 -0
- package/dist/plugins/rolldown/resolveFromAST.js +4 -0
- package/dist/plugins/rollup/index.js +9 -2
- package/dist/plugins/rollup/resolveFromAST.d.ts +2 -0
- package/dist/plugins/rollup/resolveFromAST.js +4 -0
- package/dist/plugins/storybook/index.js +8 -0
- package/dist/schema/configuration.d.ts +15 -0
- package/dist/schema/plugins.d.ts +5 -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/types.d.ts +1 -1
- package/dist/typescript/visitors/calls.js +6 -14
- package/dist/util/create-options.d.ts +10 -0
- package/dist/util/modules.js +1 -1
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/package.json +2 -2
- package/schema.json +10 -6
|
@@ -527,6 +527,11 @@ export declare class ConfigurationChief {
|
|
|
527
527
|
entry?: string | string[] | undefined;
|
|
528
528
|
project?: string | string[] | undefined;
|
|
529
529
|
} | undefined;
|
|
530
|
+
rolldown?: string | boolean | string[] | {
|
|
531
|
+
config?: string | string[] | undefined;
|
|
532
|
+
entry?: string | string[] | undefined;
|
|
533
|
+
project?: string | string[] | undefined;
|
|
534
|
+
} | undefined;
|
|
530
535
|
rollup?: string | boolean | string[] | {
|
|
531
536
|
config?: string | string[] | undefined;
|
|
532
537
|
entry?: string | string[] | undefined;
|
|
@@ -880,6 +885,7 @@ export declare class ConfigurationChief {
|
|
|
880
885
|
"release-it"?: (boolean | import("./types/config.ts").EnsuredPluginConfiguration) | undefined;
|
|
881
886
|
remark?: (boolean | import("./types/config.ts").EnsuredPluginConfiguration) | undefined;
|
|
882
887
|
remix?: (boolean | import("./types/config.ts").EnsuredPluginConfiguration) | undefined;
|
|
888
|
+
rolldown?: (boolean | import("./types/config.ts").EnsuredPluginConfiguration) | undefined;
|
|
883
889
|
rollup?: (boolean | import("./types/config.ts").EnsuredPluginConfiguration) | undefined;
|
|
884
890
|
rsbuild?: (boolean | import("./types/config.ts").EnsuredPluginConfiguration) | undefined;
|
|
885
891
|
rslib?: (boolean | import("./types/config.ts").EnsuredPluginConfiguration) | undefined;
|
package/dist/ProjectPrincipal.js
CHANGED
|
@@ -131,15 +131,10 @@ export class ProjectPrincipal {
|
|
|
131
131
|
}
|
|
132
132
|
walkAndAnalyze(analyzeFile) {
|
|
133
133
|
this.resolvedFiles.clear();
|
|
134
|
-
const
|
|
135
|
-
const visited = new Set();
|
|
134
|
+
const visited = new Set([...this.entryPaths, ...this.programPaths]);
|
|
136
135
|
let lastEntrySize = this.entryPaths.size;
|
|
137
136
|
let lastProgramSize = this.programPaths.size;
|
|
138
|
-
for (
|
|
139
|
-
const filePath = queue[i];
|
|
140
|
-
if (visited.has(filePath))
|
|
141
|
-
continue;
|
|
142
|
-
visited.add(filePath);
|
|
137
|
+
for (const filePath of visited) {
|
|
143
138
|
const sourceText = this.fileManager.readFile(filePath);
|
|
144
139
|
if (!sourceText) {
|
|
145
140
|
if (this.projectPaths.has(filePath))
|
|
@@ -152,29 +147,22 @@ export class ProjectPrincipal {
|
|
|
152
147
|
if (this.projectPaths.has(filePath)) {
|
|
153
148
|
const internalPaths = analyzeFile(filePath, result, sourceText);
|
|
154
149
|
if (internalPaths) {
|
|
155
|
-
for (const p of internalPaths)
|
|
156
|
-
|
|
157
|
-
queue.push(p);
|
|
158
|
-
}
|
|
150
|
+
for (const p of internalPaths)
|
|
151
|
+
visited.add(p);
|
|
159
152
|
}
|
|
160
153
|
}
|
|
161
154
|
else {
|
|
162
155
|
for (const specifier of extractSpecifiers(result, sourceText, filePath)) {
|
|
163
156
|
const resolved = this.resolveSpecifier(specifier, filePath);
|
|
164
|
-
if (resolved && !isInNodeModules(resolved)
|
|
165
|
-
|
|
166
|
-
}
|
|
157
|
+
if (resolved && !isInNodeModules(resolved))
|
|
158
|
+
visited.add(resolved);
|
|
167
159
|
}
|
|
168
160
|
}
|
|
169
161
|
if (this.entryPaths.size > lastEntrySize || this.programPaths.size > lastProgramSize) {
|
|
170
|
-
for (const p of this.entryPaths)
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
for (const p of this.programPaths) {
|
|
175
|
-
if (!visited.has(p))
|
|
176
|
-
queue.push(p);
|
|
177
|
-
}
|
|
162
|
+
for (const p of this.entryPaths)
|
|
163
|
+
visited.add(p);
|
|
164
|
+
for (const p of this.programPaths)
|
|
165
|
+
visited.add(p);
|
|
178
166
|
lastEntrySize = this.entryPaths.size;
|
|
179
167
|
lastProgramSize = this.programPaths.size;
|
|
180
168
|
}
|
|
@@ -186,13 +174,8 @@ export class ProjectPrincipal {
|
|
|
186
174
|
}
|
|
187
175
|
getUsedResolvedFiles() {
|
|
188
176
|
this.resolvedFiles.clear();
|
|
189
|
-
const
|
|
190
|
-
const
|
|
191
|
-
for (let i = 0; i < queue.length; i++) {
|
|
192
|
-
const filePath = queue[i];
|
|
193
|
-
if (visited.has(filePath))
|
|
194
|
-
continue;
|
|
195
|
-
visited.add(filePath);
|
|
177
|
+
const visited = new Set([...this.entryPaths, ...this.programPaths]);
|
|
178
|
+
for (const filePath of visited) {
|
|
196
179
|
const sourceText = this.fileManager.readFile(filePath);
|
|
197
180
|
if (!sourceText)
|
|
198
181
|
continue;
|
|
@@ -200,9 +183,8 @@ export class ProjectPrincipal {
|
|
|
200
183
|
const result = parseFile(filePath, sourceText);
|
|
201
184
|
for (const specifier of extractSpecifiers(result, sourceText, filePath)) {
|
|
202
185
|
const resolved = this.resolveSpecifier(specifier, filePath);
|
|
203
|
-
if (resolved && !isInNodeModules(resolved)
|
|
204
|
-
|
|
205
|
-
}
|
|
186
|
+
if (resolved && !isInNodeModules(resolved))
|
|
187
|
+
visited.add(resolved);
|
|
206
188
|
}
|
|
207
189
|
}
|
|
208
190
|
catch {
|
|
@@ -475,6 +475,11 @@ export declare const partitionCompilers: (rawLocalConfig: RawConfiguration) => {
|
|
|
475
475
|
entry?: string | string[] | undefined;
|
|
476
476
|
project?: string | string[] | undefined;
|
|
477
477
|
} | undefined;
|
|
478
|
+
rolldown?: string | boolean | string[] | {
|
|
479
|
+
config?: string | string[] | undefined;
|
|
480
|
+
entry?: string | string[] | undefined;
|
|
481
|
+
project?: string | string[] | undefined;
|
|
482
|
+
} | undefined;
|
|
478
483
|
rollup?: string | boolean | string[] | {
|
|
479
484
|
config?: string | string[] | undefined;
|
|
480
485
|
entry?: string | string[] | undefined;
|
|
@@ -1186,6 +1191,11 @@ export declare const partitionCompilers: (rawLocalConfig: RawConfiguration) => {
|
|
|
1186
1191
|
entry?: string | string[] | undefined;
|
|
1187
1192
|
project?: string | string[] | undefined;
|
|
1188
1193
|
} | undefined;
|
|
1194
|
+
rolldown?: string | boolean | string[] | {
|
|
1195
|
+
config?: string | string[] | undefined;
|
|
1196
|
+
entry?: string | string[] | undefined;
|
|
1197
|
+
project?: string | string[] | undefined;
|
|
1198
|
+
} | undefined;
|
|
1189
1199
|
rollup?: string | boolean | string[] | {
|
|
1190
1200
|
config?: string | string[] | undefined;
|
|
1191
1201
|
entry?: string | string[] | undefined;
|
package/dist/graph/build.js
CHANGED
|
@@ -175,11 +175,8 @@ export async function build({ chief, collector, counselor, deputy, principal, is
|
|
|
175
175
|
const ws = (input.containingFilePath && chief.findWorkspaceByFilePath(input.containingFilePath)) || workspace;
|
|
176
176
|
const resolvedFilePath = handleInput(input, ws);
|
|
177
177
|
if (resolvedFilePath) {
|
|
178
|
-
if (isDeferResolveProductionEntry(input)) {
|
|
179
|
-
|
|
180
|
-
}
|
|
181
|
-
else if (isDeferResolveEntry(input)) {
|
|
182
|
-
if (!options.isProduction || !input.optional)
|
|
178
|
+
if (isDeferResolveEntry(input) && options.isProduction && !isDeferResolveProductionEntry(input)) {
|
|
179
|
+
if (!input.optional)
|
|
183
180
|
addPattern(entryPatternsSkipExports, input, resolvedFilePath);
|
|
184
181
|
}
|
|
185
182
|
else {
|
package/dist/plugins/index.d.ts
CHANGED
|
@@ -98,6 +98,7 @@ export declare const Plugins: {
|
|
|
98
98
|
'release-it': import("../types/config.ts").Plugin;
|
|
99
99
|
remark: import("../types/config.ts").Plugin;
|
|
100
100
|
remix: import("../types/config.ts").Plugin;
|
|
101
|
+
rolldown: import("../types/config.ts").Plugin;
|
|
101
102
|
rollup: import("../types/config.ts").Plugin;
|
|
102
103
|
rsbuild: import("../types/config.ts").Plugin;
|
|
103
104
|
rslib: import("../types/config.ts").Plugin;
|
package/dist/plugins/index.js
CHANGED
|
@@ -92,6 +92,7 @@ import { default as relay } from "./relay/index.js";
|
|
|
92
92
|
import { default as releaseIt } from "./release-it/index.js";
|
|
93
93
|
import { default as remark } from "./remark/index.js";
|
|
94
94
|
import { default as remix } from "./remix/index.js";
|
|
95
|
+
import { default as rolldown } from "./rolldown/index.js";
|
|
95
96
|
import { default as rollup } from "./rollup/index.js";
|
|
96
97
|
import { default as rsbuild } from "./rsbuild/index.js";
|
|
97
98
|
import { default as rslib } from "./rslib/index.js";
|
|
@@ -235,6 +236,7 @@ export const Plugins = {
|
|
|
235
236
|
'release-it': releaseIt,
|
|
236
237
|
remark,
|
|
237
238
|
remix,
|
|
239
|
+
rolldown,
|
|
238
240
|
rollup,
|
|
239
241
|
rsbuild,
|
|
240
242
|
rslib,
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { toProductionEntry } from "../../util/input.js";
|
|
2
|
+
import { hasDependency } from "../../util/plugin.js";
|
|
3
|
+
import { getInputFromAST } from "./resolveFromAST.js";
|
|
4
|
+
const title = 'Rolldown';
|
|
5
|
+
const enablers = ['rolldown'];
|
|
6
|
+
const isEnabled = ({ dependencies }) => hasDependency(dependencies, enablers);
|
|
7
|
+
const config = ['rolldown.config.{js,cjs,mjs,ts,cts,mts}'];
|
|
8
|
+
const resolveFromAST = program => {
|
|
9
|
+
const inputs = getInputFromAST(program);
|
|
10
|
+
return [...inputs].map(id => toProductionEntry(id));
|
|
11
|
+
};
|
|
12
|
+
const plugin = {
|
|
13
|
+
title,
|
|
14
|
+
enablers,
|
|
15
|
+
isEnabled,
|
|
16
|
+
config,
|
|
17
|
+
resolveFromAST,
|
|
18
|
+
};
|
|
19
|
+
export default plugin;
|
|
@@ -1,19 +1,26 @@
|
|
|
1
|
+
import { toProductionEntry } from "../../util/input.js";
|
|
1
2
|
import { hasDependency } from "../../util/plugin.js";
|
|
3
|
+
import { getInputFromAST } from "./resolveFromAST.js";
|
|
2
4
|
const title = 'Rollup';
|
|
3
5
|
const enablers = ['rollup'];
|
|
4
6
|
const isEnabled = ({ dependencies }) => hasDependency(dependencies, enablers);
|
|
5
|
-
const
|
|
7
|
+
const config = ['rollup.config.{js,cjs,mjs,ts}'];
|
|
6
8
|
const args = {
|
|
7
9
|
alias: { plugin: ['p'] },
|
|
8
10
|
args: (args) => args.map(arg => (arg.startsWith('--watch.onEnd') ? `--_exec${arg.slice(13)}` : arg)),
|
|
9
11
|
fromArgs: ['_exec'],
|
|
10
12
|
resolve: ['plugin', 'configPlugin'],
|
|
11
13
|
};
|
|
14
|
+
const resolveFromAST = program => {
|
|
15
|
+
const inputs = getInputFromAST(program);
|
|
16
|
+
return [...inputs].map(id => toProductionEntry(id));
|
|
17
|
+
};
|
|
12
18
|
const plugin = {
|
|
13
19
|
title,
|
|
14
20
|
enablers,
|
|
15
21
|
isEnabled,
|
|
16
|
-
|
|
22
|
+
config,
|
|
17
23
|
args,
|
|
24
|
+
resolveFromAST,
|
|
18
25
|
};
|
|
19
26
|
export default plugin;
|
|
@@ -38,11 +38,19 @@ const resolveConfig = async (localConfig, options) => {
|
|
|
38
38
|
const configs = viteConfigPath
|
|
39
39
|
? [toConfig('vite', viteConfigPath, { dir: cwd, containingFilePath: configFilePath })]
|
|
40
40
|
: [];
|
|
41
|
+
const hasVitestAddon = addons.some(addon => addon === '@storybook/addon-vitest');
|
|
42
|
+
const coverageDeps = hasVitestAddon
|
|
43
|
+
? [
|
|
44
|
+
toDependency('@vitest/coverage-v8', { optional: true }),
|
|
45
|
+
toDependency('@vitest/coverage-istanbul', { optional: true }),
|
|
46
|
+
]
|
|
47
|
+
: [];
|
|
41
48
|
return [
|
|
42
49
|
...patterns.map(id => toEntry(id)),
|
|
43
50
|
...addons.map(id => toDeferResolve(id)),
|
|
44
51
|
...builderPackages.map(id => toDependency(id)),
|
|
45
52
|
...frameworks.map(id => toDependency(id)),
|
|
53
|
+
...coverageDeps,
|
|
46
54
|
...configs,
|
|
47
55
|
];
|
|
48
56
|
};
|
|
@@ -472,6 +472,11 @@ export declare const workspaceConfigurationSchema: z.ZodMiniObject<{
|
|
|
472
472
|
entry: z.ZodMiniOptional<z.ZodMiniUnion<readonly [z.ZodMiniString<string>, z.ZodMiniArray<z.ZodMiniString<string>>]>>;
|
|
473
473
|
project: z.ZodMiniOptional<z.ZodMiniUnion<readonly [z.ZodMiniString<string>, z.ZodMiniArray<z.ZodMiniString<string>>]>>;
|
|
474
474
|
}, z.core.$strip>]>>;
|
|
475
|
+
rolldown: z.ZodMiniOptional<z.ZodMiniUnion<readonly [z.ZodMiniBoolean<boolean>, z.ZodMiniUnion<readonly [z.ZodMiniString<string>, z.ZodMiniArray<z.ZodMiniString<string>>]>, z.ZodMiniObject<{
|
|
476
|
+
config: z.ZodMiniOptional<z.ZodMiniUnion<readonly [z.ZodMiniString<string>, z.ZodMiniArray<z.ZodMiniString<string>>]>>;
|
|
477
|
+
entry: z.ZodMiniOptional<z.ZodMiniUnion<readonly [z.ZodMiniString<string>, z.ZodMiniArray<z.ZodMiniString<string>>]>>;
|
|
478
|
+
project: z.ZodMiniOptional<z.ZodMiniUnion<readonly [z.ZodMiniString<string>, z.ZodMiniArray<z.ZodMiniString<string>>]>>;
|
|
479
|
+
}, z.core.$strip>]>>;
|
|
475
480
|
rollup: z.ZodMiniOptional<z.ZodMiniUnion<readonly [z.ZodMiniBoolean<boolean>, z.ZodMiniUnion<readonly [z.ZodMiniString<string>, z.ZodMiniArray<z.ZodMiniString<string>>]>, z.ZodMiniObject<{
|
|
476
481
|
config: z.ZodMiniOptional<z.ZodMiniUnion<readonly [z.ZodMiniString<string>, z.ZodMiniArray<z.ZodMiniString<string>>]>>;
|
|
477
482
|
entry: z.ZodMiniOptional<z.ZodMiniUnion<readonly [z.ZodMiniString<string>, z.ZodMiniArray<z.ZodMiniString<string>>]>>;
|
|
@@ -1194,6 +1199,11 @@ export declare const knipConfigurationSchema: z.ZodMiniObject<{
|
|
|
1194
1199
|
entry: z.ZodMiniOptional<z.ZodMiniUnion<readonly [z.ZodMiniString<string>, z.ZodMiniArray<z.ZodMiniString<string>>]>>;
|
|
1195
1200
|
project: z.ZodMiniOptional<z.ZodMiniUnion<readonly [z.ZodMiniString<string>, z.ZodMiniArray<z.ZodMiniString<string>>]>>;
|
|
1196
1201
|
}, z.core.$strip>]>>;
|
|
1202
|
+
rolldown: z.ZodMiniOptional<z.ZodMiniUnion<readonly [z.ZodMiniBoolean<boolean>, z.ZodMiniUnion<readonly [z.ZodMiniString<string>, z.ZodMiniArray<z.ZodMiniString<string>>]>, z.ZodMiniObject<{
|
|
1203
|
+
config: z.ZodMiniOptional<z.ZodMiniUnion<readonly [z.ZodMiniString<string>, z.ZodMiniArray<z.ZodMiniString<string>>]>>;
|
|
1204
|
+
entry: z.ZodMiniOptional<z.ZodMiniUnion<readonly [z.ZodMiniString<string>, z.ZodMiniArray<z.ZodMiniString<string>>]>>;
|
|
1205
|
+
project: z.ZodMiniOptional<z.ZodMiniUnion<readonly [z.ZodMiniString<string>, z.ZodMiniArray<z.ZodMiniString<string>>]>>;
|
|
1206
|
+
}, z.core.$strip>]>>;
|
|
1197
1207
|
rollup: z.ZodMiniOptional<z.ZodMiniUnion<readonly [z.ZodMiniBoolean<boolean>, z.ZodMiniUnion<readonly [z.ZodMiniString<string>, z.ZodMiniArray<z.ZodMiniString<string>>]>, z.ZodMiniObject<{
|
|
1198
1208
|
config: z.ZodMiniOptional<z.ZodMiniUnion<readonly [z.ZodMiniString<string>, z.ZodMiniArray<z.ZodMiniString<string>>]>>;
|
|
1199
1209
|
entry: z.ZodMiniOptional<z.ZodMiniUnion<readonly [z.ZodMiniString<string>, z.ZodMiniArray<z.ZodMiniString<string>>]>>;
|
|
@@ -1905,6 +1915,11 @@ export declare const knipConfigurationSchema: z.ZodMiniObject<{
|
|
|
1905
1915
|
entry: z.ZodMiniOptional<z.ZodMiniUnion<readonly [z.ZodMiniString<string>, z.ZodMiniArray<z.ZodMiniString<string>>]>>;
|
|
1906
1916
|
project: z.ZodMiniOptional<z.ZodMiniUnion<readonly [z.ZodMiniString<string>, z.ZodMiniArray<z.ZodMiniString<string>>]>>;
|
|
1907
1917
|
}, z.core.$strip>]>>;
|
|
1918
|
+
rolldown: z.ZodMiniOptional<z.ZodMiniUnion<readonly [z.ZodMiniBoolean<boolean>, z.ZodMiniUnion<readonly [z.ZodMiniString<string>, z.ZodMiniArray<z.ZodMiniString<string>>]>, z.ZodMiniObject<{
|
|
1919
|
+
config: z.ZodMiniOptional<z.ZodMiniUnion<readonly [z.ZodMiniString<string>, z.ZodMiniArray<z.ZodMiniString<string>>]>>;
|
|
1920
|
+
entry: z.ZodMiniOptional<z.ZodMiniUnion<readonly [z.ZodMiniString<string>, z.ZodMiniArray<z.ZodMiniString<string>>]>>;
|
|
1921
|
+
project: z.ZodMiniOptional<z.ZodMiniUnion<readonly [z.ZodMiniString<string>, z.ZodMiniArray<z.ZodMiniString<string>>]>>;
|
|
1922
|
+
}, z.core.$strip>]>>;
|
|
1908
1923
|
rollup: z.ZodMiniOptional<z.ZodMiniUnion<readonly [z.ZodMiniBoolean<boolean>, z.ZodMiniUnion<readonly [z.ZodMiniString<string>, z.ZodMiniArray<z.ZodMiniString<string>>]>, z.ZodMiniObject<{
|
|
1909
1924
|
config: z.ZodMiniOptional<z.ZodMiniUnion<readonly [z.ZodMiniString<string>, z.ZodMiniArray<z.ZodMiniString<string>>]>>;
|
|
1910
1925
|
entry: z.ZodMiniOptional<z.ZodMiniUnion<readonly [z.ZodMiniString<string>, z.ZodMiniArray<z.ZodMiniString<string>>]>>;
|
package/dist/schema/plugins.d.ts
CHANGED
|
@@ -476,6 +476,11 @@ export declare const pluginsSchema: z.ZodMiniObject<{
|
|
|
476
476
|
entry: z.ZodMiniOptional<z.ZodMiniUnion<readonly [z.ZodMiniString<string>, z.ZodMiniArray<z.ZodMiniString<string>>]>>;
|
|
477
477
|
project: z.ZodMiniOptional<z.ZodMiniUnion<readonly [z.ZodMiniString<string>, z.ZodMiniArray<z.ZodMiniString<string>>]>>;
|
|
478
478
|
}, z.core.$strip>]>;
|
|
479
|
+
rolldown: z.ZodMiniUnion<readonly [z.ZodMiniBoolean<boolean>, z.ZodMiniUnion<readonly [z.ZodMiniString<string>, z.ZodMiniArray<z.ZodMiniString<string>>]>, z.ZodMiniObject<{
|
|
480
|
+
config: z.ZodMiniOptional<z.ZodMiniUnion<readonly [z.ZodMiniString<string>, z.ZodMiniArray<z.ZodMiniString<string>>]>>;
|
|
481
|
+
entry: z.ZodMiniOptional<z.ZodMiniUnion<readonly [z.ZodMiniString<string>, z.ZodMiniArray<z.ZodMiniString<string>>]>>;
|
|
482
|
+
project: z.ZodMiniOptional<z.ZodMiniUnion<readonly [z.ZodMiniString<string>, z.ZodMiniArray<z.ZodMiniString<string>>]>>;
|
|
483
|
+
}, z.core.$strip>]>;
|
|
479
484
|
rollup: z.ZodMiniUnion<readonly [z.ZodMiniBoolean<boolean>, z.ZodMiniUnion<readonly [z.ZodMiniString<string>, z.ZodMiniArray<z.ZodMiniString<string>>]>, z.ZodMiniObject<{
|
|
480
485
|
config: z.ZodMiniOptional<z.ZodMiniUnion<readonly [z.ZodMiniString<string>, z.ZodMiniArray<z.ZodMiniString<string>>]>>;
|
|
481
486
|
entry: z.ZodMiniOptional<z.ZodMiniUnion<readonly [z.ZodMiniString<string>, z.ZodMiniArray<z.ZodMiniString<string>>]>>;
|
package/dist/schema/plugins.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export type PluginName = 'angular' | 'astro' | 'astro-db' | 'astro-og-canvas' | 'ava' | 'babel' | 'biome' | 'bumpp' | 'bun' | 'c8' | 'capacitor' | 'changelogen' | 'changelogithub' | 'changesets' | 'commitizen' | 'commitlint' | 'convex' | 'create-typescript-app' | 'cspell' | 'cucumber' | 'cypress' | 'danger' | 'dependency-cruiser' | 'docusaurus' | 'dotenv' | 'drizzle' | 'eleventy' | 'eslint' | 'execa' | 'expo' | 'expressive-code' | 'gatsby' | 'github-action' | 'github-actions' | 'glob' | 'graphql-codegen' | 'hardhat' | 'husky' | 'i18next-parser' | 'jest' | 'karma' | 'knex' | 'ladle' | 'lefthook' | 'lint-staged' | 'linthtml' | 'lockfile-lint' | 'lost-pixel' | 'markdownlint' | 'mdx' | 'mdxlint' | 'metro' | 'mocha' | 'moonrepo' | 'msw' | 'nano-staged' | 'nest' | 'netlify' | 'next' | 'next-intl' | 'next-mdx' | 'nitro' | 'node' | 'node-modules-inspector' | 'nodemon' | 'npm-package-json-lint' | 'nuxt' | 'nx' | 'nyc' | 'oclif' | 'openapi-ts' | 'oxfmt' | 'oxlint' | 'parcel' | 'payload' | 'playwright' | 'playwright-ct' | 'playwright-test' | 'plop' | 'pm2' | 'pnpm' | 'postcss' | 'preconstruct' | 'prettier' | 'prisma' | 'qwik' | 'raycast' | 'react-cosmos' | 'react-native' | 'react-router' | 'relay' | 'release-it' | 'remark' | 'remix' | 'rollup' | 'rsbuild' | 'rslib' | 'rspack' | 'rstest' | 'sanity' | 'semantic-release' | 'sentry' | 'simple-git-hooks' | 'size-limit' | 'sst' | 'starlight' | 'stencil' | 'storybook' | 'stryker' | 'stylelint' | 'svelte' | 'sveltekit' | 'svgo' | 'svgr' | 'swc' | 'syncpack' | 'tailwind' | 'tanstack-router' | 'taskfile' | 'travis' | 'ts-node' | 'tsdown' | 'tsup' | 'tsx' | 'typedoc' | 'typescript' | 'unbuild' | 'unocss' | 'vercel-og' | 'vike' | 'vite' | 'vitepress' | 'vitest' | 'vue' | 'webdriver-io' | 'webpack' | 'wireit' | 'wrangler' | 'xo' | 'yarn' | 'yorkie' | 'zx';
|
|
2
|
-
export declare const pluginNames: readonly ["angular", "astro", "astro-db", "astro-og-canvas", "ava", "babel", "biome", "bumpp", "bun", "c8", "capacitor", "changelogen", "changelogithub", "changesets", "commitizen", "commitlint", "convex", "create-typescript-app", "cspell", "cucumber", "cypress", "danger", "dependency-cruiser", "docusaurus", "dotenv", "drizzle", "eleventy", "eslint", "execa", "expo", "expressive-code", "gatsby", "github-action", "github-actions", "glob", "graphql-codegen", "hardhat", "husky", "i18next-parser", "jest", "karma", "knex", "ladle", "lefthook", "lint-staged", "linthtml", "lockfile-lint", "lost-pixel", "markdownlint", "mdx", "mdxlint", "metro", "mocha", "moonrepo", "msw", "nano-staged", "nest", "netlify", "next", "next-intl", "next-mdx", "nitro", "node", "node-modules-inspector", "nodemon", "npm-package-json-lint", "nuxt", "nx", "nyc", "oclif", "openapi-ts", "oxfmt", "oxlint", "parcel", "payload", "playwright", "playwright-ct", "playwright-test", "plop", "pm2", "pnpm", "postcss", "preconstruct", "prettier", "prisma", "qwik", "raycast", "react-cosmos", "react-native", "react-router", "relay", "release-it", "remark", "remix", "rollup", "rsbuild", "rslib", "rspack", "rstest", "sanity", "semantic-release", "sentry", "simple-git-hooks", "size-limit", "sst", "starlight", "stencil", "storybook", "stryker", "stylelint", "svelte", "sveltekit", "svgo", "svgr", "swc", "syncpack", "tailwind", "tanstack-router", "taskfile", "travis", "ts-node", "tsdown", "tsup", "tsx", "typedoc", "typescript", "unbuild", "unocss", "vercel-og", "vike", "vite", "vitepress", "vitest", "vue", "webdriver-io", "webpack", "wireit", "wrangler", "xo", "yarn", "yorkie", "zx"];
|
|
1
|
+
export type PluginName = 'angular' | 'astro' | 'astro-db' | 'astro-og-canvas' | 'ava' | 'babel' | 'biome' | 'bumpp' | 'bun' | 'c8' | 'capacitor' | 'changelogen' | 'changelogithub' | 'changesets' | 'commitizen' | 'commitlint' | 'convex' | 'create-typescript-app' | 'cspell' | 'cucumber' | 'cypress' | 'danger' | 'dependency-cruiser' | 'docusaurus' | 'dotenv' | 'drizzle' | 'eleventy' | 'eslint' | 'execa' | 'expo' | 'expressive-code' | 'gatsby' | 'github-action' | 'github-actions' | 'glob' | 'graphql-codegen' | 'hardhat' | 'husky' | 'i18next-parser' | 'jest' | 'karma' | 'knex' | 'ladle' | 'lefthook' | 'lint-staged' | 'linthtml' | 'lockfile-lint' | 'lost-pixel' | 'markdownlint' | 'mdx' | 'mdxlint' | 'metro' | 'mocha' | 'moonrepo' | 'msw' | 'nano-staged' | 'nest' | 'netlify' | 'next' | 'next-intl' | 'next-mdx' | 'nitro' | 'node' | 'node-modules-inspector' | 'nodemon' | 'npm-package-json-lint' | 'nuxt' | 'nx' | 'nyc' | 'oclif' | 'openapi-ts' | 'oxfmt' | 'oxlint' | 'parcel' | 'payload' | 'playwright' | 'playwright-ct' | 'playwright-test' | 'plop' | 'pm2' | 'pnpm' | 'postcss' | 'preconstruct' | 'prettier' | 'prisma' | 'qwik' | 'raycast' | 'react-cosmos' | 'react-native' | 'react-router' | 'relay' | 'release-it' | 'remark' | 'remix' | 'rolldown' | 'rollup' | 'rsbuild' | 'rslib' | 'rspack' | 'rstest' | 'sanity' | 'semantic-release' | 'sentry' | 'simple-git-hooks' | 'size-limit' | 'sst' | 'starlight' | 'stencil' | 'storybook' | 'stryker' | 'stylelint' | 'svelte' | 'sveltekit' | 'svgo' | 'svgr' | 'swc' | 'syncpack' | 'tailwind' | 'tanstack-router' | 'taskfile' | 'travis' | 'ts-node' | 'tsdown' | 'tsup' | 'tsx' | 'typedoc' | 'typescript' | 'unbuild' | 'unocss' | 'vercel-og' | 'vike' | 'vite' | 'vitepress' | 'vitest' | 'vue' | 'webdriver-io' | 'webpack' | 'wireit' | 'wrangler' | 'xo' | 'yarn' | 'yorkie' | 'zx';
|
|
2
|
+
export declare const pluginNames: readonly ["angular", "astro", "astro-db", "astro-og-canvas", "ava", "babel", "biome", "bumpp", "bun", "c8", "capacitor", "changelogen", "changelogithub", "changesets", "commitizen", "commitlint", "convex", "create-typescript-app", "cspell", "cucumber", "cypress", "danger", "dependency-cruiser", "docusaurus", "dotenv", "drizzle", "eleventy", "eslint", "execa", "expo", "expressive-code", "gatsby", "github-action", "github-actions", "glob", "graphql-codegen", "hardhat", "husky", "i18next-parser", "jest", "karma", "knex", "ladle", "lefthook", "lint-staged", "linthtml", "lockfile-lint", "lost-pixel", "markdownlint", "mdx", "mdxlint", "metro", "mocha", "moonrepo", "msw", "nano-staged", "nest", "netlify", "next", "next-intl", "next-mdx", "nitro", "node", "node-modules-inspector", "nodemon", "npm-package-json-lint", "nuxt", "nx", "nyc", "oclif", "openapi-ts", "oxfmt", "oxlint", "parcel", "payload", "playwright", "playwright-ct", "playwright-test", "plop", "pm2", "pnpm", "postcss", "preconstruct", "prettier", "prisma", "qwik", "raycast", "react-cosmos", "react-native", "react-router", "relay", "release-it", "remark", "remix", "rolldown", "rollup", "rsbuild", "rslib", "rspack", "rstest", "sanity", "semantic-release", "sentry", "simple-git-hooks", "size-limit", "sst", "starlight", "stencil", "storybook", "stryker", "stylelint", "svelte", "sveltekit", "svgo", "svgr", "swc", "syncpack", "tailwind", "tanstack-router", "taskfile", "travis", "ts-node", "tsdown", "tsup", "tsx", "typedoc", "typescript", "unbuild", "unocss", "vercel-og", "vike", "vite", "vitepress", "vitest", "vue", "webdriver-io", "webpack", "wireit", "wrangler", "xo", "yarn", "yorkie", "zx"];
|
package/dist/types.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export type { RawConfigurationOrFn as KnipConfig, WorkspaceProjectConfig } from './types/config.ts';
|
|
1
|
+
export type { RawConfigurationOrFn as KnipConfig, RawConfiguration as KnipConfiguration, WorkspaceProjectConfig, } from './types/config.ts';
|
|
2
2
|
export type { Preprocessor, Reporter, ReporterOptions } from './types/issues.ts';
|
|
@@ -32,21 +32,13 @@ export function handleCallExpression(node, s) {
|
|
|
32
32
|
s.addImport(specifier, undefined, undefined, undefined, node.arguments[0].start, IMPORT_FLAGS.ENTRY);
|
|
33
33
|
return;
|
|
34
34
|
}
|
|
35
|
-
if (node.callee.type === 'MemberExpression' &&
|
|
36
|
-
node.callee.object.type === 'Identifier' &&
|
|
37
|
-
node.callee.object.name === 'module' &&
|
|
38
|
-
!node.callee.computed &&
|
|
39
|
-
node.callee.property.name === 'register' &&
|
|
40
|
-
node.arguments.length >= 1 &&
|
|
41
|
-
isStringLiteral(node.arguments[0])) {
|
|
42
|
-
const specifier = getStringValue(node.arguments[0]);
|
|
43
|
-
if (specifier)
|
|
44
|
-
s.addImport(specifier, undefined, undefined, undefined, node.arguments[0].start, IMPORT_FLAGS.ENTRY);
|
|
45
|
-
return;
|
|
46
|
-
}
|
|
47
35
|
if (s.hasNodeModuleImport &&
|
|
48
|
-
node.callee.type === '
|
|
49
|
-
|
|
36
|
+
((node.callee.type === 'MemberExpression' &&
|
|
37
|
+
node.callee.object.type === 'Identifier' &&
|
|
38
|
+
node.callee.object.name === 'module' &&
|
|
39
|
+
!node.callee.computed &&
|
|
40
|
+
node.callee.property.name === 'register') ||
|
|
41
|
+
(node.callee.type === 'Identifier' && node.callee.name === 'register')) &&
|
|
50
42
|
node.arguments.length >= 1 &&
|
|
51
43
|
isStringLiteral(node.arguments[0])) {
|
|
52
44
|
const specifier = getStringValue(node.arguments[0]);
|
|
@@ -512,6 +512,11 @@ export declare const createOptions: (options: CreateOptions) => Promise<{
|
|
|
512
512
|
entry?: string | string[] | undefined;
|
|
513
513
|
project?: string | string[] | undefined;
|
|
514
514
|
} | undefined;
|
|
515
|
+
rolldown?: string | boolean | string[] | {
|
|
516
|
+
config?: string | string[] | undefined;
|
|
517
|
+
entry?: string | string[] | undefined;
|
|
518
|
+
project?: string | string[] | undefined;
|
|
519
|
+
} | undefined;
|
|
515
520
|
rollup?: string | boolean | string[] | {
|
|
516
521
|
config?: string | string[] | undefined;
|
|
517
522
|
entry?: string | string[] | undefined;
|
|
@@ -1223,6 +1228,11 @@ export declare const createOptions: (options: CreateOptions) => Promise<{
|
|
|
1223
1228
|
entry?: string | string[] | undefined;
|
|
1224
1229
|
project?: string | string[] | undefined;
|
|
1225
1230
|
} | undefined;
|
|
1231
|
+
rolldown?: string | boolean | string[] | {
|
|
1232
|
+
config?: string | string[] | undefined;
|
|
1233
|
+
entry?: string | string[] | undefined;
|
|
1234
|
+
project?: string | string[] | undefined;
|
|
1235
|
+
} | undefined;
|
|
1226
1236
|
rollup?: string | boolean | string[] | {
|
|
1227
1237
|
config?: string | string[] | undefined;
|
|
1228
1238
|
entry?: string | string[] | undefined;
|
package/dist/util/modules.js
CHANGED
|
@@ -28,7 +28,7 @@ export const getPackageNameFromFilePath = (value) => {
|
|
|
28
28
|
return name;
|
|
29
29
|
};
|
|
30
30
|
export const getPackageNameFromSpecifier = (specifier) => isInNodeModules(specifier) ? getPackageNameFromFilePath(specifier) : getPackageNameFromModuleSpecifier(specifier);
|
|
31
|
-
const matchPackageNameStart = /^(@[a-z0-9._]|[a-z0-9])/i;
|
|
31
|
+
const matchPackageNameStart = /^(@[a-z0-9._~]|[a-z0-9])/i;
|
|
32
32
|
export const isStartsLikePackageName = (specifier) => {
|
|
33
33
|
const ch = specifier.charCodeAt(0);
|
|
34
34
|
if (ch === 46 || ch === 47 || ch === 35 || ch === 126 || ch === 36)
|
package/dist/version.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const version = "6.
|
|
1
|
+
export declare const version = "6.3.0";
|
package/dist/version.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const version = '6.
|
|
1
|
+
export const version = '6.3.0';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "knip",
|
|
3
|
-
"version": "6.
|
|
3
|
+
"version": "6.3.0",
|
|
4
4
|
"description": "Find and fix unused dependencies, exports and files in your TypeScript and JavaScript projects",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"analysis",
|
|
@@ -124,7 +124,7 @@
|
|
|
124
124
|
"prebuild": "pnpm run generate-plugin-defs && node rmdir.js dist",
|
|
125
125
|
"build": "tsc",
|
|
126
126
|
"qa": "pnpm lint && pnpm build && pnpm knip && pnpm knip:production && pnpm run test",
|
|
127
|
-
"release": "release-it",
|
|
127
|
+
"release": "NODE_OPTIONS=--no-deprecation release-it",
|
|
128
128
|
"create-plugin": "node ./scripts/create-new-plugin.ts",
|
|
129
129
|
"postcreate-plugin": "pnpm run build && (oxfmt schema.json schema-jsonc.json src/schema/plugins.ts || true)",
|
|
130
130
|
"generate-plugin-defs": "node ./scripts/generate-plugin-defs.js && (oxfmt src/plugins/index.ts src/types/PluginNames.ts src/schema/plugins.ts || true)"
|
package/schema.json
CHANGED
|
@@ -616,22 +616,22 @@
|
|
|
616
616
|
"title": "nyc plugin configuration (https://knip.dev/reference/plugins/nyc)",
|
|
617
617
|
"$ref": "#/definitions/plugin"
|
|
618
618
|
},
|
|
619
|
-
"openapi-ts": {
|
|
620
|
-
"title": "openapi-ts plugin configuration (https://knip.dev/reference/plugins/openapi-ts)",
|
|
621
|
-
"$ref": "#/definitions/plugin"
|
|
622
|
-
},
|
|
623
619
|
"oclif": {
|
|
624
620
|
"title": "oclif plugin configuration (https://knip.dev/reference/plugins/oclif)",
|
|
625
621
|
"$ref": "#/definitions/plugin"
|
|
626
622
|
},
|
|
627
|
-
"
|
|
628
|
-
"title": "
|
|
623
|
+
"openapi-ts": {
|
|
624
|
+
"title": "openapi-ts plugin configuration (https://knip.dev/reference/plugins/openapi-ts)",
|
|
629
625
|
"$ref": "#/definitions/plugin"
|
|
630
626
|
},
|
|
631
627
|
"oxfmt": {
|
|
632
628
|
"title": "oxfmt plugin configuration (https://knip.dev/reference/plugins/oxfmt)",
|
|
633
629
|
"$ref": "#/definitions/plugin"
|
|
634
630
|
},
|
|
631
|
+
"oxlint": {
|
|
632
|
+
"title": "oxlint plugin configuration (https://knip.dev/reference/plugins/oxlint)",
|
|
633
|
+
"$ref": "#/definitions/plugin"
|
|
634
|
+
},
|
|
635
635
|
"payload": {
|
|
636
636
|
"title": "payload plugin configuration (https://knip.dev/reference/plugins/payload)",
|
|
637
637
|
"$ref": "#/definitions/plugin"
|
|
@@ -704,6 +704,10 @@
|
|
|
704
704
|
"title": "Remix plugin configuration (https://knip.dev/reference/plugins/remix)",
|
|
705
705
|
"$ref": "#/definitions/plugin"
|
|
706
706
|
},
|
|
707
|
+
"rolldown": {
|
|
708
|
+
"title": "rolldown plugin configuration (https://knip.dev/reference/plugins/rolldown)",
|
|
709
|
+
"$ref": "#/definitions/plugin"
|
|
710
|
+
},
|
|
707
711
|
"rollup": {
|
|
708
712
|
"title": "Rollup plugin configuration (https://knip.dev/reference/plugins/rollup)",
|
|
709
713
|
"$ref": "#/definitions/plugin"
|