knip 2.33.3 → 2.33.4
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/README.md +2 -0
- package/dist/WorkspaceWorker.js +12 -17
- package/dist/binaries/bash-parser.js +1 -1
- package/dist/index.js +17 -16
- package/dist/plugins/_template/index.js +14 -3
- package/dist/plugins/_template/types.d.ts +1 -0
- package/dist/plugins/angular/index.js +11 -11
- package/dist/plugins/ava/index.js +13 -12
- package/dist/plugins/babel/index.js +8 -5
- package/dist/plugins/capacitor/index.js +4 -2
- package/dist/plugins/changesets/index.js +7 -5
- package/dist/plugins/commitizen/index.js +4 -3
- package/dist/plugins/commitizen/types.d.ts +1 -1
- package/dist/plugins/commitlint/index.js +4 -2
- package/dist/plugins/cspell/index.js +4 -2
- package/dist/plugins/cspell/types.d.ts +1 -1
- package/dist/plugins/cypress/index.js +7 -4
- package/dist/plugins/drizzle/index.js +4 -4
- package/dist/plugins/eslint/fallback.js +6 -1
- package/dist/plugins/eslint/helpers.d.ts +2 -2
- package/dist/plugins/eslint/helpers.js +7 -7
- package/dist/plugins/eslint/index.d.ts +0 -1
- package/dist/plugins/eslint/index.js +3 -4
- package/dist/plugins/gatsby/index.js +5 -8
- package/dist/plugins/github-actions/index.d.ts +1 -1
- package/dist/plugins/github-actions/index.js +5 -4
- package/dist/plugins/husky/index.js +4 -2
- package/dist/plugins/jest/index.js +8 -8
- package/dist/plugins/jest/types.d.ts +3 -0
- package/dist/plugins/jest/types.js +1 -0
- package/dist/plugins/lefthook/index.js +5 -4
- package/dist/plugins/lint-staged/index.js +7 -7
- package/dist/plugins/markdownlint/index.js +5 -4
- package/dist/plugins/mocha/index.js +8 -7
- package/dist/plugins/mocha/types.d.ts +4 -0
- package/dist/plugins/mocha/types.js +1 -0
- package/dist/plugins/npm-package-json-lint/index.js +4 -3
- package/dist/plugins/nx/index.js +5 -4
- package/dist/plugins/nyc/index.js +4 -3
- package/dist/plugins/nyc/types.d.ts +3 -0
- package/dist/plugins/nyc/types.js +1 -0
- package/dist/plugins/playwright/index.d.ts +1 -1
- package/dist/plugins/playwright/index.js +7 -6
- package/dist/plugins/playwright-ct/index.js +11 -6
- package/dist/plugins/postcss/index.js +6 -5
- package/dist/plugins/prettier/index.js +3 -3
- package/dist/plugins/prettier/types.d.ts +8 -0
- package/dist/plugins/prettier/types.js +1 -0
- package/dist/plugins/release-it/index.js +10 -9
- package/dist/plugins/remark/index.js +6 -5
- package/dist/plugins/remix/index.js +1 -5
- package/dist/plugins/rollup/index.js +1 -1
- package/dist/plugins/semantic-release/index.js +5 -4
- package/dist/plugins/semantic-release/types.d.ts +1 -1
- package/dist/plugins/storybook/index.js +13 -11
- package/dist/plugins/stryker/index.js +9 -6
- package/dist/plugins/stylelint/index.js +6 -5
- package/dist/plugins/typedoc/index.js +4 -3
- package/dist/plugins/typedoc/types.d.ts +1 -1
- package/dist/plugins/typescript/index.js +13 -10
- package/dist/plugins/vite/index.js +4 -2
- package/dist/plugins/vitest/index.d.ts +1 -1
- package/dist/plugins/vitest/index.js +8 -8
- package/dist/plugins/webpack/index.js +25 -15
- package/dist/plugins/webpack/types.d.ts +2 -1
- package/dist/types/config.d.ts +1 -1
- package/dist/types/plugins.d.ts +1 -1
- package/dist/typescript/SourceFileManager.js +3 -3
- package/dist/util/debug.d.ts +3 -3
- package/dist/util/debug.js +10 -8
- package/dist/util/glob.js +1 -1
- package/dist/util/path.js +1 -1
- package/dist/util/plugin.js +7 -1
- package/dist/util/require.js +1 -1
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/package.json +1 -1
|
@@ -4,10 +4,11 @@ import { getValuesByKeyDeep } from '../../util/object.js';
|
|
|
4
4
|
import { timerify } from '../../util/Performance.js';
|
|
5
5
|
import { load } from '../../util/plugin.js';
|
|
6
6
|
export const NAME = 'GitHub Actions';
|
|
7
|
-
export const ENABLERS = 'This plugin is enabled when a `.yml` file is found in the `.github/workflows` folder.';
|
|
8
|
-
export const isEnabled = async ({ cwd }) => Boolean(await _firstGlob({ cwd, patterns: ['.github/workflows/*.yml'] }));
|
|
9
|
-
export const CONFIG_FILE_PATTERNS = ['.github/workflows/*.yml', '.github/**/action.{yml,yaml}'];
|
|
10
|
-
const findGithubActionsDependencies = async (configFilePath,
|
|
7
|
+
export const ENABLERS = 'This plugin is enabled when a `.yml` or `.yaml` file is found in the `.github/workflows` folder.';
|
|
8
|
+
export const isEnabled = async ({ cwd }) => Boolean(await _firstGlob({ cwd, patterns: ['.github/workflows/*.{yml,yaml}'] }));
|
|
9
|
+
export const CONFIG_FILE_PATTERNS = ['.github/workflows/*.{yml,yaml}', '.github/**/action.{yml,yaml}'];
|
|
10
|
+
const findGithubActionsDependencies = async (configFilePath, options) => {
|
|
11
|
+
const { cwd, manifest, isProduction } = options;
|
|
11
12
|
if (isProduction)
|
|
12
13
|
return [];
|
|
13
14
|
const config = await load(configFilePath);
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { readFileSync } from 'fs';
|
|
2
2
|
import { _getDependenciesFromScripts } from '../../binaries/index.js';
|
|
3
3
|
import { getGitHookPaths } from '../../util/git.js';
|
|
4
|
+
import { FAKE_PATH } from '../../util/loader.js';
|
|
4
5
|
import { timerify } from '../../util/Performance.js';
|
|
5
6
|
import { hasDependency } from '../../util/plugin.js';
|
|
6
7
|
export const NAME = 'husky';
|
|
@@ -8,8 +9,9 @@ export const ENABLERS = ['husky'];
|
|
|
8
9
|
export const isEnabled = ({ dependencies }) => hasDependency(dependencies, ENABLERS);
|
|
9
10
|
const gitHookPaths = getGitHookPaths('.husky');
|
|
10
11
|
export const CONFIG_FILE_PATTERNS = [...gitHookPaths];
|
|
11
|
-
const findHuskyDependencies = async (configFilePath,
|
|
12
|
-
|
|
12
|
+
const findHuskyDependencies = async (configFilePath, options) => {
|
|
13
|
+
const { cwd, manifest, isProduction } = options;
|
|
14
|
+
if (isProduction || configFilePath === FAKE_PATH)
|
|
13
15
|
return [];
|
|
14
16
|
const script = readFileSync(configFilePath);
|
|
15
17
|
return _getDependenciesFromScripts(String(script), {
|
|
@@ -21,7 +21,7 @@ const resolveExtensibleConfig = async (configFilePath) => {
|
|
|
21
21
|
};
|
|
22
22
|
const resolveDependencies = (config, options) => {
|
|
23
23
|
const { isProduction } = options;
|
|
24
|
-
const entryPatterns = (config.testMatch ?? ENTRY_FILE_PATTERNS).map(toEntryPattern);
|
|
24
|
+
const entryPatterns = (options.config?.entry ?? config.testMatch ?? ENTRY_FILE_PATTERNS).map(toEntryPattern);
|
|
25
25
|
if (isProduction)
|
|
26
26
|
return entryPatterns;
|
|
27
27
|
const presets = (config.preset ? [config.preset] : []).map(preset => isInternal(preset) ? preset : join(preset, 'jest-preset'));
|
|
@@ -64,16 +64,16 @@ const resolveDependencies = (config, options) => {
|
|
|
64
64
|
};
|
|
65
65
|
const findJestDependencies = async (configFilePath, options) => {
|
|
66
66
|
const { manifest, cwd } = options;
|
|
67
|
-
let
|
|
67
|
+
let localConfig = configFilePath.endsWith('package.json')
|
|
68
68
|
? manifest.jest
|
|
69
69
|
: await resolveExtensibleConfig(configFilePath);
|
|
70
|
-
if (typeof
|
|
71
|
-
|
|
72
|
-
if (!
|
|
73
|
-
|
|
74
|
-
const rootDir =
|
|
70
|
+
if (typeof localConfig === 'function')
|
|
71
|
+
localConfig = await localConfig();
|
|
72
|
+
if (!localConfig)
|
|
73
|
+
localConfig = {};
|
|
74
|
+
const rootDir = localConfig.rootDir ? join(dirname(configFilePath), localConfig.rootDir) : dirname(configFilePath);
|
|
75
75
|
const replaceRootDir = (name) => (name.includes('<rootDir>') ? name.replace(/<rootDir>/, rootDir) : name);
|
|
76
|
-
const dependencies = resolveDependencies(
|
|
76
|
+
const dependencies = resolveDependencies(localConfig, options);
|
|
77
77
|
const matchCwd = new RegExp('^' + toEntryPattern(cwd) + '/');
|
|
78
78
|
return dependencies.map(replaceRootDir).map(dependency => dependency.replace(matchCwd, toEntryPattern('')));
|
|
79
79
|
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -10,15 +10,16 @@ export const ENABLERS = ['lefthook', '@arkweid/lefthook', '@evilmartians/lefthoo
|
|
|
10
10
|
export const isEnabled = ({ dependencies }) => hasDependency(dependencies, ENABLERS);
|
|
11
11
|
const gitHookPaths = getGitHookPaths();
|
|
12
12
|
export const CONFIG_FILE_PATTERNS = ['lefthook.yml', ...gitHookPaths];
|
|
13
|
-
const findLefthookDependencies = async (configFilePath,
|
|
13
|
+
const findLefthookDependencies = async (configFilePath, options) => {
|
|
14
|
+
const { cwd, manifest, isProduction } = options;
|
|
14
15
|
if (isProduction)
|
|
15
16
|
return [];
|
|
16
17
|
const dependencies = manifest.devDependencies ? Object.keys(manifest.devDependencies) : [];
|
|
17
18
|
if (configFilePath.endsWith('.yml')) {
|
|
18
|
-
const
|
|
19
|
-
if (!
|
|
19
|
+
const localConfig = await load(configFilePath);
|
|
20
|
+
if (!localConfig)
|
|
20
21
|
return [];
|
|
21
|
-
const scripts = getValuesByKeyDeep(
|
|
22
|
+
const scripts = getValuesByKeyDeep(localConfig, 'run').filter((run) => typeof run === 'string');
|
|
22
23
|
const lefthook = process.env.CI ? ENABLERS.filter(dependency => dependencies.includes(dependency)) : [];
|
|
23
24
|
return [...lefthook, ..._getDependenciesFromScripts(scripts, { cwd, manifest, knownGlobalsOnly: true })];
|
|
24
25
|
}
|
|
@@ -13,19 +13,19 @@ export const CONFIG_FILE_PATTERNS = [
|
|
|
13
13
|
'lint-staged.config.{js,mjs,cjs}',
|
|
14
14
|
'package.json',
|
|
15
15
|
];
|
|
16
|
-
const findLintStagedDependencies = async (configFilePath,
|
|
16
|
+
const findLintStagedDependencies = async (configFilePath, options) => {
|
|
17
|
+
const { cwd, manifest, isProduction } = options;
|
|
17
18
|
if (isProduction)
|
|
18
19
|
return [];
|
|
19
|
-
let
|
|
20
|
+
let localConfig = configFilePath.endsWith('package.json')
|
|
20
21
|
? manifest['lint-staged']
|
|
21
22
|
: await load(configFilePath);
|
|
22
|
-
if (
|
|
23
|
+
if (typeof localConfig === 'function')
|
|
24
|
+
localConfig = localConfig();
|
|
25
|
+
if (!localConfig)
|
|
23
26
|
return [];
|
|
24
|
-
if (typeof config === 'function') {
|
|
25
|
-
config = config();
|
|
26
|
-
}
|
|
27
27
|
const dependencies = new Set();
|
|
28
|
-
for (const entry of Object.values(
|
|
28
|
+
for (const entry of Object.values(localConfig).flat()) {
|
|
29
29
|
const scripts = [typeof entry === 'function' ? await entry([]) : entry].flat();
|
|
30
30
|
const options = { cwd, manifest };
|
|
31
31
|
_getDependenciesFromScripts(scripts, options).forEach(identifier => dependencies.add(identifier));
|
|
@@ -5,12 +5,13 @@ export const NAME = 'markdownlint';
|
|
|
5
5
|
export const ENABLERS = ['markdownlint-cli'];
|
|
6
6
|
export const isEnabled = ({ dependencies }) => hasDependency(dependencies, ENABLERS);
|
|
7
7
|
export const CONFIG_FILE_PATTERNS = ['.markdownlint.{json,jsonc}', '.markdownlint.{yml,yaml}'];
|
|
8
|
-
const findMarkdownlintConfigDependencies = async (configFilePath,
|
|
8
|
+
const findMarkdownlintConfigDependencies = async (configFilePath, options) => {
|
|
9
|
+
const { manifest, isProduction } = options;
|
|
9
10
|
if (isProduction)
|
|
10
11
|
return [];
|
|
11
|
-
const
|
|
12
|
-
const extend =
|
|
13
|
-
const scripts = manifest
|
|
12
|
+
const localConfig = await load(configFilePath);
|
|
13
|
+
const extend = localConfig?.extends ? [localConfig.extends] : [];
|
|
14
|
+
const scripts = manifest?.scripts
|
|
14
15
|
? Object.values(manifest.scripts).filter((script) => typeof script === 'string')
|
|
15
16
|
: [];
|
|
16
17
|
const uses = scripts
|
|
@@ -6,14 +6,15 @@ export const ENABLERS = ['mocha'];
|
|
|
6
6
|
export const isEnabled = ({ dependencies }) => hasDependency(dependencies, ENABLERS);
|
|
7
7
|
export const CONFIG_FILE_PATTERNS = ['.mocharc.{js,cjs,json,jsonc,yml,yaml}', 'package.json'];
|
|
8
8
|
export const ENTRY_FILE_PATTERNS = ['**/test/*.{js,cjs,mjs}'];
|
|
9
|
-
const findMochaDependencies = async (configFilePath,
|
|
10
|
-
const
|
|
11
|
-
|
|
9
|
+
const findMochaDependencies = async (configFilePath, options) => {
|
|
10
|
+
const { config, manifest, isProduction } = options;
|
|
11
|
+
const localConfig = configFilePath.endsWith('package.json')
|
|
12
|
+
? manifest.mocha
|
|
13
|
+
: await load(configFilePath);
|
|
14
|
+
const entryPatterns = (config.entry ?? (localConfig?.spec ? [localConfig.spec].flat() : ENTRY_FILE_PATTERNS)).map(toEntryPattern);
|
|
15
|
+
if (isProduction || !localConfig)
|
|
12
16
|
return entryPatterns;
|
|
13
|
-
const
|
|
14
|
-
if (!config)
|
|
15
|
-
return [];
|
|
16
|
-
const require = config.require ? [config.require].flat() : [];
|
|
17
|
+
const require = localConfig.require ? [localConfig.require].flat() : [];
|
|
17
18
|
return [...require, ...entryPatterns];
|
|
18
19
|
};
|
|
19
20
|
export const findDependencies = timerify(findMochaDependencies);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -5,12 +5,13 @@ export const ENABLERS = ['npm-package-json-lint'];
|
|
|
5
5
|
export const PACKAGE_JSON_PATH = 'npmpackagejsonlint';
|
|
6
6
|
export const isEnabled = ({ dependencies }) => hasDependency(dependencies, ENABLERS);
|
|
7
7
|
export const CONFIG_FILE_PATTERNS = ['.npmpackagejsonlintrc.json', 'npmpackagejsonlint.config.js', 'package.json'];
|
|
8
|
-
const findNpmPkgJsonLintConfigDependencies = async (configFilePath,
|
|
8
|
+
const findNpmPkgJsonLintConfigDependencies = async (configFilePath, options) => {
|
|
9
|
+
const { manifest, isProduction } = options;
|
|
9
10
|
if (isProduction)
|
|
10
11
|
return [];
|
|
11
|
-
const
|
|
12
|
+
const localConfig = configFilePath.endsWith('package.json')
|
|
12
13
|
? manifest[PACKAGE_JSON_PATH]
|
|
13
14
|
: await load(configFilePath);
|
|
14
|
-
return
|
|
15
|
+
return localConfig?.extends ? [localConfig.extends] : [];
|
|
15
16
|
};
|
|
16
17
|
export const findDependencies = timerify(findNpmPkgJsonLintConfigDependencies);
|
package/dist/plugins/nx/index.js
CHANGED
|
@@ -6,13 +6,14 @@ export const NAME = 'Nx';
|
|
|
6
6
|
export const ENABLERS = ['nx', /^@nrwl\//];
|
|
7
7
|
export const isEnabled = ({ dependencies }) => hasDependency(dependencies, ENABLERS);
|
|
8
8
|
export const CONFIG_FILE_PATTERNS = ['project.json', '{apps,libs}/**/project.json'];
|
|
9
|
-
const findNxDependencies = async (configFilePath,
|
|
9
|
+
const findNxDependencies = async (configFilePath, options) => {
|
|
10
|
+
const { cwd, manifest, isProduction } = options;
|
|
10
11
|
if (isProduction)
|
|
11
12
|
return [];
|
|
12
|
-
const
|
|
13
|
-
if (!
|
|
13
|
+
const localConfig = await load(configFilePath);
|
|
14
|
+
if (!localConfig)
|
|
14
15
|
return [];
|
|
15
|
-
const targets =
|
|
16
|
+
const targets = localConfig.targets ? Object.values(localConfig.targets) : [];
|
|
16
17
|
const executors = compact(targets
|
|
17
18
|
.map(target => target?.executor)
|
|
18
19
|
.filter(executor => executor && !executor.startsWith('.'))
|
|
@@ -4,10 +4,11 @@ export const NAME = 'nyc';
|
|
|
4
4
|
export const ENABLERS = ['nyc'];
|
|
5
5
|
export const isEnabled = ({ dependencies }) => hasDependency(dependencies, ENABLERS);
|
|
6
6
|
export const CONFIG_FILE_PATTERNS = ['.nycrc', '.nycrc.json', '.nycrc.{yml,yaml}', 'nyc.config.js'];
|
|
7
|
-
const findNycDependencies = async (configFilePath,
|
|
7
|
+
const findNycDependencies = async (configFilePath, options) => {
|
|
8
|
+
const { isProduction } = options;
|
|
8
9
|
if (isProduction)
|
|
9
10
|
return [];
|
|
10
|
-
const
|
|
11
|
-
return
|
|
11
|
+
const localConfig = await load(configFilePath);
|
|
12
|
+
return localConfig?.extends ? [localConfig.extends].flat() : [];
|
|
12
13
|
};
|
|
13
14
|
export const findDependencies = timerify(findNycDependencies);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -3,7 +3,7 @@ import type { PlaywrightTestConfig } from 'playwright/test';
|
|
|
3
3
|
export declare const NAME = "Playwright";
|
|
4
4
|
export declare const ENABLERS: string[];
|
|
5
5
|
export declare const isEnabled: IsPluginEnabledCallback;
|
|
6
|
-
export declare const ENTRY_FILE_PATTERNS: string[];
|
|
7
6
|
export declare const CONFIG_FILE_PATTERNS: string[];
|
|
7
|
+
export declare const ENTRY_FILE_PATTERNS: string[];
|
|
8
8
|
export declare const toEntryPatterns: (testMatch: string | RegExp | Array<string | RegExp> | undefined, cwd: string, configFilePath: string, config: PlaywrightTestConfig) => string[];
|
|
9
9
|
export declare const findDependencies: GenericPluginCallback;
|
|
@@ -5,8 +5,8 @@ import { toEntryPattern } from '../../util/protocols.js';
|
|
|
5
5
|
export const NAME = 'Playwright';
|
|
6
6
|
export const ENABLERS = ['@playwright/test'];
|
|
7
7
|
export const isEnabled = ({ dependencies }) => hasDependency(dependencies, ENABLERS);
|
|
8
|
-
export const ENTRY_FILE_PATTERNS = ['**/*.@(spec|test).?(c|m)[jt]s?(x)'];
|
|
9
8
|
export const CONFIG_FILE_PATTERNS = ['playwright.config.{js,ts}'];
|
|
9
|
+
export const ENTRY_FILE_PATTERNS = ['**/*.@(spec|test).?(c|m)[jt]s?(x)'];
|
|
10
10
|
export const toEntryPatterns = (testMatch, cwd, configFilePath, config) => {
|
|
11
11
|
if (!testMatch)
|
|
12
12
|
return [];
|
|
@@ -14,14 +14,15 @@ export const toEntryPatterns = (testMatch, cwd, configFilePath, config) => {
|
|
|
14
14
|
const patterns = [testMatch].flat().filter((p) => typeof p === 'string');
|
|
15
15
|
return patterns.map(pattern => toEntryPattern(join(dir, pattern)));
|
|
16
16
|
};
|
|
17
|
-
const findPlaywrightDependencies = async (configFilePath,
|
|
18
|
-
const
|
|
19
|
-
|
|
20
|
-
|
|
17
|
+
const findPlaywrightDependencies = async (configFilePath, options) => {
|
|
18
|
+
const { cwd, config } = options;
|
|
19
|
+
const localConfig = await load(configFilePath);
|
|
20
|
+
if (localConfig) {
|
|
21
|
+
const projects = localConfig.projects ? [localConfig, ...localConfig.projects] : [localConfig];
|
|
21
22
|
const patterns = projects.flatMap(config => toEntryPatterns(config.testMatch, cwd, configFilePath, config));
|
|
22
23
|
if (patterns.length > 0)
|
|
23
24
|
return patterns;
|
|
24
25
|
}
|
|
25
|
-
return
|
|
26
|
+
return (config?.entry ?? ENTRY_FILE_PATTERNS).map(toEntryPattern);
|
|
26
27
|
};
|
|
27
28
|
export const findDependencies = timerify(findPlaywrightDependencies);
|
|
@@ -1,16 +1,21 @@
|
|
|
1
1
|
import { timerify } from '../../util/Performance.js';
|
|
2
2
|
import { hasDependency, load } from '../../util/plugin.js';
|
|
3
|
+
import { toEntryPattern } from '../../util/protocols.js';
|
|
3
4
|
import { toEntryPatterns } from '../playwright/index.js';
|
|
4
5
|
export const NAME = 'Playwright for components';
|
|
5
6
|
export const ENABLERS = [/^@playwright\/experimental-ct-/];
|
|
6
7
|
export const isEnabled = ({ dependencies }) => hasDependency(dependencies, ENABLERS);
|
|
7
8
|
export const CONFIG_FILE_PATTERNS = ['playwright-ct.config.{js,ts}', 'playwright/index.{js,ts,jsx,tsx}'];
|
|
8
9
|
export const ENTRY_FILE_PATTERNS = ['**/*.@(spec|test).?(c|m)[jt]s?(x)'];
|
|
9
|
-
const findPlaywrightCTDependencies = async (configFilePath,
|
|
10
|
-
const config =
|
|
11
|
-
const
|
|
12
|
-
if (
|
|
13
|
-
|
|
14
|
-
|
|
10
|
+
const findPlaywrightCTDependencies = async (configFilePath, options) => {
|
|
11
|
+
const { cwd, config } = options;
|
|
12
|
+
const localConfig = await load(configFilePath);
|
|
13
|
+
if (localConfig) {
|
|
14
|
+
const projects = localConfig.projects ? [localConfig, ...localConfig.projects] : [localConfig];
|
|
15
|
+
const patterns = projects.flatMap(config => toEntryPatterns(config.testMatch, cwd, configFilePath, config));
|
|
16
|
+
if (patterns.length > 0)
|
|
17
|
+
return patterns;
|
|
18
|
+
}
|
|
19
|
+
return (config?.entry ?? ENTRY_FILE_PATTERNS).map(toEntryPattern);
|
|
15
20
|
};
|
|
16
21
|
export const findDependencies = timerify(findPlaywrightCTDependencies);
|
|
@@ -4,16 +4,17 @@ export const NAME = 'PostCSS';
|
|
|
4
4
|
export const ENABLERS = ['postcss', 'next'];
|
|
5
5
|
export const isEnabled = ({ dependencies }) => hasDependency(dependencies, ENABLERS);
|
|
6
6
|
export const CONFIG_FILE_PATTERNS = ['postcss.config.js', 'postcss.config.json', 'package.json'];
|
|
7
|
-
const findPostCSSDependencies = async (configFilePath,
|
|
7
|
+
const findPostCSSDependencies = async (configFilePath, options) => {
|
|
8
|
+
const { manifest, isProduction } = options;
|
|
8
9
|
if (isProduction)
|
|
9
10
|
return [];
|
|
10
|
-
const
|
|
11
|
+
const localConfig = configFilePath.endsWith('package.json')
|
|
11
12
|
? manifest?.postcss
|
|
12
13
|
: await load(configFilePath);
|
|
13
|
-
if (!
|
|
14
|
+
if (!localConfig)
|
|
14
15
|
return [];
|
|
15
|
-
return
|
|
16
|
-
? (Array.isArray(
|
|
16
|
+
return localConfig.plugins
|
|
17
|
+
? (Array.isArray(localConfig.plugins) ? localConfig.plugins : Object.keys(localConfig.plugins)).flatMap(plugin => {
|
|
17
18
|
if (typeof plugin === 'string')
|
|
18
19
|
return plugin;
|
|
19
20
|
if (Array.isArray(plugin) && typeof plugin[0] === 'string')
|
|
@@ -12,11 +12,11 @@ export const CONFIG_FILE_PATTERNS = [
|
|
|
12
12
|
const findPrettierDependencies = async (configFilePath, { manifest, isProduction }) => {
|
|
13
13
|
if (isProduction)
|
|
14
14
|
return [];
|
|
15
|
-
const
|
|
15
|
+
const localConfig = configFilePath.endsWith('package.json')
|
|
16
16
|
? manifest.prettier
|
|
17
17
|
: await load(configFilePath);
|
|
18
|
-
return
|
|
19
|
-
?
|
|
18
|
+
return localConfig && Array.isArray(localConfig.plugins)
|
|
19
|
+
? localConfig.plugins.filter((plugin) => typeof plugin === 'string')
|
|
20
20
|
: [];
|
|
21
21
|
};
|
|
22
22
|
export const findDependencies = timerify(findPrettierDependencies);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -11,21 +11,22 @@ export const CONFIG_FILE_PATTERNS = [
|
|
|
11
11
|
'.release-it.{yml,yaml}',
|
|
12
12
|
'package.json',
|
|
13
13
|
];
|
|
14
|
-
const findReleaseItDependencies = async (configFilePath,
|
|
14
|
+
const findReleaseItDependencies = async (configFilePath, options) => {
|
|
15
|
+
const { cwd, manifest, isProduction } = options;
|
|
15
16
|
if (isProduction)
|
|
16
17
|
return [];
|
|
17
|
-
const
|
|
18
|
+
const localConfig = configFilePath.endsWith('package.json')
|
|
18
19
|
? manifest[PACKAGE_JSON_PATH]
|
|
19
20
|
: await load(configFilePath);
|
|
20
|
-
if (!
|
|
21
|
+
if (!localConfig)
|
|
21
22
|
return [];
|
|
22
|
-
const plugins =
|
|
23
|
-
const scripts =
|
|
24
|
-
if (typeof
|
|
25
|
-
scripts.push(
|
|
23
|
+
const plugins = localConfig.plugins ? Object.keys(localConfig.plugins) : [];
|
|
24
|
+
const scripts = localConfig.hooks ? Object.values(localConfig.hooks).flat() : [];
|
|
25
|
+
if (typeof localConfig.github?.releaseNotes === 'string') {
|
|
26
|
+
scripts.push(localConfig.github.releaseNotes);
|
|
26
27
|
}
|
|
27
|
-
if (typeof
|
|
28
|
-
scripts.push(
|
|
28
|
+
if (typeof localConfig.gitlab?.releaseNotes === 'string') {
|
|
29
|
+
scripts.push(localConfig.gitlab.releaseNotes);
|
|
29
30
|
}
|
|
30
31
|
const dependencies = _getDependenciesFromScripts(scripts, { cwd, manifest });
|
|
31
32
|
return [...plugins, ...dependencies];
|
|
@@ -11,15 +11,16 @@ export const CONFIG_FILE_PATTERNS = [
|
|
|
11
11
|
'.remarkrc.{js,cjs,mjs}',
|
|
12
12
|
'.remarkrc.{yml,yaml}',
|
|
13
13
|
];
|
|
14
|
-
const findRemarkDependencies = async (configFilePath,
|
|
14
|
+
const findRemarkDependencies = async (configFilePath, options) => {
|
|
15
|
+
const { manifest, isProduction } = options;
|
|
15
16
|
if (isProduction)
|
|
16
17
|
return [];
|
|
17
|
-
const
|
|
18
|
+
const localConfig = configFilePath.endsWith('package.json')
|
|
18
19
|
? manifest[PACKAGE_JSON_PATH]
|
|
19
20
|
: await load(configFilePath);
|
|
20
|
-
if (!
|
|
21
|
+
if (!localConfig)
|
|
21
22
|
return [];
|
|
22
|
-
const plugins =
|
|
23
|
-
return
|
|
23
|
+
const plugins = localConfig.plugins?.map(plugin => `remark-${plugin}`) ?? [];
|
|
24
|
+
return plugins;
|
|
24
25
|
};
|
|
25
26
|
export const findDependencies = timerify(findRemarkDependencies);
|
|
@@ -12,10 +12,6 @@ export const PRODUCTION_ENTRY_FILE_PATTERNS = [
|
|
|
12
12
|
'server.{js,ts}',
|
|
13
13
|
];
|
|
14
14
|
const findRemixDependencies = async () => {
|
|
15
|
-
|
|
16
|
-
...ENTRY_FILE_PATTERNS.map(toEntryPattern),
|
|
17
|
-
...PRODUCTION_ENTRY_FILE_PATTERNS.map(toProductionEntryPattern),
|
|
18
|
-
];
|
|
19
|
-
return entryPatterns;
|
|
15
|
+
return [...ENTRY_FILE_PATTERNS.map(toEntryPattern), ...PRODUCTION_ENTRY_FILE_PATTERNS.map(toProductionEntryPattern)];
|
|
20
16
|
};
|
|
21
17
|
export const findDependencies = timerify(findRemixDependencies);
|
|
@@ -4,7 +4,7 @@ import { toEntryPattern } from '../../util/protocols.js';
|
|
|
4
4
|
export const NAME = 'Rollup';
|
|
5
5
|
export const ENABLERS = ['rollup'];
|
|
6
6
|
export const isEnabled = ({ dependencies }) => hasDependency(dependencies, ENABLERS);
|
|
7
|
-
export const ENTRY_FILE_PATTERNS = ['rollup.config.{js,mjs,ts}'];
|
|
7
|
+
export const ENTRY_FILE_PATTERNS = ['rollup.config.{js,cjs,mjs,ts}'];
|
|
8
8
|
const findRollupDependencies = async () => {
|
|
9
9
|
const entryPatterns = ENTRY_FILE_PATTERNS.map(toEntryPattern);
|
|
10
10
|
return entryPatterns;
|
|
@@ -10,13 +10,14 @@ export const CONFIG_FILE_PATTERNS = [
|
|
|
10
10
|
'release.config.{js,cjs}',
|
|
11
11
|
'package.json',
|
|
12
12
|
];
|
|
13
|
-
const findSemanticReleaseDependencies = async (configFilePath,
|
|
13
|
+
const findSemanticReleaseDependencies = async (configFilePath, options) => {
|
|
14
|
+
const { manifest, isProduction } = options;
|
|
14
15
|
if (isProduction)
|
|
15
16
|
return [];
|
|
16
|
-
const
|
|
17
|
+
const localConfig = configFilePath.endsWith('package.json')
|
|
17
18
|
? manifest[PACKAGE_JSON_PATH]
|
|
18
19
|
: await load(configFilePath);
|
|
19
|
-
const plugins =
|
|
20
|
-
return plugins
|
|
20
|
+
const plugins = (localConfig?.plugins ?? []).map(plugin => (Array.isArray(plugin) ? plugin[0] : plugin));
|
|
21
|
+
return plugins;
|
|
21
22
|
};
|
|
22
23
|
export const findDependencies = timerify(findSemanticReleaseDependencies);
|
|
@@ -9,19 +9,21 @@ export const CONFIG_FILE_PATTERNS = ['.storybook/{main,test-runner}.{js,ts}'];
|
|
|
9
9
|
export const STORIES_FILE_PATTERNS = ['**/*.stories.{js,jsx,ts,tsx}'];
|
|
10
10
|
export const ENTRY_FILE_PATTERNS = ['.storybook/{manager,preview}.{js,jsx,ts,tsx}', ...STORIES_FILE_PATTERNS];
|
|
11
11
|
export const PROJECT_FILE_PATTERNS = ['.storybook/**/*.{js,jsx,ts,tsx}'];
|
|
12
|
-
const findStorybookDependencies = async (configFilePath,
|
|
13
|
-
const
|
|
14
|
-
const
|
|
15
|
-
const
|
|
16
|
-
|
|
17
|
-
|
|
12
|
+
const findStorybookDependencies = async (configFilePath, options) => {
|
|
13
|
+
const { isProduction, cwd, config } = options;
|
|
14
|
+
const localConfig = await load(configFilePath);
|
|
15
|
+
const stories = typeof localConfig?.stories === 'function'
|
|
16
|
+
? await localConfig.stories(STORIES_FILE_PATTERNS)
|
|
17
|
+
: localConfig?.stories;
|
|
18
|
+
const relativePatterns = stories?.map(pattern => relative(cwd, join(dirname(configFilePath), pattern)));
|
|
19
|
+
const patterns = [...(config?.entry ?? []), ...(relativePatterns ?? [])];
|
|
20
|
+
const entryPatterns = (patterns.length > 0 ? patterns : ENTRY_FILE_PATTERNS).map(toEntryPattern);
|
|
21
|
+
if (!localConfig || isProduction)
|
|
18
22
|
return entryPatterns;
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
const addons = cfg.addons?.map(addon => (typeof addon === 'string' ? addon : addon.name)) ?? [];
|
|
22
|
-
const builder = cfg?.core?.builder;
|
|
23
|
+
const addons = localConfig.addons?.map(addon => (typeof addon === 'string' ? addon : addon.name)) ?? [];
|
|
24
|
+
const builder = localConfig?.core?.builder;
|
|
23
25
|
const builderPackages = builder && /webpack/.test(builder) ? [`@storybook/builder-${builder}`, `@storybook/manager-${builder}`] : [];
|
|
24
|
-
const frameworks =
|
|
26
|
+
const frameworks = localConfig.framework?.name ? [localConfig.framework.name] : [];
|
|
25
27
|
return [...entryPatterns, ...addons, ...builderPackages, ...frameworks];
|
|
26
28
|
};
|
|
27
29
|
export const findDependencies = timerify(findStorybookDependencies);
|
|
@@ -4,15 +4,18 @@ export const NAME = 'Stryker';
|
|
|
4
4
|
export const ENABLERS = ['@stryker-mutator/core'];
|
|
5
5
|
export const isEnabled = ({ dependencies }) => hasDependency(dependencies, ENABLERS);
|
|
6
6
|
export const CONFIG_FILE_PATTERNS = ['?(.)stryker.{conf,config}.{js,mjs,cjs,json}'];
|
|
7
|
-
const findStrykerDependencies = async (configFilePath,
|
|
7
|
+
const findStrykerDependencies = async (configFilePath, options) => {
|
|
8
|
+
const { isProduction } = options;
|
|
8
9
|
if (isProduction)
|
|
9
10
|
return [];
|
|
10
|
-
const
|
|
11
|
-
if (!
|
|
11
|
+
const localConfig = await load(configFilePath);
|
|
12
|
+
if (!localConfig)
|
|
12
13
|
return [];
|
|
13
|
-
const runners =
|
|
14
|
-
const checkers =
|
|
15
|
-
|
|
14
|
+
const runners = localConfig.testRunner ? [`@stryker-mutator/${localConfig.testRunner}-runner`] : [];
|
|
15
|
+
const checkers = localConfig.checkers
|
|
16
|
+
? localConfig.checkers.map(checker => `@stryker-mutator/${checker}-checker`)
|
|
17
|
+
: [];
|
|
18
|
+
const plugins = localConfig.plugins ?? [];
|
|
16
19
|
return [...runners, ...checkers, ...plugins];
|
|
17
20
|
};
|
|
18
21
|
export const findDependencies = timerify(findStrykerDependencies);
|
|
@@ -9,16 +9,17 @@ export const CONFIG_FILE_PATTERNS = [
|
|
|
9
9
|
'.stylelintrc.{cjs,js,json,yaml,yml}',
|
|
10
10
|
'stylelint.config.{cjs,mjs,js}',
|
|
11
11
|
];
|
|
12
|
-
const findPluginDependencies = async (configFilePath,
|
|
12
|
+
const findPluginDependencies = async (configFilePath, options) => {
|
|
13
|
+
const { manifest, isProduction } = options;
|
|
13
14
|
if (isProduction)
|
|
14
15
|
return [];
|
|
15
|
-
const
|
|
16
|
+
const localConfig = configFilePath.endsWith('package.json')
|
|
16
17
|
? manifest.stylelint
|
|
17
18
|
: await load(configFilePath);
|
|
18
|
-
if (!
|
|
19
|
+
if (!localConfig)
|
|
19
20
|
return [];
|
|
20
|
-
const extend =
|
|
21
|
-
const plugins =
|
|
21
|
+
const extend = localConfig.extends ? [localConfig.extends].flat().filter(extend => !isInternal(extend)) : [];
|
|
22
|
+
const plugins = localConfig.plugins ? [localConfig.plugins].flat().filter(plugin => !isInternal(plugin)) : [];
|
|
22
23
|
return [...extend, ...plugins];
|
|
23
24
|
};
|
|
24
25
|
export const findDependencies = timerify(findPluginDependencies);
|
|
@@ -12,14 +12,15 @@ export const CONFIG_FILE_PATTERNS = [
|
|
|
12
12
|
'package.json',
|
|
13
13
|
'tsconfig.json',
|
|
14
14
|
];
|
|
15
|
-
const findTypeDocDependencies = async (configFilePath,
|
|
15
|
+
const findTypeDocDependencies = async (configFilePath, options) => {
|
|
16
|
+
const { manifest, isProduction } = options;
|
|
16
17
|
if (isProduction)
|
|
17
18
|
return [];
|
|
18
|
-
const
|
|
19
|
+
const localConfig = configFilePath.endsWith('package.json')
|
|
19
20
|
? manifest[PACKAGE_JSON_PATH]
|
|
20
21
|
: configFilePath.endsWith('tsconfig.json')
|
|
21
22
|
? (await load(configFilePath)).typedocOptions
|
|
22
23
|
: await load(configFilePath);
|
|
23
|
-
return
|
|
24
|
+
return localConfig?.plugin ?? [];
|
|
24
25
|
};
|
|
25
26
|
export const findDependencies = timerify(findTypeDocDependencies);
|