knip 5.34.0 → 5.34.1
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/bash-parser.js +1 -2
- package/dist/binaries/index.js +4 -2
- package/dist/binaries/util.d.ts +2 -0
- package/dist/binaries/util.js +5 -0
- package/dist/index.js +2 -2
- package/dist/util/{handle-referenced-dependency.d.ts → handle-referenced-inputs.d.ts} +1 -1
- package/dist/util/{handle-referenced-dependency.js → handle-referenced-inputs.js} +6 -2
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/package.json +1 -1
- package/dist/binaries/package-manager/node.d.ts +0 -2
- package/dist/binaries/package-manager/node.js +0 -5
|
@@ -4,9 +4,8 @@ import { debugLogObject } from '../util/debug.js';
|
|
|
4
4
|
import { toBinary, toDeferResolve } from '../util/input.js';
|
|
5
5
|
import { resolve as fallbackResolve } from './fallback.js';
|
|
6
6
|
import PackageManagerResolvers from './package-manager/index.js';
|
|
7
|
-
import { parseNodeArgs } from './package-manager/node.js';
|
|
8
7
|
import { resolve as resolverFromPlugins } from './plugins.js';
|
|
9
|
-
import { trimBinary } from './util.js';
|
|
8
|
+
import { parseNodeArgs, trimBinary } from './util.js';
|
|
10
9
|
const spawningBinaries = ['cross-env', 'retry-cli'];
|
|
11
10
|
const isExpansion = (node) => 'expansion' in node;
|
|
12
11
|
const isAssignment = (node) => 'type' in node && node.type === 'AssignmentWord';
|
package/dist/binaries/index.js
CHANGED
|
@@ -1,12 +1,14 @@
|
|
|
1
1
|
import { timerify } from '../util/Performance.js';
|
|
2
|
-
import { fromBinary, isBinary } from '../util/input.js';
|
|
2
|
+
import { fromBinary, isBinary, isDependency } from '../util/input.js';
|
|
3
3
|
import { getDependenciesFromScript } from './bash-parser.js';
|
|
4
4
|
const getInputsFromScripts = (npmScripts, options) => {
|
|
5
5
|
const scripts = typeof npmScripts === 'string' ? [npmScripts] : Array.from(npmScripts);
|
|
6
6
|
const results = scripts.flatMap(script => getDependenciesFromScript(script, options));
|
|
7
7
|
const inputs = new Set();
|
|
8
8
|
for (const input of results) {
|
|
9
|
-
if (!input.specifier
|
|
9
|
+
if (!input.specifier)
|
|
10
|
+
continue;
|
|
11
|
+
if (isDependency(input) && input.specifier.startsWith('http'))
|
|
10
12
|
continue;
|
|
11
13
|
if (isBinary(input) && !/^\b/.test(fromBinary(input)))
|
|
12
14
|
continue;
|
package/dist/binaries/util.d.ts
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import parseArgs from 'minimist';
|
|
1
2
|
export declare const stripVersionFromSpecifier: (specifier: string) => string;
|
|
2
3
|
export declare const trimBinary: (command: string) => string;
|
|
3
4
|
export declare const argsFrom: (args: string[], from: string) => string[];
|
|
5
|
+
export declare const parseNodeArgs: (args: string[]) => parseArgs.ParsedArgs;
|
package/dist/binaries/util.js
CHANGED
|
@@ -1,6 +1,11 @@
|
|
|
1
|
+
import parseArgs from 'minimist';
|
|
1
2
|
export const stripVersionFromSpecifier = (specifier) => specifier.replace(/(\S+)@.*/, '$1');
|
|
2
3
|
const stripNodeModulesFromPath = (command) => command.replace(/^(\.\/)?node_modules\//, '');
|
|
3
4
|
export const trimBinary = (command) => stripVersionFromSpecifier(stripNodeModulesFromPath(command)
|
|
4
5
|
.replace(/^(\.bin\/)/, '')
|
|
5
6
|
.replace(/\$\(npm bin\)\/(\w+)/, '$1'));
|
|
6
7
|
export const argsFrom = (args, from) => args.slice(args.indexOf(from));
|
|
8
|
+
export const parseNodeArgs = (args) => parseArgs(args, {
|
|
9
|
+
string: ['r'],
|
|
10
|
+
alias: { require: ['r', 'loader', 'experimental-loader', 'test-reporter', 'watch', 'import'] },
|
|
11
|
+
});
|
package/dist/index.js
CHANGED
|
@@ -12,7 +12,7 @@ import { debugLog, debugLogArray, debugLogObject } from './util/debug.js';
|
|
|
12
12
|
import { getOrCreateFileNode, updateImportMap } from './util/dependency-graph.js';
|
|
13
13
|
import { getGitIgnoredHandler } from './util/glob-core.js';
|
|
14
14
|
import { _glob, negate } from './util/glob.js';
|
|
15
|
-
import {
|
|
15
|
+
import { getReferencedInputsHandler } from './util/handle-referenced-inputs.js';
|
|
16
16
|
import { getHasStrictlyNsReferences, getType } from './util/has-strictly-ns-references.js';
|
|
17
17
|
import { isConfigPattern, isEntry, isProductionEntry, toProductionEntry } from './util/input.js';
|
|
18
18
|
import { getIsIdentifierReferencedHandler } from './util/is-identifier-referenced.js';
|
|
@@ -59,7 +59,7 @@ export const main = async (unresolvedConfiguration) => {
|
|
|
59
59
|
debugLogObject('*', 'Included workspace configs', o);
|
|
60
60
|
const isGitIgnored = await getGitIgnoredHandler({ cwd, gitignore });
|
|
61
61
|
const toSourceFilePath = getToSourcePathHandler(chief);
|
|
62
|
-
const getReferencedInternalFilePath =
|
|
62
|
+
const getReferencedInternalFilePath = getReferencedInputsHandler(collector, deputy, chief, isGitIgnored);
|
|
63
63
|
const shouldIgnore = getShouldIgnoreHandler(isProduction);
|
|
64
64
|
const shouldIgnoreTags = getShouldIgnoreTagHandler(tags);
|
|
65
65
|
for (const workspace of workspaces) {
|
|
@@ -2,4 +2,4 @@ import type { ConfigurationChief, Workspace } from '../ConfigurationChief.js';
|
|
|
2
2
|
import type { DependencyDeputy } from '../DependencyDeputy.js';
|
|
3
3
|
import type { IssueCollector } from '../IssueCollector.js';
|
|
4
4
|
import { type Input } from './input.js';
|
|
5
|
-
export declare const
|
|
5
|
+
export declare const getReferencedInputsHandler: (collector: IssueCollector, deputy: DependencyDeputy, chief: ConfigurationChief, isGitIgnored: (s: string) => boolean) => (input: Input, workspace: Workspace) => string | undefined;
|
|
@@ -1,14 +1,18 @@
|
|
|
1
|
+
import { trimBinary } from '../binaries/util.js';
|
|
1
2
|
import { IGNORED_RUNTIME_DEPENDENCIES } from '../constants.js';
|
|
2
3
|
import { debugLog } from './debug.js';
|
|
3
|
-
import { toDebugString } from './input.js';
|
|
4
|
+
import { toBinary, toDebugString } from './input.js';
|
|
4
5
|
import { fromBinary, isBinary, isConfigPattern, isDeferResolveEntry, isDependency } from './input.js';
|
|
5
6
|
import { getPackageNameFromSpecifier } from './modules.js';
|
|
6
7
|
import { dirname, isAbsolute, isInternal, join } from './path.js';
|
|
7
8
|
import { _resolveSync } from './resolve.js';
|
|
8
|
-
export const
|
|
9
|
+
export const getReferencedInputsHandler = (collector, deputy, chief, isGitIgnored) => (input, workspace) => {
|
|
9
10
|
const { specifier, containingFilePath } = input;
|
|
10
11
|
if (!containingFilePath || IGNORED_RUNTIME_DEPENDENCIES.has(specifier))
|
|
11
12
|
return;
|
|
13
|
+
if (isDeferResolveEntry(input) && specifier.includes('node_modules/.bin')) {
|
|
14
|
+
Object.assign(input, toBinary(trimBinary(input.specifier)));
|
|
15
|
+
}
|
|
12
16
|
if (isBinary(input)) {
|
|
13
17
|
const binaryName = fromBinary(input);
|
|
14
18
|
const ws = (input.dir && chief.findWorkspaceByFilePath(`${input.dir}/`)) || workspace;
|
package/dist/version.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const version = "5.34.
|
|
1
|
+
export declare const version = "5.34.1";
|
package/dist/version.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const version = '5.34.
|
|
1
|
+
export const version = '5.34.1';
|
package/package.json
CHANGED