knip 5.1.2 → 5.1.3
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 +3 -3
- package/dist/ConfigurationValidator.d.ts +21 -21
- package/dist/ProjectPrincipal.d.ts +1 -1
- package/dist/ProjectPrincipal.js +3 -5
- package/dist/WorkspaceWorker.d.ts +2 -2
- package/dist/WorkspaceWorker.js +61 -44
- package/dist/binaries/index.js +2 -2
- package/dist/binaries/resolvers/index.d.ts +12 -12
- package/dist/compilers/index.d.ts +6 -7
- package/dist/compilers/index.js +0 -3
- package/dist/constants.d.ts +1 -2
- package/dist/constants.js +8 -4
- package/dist/plugins/_template/index.d.ts +10 -9
- package/dist/plugins/_template/index.js +16 -30
- package/dist/plugins/angular/index.d.ts +8 -6
- package/dist/plugins/angular/index.js +17 -22
- package/dist/plugins/astro/index.d.ts +7 -7
- package/dist/plugins/astro/index.js +14 -17
- package/dist/plugins/ava/index.d.ts +9 -7
- package/dist/plugins/ava/index.js +19 -21
- package/dist/plugins/babel/helpers.js +1 -1
- package/dist/plugins/babel/index.d.ts +7 -7
- package/dist/plugins/babel/index.js +15 -26
- package/dist/plugins/capacitor/index.d.ts +7 -6
- package/dist/plugins/capacitor/index.js +11 -18
- package/dist/plugins/changesets/index.d.ts +7 -6
- package/dist/plugins/changesets/index.js +14 -21
- package/dist/plugins/changesets/types.d.ts +3 -0
- package/dist/plugins/changesets/types.js +1 -0
- package/dist/plugins/commitizen/index.d.ts +8 -7
- package/dist/plugins/commitizen/index.js +13 -21
- package/dist/plugins/commitlint/index.d.ts +9 -6
- package/dist/plugins/commitlint/index.js +11 -19
- package/dist/plugins/cspell/index.d.ts +7 -6
- package/dist/plugins/cspell/index.js +12 -20
- package/dist/plugins/cypress/index.d.ts +7 -7
- package/dist/plugins/cypress/index.js +13 -21
- package/dist/plugins/drizzle/index.d.ts +7 -6
- package/dist/plugins/drizzle/index.js +13 -16
- package/dist/plugins/eleventy/index.d.ts +11 -9
- package/dist/plugins/eleventy/index.js +35 -41
- package/dist/plugins/eslint/helpers.d.ts +3 -5
- package/dist/plugins/eslint/helpers.js +10 -15
- package/dist/plugins/eslint/index.d.ts +10 -8
- package/dist/plugins/eslint/index.js +15 -29
- package/dist/plugins/gatsby/index.d.ts +8 -7
- package/dist/plugins/gatsby/index.js +15 -22
- package/dist/plugins/github-actions/index.d.ts +6 -6
- package/dist/plugins/github-actions/index.js +15 -25
- package/dist/plugins/graphql-codegen/index.d.ts +8 -7
- package/dist/plugins/graphql-codegen/index.js +15 -23
- package/dist/plugins/husky/index.d.ts +6 -6
- package/dist/plugins/husky/index.js +10 -16
- package/dist/plugins/jest/index.d.ts +9 -7
- package/dist/plugins/jest/index.js +50 -31
- package/dist/plugins/lefthook/index.d.ts +6 -6
- package/dist/plugins/lefthook/index.js +19 -24
- package/dist/plugins/lint-staged/index.d.ts +8 -7
- package/dist/plugins/lint-staged/index.js +16 -23
- package/dist/plugins/linthtml/index.d.ts +8 -7
- package/dist/plugins/linthtml/index.js +16 -24
- package/dist/plugins/markdownlint/index.d.ts +7 -6
- package/dist/plugins/markdownlint/index.js +12 -17
- package/dist/plugins/mocha/index.d.ts +9 -7
- package/dist/plugins/mocha/index.js +19 -22
- package/dist/plugins/msw/index.d.ts +8 -7
- package/dist/plugins/msw/index.js +12 -15
- package/dist/plugins/netlify/index.d.ts +9 -7
- package/dist/plugins/netlify/index.js +23 -27
- package/dist/plugins/next/index.d.ts +6 -7
- package/dist/plugins/next/index.js +10 -18
- package/dist/plugins/node-test-runner/index.d.ts +5 -6
- package/dist/plugins/node-test-runner/index.js +6 -18
- package/dist/plugins/npm-package-json-lint/index.d.ts +8 -7
- package/dist/plugins/npm-package-json-lint/index.js +12 -19
- package/dist/plugins/nx/index.d.ts +7 -6
- package/dist/plugins/nx/index.js +18 -27
- package/dist/plugins/nyc/index.d.ts +7 -6
- package/dist/plugins/nyc/index.js +11 -17
- package/dist/plugins/playwright/index.d.ts +11 -13
- package/dist/plugins/playwright/index.js +23 -30
- package/dist/plugins/playwright-ct/index.d.ts +8 -7
- package/dist/plugins/playwright-ct/index.js +12 -24
- package/dist/plugins/postcss/index.d.ts +7 -6
- package/dist/plugins/postcss/index.js +12 -21
- package/dist/plugins/prettier/index.d.ts +7 -6
- package/dist/plugins/prettier/index.js +14 -20
- package/dist/plugins/release-it/index.d.ts +8 -7
- package/dist/plugins/release-it/index.js +18 -27
- package/dist/plugins/remark/index.d.ts +8 -7
- package/dist/plugins/remark/index.js +13 -28
- package/dist/plugins/remix/index.d.ts +6 -7
- package/dist/plugins/remix/index.js +10 -20
- package/dist/plugins/rollup/index.d.ts +5 -6
- package/dist/plugins/rollup/index.js +8 -16
- package/dist/plugins/semantic-release/index.d.ts +8 -7
- package/dist/plugins/semantic-release/index.js +13 -25
- package/dist/plugins/sentry/index.d.ts +5 -6
- package/dist/plugins/sentry/index.js +8 -16
- package/dist/plugins/storybook/index.d.ts +10 -8
- package/dist/plugins/storybook/index.js +28 -35
- package/dist/plugins/stryker/index.d.ts +7 -6
- package/dist/plugins/stryker/index.js +10 -18
- package/dist/plugins/stylelint/index.d.ts +7 -6
- package/dist/plugins/stylelint/index.js +13 -23
- package/dist/plugins/svelte/index.d.ts +7 -8
- package/dist/plugins/svelte/index.js +13 -23
- package/dist/plugins/tailwind/index.d.ts +5 -6
- package/dist/plugins/tailwind/index.js +8 -14
- package/dist/plugins/tsup/index.d.ts +7 -6
- package/dist/plugins/tsup/index.js +14 -21
- package/dist/plugins/typedoc/index.d.ts +10 -7
- package/dist/plugins/typedoc/index.js +14 -24
- package/dist/plugins/typescript/index.d.ts +8 -7
- package/dist/plugins/typescript/index.js +31 -25
- package/dist/plugins/unbuild/index.d.ts +7 -6
- package/dist/plugins/unbuild/index.js +12 -17
- package/dist/plugins/vercel-og/index.d.ts +5 -6
- package/dist/plugins/vercel-og/index.js +8 -16
- package/dist/plugins/vite/index.d.ts +9 -7
- package/dist/plugins/vite/index.js +13 -18
- package/dist/plugins/vitest/index.d.ts +11 -9
- package/dist/plugins/vitest/index.js +62 -49
- package/dist/plugins/vue/index.d.ts +7 -6
- package/dist/plugins/vue/index.js +14 -26
- package/dist/plugins/webpack/index.d.ts +7 -6
- package/dist/plugins/webpack/index.js +17 -20
- package/dist/plugins/wireit/index.d.ts +8 -7
- package/dist/plugins/wireit/index.js +12 -20
- package/dist/plugins/yorkie/index.d.ts +8 -7
- package/dist/plugins/yorkie/index.js +13 -21
- package/dist/plugins.d.ts +3 -0
- package/dist/plugins.js +14 -0
- package/dist/reporters/index.d.ts +5 -5
- package/dist/types/config.d.ts +1 -1
- package/dist/types/package-json.d.ts +12 -13
- package/dist/types/plugins.d.ts +20 -14
- package/dist/types/util.d.ts +0 -13
- package/dist/typescript/SourceFileManager.js +3 -0
- package/dist/typescript/createHosts.js +4 -3
- package/dist/typescript/resolveModuleNames.js +26 -41
- package/dist/typescript/visitors/dynamic-imports/importCall.d.ts +1 -1
- package/dist/typescript/visitors/dynamic-imports/importType.d.ts +1 -1
- package/dist/typescript/visitors/dynamic-imports/index.d.ts +1 -1
- package/dist/typescript/visitors/dynamic-imports/jsDocType.d.ts +1 -1
- package/dist/typescript/visitors/dynamic-imports/propertyAccessCall.d.ts +1 -1
- package/dist/typescript/visitors/dynamic-imports/requireCall.d.ts +1 -1
- package/dist/typescript/visitors/exports/exportAssignment.d.ts +1 -1
- package/dist/typescript/visitors/exports/exportDeclaration.d.ts +1 -1
- package/dist/typescript/visitors/exports/exportKeyword.d.ts +1 -1
- package/dist/typescript/visitors/exports/index.d.ts +1 -1
- package/dist/typescript/visitors/exports/moduleExportsAccessExpression.d.ts +1 -1
- package/dist/typescript/visitors/imports/importDeclaration.d.ts +1 -1
- package/dist/typescript/visitors/imports/importEqualsDeclaration.d.ts +1 -1
- package/dist/typescript/visitors/imports/index.d.ts +1 -1
- package/dist/typescript/visitors/imports/reExportDeclaration.d.ts +1 -1
- package/dist/typescript/visitors/scripts/bun.d.ts +1 -1
- package/dist/typescript/visitors/scripts/execa.d.ts +1 -1
- package/dist/typescript/visitors/scripts/index.d.ts +1 -1
- package/dist/typescript/visitors/scripts/zx.d.ts +1 -1
- package/dist/util/Performance.d.ts +1 -4
- package/dist/util/Performance.js +5 -1
- package/dist/util/fs.js +0 -3
- package/dist/util/loader.d.ts +0 -2
- package/dist/util/loader.js +8 -16
- package/dist/util/object.d.ts +1 -1
- package/dist/util/path.d.ts +0 -3
- package/dist/util/path.js +0 -1
- package/dist/util/plugin.d.ts +4 -1
- package/dist/util/plugin.js +28 -1
- package/dist/util/require.d.ts +1 -0
- package/dist/util/require.js +13 -0
- package/dist/util/tsconfig-loader.js +1 -2
- package/dist/util/type.d.ts +1 -1
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/package.json +5 -1
- package/dist/plugins/eslint/fallback.d.ts +0 -1
- package/dist/plugins/eslint/fallback.js +0 -18
|
@@ -1,10 +1,12 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { IsPluginEnabled, ResolveConfig, ResolveEntryPaths } from '#p/types/plugins.js';
|
|
2
|
+
import type { JestConfig } from './types.js';
|
|
2
3
|
declare const _default: {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
isEnabled:
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
4
|
+
title: string;
|
|
5
|
+
enablers: string[];
|
|
6
|
+
isEnabled: IsPluginEnabled;
|
|
7
|
+
config: string[];
|
|
8
|
+
entry: string[];
|
|
9
|
+
resolveEntryPaths: ResolveEntryPaths<JestConfig>;
|
|
10
|
+
resolveConfig: ResolveConfig<JestConfig>;
|
|
9
11
|
};
|
|
10
12
|
export default _default;
|
|
@@ -1,12 +1,11 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
const
|
|
6
|
-
const
|
|
7
|
-
const
|
|
8
|
-
const
|
|
9
|
-
const ENTRY_FILE_PATTERNS = ['**/__tests__/**/*.[jt]s?(x)', '**/?(*.)+(spec|test).[jt]s?(x)'];
|
|
1
|
+
import { join, isInternal, toAbsolute, dirname } from '#p/util/path.js';
|
|
2
|
+
import { hasDependency, load } from '#p/util/plugin.js';
|
|
3
|
+
import { toEntryPattern } from '#p/util/protocols.js';
|
|
4
|
+
const title = 'Jest';
|
|
5
|
+
const enablers = ['jest'];
|
|
6
|
+
const isEnabled = ({ dependencies, manifest }) => hasDependency(dependencies, enablers) || Boolean(manifest.name?.startsWith('jest-presets'));
|
|
7
|
+
const config = ['jest.config.{js,ts,mjs,cjs,json}', 'package.json'];
|
|
8
|
+
const entry = ['**/__tests__/**/*.[jt]s?(x)', '**/?(*.)+(spec|test).[jt]s?(x)'];
|
|
10
9
|
const resolveExtensibleConfig = async (configFilePath) => {
|
|
11
10
|
const config = await load(configFilePath);
|
|
12
11
|
if (config?.preset) {
|
|
@@ -19,15 +18,27 @@ const resolveExtensibleConfig = async (configFilePath) => {
|
|
|
19
18
|
}
|
|
20
19
|
return config;
|
|
21
20
|
};
|
|
22
|
-
const resolveDependencies = (config, options) => {
|
|
23
|
-
const {
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
21
|
+
const resolveDependencies = async (config, options) => {
|
|
22
|
+
const { configFileDir } = options;
|
|
23
|
+
if (config?.preset) {
|
|
24
|
+
const { preset } = config;
|
|
25
|
+
if (isInternal(preset)) {
|
|
26
|
+
const presetConfigPath = toAbsolute(preset, configFileDir);
|
|
27
|
+
const presetConfig = await resolveExtensibleConfig(presetConfigPath);
|
|
28
|
+
Object.assign(config, presetConfig);
|
|
29
|
+
}
|
|
30
|
+
}
|
|
27
31
|
const presets = (config.preset ? [config.preset] : []).map(preset => isInternal(preset) ? preset : join(preset, 'jest-preset'));
|
|
28
|
-
const projects =
|
|
29
|
-
|
|
30
|
-
|
|
32
|
+
const projects = [];
|
|
33
|
+
for (const project of config.projects ?? []) {
|
|
34
|
+
if (typeof project === 'string') {
|
|
35
|
+
projects.push(project);
|
|
36
|
+
}
|
|
37
|
+
else {
|
|
38
|
+
const dependencies = await resolveDependencies(project, options);
|
|
39
|
+
dependencies.forEach(dependency => projects.push(dependency));
|
|
40
|
+
}
|
|
41
|
+
}
|
|
31
42
|
const runner = config.runner ? [config.runner] : [];
|
|
32
43
|
const environments = config.testEnvironment === 'jsdom' ? ['jest-environment-jsdom'] : [];
|
|
33
44
|
const resolvers = config.resolver ? [config.resolver] : [];
|
|
@@ -48,7 +59,6 @@ const resolveDependencies = (config, options) => {
|
|
|
48
59
|
const testResultsProcessor = config.testResultsProcessor ? [config.testResultsProcessor] : [];
|
|
49
60
|
const snapshotResolver = config.snapshotResolver ? [config.snapshotResolver] : [];
|
|
50
61
|
return [
|
|
51
|
-
...entryPatterns,
|
|
52
62
|
...presets,
|
|
53
63
|
...projects,
|
|
54
64
|
...runner,
|
|
@@ -64,25 +74,34 @@ const resolveDependencies = (config, options) => {
|
|
|
64
74
|
...snapshotResolver,
|
|
65
75
|
];
|
|
66
76
|
};
|
|
67
|
-
const
|
|
68
|
-
const {
|
|
69
|
-
|
|
77
|
+
const resolveEntryPaths = async (localConfig, options) => {
|
|
78
|
+
const { cwd, configFileDir } = options;
|
|
79
|
+
if (typeof localConfig === 'function')
|
|
80
|
+
localConfig = await localConfig();
|
|
81
|
+
const rootDir = localConfig.rootDir ? join(configFileDir, localConfig.rootDir) : configFileDir;
|
|
82
|
+
const replaceRootDir = (name) => (name.includes('<rootDir>') ? name.replace(/<rootDir>/, rootDir) : name);
|
|
83
|
+
const matchCwd = new RegExp('^' + toEntryPattern(cwd) + '/');
|
|
84
|
+
return (localConfig.testMatch ?? [])
|
|
85
|
+
.map(replaceRootDir)
|
|
86
|
+
.map(dependency => dependency.replace(matchCwd, toEntryPattern('')))
|
|
87
|
+
.map(toEntryPattern);
|
|
88
|
+
};
|
|
89
|
+
const resolveConfig = async (localConfig, options) => {
|
|
90
|
+
const { cwd, configFileDir } = options;
|
|
70
91
|
if (typeof localConfig === 'function')
|
|
71
92
|
localConfig = await localConfig();
|
|
72
|
-
|
|
73
|
-
localConfig = {};
|
|
74
|
-
const rootDir = localConfig.rootDir ? join(dirname(configFilePath), localConfig.rootDir) : dirname(configFilePath);
|
|
93
|
+
const rootDir = localConfig.rootDir ? join(configFileDir, localConfig.rootDir) : configFileDir;
|
|
75
94
|
const replaceRootDir = (name) => (name.includes('<rootDir>') ? name.replace(/<rootDir>/, rootDir) : name);
|
|
76
|
-
const dependencies = resolveDependencies(localConfig, options);
|
|
95
|
+
const dependencies = await resolveDependencies(localConfig, options);
|
|
77
96
|
const matchCwd = new RegExp('^' + toEntryPattern(cwd) + '/');
|
|
78
97
|
return dependencies.map(replaceRootDir).map(dependency => dependency.replace(matchCwd, toEntryPattern('')));
|
|
79
98
|
};
|
|
80
|
-
const findDependencies = timerify(findJestDependencies);
|
|
81
99
|
export default {
|
|
82
|
-
|
|
83
|
-
|
|
100
|
+
title,
|
|
101
|
+
enablers,
|
|
84
102
|
isEnabled,
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
103
|
+
config,
|
|
104
|
+
entry,
|
|
105
|
+
resolveEntryPaths,
|
|
106
|
+
resolveConfig,
|
|
88
107
|
};
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { IsPluginEnabled, ResolveConfig } from '#p/types/plugins.js';
|
|
2
2
|
declare const _default: {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
isEnabled:
|
|
6
|
-
|
|
7
|
-
|
|
3
|
+
title: string;
|
|
4
|
+
enablers: string[];
|
|
5
|
+
isEnabled: IsPluginEnabled;
|
|
6
|
+
config: string[];
|
|
7
|
+
resolveConfig: ResolveConfig;
|
|
8
8
|
};
|
|
9
9
|
export default _default;
|
|
@@ -1,39 +1,34 @@
|
|
|
1
|
-
import { getGitHookPaths } from '
|
|
2
|
-
import { getValuesByKeyDeep } from '
|
|
3
|
-
import { extname } from '
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
|
|
7
|
-
const
|
|
8
|
-
const
|
|
9
|
-
const isEnabled = ({ dependencies }) => hasDependency(dependencies, ENABLERS);
|
|
1
|
+
import { getGitHookPaths } from '#p/util/git.js';
|
|
2
|
+
import { getValuesByKeyDeep } from '#p/util/object.js';
|
|
3
|
+
import { extname } from '#p/util/path.js';
|
|
4
|
+
import { getDependenciesFromScripts, hasDependency } from '#p/util/plugin.js';
|
|
5
|
+
import { fromBinary } from '#p/util/protocols.js';
|
|
6
|
+
const title = 'Lefthook';
|
|
7
|
+
const enablers = ['lefthook', '@arkweid/lefthook', '@evilmartians/lefthook'];
|
|
8
|
+
const isEnabled = ({ dependencies }) => hasDependency(dependencies, enablers);
|
|
10
9
|
const gitHookPaths = getGitHookPaths();
|
|
11
|
-
const
|
|
12
|
-
const
|
|
13
|
-
const { manifest, isProduction } = options;
|
|
10
|
+
const config = ['lefthook.yml', ...gitHookPaths];
|
|
11
|
+
const resolveConfig = async (localConfig, options) => {
|
|
12
|
+
const { manifest, isProduction, configFileName } = options;
|
|
14
13
|
if (isProduction)
|
|
15
14
|
return [];
|
|
16
15
|
const dependencies = manifest.devDependencies ? Object.keys(manifest.devDependencies) : [];
|
|
17
|
-
if (extname(
|
|
18
|
-
const localConfig = await load(configFilePath);
|
|
19
|
-
if (!localConfig)
|
|
20
|
-
return [];
|
|
16
|
+
if (extname(configFileName) === '.yml') {
|
|
21
17
|
const scripts = getValuesByKeyDeep(localConfig, 'run').filter((run) => typeof run === 'string');
|
|
22
|
-
const lefthook = process.env.CI ?
|
|
18
|
+
const lefthook = process.env.CI ? enablers.filter(dependency => dependencies.includes(dependency)) : [];
|
|
23
19
|
return [...lefthook, ...getDependenciesFromScripts(scripts, { ...options, knownGlobalsOnly: true })];
|
|
24
20
|
}
|
|
25
|
-
const script =
|
|
21
|
+
const script = localConfig;
|
|
26
22
|
if (!script)
|
|
27
23
|
return [];
|
|
28
|
-
const scriptDependencies = getDependenciesFromScripts(
|
|
24
|
+
const scriptDependencies = getDependenciesFromScripts(script, options);
|
|
29
25
|
const matches = scriptDependencies.find(dep => dependencies.includes(fromBinary(dep)));
|
|
30
26
|
return matches ? [matches] : [];
|
|
31
27
|
};
|
|
32
|
-
const findDependencies = timerify(findLefthookDependencies);
|
|
33
28
|
export default {
|
|
34
|
-
|
|
35
|
-
|
|
29
|
+
title,
|
|
30
|
+
enablers,
|
|
36
31
|
isEnabled,
|
|
37
|
-
|
|
38
|
-
|
|
32
|
+
config,
|
|
33
|
+
resolveConfig,
|
|
39
34
|
};
|
|
@@ -1,10 +1,11 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { ResolveConfig, IsPluginEnabled } from '#p/types/plugins.js';
|
|
2
|
+
import type { LintStagedConfig } from './types.js';
|
|
2
3
|
declare const _default: {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
isEnabled:
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
4
|
+
readonly title: "lint-staged";
|
|
5
|
+
readonly enablers: string[];
|
|
6
|
+
readonly isEnabled: IsPluginEnabled;
|
|
7
|
+
readonly packageJsonPath: "lint-staged";
|
|
8
|
+
readonly config: string[];
|
|
9
|
+
readonly resolveConfig: ResolveConfig<LintStagedConfig>;
|
|
9
10
|
};
|
|
10
11
|
export default _default;
|
|
@@ -1,11 +1,9 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
const
|
|
5
|
-
const
|
|
6
|
-
const
|
|
7
|
-
const PACKAGE_JSON_PATH = 'lint-staged';
|
|
8
|
-
const CONFIG_FILE_PATTERNS = [
|
|
1
|
+
import { getDependenciesFromScripts, hasDependency } from '#p/util/plugin.js';
|
|
2
|
+
const title = 'lint-staged';
|
|
3
|
+
const enablers = ['lint-staged'];
|
|
4
|
+
const isEnabled = ({ dependencies }) => hasDependency(dependencies, enablers);
|
|
5
|
+
const packageJsonPath = 'lint-staged';
|
|
6
|
+
const config = [
|
|
9
7
|
'.lintstagedrc',
|
|
10
8
|
'.lintstagedrc.json',
|
|
11
9
|
'.lintstagedrc.{yml,yaml}',
|
|
@@ -13,28 +11,23 @@ const CONFIG_FILE_PATTERNS = [
|
|
|
13
11
|
'lint-staged.config.{js,mjs,cjs}',
|
|
14
12
|
'package.json',
|
|
15
13
|
];
|
|
16
|
-
const
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
let localConfig = basename(configFilePath) === 'package.json' ? manifest['lint-staged'] : await load(configFilePath);
|
|
21
|
-
if (typeof localConfig === 'function')
|
|
22
|
-
localConfig = localConfig();
|
|
23
|
-
if (!localConfig)
|
|
14
|
+
const resolveConfig = async (config, options) => {
|
|
15
|
+
if (typeof config === 'function')
|
|
16
|
+
config = config();
|
|
17
|
+
if (!config)
|
|
24
18
|
return [];
|
|
25
19
|
const dependencies = new Set();
|
|
26
|
-
for (const entry of Object.values(
|
|
20
|
+
for (const entry of Object.values(config).flat()) {
|
|
27
21
|
const scripts = [typeof entry === 'function' ? await entry([]) : entry].flat();
|
|
28
22
|
getDependenciesFromScripts(scripts, options).forEach(identifier => dependencies.add(identifier));
|
|
29
23
|
}
|
|
30
24
|
return Array.from(dependencies);
|
|
31
25
|
};
|
|
32
|
-
const findDependencies = timerify(findLintStagedDependencies);
|
|
33
26
|
export default {
|
|
34
|
-
|
|
35
|
-
|
|
27
|
+
title,
|
|
28
|
+
enablers,
|
|
36
29
|
isEnabled,
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
30
|
+
packageJsonPath,
|
|
31
|
+
config,
|
|
32
|
+
resolveConfig,
|
|
40
33
|
};
|
|
@@ -1,10 +1,11 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { ResolveConfig, IsPluginEnabled } from '#p/types/plugins.js';
|
|
2
|
+
import type { PluginConfig } from './types.js';
|
|
2
3
|
declare const _default: {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
isEnabled:
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
4
|
+
readonly title: "LintHTML";
|
|
5
|
+
readonly enablers: string[];
|
|
6
|
+
readonly isEnabled: IsPluginEnabled;
|
|
7
|
+
readonly packageJsonPath: "linthtmlConfig";
|
|
8
|
+
readonly config: string[];
|
|
9
|
+
readonly resolveConfig: ResolveConfig<PluginConfig>;
|
|
9
10
|
};
|
|
10
11
|
export default _default;
|
|
@@ -1,12 +1,11 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
const
|
|
6
|
-
const
|
|
7
|
-
const
|
|
8
|
-
const
|
|
9
|
-
const CONFIG_FILE_PATTERNS = [
|
|
1
|
+
import { isInternal } from '#p/util/path.js';
|
|
2
|
+
import { hasDependency } from '#p/util/plugin.js';
|
|
3
|
+
import { toEntryPattern } from '#p/util/protocols.js';
|
|
4
|
+
const title = 'LintHTML';
|
|
5
|
+
const packageJsonPath = 'linthtmlConfig';
|
|
6
|
+
const enablers = ['@linthtml/linthtml'];
|
|
7
|
+
const isEnabled = ({ dependencies }) => hasDependency(dependencies, enablers);
|
|
8
|
+
const config = [
|
|
10
9
|
'.linthtmlrc',
|
|
11
10
|
'.linthtmlrc.json',
|
|
12
11
|
'.linthtmlrc.yml',
|
|
@@ -14,25 +13,18 @@ const CONFIG_FILE_PATTERNS = [
|
|
|
14
13
|
'linthtml.config.js',
|
|
15
14
|
'package.json',
|
|
16
15
|
];
|
|
17
|
-
const
|
|
18
|
-
const
|
|
19
|
-
const localConfig = basename(configFilePath) === 'package.json' ? manifest.linthtmlConfig : await load(configFilePath);
|
|
20
|
-
if (!localConfig)
|
|
21
|
-
return [];
|
|
22
|
-
const extensions = [localConfig.extends ?? []]
|
|
16
|
+
const resolveConfig = config => {
|
|
17
|
+
const extensions = [config.extends ?? []]
|
|
23
18
|
.flat()
|
|
24
19
|
.map(extension => (isInternal(extension) ? toEntryPattern(extension) : extension));
|
|
25
|
-
const plugins = [
|
|
26
|
-
.flat()
|
|
27
|
-
.map(plugin => (isInternal(plugin) ? toEntryPattern(plugin) : plugin));
|
|
20
|
+
const plugins = [config.plugins ?? []].flat().map(plugin => (isInternal(plugin) ? toEntryPattern(plugin) : plugin));
|
|
28
21
|
return [...extensions, ...plugins];
|
|
29
22
|
};
|
|
30
|
-
const findDependencies = timerify(findPluginDependencies);
|
|
31
23
|
export default {
|
|
32
|
-
|
|
33
|
-
|
|
24
|
+
title,
|
|
25
|
+
enablers,
|
|
34
26
|
isEnabled,
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
27
|
+
packageJsonPath,
|
|
28
|
+
config,
|
|
29
|
+
resolveConfig,
|
|
38
30
|
};
|
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { ResolveConfig, IsPluginEnabled } from '#p/types/plugins.js';
|
|
2
|
+
import type { MarkdownlintConfig } from './types.js';
|
|
2
3
|
declare const _default: {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
isEnabled:
|
|
6
|
-
|
|
7
|
-
|
|
4
|
+
readonly title: "markdownlint";
|
|
5
|
+
readonly enablers: string[];
|
|
6
|
+
readonly isEnabled: IsPluginEnabled;
|
|
7
|
+
readonly config: string[];
|
|
8
|
+
readonly resolveConfig: ResolveConfig<MarkdownlintConfig>;
|
|
8
9
|
};
|
|
9
10
|
export default _default;
|
|
@@ -1,16 +1,12 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { hasDependency, load } from '../../util/plugin.js';
|
|
1
|
+
import { hasDependency } from '#p/util/plugin.js';
|
|
3
2
|
import { getArgumentValues } from './helpers.js';
|
|
4
|
-
const
|
|
5
|
-
const
|
|
6
|
-
const isEnabled = ({ dependencies }) => hasDependency(dependencies,
|
|
7
|
-
const
|
|
8
|
-
const
|
|
9
|
-
const { manifest
|
|
10
|
-
|
|
11
|
-
return [];
|
|
12
|
-
const localConfig = await load(configFilePath);
|
|
13
|
-
const extend = localConfig?.extends ? [localConfig.extends] : [];
|
|
3
|
+
const title = 'markdownlint';
|
|
4
|
+
const enablers = ['markdownlint-cli'];
|
|
5
|
+
const isEnabled = ({ dependencies }) => hasDependency(dependencies, enablers);
|
|
6
|
+
const config = ['.markdownlint.{json,jsonc}', '.markdownlint.{yml,yaml}'];
|
|
7
|
+
const resolveConfig = (config, options) => {
|
|
8
|
+
const { manifest } = options;
|
|
9
|
+
const extend = config?.extends ? [config.extends] : [];
|
|
14
10
|
const scripts = manifest?.scripts
|
|
15
11
|
? Object.values(manifest.scripts).filter((script) => typeof script === 'string')
|
|
16
12
|
: [];
|
|
@@ -19,11 +15,10 @@ const findMarkdownlintConfigDependencies = async (configFilePath, options) => {
|
|
|
19
15
|
.flatMap(script => getArgumentValues(script, / (--rules|-r)[ =]([^ ]+)/g));
|
|
20
16
|
return [...extend, ...uses];
|
|
21
17
|
};
|
|
22
|
-
const findDependencies = timerify(findMarkdownlintConfigDependencies);
|
|
23
18
|
export default {
|
|
24
|
-
|
|
25
|
-
|
|
19
|
+
title,
|
|
20
|
+
enablers,
|
|
26
21
|
isEnabled,
|
|
27
|
-
|
|
28
|
-
|
|
22
|
+
config,
|
|
23
|
+
resolveConfig,
|
|
29
24
|
};
|
|
@@ -1,10 +1,12 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { IsPluginEnabled, ResolveConfig, ResolveEntryPaths } from '#p/types/plugins.js';
|
|
2
|
+
import type { MochaConfig } from './types.js';
|
|
2
3
|
declare const _default: {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
isEnabled:
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
4
|
+
readonly title: "Mocha";
|
|
5
|
+
readonly enablers: string[];
|
|
6
|
+
readonly isEnabled: IsPluginEnabled;
|
|
7
|
+
readonly config: string[];
|
|
8
|
+
readonly entry: string[];
|
|
9
|
+
readonly resolveConfig: ResolveConfig<MochaConfig>;
|
|
10
|
+
readonly resolveEntryPaths: ResolveEntryPaths<MochaConfig>;
|
|
9
11
|
};
|
|
10
12
|
export default _default;
|
|
@@ -1,27 +1,24 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
const
|
|
6
|
-
const
|
|
7
|
-
const
|
|
8
|
-
const
|
|
9
|
-
const
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
const entryPatterns = (config.entry ?? (localConfig?.spec ? [localConfig.spec].flat() : ENTRY_FILE_PATTERNS)).map(toEntryPattern);
|
|
14
|
-
if (isProduction || !localConfig)
|
|
15
|
-
return entryPatterns;
|
|
1
|
+
import { hasDependency } from '#p/util/plugin.js';
|
|
2
|
+
import { toEntryPattern } from '#p/util/protocols.js';
|
|
3
|
+
const title = 'Mocha';
|
|
4
|
+
const enablers = ['mocha'];
|
|
5
|
+
const isEnabled = ({ dependencies }) => hasDependency(dependencies, enablers);
|
|
6
|
+
const config = ['.mocharc.{js,cjs,json,jsonc,yml,yaml}', 'package.json'];
|
|
7
|
+
const entry = ['**/test/*.{js,cjs,mjs}'];
|
|
8
|
+
const resolveEntryPaths = localConfig => {
|
|
9
|
+
const entryPatterns = localConfig.spec ? [localConfig.spec].flat() : [];
|
|
10
|
+
return [...entryPatterns].map(toEntryPattern);
|
|
11
|
+
};
|
|
12
|
+
const resolveConfig = localConfig => {
|
|
16
13
|
const require = localConfig.require ? [localConfig.require].flat() : [];
|
|
17
|
-
return [...require
|
|
14
|
+
return [...require].map(toEntryPattern);
|
|
18
15
|
};
|
|
19
|
-
const findDependencies = timerify(findMochaDependencies);
|
|
20
16
|
export default {
|
|
21
|
-
|
|
22
|
-
|
|
17
|
+
title,
|
|
18
|
+
enablers,
|
|
23
19
|
isEnabled,
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
20
|
+
config,
|
|
21
|
+
entry,
|
|
22
|
+
resolveConfig,
|
|
23
|
+
resolveEntryPaths,
|
|
27
24
|
};
|
|
@@ -1,10 +1,11 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { MSWConfig } from './types.js';
|
|
2
|
+
import type { IsPluginEnabled, ResolveEntryPaths } from '../../types/plugins.js';
|
|
2
3
|
declare const _default: {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
isEnabled:
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
4
|
+
title: string;
|
|
5
|
+
enablers: string[];
|
|
6
|
+
isEnabled: IsPluginEnabled;
|
|
7
|
+
config: string[];
|
|
8
|
+
entry: string[];
|
|
9
|
+
resolveEntryPaths: ResolveEntryPaths<MSWConfig>;
|
|
9
10
|
};
|
|
10
11
|
export default _default;
|
|
@@ -1,23 +1,20 @@
|
|
|
1
1
|
import { join } from '../../util/path.js';
|
|
2
|
-
import { basename } from '../../util/path.js';
|
|
3
2
|
import { hasDependency } from '../../util/plugin.js';
|
|
4
3
|
import { toEntryPattern } from '../../util/protocols.js';
|
|
5
|
-
const
|
|
6
|
-
const
|
|
7
|
-
const isEnabled = ({ dependencies }) => hasDependency(dependencies,
|
|
8
|
-
const
|
|
9
|
-
const
|
|
10
|
-
const
|
|
11
|
-
const { manifest } = options;
|
|
12
|
-
const localConfig = basename(configFilePath) === 'package.json' ? manifest.msw : undefined;
|
|
4
|
+
const title = 'Mock Service Worker';
|
|
5
|
+
const enablers = ['msw'];
|
|
6
|
+
const isEnabled = ({ dependencies }) => hasDependency(dependencies, enablers);
|
|
7
|
+
const config = ['package.json'];
|
|
8
|
+
const entry = ['mockServiceWorker.js'];
|
|
9
|
+
const resolveEntryPaths = async (localConfig) => {
|
|
13
10
|
const workerDirectory = localConfig?.workerDirectory ?? '.';
|
|
14
|
-
return
|
|
11
|
+
return entry.map(pattern => toEntryPattern(join(workerDirectory, pattern)));
|
|
15
12
|
};
|
|
16
13
|
export default {
|
|
17
|
-
|
|
18
|
-
|
|
14
|
+
title,
|
|
15
|
+
enablers,
|
|
19
16
|
isEnabled,
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
17
|
+
config,
|
|
18
|
+
entry,
|
|
19
|
+
resolveEntryPaths,
|
|
23
20
|
};
|
|
@@ -1,10 +1,12 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { IsPluginEnabled, ResolveConfig, ResolveEntryPaths } from '#p/types/plugins.js';
|
|
2
|
+
import type { NetlifyConfig } from './types.js';
|
|
2
3
|
declare const _default: {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
isEnabled:
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
4
|
+
title: string;
|
|
5
|
+
enablers: (string | RegExp)[];
|
|
6
|
+
isEnabled: IsPluginEnabled;
|
|
7
|
+
config: string[];
|
|
8
|
+
production: string[];
|
|
9
|
+
resolveEntryPaths: ResolveEntryPaths<NetlifyConfig>;
|
|
10
|
+
resolveConfig: ResolveConfig<NetlifyConfig>;
|
|
9
11
|
};
|
|
10
12
|
export default _default;
|
|
@@ -1,38 +1,34 @@
|
|
|
1
|
-
import { join } from '
|
|
2
|
-
import {
|
|
3
|
-
import { hasDependency, load } from '../../util/plugin.js';
|
|
1
|
+
import { join } from '#p/util/path.js';
|
|
2
|
+
import { hasDependency } from '#p/util/plugin.js';
|
|
4
3
|
import { toProductionEntryPattern } from '../../util/protocols.js';
|
|
5
4
|
import { extractFunctionsConfigProperty } from './helpers.js';
|
|
6
|
-
const
|
|
7
|
-
const
|
|
8
|
-
const isEnabled = ({ dependencies }) => hasDependency(dependencies,
|
|
9
|
-
const
|
|
5
|
+
const title = 'Netlify';
|
|
6
|
+
const enablers = [/^@netlify\/plugin-/, 'netlify-cli', '@netlify/functions'];
|
|
7
|
+
const isEnabled = ({ dependencies }) => hasDependency(dependencies, enablers);
|
|
8
|
+
const config = ['netlify.toml'];
|
|
10
9
|
const NETLIFY_FUNCTIONS_DIR = 'netlify/functions';
|
|
11
10
|
const NETLIFY_FUNCTIONS_EXTS = 'js,mjs,cjs,ts,mts,cts';
|
|
12
|
-
const
|
|
13
|
-
const
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
11
|
+
const production = [`${NETLIFY_FUNCTIONS_DIR}/**/*.{${NETLIFY_FUNCTIONS_EXTS}}`];
|
|
12
|
+
const resolveEntryPaths = localConfig => {
|
|
13
|
+
return [
|
|
14
|
+
...extractFunctionsConfigProperty(localConfig.functions || {}, 'included_files'),
|
|
15
|
+
join(localConfig.functions?.directory ?? NETLIFY_FUNCTIONS_DIR, `**/*.{${NETLIFY_FUNCTIONS_EXTS}}`),
|
|
16
|
+
]
|
|
17
|
+
.filter(file => !file.startsWith('!'))
|
|
18
|
+
.map(toProductionEntryPattern);
|
|
19
|
+
};
|
|
20
|
+
const resolveConfig = async (localConfig) => {
|
|
21
|
+
return [
|
|
21
22
|
...(localConfig?.plugins?.map(plugin => plugin.package) ?? []),
|
|
22
23
|
...extractFunctionsConfigProperty(localConfig.functions || {}, 'external_node_modules'),
|
|
23
24
|
];
|
|
24
|
-
const entryFiles = [
|
|
25
|
-
...extractFunctionsConfigProperty(localConfig.functions || {}, 'included_files'),
|
|
26
|
-
join(localConfig.functions?.directory ?? NETLIFY_FUNCTIONS_DIR, `**/*.{${NETLIFY_FUNCTIONS_EXTS}}`),
|
|
27
|
-
].filter(file => !file.startsWith('!'));
|
|
28
|
-
return [...dependencies, ...entryFiles.map(toProductionEntryPattern)];
|
|
29
25
|
};
|
|
30
|
-
const findDependencies = timerify(findPluginDependencies);
|
|
31
26
|
export default {
|
|
32
|
-
|
|
33
|
-
|
|
27
|
+
title,
|
|
28
|
+
enablers,
|
|
34
29
|
isEnabled,
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
30
|
+
config,
|
|
31
|
+
production,
|
|
32
|
+
resolveEntryPaths,
|
|
33
|
+
resolveConfig,
|
|
38
34
|
};
|