knip 5.42.0 → 5.42.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/ConfigurationChief.d.ts +1 -0
- package/dist/ConfigurationValidator.d.ts +56 -0
- package/dist/IssueCollector.js +6 -4
- package/dist/binaries/package-manager/bun.js +8 -2
- package/dist/binaries/package-manager/bunx.d.ts +3 -0
- package/dist/binaries/package-manager/bunx.js +18 -0
- package/dist/binaries/package-manager/index.d.ts +2 -0
- package/dist/binaries/package-manager/index.js +4 -0
- package/dist/binaries/package-manager/npm.js +1 -2
- package/dist/binaries/package-manager/npx.js +7 -2
- package/dist/binaries/package-manager/pnpm.js +7 -1
- package/dist/binaries/package-manager/pnpx.d.ts +3 -0
- package/dist/binaries/package-manager/pnpx.js +18 -0
- package/dist/binaries/package-manager/yarn.js +4 -3
- package/dist/binaries/plugins.js +7 -2
- package/dist/compilers/index.d.ts +10 -0
- package/dist/index.js +6 -6
- package/dist/plugins/capacitor/index.js +1 -1
- package/dist/plugins/changesets/index.js +1 -1
- package/dist/plugins/commitlint/index.js +1 -1
- package/dist/plugins/dependency-cruiser/index.d.ts +12 -0
- package/dist/plugins/dependency-cruiser/index.js +16 -0
- package/dist/plugins/expo/helpers.js +1 -1
- package/dist/plugins/gatsby/index.js +1 -1
- package/dist/plugins/graphql-codegen/index.js +1 -1
- package/dist/plugins/index.d.ts +10 -2
- package/dist/plugins/index.js +2 -0
- package/dist/plugins/lefthook/index.js +2 -2
- package/dist/plugins/markdownlint/index.js +1 -1
- package/dist/plugins/metro/index.d.ts +1 -1
- package/dist/plugins/metro/index.js +3 -4
- package/dist/plugins/nest/index.js +1 -1
- package/dist/plugins/netlify/index.js +2 -2
- package/dist/plugins/npm-package-json-lint/index.js +1 -1
- package/dist/plugins/nuxt/index.d.ts +3 -1
- package/dist/plugins/nuxt/index.js +3 -3
- package/dist/plugins/nx/index.js +1 -1
- package/dist/plugins/oclif/index.js +1 -1
- package/dist/plugins/prettier/index.js +1 -1
- package/dist/plugins/release-it/index.js +1 -1
- package/dist/plugins/semantic-release/index.js +7 -1
- package/dist/plugins/storybook/index.js +5 -1
- package/dist/plugins/typescript/index.d.ts +3 -0
- package/dist/plugins/typescript/index.js +2 -0
- package/dist/plugins/vitest/index.js +1 -1
- package/dist/plugins/webdriver-io/index.js +1 -1
- package/dist/reporters/symbols.js +6 -1
- package/dist/schema/plugins.d.ts +23 -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/config.d.ts +1 -2
- package/dist/typescript/visitors/helpers.d.ts +1 -1
- package/dist/typescript/visitors/helpers.js +2 -2
- package/dist/typescript/visitors/scripts/bun.js +1 -1
- package/dist/typescript/visitors/scripts/execa.js +24 -1
- package/dist/util/get-referenced-inputs.js +4 -2
- package/dist/util/input.d.ts +3 -1
- package/dist/util/input.js +5 -1
- package/dist/util/modules.js +1 -1
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/package.json +3 -2
- package/schema.json +4 -0
|
@@ -83,6 +83,7 @@ export declare class ConfigurationChief {
|
|
|
83
83
|
cspell?: (boolean | import("./types/config.js").EnsuredPluginConfiguration) | undefined;
|
|
84
84
|
cucumber?: (boolean | import("./types/config.js").EnsuredPluginConfiguration) | undefined;
|
|
85
85
|
cypress?: (boolean | import("./types/config.js").EnsuredPluginConfiguration) | undefined;
|
|
86
|
+
"dependency-cruiser"?: (boolean | import("./types/config.js").EnsuredPluginConfiguration) | undefined;
|
|
86
87
|
dotenv?: (boolean | import("./types/config.js").EnsuredPluginConfiguration) | undefined;
|
|
87
88
|
drizzle?: (boolean | import("./types/config.js").EnsuredPluginConfiguration) | undefined;
|
|
88
89
|
eleventy?: (boolean | import("./types/config.js").EnsuredPluginConfiguration) | undefined;
|
|
@@ -184,6 +184,19 @@ export declare const ConfigurationValidator: z.ZodObject<z.objectUtil.extendShap
|
|
|
184
184
|
entry?: string | string[] | undefined;
|
|
185
185
|
project?: string | string[] | undefined;
|
|
186
186
|
}>]>>;
|
|
187
|
+
'dependency-cruiser': z.ZodOptional<z.ZodUnion<[z.ZodBoolean, z.ZodUnion<[z.ZodString, z.ZodArray<z.ZodString, "many">]>, z.ZodObject<{
|
|
188
|
+
config: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodArray<z.ZodString, "many">]>>;
|
|
189
|
+
entry: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodArray<z.ZodString, "many">]>>;
|
|
190
|
+
project: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodArray<z.ZodString, "many">]>>;
|
|
191
|
+
}, "strip", z.ZodTypeAny, {
|
|
192
|
+
config?: string | string[] | undefined;
|
|
193
|
+
entry?: string | string[] | undefined;
|
|
194
|
+
project?: string | string[] | undefined;
|
|
195
|
+
}, {
|
|
196
|
+
config?: string | string[] | undefined;
|
|
197
|
+
entry?: string | string[] | undefined;
|
|
198
|
+
project?: string | string[] | undefined;
|
|
199
|
+
}>]>>;
|
|
187
200
|
dotenv: z.ZodOptional<z.ZodUnion<[z.ZodBoolean, z.ZodUnion<[z.ZodString, z.ZodArray<z.ZodString, "many">]>, z.ZodObject<{
|
|
188
201
|
config: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodArray<z.ZodString, "many">]>>;
|
|
189
202
|
entry: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodArray<z.ZodString, "many">]>>;
|
|
@@ -1266,6 +1279,11 @@ export declare const ConfigurationValidator: z.ZodObject<z.objectUtil.extendShap
|
|
|
1266
1279
|
entry?: string | string[] | undefined;
|
|
1267
1280
|
project?: string | string[] | undefined;
|
|
1268
1281
|
} | undefined;
|
|
1282
|
+
'dependency-cruiser'?: string | boolean | string[] | {
|
|
1283
|
+
config?: string | string[] | undefined;
|
|
1284
|
+
entry?: string | string[] | undefined;
|
|
1285
|
+
project?: string | string[] | undefined;
|
|
1286
|
+
} | undefined;
|
|
1269
1287
|
dotenv?: string | boolean | string[] | {
|
|
1270
1288
|
config?: string | string[] | undefined;
|
|
1271
1289
|
entry?: string | string[] | undefined;
|
|
@@ -1725,6 +1743,11 @@ export declare const ConfigurationValidator: z.ZodObject<z.objectUtil.extendShap
|
|
|
1725
1743
|
entry?: string | string[] | undefined;
|
|
1726
1744
|
project?: string | string[] | undefined;
|
|
1727
1745
|
} | undefined;
|
|
1746
|
+
'dependency-cruiser'?: string | boolean | string[] | {
|
|
1747
|
+
config?: string | string[] | undefined;
|
|
1748
|
+
entry?: string | string[] | undefined;
|
|
1749
|
+
project?: string | string[] | undefined;
|
|
1750
|
+
} | undefined;
|
|
1728
1751
|
dotenv?: string | boolean | string[] | {
|
|
1729
1752
|
config?: string | string[] | undefined;
|
|
1730
1753
|
entry?: string | string[] | undefined;
|
|
@@ -2274,6 +2297,19 @@ export declare const ConfigurationValidator: z.ZodObject<z.objectUtil.extendShap
|
|
|
2274
2297
|
entry?: string | string[] | undefined;
|
|
2275
2298
|
project?: string | string[] | undefined;
|
|
2276
2299
|
}>]>>;
|
|
2300
|
+
'dependency-cruiser': z.ZodOptional<z.ZodUnion<[z.ZodBoolean, z.ZodUnion<[z.ZodString, z.ZodArray<z.ZodString, "many">]>, z.ZodObject<{
|
|
2301
|
+
config: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodArray<z.ZodString, "many">]>>;
|
|
2302
|
+
entry: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodArray<z.ZodString, "many">]>>;
|
|
2303
|
+
project: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodArray<z.ZodString, "many">]>>;
|
|
2304
|
+
}, "strip", z.ZodTypeAny, {
|
|
2305
|
+
config?: string | string[] | undefined;
|
|
2306
|
+
entry?: string | string[] | undefined;
|
|
2307
|
+
project?: string | string[] | undefined;
|
|
2308
|
+
}, {
|
|
2309
|
+
config?: string | string[] | undefined;
|
|
2310
|
+
entry?: string | string[] | undefined;
|
|
2311
|
+
project?: string | string[] | undefined;
|
|
2312
|
+
}>]>>;
|
|
2277
2313
|
dotenv: z.ZodOptional<z.ZodUnion<[z.ZodBoolean, z.ZodUnion<[z.ZodString, z.ZodArray<z.ZodString, "many">]>, z.ZodObject<{
|
|
2278
2314
|
config: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodArray<z.ZodString, "many">]>>;
|
|
2279
2315
|
entry: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodArray<z.ZodString, "many">]>>;
|
|
@@ -3358,6 +3394,11 @@ export declare const ConfigurationValidator: z.ZodObject<z.objectUtil.extendShap
|
|
|
3358
3394
|
entry?: string | string[] | undefined;
|
|
3359
3395
|
project?: string | string[] | undefined;
|
|
3360
3396
|
} | undefined;
|
|
3397
|
+
'dependency-cruiser'?: string | boolean | string[] | {
|
|
3398
|
+
config?: string | string[] | undefined;
|
|
3399
|
+
entry?: string | string[] | undefined;
|
|
3400
|
+
project?: string | string[] | undefined;
|
|
3401
|
+
} | undefined;
|
|
3361
3402
|
dotenv?: string | boolean | string[] | {
|
|
3362
3403
|
config?: string | string[] | undefined;
|
|
3363
3404
|
entry?: string | string[] | undefined;
|
|
@@ -3823,6 +3864,11 @@ export declare const ConfigurationValidator: z.ZodObject<z.objectUtil.extendShap
|
|
|
3823
3864
|
entry?: string | string[] | undefined;
|
|
3824
3865
|
project?: string | string[] | undefined;
|
|
3825
3866
|
} | undefined;
|
|
3867
|
+
'dependency-cruiser'?: string | boolean | string[] | {
|
|
3868
|
+
config?: string | string[] | undefined;
|
|
3869
|
+
entry?: string | string[] | undefined;
|
|
3870
|
+
project?: string | string[] | undefined;
|
|
3871
|
+
} | undefined;
|
|
3826
3872
|
dotenv?: string | boolean | string[] | {
|
|
3827
3873
|
config?: string | string[] | undefined;
|
|
3828
3874
|
entry?: string | string[] | undefined;
|
|
@@ -4285,6 +4331,11 @@ export declare const ConfigurationValidator: z.ZodObject<z.objectUtil.extendShap
|
|
|
4285
4331
|
entry?: string | string[] | undefined;
|
|
4286
4332
|
project?: string | string[] | undefined;
|
|
4287
4333
|
} | undefined;
|
|
4334
|
+
'dependency-cruiser'?: string | boolean | string[] | {
|
|
4335
|
+
config?: string | string[] | undefined;
|
|
4336
|
+
entry?: string | string[] | undefined;
|
|
4337
|
+
project?: string | string[] | undefined;
|
|
4338
|
+
} | undefined;
|
|
4288
4339
|
dotenv?: string | boolean | string[] | {
|
|
4289
4340
|
config?: string | string[] | undefined;
|
|
4290
4341
|
entry?: string | string[] | undefined;
|
|
@@ -4750,6 +4801,11 @@ export declare const ConfigurationValidator: z.ZodObject<z.objectUtil.extendShap
|
|
|
4750
4801
|
entry?: string | string[] | undefined;
|
|
4751
4802
|
project?: string | string[] | undefined;
|
|
4752
4803
|
} | undefined;
|
|
4804
|
+
'dependency-cruiser'?: string | boolean | string[] | {
|
|
4805
|
+
config?: string | string[] | undefined;
|
|
4806
|
+
entry?: string | string[] | undefined;
|
|
4807
|
+
project?: string | string[] | undefined;
|
|
4808
|
+
} | undefined;
|
|
4753
4809
|
dotenv?: string | boolean | string[] | {
|
|
4754
4810
|
config?: string | string[] | undefined;
|
|
4755
4811
|
entry?: string | string[] | undefined;
|
package/dist/IssueCollector.js
CHANGED
|
@@ -51,11 +51,13 @@ export class IssueCollector {
|
|
|
51
51
|
if (this.isMatch(issue.filePath))
|
|
52
52
|
return;
|
|
53
53
|
const key = relative(this.cwd, issue.filePath);
|
|
54
|
-
|
|
55
|
-
|
|
54
|
+
const { type } = issue;
|
|
55
|
+
issue.severity = this.rules[type];
|
|
56
|
+
const issues = this.issues[type];
|
|
56
57
|
issues[key] = issues[key] ?? {};
|
|
57
|
-
|
|
58
|
-
|
|
58
|
+
const symbol = type.endsWith('Members') && issue.parentSymbol ? `${issue.parentSymbol}.${issue.symbol}` : issue.symbol;
|
|
59
|
+
if (!issues[key][symbol]) {
|
|
60
|
+
issues[key][symbol] = issue;
|
|
59
61
|
this.counters[issue.type]++;
|
|
60
62
|
}
|
|
61
63
|
return issue;
|
|
@@ -2,10 +2,16 @@ import parseArgs from 'minimist';
|
|
|
2
2
|
import { isFile } from '../../util/fs.js';
|
|
3
3
|
import { toEntry } from '../../util/input.js';
|
|
4
4
|
import { isAbsolute, join } from '../../util/path.js';
|
|
5
|
-
|
|
6
|
-
|
|
5
|
+
import { resolveX } from './bunx.js';
|
|
6
|
+
const commands = ['add', 'create', 'init', 'install', 'link', 'pm', 'remove', 'run', 'test', 'update', 'upgrade', 'x'];
|
|
7
|
+
export const resolve = (_binary, args, options) => {
|
|
7
8
|
const parsed = parseArgs(args);
|
|
8
9
|
const [command, script] = parsed._;
|
|
10
|
+
if (command === 'x') {
|
|
11
|
+
const argsForX = args.filter(arg => arg !== 'x');
|
|
12
|
+
return resolveX(argsForX, options);
|
|
13
|
+
}
|
|
14
|
+
const { manifestScriptNames, cwd, fromArgs } = options;
|
|
9
15
|
if (command === 'run' && manifestScriptNames.has(script))
|
|
10
16
|
return [];
|
|
11
17
|
if (manifestScriptNames.has(command) || commands.includes(command))
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import parseArgs from 'minimist';
|
|
2
|
+
import { toDependency } from '../../util/input.js';
|
|
3
|
+
import { stripVersionFromSpecifier } from '../../util/modules.js';
|
|
4
|
+
import { argsFrom } from '../util.js';
|
|
5
|
+
export const resolveX = (args, options) => {
|
|
6
|
+
const { fromArgs } = options;
|
|
7
|
+
const parsed = parseArgs(args);
|
|
8
|
+
const packageSpecifier = parsed._[0];
|
|
9
|
+
const specifier = packageSpecifier ? stripVersionFromSpecifier(packageSpecifier) : '';
|
|
10
|
+
const packages = parsed.package && !parsed.yes ? [parsed.package].flat().map(stripVersionFromSpecifier) : [];
|
|
11
|
+
const command = parsed['shell-mode'] ? fromArgs([parsed['shell-mode']]) : [];
|
|
12
|
+
const restArgs = argsFrom(args, packageSpecifier);
|
|
13
|
+
const dependency = specifier ? [toDependency(specifier, { optional: true })] : [];
|
|
14
|
+
return [...dependency, ...packages.map(id => toDependency(id)), ...command, ...fromArgs(restArgs).slice(1)];
|
|
15
|
+
};
|
|
16
|
+
export const resolve = (_binary, args, options) => {
|
|
17
|
+
return resolveX(args, options);
|
|
18
|
+
};
|
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
declare const _default: {
|
|
2
2
|
bun: import("../../types/config.js").BinaryResolver;
|
|
3
|
+
bunx: import("../../types/config.js").BinaryResolver;
|
|
3
4
|
npm: import("../../types/config.js").BinaryResolver;
|
|
4
5
|
npx: import("../../types/config.js").BinaryResolver;
|
|
5
6
|
pnpm: import("../../types/config.js").BinaryResolver;
|
|
7
|
+
pnpx: import("../../types/config.js").BinaryResolver;
|
|
6
8
|
yarn: import("../../types/config.js").BinaryResolver;
|
|
7
9
|
};
|
|
8
10
|
export default _default;
|
|
@@ -1,12 +1,16 @@
|
|
|
1
1
|
import * as bun from './bun.js';
|
|
2
|
+
import * as bunx from './bunx.js';
|
|
2
3
|
import * as npm from './npm.js';
|
|
3
4
|
import * as npx from './npx.js';
|
|
4
5
|
import * as pnpm from './pnpm.js';
|
|
6
|
+
import * as pnpx from './pnpx.js';
|
|
5
7
|
import * as yarn from './yarn.js';
|
|
6
8
|
export default {
|
|
7
9
|
bun: bun.resolve,
|
|
10
|
+
bunx: bunx.resolve,
|
|
8
11
|
npm: npm.resolve,
|
|
9
12
|
npx: npx.resolve,
|
|
10
13
|
pnpm: pnpm.resolve,
|
|
14
|
+
pnpx: pnpx.resolve,
|
|
11
15
|
yarn: yarn.resolve,
|
|
12
16
|
};
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import parseArgs from 'minimist';
|
|
2
|
-
import { toBinary } from '../../util/input.js';
|
|
3
2
|
export const resolve = (_binary, args, options) => {
|
|
4
3
|
const { fromArgs } = options;
|
|
5
4
|
const parsed = parseArgs(args);
|
|
6
5
|
const [command] = parsed._;
|
|
7
|
-
return
|
|
6
|
+
return command !== 'exec' ? [] : fromArgs(parsed._.slice(1));
|
|
8
7
|
};
|
|
@@ -15,7 +15,12 @@ export const resolve = (_binary, args, options) => {
|
|
|
15
15
|
const command = parsed.call ? fromArgs([parsed.call]) : [];
|
|
16
16
|
const restArgs = argsFrom(args, packageSpecifier);
|
|
17
17
|
const isBinary = specifier && !packageSpecifier.includes('@') && !isInternal(specifier);
|
|
18
|
-
const dependency = isBinary ? toBinary(specifier) : toDependency(specifier);
|
|
18
|
+
const dependency = isBinary ? toBinary(specifier) : toDependency(specifier, { optional: !parsed.no });
|
|
19
19
|
const specifiers = dependency && !parsed.yes ? [dependency] : [];
|
|
20
|
-
return [
|
|
20
|
+
return [
|
|
21
|
+
...specifiers,
|
|
22
|
+
...packages.map(id => toDependency(id, { optional: true })),
|
|
23
|
+
...command,
|
|
24
|
+
...fromArgs(restArgs).slice(1),
|
|
25
|
+
];
|
|
21
26
|
};
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import parseArgs from 'minimist';
|
|
2
2
|
import { toBinary } from '../../util/input.js';
|
|
3
|
+
import { resolveDlx } from './pnpx.js';
|
|
3
4
|
const commands = [
|
|
4
5
|
'add',
|
|
5
6
|
'audit',
|
|
@@ -51,12 +52,17 @@ const commands = [
|
|
|
51
52
|
'upgrade',
|
|
52
53
|
'why',
|
|
53
54
|
];
|
|
54
|
-
export const resolve = (_binary, args,
|
|
55
|
+
export const resolve = (_binary, args, options) => {
|
|
55
56
|
const parsed = parseArgs(args, {
|
|
56
57
|
boolean: ['recursive', 'silent', 'shell-mode'],
|
|
57
58
|
alias: { recursive: 'r', silent: 's', 'shell-mode': 'c' },
|
|
58
59
|
});
|
|
59
60
|
const [command, binary] = parsed._;
|
|
61
|
+
if (command === 'dlx') {
|
|
62
|
+
const argsForDlx = args.filter(arg => arg !== 'dlx');
|
|
63
|
+
return resolveDlx(argsForDlx, options);
|
|
64
|
+
}
|
|
65
|
+
const { manifestScriptNames, fromArgs } = options;
|
|
60
66
|
if (manifestScriptNames.has(command) || commands.includes(command))
|
|
61
67
|
return [];
|
|
62
68
|
if (command === 'exec') {
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import parseArgs from 'minimist';
|
|
2
|
+
import { toDependency } from '../../util/input.js';
|
|
3
|
+
import { stripVersionFromSpecifier } from '../../util/modules.js';
|
|
4
|
+
export const resolveDlx = (args, options) => {
|
|
5
|
+
const parsed = parseArgs(args, {
|
|
6
|
+
boolean: ['silent'],
|
|
7
|
+
alias: { package: 'p', 'shell-mode': 'c' },
|
|
8
|
+
});
|
|
9
|
+
const packageSpecifier = parsed._[0];
|
|
10
|
+
const specifier = packageSpecifier ? stripVersionFromSpecifier(packageSpecifier) : '';
|
|
11
|
+
const packages = parsed.package && !parsed.yes ? [parsed.package].flat().map(stripVersionFromSpecifier) : [];
|
|
12
|
+
const command = parsed['shell-mode'] ? options.fromArgs([parsed['shell-mode']]) : [];
|
|
13
|
+
const dependency = specifier ? [toDependency(specifier, { optional: true })] : [];
|
|
14
|
+
return [...dependency, ...packages.map(id => toDependency(id, { optional: true })), ...command];
|
|
15
|
+
};
|
|
16
|
+
export const resolve = (_binary, args, options) => {
|
|
17
|
+
return resolveDlx(args, options);
|
|
18
|
+
};
|
|
@@ -42,9 +42,10 @@ export const resolve = (_binary, args, { manifestScriptNames, fromArgs, cwd, roo
|
|
|
42
42
|
return [];
|
|
43
43
|
if (!dir && command === 'run' && manifestScriptNames.has(binary))
|
|
44
44
|
return [];
|
|
45
|
-
if (command === 'run' || command === 'exec')
|
|
46
|
-
return dir ? [{ ...toBinary(binary), dir }] : [toBinary(binary)];
|
|
47
45
|
if (command === 'node')
|
|
48
46
|
return fromArgs(parsed._);
|
|
49
|
-
|
|
47
|
+
const bin = command === 'run' || command === 'exec' ? toBinary(binary) : toBinary(command);
|
|
48
|
+
if (dir)
|
|
49
|
+
Object.assign(bin, { dir });
|
|
50
|
+
return [bin];
|
|
50
51
|
};
|
package/dist/binaries/plugins.js
CHANGED
|
@@ -2,6 +2,7 @@ import parseArgs from 'minimist';
|
|
|
2
2
|
import { pluginArgsMap } from '../plugins.js';
|
|
3
3
|
import { compact } from '../util/array.js';
|
|
4
4
|
import { toBinary, toConfig, toDeferResolve, toDeferResolveEntry, toEntry } from '../util/input.js';
|
|
5
|
+
import { extractBinary } from '../util/modules.js';
|
|
5
6
|
import { resolve as fallbackResolve } from './fallback.js';
|
|
6
7
|
const isGlobLikeMatch = /(^!|[*+\\(|{^$])/;
|
|
7
8
|
const isGlobLike = (value) => isGlobLikeMatch.test(value);
|
|
@@ -31,8 +32,12 @@ export const resolve = (binary, _args, options) => {
|
|
|
31
32
|
const id = parsed._[0];
|
|
32
33
|
if (isGlobLike(id))
|
|
33
34
|
positionals.push(toEntry(id));
|
|
34
|
-
else
|
|
35
|
-
|
|
35
|
+
else {
|
|
36
|
+
if (id.includes('node_modules/.bin/'))
|
|
37
|
+
positionals.push(toBinary(extractBinary(id)));
|
|
38
|
+
else
|
|
39
|
+
positionals.push(toDeferResolveEntry(id));
|
|
40
|
+
}
|
|
36
41
|
}
|
|
37
42
|
const mapToParsedKey = (id) => parsed[id];
|
|
38
43
|
const resolved = compact(opts.resolve ? opts.resolve.flatMap(mapToParsedKey) : []);
|
|
@@ -73,6 +73,11 @@ export declare const partitionCompilers: (rawLocalConfig: RawConfiguration) => {
|
|
|
73
73
|
entry?: string | string[] | undefined;
|
|
74
74
|
project?: string | string[] | undefined;
|
|
75
75
|
} | undefined;
|
|
76
|
+
'dependency-cruiser'?: string | boolean | string[] | {
|
|
77
|
+
config?: string | string[] | undefined;
|
|
78
|
+
entry?: string | string[] | undefined;
|
|
79
|
+
project?: string | string[] | undefined;
|
|
80
|
+
} | undefined;
|
|
76
81
|
dotenv?: string | boolean | string[] | {
|
|
77
82
|
config?: string | string[] | undefined;
|
|
78
83
|
entry?: string | string[] | undefined;
|
|
@@ -536,6 +541,11 @@ export declare const partitionCompilers: (rawLocalConfig: RawConfiguration) => {
|
|
|
536
541
|
entry?: string | string[] | undefined;
|
|
537
542
|
project?: string | string[] | undefined;
|
|
538
543
|
} | undefined;
|
|
544
|
+
'dependency-cruiser'?: string | boolean | string[] | {
|
|
545
|
+
config?: string | string[] | undefined;
|
|
546
|
+
entry?: string | string[] | undefined;
|
|
547
|
+
project?: string | string[] | undefined;
|
|
548
|
+
} | undefined;
|
|
539
549
|
dotenv?: string | boolean | string[] | {
|
|
540
550
|
config?: string | string[] | undefined;
|
|
541
551
|
entry?: string | string[] | undefined;
|
package/dist/index.js
CHANGED
|
@@ -251,7 +251,7 @@ export const main = async (unresolvedConfiguration) => {
|
|
|
251
251
|
graph.set(filePath, file);
|
|
252
252
|
if (scripts && scripts.size > 0) {
|
|
253
253
|
const dependencies = deputy.getDependencies(workspace.name);
|
|
254
|
-
const manifestScriptNames = new Set();
|
|
254
|
+
const manifestScriptNames = new Set(Object.keys(chief.getManifestForWorkspace(workspace.name)?.scripts ?? {}));
|
|
255
255
|
const rootCwd = cwd;
|
|
256
256
|
const options = {
|
|
257
257
|
cwd: dirname(filePath),
|
|
@@ -260,11 +260,11 @@ export const main = async (unresolvedConfiguration) => {
|
|
|
260
260
|
dependencies,
|
|
261
261
|
manifestScriptNames,
|
|
262
262
|
};
|
|
263
|
-
const
|
|
264
|
-
for (const
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
const specifierFilePath = getReferencedInternalFilePath(
|
|
263
|
+
const inputs = _getInputsFromScripts(scripts, options);
|
|
264
|
+
for (const input of inputs) {
|
|
265
|
+
input.containingFilePath = filePath;
|
|
266
|
+
input.dir = cwd;
|
|
267
|
+
const specifierFilePath = getReferencedInternalFilePath(input, workspace);
|
|
268
268
|
if (specifierFilePath)
|
|
269
269
|
analyzeSourceFile(specifierFilePath, principal);
|
|
270
270
|
}
|
|
@@ -11,7 +11,7 @@ const resolveConfig = async (config, { configFileDir }) => {
|
|
|
11
11
|
const plugins = config.includePlugins ?? [];
|
|
12
12
|
const android = (await exists('android/capacitor.settings.gradle')) ? ['@capacitor/android'] : [];
|
|
13
13
|
const ios = (await exists('ios/App/Podfile')) ? ['@capacitor/ios'] : [];
|
|
14
|
-
return [...plugins, ...android, ...ios].map(toDependency);
|
|
14
|
+
return [...plugins, ...android, ...ios].map(id => toDependency(id));
|
|
15
15
|
};
|
|
16
16
|
export default {
|
|
17
17
|
title,
|
|
@@ -21,7 +21,7 @@ const resolveConfig = async (config) => {
|
|
|
21
21
|
? [parserPreset.path ?? parserPreset]
|
|
22
22
|
: []
|
|
23
23
|
: [];
|
|
24
|
-
return [...extendsConfigs, ...plugins, ...formatter, ...parserPresetPaths].map(toDependency);
|
|
24
|
+
return [...extendsConfigs, ...plugins, ...formatter, ...parserPresetPaths].map(id => toDependency(id));
|
|
25
25
|
};
|
|
26
26
|
export default {
|
|
27
27
|
title,
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { IsPluginEnabled } from '../../types/config.js';
|
|
2
|
+
declare const _default: {
|
|
3
|
+
title: string;
|
|
4
|
+
enablers: string[];
|
|
5
|
+
isEnabled: IsPluginEnabled;
|
|
6
|
+
config: string[];
|
|
7
|
+
args: {
|
|
8
|
+
binaries: string[];
|
|
9
|
+
config: boolean;
|
|
10
|
+
};
|
|
11
|
+
};
|
|
12
|
+
export default _default;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { hasDependency } from '../../util/plugin.js';
|
|
2
|
+
const title = 'dependency-cruiser';
|
|
3
|
+
const enablers = ['dependency-cruiser'];
|
|
4
|
+
const isEnabled = ({ dependencies }) => hasDependency(dependencies, enablers);
|
|
5
|
+
const config = ['.dependency-cruiser.{js,cjs,mjs,json}'];
|
|
6
|
+
const args = {
|
|
7
|
+
binaries: ['depcruise', 'dependency-cruise', 'dependency-cruiser', 'depcruise-baseline'],
|
|
8
|
+
config: true,
|
|
9
|
+
};
|
|
10
|
+
export default {
|
|
11
|
+
title,
|
|
12
|
+
enablers,
|
|
13
|
+
isEnabled,
|
|
14
|
+
config,
|
|
15
|
+
args,
|
|
16
|
+
};
|
|
@@ -9,7 +9,7 @@ export const getDependencies = async (expoConfig, { manifest }) => {
|
|
|
9
9
|
return getPackageNameFromModuleSpecifier(pluginName);
|
|
10
10
|
})
|
|
11
11
|
.filter(Boolean) ?? [];
|
|
12
|
-
const inputs = new Set(pluginPackages.map(toDependency));
|
|
12
|
+
const inputs = new Set(pluginPackages.map(id => toDependency(id)));
|
|
13
13
|
const allowedPackages = ['expo-atlas', 'expo-dev-client'];
|
|
14
14
|
const allowedProductionPackages = ['expo-insights'];
|
|
15
15
|
const manifestDependencies = Object.keys(manifest.dependencies ?? {});
|
|
@@ -26,7 +26,7 @@ const resolveConfig = async (localConfig, options) => {
|
|
|
26
26
|
if (typeof _config.onCreateBabelConfig === 'function') {
|
|
27
27
|
_config.onCreateBabelConfig({ actions });
|
|
28
28
|
}
|
|
29
|
-
return Array.from(plugins).map(toDependency);
|
|
29
|
+
return Array.from(plugins).map(id => toDependency(id));
|
|
30
30
|
}
|
|
31
31
|
return [];
|
|
32
32
|
};
|
|
@@ -48,7 +48,7 @@ const resolveConfig = config => {
|
|
|
48
48
|
return [];
|
|
49
49
|
if (isInternal(plugin))
|
|
50
50
|
return [toEntry(plugin)];
|
|
51
|
-
return [plugin.includes('codegen-') ? plugin : `@graphql-codegen/${plugin}`].map(toDependency);
|
|
51
|
+
return [plugin.includes('codegen-') ? plugin : `@graphql-codegen/${plugin}`].map(id => toDependency(id));
|
|
52
52
|
});
|
|
53
53
|
return [...presets, ...flatPlugins, ...nestedPlugins].map(id => (typeof id === 'string' ? toDependency(id) : id));
|
|
54
54
|
};
|
package/dist/plugins/index.d.ts
CHANGED
|
@@ -94,6 +94,16 @@ export declare const Plugins: {
|
|
|
94
94
|
resolveEntryPaths: import("../types/config.js").ResolveEntryPaths;
|
|
95
95
|
resolveConfig: import("../types/config.js").ResolveConfig<import("./cypress/types.js").CypressConfig>;
|
|
96
96
|
};
|
|
97
|
+
'dependency-cruiser': {
|
|
98
|
+
title: string;
|
|
99
|
+
enablers: string[];
|
|
100
|
+
isEnabled: import("../types/config.js").IsPluginEnabled;
|
|
101
|
+
config: string[];
|
|
102
|
+
args: {
|
|
103
|
+
binaries: string[];
|
|
104
|
+
config: boolean;
|
|
105
|
+
};
|
|
106
|
+
};
|
|
97
107
|
dotenv: {
|
|
98
108
|
title: string;
|
|
99
109
|
args: {
|
|
@@ -251,7 +261,6 @@ export declare const Plugins: {
|
|
|
251
261
|
};
|
|
252
262
|
metro: {
|
|
253
263
|
title: string;
|
|
254
|
-
note: string;
|
|
255
264
|
enablers: string[];
|
|
256
265
|
isEnabled: import("../types/config.js").IsPluginEnabled;
|
|
257
266
|
config: string[];
|
|
@@ -341,7 +350,6 @@ export declare const Plugins: {
|
|
|
341
350
|
};
|
|
342
351
|
nuxt: {
|
|
343
352
|
title: string;
|
|
344
|
-
note: string;
|
|
345
353
|
enablers: string[];
|
|
346
354
|
isEnabled: import("../types/config.js").IsPluginEnabled;
|
|
347
355
|
entry: string[];
|
package/dist/plugins/index.js
CHANGED
|
@@ -10,6 +10,7 @@ import { default as commitlint } from './commitlint/index.js';
|
|
|
10
10
|
import { default as cspell } from './cspell/index.js';
|
|
11
11
|
import { default as cucumber } from './cucumber/index.js';
|
|
12
12
|
import { default as cypress } from './cypress/index.js';
|
|
13
|
+
import { default as dependencyCruiser } from './dependency-cruiser/index.js';
|
|
13
14
|
import { default as dotenv } from './dotenv/index.js';
|
|
14
15
|
import { default as drizzle } from './drizzle/index.js';
|
|
15
16
|
import { default as eleventy } from './eleventy/index.js';
|
|
@@ -101,6 +102,7 @@ export const Plugins = {
|
|
|
101
102
|
cspell,
|
|
102
103
|
cucumber,
|
|
103
104
|
cypress,
|
|
105
|
+
'dependency-cruiser': dependencyCruiser,
|
|
104
106
|
dotenv,
|
|
105
107
|
drizzle,
|
|
106
108
|
eleventy,
|
|
@@ -10,7 +10,7 @@ const gitHookPaths = getGitHookPaths();
|
|
|
10
10
|
const config = ['lefthook.yml', ...gitHookPaths];
|
|
11
11
|
const resolveConfig = async (localConfig, options) => {
|
|
12
12
|
const { manifest, configFileName, cwd, getInputsFromScripts } = options;
|
|
13
|
-
const inputs = manifest.devDependencies ? Object.keys(manifest.devDependencies).map(toDependency) : [];
|
|
13
|
+
const inputs = manifest.devDependencies ? Object.keys(manifest.devDependencies).map(id => toDependency(id)) : [];
|
|
14
14
|
if (extname(configFileName) === '.yml') {
|
|
15
15
|
const scripts = findByKeyDeep(localConfig, 'run').flatMap(command => {
|
|
16
16
|
const deps = getInputsFromScripts([command.run], { ...options, knownBinsOnly: true });
|
|
@@ -18,7 +18,7 @@ const resolveConfig = async (localConfig, options) => {
|
|
|
18
18
|
return deps.flatMap(dependency => ({ ...dependency, dir }));
|
|
19
19
|
});
|
|
20
20
|
const lefthook = process.env.CI
|
|
21
|
-
? enablers.filter(dependency => inputs.some(d => d.specifier === dependency)).map(toDependency)
|
|
21
|
+
? enablers.filter(dependency => inputs.some(d => d.specifier === dependency)).map(id => toDependency(id))
|
|
22
22
|
: [];
|
|
23
23
|
return [...scripts, ...lefthook];
|
|
24
24
|
}
|
|
@@ -14,7 +14,7 @@ const resolveConfig = (config, options) => {
|
|
|
14
14
|
const uses = scripts
|
|
15
15
|
.filter(script => script.includes('markdownlint '))
|
|
16
16
|
.flatMap(script => getArgumentValues(script, / (--rules|-r)[ =]([^ ]+)/g));
|
|
17
|
-
return [...extend, ...uses].map(toDependency);
|
|
17
|
+
return [...extend, ...uses].map(id => toDependency(id));
|
|
18
18
|
};
|
|
19
19
|
export default {
|
|
20
20
|
title,
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import type { IsPluginEnabled, ResolveConfig, ResolveEntryPaths } from '../../types/config.js';
|
|
2
2
|
import type { MetroConfig } from './types.js';
|
|
3
3
|
export declare const docs: {
|
|
4
|
+
note: string;
|
|
4
5
|
production: string[];
|
|
5
6
|
};
|
|
6
7
|
declare const _default: {
|
|
7
8
|
title: string;
|
|
8
|
-
note: string;
|
|
9
9
|
enablers: string[];
|
|
10
10
|
isEnabled: IsPluginEnabled;
|
|
11
11
|
config: string[];
|
|
@@ -3,8 +3,6 @@ import { toDeferResolve, toProductionEntry } from '../../util/input.js';
|
|
|
3
3
|
import { join } from '../../util/path.js';
|
|
4
4
|
import { hasDependency } from '../../util/plugin.js';
|
|
5
5
|
const title = 'Metro';
|
|
6
|
-
const note = `False positives for platform-specific unused files?
|
|
7
|
-
Override the entry patterns as shown below to match platforms and extensions.`;
|
|
8
6
|
const enablers = ['metro', 'react-native'];
|
|
9
7
|
const isEnabled = options => hasDependency(options.dependencies, enablers);
|
|
10
8
|
const config = ['metro.config.{js,cjs,json}', 'package.json'];
|
|
@@ -12,7 +10,6 @@ const DEFAULT_PLATFORMS = ['ios', 'android', 'windows', 'web'];
|
|
|
12
10
|
const PLATFORMS = [...DEFAULT_PLATFORMS, 'native', 'default'];
|
|
13
11
|
const DEFAULT_EXTENSIONS = ['js', 'jsx', 'json', 'ts', 'tsx'];
|
|
14
12
|
const production = [`src/**/*.{${PLATFORMS.join(',')}}.{${DEFAULT_EXTENSIONS.join(',')}}`];
|
|
15
|
-
export const docs = { production };
|
|
16
13
|
const resolveEntryPaths = async (config) => {
|
|
17
14
|
const platformEntryPatterns = compact(PLATFORMS.concat(config.resolver?.platforms ?? []));
|
|
18
15
|
const sourceExts = config.resolver?.sourceExts ?? DEFAULT_EXTENSIONS;
|
|
@@ -37,9 +34,11 @@ const resolveConfig = async (config) => {
|
|
|
37
34
|
inputs.push(transformer.babelTransformerPath);
|
|
38
35
|
return [...inputs].map(toDeferResolve);
|
|
39
36
|
};
|
|
37
|
+
const note = `False positives for platform-specific unused files?
|
|
38
|
+
Override the entry patterns as shown below to match platforms and extensions.`;
|
|
39
|
+
export const docs = { note, production };
|
|
40
40
|
export default {
|
|
41
41
|
title,
|
|
42
|
-
note,
|
|
43
42
|
enablers,
|
|
44
43
|
isEnabled,
|
|
45
44
|
config,
|
|
@@ -6,7 +6,7 @@ const isEnabled = ({ dependencies }) => hasDependency(dependencies, enablers);
|
|
|
6
6
|
const config = ['nest-cli.json', '.nestcli.json', '.nest-cli.json', 'nest.json'];
|
|
7
7
|
const resolveConfig = async (config) => {
|
|
8
8
|
const inputs = config?.collection ? [config.collection] : [];
|
|
9
|
-
return [...inputs].map(toDependency);
|
|
9
|
+
return [...inputs].map(id => toDependency(id));
|
|
10
10
|
};
|
|
11
11
|
export default {
|
|
12
12
|
title,
|
|
@@ -19,8 +19,8 @@ const resolveEntryPaths = localConfig => {
|
|
|
19
19
|
};
|
|
20
20
|
const resolveConfig = async (localConfig) => {
|
|
21
21
|
return [
|
|
22
|
-
...(localConfig?.plugins?.map(plugin => plugin.package) ?? []).map(toDependency),
|
|
23
|
-
...extractFunctionsConfigProperty(localConfig.functions || {}, 'external_node_modules').map(toDependency),
|
|
22
|
+
...(localConfig?.plugins?.map(plugin => plugin.package) ?? []).map(id => toDependency(id)),
|
|
23
|
+
...extractFunctionsConfigProperty(localConfig.functions || {}, 'external_node_modules').map(id => toDependency(id)),
|
|
24
24
|
];
|
|
25
25
|
};
|
|
26
26
|
export default {
|
|
@@ -7,7 +7,7 @@ const isEnabled = ({ dependencies }) => hasDependency(dependencies, enablers);
|
|
|
7
7
|
const packageJsonPath = 'npmpackagejsonlint';
|
|
8
8
|
const config = ['package.json', ...toCosmiconfig('npmpackagejsonlint')];
|
|
9
9
|
const resolveConfig = localConfig => {
|
|
10
|
-
return localConfig?.extends ? [localConfig.extends].map(toDependency) : [];
|
|
10
|
+
return localConfig?.extends ? [localConfig.extends].map(id => toDependency(id)) : [];
|
|
11
11
|
};
|
|
12
12
|
export default {
|
|
13
13
|
title,
|
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
import type { IsPluginEnabled, ResolveEntryPaths } from '../../types/config.js';
|
|
2
2
|
import type { NuxtConfig } from './types.js';
|
|
3
|
+
export declare const docs: {
|
|
4
|
+
note: string;
|
|
5
|
+
};
|
|
3
6
|
declare const _default: {
|
|
4
7
|
title: string;
|
|
5
|
-
note: string;
|
|
6
8
|
enablers: string[];
|
|
7
9
|
isEnabled: IsPluginEnabled;
|
|
8
10
|
entry: string[];
|
|
@@ -2,8 +2,6 @@ import { toProductionEntry } from '../../util/input.js';
|
|
|
2
2
|
import { join } from '../../util/path.js';
|
|
3
3
|
import { hasDependency } from '../../util/plugin.js';
|
|
4
4
|
const title = 'Nuxt';
|
|
5
|
-
const note = `Knip works best with [explicit imports](https://nuxt.com/docs/guide/concepts/auto-imports#explicit-imports).
|
|
6
|
-
Nuxt allows to [disable auto-imports](https://nuxt.com/docs/guide/concepts/auto-imports#disabling-auto-imports).`;
|
|
7
5
|
const enablers = ['nuxt'];
|
|
8
6
|
const isEnabled = ({ dependencies }) => {
|
|
9
7
|
const isEnabled = hasDependency(dependencies, enablers);
|
|
@@ -38,9 +36,11 @@ const resolveEntryPaths = async (localConfig) => {
|
|
|
38
36
|
];
|
|
39
37
|
return patterns.map(pattern => toProductionEntry(join(srcDir, pattern)));
|
|
40
38
|
};
|
|
39
|
+
const note = `Knip works best with [explicit imports](https://nuxt.com/docs/guide/concepts/auto-imports#explicit-imports).
|
|
40
|
+
Nuxt allows to [disable auto-imports](https://nuxt.com/docs/guide/concepts/auto-imports#disabling-auto-imports).`;
|
|
41
|
+
export const docs = { note };
|
|
41
42
|
export default {
|
|
42
43
|
title,
|
|
43
|
-
note,
|
|
44
44
|
enablers,
|
|
45
45
|
isEnabled,
|
|
46
46
|
entry,
|
package/dist/plugins/nx/index.js
CHANGED
|
@@ -21,7 +21,7 @@ const findNxDependenciesInNxJson = async (localConfig) => {
|
|
|
21
21
|
.filter(value => value !== undefined)
|
|
22
22
|
.map(value => value.split(':')[0])
|
|
23
23
|
: [];
|
|
24
|
-
return compact([...targetsDefault, ...plugins, ...generators]).map(toDependency);
|
|
24
|
+
return compact([...targetsDefault, ...plugins, ...generators]).map(id => toDependency(id));
|
|
25
25
|
};
|
|
26
26
|
const resolveConfig = async (localConfig, options) => {
|
|
27
27
|
const { configFileName } = options;
|
|
@@ -7,7 +7,7 @@ const config = ['package.json'];
|
|
|
7
7
|
const resolveConfig = async (config) => {
|
|
8
8
|
const plugins = config?.plugins ?? [];
|
|
9
9
|
const devPlugins = config?.devPlugins ?? [];
|
|
10
|
-
return [...plugins, ...devPlugins].map(toDependency);
|
|
10
|
+
return [...plugins, ...devPlugins].map(id => toDependency(id));
|
|
11
11
|
};
|
|
12
12
|
export default {
|
|
13
13
|
title,
|
|
@@ -13,7 +13,7 @@ const resolveConfig = config => {
|
|
|
13
13
|
if (typeof config === 'string')
|
|
14
14
|
return [toDeferResolve(config)];
|
|
15
15
|
return Array.isArray(config.plugins)
|
|
16
|
-
? config.plugins.filter((plugin) => typeof plugin === 'string').map(toDependency)
|
|
16
|
+
? config.plugins.filter((plugin) => typeof plugin === 'string').map(id => toDependency(id))
|
|
17
17
|
: [];
|
|
18
18
|
};
|
|
19
19
|
export default {
|
|
@@ -14,7 +14,7 @@ const resolveConfig = (config, options) => {
|
|
|
14
14
|
scripts.push(config.gitlab.releaseNotes);
|
|
15
15
|
}
|
|
16
16
|
const inputs = options.getInputsFromScripts(scripts);
|
|
17
|
-
return [...plugins.map(toDependency), ...inputs];
|
|
17
|
+
return [...plugins.map(id => toDependency(id)), ...inputs];
|
|
18
18
|
};
|
|
19
19
|
export default {
|
|
20
20
|
title,
|
|
@@ -7,9 +7,15 @@ const isEnabled = ({ dependencies }) => hasDependency(dependencies, enablers);
|
|
|
7
7
|
const isRootOnly = true;
|
|
8
8
|
const packageJsonPath = 'release';
|
|
9
9
|
const config = ['package.json', ...toCosmiconfig('release')];
|
|
10
|
+
const excludePackages = [
|
|
11
|
+
'@semantic-release/commit-analyzer',
|
|
12
|
+
'@semantic-release/github',
|
|
13
|
+
'@semantic-release/npm',
|
|
14
|
+
'@semantic-release/release-notes-generator',
|
|
15
|
+
];
|
|
10
16
|
const resolveConfig = config => {
|
|
11
17
|
const plugins = (config?.plugins ?? []).map(plugin => (Array.isArray(plugin) ? plugin[0] : plugin));
|
|
12
|
-
return plugins.map(toDeferResolve);
|
|
18
|
+
return plugins.filter(plugin => !excludePackages.includes(plugin)).map(toDeferResolve);
|
|
13
19
|
};
|
|
14
20
|
export default {
|
|
15
21
|
title,
|
|
@@ -30,7 +30,11 @@ const resolveConfig = async (localConfig) => {
|
|
|
30
30
|
: [builder]
|
|
31
31
|
: [];
|
|
32
32
|
const frameworks = localConfig.framework?.name ? [localConfig.framework.name] : [];
|
|
33
|
-
return [
|
|
33
|
+
return [
|
|
34
|
+
...addons.map(toDeferResolve),
|
|
35
|
+
...builderPackages.map(id => toDependency(id)),
|
|
36
|
+
...frameworks.map(id => toDependency(id)),
|
|
37
|
+
];
|
|
34
38
|
};
|
|
35
39
|
export default {
|
|
36
40
|
title,
|
|
@@ -30,6 +30,8 @@ const args = {
|
|
|
30
30
|
alias: { project: ['p'] },
|
|
31
31
|
config: [['project', (p) => (p.endsWith('.json') ? p : join(p, 'tsconfig.json'))]],
|
|
32
32
|
};
|
|
33
|
+
const note = '[What’s up with that configurable tsconfig.json location?](/reference/faq#whats-up-with-that-configurable-tsconfigjson-location)';
|
|
34
|
+
export const docs = { note };
|
|
33
35
|
export default {
|
|
34
36
|
title,
|
|
35
37
|
enablers,
|
|
@@ -25,7 +25,7 @@ const findConfigDependencies = (localConfig, options) => {
|
|
|
25
25
|
const dir = join(configFileDir, testConfig.root ?? '.');
|
|
26
26
|
const setupFiles = [testConfig.setupFiles ?? []].flat().map(specifier => ({ ...toDeferResolve(specifier), dir }));
|
|
27
27
|
const globalSetup = [testConfig.globalSetup ?? []].flat().map(specifier => ({ ...toDeferResolve(specifier), dir }));
|
|
28
|
-
return [...[...environments, ...reporters, ...coverage].map(toDependency), ...setupFiles, ...globalSetup];
|
|
28
|
+
return [...[...environments, ...reporters, ...coverage].map(id => toDependency(id)), ...setupFiles, ...globalSetup];
|
|
29
29
|
};
|
|
30
30
|
const getConfigs = async (localConfig) => {
|
|
31
31
|
const configs = [];
|
|
@@ -23,7 +23,7 @@ const resolveConfig = async (config) => {
|
|
|
23
23
|
})
|
|
24
24
|
.map(reporter => `@wdio/${reporter}-reporter`)
|
|
25
25
|
: [];
|
|
26
|
-
return [...frameworks, ...runners, ...reporters].map(toDependency);
|
|
26
|
+
return [...frameworks, ...runners, ...reporters].map(id => toDependency(id));
|
|
27
27
|
};
|
|
28
28
|
export default {
|
|
29
29
|
title,
|
|
@@ -8,6 +8,11 @@ const bright = picocolors.whiteBright;
|
|
|
8
8
|
const TRUNCATE_WIDTH = 40;
|
|
9
9
|
const truncate = (text) => (text.length > TRUNCATE_WIDTH ? `${text.slice(0, TRUNCATE_WIDTH - 3)}...` : text);
|
|
10
10
|
const truncateStart = (text, width) => (text.length > width ? `...${text.slice(-(width - 3))}` : text);
|
|
11
|
+
const sortByPos = (a, b) => {
|
|
12
|
+
const [f, r, c] = a.filePath.split(':');
|
|
13
|
+
const [f2, r2, c2] = b.filePath.split(':');
|
|
14
|
+
return f === f2 ? (Number(r) === Number(r2) ? Number(c) - Number(c2) : Number(r) - Number(r2)) : f.localeCompare(f2);
|
|
15
|
+
};
|
|
11
16
|
const hl = (issue) => {
|
|
12
17
|
if (issue.specifier && issue.specifier !== issue.symbol && issue.specifier.includes(issue.symbol)) {
|
|
13
18
|
const parts = issue.specifier.split(issue.symbol);
|
|
@@ -32,7 +37,7 @@ const logIssueRecord = (issues) => {
|
|
|
32
37
|
issue.isFixed && table.cell('fixed', print('(removed)'));
|
|
33
38
|
table.newRow();
|
|
34
39
|
}
|
|
35
|
-
console.log(table.sort(
|
|
40
|
+
console.log(table.sort(sortByPos).print().trim());
|
|
36
41
|
};
|
|
37
42
|
export default ({ report, issues, tagHints, configurationHints, noConfigHints, isShowProgress }) => {
|
|
38
43
|
const reportMultipleGroups = Object.values(report).filter(Boolean).length > 1;
|
package/dist/schema/plugins.d.ts
CHANGED
|
@@ -170,6 +170,19 @@ export declare const pluginsSchema: z.ZodObject<{
|
|
|
170
170
|
entry?: string | string[] | undefined;
|
|
171
171
|
project?: string | string[] | undefined;
|
|
172
172
|
}>]>;
|
|
173
|
+
'dependency-cruiser': z.ZodUnion<[z.ZodBoolean, z.ZodUnion<[z.ZodString, z.ZodArray<z.ZodString, "many">]>, z.ZodObject<{
|
|
174
|
+
config: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodArray<z.ZodString, "many">]>>;
|
|
175
|
+
entry: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodArray<z.ZodString, "many">]>>;
|
|
176
|
+
project: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodArray<z.ZodString, "many">]>>;
|
|
177
|
+
}, "strip", z.ZodTypeAny, {
|
|
178
|
+
config?: string | string[] | undefined;
|
|
179
|
+
entry?: string | string[] | undefined;
|
|
180
|
+
project?: string | string[] | undefined;
|
|
181
|
+
}, {
|
|
182
|
+
config?: string | string[] | undefined;
|
|
183
|
+
entry?: string | string[] | undefined;
|
|
184
|
+
project?: string | string[] | undefined;
|
|
185
|
+
}>]>;
|
|
173
186
|
dotenv: z.ZodUnion<[z.ZodBoolean, z.ZodUnion<[z.ZodString, z.ZodArray<z.ZodString, "many">]>, z.ZodObject<{
|
|
174
187
|
config: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodArray<z.ZodString, "many">]>>;
|
|
175
188
|
entry: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodArray<z.ZodString, "many">]>>;
|
|
@@ -1250,6 +1263,11 @@ export declare const pluginsSchema: z.ZodObject<{
|
|
|
1250
1263
|
entry?: string | string[] | undefined;
|
|
1251
1264
|
project?: string | string[] | undefined;
|
|
1252
1265
|
};
|
|
1266
|
+
'dependency-cruiser': string | boolean | string[] | {
|
|
1267
|
+
config?: string | string[] | undefined;
|
|
1268
|
+
entry?: string | string[] | undefined;
|
|
1269
|
+
project?: string | string[] | undefined;
|
|
1270
|
+
};
|
|
1253
1271
|
dotenv: string | boolean | string[] | {
|
|
1254
1272
|
config?: string | string[] | undefined;
|
|
1255
1273
|
entry?: string | string[] | undefined;
|
|
@@ -1701,6 +1719,11 @@ export declare const pluginsSchema: z.ZodObject<{
|
|
|
1701
1719
|
entry?: string | string[] | undefined;
|
|
1702
1720
|
project?: string | string[] | undefined;
|
|
1703
1721
|
};
|
|
1722
|
+
'dependency-cruiser': string | boolean | string[] | {
|
|
1723
|
+
config?: string | string[] | undefined;
|
|
1724
|
+
entry?: string | string[] | undefined;
|
|
1725
|
+
project?: string | string[] | undefined;
|
|
1726
|
+
};
|
|
1704
1727
|
dotenv: string | boolean | string[] | {
|
|
1705
1728
|
config?: string | string[] | undefined;
|
|
1706
1729
|
entry?: string | string[] | undefined;
|
package/dist/schema/plugins.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export type PluginName = 'angular' | 'astro' | 'ava' | 'babel' | 'c8' | 'capacitor' | 'changesets' | 'commitizen' | 'commitlint' | 'cspell' | 'cucumber' | 'cypress' | 'dotenv' | 'drizzle' | 'eleventy' | 'eslint' | 'expo' | 'gatsby' | 'github-actions' | 'glob' | 'graphql-codegen' | 'husky' | 'jest' | 'karma' | 'ladle' | 'lefthook' | 'lint-staged' | 'linthtml' | 'lockfile-lint' | 'lost-pixel' | 'markdownlint' | 'metro' | 'mocha' | 'moonrepo' | 'msw' | 'nest' | 'netlify' | 'next' | 'node' | 'node-test-runner' | 'nodemon' | 'npm-package-json-lint' | 'nuxt' | 'nx' | 'nyc' | 'oclif' | 'playwright' | 'playwright-ct' | 'playwright-test' | 'plop' | 'postcss' | 'preconstruct' | 'prettier' | 'react-cosmos' | 'release-it' | 'remark' | 'remix' | 'rollup' | 'rsbuild' | 'rspack' | 'semantic-release' | 'sentry' | 'simple-git-hooks' | 'size-limit' | 'storybook' | 'stryker' | 'stylelint' | 'svelte' | 'syncpack' | 'tailwind' | 'travis' | 'ts-node' | 'tsup' | 'tsx' | 'typedoc' | 'typescript' | 'unbuild' | 'unocss' | 'vercel-og' | 'vike' | 'vite' | 'vitest' | 'vue' | 'webdriver-io' | 'webpack' | 'wireit' | 'wrangler' | 'xo' | 'yarn' | 'yorkie';
|
|
2
|
-
export declare const pluginNames: readonly ["angular", "astro", "ava", "babel", "c8", "capacitor", "changesets", "commitizen", "commitlint", "cspell", "cucumber", "cypress", "dotenv", "drizzle", "eleventy", "eslint", "expo", "gatsby", "github-actions", "glob", "graphql-codegen", "husky", "jest", "karma", "ladle", "lefthook", "lint-staged", "linthtml", "lockfile-lint", "lost-pixel", "markdownlint", "metro", "mocha", "moonrepo", "msw", "nest", "netlify", "next", "node", "node-test-runner", "nodemon", "npm-package-json-lint", "nuxt", "nx", "nyc", "oclif", "playwright", "playwright-ct", "playwright-test", "plop", "postcss", "preconstruct", "prettier", "react-cosmos", "release-it", "remark", "remix", "rollup", "rsbuild", "rspack", "semantic-release", "sentry", "simple-git-hooks", "size-limit", "storybook", "stryker", "stylelint", "svelte", "syncpack", "tailwind", "travis", "ts-node", "tsup", "tsx", "typedoc", "typescript", "unbuild", "unocss", "vercel-og", "vike", "vite", "vitest", "vue", "webdriver-io", "webpack", "wireit", "wrangler", "xo", "yarn", "yorkie"];
|
|
1
|
+
export type PluginName = 'angular' | 'astro' | 'ava' | 'babel' | 'c8' | 'capacitor' | 'changesets' | 'commitizen' | 'commitlint' | 'cspell' | 'cucumber' | 'cypress' | 'dependency-cruiser' | 'dotenv' | 'drizzle' | 'eleventy' | 'eslint' | 'expo' | 'gatsby' | 'github-actions' | 'glob' | 'graphql-codegen' | 'husky' | 'jest' | 'karma' | 'ladle' | 'lefthook' | 'lint-staged' | 'linthtml' | 'lockfile-lint' | 'lost-pixel' | 'markdownlint' | 'metro' | 'mocha' | 'moonrepo' | 'msw' | 'nest' | 'netlify' | 'next' | 'node' | 'node-test-runner' | 'nodemon' | 'npm-package-json-lint' | 'nuxt' | 'nx' | 'nyc' | 'oclif' | 'playwright' | 'playwright-ct' | 'playwright-test' | 'plop' | 'postcss' | 'preconstruct' | 'prettier' | 'react-cosmos' | 'release-it' | 'remark' | 'remix' | 'rollup' | 'rsbuild' | 'rspack' | 'semantic-release' | 'sentry' | 'simple-git-hooks' | 'size-limit' | 'storybook' | 'stryker' | 'stylelint' | 'svelte' | 'syncpack' | 'tailwind' | 'travis' | 'ts-node' | 'tsup' | 'tsx' | 'typedoc' | 'typescript' | 'unbuild' | 'unocss' | 'vercel-og' | 'vike' | 'vite' | 'vitest' | 'vue' | 'webdriver-io' | 'webpack' | 'wireit' | 'wrangler' | 'xo' | 'yarn' | 'yorkie';
|
|
2
|
+
export declare const pluginNames: readonly ["angular", "astro", "ava", "babel", "c8", "capacitor", "changesets", "commitizen", "commitlint", "cspell", "cucumber", "cypress", "dependency-cruiser", "dotenv", "drizzle", "eleventy", "eslint", "expo", "gatsby", "github-actions", "glob", "graphql-codegen", "husky", "jest", "karma", "ladle", "lefthook", "lint-staged", "linthtml", "lockfile-lint", "lost-pixel", "markdownlint", "metro", "mocha", "moonrepo", "msw", "nest", "netlify", "next", "node", "node-test-runner", "nodemon", "npm-package-json-lint", "nuxt", "nx", "nyc", "oclif", "playwright", "playwright-ct", "playwright-test", "plop", "postcss", "preconstruct", "prettier", "react-cosmos", "release-it", "remark", "remix", "rollup", "rsbuild", "rspack", "semantic-release", "sentry", "simple-git-hooks", "size-limit", "storybook", "stryker", "stylelint", "svelte", "syncpack", "tailwind", "travis", "ts-node", "tsup", "tsx", "typedoc", "typescript", "unbuild", "unocss", "vercel-og", "vike", "vite", "vitest", "vue", "webdriver-io", "webpack", "wireit", "wrangler", "xo", "yarn", "yorkie"];
|
package/dist/types/config.d.ts
CHANGED
|
@@ -15,7 +15,7 @@ export interface GetInputsFromScriptsOptions extends BaseOptions {
|
|
|
15
15
|
export type GetInputsFromScripts<T = GetInputsFromScriptsOptions> = (npmScripts: string | string[] | Set<string>, options: T) => Input[];
|
|
16
16
|
export type GetInputsFromScriptsPartial = (npmScripts: string | string[] | Set<string>, options?: Partial<GetInputsFromScriptsOptions>) => Input[];
|
|
17
17
|
type FromArgs = (args: string[]) => Input[];
|
|
18
|
-
interface BinaryResolverOptions extends GetInputsFromScriptsOptions {
|
|
18
|
+
export interface BinaryResolverOptions extends GetInputsFromScriptsOptions {
|
|
19
19
|
fromArgs: FromArgs;
|
|
20
20
|
}
|
|
21
21
|
export type BinaryResolver = (binary: string, args: string[], options: BinaryResolverOptions) => Input[];
|
|
@@ -92,7 +92,6 @@ export type ResolveConfig<T = any> = (config: T, options: PluginOptions) => Prom
|
|
|
92
92
|
export type Resolve = (options: PluginOptions) => Promise<Input[]> | Input[];
|
|
93
93
|
export interface Plugin {
|
|
94
94
|
title: string;
|
|
95
|
-
note?: string;
|
|
96
95
|
args?: Args;
|
|
97
96
|
packageJsonPath?: string | ((manifest: PackageJson) => string);
|
|
98
97
|
enablers?: IgnorePatterns | string;
|
|
@@ -5,4 +5,4 @@ export declare const isNotJS: (sourceFile: BoundSourceFile) => boolean;
|
|
|
5
5
|
export declare const isJS: (sourceFile: BoundSourceFile) => boolean;
|
|
6
6
|
export declare const isModule: (sourceFile: BoundSourceFile) => boolean;
|
|
7
7
|
export declare function getImportsFromPragmas(sourceFile: BoundSourceFile): ImportNode[];
|
|
8
|
-
export declare function hasImportSpecifier(node: ts.Statement, name: string): boolean;
|
|
8
|
+
export declare function hasImportSpecifier(node: ts.Statement, name: string, id?: string): boolean;
|
|
@@ -29,11 +29,11 @@ export function getImportsFromPragmas(sourceFile) {
|
|
|
29
29
|
}
|
|
30
30
|
return importNodes;
|
|
31
31
|
}
|
|
32
|
-
export function hasImportSpecifier(node, name) {
|
|
32
|
+
export function hasImportSpecifier(node, name, id) {
|
|
33
33
|
return (ts.isImportDeclaration(node) &&
|
|
34
34
|
ts.isStringLiteral(node.moduleSpecifier) &&
|
|
35
35
|
node.moduleSpecifier.text === name &&
|
|
36
36
|
!!node.importClause?.namedBindings &&
|
|
37
37
|
ts.isNamedImports(node.importClause.namedBindings) &&
|
|
38
|
-
node.importClause.namedBindings.elements.some(element => element.name.text ===
|
|
38
|
+
(!id || node.importClause.namedBindings.elements.some(element => element.name.text === id)));
|
|
39
39
|
}
|
|
@@ -2,7 +2,7 @@ import ts from 'typescript';
|
|
|
2
2
|
import { stripQuotes } from '../../ast-helpers.js';
|
|
3
3
|
import { hasImportSpecifier } from '../helpers.js';
|
|
4
4
|
import { scriptVisitor as visit } from '../index.js';
|
|
5
|
-
export default visit(sourceFile => sourceFile.statements.some(node => hasImportSpecifier(node, 'bun')), node => {
|
|
5
|
+
export default visit(sourceFile => sourceFile.statements.some(node => hasImportSpecifier(node, 'bun', '$')), node => {
|
|
6
6
|
if (ts.isTaggedTemplateExpression(node) && node.tag.getText() === '$') {
|
|
7
7
|
return stripQuotes(node.template.getText());
|
|
8
8
|
}
|
|
@@ -2,10 +2,33 @@ import ts from 'typescript';
|
|
|
2
2
|
import { stripQuotes } from '../../ast-helpers.js';
|
|
3
3
|
import { hasImportSpecifier } from '../helpers.js';
|
|
4
4
|
import { scriptVisitor as visit } from '../index.js';
|
|
5
|
+
const tags = new Set(['$', '$sync']);
|
|
6
|
+
const methods = new Set(['execa', 'execaSync', 'execaCommand', 'execaCommandSync', '$sync']);
|
|
5
7
|
export default visit(sourceFile => sourceFile.statements.some(node => hasImportSpecifier(node, 'execa')), node => {
|
|
6
8
|
if (ts.isTaggedTemplateExpression(node)) {
|
|
7
|
-
if (node.tag.getText()
|
|
9
|
+
if (tags.has(node.tag.getText()) || (ts.isCallExpression(node.tag) && tags.has(node.tag.expression.getText()))) {
|
|
8
10
|
return stripQuotes(node.template.getText());
|
|
9
11
|
}
|
|
10
12
|
}
|
|
13
|
+
if (ts.isCallExpression(node)) {
|
|
14
|
+
const functionName = node.expression.getText();
|
|
15
|
+
if (methods.has(functionName)) {
|
|
16
|
+
if (functionName.startsWith('execaCommand')) {
|
|
17
|
+
if (node.arguments[0] && ts.isStringLiteral(node.arguments[0])) {
|
|
18
|
+
return stripQuotes(node.arguments[0].getText());
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
else {
|
|
22
|
+
const [executable, args] = node.arguments;
|
|
23
|
+
if (executable && ts.isStringLiteral(executable)) {
|
|
24
|
+
const executableStr = stripQuotes(executable.getText());
|
|
25
|
+
if (args && ts.isArrayLiteralExpression(args)) {
|
|
26
|
+
const argStrings = args.elements.filter(ts.isStringLiteral).map(arg => stripQuotes(arg.getText()));
|
|
27
|
+
return [executableStr, ...argStrings].join(' ');
|
|
28
|
+
}
|
|
29
|
+
return executableStr;
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
}
|
|
11
34
|
});
|
|
@@ -35,7 +35,7 @@ export const getReferencedInputsHandler = (collector, deputy, chief, isGitIgnore
|
|
|
35
35
|
const isHandled = deputy.maybeAddReferencedExternalDependency(inputWorkspace, packageName);
|
|
36
36
|
if (isWorkspace || isDependency(input)) {
|
|
37
37
|
if (!isHandled) {
|
|
38
|
-
if ((deputy.isProduction && input.production) || !deputy.isProduction) {
|
|
38
|
+
if (!input.optional && ((deputy.isProduction && input.production) || !deputy.isProduction)) {
|
|
39
39
|
collector.addIssue({
|
|
40
40
|
type: 'unlisted',
|
|
41
41
|
filePath: containingFilePath,
|
|
@@ -47,7 +47,7 @@ export const getReferencedInputsHandler = (collector, deputy, chief, isGitIgnore
|
|
|
47
47
|
return;
|
|
48
48
|
}
|
|
49
49
|
const ref = _resolveSync(specifier, dirname(containingFilePath));
|
|
50
|
-
if (ref && !isGitIgnored(ref))
|
|
50
|
+
if (ref && isInternal(ref) && !isGitIgnored(ref))
|
|
51
51
|
return ref;
|
|
52
52
|
}
|
|
53
53
|
if (isHandled)
|
|
@@ -63,6 +63,8 @@ export const getReferencedInputsHandler = (collector, deputy, chief, isGitIgnore
|
|
|
63
63
|
if (resolvedFilePath && isInternal(resolvedFilePath)) {
|
|
64
64
|
return isGitIgnored(resolvedFilePath) ? undefined : resolvedFilePath;
|
|
65
65
|
}
|
|
66
|
+
if (input.optional)
|
|
67
|
+
return;
|
|
66
68
|
if (!isInternal(filePath)) {
|
|
67
69
|
collector.addIssue({
|
|
68
70
|
type: 'unlisted',
|
package/dist/util/input.d.ts
CHANGED
|
@@ -4,6 +4,7 @@ export interface Input {
|
|
|
4
4
|
type: InputType;
|
|
5
5
|
specifier: string;
|
|
6
6
|
production?: boolean;
|
|
7
|
+
optional?: boolean;
|
|
7
8
|
dir?: string;
|
|
8
9
|
containingFilePath?: string;
|
|
9
10
|
}
|
|
@@ -14,6 +15,7 @@ export interface ConfigInput extends Input {
|
|
|
14
15
|
}
|
|
15
16
|
type Options = {
|
|
16
17
|
production?: boolean;
|
|
18
|
+
optional?: boolean;
|
|
17
19
|
dir?: string;
|
|
18
20
|
containingFilePath?: string;
|
|
19
21
|
};
|
|
@@ -26,7 +28,7 @@ export declare const toProductionEntry: (specifier: string, options?: Options) =
|
|
|
26
28
|
export declare const isProductionEntry: (input: Input) => boolean;
|
|
27
29
|
export declare const toConfig: (pluginName: PluginName, specifier: string, containingFilePath: string) => ConfigInput;
|
|
28
30
|
export declare const isConfigPattern: (input: Input) => input is ConfigInput;
|
|
29
|
-
export declare const toDependency: (specifier: string) => Input;
|
|
31
|
+
export declare const toDependency: (specifier: string, options?: Options) => Input;
|
|
30
32
|
export declare const isDependency: (input: Input) => boolean;
|
|
31
33
|
export declare const toProductionDependency: (specifier: string) => Input;
|
|
32
34
|
export declare const toDevDependency: (specifier: string) => Input;
|
package/dist/util/input.js
CHANGED
|
@@ -22,7 +22,11 @@ export const toConfig = (pluginName, specifier, containingFilePath) => ({
|
|
|
22
22
|
containingFilePath,
|
|
23
23
|
});
|
|
24
24
|
export const isConfigPattern = (input) => input.type === 'config';
|
|
25
|
-
export const toDependency = (specifier) => ({
|
|
25
|
+
export const toDependency = (specifier, options = {}) => ({
|
|
26
|
+
type: 'dependency',
|
|
27
|
+
specifier,
|
|
28
|
+
...options,
|
|
29
|
+
});
|
|
26
30
|
export const isDependency = (input) => input.type === 'dependency';
|
|
27
31
|
export const toProductionDependency = (specifier) => ({
|
|
28
32
|
type: 'dependency',
|
package/dist/util/modules.js
CHANGED
|
@@ -19,7 +19,7 @@ export const getPackageNameFromFilePath = (value) => {
|
|
|
19
19
|
export const getPackageNameFromSpecifier = (specifier) => isInNodeModules(specifier) ? getPackageNameFromFilePath(specifier) : getPackageNameFromModuleSpecifier(specifier);
|
|
20
20
|
export const isStartsLikePackageName = (specifier) => /^(@[a-z0-9._]|[a-z0-9])/i.test(specifier);
|
|
21
21
|
export const stripVersionFromSpecifier = (specifier) => specifier.replace(/(\S+)@.*/, '$1');
|
|
22
|
-
const stripNodeModulesFromPath = (command) => command.replace(
|
|
22
|
+
const stripNodeModulesFromPath = (command) => command.replace(/(?:\.{0,2}\/)*node_modules\//, '');
|
|
23
23
|
export const extractBinary = (command) => stripVersionFromSpecifier(stripNodeModulesFromPath(command)
|
|
24
24
|
.replace(/^(\.bin\/)/, '')
|
|
25
25
|
.replace(/\$\(npm bin\)\/(\w+)/, '$1'));
|
package/dist/version.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const version = "5.42.
|
|
1
|
+
export declare const version = "5.42.1";
|
package/dist/version.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const version = '5.42.
|
|
1
|
+
export const version = '5.42.1';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "knip",
|
|
3
|
-
"version": "5.42.
|
|
3
|
+
"version": "5.42.1",
|
|
4
4
|
"description": "Find unused files, dependencies and exports in your TypeScript and JavaScript projects",
|
|
5
5
|
"homepage": "https://knip.dev",
|
|
6
6
|
"repository": {
|
|
@@ -41,6 +41,7 @@
|
|
|
41
41
|
"lint": "biome lint ../..",
|
|
42
42
|
"format": "biome format --write .",
|
|
43
43
|
"test": "bun test test/*.test.ts test/**/*.test.ts",
|
|
44
|
+
"test:watch": "bun test test/*.test.ts test/**/*.test.ts --reporter=junit --reporter-outfile=junit.xml || bun test --watch $(grep -o 'name=\"[^\"]*\".*failures=\"[^0]' junit.xml | grep -v 'name=\"bun test\"' | grep -o 'name=\"[^\"]*\"' | cut -d'\"' -f2)",
|
|
44
45
|
"test:node": "glob -c \"npx -y tsx --test --import ./transform-test.js\" \"test/**/*.test.ts\"",
|
|
45
46
|
"watch": "npm link && tsc --watch",
|
|
46
47
|
"prebuild": "npm run generate-plugin-defs && node rmdir.js dist",
|
|
@@ -82,7 +83,7 @@
|
|
|
82
83
|
"devDependencies": {
|
|
83
84
|
"@jest/types": "^29.6.3",
|
|
84
85
|
"@release-it/bumper": "^7.0.0",
|
|
85
|
-
"@types/bun": "^1.1.
|
|
86
|
+
"@types/bun": "^1.1.16",
|
|
86
87
|
"@types/js-yaml": "^4.0.9",
|
|
87
88
|
"@types/minimist": "^1.2.5",
|
|
88
89
|
"@types/picomatch": "3.0.1",
|
package/schema.json
CHANGED
|
@@ -328,6 +328,10 @@
|
|
|
328
328
|
"title": "Cypress plugin configuration (https://knip.dev/reference/plugins/cypress)",
|
|
329
329
|
"$ref": "#/definitions/plugin"
|
|
330
330
|
},
|
|
331
|
+
"dependency-cruiser": {
|
|
332
|
+
"title": "dependency-cruiser plugin configuration (https://knip.dev/reference/plugins/dependency-cruiser)",
|
|
333
|
+
"$ref": "#/definitions/plugin"
|
|
334
|
+
},
|
|
331
335
|
"dotenv": {
|
|
332
336
|
"title": "dotenv plugin configuration (https://knip.dev/reference/plugins/dotenv)",
|
|
333
337
|
"$ref": "#/definitions/plugin"
|