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.
Files changed (179) hide show
  1. package/dist/ConfigurationChief.d.ts +3 -3
  2. package/dist/ConfigurationValidator.d.ts +21 -21
  3. package/dist/ProjectPrincipal.d.ts +1 -1
  4. package/dist/ProjectPrincipal.js +3 -5
  5. package/dist/WorkspaceWorker.d.ts +2 -2
  6. package/dist/WorkspaceWorker.js +61 -44
  7. package/dist/binaries/index.js +2 -2
  8. package/dist/binaries/resolvers/index.d.ts +12 -12
  9. package/dist/compilers/index.d.ts +6 -7
  10. package/dist/compilers/index.js +0 -3
  11. package/dist/constants.d.ts +1 -2
  12. package/dist/constants.js +8 -4
  13. package/dist/plugins/_template/index.d.ts +10 -9
  14. package/dist/plugins/_template/index.js +16 -30
  15. package/dist/plugins/angular/index.d.ts +8 -6
  16. package/dist/plugins/angular/index.js +17 -22
  17. package/dist/plugins/astro/index.d.ts +7 -7
  18. package/dist/plugins/astro/index.js +14 -17
  19. package/dist/plugins/ava/index.d.ts +9 -7
  20. package/dist/plugins/ava/index.js +19 -21
  21. package/dist/plugins/babel/helpers.js +1 -1
  22. package/dist/plugins/babel/index.d.ts +7 -7
  23. package/dist/plugins/babel/index.js +15 -26
  24. package/dist/plugins/capacitor/index.d.ts +7 -6
  25. package/dist/plugins/capacitor/index.js +11 -18
  26. package/dist/plugins/changesets/index.d.ts +7 -6
  27. package/dist/plugins/changesets/index.js +14 -21
  28. package/dist/plugins/changesets/types.d.ts +3 -0
  29. package/dist/plugins/changesets/types.js +1 -0
  30. package/dist/plugins/commitizen/index.d.ts +8 -7
  31. package/dist/plugins/commitizen/index.js +13 -21
  32. package/dist/plugins/commitlint/index.d.ts +9 -6
  33. package/dist/plugins/commitlint/index.js +11 -19
  34. package/dist/plugins/cspell/index.d.ts +7 -6
  35. package/dist/plugins/cspell/index.js +12 -20
  36. package/dist/plugins/cypress/index.d.ts +7 -7
  37. package/dist/plugins/cypress/index.js +13 -21
  38. package/dist/plugins/drizzle/index.d.ts +7 -6
  39. package/dist/plugins/drizzle/index.js +13 -16
  40. package/dist/plugins/eleventy/index.d.ts +11 -9
  41. package/dist/plugins/eleventy/index.js +35 -41
  42. package/dist/plugins/eslint/helpers.d.ts +3 -5
  43. package/dist/plugins/eslint/helpers.js +10 -15
  44. package/dist/plugins/eslint/index.d.ts +10 -8
  45. package/dist/plugins/eslint/index.js +15 -29
  46. package/dist/plugins/gatsby/index.d.ts +8 -7
  47. package/dist/plugins/gatsby/index.js +15 -22
  48. package/dist/plugins/github-actions/index.d.ts +6 -6
  49. package/dist/plugins/github-actions/index.js +15 -25
  50. package/dist/plugins/graphql-codegen/index.d.ts +8 -7
  51. package/dist/plugins/graphql-codegen/index.js +15 -23
  52. package/dist/plugins/husky/index.d.ts +6 -6
  53. package/dist/plugins/husky/index.js +10 -16
  54. package/dist/plugins/jest/index.d.ts +9 -7
  55. package/dist/plugins/jest/index.js +50 -31
  56. package/dist/plugins/lefthook/index.d.ts +6 -6
  57. package/dist/plugins/lefthook/index.js +19 -24
  58. package/dist/plugins/lint-staged/index.d.ts +8 -7
  59. package/dist/plugins/lint-staged/index.js +16 -23
  60. package/dist/plugins/linthtml/index.d.ts +8 -7
  61. package/dist/plugins/linthtml/index.js +16 -24
  62. package/dist/plugins/markdownlint/index.d.ts +7 -6
  63. package/dist/plugins/markdownlint/index.js +12 -17
  64. package/dist/plugins/mocha/index.d.ts +9 -7
  65. package/dist/plugins/mocha/index.js +19 -22
  66. package/dist/plugins/msw/index.d.ts +8 -7
  67. package/dist/plugins/msw/index.js +12 -15
  68. package/dist/plugins/netlify/index.d.ts +9 -7
  69. package/dist/plugins/netlify/index.js +23 -27
  70. package/dist/plugins/next/index.d.ts +6 -7
  71. package/dist/plugins/next/index.js +10 -18
  72. package/dist/plugins/node-test-runner/index.d.ts +5 -6
  73. package/dist/plugins/node-test-runner/index.js +6 -18
  74. package/dist/plugins/npm-package-json-lint/index.d.ts +8 -7
  75. package/dist/plugins/npm-package-json-lint/index.js +12 -19
  76. package/dist/plugins/nx/index.d.ts +7 -6
  77. package/dist/plugins/nx/index.js +18 -27
  78. package/dist/plugins/nyc/index.d.ts +7 -6
  79. package/dist/plugins/nyc/index.js +11 -17
  80. package/dist/plugins/playwright/index.d.ts +11 -13
  81. package/dist/plugins/playwright/index.js +23 -30
  82. package/dist/plugins/playwright-ct/index.d.ts +8 -7
  83. package/dist/plugins/playwright-ct/index.js +12 -24
  84. package/dist/plugins/postcss/index.d.ts +7 -6
  85. package/dist/plugins/postcss/index.js +12 -21
  86. package/dist/plugins/prettier/index.d.ts +7 -6
  87. package/dist/plugins/prettier/index.js +14 -20
  88. package/dist/plugins/release-it/index.d.ts +8 -7
  89. package/dist/plugins/release-it/index.js +18 -27
  90. package/dist/plugins/remark/index.d.ts +8 -7
  91. package/dist/plugins/remark/index.js +13 -28
  92. package/dist/plugins/remix/index.d.ts +6 -7
  93. package/dist/plugins/remix/index.js +10 -20
  94. package/dist/plugins/rollup/index.d.ts +5 -6
  95. package/dist/plugins/rollup/index.js +8 -16
  96. package/dist/plugins/semantic-release/index.d.ts +8 -7
  97. package/dist/plugins/semantic-release/index.js +13 -25
  98. package/dist/plugins/sentry/index.d.ts +5 -6
  99. package/dist/plugins/sentry/index.js +8 -16
  100. package/dist/plugins/storybook/index.d.ts +10 -8
  101. package/dist/plugins/storybook/index.js +28 -35
  102. package/dist/plugins/stryker/index.d.ts +7 -6
  103. package/dist/plugins/stryker/index.js +10 -18
  104. package/dist/plugins/stylelint/index.d.ts +7 -6
  105. package/dist/plugins/stylelint/index.js +13 -23
  106. package/dist/plugins/svelte/index.d.ts +7 -8
  107. package/dist/plugins/svelte/index.js +13 -23
  108. package/dist/plugins/tailwind/index.d.ts +5 -6
  109. package/dist/plugins/tailwind/index.js +8 -14
  110. package/dist/plugins/tsup/index.d.ts +7 -6
  111. package/dist/plugins/tsup/index.js +14 -21
  112. package/dist/plugins/typedoc/index.d.ts +10 -7
  113. package/dist/plugins/typedoc/index.js +14 -24
  114. package/dist/plugins/typescript/index.d.ts +8 -7
  115. package/dist/plugins/typescript/index.js +31 -25
  116. package/dist/plugins/unbuild/index.d.ts +7 -6
  117. package/dist/plugins/unbuild/index.js +12 -17
  118. package/dist/plugins/vercel-og/index.d.ts +5 -6
  119. package/dist/plugins/vercel-og/index.js +8 -16
  120. package/dist/plugins/vite/index.d.ts +9 -7
  121. package/dist/plugins/vite/index.js +13 -18
  122. package/dist/plugins/vitest/index.d.ts +11 -9
  123. package/dist/plugins/vitest/index.js +62 -49
  124. package/dist/plugins/vue/index.d.ts +7 -6
  125. package/dist/plugins/vue/index.js +14 -26
  126. package/dist/plugins/webpack/index.d.ts +7 -6
  127. package/dist/plugins/webpack/index.js +17 -20
  128. package/dist/plugins/wireit/index.d.ts +8 -7
  129. package/dist/plugins/wireit/index.js +12 -20
  130. package/dist/plugins/yorkie/index.d.ts +8 -7
  131. package/dist/plugins/yorkie/index.js +13 -21
  132. package/dist/plugins.d.ts +3 -0
  133. package/dist/plugins.js +14 -0
  134. package/dist/reporters/index.d.ts +5 -5
  135. package/dist/types/config.d.ts +1 -1
  136. package/dist/types/package-json.d.ts +12 -13
  137. package/dist/types/plugins.d.ts +20 -14
  138. package/dist/types/util.d.ts +0 -13
  139. package/dist/typescript/SourceFileManager.js +3 -0
  140. package/dist/typescript/createHosts.js +4 -3
  141. package/dist/typescript/resolveModuleNames.js +26 -41
  142. package/dist/typescript/visitors/dynamic-imports/importCall.d.ts +1 -1
  143. package/dist/typescript/visitors/dynamic-imports/importType.d.ts +1 -1
  144. package/dist/typescript/visitors/dynamic-imports/index.d.ts +1 -1
  145. package/dist/typescript/visitors/dynamic-imports/jsDocType.d.ts +1 -1
  146. package/dist/typescript/visitors/dynamic-imports/propertyAccessCall.d.ts +1 -1
  147. package/dist/typescript/visitors/dynamic-imports/requireCall.d.ts +1 -1
  148. package/dist/typescript/visitors/exports/exportAssignment.d.ts +1 -1
  149. package/dist/typescript/visitors/exports/exportDeclaration.d.ts +1 -1
  150. package/dist/typescript/visitors/exports/exportKeyword.d.ts +1 -1
  151. package/dist/typescript/visitors/exports/index.d.ts +1 -1
  152. package/dist/typescript/visitors/exports/moduleExportsAccessExpression.d.ts +1 -1
  153. package/dist/typescript/visitors/imports/importDeclaration.d.ts +1 -1
  154. package/dist/typescript/visitors/imports/importEqualsDeclaration.d.ts +1 -1
  155. package/dist/typescript/visitors/imports/index.d.ts +1 -1
  156. package/dist/typescript/visitors/imports/reExportDeclaration.d.ts +1 -1
  157. package/dist/typescript/visitors/scripts/bun.d.ts +1 -1
  158. package/dist/typescript/visitors/scripts/execa.d.ts +1 -1
  159. package/dist/typescript/visitors/scripts/index.d.ts +1 -1
  160. package/dist/typescript/visitors/scripts/zx.d.ts +1 -1
  161. package/dist/util/Performance.d.ts +1 -4
  162. package/dist/util/Performance.js +5 -1
  163. package/dist/util/fs.js +0 -3
  164. package/dist/util/loader.d.ts +0 -2
  165. package/dist/util/loader.js +8 -16
  166. package/dist/util/object.d.ts +1 -1
  167. package/dist/util/path.d.ts +0 -3
  168. package/dist/util/path.js +0 -1
  169. package/dist/util/plugin.d.ts +4 -1
  170. package/dist/util/plugin.js +28 -1
  171. package/dist/util/require.d.ts +1 -0
  172. package/dist/util/require.js +13 -0
  173. package/dist/util/tsconfig-loader.js +1 -2
  174. package/dist/util/type.d.ts +1 -1
  175. package/dist/version.d.ts +1 -1
  176. package/dist/version.js +1 -1
  177. package/package.json +5 -1
  178. package/dist/plugins/eslint/fallback.d.ts +0 -1
  179. package/dist/plugins/eslint/fallback.js +0 -18
@@ -1,9 +1,11 @@
1
- import type { IsPluginEnabledCallback, GenericPluginCallback } from '../../types/plugins.js';
1
+ import type { IsPluginEnabled, ResolveConfig } from '#p/types/plugins.js';
2
+ import type { AngularCLIWorkspaceConfiguration } from './types.js';
2
3
  declare const _default: {
3
- NAME: string;
4
- ENABLERS: string[];
5
- isEnabled: IsPluginEnabledCallback;
6
- CONFIG_FILE_PATTERNS: string[];
7
- findDependencies: GenericPluginCallback;
4
+ title: string;
5
+ enablers: string[];
6
+ isEnabled: IsPluginEnabled;
7
+ config: string[];
8
+ production: string[];
9
+ resolveConfig: ResolveConfig<AngularCLIWorkspaceConfiguration>;
8
10
  };
9
11
  export default _default;
@@ -1,18 +1,17 @@
1
- import { join } from '../../util/path.js';
2
- import { timerify } from '../../util/Performance.js';
3
- import { hasDependency, load } from '../../util/plugin.js';
4
- import { findTypeScriptDependencies } from '../typescript/index.js';
5
- const NAME = 'Angular';
6
- const ENABLERS = ['@angular/cli'];
7
- const isEnabled = ({ dependencies }) => hasDependency(dependencies, ENABLERS);
8
- const CONFIG_FILE_PATTERNS = ['angular.json'];
9
- const findPluginDependencies = async (configFilePath, options) => {
1
+ import { join } from '#p/util/path.js';
2
+ import { hasDependency } from '#p/util/plugin.js';
3
+ import { toProductionEntryPattern } from '#p/util/protocols.js';
4
+ const title = 'Angular';
5
+ const enablers = ['@angular/cli'];
6
+ const isEnabled = ({ dependencies }) => hasDependency(dependencies, enablers);
7
+ const config = ['angular.json'];
8
+ const production = [];
9
+ const resolveConfig = async (config, options) => {
10
10
  const { cwd } = options;
11
- const localConfig = await load(configFilePath);
12
- if (!localConfig?.projects)
11
+ if (!config?.projects)
13
12
  return [];
14
13
  const dependencies = new Set();
15
- for (const project of Object.values(localConfig.projects)) {
14
+ for (const project of Object.values(config.projects)) {
16
15
  if (!project.architect)
17
16
  return [];
18
17
  for (const target of Object.values(project.architect)) {
@@ -22,22 +21,18 @@ const findPluginDependencies = async (configFilePath, options) => {
22
21
  dependencies.add(packageName);
23
22
  if (opts) {
24
23
  if ('main' in opts && typeof opts.main === 'string') {
25
- dependencies.add(join(cwd, opts.main));
26
- }
27
- if ('tsConfig' in opts && typeof opts.tsConfig === 'string') {
28
- const tsConfigDependencies = await findTypeScriptDependencies(join(cwd, opts.tsConfig), options);
29
- tsConfigDependencies.forEach(dependency => dependencies.add(dependency));
24
+ dependencies.add(toProductionEntryPattern(join(cwd, opts.main)));
30
25
  }
31
26
  }
32
27
  }
33
28
  }
34
29
  return Array.from(dependencies);
35
30
  };
36
- const findDependencies = timerify(findPluginDependencies);
37
31
  export default {
38
- NAME,
39
- ENABLERS,
32
+ title,
33
+ enablers,
40
34
  isEnabled,
41
- CONFIG_FILE_PATTERNS,
42
- findDependencies,
35
+ config,
36
+ production,
37
+ resolveConfig,
43
38
  };
@@ -1,10 +1,10 @@
1
- import type { GenericPluginCallback, IsPluginEnabledCallback } from '../../types/plugins.js';
1
+ import type { IsPluginEnabled, Resolve } from '#p/types/plugins.js';
2
2
  declare const _default: {
3
- NAME: string;
4
- ENABLERS: string[];
5
- isEnabled: IsPluginEnabledCallback;
6
- ENTRY_FILE_PATTERNS: string[];
7
- PRODUCTION_ENTRY_FILE_PATTERNS: string[];
8
- findDependencies: GenericPluginCallback;
3
+ readonly title: "Astro";
4
+ readonly enablers: string[];
5
+ readonly isEnabled: IsPluginEnabled;
6
+ readonly entry: string[];
7
+ readonly production: string[];
8
+ readonly resolve: Resolve;
9
9
  };
10
10
  export default _default;
@@ -1,15 +1,12 @@
1
- import { hasDependency } from '../../util/plugin.js';
2
- import { toEntryPattern, toProductionEntryPattern } from '../../util/protocols.js';
3
- const NAME = 'Astro';
4
- const ENABLERS = ['astro'];
5
- const isEnabled = ({ dependencies }) => hasDependency(dependencies, ENABLERS);
6
- const ENTRY_FILE_PATTERNS = ['astro.config.{js,cjs,mjs,ts}', 'src/content/config.ts'];
7
- const PRODUCTION_ENTRY_FILE_PATTERNS = ['src/pages/**/*.{astro,mdx,js,ts}', 'src/content/**/*.mdx'];
8
- const findDependencies = async (configFilePath, options) => {
9
- const { config, manifest, isProduction } = options;
10
- const dependencies = config.entry
11
- ? config.entry.map(toProductionEntryPattern)
12
- : [...ENTRY_FILE_PATTERNS.map(toEntryPattern), ...PRODUCTION_ENTRY_FILE_PATTERNS.map(toProductionEntryPattern)];
1
+ import { hasDependency } from '#p/util/plugin.js';
2
+ const title = 'Astro';
3
+ const enablers = ['astro'];
4
+ const isEnabled = ({ dependencies }) => hasDependency(dependencies, enablers);
5
+ const entry = ['astro.config.{js,cjs,mjs,ts}', 'src/content/config.ts'];
6
+ const production = ['src/pages/**/*.{astro,mdx,js,ts}', 'src/content/**/*.mdx'];
7
+ const resolve = options => {
8
+ const { isProduction, manifest } = options;
9
+ const dependencies = [];
13
10
  if (!isProduction &&
14
11
  manifest.scripts &&
15
12
  Object.values(manifest.scripts).some(script => /(?<=^|\s)astro(\s|\s.+\s)check(?=\s|$)/.test(script))) {
@@ -18,10 +15,10 @@ const findDependencies = async (configFilePath, options) => {
18
15
  return dependencies;
19
16
  };
20
17
  export default {
21
- NAME,
22
- ENABLERS,
18
+ title,
19
+ enablers,
23
20
  isEnabled,
24
- ENTRY_FILE_PATTERNS,
25
- PRODUCTION_ENTRY_FILE_PATTERNS,
26
- findDependencies,
21
+ entry,
22
+ production,
23
+ resolve,
27
24
  };
@@ -1,10 +1,12 @@
1
- import type { IsPluginEnabledCallback, GenericPluginCallback } from '../../types/plugins.js';
1
+ import type { IsPluginEnabled, ResolveConfig, ResolveEntryPaths } from '#p/types/plugins.js';
2
+ import type { AvaConfig } from './types.js';
2
3
  declare const _default: {
3
- NAME: string;
4
- ENABLERS: string[];
5
- isEnabled: IsPluginEnabledCallback;
6
- CONFIG_FILE_PATTERNS: string[];
7
- ENTRY_FILE_PATTERNS: string[];
8
- findDependencies: GenericPluginCallback;
4
+ readonly title: "Ava";
5
+ readonly enablers: string[];
6
+ readonly isEnabled: IsPluginEnabled;
7
+ readonly config: string[];
8
+ readonly entry: string[];
9
+ readonly resolveEntryPaths: ResolveEntryPaths<AvaConfig>;
10
+ readonly resolveConfig: ResolveConfig<AvaConfig>;
9
11
  };
10
12
  export default _default;
@@ -1,12 +1,10 @@
1
- import { basename } from '../../util/path.js';
2
- import { timerify } from '../../util/Performance.js';
3
- import { getDependenciesFromScripts, hasDependency, load } from '../../util/plugin.js';
1
+ import { getDependenciesFromScripts, hasDependency } from '#p/util/plugin.js';
4
2
  import { toEntryPattern } from '../../util/protocols.js';
5
- const NAME = 'Ava';
6
- const ENABLERS = ['ava'];
7
- const isEnabled = ({ dependencies }) => hasDependency(dependencies, ENABLERS);
8
- const CONFIG_FILE_PATTERNS = ['ava.config.{js,cjs,mjs}', 'package.json'];
9
- const ENTRY_FILE_PATTERNS = [
3
+ const title = 'Ava';
4
+ const enablers = ['ava'];
5
+ const isEnabled = ({ dependencies }) => hasDependency(dependencies, enablers);
6
+ const config = ['ava.config.{js,cjs,mjs}', 'package.json'];
7
+ const entry = [
10
8
  `test.{js,cjs,mjs,ts}`,
11
9
  `{src,source}/test.{js,cjs,mjs,ts}`,
12
10
  `**/__tests__/**/*.{js,cjs,mjs,ts}`,
@@ -18,26 +16,26 @@ const ENTRY_FILE_PATTERNS = [
18
16
  '!**/__tests__/**/__{helper,fixture}?(s)__/**/*',
19
17
  '!**/test?(s)/**/{helper,fixture}?(s)/**/*',
20
18
  ];
21
- const findAvaDependencies = async (configFilePath, options) => {
22
- const { manifest, isProduction, config } = options;
23
- let localConfig = basename(configFilePath) === 'package.json' ? manifest.ava : await load(configFilePath);
19
+ const resolveEntryPaths = localConfig => {
20
+ if (typeof localConfig === 'function')
21
+ localConfig = localConfig();
22
+ return (localConfig?.files ?? []).map(toEntryPattern);
23
+ };
24
+ const resolveConfig = async (localConfig, options) => {
24
25
  if (typeof localConfig === 'function')
25
26
  localConfig = localConfig();
26
- const entryPatterns = (config.entry ?? localConfig?.files ?? ENTRY_FILE_PATTERNS).map(toEntryPattern);
27
- if (isProduction || !localConfig)
28
- return entryPatterns;
29
27
  const nodeArgs = localConfig.nodeArguments ?? [];
30
28
  const requireArgs = (localConfig.require ?? []).map(require => `--require ${require}`);
31
29
  const fakeCommand = `node ${nodeArgs.join(' ')} ${requireArgs.join(' ')}`;
32
30
  const dependencies = getDependenciesFromScripts([fakeCommand], { ...options, knownGlobalsOnly: true });
33
- return [...entryPatterns, ...dependencies];
31
+ return [...dependencies];
34
32
  };
35
- const findDependencies = timerify(findAvaDependencies);
36
33
  export default {
37
- NAME,
38
- ENABLERS,
34
+ title,
35
+ enablers,
39
36
  isEnabled,
40
- CONFIG_FILE_PATTERNS,
41
- ENTRY_FILE_PATTERNS,
42
- findDependencies,
37
+ config,
38
+ entry,
39
+ resolveEntryPaths,
40
+ resolveConfig,
43
41
  };
@@ -1,4 +1,4 @@
1
- import { isAbsolute, isInternal } from '../../util/path.js';
1
+ import { isAbsolute, isInternal } from '#p/util/path.js';
2
2
  export const resolveName = (identifier, namespace) => {
3
3
  if (isAbsolute(identifier) || isInternal(identifier))
4
4
  return identifier;
@@ -1,11 +1,11 @@
1
- import type { BabelConfigObj } from './types.js';
2
- import type { IsPluginEnabledCallback, GenericPluginCallback } from '../../types/plugins.js';
1
+ import type { IsPluginEnabled, ResolveConfig } from '#p/types/plugins.js';
2
+ import type { BabelConfig, BabelConfigObj } from './types.js';
3
3
  export declare const getDependenciesFromConfig: (config: BabelConfigObj) => string[];
4
4
  declare const _default: {
5
- NAME: string;
6
- ENABLERS: RegExp[];
7
- isEnabled: IsPluginEnabledCallback;
8
- CONFIG_FILE_PATTERNS: string[];
9
- findDependencies: GenericPluginCallback;
5
+ title: string;
6
+ enablers: RegExp[];
7
+ isEnabled: IsPluginEnabled;
8
+ config: string[];
9
+ resolveConfig: ResolveConfig<BabelConfig>;
10
10
  };
11
11
  export default _default;
@@ -1,17 +1,10 @@
1
- import { compact } from '../../util/array.js';
2
- import { basename } from '../../util/path.js';
3
- import { timerify } from '../../util/Performance.js';
4
- import { hasDependency, load } from '../../util/plugin.js';
1
+ import { compact } from '#p/util/array.js';
2
+ import { hasDependency } from '#p/util/plugin.js';
5
3
  import { resolveName, api } from './helpers.js';
6
- const NAME = 'Babel';
7
- const ENABLERS = [/^@babel\//];
8
- const isEnabled = ({ dependencies }) => hasDependency(dependencies, ENABLERS);
9
- const CONFIG_FILE_PATTERNS = [
10
- 'babel.config.{json,js,cjs,mjs,cts}',
11
- '.babelrc.{json,js,cjs,mjs,cts}',
12
- '.babelrc',
13
- 'package.json',
14
- ];
4
+ const title = 'Babel';
5
+ const enablers = [/^@babel\//];
6
+ const isEnabled = ({ dependencies }) => hasDependency(dependencies, enablers);
7
+ const config = ['babel.config.{json,js,cjs,mjs,cts}', '.babelrc.{json,js,cjs,mjs,cts}', '.babelrc', 'package.json'];
15
8
  const getName = (value) => typeof value === 'string' ? [value] : Array.isArray(value) ? [value[0]] : [];
16
9
  export const getDependenciesFromConfig = (config) => {
17
10
  const presets = config.presets?.flatMap(getName).map(name => resolveName(name, 'preset')) ?? [];
@@ -19,21 +12,17 @@ export const getDependenciesFromConfig = (config) => {
19
12
  const nested = config.env ? Object.values(config.env).flatMap(getDependenciesFromConfig) : [];
20
13
  return compact([...presets, ...plugins, ...nested]);
21
14
  };
22
- const findBabelDependencies = async (configFilePath, { manifest, isProduction }) => {
23
- if (isProduction)
15
+ const resolveConfig = async (config) => {
16
+ if (typeof config === 'function')
17
+ config = config(api);
18
+ if (!config)
24
19
  return [];
25
- let localConfig = basename(configFilePath) === 'package.json' ? manifest.babel : await load(configFilePath);
26
- if (typeof localConfig === 'function')
27
- localConfig = localConfig(api);
28
- if (!localConfig)
29
- return [];
30
- return getDependenciesFromConfig(localConfig);
20
+ return getDependenciesFromConfig(config);
31
21
  };
32
- const findDependencies = timerify(findBabelDependencies);
33
22
  export default {
34
- NAME,
35
- ENABLERS,
23
+ title,
24
+ enablers,
36
25
  isEnabled,
37
- CONFIG_FILE_PATTERNS,
38
- findDependencies,
26
+ config,
27
+ resolveConfig,
39
28
  };
@@ -1,9 +1,10 @@
1
- import type { IsPluginEnabledCallback, GenericPluginCallback } from '../../types/plugins.js';
1
+ import type { IsPluginEnabled, ResolveConfig } from '#p/types/plugins.js';
2
+ import type { CapacitorConfig } from './types.js';
2
3
  declare const _default: {
3
- NAME: string;
4
- ENABLERS: RegExp[];
5
- isEnabled: IsPluginEnabledCallback;
6
- CONFIG_FILE_PATTERNS: string[];
7
- findDependencies: GenericPluginCallback;
4
+ readonly title: "Capacitor";
5
+ readonly enablers: RegExp[];
6
+ readonly isEnabled: IsPluginEnabled;
7
+ readonly config: string[];
8
+ readonly resolveConfig: ResolveConfig<CapacitorConfig>;
8
9
  };
9
10
  export default _default;
@@ -1,22 +1,15 @@
1
- import { timerify } from '../../util/Performance.js';
2
- import { hasDependency, load } from '../../util/plugin.js';
3
- const NAME = 'Capacitor';
4
- const ENABLERS = [/^@capacitor\//];
5
- const isEnabled = ({ dependencies }) => hasDependency(dependencies, ENABLERS);
6
- const CONFIG_FILE_PATTERNS = ['capacitor.config.ts'];
7
- const findCapacitorDependencies = async (configFilePath, { isProduction }) => {
8
- if (isProduction)
9
- return [];
10
- const localConfig = await load(configFilePath);
11
- if (!localConfig)
12
- return [];
13
- return localConfig.includePlugins ?? [];
1
+ import { hasDependency } from '#p/util/plugin.js';
2
+ const title = 'Capacitor';
3
+ const enablers = [/^@capacitor\//];
4
+ const isEnabled = ({ dependencies }) => hasDependency(dependencies, enablers);
5
+ const config = ['capacitor.config.{json,ts}'];
6
+ const resolveConfig = config => {
7
+ return config.includePlugins ?? [];
14
8
  };
15
- const findDependencies = timerify(findCapacitorDependencies);
16
9
  export default {
17
- NAME,
18
- ENABLERS,
10
+ title,
11
+ enablers,
19
12
  isEnabled,
20
- CONFIG_FILE_PATTERNS,
21
- findDependencies,
13
+ config,
14
+ resolveConfig,
22
15
  };
@@ -1,9 +1,10 @@
1
- import type { IsPluginEnabledCallback, GenericPluginCallback } from '../../types/plugins.js';
1
+ import type { IsPluginEnabled, ResolveConfig } from '#p/types/plugins.js';
2
+ import type { ChangesetsConfig } from './types.js';
2
3
  declare const _default: {
3
- NAME: string;
4
- ENABLERS: string[];
5
- isEnabled: IsPluginEnabledCallback;
6
- CONFIG_FILE_PATTERNS: string[];
7
- findDependencies: GenericPluginCallback;
4
+ readonly title: "Changesets";
5
+ readonly enablers: string[];
6
+ readonly isEnabled: IsPluginEnabled;
7
+ readonly config: string[];
8
+ readonly resolveConfig: ResolveConfig<ChangesetsConfig>;
8
9
  };
9
10
  export default _default;
@@ -1,26 +1,19 @@
1
- import { timerify } from '../../util/Performance.js';
2
- import { hasDependency, load } from '../../util/plugin.js';
3
- const NAME = 'Changesets';
4
- const ENABLERS = ['@changesets/cli'];
5
- const isEnabled = ({ dependencies }) => hasDependency(dependencies, ENABLERS);
6
- const CONFIG_FILE_PATTERNS = ['.changeset/config.json'];
7
- const findChangesetsDependencies = async (configFilePath, { isProduction }) => {
8
- if (isProduction)
9
- return [];
10
- const localConfig = await load(configFilePath);
11
- if (!localConfig)
12
- return [];
13
- return Array.isArray(localConfig.changelog)
14
- ? [localConfig.changelog[0]]
15
- : typeof localConfig.changelog === 'string'
16
- ? [localConfig.changelog]
1
+ import { hasDependency } from '#p/util/plugin.js';
2
+ const title = 'Changesets';
3
+ const enablers = ['@changesets/cli'];
4
+ const isEnabled = ({ dependencies }) => hasDependency(dependencies, enablers);
5
+ const config = ['.changeset/config.json'];
6
+ const resolveConfig = config => {
7
+ return Array.isArray(config.changelog)
8
+ ? [config.changelog[0]]
9
+ : typeof config.changelog === 'string'
10
+ ? [config.changelog]
17
11
  : [];
18
12
  };
19
- const findDependencies = timerify(findChangesetsDependencies);
20
13
  export default {
21
- NAME,
22
- ENABLERS,
14
+ title,
15
+ enablers,
23
16
  isEnabled,
24
- CONFIG_FILE_PATTERNS,
25
- findDependencies,
17
+ config,
18
+ resolveConfig,
26
19
  };
@@ -0,0 +1,3 @@
1
+ export type ChangesetsConfig = {
2
+ changelog: string | string[];
3
+ };
@@ -0,0 +1 @@
1
+ export {};
@@ -1,10 +1,11 @@
1
- import type { IsPluginEnabledCallback, GenericPluginCallback } from '../../types/plugins.js';
1
+ import type { IsPluginEnabled, ResolveConfig } from '#p/types/plugins.js';
2
+ import type { CommitizenConfig } from './types.js';
2
3
  declare const _default: {
3
- NAME: string;
4
- ENABLERS: string[];
5
- isEnabled: IsPluginEnabledCallback;
6
- PACKAGE_JSON_PATH: string;
7
- CONFIG_FILE_PATTERNS: string[];
8
- findDependencies: GenericPluginCallback;
4
+ readonly title: "Commitizen";
5
+ readonly enablers: string[];
6
+ readonly isEnabled: IsPluginEnabled;
7
+ readonly packageJsonPath: "config.commitizen";
8
+ readonly config: string[];
9
+ readonly resolveConfig: ResolveConfig<CommitizenConfig>;
9
10
  };
10
11
  export default _default;
@@ -1,25 +1,17 @@
1
- import { basename } from '../../util/path.js';
2
- import { timerify } from '../../util/Performance.js';
3
- import { hasDependency, load } from '../../util/plugin.js';
4
- const NAME = 'Commitizen';
5
- const ENABLERS = ['commitizen'];
6
- const isEnabled = ({ dependencies }) => hasDependency(dependencies, ENABLERS);
7
- const PACKAGE_JSON_PATH = 'config.commitizen';
8
- const CONFIG_FILE_PATTERNS = ['.czrc', '.cz.json', 'package.json'];
9
- const findPluginDependencies = async (configFilePath, { manifest, isProduction }) => {
10
- if (isProduction)
11
- return [];
12
- const localConfig = basename(configFilePath) === 'package.json' ? manifest.config?.commitizen : await load(configFilePath);
13
- if (!localConfig)
14
- return [];
15
- return localConfig.path ? [localConfig.path] : [];
1
+ import { hasDependency } from '#p/util/plugin.js';
2
+ const title = 'Commitizen';
3
+ const enablers = ['commitizen'];
4
+ const isEnabled = ({ dependencies }) => hasDependency(dependencies, enablers);
5
+ const packageJsonPath = 'config.commitizen';
6
+ const config = ['.czrc', '.cz.json', 'package.json'];
7
+ const resolveConfig = config => {
8
+ return config.path ? [config.path] : [];
16
9
  };
17
- const findDependencies = timerify(findPluginDependencies);
18
10
  export default {
19
- NAME,
20
- ENABLERS,
11
+ title,
12
+ enablers,
21
13
  isEnabled,
22
- PACKAGE_JSON_PATH,
23
- CONFIG_FILE_PATTERNS,
24
- findDependencies,
14
+ packageJsonPath,
15
+ config,
16
+ resolveConfig,
25
17
  };
@@ -1,9 +1,12 @@
1
- import type { IsPluginEnabledCallback, GenericPluginCallback } from '../../types/plugins.js';
1
+ import type { ResolveConfig, IsPluginEnabled } from '#p/types/plugins.js';
2
+ type CommitLintConfig = {
3
+ extends: string[];
4
+ };
2
5
  declare const _default: {
3
- NAME: string;
4
- ENABLERS: string[];
5
- isEnabled: IsPluginEnabledCallback;
6
- CONFIG_FILE_PATTERNS: string[];
7
- findDependencies: GenericPluginCallback;
6
+ readonly title: "commitlint";
7
+ readonly enablers: string[];
8
+ readonly isEnabled: IsPluginEnabled;
9
+ readonly config: string[];
10
+ readonly resolveConfig: ResolveConfig<CommitLintConfig>;
8
11
  };
9
12
  export default _default;
@@ -1,28 +1,20 @@
1
- import { basename } from '../../util/path.js';
2
- import { timerify } from '../../util/Performance.js';
3
- import { hasDependency, load } from '../../util/plugin.js';
4
- const NAME = 'commitlint';
5
- const ENABLERS = ['@commitlint/cli'];
6
- const isEnabled = ({ dependencies }) => hasDependency(dependencies, ENABLERS);
7
- const CONFIG_FILE_PATTERNS = [
1
+ import { hasDependency } from '#p/util/plugin.js';
2
+ const title = 'commitlint';
3
+ const enablers = ['@commitlint/cli'];
4
+ const isEnabled = ({ dependencies }) => hasDependency(dependencies, enablers);
5
+ const config = [
8
6
  '.commitlintrc',
9
7
  '.commitlintrc.{json,yaml,yml,js,cjs,ts,cts}',
10
8
  'commitlint.config.{js,cjs,ts,cts}',
11
9
  'package.json',
12
10
  ];
13
- const findCommitLintDependencies = async (configFilePath, { manifest, isProduction }) => {
14
- if (isProduction)
15
- return [];
16
- const localConfig = basename(configFilePath) === 'package.json' ? manifest.commitlint : await load(configFilePath);
17
- if (!localConfig)
18
- return [];
19
- return localConfig.extends ? [localConfig.extends].flat() : [];
11
+ const resolveConfig = config => {
12
+ return config.extends ? [config.extends].flat() : [];
20
13
  };
21
- const findDependencies = timerify(findCommitLintDependencies);
22
14
  export default {
23
- NAME,
24
- ENABLERS,
15
+ title,
16
+ enablers,
25
17
  isEnabled,
26
- CONFIG_FILE_PATTERNS,
27
- findDependencies,
18
+ config,
19
+ resolveConfig,
28
20
  };
@@ -1,9 +1,10 @@
1
- import type { IsPluginEnabledCallback, GenericPluginCallback } from '../../types/plugins.js';
1
+ import type { ResolveConfig, IsPluginEnabled } from '#p/types/plugins.js';
2
+ import type { CSpellConfig } from './types.js';
2
3
  declare const _default: {
3
- NAME: string;
4
- ENABLERS: string[];
5
- isEnabled: IsPluginEnabledCallback;
6
- CONFIG_FILE_PATTERNS: string[];
7
- findDependencies: GenericPluginCallback;
4
+ readonly title: "CSpell";
5
+ readonly enablers: string[];
6
+ readonly isEnabled: IsPluginEnabled;
7
+ readonly config: string[];
8
+ readonly resolveConfig: ResolveConfig<CSpellConfig>;
8
9
  };
9
10
  export default _default;
@@ -1,28 +1,20 @@
1
- import { timerify } from '../../util/Performance.js';
2
- import { hasDependency, load } from '../../util/plugin.js';
3
- const NAME = 'cspell';
4
- const ENABLERS = ['cspell'];
5
- const isEnabled = ({ dependencies }) => hasDependency(dependencies, ENABLERS);
6
- const CONFIG_FILE_PATTERNS = [
1
+ import { hasDependency } from '#p/util/plugin.js';
2
+ const title = 'CSpell';
3
+ const enablers = ['cspell'];
4
+ const isEnabled = ({ dependencies }) => hasDependency(dependencies, enablers);
5
+ const config = [
7
6
  'cspell.config.{js,cjs,json,yaml,yml}',
8
7
  'cspell.{json,yaml,yml}',
9
8
  '.c{s,S}pell.json',
10
- 'cSpell.json',
9
+ 'c{s,S}pell.json',
11
10
  ];
12
- const findCspellDependencies = async (configFilePath, { isProduction }) => {
13
- if (isProduction)
14
- return [];
15
- const localConfig = await load(configFilePath);
16
- if (!localConfig)
17
- return [];
18
- const imports = localConfig.import ?? [];
19
- return imports;
11
+ const resolveConfig = config => {
12
+ return config.import ?? [];
20
13
  };
21
- const findDependencies = timerify(findCspellDependencies);
22
14
  export default {
23
- NAME,
24
- ENABLERS,
15
+ title,
16
+ enablers,
25
17
  isEnabled,
26
- CONFIG_FILE_PATTERNS,
27
- findDependencies,
18
+ config,
19
+ resolveConfig,
28
20
  };
@@ -1,10 +1,10 @@
1
- import type { GenericPluginCallback, IsPluginEnabledCallback } from '../../types/plugins.js';
1
+ import type { IsPluginEnabled, ResolveEntryPaths } from '#p/types/plugins.js';
2
2
  declare const _default: {
3
- NAME: string;
4
- ENABLERS: string[];
5
- isEnabled: IsPluginEnabledCallback;
6
- CONFIG_FILE_PATTERNS: string[];
7
- ENTRY_FILE_PATTERNS: string[];
8
- findDependencies: GenericPluginCallback;
3
+ title: string;
4
+ enablers: string[];
5
+ isEnabled: IsPluginEnabled;
6
+ config: string[];
7
+ entry: string[];
8
+ resolveEntryPaths: ResolveEntryPaths;
9
9
  };
10
10
  export default _default;