knip 5.63.1 → 5.64.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 +12 -0
- package/dist/DependencyDeputy.js +3 -2
- package/dist/IssueFixer.js +3 -1
- package/dist/binaries/bash-parser.d.ts +1 -0
- package/dist/binaries/bash-parser.js +3 -0
- package/dist/binaries/fallback.js +3 -2
- package/dist/binaries/package-manager/bun.js +1 -0
- package/dist/binaries/plugins.js +3 -1
- package/dist/compilers/index.d.ts +20 -0
- package/dist/constants.js +2 -0
- package/dist/graph/analyze.js +7 -4
- package/dist/graph/build.js +7 -7
- package/dist/plugins/angular/index.js +2 -3
- package/dist/plugins/bumpp/index.d.ts +8 -0
- package/dist/plugins/bumpp/index.js +11 -0
- package/dist/plugins/eslint/index.d.ts +7 -0
- package/dist/plugins/eslint/index.js +12 -0
- package/dist/plugins/glob/index.d.ts +0 -1
- package/dist/plugins/glob/index.js +0 -1
- package/dist/plugins/index.d.ts +19 -7
- package/dist/plugins/index.js +4 -0
- package/dist/plugins/karma/helpers.js +1 -1
- package/dist/plugins/node-modules-inspector/index.d.ts +0 -1
- package/dist/plugins/node-modules-inspector/index.js +0 -1
- package/dist/plugins/nuxt/index.js +7 -1
- package/dist/plugins/nuxt/types.d.ts +1 -1
- package/dist/plugins/oxlint/index.d.ts +0 -1
- package/dist/plugins/oxlint/index.js +0 -1
- package/dist/plugins/playwright/index.d.ts +0 -1
- package/dist/plugins/playwright/index.js +0 -1
- package/dist/plugins/playwright-test/index.d.ts +0 -1
- package/dist/plugins/playwright-test/index.js +0 -1
- package/dist/plugins/pnpm/index.d.ts +1 -0
- package/dist/plugins/pnpm/index.js +5 -1
- package/dist/plugins/prisma/index.d.ts +0 -1
- package/dist/plugins/prisma/index.js +0 -1
- package/dist/plugins/rslib/index.js +1 -1
- package/dist/plugins/rstest/index.d.ts +10 -0
- package/dist/plugins/rstest/index.js +29 -0
- package/dist/plugins/rstest/types.d.ts +6 -0
- package/dist/plugins/rstest/types.js +1 -0
- package/dist/plugins/ts-node/index.d.ts +0 -1
- package/dist/plugins/ts-node/index.js +0 -1
- package/dist/reporters/githubActions.d.ts +3 -0
- package/dist/reporters/githubActions.js +94 -0
- package/dist/reporters/index.d.ts +1 -0
- package/dist/reporters/index.js +2 -0
- package/dist/reporters/json.js +1 -1
- package/dist/reporters/util/configuration-hints.d.ts +13 -1
- package/dist/reporters/util/configuration-hints.js +1 -0
- package/dist/schema/configuration.d.ts +112 -0
- package/dist/schema/plugins.d.ts +46 -0
- package/dist/schema/plugins.js +2 -0
- package/dist/types/PluginNames.d.ts +2 -2
- package/dist/types/PluginNames.js +2 -0
- package/dist/types/args.d.ts +2 -0
- package/dist/types/exports.d.ts +1 -1
- package/dist/types/imports.d.ts +1 -1
- package/dist/types/module-graph.d.ts +5 -4
- package/dist/typescript/SourceFile.d.ts +2 -2
- package/dist/typescript/ast-helpers.d.ts +4 -0
- package/dist/typescript/ast-helpers.js +29 -0
- package/dist/typescript/find-internal-references.js +10 -1
- package/dist/typescript/get-imports-and-exports.js +27 -17
- package/dist/typescript/visitors/dynamic-imports/importCall.js +6 -1
- package/dist/util/cli-arguments.d.ts +3 -2
- package/dist/util/cli-arguments.js +2 -2
- package/dist/util/create-options.d.ts +22 -3
- package/dist/util/create-options.js +1 -1
- package/dist/util/load-config.d.ts +2 -1
- package/dist/util/load-config.js +4 -4
- package/dist/util/modules.js +18 -7
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/package.json +3 -3
- package/schema.json +8 -0
|
@@ -84,6 +84,11 @@ export declare class ConfigurationChief {
|
|
|
84
84
|
entry?: string | string[] | undefined;
|
|
85
85
|
project?: string | string[] | undefined;
|
|
86
86
|
} | undefined;
|
|
87
|
+
bumpp?: string | boolean | string[] | {
|
|
88
|
+
config?: string | string[] | undefined;
|
|
89
|
+
entry?: string | string[] | undefined;
|
|
90
|
+
project?: string | string[] | undefined;
|
|
91
|
+
} | undefined;
|
|
87
92
|
bun?: string | boolean | string[] | {
|
|
88
93
|
config?: string | string[] | undefined;
|
|
89
94
|
entry?: string | string[] | undefined;
|
|
@@ -444,6 +449,11 @@ export declare class ConfigurationChief {
|
|
|
444
449
|
entry?: string | string[] | undefined;
|
|
445
450
|
project?: string | string[] | undefined;
|
|
446
451
|
} | undefined;
|
|
452
|
+
rstest?: string | boolean | string[] | {
|
|
453
|
+
config?: string | string[] | undefined;
|
|
454
|
+
entry?: string | string[] | undefined;
|
|
455
|
+
project?: string | string[] | undefined;
|
|
456
|
+
} | undefined;
|
|
447
457
|
'semantic-release'?: string | boolean | string[] | {
|
|
448
458
|
config?: string | string[] | undefined;
|
|
449
459
|
entry?: string | string[] | undefined;
|
|
@@ -634,6 +644,7 @@ export declare class ConfigurationChief {
|
|
|
634
644
|
ava?: (boolean | import("./types/config.js").EnsuredPluginConfiguration) | undefined;
|
|
635
645
|
babel?: (boolean | import("./types/config.js").EnsuredPluginConfiguration) | undefined;
|
|
636
646
|
biome?: (boolean | import("./types/config.js").EnsuredPluginConfiguration) | undefined;
|
|
647
|
+
bumpp?: (boolean | import("./types/config.js").EnsuredPluginConfiguration) | undefined;
|
|
637
648
|
bun?: (boolean | import("./types/config.js").EnsuredPluginConfiguration) | undefined;
|
|
638
649
|
c8?: (boolean | import("./types/config.js").EnsuredPluginConfiguration) | undefined;
|
|
639
650
|
capacitor?: (boolean | import("./types/config.js").EnsuredPluginConfiguration) | undefined;
|
|
@@ -706,6 +717,7 @@ export declare class ConfigurationChief {
|
|
|
706
717
|
rsbuild?: (boolean | import("./types/config.js").EnsuredPluginConfiguration) | undefined;
|
|
707
718
|
rslib?: (boolean | import("./types/config.js").EnsuredPluginConfiguration) | undefined;
|
|
708
719
|
rspack?: (boolean | import("./types/config.js").EnsuredPluginConfiguration) | undefined;
|
|
720
|
+
rstest?: (boolean | import("./types/config.js").EnsuredPluginConfiguration) | undefined;
|
|
709
721
|
"semantic-release"?: (boolean | import("./types/config.js").EnsuredPluginConfiguration) | undefined;
|
|
710
722
|
sentry?: (boolean | import("./types/config.js").EnsuredPluginConfiguration) | undefined;
|
|
711
723
|
"simple-git-hooks"?: (boolean | import("./types/config.js").EnsuredPluginConfiguration) | undefined;
|
package/dist/DependencyDeputy.js
CHANGED
|
@@ -4,6 +4,7 @@ import { DT_SCOPE, IGNORED_DEPENDENCIES, IGNORED_GLOBAL_BINARIES, IGNORED_RUNTIM
|
|
|
4
4
|
import { getDependencyMetaData } from './manifest/index.js';
|
|
5
5
|
import { getDefinitelyTypedFor, getPackageFromDefinitelyTyped, getPackageNameFromModuleSpecifier, isDefinitelyTyped, } from './util/modules.js';
|
|
6
6
|
import { findMatch, toRegexOrString } from './util/regex.js';
|
|
7
|
+
const filterIsProduction = (id, isProduction) => typeof id === 'string' ? (isProduction || !id.endsWith('!') ? id.replace(/!$/, '') : []) : id;
|
|
7
8
|
export class DependencyDeputy {
|
|
8
9
|
isProduction;
|
|
9
10
|
isStrict;
|
|
@@ -46,8 +47,8 @@ export class DependencyDeputy {
|
|
|
46
47
|
this.setHostDependencies(name, hostDependencies);
|
|
47
48
|
this.setInstalledBinaries(name, installedBinaries);
|
|
48
49
|
this.setHasTypesIncluded(name, hasTypesIncluded);
|
|
49
|
-
const ignoreDependencies = id.map(toRegexOrString);
|
|
50
|
-
const ignoreBinaries = ib.map(toRegexOrString);
|
|
50
|
+
const ignoreDependencies = id.flatMap(id => filterIsProduction(id, this.isProduction)).map(toRegexOrString);
|
|
51
|
+
const ignoreBinaries = ib.flatMap(ib => filterIsProduction(ib, this.isProduction)).map(toRegexOrString);
|
|
51
52
|
const ignoreUnresolved = iu.map(toRegexOrString);
|
|
52
53
|
this._manifests.set(name, {
|
|
53
54
|
workspaceDir: dir,
|
package/dist/IssueFixer.js
CHANGED
|
@@ -62,7 +62,9 @@ export class IssueFixer {
|
|
|
62
62
|
for (const filePath of filePaths) {
|
|
63
63
|
const types = (this.options.isFixUnusedTypes && this.unusedTypeNodes.get(filePath)) || [];
|
|
64
64
|
const exports = (this.options.isFixUnusedExports && this.unusedExportNodes.get(filePath)) || [];
|
|
65
|
-
const exportPositions = [...types, ...exports]
|
|
65
|
+
const exportPositions = [...types, ...exports]
|
|
66
|
+
.filter((fix) => fix !== undefined)
|
|
67
|
+
.sort((a, b) => b[0] - a[0]);
|
|
66
68
|
if (exportPositions.length > 0) {
|
|
67
69
|
const sourceFileText = exportPositions.reduce((text, [start, end, flags]) => removeExport({ text, start, end, flags }), await readFile(filePath, 'utf-8'));
|
|
68
70
|
await writeFile(filePath, sourceFileText);
|
|
@@ -1,3 +1,4 @@
|
|
|
1
1
|
import type { GetInputsFromScriptsOptions } from '../types/config.js';
|
|
2
2
|
import { type Input } from '../util/input.js';
|
|
3
|
+
export declare const isValidBinary: (str: string) => boolean;
|
|
3
4
|
export declare const getDependenciesFromScript: (script: string, options: GetInputsFromScriptsOptions) => Input[];
|
|
@@ -12,10 +12,13 @@ import { parseNodeArgs } from './util.js';
|
|
|
12
12
|
const spawningBinaries = ['cross-env', 'retry-cli'];
|
|
13
13
|
const isExpansion = (node) => 'expansion' in node;
|
|
14
14
|
const isAssignment = (node) => 'type' in node && node.type === 'AssignmentWord';
|
|
15
|
+
export const isValidBinary = (str) => !/[*:!()]/.test(str);
|
|
15
16
|
export const getDependenciesFromScript = (script, options) => {
|
|
16
17
|
if (!script)
|
|
17
18
|
return [];
|
|
18
19
|
const fromArgs = (args, opts) => {
|
|
20
|
+
if (args.length === 0 || !isValidBinary(args[0]))
|
|
21
|
+
return [];
|
|
19
22
|
return getDependenciesFromScript(args.filter(arg => arg !== '--').join(' '), {
|
|
20
23
|
...options,
|
|
21
24
|
...opts,
|
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
import parseArgs from 'minimist';
|
|
2
2
|
import { compact } from '../util/array.js';
|
|
3
3
|
import { toBinary, toDeferResolve, toEntry } from '../util/input.js';
|
|
4
|
+
import { isValidBinary } from './bash-parser.js';
|
|
4
5
|
const spawningBinaries = ['cross-env', 'retry-cli'];
|
|
5
|
-
const endOfCommandBinaries = ['dotenvx'];
|
|
6
|
+
const endOfCommandBinaries = ['dotenvx', 'env-cmd'];
|
|
6
7
|
const positionals = new Set(['babel-node', 'esbuild', 'execa', 'jiti', 'oxnode', 'vite-node', 'zx']);
|
|
7
8
|
const positionalBinaries = new Set(['concurrently']);
|
|
8
9
|
export const resolve = (binary, args, { fromArgs }) => {
|
|
9
10
|
const parsed = parseArgs(args, { boolean: ['quiet', 'verbose'], '--': endOfCommandBinaries.includes(binary) });
|
|
10
|
-
const bin = binary.startsWith('.') ? toEntry(binary) :
|
|
11
|
+
const bin = binary.startsWith('.') ? toEntry(binary) : isValidBinary(binary) ? toBinary(binary) : undefined;
|
|
11
12
|
const shiftedArgs = spawningBinaries.includes(binary) ? fromArgs(args) : [];
|
|
12
13
|
const pos = positionals.has(binary) ? [toDeferResolve(parsed._[0])] : [];
|
|
13
14
|
const newCommand = parsed['--'] && parsed['--'].length > 0 ? fromArgs(parsed['--']) : [];
|
package/dist/binaries/plugins.js
CHANGED
|
@@ -48,7 +48,7 @@ export const resolve = (binary, _args, options) => {
|
|
|
48
48
|
const resolvedFromArgs = typeof pluginArgs.fromArgs === 'function'
|
|
49
49
|
? fromArgs(pluginArgs.fromArgs(parsed, args))
|
|
50
50
|
: Array.isArray(pluginArgs.fromArgs)
|
|
51
|
-
? fromArgs(pluginArgs.fromArgs.flatMap(mapToParsedKey))
|
|
51
|
+
? fromArgs(pluginArgs.fromArgs.flatMap(mapToParsedKey).filter(Boolean))
|
|
52
52
|
: [];
|
|
53
53
|
const config = pluginArgs.config === true ? ['config'] : pluginArgs.config || [];
|
|
54
54
|
const mapToConfigPattern = (value) => {
|
|
@@ -58,6 +58,7 @@ export const resolve = (binary, _args, options) => {
|
|
|
58
58
|
return parsed[id] && pluginName ? [toConfig(pluginName, fn(parsed[id]), inputOpts)] : [];
|
|
59
59
|
};
|
|
60
60
|
const configFilePaths = config.flatMap(mapToConfigPattern);
|
|
61
|
+
const inputs = pluginArgs.resolveInputs?.(parsed, args) ?? [];
|
|
61
62
|
return [
|
|
62
63
|
toBinary(binary, inputOpts),
|
|
63
64
|
...positionals,
|
|
@@ -65,5 +66,6 @@ export const resolve = (binary, _args, options) => {
|
|
|
65
66
|
...resolvedImports.map(id => toDeferResolve(id)),
|
|
66
67
|
...resolvedFromArgs,
|
|
67
68
|
...configFilePaths,
|
|
69
|
+
...inputs,
|
|
68
70
|
];
|
|
69
71
|
};
|
|
@@ -36,6 +36,11 @@ export declare const partitionCompilers: (rawLocalConfig: RawConfiguration) => {
|
|
|
36
36
|
entry?: string | string[] | undefined;
|
|
37
37
|
project?: string | string[] | undefined;
|
|
38
38
|
} | undefined;
|
|
39
|
+
bumpp?: string | boolean | string[] | {
|
|
40
|
+
config?: string | string[] | undefined;
|
|
41
|
+
entry?: string | string[] | undefined;
|
|
42
|
+
project?: string | string[] | undefined;
|
|
43
|
+
} | undefined;
|
|
39
44
|
bun?: string | boolean | string[] | {
|
|
40
45
|
config?: string | string[] | undefined;
|
|
41
46
|
entry?: string | string[] | undefined;
|
|
@@ -396,6 +401,11 @@ export declare const partitionCompilers: (rawLocalConfig: RawConfiguration) => {
|
|
|
396
401
|
entry?: string | string[] | undefined;
|
|
397
402
|
project?: string | string[] | undefined;
|
|
398
403
|
} | undefined;
|
|
404
|
+
rstest?: string | boolean | string[] | {
|
|
405
|
+
config?: string | string[] | undefined;
|
|
406
|
+
entry?: string | string[] | undefined;
|
|
407
|
+
project?: string | string[] | undefined;
|
|
408
|
+
} | undefined;
|
|
399
409
|
'semantic-release'?: string | boolean | string[] | {
|
|
400
410
|
config?: string | string[] | undefined;
|
|
401
411
|
entry?: string | string[] | undefined;
|
|
@@ -615,6 +625,11 @@ export declare const partitionCompilers: (rawLocalConfig: RawConfiguration) => {
|
|
|
615
625
|
entry?: string | string[] | undefined;
|
|
616
626
|
project?: string | string[] | undefined;
|
|
617
627
|
} | undefined;
|
|
628
|
+
bumpp?: string | boolean | string[] | {
|
|
629
|
+
config?: string | string[] | undefined;
|
|
630
|
+
entry?: string | string[] | undefined;
|
|
631
|
+
project?: string | string[] | undefined;
|
|
632
|
+
} | undefined;
|
|
618
633
|
bun?: string | boolean | string[] | {
|
|
619
634
|
config?: string | string[] | undefined;
|
|
620
635
|
entry?: string | string[] | undefined;
|
|
@@ -975,6 +990,11 @@ export declare const partitionCompilers: (rawLocalConfig: RawConfiguration) => {
|
|
|
975
990
|
entry?: string | string[] | undefined;
|
|
976
991
|
project?: string | string[] | undefined;
|
|
977
992
|
} | undefined;
|
|
993
|
+
rstest?: string | boolean | string[] | {
|
|
994
|
+
config?: string | string[] | undefined;
|
|
995
|
+
entry?: string | string[] | undefined;
|
|
996
|
+
project?: string | string[] | undefined;
|
|
997
|
+
} | undefined;
|
|
978
998
|
'semantic-release'?: string | boolean | string[] | {
|
|
979
999
|
config?: string | string[] | undefined;
|
|
980
1000
|
entry?: string | string[] | undefined;
|
package/dist/constants.js
CHANGED
|
@@ -106,6 +106,7 @@ export const IGNORED_GLOBAL_BINARIES = new Set([
|
|
|
106
106
|
'tac',
|
|
107
107
|
'tee',
|
|
108
108
|
'test',
|
|
109
|
+
'time',
|
|
109
110
|
'timeout',
|
|
110
111
|
'touch',
|
|
111
112
|
'tr',
|
|
@@ -115,6 +116,7 @@ export const IGNORED_GLOBAL_BINARIES = new Set([
|
|
|
115
116
|
'uname',
|
|
116
117
|
'unexpand',
|
|
117
118
|
'uniq',
|
|
119
|
+
'unzip',
|
|
118
120
|
'wc',
|
|
119
121
|
'who',
|
|
120
122
|
'whoami',
|
package/dist/graph/analyze.js
CHANGED
|
@@ -172,16 +172,19 @@ export const analyze = async ({ analyzedFiles, chief, collector, deputy, entryPa
|
|
|
172
172
|
}
|
|
173
173
|
}
|
|
174
174
|
if (file.imports?.external) {
|
|
175
|
-
for (const
|
|
176
|
-
const packageName = getPackageNameFromModuleSpecifier(specifier);
|
|
175
|
+
for (const extImport of file.imports.external) {
|
|
176
|
+
const packageName = getPackageNameFromModuleSpecifier(extImport.specifier);
|
|
177
177
|
const isHandled = packageName && deputy.maybeAddReferencedExternalDependency(ws, packageName);
|
|
178
178
|
if (!isHandled)
|
|
179
179
|
collector.addIssue({
|
|
180
180
|
type: 'unlisted',
|
|
181
181
|
filePath,
|
|
182
182
|
workspace: ws.name,
|
|
183
|
-
symbol: packageName ?? specifier,
|
|
184
|
-
specifier,
|
|
183
|
+
symbol: packageName ?? extImport.specifier,
|
|
184
|
+
specifier: extImport.specifier,
|
|
185
|
+
pos: extImport.pos,
|
|
186
|
+
line: extImport.line,
|
|
187
|
+
col: extImport.col,
|
|
185
188
|
});
|
|
186
189
|
}
|
|
187
190
|
}
|
package/dist/graph/build.js
CHANGED
|
@@ -266,14 +266,14 @@ export async function build({ chief, collector, deputy, factory, isGitIgnored, s
|
|
|
266
266
|
const workspace = chief.findWorkspaceByFilePath(filePath);
|
|
267
267
|
if (workspace) {
|
|
268
268
|
const file = principal.analyzeSourceFile(filePath, analyzeOpts, chief.config.ignoreExportsUsedInFile);
|
|
269
|
-
const
|
|
269
|
+
const unresolvedImports = new Set();
|
|
270
270
|
for (const unresolvedImport of file.imports.unresolved) {
|
|
271
271
|
const { specifier } = unresolvedImport;
|
|
272
272
|
if (specifier.startsWith('http'))
|
|
273
273
|
continue;
|
|
274
274
|
const sanitizedSpecifier = sanitizeSpecifier(specifier);
|
|
275
275
|
if (isStartsLikePackageName(sanitizedSpecifier)) {
|
|
276
|
-
file.imports.external.add(sanitizedSpecifier);
|
|
276
|
+
file.imports.external.add({ ...unresolvedImport, specifier: sanitizedSpecifier });
|
|
277
277
|
}
|
|
278
278
|
else {
|
|
279
279
|
const isIgnored = isGitIgnored(join(dirname(filePath), sanitizedSpecifier));
|
|
@@ -281,7 +281,7 @@ export async function build({ chief, collector, deputy, factory, isGitIgnored, s
|
|
|
281
281
|
const ext = extname(sanitizedSpecifier);
|
|
282
282
|
const hasIgnoredExtension = FOREIGN_FILE_EXTENSIONS.has(ext);
|
|
283
283
|
if (!ext || (ext !== '.json' && !hasIgnoredExtension))
|
|
284
|
-
|
|
284
|
+
unresolvedImports.add(unresolvedImport);
|
|
285
285
|
}
|
|
286
286
|
}
|
|
287
287
|
}
|
|
@@ -290,10 +290,10 @@ export async function build({ chief, collector, deputy, factory, isGitIgnored, s
|
|
|
290
290
|
if (!isIgnored)
|
|
291
291
|
principal.addEntryPath(filePath, { skipExportsAnalysis: true });
|
|
292
292
|
}
|
|
293
|
-
for (const [
|
|
294
|
-
const packageName = getPackageNameFromModuleSpecifier(specifier);
|
|
293
|
+
for (const [import_, specifierFilePath] of file.imports.specifiers) {
|
|
294
|
+
const packageName = getPackageNameFromModuleSpecifier(import_.specifier);
|
|
295
295
|
if (packageName && isInternalWorkspace(packageName)) {
|
|
296
|
-
file.imports.external.add(packageName);
|
|
296
|
+
file.imports.external.add({ ...import_, specifier: packageName });
|
|
297
297
|
const principal = getPrincipalByFilePath(specifierFilePath);
|
|
298
298
|
if (principal && !isGitIgnored(specifierFilePath)) {
|
|
299
299
|
principal.addNonEntryPath(specifierFilePath);
|
|
@@ -321,7 +321,7 @@ export async function build({ chief, collector, deputy, factory, isGitIgnored, s
|
|
|
321
321
|
}
|
|
322
322
|
}
|
|
323
323
|
const node = getOrCreateFileNode(graph, filePath);
|
|
324
|
-
file.imports.unresolved =
|
|
324
|
+
file.imports.unresolved = unresolvedImports;
|
|
325
325
|
Object.assign(node, file);
|
|
326
326
|
updateImportMap(node, file.imports.internal, graph);
|
|
327
327
|
node.internalImportCache = file.imports.internal;
|
|
@@ -8,7 +8,6 @@ const enablers = ['@angular/cli'];
|
|
|
8
8
|
const isEnabled = ({ dependencies }) => hasDependency(dependencies, enablers);
|
|
9
9
|
const config = ['angular.json'];
|
|
10
10
|
const resolveConfig = async (config, options) => {
|
|
11
|
-
const { cwd, configFilePath } = options;
|
|
12
11
|
if (!config?.projects)
|
|
13
12
|
return [];
|
|
14
13
|
const inputs = new Set();
|
|
@@ -22,7 +21,7 @@ const resolveConfig = async (config, options) => {
|
|
|
22
21
|
inputs.add(toDependency(packageName));
|
|
23
22
|
if (opts) {
|
|
24
23
|
if ('tsConfig' in opts && typeof opts.tsConfig === 'string') {
|
|
25
|
-
inputs.add(toConfig('typescript', opts.tsConfig
|
|
24
|
+
inputs.add(toConfig('typescript', opts.tsConfig));
|
|
26
25
|
}
|
|
27
26
|
}
|
|
28
27
|
const defaultEntriesByOption = opts ? entriesByOption(opts) : new Map();
|
|
@@ -31,7 +30,7 @@ const resolveConfig = async (config, options) => {
|
|
|
31
30
|
const isBuildTarget = targetName === BUILD_TARGET_NAME;
|
|
32
31
|
const maybeExternal = (option) => option === 'polyfills';
|
|
33
32
|
const toInput = (specifier, opts) => {
|
|
34
|
-
const normalizedPath = join(cwd, specifier);
|
|
33
|
+
const normalizedPath = join(options.cwd, specifier);
|
|
35
34
|
if (opts.maybeExternal && !isInternal(specifier) && !existsSync(normalizedPath)) {
|
|
36
35
|
return toDeferResolve(specifier);
|
|
37
36
|
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { hasDependency } from '../../util/plugin.js';
|
|
2
|
+
const title = 'bumpp';
|
|
3
|
+
const enablers = ['bumpp'];
|
|
4
|
+
const isEnabled = ({ dependencies }) => hasDependency(dependencies, enablers);
|
|
5
|
+
const entry = ['bump.config.{mjs,ts,js,cjs,mts,cts}'];
|
|
6
|
+
export default {
|
|
7
|
+
title,
|
|
8
|
+
enablers,
|
|
9
|
+
isEnabled,
|
|
10
|
+
entry,
|
|
11
|
+
};
|
|
@@ -1,4 +1,6 @@
|
|
|
1
|
+
import type { ParsedArgs } from 'minimist';
|
|
1
2
|
import type { IsLoadConfig, IsPluginEnabled, ResolveConfig } from '../../types/config.js';
|
|
3
|
+
import { type Input } from '../../util/input.js';
|
|
2
4
|
import type { ESLintConfigDeprecated } from './types.js';
|
|
3
5
|
export declare const docs: {
|
|
4
6
|
note: string;
|
|
@@ -9,6 +11,11 @@ declare const _default: {
|
|
|
9
11
|
isEnabled: IsPluginEnabled;
|
|
10
12
|
packageJsonPath: string;
|
|
11
13
|
config: string[];
|
|
14
|
+
args: {
|
|
15
|
+
config: boolean;
|
|
16
|
+
boolean: string[];
|
|
17
|
+
resolveInputs: (parsed: ParsedArgs) => Input[];
|
|
18
|
+
};
|
|
12
19
|
isLoadConfig: IsLoadConfig;
|
|
13
20
|
resolveConfig: ResolveConfig<ESLintConfigDeprecated>;
|
|
14
21
|
};
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { toDependency } from '../../util/input.js';
|
|
1
2
|
import { hasDependency } from '../../util/plugin.js';
|
|
2
3
|
import { getInputs } from './helpers.js';
|
|
3
4
|
const title = 'ESLint';
|
|
@@ -41,12 +42,23 @@ consider using an extended glob pattern like this:
|
|
|
41
42
|
\`\`\`
|
|
42
43
|
`;
|
|
43
44
|
export const docs = { note };
|
|
45
|
+
const args = {
|
|
46
|
+
config: true,
|
|
47
|
+
boolean: ['inspect-config'],
|
|
48
|
+
resolveInputs: (parsed) => {
|
|
49
|
+
const inputs = [];
|
|
50
|
+
if (parsed['inspect-config'])
|
|
51
|
+
inputs.push(toDependency('@eslint/config-inspector', { optional: true }));
|
|
52
|
+
return inputs;
|
|
53
|
+
},
|
|
54
|
+
};
|
|
44
55
|
export default {
|
|
45
56
|
title,
|
|
46
57
|
enablers,
|
|
47
58
|
isEnabled,
|
|
48
59
|
packageJsonPath,
|
|
49
60
|
config,
|
|
61
|
+
args,
|
|
50
62
|
isLoadConfig,
|
|
51
63
|
resolveConfig,
|
|
52
64
|
};
|
package/dist/plugins/index.d.ts
CHANGED
|
@@ -39,6 +39,12 @@ export declare const Plugins: {
|
|
|
39
39
|
config: string[];
|
|
40
40
|
resolveConfig: import("../types/config.js").ResolveConfig<import("./biome/types.js").BiomeConfig>;
|
|
41
41
|
};
|
|
42
|
+
bumpp: {
|
|
43
|
+
title: string;
|
|
44
|
+
enablers: string[];
|
|
45
|
+
isEnabled: import("../types/config.js").IsPluginEnabled;
|
|
46
|
+
entry: string[];
|
|
47
|
+
};
|
|
42
48
|
bun: {
|
|
43
49
|
title: string;
|
|
44
50
|
enablers: string[];
|
|
@@ -181,6 +187,11 @@ export declare const Plugins: {
|
|
|
181
187
|
isEnabled: import("../types/config.js").IsPluginEnabled;
|
|
182
188
|
packageJsonPath: string;
|
|
183
189
|
config: string[];
|
|
190
|
+
args: {
|
|
191
|
+
config: boolean;
|
|
192
|
+
boolean: string[];
|
|
193
|
+
resolveInputs: (parsed: import("minimist").ParsedArgs) => import("../util/input.js").Input[];
|
|
194
|
+
};
|
|
184
195
|
isLoadConfig: import("../types/config.js").IsLoadConfig;
|
|
185
196
|
resolveConfig: import("../types/config.js").ResolveConfig<import("./eslint/types.js").ESLintConfigDeprecated>;
|
|
186
197
|
};
|
|
@@ -218,7 +229,6 @@ export declare const Plugins: {
|
|
|
218
229
|
glob: {
|
|
219
230
|
title: string;
|
|
220
231
|
args: {
|
|
221
|
-
binaries: string[];
|
|
222
232
|
positional: boolean;
|
|
223
233
|
alias: {
|
|
224
234
|
cmd: string[];
|
|
@@ -412,7 +422,6 @@ export declare const Plugins: {
|
|
|
412
422
|
isEnabled: import("../types/config.js").IsPluginEnabled;
|
|
413
423
|
config: string[];
|
|
414
424
|
args: {
|
|
415
|
-
binaries: string[];
|
|
416
425
|
config: boolean;
|
|
417
426
|
};
|
|
418
427
|
};
|
|
@@ -472,7 +481,6 @@ export declare const Plugins: {
|
|
|
472
481
|
isEnabled: import("../types/config.js").IsPluginEnabled;
|
|
473
482
|
config: string[];
|
|
474
483
|
args: {
|
|
475
|
-
binaries: string[];
|
|
476
484
|
config: boolean;
|
|
477
485
|
};
|
|
478
486
|
};
|
|
@@ -484,7 +492,6 @@ export declare const Plugins: {
|
|
|
484
492
|
entry: string[];
|
|
485
493
|
resolveConfig: import("../types/config.js").ResolveConfig<import("./playwright/types.js").PlaywrightTestConfig>;
|
|
486
494
|
args: {
|
|
487
|
-
binaries: string[];
|
|
488
495
|
positional: boolean;
|
|
489
496
|
args: (args: string[]) => string[];
|
|
490
497
|
config: boolean;
|
|
@@ -503,7 +510,6 @@ export declare const Plugins: {
|
|
|
503
510
|
enablers: string[];
|
|
504
511
|
isEnabled: import("../types/config.js").IsPluginEnabled;
|
|
505
512
|
args: {
|
|
506
|
-
binaries: string[];
|
|
507
513
|
positional: boolean;
|
|
508
514
|
args: (args: string[]) => string[];
|
|
509
515
|
config: boolean;
|
|
@@ -518,6 +524,7 @@ export declare const Plugins: {
|
|
|
518
524
|
pnpm: {
|
|
519
525
|
title: string;
|
|
520
526
|
isEnabled: import("../types/config.js").IsPluginEnabled;
|
|
527
|
+
isRootOnly: true;
|
|
521
528
|
config: string[];
|
|
522
529
|
};
|
|
523
530
|
postcss: {
|
|
@@ -547,7 +554,6 @@ export declare const Plugins: {
|
|
|
547
554
|
isEnabled: import("../types/config.js").IsPluginEnabled;
|
|
548
555
|
config: string[];
|
|
549
556
|
args: {
|
|
550
|
-
binaries: string[];
|
|
551
557
|
config: boolean;
|
|
552
558
|
};
|
|
553
559
|
resolveConfig: import("../types/config.js").ResolveConfig<import("./prisma/types.js").PrismaConfig>;
|
|
@@ -629,6 +635,13 @@ export declare const Plugins: {
|
|
|
629
635
|
config: string[];
|
|
630
636
|
resolveConfig: import("../types/config.js").ResolveConfig<import("./webpack/types.js").WebpackConfig>;
|
|
631
637
|
};
|
|
638
|
+
rstest: {
|
|
639
|
+
title: string;
|
|
640
|
+
enablers: string[];
|
|
641
|
+
isEnabled: import("../types/config.js").IsPluginEnabled;
|
|
642
|
+
config: string[];
|
|
643
|
+
resolveConfig: import("../types/config.js").ResolveConfig<import("./rstest/types.js").RstestConfig>;
|
|
644
|
+
};
|
|
632
645
|
'semantic-release': {
|
|
633
646
|
title: string;
|
|
634
647
|
enablers: string[];
|
|
@@ -732,7 +745,6 @@ export declare const Plugins: {
|
|
|
732
745
|
'ts-node': {
|
|
733
746
|
title: string;
|
|
734
747
|
args: {
|
|
735
|
-
binaries: string[];
|
|
736
748
|
positional: boolean;
|
|
737
749
|
nodeImportArgs: boolean;
|
|
738
750
|
boolean: string[];
|
package/dist/plugins/index.js
CHANGED
|
@@ -3,6 +3,7 @@ import { default as astro } from './astro/index.js';
|
|
|
3
3
|
import { default as ava } from './ava/index.js';
|
|
4
4
|
import { default as babel } from './babel/index.js';
|
|
5
5
|
import { default as biome } from './biome/index.js';
|
|
6
|
+
import { default as bumpp } from './bumpp/index.js';
|
|
6
7
|
import { default as bun } from './bun/index.js';
|
|
7
8
|
import { default as c8 } from './c8/index.js';
|
|
8
9
|
import { default as capacitor } from './capacitor/index.js';
|
|
@@ -76,6 +77,7 @@ import { default as rollup } from './rollup/index.js';
|
|
|
76
77
|
import { default as rsbuild } from './rsbuild/index.js';
|
|
77
78
|
import { default as rslib } from './rslib/index.js';
|
|
78
79
|
import { default as rspack } from './rspack/index.js';
|
|
80
|
+
import { default as rstest } from './rstest/index.js';
|
|
79
81
|
import { default as semanticRelease } from './semantic-release/index.js';
|
|
80
82
|
import { default as sentry } from './sentry/index.js';
|
|
81
83
|
import { default as simpleGitHooks } from './simple-git-hooks/index.js';
|
|
@@ -116,6 +118,7 @@ export const Plugins = {
|
|
|
116
118
|
ava,
|
|
117
119
|
babel,
|
|
118
120
|
biome,
|
|
121
|
+
bumpp,
|
|
119
122
|
bun,
|
|
120
123
|
c8,
|
|
121
124
|
capacitor,
|
|
@@ -189,6 +192,7 @@ export const Plugins = {
|
|
|
189
192
|
rsbuild,
|
|
190
193
|
rslib,
|
|
191
194
|
rspack,
|
|
195
|
+
rstest,
|
|
192
196
|
'semantic-release': semanticRelease,
|
|
193
197
|
sentry,
|
|
194
198
|
'simple-git-hooks': simpleGitHooks,
|
|
@@ -15,7 +15,7 @@ export const inputsFromPlugins = (plugins, devDependencies) => {
|
|
|
15
15
|
return;
|
|
16
16
|
return isInternal(plugin) ? toDeferResolveEntry(plugin) : toDependency(plugin);
|
|
17
17
|
})
|
|
18
|
-
.filter(input => !!input);
|
|
18
|
+
.filter((input) => !!input);
|
|
19
19
|
};
|
|
20
20
|
export const loadConfig = (configFile) => {
|
|
21
21
|
if (typeof configFile !== 'function')
|
|
@@ -5,7 +5,6 @@ const enablers = ['node-modules-inspector'];
|
|
|
5
5
|
const isEnabled = ({ dependencies }) => hasDependency(dependencies, enablers);
|
|
6
6
|
const config = [...toUnconfig('node-modules-inspector.config')];
|
|
7
7
|
const args = {
|
|
8
|
-
binaries: ['node-modules-inspector'],
|
|
9
8
|
config: true,
|
|
10
9
|
};
|
|
11
10
|
export default {
|
|
@@ -34,7 +34,13 @@ const resolveConfig = async (localConfig) => {
|
|
|
34
34
|
'server/middleware/**/*.ts',
|
|
35
35
|
'server/plugins/**/*.ts',
|
|
36
36
|
].map(pattern => toProductionEntry(join(srcDir, pattern)));
|
|
37
|
-
const deps = localConfig.modules?.
|
|
37
|
+
const deps = localConfig.modules?.reduce((acc, id) => {
|
|
38
|
+
if (Array.isArray(id) && typeof id[0] === 'string')
|
|
39
|
+
acc.push(toDependency(id[0]));
|
|
40
|
+
if (typeof id === 'string')
|
|
41
|
+
acc.push(toDependency(id));
|
|
42
|
+
return acc;
|
|
43
|
+
}, []) ?? [];
|
|
38
44
|
return [...deps, ...patterns];
|
|
39
45
|
};
|
|
40
46
|
const note = `Knip works best with [explicit imports](https://nuxt.com/docs/guide/concepts/auto-imports#explicit-imports).
|
|
@@ -3,7 +3,6 @@ const title = 'playwright-test';
|
|
|
3
3
|
const enablers = ['playwright-test'];
|
|
4
4
|
const isEnabled = ({ dependencies }) => hasDependency(dependencies, enablers);
|
|
5
5
|
const args = {
|
|
6
|
-
binaries: ['playwright-test'],
|
|
7
6
|
positional: true,
|
|
8
7
|
args: (args) => args.filter(arg => arg !== 'install' && arg !== 'test'),
|
|
9
8
|
config: true,
|