knip 5.55.1 → 5.57.0

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 (71) hide show
  1. package/README.md +44 -20
  2. package/dist/CacheConsultant.d.ts +1 -0
  3. package/dist/CacheConsultant.js +1 -1
  4. package/dist/ConfigurationChief.d.ts +5 -0
  5. package/dist/DependencyDeputy.d.ts +2 -0
  6. package/dist/DependencyDeputy.js +6 -0
  7. package/dist/PrincipalFactory.d.ts +2 -9
  8. package/dist/PrincipalFactory.js +10 -6
  9. package/dist/ProjectPrincipal.d.ts +1 -1
  10. package/dist/ProjectPrincipal.js +3 -3
  11. package/dist/WorkspaceWorker.js +1 -1
  12. package/dist/cli.js +6 -5
  13. package/dist/compilers/index.d.ts +50 -0
  14. package/dist/graph/build.js +11 -2
  15. package/dist/plugins/changelogen/index.d.ts +9 -0
  16. package/dist/plugins/changelogen/index.js +14 -0
  17. package/dist/plugins/changelogithub/index.d.ts +9 -0
  18. package/dist/plugins/changelogithub/index.js +14 -0
  19. package/dist/plugins/convex/index.d.ts +8 -0
  20. package/dist/plugins/convex/index.js +11 -0
  21. package/dist/plugins/docusaurus/helpers.d.ts +5 -0
  22. package/dist/plugins/docusaurus/helpers.js +89 -0
  23. package/dist/plugins/docusaurus/index.d.ts +12 -0
  24. package/dist/plugins/docusaurus/index.js +36 -0
  25. package/dist/plugins/docusaurus/types.d.ts +40 -0
  26. package/dist/plugins/docusaurus/types.js +1 -0
  27. package/dist/plugins/hardhat/index.d.ts +9 -0
  28. package/dist/plugins/hardhat/index.js +16 -0
  29. package/dist/plugins/index.d.ts +40 -0
  30. package/dist/plugins/index.js +10 -0
  31. package/dist/plugins/mocha/index.js +5 -2
  32. package/dist/plugins/nx/index.js +1 -1
  33. package/dist/plugins/nx/types.d.ts +3 -1
  34. package/dist/plugins/tsx/index.d.ts +6 -0
  35. package/dist/plugins/tsx/index.js +24 -0
  36. package/dist/reporters/codeclimate.js +3 -3
  37. package/dist/reporters/codeowners.js +15 -30
  38. package/dist/reporters/compact.js +10 -4
  39. package/dist/reporters/disclosure.js +5 -24
  40. package/dist/reporters/markdown.js +2 -2
  41. package/dist/reporters/symbols.d.ts +1 -1
  42. package/dist/reporters/symbols.js +10 -45
  43. package/dist/reporters/util.d.ts +11 -7
  44. package/dist/reporters/util.js +45 -14
  45. package/dist/reporters/watch.js +7 -21
  46. package/dist/schema/configuration.d.ts +280 -0
  47. package/dist/schema/plugins.d.ts +115 -0
  48. package/dist/schema/plugins.js +5 -0
  49. package/dist/types/PluginNames.d.ts +2 -2
  50. package/dist/types/PluginNames.js +5 -0
  51. package/dist/types/project.d.ts +1 -0
  52. package/dist/typescript/resolve-module-names.js +2 -2
  53. package/dist/util/Performance.d.ts +7 -7
  54. package/dist/util/Performance.js +20 -16
  55. package/dist/util/cli-arguments.d.ts +2 -1
  56. package/dist/util/cli-arguments.js +2 -0
  57. package/dist/util/input.d.ts +8 -1
  58. package/dist/util/input.js +6 -0
  59. package/dist/util/math.js +1 -1
  60. package/dist/util/plugin-config.d.ts +8 -0
  61. package/dist/util/plugin-config.js +1 -0
  62. package/dist/util/resolve.d.ts +3 -1
  63. package/dist/util/resolve.js +7 -9
  64. package/dist/util/table.d.ts +4 -2
  65. package/dist/util/table.js +20 -24
  66. package/dist/util/watch.js +2 -2
  67. package/dist/version.d.ts +1 -1
  68. package/dist/version.js +1 -1
  69. package/package.json +2 -2
  70. package/schema.json +20 -0
  71. package/license +0 -12
package/README.md CHANGED
@@ -1,17 +1,15 @@
1
1
  <h1 align="center">
2
- <br>
2
+ <br />
3
3
  <a href="https://knip.dev">
4
4
  <img height="200" width="200" src="https://knip.dev/favicon.svg" alt="Knip" />
5
5
  </a>
6
- <br>
7
- <br>
6
+ <br />
7
+ <br />
8
8
  </h1>
9
9
 
10
10
  <div align="center">
11
11
 
12
- [![NPM Version](https://img.shields.io/npm/v/knip?color=f56e0f)][1]
13
- [![NPM Downloads](https://img.shields.io/npm/dm/knip?color=f56e0f)][1]
14
- [![GitHub Repo stars](https://img.shields.io/github/stars/webpro-nl/knip?style=flat-square&color=f56e0f)][2]
12
+ [![NPM Version][2]][1] [![NPM Downloads][3]][1] [![GitHub Repo stars][5]][4]
15
13
 
16
14
  </div>
17
15
 
@@ -19,26 +17,52 @@ Knip finds and fixes **unused dependencies, exports and files** in your
19
17
  JavaScript and TypeScript projects. Less code and dependencies lead to improved
20
18
  performance, less maintenance and easier refactorings.
21
19
 
22
- - Website: [knip.dev][3]
23
- - GitHub repo: [webpro-nl/knip][2]
20
+ - Website: [knip.dev][6]
21
+ - GitHub repo: [webpro-nl/knip][4]
24
22
  - npm package: [knip][1]
25
- - [Discord][4]
26
- - [Contributing Guide][5]
27
- - [Sponsor Knip!][6]
23
+ - [Discord][7]
24
+ - [Contributing Guide][8]
25
+ - [Sponsor Knip!][9]
28
26
 
29
27
  ## Contributors
30
28
 
31
- Special thanks to [the wonderful people who have contributed to Knip][8]!
29
+ Special thanks to [the wonderful people who have contributed to Knip][10]!
32
30
 
33
31
  ## Knip
34
32
 
35
- /'knɪp/ means "(to) cut" and is [pronounced with a hard "K"][7] 🇳🇱
33
+ /'knɪp/ means "(to) cut" and is [pronounced with a hard "K"][11] 🇳🇱
34
+
35
+ ## License
36
+
37
+ Knip is free and open-source software licensed under the [ISC License][12].
38
+
39
+ Parts of Knip have been inspired by and/or partially copy code from the
40
+ following projects:
41
+
42
+ - [@npmcli/package-json][17] ([ISC][18])
43
+ - [@pnpm/deps.graph-sequencer][15] ([MIT][16])
44
+ - [file-entry-cache][13] ([MIT][14])
45
+ - [json-parse-even-better-errors][19] ([MIT][20])
36
46
 
37
47
  [1]: https://www.npmjs.com/package/knip
38
- [2]: https://github.com/webpro-nl/knip
39
- [3]: https://knip.dev
40
- [4]: https://discord.gg/r5uXTtbTpc
41
- [5]: https://github.com/webpro-nl/knip/blob/main/.github/CONTRIBUTING.md
42
- [6]: https://knip.dev/sponsors
43
- [7]: https://www.youtube.com/watch?v=PE7h7KvQoUI&t=9s
44
- [8]: https://knip.dev/#-contributors
48
+ [2]: https://img.shields.io/npm/v/knip?color=f56e0f
49
+ [3]: https://img.shields.io/npm/dm/knip?color=f56e0f
50
+ [4]: https://github.com/webpro-nl/knip
51
+ [5]:
52
+ https://img.shields.io/github/stars/webpro-nl/knip?style=flat-square&color=f56e0f
53
+ [6]: https://knip.dev
54
+ [7]: https://discord.gg/r5uXTtbTpc
55
+ [8]: https://github.com/webpro-nl/knip/blob/main/.github/CONTRIBUTING.md
56
+ [9]: https://knip.dev/sponsors
57
+ [10]: https://knip.dev/#created-by-awesome-contributors
58
+ [11]: https://www.youtube.com/watch?v=PE7h7KvQoUI&t=9s
59
+ [12]: ./license
60
+ [13]: https://github.com/jaredwray/cacheable/tree/main/packages/file-entry-cache
61
+ [14]:
62
+ https://github.com/jaredwray/cacheable/blob/main/packages/file-entry-cache/LICENSE
63
+ [15]: https://github.com/pnpm/pnpm/tree/main/deps/graph-sequencer
64
+ [16]: https://github.com/pnpm/pnpm/blob/main/LICENSE
65
+ [17]: https://github.com/npm/package-json
66
+ [18]: https://github.com/npm/package-json/blob/main/LICENSE
67
+ [19]: https://github.com/npm/json-parse-even-better-errors
68
+ [20]: https://github.com/npm/json-parse-even-better-errors/blob/main/LICENSE.md
@@ -3,6 +3,7 @@ type CacheOptions = {
3
3
  name: string;
4
4
  isEnabled: boolean;
5
5
  cacheLocation: string;
6
+ isProduction: boolean;
6
7
  };
7
8
  export declare class CacheConsultant<T> {
8
9
  private isEnabled;
@@ -8,7 +8,7 @@ export class CacheConsultant {
8
8
  constructor(options) {
9
9
  this.isEnabled = options.isEnabled;
10
10
  if (this.isEnabled) {
11
- const cacheName = `${options.name.replace(/[^a-z0-9]/g, '-').replace(/-*$/, '')}-${version}`;
11
+ const cacheName = `${options.name.replace(/[^a-z0-9]/g, '-').replace(/-*$/, '')}-${options.isProduction ? '-prod' : ''}-${version}`;
12
12
  this.cache = new FileEntryCache(cacheName, options.cacheLocation);
13
13
  this.reconcile = timerify(this.cache.reconcile).bind(this.cache);
14
14
  this.getFileDescriptor = timerify(this.cache.getFileDescriptor).bind(this.cache);
@@ -80,14 +80,18 @@ export declare class ConfigurationChief {
80
80
  bun?: (boolean | import("./types/config.js").EnsuredPluginConfiguration) | undefined;
81
81
  c8?: (boolean | import("./types/config.js").EnsuredPluginConfiguration) | undefined;
82
82
  capacitor?: (boolean | import("./types/config.js").EnsuredPluginConfiguration) | undefined;
83
+ changelogen?: (boolean | import("./types/config.js").EnsuredPluginConfiguration) | undefined;
84
+ changelogithub?: (boolean | import("./types/config.js").EnsuredPluginConfiguration) | undefined;
83
85
  changesets?: (boolean | import("./types/config.js").EnsuredPluginConfiguration) | undefined;
84
86
  commitizen?: (boolean | import("./types/config.js").EnsuredPluginConfiguration) | undefined;
85
87
  commitlint?: (boolean | import("./types/config.js").EnsuredPluginConfiguration) | undefined;
88
+ convex?: (boolean | import("./types/config.js").EnsuredPluginConfiguration) | undefined;
86
89
  "create-typescript-app"?: (boolean | import("./types/config.js").EnsuredPluginConfiguration) | undefined;
87
90
  cspell?: (boolean | import("./types/config.js").EnsuredPluginConfiguration) | undefined;
88
91
  cucumber?: (boolean | import("./types/config.js").EnsuredPluginConfiguration) | undefined;
89
92
  cypress?: (boolean | import("./types/config.js").EnsuredPluginConfiguration) | undefined;
90
93
  "dependency-cruiser"?: (boolean | import("./types/config.js").EnsuredPluginConfiguration) | undefined;
94
+ docusaurus?: (boolean | import("./types/config.js").EnsuredPluginConfiguration) | undefined;
91
95
  dotenv?: (boolean | import("./types/config.js").EnsuredPluginConfiguration) | undefined;
92
96
  drizzle?: (boolean | import("./types/config.js").EnsuredPluginConfiguration) | undefined;
93
97
  eleventy?: (boolean | import("./types/config.js").EnsuredPluginConfiguration) | undefined;
@@ -98,6 +102,7 @@ export declare class ConfigurationChief {
98
102
  "github-actions"?: (boolean | import("./types/config.js").EnsuredPluginConfiguration) | undefined;
99
103
  glob?: (boolean | import("./types/config.js").EnsuredPluginConfiguration) | undefined;
100
104
  "graphql-codegen"?: (boolean | import("./types/config.js").EnsuredPluginConfiguration) | undefined;
105
+ hardhat?: (boolean | import("./types/config.js").EnsuredPluginConfiguration) | undefined;
101
106
  husky?: (boolean | import("./types/config.js").EnsuredPluginConfiguration) | undefined;
102
107
  "i18next-parser"?: (boolean | import("./types/config.js").EnsuredPluginConfiguration) | undefined;
103
108
  jest?: (boolean | import("./types/config.js").EnsuredPluginConfiguration) | undefined;
@@ -74,5 +74,7 @@ export declare class DependencyDeputy {
74
74
  counters: Counters;
75
75
  }): void;
76
76
  getConfigurationHints(): ConfigurationHints;
77
+ addIgnoredDependencies(workspaceName: string, identifier: string): void;
78
+ addIgnoredBinaries(workspaceName: string, identifier: string): void;
77
79
  }
78
80
  export {};
@@ -350,4 +350,10 @@ export class DependencyDeputy {
350
350
  }
351
351
  return configurationHints;
352
352
  }
353
+ addIgnoredDependencies(workspaceName, identifier) {
354
+ this._manifests.get(workspaceName)?.ignoreDependencies.push(toRegexOrString(identifier));
355
+ }
356
+ addIgnoredBinaries(workspaceName, identifier) {
357
+ this._manifests.get(workspaceName)?.ignoreBinaries.push(toRegexOrString(identifier));
358
+ }
353
359
  }
@@ -1,14 +1,8 @@
1
1
  import { ProjectPrincipal } from './ProjectPrincipal.js';
2
2
  import type { PrincipalOptions } from './types/project.js';
3
- type Principal = {
4
- principal: ProjectPrincipal;
5
- wsDirs: Set<string>;
6
- pathKeys: Set<string>;
7
- pkgNames: Set<string>;
8
- };
9
- type Principals = Set<Principal>;
10
3
  export declare class PrincipalFactory {
11
- principals: Principals;
4
+ private principals;
5
+ getPrincipalCount(): number;
12
6
  createPrincipal(options: PrincipalOptions): ProjectPrincipal;
13
7
  private findReusablePrincipal;
14
8
  private linkPrincipal;
@@ -17,4 +11,3 @@ export declare class PrincipalFactory {
17
11
  getPrincipalByPackageName(packageName: string): ProjectPrincipal | undefined;
18
12
  deletePrincipal(principal: ProjectPrincipal): void;
19
13
  }
20
- export {};
@@ -4,20 +4,25 @@ import { debugLog } from './util/debug.js';
4
4
  import { toRelative } from './util/path.js';
5
5
  export class PrincipalFactory {
6
6
  principals = new Set();
7
+ getPrincipalCount() {
8
+ return this.principals.size;
9
+ }
7
10
  createPrincipal(options) {
8
11
  const { cwd, compilerOptions, isFile, pkgName, isIsolateWorkspaces, compilers } = options;
9
12
  if (isFile && compilerOptions.module !== ts.ModuleKind.CommonJS)
10
13
  compilerOptions.moduleResolution ??= ts.ModuleResolutionKind.Bundler;
11
- const principal = this.findReusablePrincipal(compilerOptions);
12
- if (!isIsolateWorkspaces && principal) {
13
- this.linkPrincipal(principal, cwd, compilerOptions, pkgName, compilers);
14
- return principal.principal;
14
+ if (!isIsolateWorkspaces) {
15
+ const principal = this.findReusablePrincipal(compilerOptions);
16
+ if (principal) {
17
+ this.linkPrincipal(principal, cwd, compilerOptions, pkgName, compilers);
18
+ return principal.principal;
19
+ }
15
20
  }
16
21
  return this.addNewPrincipal(options);
17
22
  }
18
23
  findReusablePrincipal(compilerOptions) {
19
24
  const workspacePaths = compilerOptions?.paths ? Object.keys(compilerOptions.paths) : [];
20
- const principal = Array.from(this.principals).find(principal => {
25
+ return Array.from(this.principals).find(principal => {
21
26
  if (compilerOptions.pathsBasePath && principal.principal.compilerOptions.pathsBasePath)
22
27
  return false;
23
28
  if (compilerOptions.baseUrl === principal.principal.compilerOptions.baseUrl) {
@@ -25,7 +30,6 @@ export class PrincipalFactory {
25
30
  }
26
31
  return !compilerOptions.baseUrl;
27
32
  });
28
- return principal;
29
33
  }
30
34
  linkPrincipal(principal, cwd, compilerOptions, pkgName, compilers) {
31
35
  const { pathsBasePath, paths } = compilerOptions;
@@ -30,7 +30,7 @@ export declare class ProjectPrincipal {
30
30
  languageServiceHost: ts.LanguageServiceHost;
31
31
  };
32
32
  findReferences?: ts.LanguageService['findReferences'];
33
- constructor({ compilerOptions, cwd, compilers, isSkipLibs, isWatch, pkgName, toSourceFilePath, isCache, cacheLocation, }: PrincipalOptions);
33
+ constructor({ compilerOptions, cwd, compilers, isSkipLibs, isWatch, pkgName, toSourceFilePath, isCache, cacheLocation, isProduction, }: PrincipalOptions);
34
34
  init(): void;
35
35
  addPaths(paths: Paths, basePath: string): void;
36
36
  addCompilers(compilers: [SyncCompilers, AsyncCompilers]): void;
@@ -43,7 +43,7 @@ export class ProjectPrincipal {
43
43
  toSourceFilePath;
44
44
  backend;
45
45
  findReferences;
46
- constructor({ compilerOptions, cwd, compilers, isSkipLibs, isWatch, pkgName, toSourceFilePath, isCache, cacheLocation, }) {
46
+ constructor({ compilerOptions, cwd, compilers, isSkipLibs, isWatch, pkgName, toSourceFilePath, isCache, cacheLocation, isProduction, }) {
47
47
  this.cwd = cwd;
48
48
  this.compilerOptions = {
49
49
  ...compilerOptions,
@@ -57,7 +57,7 @@ export class ProjectPrincipal {
57
57
  this.asyncCompilers = asyncCompilers;
58
58
  this.isSkipLibs = isSkipLibs;
59
59
  this.isWatch = isWatch;
60
- this.cache = new CacheConsultant({ name: pkgName || ANONYMOUS, isEnabled: isCache, cacheLocation });
60
+ this.cache = new CacheConsultant({ name: pkgName || ANONYMOUS, isEnabled: isCache, cacheLocation, isProduction });
61
61
  this.toSourceFilePath = toSourceFilePath;
62
62
  this.backend = {
63
63
  fileManager: new SourceFileManager({ compilers, isSkipLibs }),
@@ -162,7 +162,7 @@ export class ProjectPrincipal {
162
162
  return fd.meta.data;
163
163
  const typeChecker = this.backend.typeChecker;
164
164
  if (!typeChecker)
165
- throw new Error('Must initialize TypeChecker before source file analysis');
165
+ throw new Error('TypeChecker must be initialized before source file analysis');
166
166
  const sourceFile = this.backend.fileManager.getSourceFile(filePath);
167
167
  if (!sourceFile)
168
168
  throw new Error(`Unable to find ${filePath}`);
@@ -49,7 +49,7 @@ export class WorkspaceWorker {
49
49
  this.getReferencedInternalFilePath = getReferencedInternalFilePath;
50
50
  this.findWorkspaceByFilePath = findWorkspaceByFilePath;
51
51
  this.getSourceFile = getSourceFile;
52
- this.cache = new CacheConsultant({ name: `plugins-${name}`, isEnabled: isCache, cacheLocation });
52
+ this.cache = new CacheConsultant({ name: `plugins-${name}`, isEnabled: isCache, cacheLocation, isProduction });
53
53
  }
54
54
  async init() {
55
55
  this.enabledPlugins = await this.determineEnabledPlugins();
package/dist/cli.js CHANGED
@@ -10,7 +10,7 @@ import { splitTags } from './util/tag.js';
10
10
  import { isTrace } from './util/trace.js';
11
11
  import { version } from './version.js';
12
12
  const defaultCacheLocation = join(cwd, 'node_modules', '.cache', 'knip');
13
- const { 'allow-remove-files': isRemoveFiles = false, cache: isCache = false, 'cache-location': cacheLocation = defaultCacheLocation, debug: isDebug = false, dependencies: isDependenciesShorthand = false, exclude: excludedIssueTypes = [], 'experimental-tags': experimentalTags = [], exports: isExportsShorthand = false, files: isFilesShorthand = false, fix: isFix = false, format: isFormat = false, 'fix-type': fixTypes = [], help: isHelp, include: includedIssueTypes = [], 'include-entry-exports': isIncludeEntryExports = false, 'include-libs': isIncludeLibs = false, 'isolate-workspaces': isIsolateWorkspaces = false, 'max-issues': maxIssues = '0', 'no-config-hints': isDisableConfigHints = false, 'no-exit-code': noExitCode = false, 'no-gitignore': isNoGitIgnore = false, 'no-progress': isNoProgress = isDebug || isTrace, preprocessor = [], 'preprocessor-options': preprocessorOptions = '', production: isProduction = false, reporter = ['symbols'], 'reporter-options': reporterOptions = '', strict: isStrict = false, tags = [], 'treat-config-hints-as-errors': treatConfigHintsAsErrors = false, tsConfig, version: isVersion, watch: isWatch = false, workspace: rawWorkspaceArg, } = parsedArgValues;
13
+ const { 'allow-remove-files': isRemoveFiles = false, cache: isCache = false, 'cache-location': cacheLocation = defaultCacheLocation, debug: isDebug = false, dependencies: isDependenciesShorthand = false, exclude: excludedIssueTypes = [], 'experimental-tags': experimentalTags = [], exports: isExportsShorthand = false, files: isFilesShorthand = false, fix: isFix = false, format: isFormat = false, 'fix-type': fixTypes = [], help: isHelp, include: includedIssueTypes = [], 'include-entry-exports': isIncludeEntryExports = false, 'include-libs': isIncludeLibs = false, 'isolate-workspaces': isIsolateWorkspaces = false, 'max-issues': maxIssues = '0', 'memory-realtime': memoryRealtime = false, 'no-config-hints': isDisableConfigHints = false, 'no-exit-code': noExitCode = false, 'no-gitignore': isNoGitIgnore = false, 'no-progress': isNoProgress = isDebug || isTrace || memoryRealtime, preprocessor = [], 'preprocessor-options': preprocessorOptions = '', production: isProduction = false, reporter = ['symbols'], 'reporter-options': reporterOptions = '', strict: isStrict = false, tags = [], 'treat-config-hints-as-errors': treatConfigHintsAsErrors = false, tsConfig, version: isVersion, watch: isWatch = false, workspace: rawWorkspaceArg, } = parsedArgValues;
14
14
  if (isHelp) {
15
15
  console.log(helpText);
16
16
  process.exit(0);
@@ -73,10 +73,10 @@ const run = async () => {
73
73
  .reduce((errorCount, reportGroup) => errorCount + finalData.counters[reportGroup], 0);
74
74
  if (perfObserver.isEnabled)
75
75
  await perfObserver.finalize();
76
- if (perfObserver.isPerformanceEnabled)
77
- console.log(`\n${perfObserver.getPerformanceTable()}`);
78
- if (perfObserver.isMemoryEnabled)
79
- console.log(`\n${perfObserver.getMemoryTable()}`);
76
+ if (perfObserver.isTimerifyFunctions)
77
+ console.log(`\n${perfObserver.getTimerifiedFunctionsTable()}`);
78
+ if (perfObserver.isMemoryUsageEnabled && !memoryRealtime)
79
+ console.log(`\n${perfObserver.getMemoryUsageTable()}`);
80
80
  if (perfObserver.isEnabled) {
81
81
  const duration = perfObserver.getCurrentDurationInMs();
82
82
  console.log('\nTotal running time:', prettyMilliseconds(duration));
@@ -106,5 +106,6 @@ const run = async () => {
106
106
  }
107
107
  throw error;
108
108
  }
109
+ process.exit(0);
109
110
  };
110
111
  await run();
@@ -49,6 +49,16 @@ export declare const partitionCompilers: (rawLocalConfig: RawConfiguration) => {
49
49
  entry?: string | string[] | undefined;
50
50
  project?: string | string[] | undefined;
51
51
  } | undefined;
52
+ changelogen?: string | boolean | string[] | {
53
+ config?: string | string[] | undefined;
54
+ entry?: string | string[] | undefined;
55
+ project?: string | string[] | undefined;
56
+ } | undefined;
57
+ changelogithub?: string | boolean | string[] | {
58
+ config?: string | string[] | undefined;
59
+ entry?: string | string[] | undefined;
60
+ project?: string | string[] | undefined;
61
+ } | undefined;
52
62
  changesets?: string | boolean | string[] | {
53
63
  config?: string | string[] | undefined;
54
64
  entry?: string | string[] | undefined;
@@ -64,6 +74,11 @@ export declare const partitionCompilers: (rawLocalConfig: RawConfiguration) => {
64
74
  entry?: string | string[] | undefined;
65
75
  project?: string | string[] | undefined;
66
76
  } | undefined;
77
+ convex?: string | boolean | string[] | {
78
+ config?: string | string[] | undefined;
79
+ entry?: string | string[] | undefined;
80
+ project?: string | string[] | undefined;
81
+ } | undefined;
67
82
  'create-typescript-app'?: string | boolean | string[] | {
68
83
  config?: string | string[] | undefined;
69
84
  entry?: string | string[] | undefined;
@@ -89,6 +104,11 @@ export declare const partitionCompilers: (rawLocalConfig: RawConfiguration) => {
89
104
  entry?: string | string[] | undefined;
90
105
  project?: string | string[] | undefined;
91
106
  } | undefined;
107
+ docusaurus?: string | boolean | string[] | {
108
+ config?: string | string[] | undefined;
109
+ entry?: string | string[] | undefined;
110
+ project?: string | string[] | undefined;
111
+ } | undefined;
92
112
  dotenv?: string | boolean | string[] | {
93
113
  config?: string | string[] | undefined;
94
114
  entry?: string | string[] | undefined;
@@ -139,6 +159,11 @@ export declare const partitionCompilers: (rawLocalConfig: RawConfiguration) => {
139
159
  entry?: string | string[] | undefined;
140
160
  project?: string | string[] | undefined;
141
161
  } | undefined;
162
+ hardhat?: string | boolean | string[] | {
163
+ config?: string | string[] | undefined;
164
+ entry?: string | string[] | undefined;
165
+ project?: string | string[] | undefined;
166
+ } | undefined;
142
167
  husky?: string | boolean | string[] | {
143
168
  config?: string | string[] | undefined;
144
169
  entry?: string | string[] | undefined;
@@ -575,6 +600,16 @@ export declare const partitionCompilers: (rawLocalConfig: RawConfiguration) => {
575
600
  entry?: string | string[] | undefined;
576
601
  project?: string | string[] | undefined;
577
602
  } | undefined;
603
+ changelogen?: string | boolean | string[] | {
604
+ config?: string | string[] | undefined;
605
+ entry?: string | string[] | undefined;
606
+ project?: string | string[] | undefined;
607
+ } | undefined;
608
+ changelogithub?: string | boolean | string[] | {
609
+ config?: string | string[] | undefined;
610
+ entry?: string | string[] | undefined;
611
+ project?: string | string[] | undefined;
612
+ } | undefined;
578
613
  changesets?: string | boolean | string[] | {
579
614
  config?: string | string[] | undefined;
580
615
  entry?: string | string[] | undefined;
@@ -590,6 +625,11 @@ export declare const partitionCompilers: (rawLocalConfig: RawConfiguration) => {
590
625
  entry?: string | string[] | undefined;
591
626
  project?: string | string[] | undefined;
592
627
  } | undefined;
628
+ convex?: string | boolean | string[] | {
629
+ config?: string | string[] | undefined;
630
+ entry?: string | string[] | undefined;
631
+ project?: string | string[] | undefined;
632
+ } | undefined;
593
633
  'create-typescript-app'?: string | boolean | string[] | {
594
634
  config?: string | string[] | undefined;
595
635
  entry?: string | string[] | undefined;
@@ -615,6 +655,11 @@ export declare const partitionCompilers: (rawLocalConfig: RawConfiguration) => {
615
655
  entry?: string | string[] | undefined;
616
656
  project?: string | string[] | undefined;
617
657
  } | undefined;
658
+ docusaurus?: string | boolean | string[] | {
659
+ config?: string | string[] | undefined;
660
+ entry?: string | string[] | undefined;
661
+ project?: string | string[] | undefined;
662
+ } | undefined;
618
663
  dotenv?: string | boolean | string[] | {
619
664
  config?: string | string[] | undefined;
620
665
  entry?: string | string[] | undefined;
@@ -665,6 +710,11 @@ export declare const partitionCompilers: (rawLocalConfig: RawConfiguration) => {
665
710
  entry?: string | string[] | undefined;
666
711
  project?: string | string[] | undefined;
667
712
  } | undefined;
713
+ hardhat?: string | boolean | string[] | {
714
+ config?: string | string[] | undefined;
715
+ entry?: string | string[] | undefined;
716
+ project?: string | string[] | undefined;
717
+ } | undefined;
668
718
  husky?: string | boolean | string[] | {
669
719
  config?: string | string[] | undefined;
670
720
  entry?: string | string[] | undefined;
@@ -6,7 +6,7 @@ import { perfObserver } from '../util/Performance.js';
6
6
  import { debugLog, debugLogArray } from '../util/debug.js';
7
7
  import { getReferencedInputsHandler } from '../util/get-referenced-inputs.js';
8
8
  import { _glob, negate } from '../util/glob.js';
9
- import { isAlias, isConfig, isDeferResolveEntry, isDeferResolveProductionEntry, isEntry, isProductionEntry, isProject, toProductionEntry, } from '../util/input.js';
9
+ import { isAlias, isConfig, isDeferResolveEntry, isDeferResolveProductionEntry, isEntry, isIgnore, isProductionEntry, isProject, toProductionEntry, } from '../util/input.js';
10
10
  import { getOrCreateFileNode, updateImportMap } from '../util/module-graph.js';
11
11
  import { getEntryPathsFromManifest } from '../util/package-json.js';
12
12
  import { dirname, isAbsolute, join, relative, toRelative } from '../util/path.js';
@@ -89,6 +89,7 @@ export async function build({ cacheLocation, chief, collector, cwd, deputy, fact
89
89
  toSourceFilePath,
90
90
  isCache,
91
91
  cacheLocation,
92
+ isProduction,
92
93
  });
93
94
  principal.addPaths(config.paths, dir);
94
95
  const inputsFromPlugins = await worker.runPlugins();
@@ -126,6 +127,14 @@ export async function build({ cacheLocation, chief, collector, cwd, deputy, fact
126
127
  else if (isAlias(input)) {
127
128
  principal.addPaths({ [input.specifier]: input.prefixes }, input.dir ?? dir);
128
129
  }
130
+ else if (isIgnore(input)) {
131
+ if (input.issueType === 'dependencies' || input.issueType === 'unlisted') {
132
+ deputy.addIgnoredDependencies(name, input.specifier);
133
+ }
134
+ else if (input.issueType === 'binaries') {
135
+ deputy.addIgnoredBinaries(name, input.specifier);
136
+ }
137
+ }
129
138
  else if (!isConfig(input)) {
130
139
  const ws = (input.containingFilePath && chief.findWorkspaceByFilePath(input.containingFilePath)) || workspace;
131
140
  const resolvedFilePath = getReferencedInternalFilePath(input, ws);
@@ -299,7 +308,7 @@ export async function build({ cacheLocation, chief, collector, cwd, deputy, fact
299
308
  factory.deletePrincipal(principal);
300
309
  principals[i] = undefined;
301
310
  }
302
- perfObserver.addMemoryMark(factory.principals.size);
311
+ perfObserver.addMemoryMark(factory.getPrincipalCount());
303
312
  }
304
313
  if (!isWatch && isSkipLibs && !isIsolateWorkspaces) {
305
314
  for (const principal of principals) {
@@ -0,0 +1,9 @@
1
+ import type { IsPluginEnabled } from '../../types/config.js';
2
+ declare const _default: {
3
+ title: string;
4
+ enablers: string[];
5
+ isEnabled: IsPluginEnabled;
6
+ isRootOnly: true;
7
+ entry: string[];
8
+ };
9
+ export default _default;
@@ -0,0 +1,14 @@
1
+ import { toC12config } from '../../util/plugin-config.js';
2
+ import { hasDependency } from '../../util/plugin.js';
3
+ const title = 'Changelogen';
4
+ const enablers = ['changelogen'];
5
+ const isEnabled = ({ dependencies }) => hasDependency(dependencies, enablers);
6
+ const entry = ['package.json', ...toC12config('changelog')];
7
+ const isRootOnly = true;
8
+ export default {
9
+ title,
10
+ enablers,
11
+ isEnabled,
12
+ isRootOnly,
13
+ entry,
14
+ };
@@ -0,0 +1,9 @@
1
+ import type { IsPluginEnabled } from '../../types/config.js';
2
+ declare const _default: {
3
+ title: string;
4
+ enablers: string[];
5
+ isEnabled: IsPluginEnabled;
6
+ isRootOnly: true;
7
+ entry: string[];
8
+ };
9
+ export default _default;
@@ -0,0 +1,14 @@
1
+ import { toC12config } from '../../util/plugin-config.js';
2
+ import { hasDependency } from '../../util/plugin.js';
3
+ const title = 'Changelogithub';
4
+ const enablers = ['changelogithub'];
5
+ const isEnabled = ({ dependencies }) => hasDependency(dependencies, enablers);
6
+ const entry = ['package.json', ...toC12config('changelogithub')];
7
+ const isRootOnly = true;
8
+ export default {
9
+ title,
10
+ enablers,
11
+ isEnabled,
12
+ isRootOnly,
13
+ entry,
14
+ };
@@ -0,0 +1,8 @@
1
+ import type { IsPluginEnabled } from '../../types/config.js';
2
+ declare const _default: {
3
+ title: string;
4
+ enablers: string[];
5
+ isEnabled: IsPluginEnabled;
6
+ entry: string[];
7
+ };
8
+ export default _default;
@@ -0,0 +1,11 @@
1
+ import { hasDependency } from '../../util/plugin.js';
2
+ const title = 'Convex';
3
+ const enablers = ['convex'];
4
+ const isEnabled = ({ dependencies }) => hasDependency(dependencies, enablers);
5
+ const entry = ['convex/*.config.@(js|ts)', 'convex/_generated/*.@(js|ts)'];
6
+ export default {
7
+ title,
8
+ enablers,
9
+ isEnabled,
10
+ entry,
11
+ };
@@ -0,0 +1,5 @@
1
+ import type { PluginOptions as Options } from '../../types/config.js';
2
+ import { type Input } from '../../util/input.js';
3
+ import type { ConfigItem, ModuleType } from './types.js';
4
+ export declare const CORE_CLIENT_API: string[];
5
+ export declare const resolveConfigItems: (items: ConfigItem[], type: ModuleType, options: Options) => Promise<Set<Input>>;
@@ -0,0 +1,89 @@
1
+ import { toDeferResolve, toProductionEntry } from '../../util/input.js';
2
+ import { findWebpackDependenciesFromConfig } from '../webpack/index.js';
3
+ const FIRST_PARTY_MODULES = new Set([
4
+ 'content-docs',
5
+ 'content-blog',
6
+ 'content-pages',
7
+ 'debug',
8
+ 'sitemap',
9
+ 'svgr',
10
+ 'rsdoctor',
11
+ 'pwa',
12
+ 'client-redirects',
13
+ 'ideal-image',
14
+ 'google-analytics',
15
+ 'google-gtag',
16
+ 'google-tag-manager',
17
+ 'classic',
18
+ 'live-codeblock',
19
+ 'search-algolia',
20
+ 'mermaid',
21
+ ]);
22
+ export const CORE_CLIENT_API = [
23
+ 'BrowserOnly',
24
+ 'ComponentCreator',
25
+ 'constants',
26
+ 'ExecutionEnvironment',
27
+ 'Head',
28
+ 'Interpolate',
29
+ 'isInternalUrl',
30
+ 'Link',
31
+ 'Noop',
32
+ 'renderRoutes',
33
+ 'router',
34
+ 'Translate',
35
+ 'useBaseUrl',
36
+ 'useBrokenLinks',
37
+ 'useDocusaurusContext',
38
+ 'useGlobalData',
39
+ 'useIsBrowser',
40
+ 'useIsomorphicLayoutEffect',
41
+ 'useRouteContext',
42
+ ];
43
+ const resolveModuleName = (name, type) => {
44
+ if (name.includes(`${type}-`))
45
+ return name;
46
+ if (!name.startsWith('@')) {
47
+ const prefix = FIRST_PARTY_MODULES.has(name) ? '@docusaurus/' : 'docusaurus-';
48
+ return `${prefix}${type}-${name}`;
49
+ }
50
+ const [scope, ...rest] = name.split('/');
51
+ const baseName = rest.length ? `-${rest.join('/')}` : '';
52
+ return `${scope}/docusaurus-${type}${baseName}`;
53
+ };
54
+ const resolveSidebarPath = (config) => {
55
+ const path = config?.sidebarPath ?? config?.docs?.sidebarPath;
56
+ return typeof path === 'string' ? path : undefined;
57
+ };
58
+ const resolveArrayConfig = ([name, config], type) => {
59
+ if (typeof name !== 'string')
60
+ return [];
61
+ const resolvedName = resolveModuleName(name, type);
62
+ const sidebarPath = type !== 'theme' ? resolveSidebarPath(config) : undefined;
63
+ return [toDeferResolve(resolvedName), ...(sidebarPath ? [toProductionEntry(sidebarPath)] : [])];
64
+ };
65
+ export const resolveConfigItems = async (items, type, options) => {
66
+ const inputs = new Set();
67
+ for (let item of items) {
68
+ if (typeof item === 'function')
69
+ item = item();
70
+ if (!item)
71
+ continue;
72
+ if (typeof item === 'string') {
73
+ inputs.add(toDeferResolve(resolveModuleName(item, type)));
74
+ }
75
+ else if (Array.isArray(item)) {
76
+ for (const input of resolveArrayConfig(item, type))
77
+ inputs.add(input);
78
+ }
79
+ else if (typeof item.configureWebpack === 'function') {
80
+ const utils = { getStyleLoaders: () => [], getJSLoader: () => null };
81
+ const config = item.configureWebpack({}, false, utils);
82
+ for (const input of await findWebpackDependenciesFromConfig(config, options))
83
+ inputs.add(input);
84
+ }
85
+ else if (typeof item.configurePostCss === 'function') {
86
+ }
87
+ }
88
+ return inputs;
89
+ };
@@ -0,0 +1,12 @@
1
+ import type { IsPluginEnabled, ResolveConfig } from '../../types/config.js';
2
+ import type { DocusaurusConfig } from './types.js';
3
+ declare const _default: {
4
+ title: string;
5
+ enablers: string[];
6
+ isEnabled: IsPluginEnabled;
7
+ config: string[];
8
+ entry: string[];
9
+ production: string[];
10
+ resolveConfig: ResolveConfig<DocusaurusConfig>;
11
+ };
12
+ export default _default;