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
|
@@ -8,8 +8,17 @@ const isEnabled = async ({ cwd }) => Boolean(await _firstGlob({ cwd, patterns: [
|
|
|
8
8
|
const isRootOnly = true;
|
|
9
9
|
const config = ['.github/workflows/*.{yml,yaml}', '.github/**/action.{yml,yaml}'];
|
|
10
10
|
const isString = (value) => typeof value === 'string';
|
|
11
|
+
const getActionDependencies = (config, options) => {
|
|
12
|
+
const { configFileDir, configFileName } = options;
|
|
13
|
+
const isActionManifest = configFileName === 'action.yml' || configFileName === 'action.yaml';
|
|
14
|
+
if (!(isActionManifest && config?.runs?.using?.startsWith('node')))
|
|
15
|
+
return [];
|
|
16
|
+
const runs = config.runs;
|
|
17
|
+
const scripts = [runs.pre, runs.main, runs.post].filter(isString);
|
|
18
|
+
return scripts.map(script => join(configFileDir, script));
|
|
19
|
+
};
|
|
11
20
|
const resolveConfig = async (config, options) => {
|
|
12
|
-
const {
|
|
21
|
+
const { rootCwd, getInputsFromScripts, isProduction } = options;
|
|
13
22
|
const inputs = new Set();
|
|
14
23
|
const jobs = findByKeyDeep(config, 'steps');
|
|
15
24
|
for (const steps of jobs) {
|
|
@@ -22,21 +31,17 @@ const resolveConfig = async (config, options) => {
|
|
|
22
31
|
const dir = join(rootCwd, path && workingDir ? relative(workingDir, path) : workingDir ? workingDir : '.');
|
|
23
32
|
if (step.run) {
|
|
24
33
|
for (const input of getInputsFromScripts([step.run], { knownBinsOnly: true })) {
|
|
25
|
-
if (isDeferResolveEntry(input) && path && !workingDir)
|
|
34
|
+
if (isDeferResolveEntry(input) && path && !workingDir) {
|
|
26
35
|
input.specifier = relative(join(dir, path), join(rootCwd, input.specifier));
|
|
36
|
+
}
|
|
37
|
+
if (isProduction)
|
|
38
|
+
Object.assign(input, { optional: true });
|
|
27
39
|
inputs.add({ ...input, dir });
|
|
28
40
|
}
|
|
29
41
|
}
|
|
30
42
|
}
|
|
31
43
|
}
|
|
32
|
-
|
|
33
|
-
const isActionManifest = configFileName === 'action.yml' || configFileName === 'action.yaml';
|
|
34
|
-
if (!(isActionManifest && config?.runs?.using?.startsWith('node')))
|
|
35
|
-
return [];
|
|
36
|
-
const scripts = [config.runs.pre, config.runs.main, config.runs.post].filter(isString);
|
|
37
|
-
return scripts.map(script => join(configFileDir, script));
|
|
38
|
-
};
|
|
39
|
-
return [...getActionDependencies().map(toEntry), ...inputs];
|
|
44
|
+
return [...inputs, ...getActionDependencies(config, options).map(toEntry)];
|
|
40
45
|
};
|
|
41
46
|
export default {
|
|
42
47
|
title,
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
type Step = {
|
|
2
|
+
run?: string;
|
|
3
|
+
uses?: string;
|
|
4
|
+
with?: {
|
|
5
|
+
repository: string;
|
|
6
|
+
path: string;
|
|
7
|
+
};
|
|
8
|
+
'working-directory'?: string;
|
|
9
|
+
};
|
|
10
|
+
type Steps = Step[];
|
|
11
|
+
export type Job = {
|
|
12
|
+
steps: Steps;
|
|
13
|
+
};
|
|
14
|
+
export type Runs = {
|
|
15
|
+
using: string;
|
|
16
|
+
main?: string;
|
|
17
|
+
pre?: string;
|
|
18
|
+
post?: string;
|
|
19
|
+
};
|
|
20
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -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
|
});
|
|
@@ -16,7 +16,7 @@ export const getReferencedInputsHandler = (collector, deputy, chief, isGitIgnore
|
|
|
16
16
|
const binaryName = fromBinary(input);
|
|
17
17
|
const inputWorkspace = getWorkspaceFor(input, chief, workspace);
|
|
18
18
|
const isHandled = deputy.maybeAddReferencedBinary(inputWorkspace, binaryName);
|
|
19
|
-
if (isHandled)
|
|
19
|
+
if (isHandled || input.optional)
|
|
20
20
|
return;
|
|
21
21
|
collector.addIssue({
|
|
22
22
|
type: 'binaries',
|
|
@@ -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',
|