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,32 +1,24 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { hasDependency } from '#p/util/plugin.js';
|
|
2
2
|
import { toEntryPattern } from '../../util/protocols.js';
|
|
3
|
-
const
|
|
4
|
-
const
|
|
5
|
-
const isEnabled = ({ dependencies }) => hasDependency(dependencies,
|
|
6
|
-
const
|
|
3
|
+
const title = 'Cypress';
|
|
4
|
+
const enablers = ['cypress'];
|
|
5
|
+
const isEnabled = ({ dependencies }) => hasDependency(dependencies, enablers);
|
|
6
|
+
const config = ['cypress.config.{js,ts,mjs,cjs}'];
|
|
7
7
|
const TEST_FILE_PATTERNS = ['cypress/e2e/**/*.cy.{js,jsx,ts,tsx}'];
|
|
8
8
|
const SUPPORT_FILE_PATTERNS = [
|
|
9
9
|
'cypress/support/e2e.{js,jsx,ts,tsx}',
|
|
10
10
|
'cypress/support/commands.{js,ts}',
|
|
11
11
|
'cypress/plugins/index.js',
|
|
12
12
|
];
|
|
13
|
-
const
|
|
14
|
-
const
|
|
15
|
-
|
|
16
|
-
const localConfig = await load(configFilePath);
|
|
17
|
-
if (!localConfig)
|
|
18
|
-
return [];
|
|
19
|
-
if (config.entry)
|
|
20
|
-
return config.entry.map(toEntryPattern);
|
|
21
|
-
const patterns = [localConfig.e2e?.specPattern ?? [], localConfig.component?.specPattern ?? []].flat();
|
|
22
|
-
const entryPatterns = (patterns.length > 0 ? patterns : TEST_FILE_PATTERNS).map(toEntryPattern);
|
|
23
|
-
return [...entryPatterns, ...SUPPORT_FILE_PATTERNS.map(toEntryPattern)];
|
|
13
|
+
const entry = [...TEST_FILE_PATTERNS, ...SUPPORT_FILE_PATTERNS];
|
|
14
|
+
const resolveEntryPaths = async (localConfig) => {
|
|
15
|
+
return [localConfig.e2e?.specPattern ?? [], localConfig.component?.specPattern ?? []].flat().map(toEntryPattern);
|
|
24
16
|
};
|
|
25
17
|
export default {
|
|
26
|
-
|
|
27
|
-
|
|
18
|
+
title,
|
|
19
|
+
enablers,
|
|
28
20
|
isEnabled,
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
21
|
+
config,
|
|
22
|
+
entry,
|
|
23
|
+
resolveEntryPaths,
|
|
32
24
|
};
|
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { ResolveConfig, IsPluginEnabled } from '#p/types/plugins.js';
|
|
2
|
+
import type { DrizzleConfig } from './types.js';
|
|
2
3
|
declare const _default: {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
isEnabled:
|
|
6
|
-
|
|
7
|
-
|
|
4
|
+
readonly title: "Drizzle";
|
|
5
|
+
readonly enablers: string[];
|
|
6
|
+
readonly isEnabled: IsPluginEnabled;
|
|
7
|
+
readonly config: string[];
|
|
8
|
+
readonly resolveConfig: ResolveConfig<DrizzleConfig>;
|
|
8
9
|
};
|
|
9
10
|
export default _default;
|
|
@@ -1,21 +1,18 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
const
|
|
5
|
-
const
|
|
6
|
-
const
|
|
7
|
-
const
|
|
8
|
-
|
|
9
|
-
const localConfig = await load(configFilePath);
|
|
10
|
-
if (!localConfig?.schema)
|
|
1
|
+
import { hasDependency } from '#p/util/plugin.js';
|
|
2
|
+
import { toProductionEntryPattern } from '#p/util/protocols.js';
|
|
3
|
+
const title = 'Drizzle';
|
|
4
|
+
const enablers = ['drizzle-kit'];
|
|
5
|
+
const isEnabled = ({ dependencies }) => hasDependency(dependencies, enablers);
|
|
6
|
+
const config = ['drizzle.config.{ts,js,json}'];
|
|
7
|
+
const resolveConfig = config => {
|
|
8
|
+
if (!config.schema)
|
|
11
9
|
return [];
|
|
12
|
-
return [
|
|
10
|
+
return [config.schema].flat().map(toProductionEntryPattern);
|
|
13
11
|
};
|
|
14
|
-
const findDependencies = timerify(findDrizzleDependencies);
|
|
15
12
|
export default {
|
|
16
|
-
|
|
17
|
-
|
|
13
|
+
title,
|
|
14
|
+
enablers,
|
|
18
15
|
isEnabled,
|
|
19
|
-
|
|
20
|
-
|
|
16
|
+
config,
|
|
17
|
+
resolveConfig,
|
|
21
18
|
};
|
|
@@ -1,12 +1,14 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { DummyEleventyConfig } from './helpers.js';
|
|
2
|
+
import type { IsPluginEnabled, ResolveConfig, ResolveEntryPaths } from '#p/types/plugins.js';
|
|
3
|
+
import type { EleventyConfig } from './types.js';
|
|
4
|
+
type T = Partial<EleventyConfig> | ((arg: DummyEleventyConfig) => Promise<Partial<EleventyConfig>>);
|
|
2
5
|
declare const _default: {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
isEnabled:
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
findDependencies: GenericPluginCallback;
|
|
6
|
+
title: string;
|
|
7
|
+
enablers: string[];
|
|
8
|
+
isEnabled: IsPluginEnabled;
|
|
9
|
+
config: string[];
|
|
10
|
+
production: string[];
|
|
11
|
+
resolveEntryPaths: ResolveEntryPaths<T>;
|
|
12
|
+
resolveConfig: ResolveConfig<T>;
|
|
11
13
|
};
|
|
12
14
|
export default _default;
|
|
@@ -1,24 +1,16 @@
|
|
|
1
|
+
import { isDirectory } from '#p/util/fs.js';
|
|
2
|
+
import { isInNodeModules, join } from '#p/util/path.js';
|
|
3
|
+
import { hasDependency } from '#p/util/plugin.js';
|
|
4
|
+
import { toProductionEntryPattern } from '#p/util/protocols.js';
|
|
1
5
|
import { DEFAULT_EXTENSIONS } from '../../constants.js';
|
|
2
|
-
import { isDirectory } from '../../util/fs.js';
|
|
3
|
-
import { dirname, isInNodeModules, join } from '../../util/path.js';
|
|
4
|
-
import { timerify } from '../../util/Performance.js';
|
|
5
|
-
import { hasDependency, load } from '../../util/plugin.js';
|
|
6
|
-
import { toProductionEntryPattern } from '../../util/protocols.js';
|
|
7
6
|
import { DummyEleventyConfig, defaultEleventyConfig } from './helpers.js';
|
|
8
|
-
const
|
|
9
|
-
const
|
|
10
|
-
const isEnabled = ({ dependencies }) => hasDependency(dependencies,
|
|
11
|
-
const
|
|
12
|
-
const
|
|
13
|
-
const
|
|
14
|
-
const
|
|
15
|
-
const findEleventyDependencies = async (configFilePath, options) => {
|
|
16
|
-
const { config } = options;
|
|
17
|
-
let localConfig = (await load(configFilePath));
|
|
18
|
-
if (!localConfig)
|
|
19
|
-
return config.entry
|
|
20
|
-
? config.entry.map(toProductionEntryPattern)
|
|
21
|
-
: PRODUCTION_ENTRY_FILE_PATTERNS.map(toProductionEntryPattern);
|
|
7
|
+
const title = 'Eleventy';
|
|
8
|
+
const enablers = ['@11ty/eleventy'];
|
|
9
|
+
const isEnabled = ({ dependencies }) => hasDependency(dependencies, enablers);
|
|
10
|
+
const config = ['.eleventy.js', 'eleventy.config.{js,cjs,mjs}'];
|
|
11
|
+
const production = ['posts/**/*.11tydata.js', '_data/**/*.{js,cjs,mjs}'];
|
|
12
|
+
const resolveEntryPaths = async (localConfig, options) => {
|
|
13
|
+
const { configFileDir } = options;
|
|
22
14
|
const dummyUserConfig = new DummyEleventyConfig();
|
|
23
15
|
if (typeof localConfig === 'function')
|
|
24
16
|
localConfig = await localConfig(dummyUserConfig);
|
|
@@ -26,38 +18,40 @@ const findEleventyDependencies = async (configFilePath, options) => {
|
|
|
26
18
|
const dataDir = localConfig?.dir?.data || defaultEleventyConfig.dir.data;
|
|
27
19
|
const templateFormats = localConfig.templateFormats || defaultEleventyConfig.templateFormats;
|
|
28
20
|
const exts = DEFAULT_EXTENSIONS.map(extname => extname.slice(1)).join(',');
|
|
29
|
-
const copiedPackages = new Set();
|
|
30
21
|
const copiedEntries = new Set();
|
|
31
22
|
for (const path of Object.keys(dummyUserConfig.passthroughCopies)) {
|
|
32
|
-
const isDir = !path.includes('*') && isDirectory(join(
|
|
23
|
+
const isDir = !path.includes('*') && isDirectory(join(configFileDir, path));
|
|
33
24
|
if (isDir) {
|
|
34
25
|
copiedEntries.add(join(path, `**/*.{${exts}}`));
|
|
35
26
|
}
|
|
36
|
-
else if (isInNodeModules(path)) {
|
|
37
|
-
copiedPackages.add(path);
|
|
38
|
-
}
|
|
39
|
-
else {
|
|
27
|
+
else if (!isInNodeModules(path)) {
|
|
40
28
|
copiedEntries.add(path);
|
|
41
29
|
}
|
|
42
30
|
}
|
|
43
31
|
return [
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
32
|
+
join(inputDir, dataDir, '**/*.{js,cjs,mjs}'),
|
|
33
|
+
join(inputDir, `**/*.{${typeof templateFormats === 'string' ? templateFormats : templateFormats.join(',')}}`),
|
|
34
|
+
join(inputDir, '**/*.11tydata.js'),
|
|
35
|
+
...copiedEntries,
|
|
36
|
+
].map(toProductionEntryPattern);
|
|
37
|
+
};
|
|
38
|
+
const resolveConfig = async (localConfig) => {
|
|
39
|
+
const dummyUserConfig = new DummyEleventyConfig();
|
|
40
|
+
if (typeof localConfig === 'function')
|
|
41
|
+
localConfig = await localConfig(dummyUserConfig);
|
|
42
|
+
const copiedPackages = new Set();
|
|
43
|
+
for (const path of Object.keys(dummyUserConfig.passthroughCopies)) {
|
|
44
|
+
if (isInNodeModules(path))
|
|
45
|
+
copiedPackages.add(path);
|
|
46
|
+
}
|
|
47
|
+
return [...copiedPackages];
|
|
52
48
|
};
|
|
53
|
-
const findDependencies = timerify(findEleventyDependencies);
|
|
54
49
|
export default {
|
|
55
|
-
|
|
56
|
-
|
|
50
|
+
title,
|
|
51
|
+
enablers,
|
|
57
52
|
isEnabled,
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
findDependencies,
|
|
53
|
+
config,
|
|
54
|
+
production,
|
|
55
|
+
resolveEntryPaths,
|
|
56
|
+
resolveConfig,
|
|
63
57
|
};
|
|
@@ -1,7 +1,5 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
type
|
|
3
|
-
|
|
4
|
-
manifest: PackageJson;
|
|
5
|
-
}, dependencies?: Set<string>) => Promise<Set<string>>;
|
|
1
|
+
import type { ESLintConfig } from './types.js';
|
|
2
|
+
import type { PluginOptions } from '../../types/plugins.js';
|
|
3
|
+
type GetDependenciesDeep = (localConfig: ESLintConfig, options: PluginOptions, dependencies?: Set<string>) => Promise<Set<string>>;
|
|
6
4
|
export declare const getDependenciesDeep: GetDependenciesDeep;
|
|
7
5
|
export {};
|
|
@@ -1,11 +1,9 @@
|
|
|
1
|
-
import { compact } from '
|
|
2
|
-
import { getPackageNameFromFilePath, getPackageNameFromModuleSpecifier } from '
|
|
3
|
-
import {
|
|
4
|
-
import { load } from '
|
|
5
|
-
import { _resolve } from '
|
|
1
|
+
import { compact } from '#p/util/array.js';
|
|
2
|
+
import { getPackageNameFromFilePath, getPackageNameFromModuleSpecifier } from '#p/util/modules.js';
|
|
3
|
+
import { isInternal, toAbsolute, isAbsolute } from '#p/util/path.js';
|
|
4
|
+
import { load } from '#p/util/plugin.js';
|
|
5
|
+
import { _resolve } from '#p/util/require.js';
|
|
6
6
|
import { getDependenciesFromConfig } from '../babel/index.js';
|
|
7
|
-
import { fallback } from './fallback.js';
|
|
8
|
-
import { PACKAGE_JSON_PATH } from './index.js';
|
|
9
7
|
const getDependencies = (config) => {
|
|
10
8
|
const extendsSpecifiers = config.extends ? [config.extends].flat().map(resolveExtendSpecifier) : [];
|
|
11
9
|
if (extendsSpecifiers.some(specifier => specifier?.startsWith('eslint-plugin-prettier')))
|
|
@@ -19,21 +17,18 @@ const getDependencies = (config) => {
|
|
|
19
17
|
const overrides = config.overrides ? [config.overrides].flat().flatMap(getDependencies) : [];
|
|
20
18
|
return compact([...extendsSpecifiers, ...plugins, parser, ...babelDependencies, ...settings, ...overrides]);
|
|
21
19
|
};
|
|
22
|
-
export const getDependenciesDeep = async (
|
|
20
|
+
export const getDependenciesDeep = async (localConfig, options, dependencies = new Set()) => {
|
|
21
|
+
const { configFileDir } = options;
|
|
23
22
|
const addAll = (deps) => deps.forEach(dependency => dependencies.add(dependency));
|
|
24
|
-
const localConfig = basename(configFilePath) === 'package.json'
|
|
25
|
-
? options.manifest[PACKAGE_JSON_PATH]
|
|
26
|
-
: /(\.(jsonc?|ya?ml)|rc)$/.test(configFilePath)
|
|
27
|
-
? await load(configFilePath)
|
|
28
|
-
: await fallback(configFilePath);
|
|
29
23
|
if (localConfig) {
|
|
30
24
|
if (localConfig.extends) {
|
|
31
25
|
for (const extend of [localConfig.extends].flat()) {
|
|
32
26
|
if (isInternal(extend)) {
|
|
33
|
-
const filePath = toAbsolute(extend,
|
|
27
|
+
const filePath = toAbsolute(extend, configFileDir);
|
|
34
28
|
const extendConfigFilePath = _resolve(filePath);
|
|
35
29
|
dependencies.add(extendConfigFilePath);
|
|
36
|
-
|
|
30
|
+
const localConfig = await load(extendConfigFilePath);
|
|
31
|
+
addAll(await getDependenciesDeep(localConfig, options, dependencies));
|
|
37
32
|
}
|
|
38
33
|
}
|
|
39
34
|
}
|
|
@@ -1,11 +1,13 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
|
|
1
|
+
import type { IsPluginEnabled, ResolveConfig } from '#p/types/plugins.js';
|
|
2
|
+
import type { ESLintConfig } from './types.js';
|
|
3
|
+
export declare const packageJsonPath = "eslintConfig";
|
|
3
4
|
declare const _default: {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
isEnabled:
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
5
|
+
readonly title: "ESLint";
|
|
6
|
+
readonly enablers: string[];
|
|
7
|
+
readonly isEnabled: IsPluginEnabled;
|
|
8
|
+
readonly packageJsonPath: "eslintConfig";
|
|
9
|
+
readonly entry: string[];
|
|
10
|
+
readonly config: string[];
|
|
11
|
+
readonly resolveConfig: ResolveConfig<ESLintConfig>;
|
|
10
12
|
};
|
|
11
13
|
export default _default;
|
|
@@ -1,37 +1,23 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { timerify } from '../../util/Performance.js';
|
|
3
|
-
import { hasDependency } from '../../util/plugin.js';
|
|
1
|
+
import { hasDependency } from '#p/util/plugin.js';
|
|
4
2
|
import { getDependenciesDeep } from './helpers.js';
|
|
5
|
-
const
|
|
6
|
-
const
|
|
7
|
-
const isEnabled = ({ dependencies, manifest, config }) => hasDependency(dependencies,
|
|
3
|
+
const title = 'ESLint';
|
|
4
|
+
const enablers = ['eslint'];
|
|
5
|
+
const isEnabled = ({ dependencies, manifest, config }) => hasDependency(dependencies, enablers) ||
|
|
8
6
|
'eslint' in config ||
|
|
9
7
|
Boolean(manifest.name && /(^eslint-config|\/eslint-config)/.test(manifest.name));
|
|
10
|
-
export const
|
|
11
|
-
const
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
'.eslintrc.{yml,yaml}',
|
|
16
|
-
'package.json',
|
|
17
|
-
];
|
|
18
|
-
const findESLintDependencies = async (configFilePath, { cwd, manifest, isProduction }) => {
|
|
19
|
-
if (isProduction)
|
|
20
|
-
return [];
|
|
21
|
-
const baseFilePath = basename(configFilePath);
|
|
22
|
-
if (baseFilePath === 'eslint.config.js' ||
|
|
23
|
-
baseFilePath === 'eslint.config.cjs' ||
|
|
24
|
-
baseFilePath === 'eslint.config.mjs')
|
|
25
|
-
return [];
|
|
26
|
-
const dependencies = await getDependenciesDeep(configFilePath, { cwd, manifest });
|
|
8
|
+
export const packageJsonPath = 'eslintConfig';
|
|
9
|
+
const entry = ['eslint.config.{js,cjs,mjs}'];
|
|
10
|
+
const config = ['.eslintrc', '.eslintrc.{js,json,cjs}', '.eslintrc.{yml,yaml}', 'package.json'];
|
|
11
|
+
const resolveConfig = async (localConfig, options) => {
|
|
12
|
+
const dependencies = await getDependenciesDeep(localConfig, options);
|
|
27
13
|
return Array.from(dependencies);
|
|
28
14
|
};
|
|
29
|
-
const findDependencies = timerify(findESLintDependencies);
|
|
30
15
|
export default {
|
|
31
|
-
|
|
32
|
-
|
|
16
|
+
title,
|
|
17
|
+
enablers,
|
|
33
18
|
isEnabled,
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
19
|
+
packageJsonPath,
|
|
20
|
+
entry,
|
|
21
|
+
config,
|
|
22
|
+
resolveConfig,
|
|
37
23
|
};
|
|
@@ -1,10 +1,11 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { IsPluginEnabled, ResolveConfig } from '#p/types/plugins.js';
|
|
2
|
+
import type { GatsbyConfig, GatsbyNode } 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
|
+
production: string[];
|
|
9
|
+
resolveConfig: ResolveConfig<GatsbyConfig | GatsbyNode>;
|
|
9
10
|
};
|
|
10
11
|
export default _default;
|
|
@@ -1,11 +1,9 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
const
|
|
5
|
-
const
|
|
6
|
-
const
|
|
7
|
-
const CONFIG_FILE_PATTERNS = ['gatsby-{config,node}.{js,jsx,ts,tsx}', 'plugins/**/gatsby-node.{js,jsx,ts,tsx}'];
|
|
8
|
-
const PRODUCTION_ENTRY_FILE_PATTERNS = [
|
|
1
|
+
import { hasDependency } from '#p/util/plugin.js';
|
|
2
|
+
const title = 'Gatsby';
|
|
3
|
+
const enablers = ['gatsby', 'gatsby-cli'];
|
|
4
|
+
const isEnabled = ({ dependencies }) => hasDependency(dependencies, enablers);
|
|
5
|
+
const config = ['gatsby-{config,node}.{js,jsx,ts,tsx}', 'plugins/**/gatsby-node.{js,jsx,ts,tsx}'];
|
|
6
|
+
const production = [
|
|
9
7
|
'gatsby-{browser,ssr}.{js,jsx,ts,tsx}',
|
|
10
8
|
'src/api/**/*.{js,ts}',
|
|
11
9
|
'src/pages/**/*.{js,jsx,ts,tsx}',
|
|
@@ -13,16 +11,12 @@ const PRODUCTION_ENTRY_FILE_PATTERNS = [
|
|
|
13
11
|
'src/html.{js,jsx,ts,tsx}',
|
|
14
12
|
'plugins/**/gatsby-{browser,ssr}.{js,jsx,ts,tsx}',
|
|
15
13
|
];
|
|
16
|
-
const
|
|
17
|
-
const {
|
|
18
|
-
|
|
19
|
-
const entryPatterns = (config.entry ?? PRODUCTION_ENTRY_FILE_PATTERNS).map(toProductionEntryPattern);
|
|
20
|
-
if (isProduction || !localConfig)
|
|
21
|
-
return entryPatterns;
|
|
22
|
-
if (/gatsby-config/.test(configFilePath)) {
|
|
14
|
+
const resolveConfig = async (localConfig, options) => {
|
|
15
|
+
const { configFileName } = options;
|
|
16
|
+
if (/gatsby-config/.test(configFileName)) {
|
|
23
17
|
return localConfig.plugins.map(plugin => (typeof plugin === 'string' ? plugin : plugin.resolve));
|
|
24
18
|
}
|
|
25
|
-
if (/gatsby-node/.test(
|
|
19
|
+
if (/gatsby-node/.test(configFileName)) {
|
|
26
20
|
const plugins = new Set();
|
|
27
21
|
const actions = { setBabelPlugin: plugin => plugins.add(plugin.name) };
|
|
28
22
|
const _config = localConfig;
|
|
@@ -33,12 +27,11 @@ const findGatsbyDependencies = async (configFilePath, options) => {
|
|
|
33
27
|
}
|
|
34
28
|
return [];
|
|
35
29
|
};
|
|
36
|
-
const findDependencies = timerify(findGatsbyDependencies);
|
|
37
30
|
export default {
|
|
38
|
-
|
|
39
|
-
|
|
31
|
+
title,
|
|
32
|
+
enablers,
|
|
40
33
|
isEnabled,
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
34
|
+
config,
|
|
35
|
+
production,
|
|
36
|
+
resolveConfig,
|
|
44
37
|
};
|
|
@@ -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,38 +1,28 @@
|
|
|
1
|
-
import { _firstGlob } from '
|
|
2
|
-
import { getValuesByKeyDeep } from '
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
return typeof value === 'string';
|
|
8
|
-
}
|
|
9
|
-
const NAME = 'GitHub Actions';
|
|
10
|
-
const ENABLERS = 'This plugin is enabled when a `.yml` or `.yaml` file is found in the `.github/workflows` folder.';
|
|
1
|
+
import { _firstGlob } from '#p/util/glob.js';
|
|
2
|
+
import { getValuesByKeyDeep } from '#p/util/object.js';
|
|
3
|
+
import { join } from '#p/util/path.js';
|
|
4
|
+
import { getDependenciesFromScripts } from '#p/util/plugin.js';
|
|
5
|
+
const title = 'GitHub Actions';
|
|
6
|
+
const enablers = 'This plugin is enabled when a `.yml` or `.yaml` file is found in the `.github/workflows` folder.';
|
|
11
7
|
const isEnabled = async ({ cwd }) => Boolean(await _firstGlob({ cwd, patterns: ['.github/workflows/*.{yml,yaml}'] }));
|
|
12
|
-
const
|
|
13
|
-
const
|
|
14
|
-
|
|
15
|
-
const configFileName =
|
|
16
|
-
if (isProduction)
|
|
17
|
-
return [];
|
|
18
|
-
const config = await load(configFilePath);
|
|
19
|
-
if (!config)
|
|
20
|
-
return [];
|
|
8
|
+
const config = ['.github/workflows/*.{yml,yaml}', '.github/**/action.{yml,yaml}'];
|
|
9
|
+
const isString = (value) => typeof value === 'string';
|
|
10
|
+
const resolveConfig = async (config, options) => {
|
|
11
|
+
const { configFileDir, configFileName } = options;
|
|
21
12
|
const scripts = getValuesByKeyDeep(config, 'run').filter(isString);
|
|
22
13
|
const getActionDependencies = () => {
|
|
23
14
|
const isActionManifest = configFileName === 'action.yml' || configFileName === 'action.yaml';
|
|
24
15
|
if (!isActionManifest || !config?.runs?.using?.startsWith('node'))
|
|
25
16
|
return [];
|
|
26
17
|
const scripts = [config.runs.pre, config.runs.main, config.runs.post].filter(isString);
|
|
27
|
-
return scripts.map(script => join(
|
|
18
|
+
return scripts.map(script => join(configFileDir, script));
|
|
28
19
|
};
|
|
29
20
|
return [...getActionDependencies(), ...getDependenciesFromScripts(scripts, { ...options, knownGlobalsOnly: true })];
|
|
30
21
|
};
|
|
31
|
-
const findDependencies = timerify(findGithubActionsDependencies);
|
|
32
22
|
export default {
|
|
33
|
-
|
|
34
|
-
|
|
23
|
+
title,
|
|
24
|
+
enablers,
|
|
35
25
|
isEnabled,
|
|
36
|
-
|
|
37
|
-
|
|
26
|
+
config,
|
|
27
|
+
resolveConfig,
|
|
38
28
|
};
|
|
@@ -1,10 +1,11 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { ResolveConfig, IsPluginEnabled } from '#p/types/plugins.js';
|
|
2
|
+
import type { GraphqlCodegenTypes } from './types.js';
|
|
2
3
|
declare const _default: {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
isEnabled:
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
4
|
+
readonly title: "GraphQL Codegen";
|
|
5
|
+
readonly enablers: RegExp[];
|
|
6
|
+
readonly isEnabled: IsPluginEnabled;
|
|
7
|
+
readonly packageJsonPath: "codegen";
|
|
8
|
+
readonly config: string[];
|
|
9
|
+
readonly resolveConfig: ResolveConfig<GraphqlCodegenTypes>;
|
|
9
10
|
};
|
|
10
11
|
export default _default;
|
|
@@ -1,26 +1,19 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import { toEntryPattern } from '../../util/protocols.js';
|
|
1
|
+
import { isInternal } from '#p/util/path.js';
|
|
2
|
+
import { hasDependency } from '#p/util/plugin.js';
|
|
3
|
+
import { toEntryPattern } from '#p/util/protocols.js';
|
|
5
4
|
import { isConfigurationOutput } from './types.js';
|
|
6
|
-
const
|
|
7
|
-
const
|
|
8
|
-
const isEnabled = ({ dependencies }) => hasDependency(dependencies,
|
|
9
|
-
const
|
|
10
|
-
const
|
|
5
|
+
const title = 'GraphQL Codegen';
|
|
6
|
+
const enablers = [/^@graphql-codegen\//];
|
|
7
|
+
const isEnabled = ({ dependencies }) => hasDependency(dependencies, enablers);
|
|
8
|
+
const packageJsonPath = 'codegen';
|
|
9
|
+
const config = [
|
|
11
10
|
'codegen.{json,yml,yaml,js,ts,mjs,cts}',
|
|
12
11
|
'.codegenrc.{json,yml,yaml,js,ts}',
|
|
13
12
|
'codegen.config.js',
|
|
14
13
|
'package.json',
|
|
15
14
|
];
|
|
16
|
-
const
|
|
17
|
-
const
|
|
18
|
-
if (isProduction)
|
|
19
|
-
return [];
|
|
20
|
-
const localConfig = basename(configFilePath) === 'package.json' ? manifest[PACKAGE_JSON_PATH] : await load(configFilePath);
|
|
21
|
-
if (!localConfig)
|
|
22
|
-
return [];
|
|
23
|
-
const generateSet = localConfig.generates ? Object.values(localConfig.generates) : [];
|
|
15
|
+
const resolveConfig = config => {
|
|
16
|
+
const generateSet = config.generates ? Object.values(config.generates) : [];
|
|
24
17
|
const configurationOutput = generateSet.filter(isConfigurationOutput);
|
|
25
18
|
const presets = configurationOutput
|
|
26
19
|
.map(configOutput => (configOutput.preset ? configOutput.preset : undefined))
|
|
@@ -41,12 +34,11 @@ const findPluginDependencies = async (configFilePath, options) => {
|
|
|
41
34
|
});
|
|
42
35
|
return [...presets, ...flatPlugins, ...nestedPlugins];
|
|
43
36
|
};
|
|
44
|
-
const findDependencies = timerify(findPluginDependencies);
|
|
45
37
|
export default {
|
|
46
|
-
|
|
47
|
-
|
|
38
|
+
title,
|
|
39
|
+
enablers,
|
|
48
40
|
isEnabled,
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
41
|
+
packageJsonPath,
|
|
42
|
+
config,
|
|
43
|
+
resolveConfig,
|
|
52
44
|
};
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { IsPluginEnabled, ResolveConfig } from '../../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<string>;
|
|
8
8
|
};
|
|
9
9
|
export default _default;
|
|
@@ -1,25 +1,19 @@
|
|
|
1
1
|
import { getGitHookPaths } from '../../util/git.js';
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
const
|
|
5
|
-
const
|
|
6
|
-
const isEnabled = ({ dependencies }) => hasDependency(dependencies, ENABLERS);
|
|
2
|
+
import { getDependenciesFromScripts, hasDependency } from '../../util/plugin.js';
|
|
3
|
+
const title = 'husky';
|
|
4
|
+
const enablers = ['husky'];
|
|
5
|
+
const isEnabled = ({ dependencies }) => hasDependency(dependencies, enablers);
|
|
7
6
|
const gitHookPaths = getGitHookPaths('.husky', false);
|
|
8
|
-
const
|
|
9
|
-
const
|
|
10
|
-
const { isProduction } = options;
|
|
11
|
-
if (isProduction)
|
|
12
|
-
return [];
|
|
13
|
-
const script = await loadFile(configFilePath);
|
|
7
|
+
const config = [...gitHookPaths];
|
|
8
|
+
const resolveConfig = async (script, options) => {
|
|
14
9
|
if (!script)
|
|
15
10
|
return [];
|
|
16
11
|
return getDependenciesFromScripts(String(script), { ...options, knownGlobalsOnly: true });
|
|
17
12
|
};
|
|
18
|
-
const findDependencies = timerify(findHuskyDependencies);
|
|
19
13
|
export default {
|
|
20
|
-
|
|
21
|
-
|
|
14
|
+
title,
|
|
15
|
+
enablers,
|
|
22
16
|
isEnabled,
|
|
23
|
-
|
|
24
|
-
|
|
17
|
+
config,
|
|
18
|
+
resolveConfig,
|
|
25
19
|
};
|