knip 5.76.1 → 5.76.2
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/binaries/package-manager/bun.js +7 -4
- package/dist/binaries/package-manager/npm.js +9 -4
- package/dist/binaries/package-manager/pnpm.js +8 -4
- package/dist/binaries/package-manager/yarn.js +5 -4
- package/dist/cli.js +2 -1
- package/dist/graph/build.d.ts +1 -0
- package/dist/graph/build.js +1 -0
- package/dist/index.d.ts +3 -0
- package/dist/plugins/nx/index.d.ts +3 -0
- package/dist/plugins/nx/index.js +3 -0
- package/dist/reporters/util/configuration-hints.d.ts +1 -1
- package/dist/reporters/util/configuration-hints.js +2 -2
- package/dist/run.d.ts +3 -0
- package/dist/run.js +2 -1
- package/dist/types/issues.d.ts +1 -0
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/package.json +1 -1
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import parseArgs from 'minimist';
|
|
2
|
-
import { isFile } from '../../util/fs.js';
|
|
3
2
|
import { toEntry } from '../../util/input.js';
|
|
4
3
|
import { isAbsolute, join } from '../../util/path.js';
|
|
4
|
+
import { _resolveSync } from '../../util/resolve.js';
|
|
5
5
|
import { resolveX } from './bunx.js';
|
|
6
6
|
const commands = [
|
|
7
7
|
'add',
|
|
@@ -46,9 +46,12 @@ export const resolve = (_binary, args, options) => {
|
|
|
46
46
|
if (command !== 'run' && commands.includes(command))
|
|
47
47
|
return [];
|
|
48
48
|
const filePath = command === 'run' ? script : command;
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
49
|
+
if (!filePath)
|
|
50
|
+
return [];
|
|
51
|
+
const _cwd = parsed.cwd ? join(cwd, parsed.cwd) : cwd;
|
|
52
|
+
const resolved = _resolveSync(isAbsolute(filePath) ? filePath : join(_cwd, filePath), _cwd);
|
|
53
|
+
if (resolved)
|
|
54
|
+
return [toEntry(resolved)];
|
|
52
55
|
const dir = parsed.cwd ? join(cwd, parsed.cwd) : undefined;
|
|
53
56
|
const opts = dir ? { cwd: dir } : {};
|
|
54
57
|
return command === 'run' ? [] : fromArgs(args, opts);
|
|
@@ -1,7 +1,12 @@
|
|
|
1
1
|
import parseArgs from 'minimist';
|
|
2
2
|
export const resolve = (_binary, args, options) => {
|
|
3
|
-
const { fromArgs } = options;
|
|
4
|
-
const parsed = parseArgs(args);
|
|
5
|
-
const [command] = parsed._;
|
|
6
|
-
|
|
3
|
+
const { fromArgs, manifestScriptNames } = options;
|
|
4
|
+
const parsed = parseArgs(args, { '--': true });
|
|
5
|
+
const [command, script] = parsed._;
|
|
6
|
+
const _childArgs = parsed['--'] && parsed['--'].length > 0 ? fromArgs(parsed['--']) : [];
|
|
7
|
+
if (command === 'exec')
|
|
8
|
+
return _childArgs;
|
|
9
|
+
if (command === 'run' && manifestScriptNames.has(script))
|
|
10
|
+
return _childArgs;
|
|
11
|
+
return [];
|
|
7
12
|
};
|
|
@@ -64,6 +64,7 @@ export const resolve = (_binary, args, options) => {
|
|
|
64
64
|
const parsed = parseArgs(args, {
|
|
65
65
|
boolean: ['recursive', 'silent', 'shell-mode'],
|
|
66
66
|
alias: { recursive: 'r', silent: 's', 'shell-mode': 'c', filter: 'F' },
|
|
67
|
+
'--': true,
|
|
67
68
|
});
|
|
68
69
|
const [command] = parsed._;
|
|
69
70
|
if (command === 'dlx') {
|
|
@@ -73,9 +74,12 @@ export const resolve = (_binary, args, options) => {
|
|
|
73
74
|
const { manifestScriptNames, fromArgs } = options;
|
|
74
75
|
if (parsed.filter && !parsed.recursive)
|
|
75
76
|
return [];
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
77
|
+
const childInputs = parsed['--'] && parsed['--'].length > 0 ? fromArgs(parsed['--']) : [];
|
|
78
|
+
if (command === 'exec') {
|
|
79
|
+
return childInputs.length > 0 ? childInputs : fromArgs(parsed._.slice(1));
|
|
80
|
+
}
|
|
81
|
+
const isScript = manifestScriptNames.has(command);
|
|
82
|
+
if (isScript || commands.includes(command))
|
|
83
|
+
return childInputs;
|
|
80
84
|
return command ? [toBinary(command)] : [];
|
|
81
85
|
};
|
|
@@ -50,18 +50,19 @@ const resolveDlx = (args, options) => {
|
|
|
50
50
|
};
|
|
51
51
|
export const resolve = (_binary, args, options) => {
|
|
52
52
|
const { manifestScriptNames, fromArgs, cwd, rootCwd } = options;
|
|
53
|
-
const parsed = parseArgs(args, { boolean: ['top-level'], string: ['cwd'] });
|
|
53
|
+
const parsed = parseArgs(args, { boolean: ['top-level'], string: ['cwd'], '--': true });
|
|
54
54
|
const dir = parsed['top-level'] ? rootCwd : parsed.cwd ? join(cwd, parsed.cwd) : undefined;
|
|
55
55
|
const [command, binary] = parsed._;
|
|
56
56
|
if (!command && !binary)
|
|
57
57
|
return [];
|
|
58
|
+
const _childArgs = parsed['--'] && parsed['--'].length > 0 ? fromArgs(parsed['--']) : [];
|
|
58
59
|
if (command === 'run') {
|
|
59
60
|
if (manifestScriptNames.has(binary))
|
|
60
|
-
return
|
|
61
|
+
return _childArgs;
|
|
61
62
|
const bin = toBinary(binary, { optional: true });
|
|
62
63
|
if (dir)
|
|
63
64
|
Object.assign(bin, { dir });
|
|
64
|
-
return [bin];
|
|
65
|
+
return [bin, ..._childArgs];
|
|
65
66
|
}
|
|
66
67
|
if (command === 'node')
|
|
67
68
|
return fromArgs(parsed._);
|
|
@@ -70,7 +71,7 @@ export const resolve = (_binary, args, options) => {
|
|
|
70
71
|
return resolveDlx(argsForDlx, options);
|
|
71
72
|
}
|
|
72
73
|
if ((!dir && manifestScriptNames.has(command)) || commands.includes(command))
|
|
73
|
-
return
|
|
74
|
+
return _childArgs;
|
|
74
75
|
const opts = dir ? { cwd: dir } : {};
|
|
75
76
|
return fromArgs(argsFrom(args, command === 'exec' ? binary : command), opts);
|
|
76
77
|
};
|
package/dist/cli.js
CHANGED
|
@@ -30,7 +30,7 @@ const run = async () => {
|
|
|
30
30
|
console.log(version);
|
|
31
31
|
process.exit(0);
|
|
32
32
|
}
|
|
33
|
-
const { issues, counters, tagHints, configurationHints, includedWorkspaceDirs } = await main(options);
|
|
33
|
+
const { issues, counters, tagHints, configurationHints, includedWorkspaceDirs, enabledPlugins } = await main(options);
|
|
34
34
|
if (options.isWatch || options.isTrace)
|
|
35
35
|
return;
|
|
36
36
|
const initialData = {
|
|
@@ -39,6 +39,7 @@ const run = async () => {
|
|
|
39
39
|
counters,
|
|
40
40
|
tagHints,
|
|
41
41
|
configurationHints,
|
|
42
|
+
enabledPlugins,
|
|
42
43
|
includedWorkspaceDirs,
|
|
43
44
|
cwd: options.cwd,
|
|
44
45
|
configFilePath: options.configFilePath,
|
package/dist/graph/build.d.ts
CHANGED
|
@@ -24,5 +24,6 @@ export declare function build({ chief, collector, counselor, deputy, factory, is
|
|
|
24
24
|
analyzedFiles: Set<string>;
|
|
25
25
|
unreferencedFiles: Set<string>;
|
|
26
26
|
analyzeSourceFile: (filePath: string, principal: ProjectPrincipal) => void;
|
|
27
|
+
enabledPluginsStore: Map<string, string[]>;
|
|
27
28
|
}>;
|
|
28
29
|
export {};
|
package/dist/graph/build.js
CHANGED
package/dist/index.d.ts
CHANGED
|
@@ -5,4 +5,7 @@ export declare const main: (options: MainOptions) => Promise<{
|
|
|
5
5
|
tagHints: Set<import("./types/issues.js").TagHint>;
|
|
6
6
|
configurationHints: Set<import("./types/issues.js").ConfigurationHint>;
|
|
7
7
|
includedWorkspaceDirs: string[];
|
|
8
|
+
enabledPlugins: {
|
|
9
|
+
[k: string]: string[];
|
|
10
|
+
};
|
|
8
11
|
}>;
|
package/dist/plugins/nx/index.js
CHANGED
|
@@ -51,6 +51,9 @@ const resolveConfig = async (localConfig, options) => {
|
|
|
51
51
|
const args = {
|
|
52
52
|
fromArgs: (parsed) => (parsed._[0] === 'exec' ? parsed._.slice(1) : []),
|
|
53
53
|
};
|
|
54
|
+
export const docs = {
|
|
55
|
+
note: `Also see [integrated monorepos](/features/integrated-monorepos) and the note regarding internal workspace dependencies.`,
|
|
56
|
+
};
|
|
54
57
|
const plugin = {
|
|
55
58
|
title,
|
|
56
59
|
enablers,
|
|
@@ -19,4 +19,4 @@ export declare const finalizeConfigurationHints: (results: Results, options: {
|
|
|
19
19
|
cwd: string;
|
|
20
20
|
configFilePath?: string;
|
|
21
21
|
}) => ProcessedHint[];
|
|
22
|
-
export declare const printConfigurationHints: ({ cwd, counters, issues, tagHints, configurationHints, isTreatConfigHintsAsErrors, includedWorkspaceDirs, configFilePath, }: ReporterOptions) => void;
|
|
22
|
+
export declare const printConfigurationHints: ({ cwd, counters, issues, tagHints, configurationHints, enabledPlugins, isTreatConfigHintsAsErrors, includedWorkspaceDirs, configFilePath, }: ReporterOptions) => void;
|
|
@@ -102,8 +102,8 @@ export const finalizeConfigurationHints = (results, options) => {
|
|
|
102
102
|
return row;
|
|
103
103
|
}));
|
|
104
104
|
};
|
|
105
|
-
export const printConfigurationHints = ({ cwd, counters, issues, tagHints, configurationHints, isTreatConfigHintsAsErrors, includedWorkspaceDirs, configFilePath, }) => {
|
|
106
|
-
const rows = finalizeConfigurationHints({ issues, counters, configurationHints, tagHints, includedWorkspaceDirs }, { cwd, configFilePath });
|
|
105
|
+
export const printConfigurationHints = ({ cwd, counters, issues, tagHints, configurationHints, enabledPlugins, isTreatConfigHintsAsErrors, includedWorkspaceDirs, configFilePath, }) => {
|
|
106
|
+
const rows = finalizeConfigurationHints({ issues, counters, configurationHints, tagHints, includedWorkspaceDirs, enabledPlugins }, { cwd, configFilePath });
|
|
107
107
|
if (rows.length > 0) {
|
|
108
108
|
const getTitle = isTreatConfigHintsAsErrors ? getColoredTitle : getDimmedTitle;
|
|
109
109
|
console.log(getTitle('Configuration hints', configurationHints.size));
|
package/dist/run.d.ts
CHANGED
|
@@ -8,6 +8,9 @@ export declare const run: (options: MainOptions) => Promise<{
|
|
|
8
8
|
tagHints: Set<import("./types/issues.js").TagHint>;
|
|
9
9
|
configurationHints: Set<import("./types/issues.js").ConfigurationHint>;
|
|
10
10
|
includedWorkspaceDirs: string[];
|
|
11
|
+
enabledPlugins: {
|
|
12
|
+
[k: string]: string[];
|
|
13
|
+
};
|
|
11
14
|
};
|
|
12
15
|
session: {
|
|
13
16
|
listener: import("fs").WatchListener<string | Buffer<ArrayBufferLike>>;
|
package/dist/run.js
CHANGED
|
@@ -29,7 +29,7 @@ export const run = async (options) => {
|
|
|
29
29
|
collector.setIgnoreIssues(chief.config.ignoreIssues);
|
|
30
30
|
debugLogObject('*', 'Included workspaces', () => workspaces.map(w => w.pkgName));
|
|
31
31
|
debugLogObject('*', 'Included workspace configs', () => workspaces.map(w => ({ pkgName: w.pkgName, name: w.name, config: w.config, ancestors: w.ancestors })));
|
|
32
|
-
const { graph, entryPaths, analyzedFiles, unreferencedFiles, analyzeSourceFile } = await build({
|
|
32
|
+
const { graph, entryPaths, analyzedFiles, unreferencedFiles, analyzeSourceFile, enabledPluginsStore } = await build({
|
|
33
33
|
chief,
|
|
34
34
|
collector,
|
|
35
35
|
counselor,
|
|
@@ -100,6 +100,7 @@ export const run = async (options) => {
|
|
|
100
100
|
tagHints,
|
|
101
101
|
configurationHints,
|
|
102
102
|
includedWorkspaceDirs: chief.includedWorkspaces.map(w => w.dir),
|
|
103
|
+
enabledPlugins: Object.fromEntries(enabledPluginsStore),
|
|
103
104
|
},
|
|
104
105
|
session,
|
|
105
106
|
streamer,
|
package/dist/types/issues.d.ts
CHANGED
package/dist/version.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const version = "5.76.
|
|
1
|
+
export declare const version = "5.76.2";
|
package/dist/version.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const version = '5.76.
|
|
1
|
+
export const version = '5.76.2';
|