knip 5.42.0 → 5.42.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/ConfigurationChief.d.ts +1 -0
- package/dist/ConfigurationValidator.d.ts +56 -0
- package/dist/IssueCollector.js +6 -4
- package/dist/WorkspaceWorker.js +2 -1
- 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 +34 -10
- package/dist/binaries/plugins.js +7 -2
- package/dist/compilers/index.d.ts +10 -0
- package/dist/index.js +6 -6
- package/dist/plugins/angular/index.js +26 -10
- 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.d.ts +1 -1
- package/dist/plugins/expo/helpers.js +3 -2
- package/dist/plugins/expo/index.js +2 -1
- package/dist/plugins/expo/types.d.ts +2 -1
- package/dist/plugins/gatsby/index.js +1 -1
- package/dist/plugins/github-actions/index.js +15 -10
- package/dist/plugins/github-actions/types.d.ts +20 -0
- package/dist/plugins/github-actions/types.js +1 -0
- 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 +5 -3
- 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;
|
package/dist/WorkspaceWorker.js
CHANGED
|
@@ -251,8 +251,9 @@ export class WorkspaceWorker {
|
|
|
251
251
|
if (hasResolveConfig) {
|
|
252
252
|
const inputs = (await plugin.resolveConfig?.(config, opts)) ?? [];
|
|
253
253
|
for (const input of inputs) {
|
|
254
|
-
if (isConfigPattern(input))
|
|
254
|
+
if (isConfigPattern(input)) {
|
|
255
255
|
handleConfigInput(input.pluginName, { ...input, containingFilePath: configFilePath });
|
|
256
|
+
}
|
|
256
257
|
addInput(input, configFilePath);
|
|
257
258
|
}
|
|
258
259
|
data.resolveConfig = inputs;
|
|
@@ -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
|
+
};
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import parseArgs from 'minimist';
|
|
2
|
-
import { toBinary } from '../../util/input.js';
|
|
2
|
+
import { isBinary, isDependency, toBinary, toDependency } from '../../util/input.js';
|
|
3
|
+
import { stripVersionFromSpecifier } from '../../util/modules.js';
|
|
3
4
|
import { join } from '../../util/path.js';
|
|
4
5
|
const commands = [
|
|
5
6
|
'add',
|
|
@@ -34,17 +35,40 @@ const commands = [
|
|
|
34
35
|
'workspace',
|
|
35
36
|
'workspaces',
|
|
36
37
|
];
|
|
37
|
-
|
|
38
|
+
const resolveDlx = (args, options) => {
|
|
39
|
+
const parsed = parseArgs(args, {
|
|
40
|
+
boolean: ['quiet'],
|
|
41
|
+
alias: { package: 'p', quiet: 'q' },
|
|
42
|
+
});
|
|
43
|
+
const packageSpecifier = parsed._[0];
|
|
44
|
+
const specifier = packageSpecifier ? stripVersionFromSpecifier(packageSpecifier) : '';
|
|
45
|
+
const packages = parsed.package && !parsed.yes ? [parsed.package].flat().map(stripVersionFromSpecifier) : [];
|
|
46
|
+
const command = specifier ? options.fromArgs(parsed._) : [];
|
|
47
|
+
return [...packages.map(id => toDependency(id)), ...command].map(id => isDependency(id) || isBinary(id) ? Object.assign(id, { optional: true }) : id);
|
|
48
|
+
};
|
|
49
|
+
export const resolve = (_binary, args, options) => {
|
|
50
|
+
const { manifestScriptNames, fromArgs, cwd, rootCwd } = options;
|
|
38
51
|
const parsed = parseArgs(args, { boolean: ['top-level'], string: ['cwd'] });
|
|
39
|
-
const [command, binary] = parsed._;
|
|
40
52
|
const dir = parsed['top-level'] ? rootCwd : parsed.cwd ? join(cwd, parsed.cwd) : undefined;
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
53
|
+
const [command, binary] = parsed._;
|
|
54
|
+
if (command === 'run') {
|
|
55
|
+
if (manifestScriptNames.has(binary))
|
|
56
|
+
return [];
|
|
57
|
+
const bin = toBinary(binary, { optional: true });
|
|
58
|
+
if (dir)
|
|
59
|
+
Object.assign(bin, { dir });
|
|
60
|
+
return [bin];
|
|
61
|
+
}
|
|
47
62
|
if (command === 'node')
|
|
48
63
|
return fromArgs(parsed._);
|
|
49
|
-
|
|
64
|
+
if (command === 'dlx') {
|
|
65
|
+
const argsForDlx = args.filter(arg => arg !== 'dlx');
|
|
66
|
+
return resolveDlx(argsForDlx, options);
|
|
67
|
+
}
|
|
68
|
+
if ((!dir && manifestScriptNames.has(command)) || commands.includes(command))
|
|
69
|
+
return [];
|
|
70
|
+
const bin = command === 'exec' ? toBinary(binary) : toBinary(command);
|
|
71
|
+
if (dir)
|
|
72
|
+
Object.assign(bin, { dir });
|
|
73
|
+
return [bin];
|
|
50
74
|
};
|
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
|
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { existsSync } from 'node:fs';
|
|
2
|
+
import { toConfig, toDeferResolve, toDependency, toEntry, toProductionEntry } from '../../util/input.js';
|
|
3
|
+
import { isInternal, join } from '../../util/path.js';
|
|
3
4
|
import { hasDependency } from '../../util/plugin.js';
|
|
4
5
|
import * as karma from '../karma/helpers.js';
|
|
5
6
|
const title = 'Angular';
|
|
@@ -27,21 +28,31 @@ const resolveConfig = async (config, options) => {
|
|
|
27
28
|
const defaultEntriesByOption = opts ? entriesByOption(opts) : new Map();
|
|
28
29
|
const entriesByOptionByConfig = new Map(configs ? Object.entries(configs).map(([name, opts]) => [name, entriesByOption(opts)]) : []);
|
|
29
30
|
const productionEntriesByOption = entriesByOptionByConfig.get(PRODUCTION_CONFIG_NAME) ?? new Map();
|
|
30
|
-
const
|
|
31
|
+
const isBuildTarget = targetName === BUILD_TARGET_NAME;
|
|
32
|
+
const maybeExternal = (option) => option === 'polyfills';
|
|
33
|
+
const toInput = (specifier, opts) => {
|
|
34
|
+
const normalizedPath = join(cwd, specifier);
|
|
35
|
+
if (opts.maybeExternal && !isInternal(specifier) && !existsSync(normalizedPath)) {
|
|
36
|
+
return toDeferResolve(specifier);
|
|
37
|
+
}
|
|
38
|
+
return opts.isProduction ? toProductionEntry(normalizedPath) : toEntry(normalizedPath);
|
|
39
|
+
};
|
|
31
40
|
for (const [configName, entriesByOption] of entriesByOptionByConfig.entries()) {
|
|
32
|
-
for (const entries of entriesByOption.
|
|
41
|
+
for (const [option, entries] of entriesByOption.entries()) {
|
|
33
42
|
for (const entry of entries) {
|
|
34
|
-
inputs.add(
|
|
35
|
-
|
|
36
|
-
:
|
|
43
|
+
inputs.add(toInput(entry, {
|
|
44
|
+
isProduction: isBuildTarget && configName === PRODUCTION_CONFIG_NAME,
|
|
45
|
+
maybeExternal: maybeExternal(option),
|
|
46
|
+
}));
|
|
37
47
|
}
|
|
38
48
|
}
|
|
39
49
|
}
|
|
40
50
|
for (const [option, entries] of defaultEntriesByOption.entries()) {
|
|
41
51
|
for (const entry of entries) {
|
|
42
|
-
inputs.add(
|
|
43
|
-
|
|
44
|
-
:
|
|
52
|
+
inputs.add(toInput(entry, {
|
|
53
|
+
isProduction: isBuildTarget && !productionEntriesByOption.get(option)?.length,
|
|
54
|
+
maybeExternal: maybeExternal(option),
|
|
55
|
+
}));
|
|
45
56
|
}
|
|
46
57
|
}
|
|
47
58
|
if (target.builder === '@angular-devkit/build-angular:karma' && opts) {
|
|
@@ -74,6 +85,11 @@ const entriesByOption = (opts) => new Map(Object.entries({
|
|
|
74
85
|
scripts: 'scripts' in opts && opts.scripts && Array.isArray(opts.scripts)
|
|
75
86
|
? opts.scripts.map(scriptStringOrObject => typeof scriptStringOrObject === 'string' ? scriptStringOrObject : scriptStringOrObject.input)
|
|
76
87
|
: [],
|
|
88
|
+
polyfills: 'polyfills' in opts && opts.polyfills
|
|
89
|
+
? Array.isArray(opts.polyfills)
|
|
90
|
+
? opts.polyfills
|
|
91
|
+
: [opts.polyfills]
|
|
92
|
+
: [],
|
|
77
93
|
fileReplacements: 'fileReplacements' in opts && opts.fileReplacements && Array.isArray(opts.fileReplacements)
|
|
78
94
|
? opts.fileReplacements.map(fileReplacement => 'with' in fileReplacement ? fileReplacement.with : fileReplacement.replaceWith)
|
|
79
95
|
: [],
|
|
@@ -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
|
+
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import type { PluginOptions } from '../../types/config.js';
|
|
2
2
|
import { type Input } from '../../util/input.js';
|
|
3
3
|
import type { ExpoConfig } from './types.js';
|
|
4
|
-
export declare const getDependencies: (
|
|
4
|
+
export declare const getDependencies: (localConfig: ExpoConfig, { manifest }: PluginOptions) => Promise<Input[]>;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { toDependency, toProductionDependency } from '../../util/input.js';
|
|
2
2
|
import { getPackageNameFromModuleSpecifier } from '../../util/modules.js';
|
|
3
|
-
export const getDependencies = async (
|
|
3
|
+
export const getDependencies = async (localConfig, { manifest }) => {
|
|
4
|
+
const expoConfig = typeof localConfig === 'function' ? localConfig() : localConfig;
|
|
4
5
|
const config = 'expo' in expoConfig ? expoConfig.expo : expoConfig;
|
|
5
6
|
const platforms = config.platforms ?? ['ios', 'android'];
|
|
6
7
|
const pluginPackages = config.plugins
|
|
@@ -9,7 +10,7 @@ export const getDependencies = async (expoConfig, { manifest }) => {
|
|
|
9
10
|
return getPackageNameFromModuleSpecifier(pluginName);
|
|
10
11
|
})
|
|
11
12
|
.filter(Boolean) ?? [];
|
|
12
|
-
const inputs = new Set(pluginPackages.map(toDependency));
|
|
13
|
+
const inputs = new Set(pluginPackages.map(id => toDependency(id)));
|
|
13
14
|
const allowedPackages = ['expo-atlas', 'expo-dev-client'];
|
|
14
15
|
const allowedProductionPackages = ['expo-insights'];
|
|
15
16
|
const manifestDependencies = Object.keys(manifest.dependencies ?? {});
|
|
@@ -8,7 +8,8 @@ const isEnabled = ({ dependencies }) => hasDependency(dependencies, enablers);
|
|
|
8
8
|
const config = ['app.json', 'app.config.{ts,js}'];
|
|
9
9
|
const production = ['app/**/*.{js,jsx,ts,tsx}', 'src/app/**/*.{js,jsx,ts,tsx}'];
|
|
10
10
|
export const docs = { production };
|
|
11
|
-
const resolveEntryPaths = async (
|
|
11
|
+
const resolveEntryPaths = async (localConfig, { manifest }) => {
|
|
12
|
+
const expoConfig = typeof localConfig === 'function' ? localConfig() : localConfig;
|
|
12
13
|
const config = 'expo' in expoConfig ? expoConfig.expo : expoConfig;
|
|
13
14
|
let patterns = [];
|
|
14
15
|
if (manifest.main === 'expo-router/entry') {
|
|
@@ -15,7 +15,8 @@ type AppConfig = {
|
|
|
15
15
|
androidNavigationBar?: Record<string, unknown>;
|
|
16
16
|
plugins?: (string | [string, Record<string, unknown>])[];
|
|
17
17
|
};
|
|
18
|
-
|
|
18
|
+
type Config = AppConfig | {
|
|
19
19
|
expo: AppConfig;
|
|
20
20
|
};
|
|
21
|
+
export type ExpoConfig = Config | (() => Config);
|
|
21
22
|
export {};
|
|
@@ -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
|
};
|