Skip to content

Commit e028528

Browse files
committed
Move helper to less confusing location
1 parent 20070ba commit e028528

File tree

3 files changed

+9
-9
lines changed

3 files changed

+9
-9
lines changed

‎packages/knip/src/binaries/bash-parser.ts‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,8 @@ import { debugLogObject } from '../util/debug.js';
55
import { type Input, toBinary, toDeferResolve } from '../util/input.js';
66
import { resolve as fallbackResolve } from './fallback.js';
77
import PackageManagerResolvers from './package-manager/index.js';
8-
import { parseNodeArgs } from './package-manager/node.js';
98
import { resolve as resolverFromPlugins } from './plugins.js';
10-
import { trimBinary } from './util.js';
9+
import { parseNodeArgs, trimBinary } from './util.js';
1110

1211
// https://vorpaljs.github.io/bash-parser-playground/
1312

‎packages/knip/src/binaries/package-manager/node.ts‎

Lines changed: 0 additions & 7 deletions
This file was deleted.

‎packages/knip/src/binaries/util.ts‎

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
import parseArgs from 'minimist';
2+
13
export const stripVersionFromSpecifier = (specifier: string) => specifier.replace(/(\S+)@.*/, '$1');
24

35
const stripNodeModulesFromPath = (command: string) => command.replace(/^(\.\/)?node_modules\//, '');
@@ -10,3 +12,9 @@ export const trimBinary = (command: string) =>
1012
);
1113

1214
export const argsFrom = (args: string[], from: string) => args.slice(args.indexOf(from));
15+
16+
export const parseNodeArgs = (args: string[]) =>
17+
parseArgs(args, {
18+
string: ['r'],
19+
alias: { require: ['r', 'loader', 'experimental-loader', 'test-reporter', 'watch', 'import'] },
20+
});

0 commit comments

Comments
 (0)