knip 5.33.3 → 5.34.1

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 (304) hide show
  1. package/dist/ConfigurationChief.d.ts +27 -27
  2. package/dist/ConfigurationChief.js +20 -36
  3. package/dist/ConfigurationValidator.d.ts +392 -0
  4. package/dist/ConfigurationValidator.js +7 -0
  5. package/dist/DependencyDeputy.js +5 -2
  6. package/dist/PrincipalFactory.d.ts +3 -20
  7. package/dist/PrincipalFactory.js +4 -4
  8. package/dist/ProjectPrincipal.d.ts +2 -5
  9. package/dist/ProjectPrincipal.js +0 -5
  10. package/dist/WorkspaceWorker.d.ts +15 -13
  11. package/dist/WorkspaceWorker.js +144 -105
  12. package/dist/binaries/bash-parser.d.ts +3 -2
  13. package/dist/binaries/bash-parser.js +33 -23
  14. package/dist/binaries/fallback.d.ts +2 -0
  15. package/dist/binaries/fallback.js +12 -0
  16. package/dist/binaries/index.d.ts +2 -2
  17. package/dist/binaries/index.js +17 -26
  18. package/dist/binaries/package-manager/bun.d.ts +2 -0
  19. package/dist/binaries/{resolvers → package-manager}/bun.js +6 -4
  20. package/dist/binaries/package-manager/index.d.ts +8 -0
  21. package/dist/binaries/package-manager/index.js +12 -0
  22. package/dist/binaries/package-manager/npm.d.ts +2 -0
  23. package/dist/binaries/package-manager/npm.js +8 -0
  24. package/dist/binaries/package-manager/npx.d.ts +2 -0
  25. package/dist/binaries/{resolvers → package-manager}/npx.js +6 -6
  26. package/dist/binaries/package-manager/pnpm.d.ts +2 -0
  27. package/dist/binaries/{resolvers → package-manager}/pnpm.js +6 -3
  28. package/dist/binaries/package-manager/yarn.d.ts +2 -0
  29. package/dist/binaries/{resolvers → package-manager}/yarn.js +9 -7
  30. package/dist/binaries/plugins.d.ts +2 -0
  31. package/dist/binaries/plugins.js +61 -0
  32. package/dist/binaries/util.d.ts +2 -2
  33. package/dist/binaries/util.js +5 -25
  34. package/dist/compilers/index.d.ts +70 -0
  35. package/dist/constants.d.ts +1 -0
  36. package/dist/constants.js +2 -1
  37. package/dist/index.js +74 -46
  38. package/dist/manifest/helpers.d.ts +1 -5
  39. package/dist/manifest/helpers.js +8 -7
  40. package/dist/plugins/_template/index.d.ts +2 -2
  41. package/dist/plugins/_template/index.js +4 -3
  42. package/dist/plugins/angular/index.d.ts +1 -1
  43. package/dist/plugins/angular/index.js +13 -10
  44. package/dist/plugins/astro/index.d.ts +1 -1
  45. package/dist/plugins/astro/index.js +6 -5
  46. package/dist/plugins/ava/index.d.ts +1 -1
  47. package/dist/plugins/ava/index.js +4 -5
  48. package/dist/plugins/babel/helpers.js +1 -1
  49. package/dist/plugins/babel/index.d.ts +3 -2
  50. package/dist/plugins/babel/index.js +4 -3
  51. package/dist/plugins/c8/index.d.ts +10 -0
  52. package/dist/plugins/c8/index.js +11 -0
  53. package/dist/plugins/capacitor/index.d.ts +1 -1
  54. package/dist/plugins/capacitor/index.js +5 -4
  55. package/dist/plugins/changesets/index.d.ts +1 -1
  56. package/dist/plugins/changesets/index.js +4 -3
  57. package/dist/plugins/commitizen/index.d.ts +1 -1
  58. package/dist/plugins/commitizen/index.js +3 -2
  59. package/dist/plugins/commitlint/index.d.ts +1 -1
  60. package/dist/plugins/commitlint/index.js +4 -2
  61. package/dist/plugins/cspell/index.d.ts +1 -1
  62. package/dist/plugins/cspell/index.js +3 -2
  63. package/dist/plugins/cucumber/index.d.ts +2 -2
  64. package/dist/plugins/cucumber/index.js +4 -4
  65. package/dist/plugins/cypress/helpers.d.ts +1 -1
  66. package/dist/plugins/cypress/helpers.js +3 -4
  67. package/dist/plugins/cypress/index.d.ts +1 -1
  68. package/dist/plugins/cypress/index.js +6 -5
  69. package/dist/plugins/dotenv/index.d.ts +8 -0
  70. package/dist/plugins/dotenv/index.js +9 -0
  71. package/dist/plugins/drizzle/index.d.ts +1 -1
  72. package/dist/plugins/drizzle/index.js +3 -3
  73. package/dist/plugins/eleventy/index.d.ts +1 -1
  74. package/dist/plugins/eleventy/index.js +6 -6
  75. package/dist/plugins/eslint/helpers.d.ts +4 -5
  76. package/dist/plugins/eslint/helpers.js +10 -32
  77. package/dist/plugins/eslint/index.d.ts +1 -1
  78. package/dist/plugins/eslint/index.js +3 -6
  79. package/dist/plugins/gatsby/index.d.ts +1 -1
  80. package/dist/plugins/gatsby/index.js +6 -3
  81. package/dist/plugins/github-actions/index.d.ts +1 -1
  82. package/dist/plugins/github-actions/index.js +23 -7
  83. package/dist/plugins/graphql-codegen/index.d.ts +1 -1
  84. package/dist/plugins/graphql-codegen/index.js +7 -7
  85. package/dist/plugins/husky/index.d.ts +1 -1
  86. package/dist/plugins/husky/index.js +4 -3
  87. package/dist/plugins/index.d.ts +685 -77
  88. package/dist/plugins/index.js +170 -77
  89. package/dist/plugins/jest/index.d.ts +1 -1
  90. package/dist/plugins/jest/index.js +22 -24
  91. package/dist/plugins/ladle/index.d.ts +2 -2
  92. package/dist/plugins/ladle/index.js +4 -4
  93. package/dist/plugins/lefthook/index.d.ts +1 -1
  94. package/dist/plugins/lefthook/index.js +18 -14
  95. package/dist/plugins/lint-staged/index.d.ts +1 -1
  96. package/dist/plugins/lint-staged/index.js +6 -5
  97. package/dist/plugins/linthtml/index.d.ts +1 -1
  98. package/dist/plugins/linthtml/index.js +6 -8
  99. package/dist/plugins/lockfile-lint/index.d.ts +2 -2
  100. package/dist/plugins/lockfile-lint/index.js +2 -1
  101. package/dist/plugins/lost-pixel/index.d.ts +2 -2
  102. package/dist/plugins/lost-pixel/index.js +1 -1
  103. package/dist/plugins/markdownlint/index.d.ts +1 -1
  104. package/dist/plugins/markdownlint/index.js +3 -2
  105. package/dist/plugins/mocha/index.d.ts +4 -1
  106. package/dist/plugins/mocha/index.js +8 -4
  107. package/dist/plugins/moonrepo/index.d.ts +2 -2
  108. package/dist/plugins/moonrepo/index.js +4 -4
  109. package/dist/plugins/msw/index.d.ts +1 -1
  110. package/dist/plugins/msw/index.js +4 -4
  111. package/dist/plugins/nest/index.d.ts +2 -2
  112. package/dist/plugins/nest/index.js +4 -3
  113. package/dist/plugins/netlify/index.d.ts +1 -1
  114. package/dist/plugins/netlify/index.js +6 -6
  115. package/dist/plugins/next/index.d.ts +1 -1
  116. package/dist/plugins/next/index.js +1 -1
  117. package/dist/plugins/node/index.d.ts +8 -0
  118. package/dist/plugins/node/index.js +9 -0
  119. package/dist/plugins/node-test-runner/index.d.ts +1 -1
  120. package/dist/plugins/nodemon/index.d.ts +10 -0
  121. package/dist/plugins/nodemon/index.js +11 -0
  122. package/dist/plugins/npm-package-json-lint/index.d.ts +1 -1
  123. package/dist/plugins/npm-package-json-lint/index.js +4 -2
  124. package/dist/plugins/nuxt/index.d.ts +1 -1
  125. package/dist/plugins/nuxt/index.js +4 -4
  126. package/dist/plugins/nx/index.d.ts +5 -1
  127. package/dist/plugins/nx/index.js +10 -8
  128. package/dist/plugins/nyc/index.d.ts +1 -1
  129. package/dist/plugins/nyc/index.js +3 -2
  130. package/dist/plugins/oclif/index.d.ts +2 -2
  131. package/dist/plugins/oclif/index.js +3 -2
  132. package/dist/plugins/playwright/index.d.ts +13 -1
  133. package/dist/plugins/playwright/index.js +13 -6
  134. package/dist/plugins/playwright-ct/index.d.ts +9 -3
  135. package/dist/plugins/playwright-ct/index.js +3 -2
  136. package/dist/plugins/playwright-test/index.d.ts +13 -0
  137. package/dist/plugins/playwright-test/index.js +16 -0
  138. package/dist/plugins/postcss/index.d.ts +1 -1
  139. package/dist/plugins/postcss/index.js +5 -2
  140. package/dist/plugins/preconstruct/index.d.ts +1 -1
  141. package/dist/plugins/preconstruct/index.js +3 -3
  142. package/dist/plugins/prettier/index.d.ts +1 -1
  143. package/dist/plugins/prettier/index.js +5 -5
  144. package/dist/plugins/react-cosmos/index.d.ts +2 -2
  145. package/dist/plugins/react-cosmos/index.js +5 -6
  146. package/dist/plugins/release-it/index.d.ts +1 -1
  147. package/dist/plugins/release-it/index.js +4 -3
  148. package/dist/plugins/remark/index.d.ts +1 -1
  149. package/dist/plugins/remark/index.js +3 -2
  150. package/dist/plugins/remix/index.d.ts +1 -1
  151. package/dist/plugins/remix/index.js +1 -1
  152. package/dist/plugins/rollup/index.d.ts +3 -1
  153. package/dist/plugins/rollup/index.js +8 -1
  154. package/dist/plugins/rsbuild/index.d.ts +2 -2
  155. package/dist/plugins/rsbuild/index.js +1 -1
  156. package/dist/plugins/rspack/index.d.ts +2 -2
  157. package/dist/plugins/rspack/index.js +4 -8
  158. package/dist/plugins/semantic-release/index.d.ts +1 -1
  159. package/dist/plugins/semantic-release/index.js +4 -2
  160. package/dist/plugins/sentry/index.d.ts +1 -1
  161. package/dist/plugins/sentry/index.js +1 -1
  162. package/dist/plugins/simple-git-hooks/index.d.ts +2 -2
  163. package/dist/plugins/simple-git-hooks/index.js +5 -5
  164. package/dist/plugins/size-limit/index.d.ts +2 -2
  165. package/dist/plugins/size-limit/index.js +2 -1
  166. package/dist/plugins/storybook/index.d.ts +1 -1
  167. package/dist/plugins/storybook/index.js +5 -5
  168. package/dist/plugins/stryker/index.d.ts +1 -1
  169. package/dist/plugins/stryker/index.js +3 -2
  170. package/dist/plugins/stylelint/index.d.ts +1 -1
  171. package/dist/plugins/stylelint/index.js +4 -3
  172. package/dist/plugins/svelte/index.d.ts +1 -1
  173. package/dist/plugins/svelte/index.js +1 -1
  174. package/dist/plugins/syncpack/index.d.ts +2 -3
  175. package/dist/plugins/syncpack/index.js +2 -4
  176. package/dist/plugins/tailwind/index.d.ts +1 -1
  177. package/dist/plugins/tailwind/index.js +1 -1
  178. package/dist/plugins/travis/index.d.ts +1 -1
  179. package/dist/plugins/travis/index.js +2 -3
  180. package/dist/plugins/ts-node/index.d.ts +15 -0
  181. package/dist/plugins/ts-node/index.js +12 -0
  182. package/dist/plugins/tsup/index.d.ts +4 -1
  183. package/dist/plugins/tsup/index.js +7 -3
  184. package/dist/plugins/tsx/index.d.ts +9 -0
  185. package/dist/plugins/tsx/index.js +10 -0
  186. package/dist/plugins/typedoc/index.d.ts +4 -1
  187. package/dist/plugins/typedoc/index.js +10 -3
  188. package/dist/plugins/typedoc/types.d.ts +1 -0
  189. package/dist/plugins/typescript/index.d.ts +11 -2
  190. package/dist/plugins/typescript/index.js +19 -34
  191. package/dist/plugins/unbuild/index.d.ts +1 -1
  192. package/dist/plugins/unbuild/index.js +3 -3
  193. package/dist/plugins/unocss/index.d.ts +2 -2
  194. package/dist/plugins/unocss/index.js +2 -1
  195. package/dist/plugins/vercel-og/index.d.ts +1 -1
  196. package/dist/plugins/vercel-og/index.js +1 -1
  197. package/dist/plugins/vike/index.d.ts +2 -2
  198. package/dist/plugins/vike/index.js +1 -1
  199. package/dist/plugins/vite/index.d.ts +3 -3
  200. package/dist/plugins/vite/index.js +2 -2
  201. package/dist/plugins/vitest/index.d.ts +4 -1
  202. package/dist/plugins/vitest/index.js +31 -20
  203. package/dist/plugins/vue/index.d.ts +1 -1
  204. package/dist/plugins/vue/index.js +10 -10
  205. package/dist/plugins/webdriver-io/index.d.ts +1 -1
  206. package/dist/plugins/webdriver-io/index.js +3 -2
  207. package/dist/plugins/webpack/index.d.ts +3 -5
  208. package/dist/plugins/webpack/index.js +18 -19
  209. package/dist/plugins/wireit/index.d.ts +1 -1
  210. package/dist/plugins/wireit/index.js +2 -2
  211. package/dist/plugins/wrangler/index.d.ts +1 -1
  212. package/dist/plugins/wrangler/index.js +3 -2
  213. package/dist/plugins/xo/index.d.ts +2 -2
  214. package/dist/plugins/xo/index.js +4 -4
  215. package/dist/plugins/yorkie/index.d.ts +1 -1
  216. package/dist/plugins/yorkie/index.js +6 -5
  217. package/dist/plugins.d.ts +7 -4
  218. package/dist/plugins.js +17 -10
  219. package/dist/reporters/symbols.js +1 -1
  220. package/dist/types/PluginNames.d.ts +2 -0
  221. package/dist/types/PluginNames.js +86 -0
  222. package/dist/types/args.d.ts +14 -0
  223. package/dist/types/config.d.ts +84 -21
  224. package/dist/types/package-json.d.ts +10 -0
  225. package/dist/types/project.d.ts +18 -0
  226. package/dist/typescript/get-imports-and-exports.d.ts +1 -11
  227. package/dist/typescript/get-imports-and-exports.js +3 -1
  228. package/dist/typescript/visitors/dynamic-imports/importCall.d.ts +1 -1
  229. package/dist/typescript/visitors/dynamic-imports/importType.d.ts +1 -1
  230. package/dist/typescript/visitors/dynamic-imports/index.d.ts +1 -1
  231. package/dist/typescript/visitors/dynamic-imports/jsDocType.d.ts +1 -1
  232. package/dist/typescript/visitors/dynamic-imports/requireCall.d.ts +1 -1
  233. package/dist/typescript/visitors/dynamic-imports/resolveCall.d.ts +1 -1
  234. package/dist/typescript/visitors/exports/exportAssignment.d.ts +1 -1
  235. package/dist/typescript/visitors/exports/exportDeclaration.d.ts +1 -1
  236. package/dist/typescript/visitors/exports/exportKeyword.d.ts +1 -1
  237. package/dist/typescript/visitors/exports/exportsAccessExpression.d.ts +1 -1
  238. package/dist/typescript/visitors/exports/index.d.ts +1 -1
  239. package/dist/typescript/visitors/exports/moduleExportsAccessExpression.d.ts +1 -1
  240. package/dist/typescript/visitors/imports/importDeclaration.d.ts +1 -1
  241. package/dist/typescript/visitors/imports/importEqualsDeclaration.d.ts +1 -1
  242. package/dist/typescript/visitors/imports/index.d.ts +1 -1
  243. package/dist/typescript/visitors/imports/reExportDeclaration.d.ts +1 -1
  244. package/dist/typescript/visitors/index.d.ts +1 -1
  245. package/dist/typescript/visitors/scripts/bun.d.ts +1 -1
  246. package/dist/typescript/visitors/scripts/execa.d.ts +1 -1
  247. package/dist/typescript/visitors/scripts/index.d.ts +1 -1
  248. package/dist/typescript/visitors/scripts/zx.d.ts +1 -1
  249. package/dist/util/create-workspace-graph.d.ts +1 -1
  250. package/dist/util/create-workspace-graph.js +7 -7
  251. package/dist/util/debug.d.ts +2 -2
  252. package/dist/util/debug.js +1 -1
  253. package/dist/util/glob.js +2 -2
  254. package/dist/util/handle-referenced-inputs.d.ts +5 -0
  255. package/dist/util/handle-referenced-inputs.js +86 -0
  256. package/dist/util/input.d.ts +37 -0
  257. package/dist/util/input.js +36 -0
  258. package/dist/util/map-workspaces.d.ts +5 -2
  259. package/dist/util/map-workspaces.js +6 -6
  260. package/dist/util/modules.d.ts +1 -0
  261. package/dist/util/modules.js +4 -3
  262. package/dist/util/object.d.ts +1 -0
  263. package/dist/util/object.js +19 -0
  264. package/dist/util/plugin-config.d.ts +24 -0
  265. package/dist/util/plugin-config.js +32 -0
  266. package/dist/util/plugin.d.ts +3 -31
  267. package/dist/util/plugin.js +9 -54
  268. package/dist/util/regex.js +3 -2
  269. package/dist/version.d.ts +1 -1
  270. package/dist/version.js +1 -1
  271. package/package.json +7 -10
  272. package/schema.json +28 -0
  273. package/dist/binaries/resolvers/bun.d.ts +0 -2
  274. package/dist/binaries/resolvers/c8.d.ts +0 -2
  275. package/dist/binaries/resolvers/c8.js +0 -11
  276. package/dist/binaries/resolvers/dotenv.d.ts +0 -2
  277. package/dist/binaries/resolvers/dotenv.js +0 -7
  278. package/dist/binaries/resolvers/fallback.d.ts +0 -2
  279. package/dist/binaries/resolvers/fallback.js +0 -26
  280. package/dist/binaries/resolvers/index.d.ts +0 -15
  281. package/dist/binaries/resolvers/index.js +0 -26
  282. package/dist/binaries/resolvers/node.d.ts +0 -4
  283. package/dist/binaries/resolvers/node.js +0 -11
  284. package/dist/binaries/resolvers/nodemon.d.ts +0 -2
  285. package/dist/binaries/resolvers/nodemon.js +0 -16
  286. package/dist/binaries/resolvers/npx.d.ts +0 -2
  287. package/dist/binaries/resolvers/nx.d.ts +0 -2
  288. package/dist/binaries/resolvers/nx.js +0 -9
  289. package/dist/binaries/resolvers/pnpm.d.ts +0 -2
  290. package/dist/binaries/resolvers/rollup.d.ts +0 -2
  291. package/dist/binaries/resolvers/rollup.js +0 -12
  292. package/dist/binaries/resolvers/ts-node.d.ts +0 -2
  293. package/dist/binaries/resolvers/ts-node.js +0 -16
  294. package/dist/binaries/resolvers/tsx.d.ts +0 -2
  295. package/dist/binaries/resolvers/tsx.js +0 -6
  296. package/dist/binaries/resolvers/yarn.d.ts +0 -2
  297. package/dist/binaries/types.d.ts +0 -11
  298. package/dist/types/plugins.d.ts +0 -42
  299. package/dist/util/handle-dependency.d.ts +0 -4
  300. package/dist/util/handle-dependency.js +0 -63
  301. package/dist/util/protocols.d.ts +0 -9
  302. package/dist/util/protocols.js +0 -9
  303. /package/dist/{binaries/types.js → types/args.js} +0 -0
  304. /package/dist/types/{plugins.js → project.js} +0 -0
@@ -68,6 +68,7 @@ const pluginsSchema = z.object({
68
68
  angular: pluginSchema,
69
69
  ava: pluginSchema,
70
70
  babel: pluginSchema,
71
+ c8: pluginSchema,
71
72
  capacitor: pluginSchema,
72
73
  changesets: pluginSchema,
73
74
  commitizen: pluginSchema,
@@ -75,6 +76,7 @@ const pluginsSchema = z.object({
75
76
  cspell: pluginSchema,
76
77
  cucumber: pluginSchema,
77
78
  cypress: pluginSchema,
79
+ dotenv: pluginSchema,
78
80
  eleventy: pluginSchema,
79
81
  eslint: pluginSchema,
80
82
  gatsby: pluginSchema,
@@ -95,6 +97,8 @@ const pluginsSchema = z.object({
95
97
  nest: pluginSchema,
96
98
  netlify: pluginSchema,
97
99
  next: pluginSchema,
100
+ node: pluginSchema,
101
+ nodemon: pluginSchema,
98
102
  'node-test-runner': pluginSchema,
99
103
  'npm-package-json-lint': pluginSchema,
100
104
  nuxt: pluginSchema,
@@ -103,6 +107,7 @@ const pluginsSchema = z.object({
103
107
  oclif: pluginSchema,
104
108
  playwright: pluginSchema,
105
109
  'playwright-ct': pluginSchema,
110
+ 'playwright-test': pluginSchema,
106
111
  postcss: pluginSchema,
107
112
  preconstruct: pluginSchema,
108
113
  prettier: pluginSchema,
@@ -124,7 +129,9 @@ const pluginsSchema = z.object({
124
129
  syncpack: pluginSchema,
125
130
  tailwind: pluginSchema,
126
131
  travis: pluginSchema,
132
+ 'ts-node': pluginSchema,
127
133
  tsup: pluginSchema,
134
+ tsx: pluginSchema,
128
135
  typedoc: pluginSchema,
129
136
  typescript: pluginSchema,
130
137
  unbuild: pluginSchema,
@@ -127,8 +127,10 @@ export class DependencyDeputy {
127
127
  const typesPackageName = !isDefinitelyTyped(packageName) && getDefinitelyTypedFor(packageName);
128
128
  const closestWorkspaceNameForTypes = typesPackageName && workspaceNames.find(name => this.isInDependencies(name, typesPackageName));
129
129
  if (closestWorkspaceName || closestWorkspaceNameForTypes) {
130
- closestWorkspaceName && this.addReferencedDependency(closestWorkspaceName, packageName);
131
- closestWorkspaceNameForTypes && this.addReferencedDependency(closestWorkspaceNameForTypes, typesPackageName);
130
+ if (closestWorkspaceName)
131
+ this.addReferencedDependency(closestWorkspaceName, packageName);
132
+ if (closestWorkspaceNameForTypes)
133
+ this.addReferencedDependency(closestWorkspaceNameForTypes, typesPackageName);
132
134
  return true;
133
135
  }
134
136
  this.addReferencedDependency(workspace.name, packageName);
@@ -287,6 +289,7 @@ export class DependencyDeputy {
287
289
  this.handleIgnoredDependencies(issues, counters, 'devDependencies');
288
290
  this.handleIgnoredDependencies(issues, counters, 'optionalPeerDependencies');
289
291
  this.handleIgnoredDependencies(issues, counters, 'unlisted');
292
+ this.handleIgnoredDependencies(issues, counters, 'unresolved');
290
293
  this.handleIgnoredBinaries(issues, counters, 'binaries');
291
294
  }
292
295
  getConfigurationHints() {
@@ -1,32 +1,15 @@
1
- import ts from 'typescript';
2
1
  import { ProjectPrincipal } from './ProjectPrincipal.js';
3
- import type { AsyncCompilers, SyncCompilers } from './compilers/types.js';
4
- import type { ToSourceFilePath } from './util/to-source-path.js';
5
- type Paths = ts.CompilerOptions['paths'];
2
+ import type { PrincipalOptions } from './types/project.js';
6
3
  type Principal = {
7
4
  principal: ProjectPrincipal;
8
- cwds: Set<string>;
5
+ wsDirs: Set<string>;
9
6
  pathKeys: Set<string>;
10
7
  pkgNames: Set<string>;
11
8
  };
12
9
  type Principals = Set<Principal>;
13
- export type PrincipalOptions = {
14
- cwd: string;
15
- isFile: boolean;
16
- compilerOptions: ts.CompilerOptions;
17
- paths: Paths;
18
- compilers: [SyncCompilers, AsyncCompilers];
19
- pkgName: string;
20
- isIsolateWorkspaces: boolean;
21
- isSkipLibs: boolean;
22
- isWatch: boolean;
23
- toSourceFilePath: ToSourceFilePath;
24
- isCache: boolean;
25
- cacheLocation: string;
26
- };
27
10
  export declare class PrincipalFactory {
28
11
  principals: Principals;
29
- getPrincipal(options: PrincipalOptions): ProjectPrincipal;
12
+ createPrincipal(options: PrincipalOptions): ProjectPrincipal;
30
13
  private findReusablePrincipal;
31
14
  private linkPrincipal;
32
15
  private addNewPrincipal;
@@ -17,7 +17,7 @@ const mergePaths = (cwd, compilerOptions, paths = {}) => {
17
17
  };
18
18
  export class PrincipalFactory {
19
19
  principals = new Set();
20
- getPrincipal(options) {
20
+ createPrincipal(options) {
21
21
  const { cwd, compilerOptions, isFile, paths, pkgName, isIsolateWorkspaces, compilers } = options;
22
22
  options.compilerOptions = mergePaths(cwd, compilerOptions, paths);
23
23
  if (isFile && compilerOptions.module !== ts.ModuleKind.CommonJS)
@@ -50,14 +50,14 @@ export class PrincipalFactory {
50
50
  principal.pathKeys.add(p);
51
51
  principal.principal.addPaths(paths);
52
52
  principal.principal.addCompilers(compilers);
53
- principal.cwds.add(cwd);
53
+ principal.wsDirs.add(cwd);
54
54
  principal.pkgNames.add(pkgName);
55
55
  }
56
56
  addNewPrincipal(options) {
57
57
  const { cwd, compilerOptions, pkgName } = options;
58
58
  const pathKeys = new Set(Object.keys(compilerOptions?.paths ?? {}));
59
59
  const principal = new ProjectPrincipal(options);
60
- this.principals.add({ principal, cwds: new Set([cwd]), pathKeys, pkgNames: new Set([pkgName]) });
60
+ this.principals.add({ principal, wsDirs: new Set([cwd]), pathKeys, pkgNames: new Set([pkgName]) });
61
61
  return principal;
62
62
  }
63
63
  getPrincipals() {
@@ -69,7 +69,7 @@ export class PrincipalFactory {
69
69
  deletePrincipal(principal) {
70
70
  const p = Array.from(this.principals).find(p => p.principal === principal);
71
71
  if (p) {
72
- debugLog('*', `Deleting principal at ${[...p.cwds].map(cwd => toRelative(cwd) || '.')} (${[...p.pkgNames]})`);
72
+ debugLog('*', `Deleting principal at ${[...p.wsDirs].map(cwd => toRelative(cwd) || '.')} (${[...p.pkgNames]})`);
73
73
  this.principals.delete(p);
74
74
  }
75
75
  }
@@ -1,18 +1,16 @@
1
1
  import ts from 'typescript';
2
2
  import { CacheConsultant } from './CacheConsultant.js';
3
- import type { PrincipalOptions } from './PrincipalFactory.js';
4
- import type { ReferencedDependencies } from './WorkspaceWorker.js';
5
3
  import type { AsyncCompilers, SyncCompilers } from './compilers/types.js';
4
+ import type { GetImportsAndExportsOptions } from './types/config.js';
6
5
  import type { DependencyGraph, Export, ExportMember, FileNode } from './types/dependency-graph.js';
6
+ import type { PrincipalOptions } from './types/project.js';
7
7
  import type { SourceFileManager } from './typescript/SourceFileManager.js';
8
- import { type GetImportsAndExportsOptions } from './typescript/get-imports-and-exports.js';
9
8
  import type { ResolveModuleNames } from './typescript/resolve-module-names.js';
10
9
  import type { ToSourceFilePath } from './util/to-source-path.js';
11
10
  export declare class ProjectPrincipal {
12
11
  entryPaths: Set<string>;
13
12
  projectPaths: Set<string>;
14
13
  nonEntryPaths: Set<string>;
15
- referencedDependencies: Set<[string, string, string]>;
16
14
  skipExportsAnalysis: Set<string>;
17
15
  cwd: string;
18
16
  compilerOptions: ts.CompilerOptions;
@@ -48,7 +46,6 @@ export declare class ProjectPrincipal {
48
46
  addProjectPath(filePath: string): void;
49
47
  deletedFiles: Set<unknown>;
50
48
  removeProjectPath(filePath: string): void;
51
- addReferencedDependencies(workspaceName: string, referencedDependencies: ReferencedDependencies): void;
52
49
  runAsyncCompilers(): Promise<void>;
53
50
  getUsedResolvedFiles(): string[];
54
51
  private getProgramSourceFiles;
@@ -30,7 +30,6 @@ export class ProjectPrincipal {
30
30
  entryPaths = new Set();
31
31
  projectPaths = new Set();
32
32
  nonEntryPaths = new Set();
33
- referencedDependencies = new Set();
34
33
  skipExportsAnalysis = new Set();
35
34
  cwd;
36
35
  compilerOptions;
@@ -123,10 +122,6 @@ export class ProjectPrincipal {
123
122
  this.invalidateFile(filePath);
124
123
  this.deletedFiles.add(filePath);
125
124
  }
126
- addReferencedDependencies(workspaceName, referencedDependencies) {
127
- for (const referencedDependency of referencedDependencies)
128
- this.referencedDependencies.add([...referencedDependency, workspaceName]);
129
- }
130
125
  async runAsyncCompilers() {
131
126
  const add = timerify(this.backend.fileManager.compileAndAddSourceFile.bind(this.backend.fileManager));
132
127
  const extensions = Array.from(this.asyncCompilers.keys());
@@ -1,7 +1,9 @@
1
1
  import { CacheConsultant } from './CacheConsultant.js';
2
- import type { Configuration, PluginName, WorkspaceConfiguration } from './types/config.js';
2
+ import type { PluginName } from './types/PluginNames.js';
3
+ import type { Configuration, WorkspaceConfiguration } from './types/config.js';
3
4
  import type { PackageJson } from './types/package-json.js';
4
5
  import type { DependencySet } from './types/workspace.js';
6
+ import { type Input } from './util/input.js';
5
7
  type WorkspaceManagerOptions = {
6
8
  name: string;
7
9
  dir: string;
@@ -9,18 +11,20 @@ type WorkspaceManagerOptions = {
9
11
  config: WorkspaceConfiguration;
10
12
  manifest: PackageJson;
11
13
  dependencies: DependencySet;
14
+ getReferencedInternalFilePath: (input: Input) => string | undefined;
12
15
  rootIgnore: Configuration['ignore'];
13
16
  negatedWorkspacePatterns: string[];
17
+ ignoredWorkspacePatterns: string[];
14
18
  enabledPluginsInAncestors: string[];
15
19
  isProduction: boolean;
16
20
  isStrict: boolean;
17
21
  isCache: boolean;
18
22
  cacheLocation: string;
23
+ allConfigFilePaths: Set<string>;
19
24
  };
20
- export type ReferencedDependencies = Set<[string, string]>;
21
25
  type CacheItem = {
22
- resolveEntryPaths?: string[];
23
- resolveConfig?: string[];
26
+ resolveEntryPaths?: Input[];
27
+ resolveConfig?: Input[];
24
28
  };
25
29
  export declare class WorkspaceWorker {
26
30
  name: string;
@@ -28,17 +32,19 @@ export declare class WorkspaceWorker {
28
32
  cwd: string;
29
33
  config: WorkspaceConfiguration;
30
34
  manifest: PackageJson;
31
- manifestScriptNames: Set<string>;
32
35
  dependencies: DependencySet;
36
+ getReferencedInternalFilePath: (input: Input) => string | undefined;
33
37
  isProduction: boolean;
34
38
  isStrict: boolean;
35
39
  rootIgnore: Configuration['ignore'];
36
40
  negatedWorkspacePatterns: string[];
37
- enabledPluginsMap: Record<"astro" | "angular" | "ava" | "babel" | "capacitor" | "changesets" | "commitizen" | "commitlint" | "cspell" | "cucumber" | "cypress" | "eleventy" | "eslint" | "gatsby" | "husky" | "jest" | "ladle" | "lefthook" | "linthtml" | "markdownlint" | "mocha" | "moonrepo" | "msw" | "nest" | "netlify" | "next" | "nuxt" | "nx" | "nyc" | "oclif" | "playwright" | "postcss" | "preconstruct" | "prettier" | "remark" | "remix" | "rollup" | "rsbuild" | "rspack" | "sentry" | "storybook" | "stryker" | "stylelint" | "svelte" | "syncpack" | "tailwind" | "travis" | "tsup" | "typedoc" | "typescript" | "unbuild" | "unocss" | "vue" | "vike" | "vite" | "vitest" | "webpack" | "wireit" | "wrangler" | "xo" | "yorkie" | "drizzle" | "githubActions" | "graphqlCodegen" | "lintStaged" | "lockfileLint" | "lostPixel" | "nodeTestRunner" | "npmPackageJsonLint" | "playwrightCt" | "reactCosmos" | "releaseIt" | "semanticRelease" | "simpleGitHooks" | "sizeLimit" | "vercelOg" | "webdriverIo", boolean>;
41
+ ignoredWorkspacePatterns: string[];
42
+ enabledPluginsMap: Record<PluginName, boolean>;
38
43
  enabledPlugins: PluginName[];
39
44
  enabledPluginsInAncestors: string[];
40
45
  cache: CacheConsultant<CacheItem>;
41
- constructor({ name, dir, cwd, config, manifest, dependencies, isProduction, isStrict, rootIgnore, negatedWorkspacePatterns, enabledPluginsInAncestors, isCache, cacheLocation, }: WorkspaceManagerOptions);
46
+ allConfigFilePaths: Set<string>;
47
+ constructor({ name, dir, cwd, config, manifest, dependencies, isProduction, isStrict, rootIgnore, negatedWorkspacePatterns, ignoredWorkspacePatterns, enabledPluginsInAncestors, getReferencedInternalFilePath, isCache, cacheLocation, allConfigFilePaths, }: WorkspaceManagerOptions);
42
48
  init(): Promise<void>;
43
49
  private determineEnabledPlugins;
44
50
  private getConfigForPlugin;
@@ -46,16 +52,12 @@ export declare class WorkspaceWorker {
46
52
  getProjectFilePatterns(projectFilePatterns: string[]): string[];
47
53
  getPluginProjectFilePatterns(): string[];
48
54
  getPluginConfigPatterns(): string[];
55
+ getPluginEntryFilePatterns(patterns: string[]): string[];
49
56
  getProductionEntryFilePatterns(negatedTestFilePatterns: string[]): string[];
50
57
  getProductionProjectFilePatterns(negatedTestFilePatterns: string[]): string[];
51
58
  private getConfigurationFilePatterns;
52
59
  getIgnorePatterns(): string[];
53
- findDependenciesByPlugins(): Promise<{
54
- entryFilePatterns: Set<string>;
55
- productionEntryFilePatterns: Set<string>;
56
- referencedDependencies: ReferencedDependencies;
57
- enabledPlugins: ("astro" | "angular" | "ava" | "babel" | "capacitor" | "changesets" | "commitizen" | "commitlint" | "cspell" | "cucumber" | "cypress" | "eleventy" | "eslint" | "gatsby" | "husky" | "jest" | "ladle" | "lefthook" | "linthtml" | "markdownlint" | "mocha" | "moonrepo" | "msw" | "nest" | "netlify" | "next" | "nuxt" | "nx" | "nyc" | "oclif" | "playwright" | "postcss" | "preconstruct" | "prettier" | "remark" | "remix" | "rollup" | "rsbuild" | "rspack" | "sentry" | "storybook" | "stryker" | "stylelint" | "svelte" | "syncpack" | "tailwind" | "travis" | "tsup" | "typedoc" | "typescript" | "unbuild" | "unocss" | "vue" | "vike" | "vite" | "vitest" | "webpack" | "wireit" | "wrangler" | "xo" | "yorkie" | "drizzle" | "githubActions" | "graphqlCodegen" | "lintStaged" | "lockfileLint" | "lostPixel" | "nodeTestRunner" | "npmPackageJsonLint" | "playwrightCt" | "reactCosmos" | "releaseIt" | "semanticRelease" | "simpleGitHooks" | "sizeLimit" | "vercelOg" | "webdriverIo")[];
58
- }>;
60
+ findDependenciesByPlugins(): Promise<Input[]>;
59
61
  onDispose(): void;
60
62
  }
61
63
  export {};
@@ -1,42 +1,49 @@
1
1
  import { CacheConsultant } from './CacheConsultant.js';
2
- import { plugins } from './plugins.js';
2
+ import { _getInputsFromScripts } from './binaries/index.js';
3
+ import { getFilteredScripts } from './manifest/helpers.js';
4
+ import { PluginEntries, Plugins } from './plugins.js';
5
+ import { compact } from './util/array.js';
3
6
  import { debugLogArray, debugLogObject } from './util/debug.js';
4
7
  import { _glob, hasNoProductionSuffix, hasProductionSuffix, negate, prependDirToPattern } from './util/glob.js';
5
- import { get, getKeysByValue } from './util/object.js';
6
- import { basename, dirname, join, toPosix } from './util/path.js';
8
+ import { isConfigPattern, toDebugString, toEntry } from './util/input.js';
9
+ import { getKeysByValue } from './util/object.js';
10
+ import { basename, dirname, join } from './util/path.js';
7
11
  import { getFinalEntryPaths, loadConfigForPlugin } from './util/plugin.js';
8
- import { fromEntryPattern, fromProductionEntryPattern, isEntryPattern, isProductionEntryPattern, } from './util/protocols.js';
9
12
  const nullConfig = { config: null, entry: null, project: null };
10
- const initEnabledPluginsMap = () => Object.keys(plugins).reduce((enabled, pluginName) => ({ ...enabled, [pluginName]: false }), {});
13
+ const initEnabledPluginsMap = () => Object.keys(Plugins).reduce((enabled, pluginName) => ({ ...enabled, [pluginName]: false }), {});
11
14
  export class WorkspaceWorker {
12
15
  name;
13
16
  dir;
14
17
  cwd;
15
18
  config;
16
19
  manifest;
17
- manifestScriptNames;
18
20
  dependencies;
21
+ getReferencedInternalFilePath;
19
22
  isProduction;
20
23
  isStrict;
21
24
  rootIgnore;
22
25
  negatedWorkspacePatterns = [];
26
+ ignoredWorkspacePatterns = [];
23
27
  enabledPluginsMap = initEnabledPluginsMap();
24
28
  enabledPlugins = [];
25
29
  enabledPluginsInAncestors;
26
30
  cache;
27
- constructor({ name, dir, cwd, config, manifest, dependencies, isProduction, isStrict, rootIgnore, negatedWorkspacePatterns, enabledPluginsInAncestors, isCache, cacheLocation, }) {
31
+ allConfigFilePaths;
32
+ constructor({ name, dir, cwd, config, manifest, dependencies, isProduction, isStrict, rootIgnore, negatedWorkspacePatterns, ignoredWorkspacePatterns, enabledPluginsInAncestors, getReferencedInternalFilePath, isCache, cacheLocation, allConfigFilePaths, }) {
28
33
  this.name = name;
29
34
  this.dir = dir;
30
35
  this.cwd = cwd;
31
36
  this.config = config;
32
37
  this.manifest = manifest;
33
- this.manifestScriptNames = new Set(Object.keys(manifest.scripts ?? {}));
34
38
  this.dependencies = dependencies;
35
39
  this.isProduction = isProduction;
36
40
  this.isStrict = isStrict;
37
41
  this.rootIgnore = rootIgnore;
38
42
  this.negatedWorkspacePatterns = negatedWorkspacePatterns;
43
+ this.ignoredWorkspacePatterns = ignoredWorkspacePatterns;
39
44
  this.enabledPluginsInAncestors = enabledPluginsInAncestors;
45
+ this.allConfigFilePaths = allConfigFilePaths;
46
+ this.getReferencedInternalFilePath = getReferencedInternalFilePath;
40
47
  this.cache = new CacheConsultant({ name: `plugins-${name}`, isEnabled: isCache, cacheLocation });
41
48
  }
42
49
  async init() {
@@ -44,8 +51,7 @@ export class WorkspaceWorker {
44
51
  }
45
52
  async determineEnabledPlugins() {
46
53
  const manifest = this.manifest;
47
- const pluginEntries = Object.entries(plugins);
48
- for (const [pluginName, plugin] of pluginEntries) {
54
+ for (const [pluginName, plugin] of PluginEntries) {
49
55
  if (this.config[pluginName] === false)
50
56
  continue;
51
57
  if (this.config[pluginName]) {
@@ -54,12 +60,13 @@ export class WorkspaceWorker {
54
60
  }
55
61
  const isEnabledInAncestor = this.enabledPluginsInAncestors.includes(pluginName);
56
62
  if (isEnabledInAncestor ||
57
- (await plugin.isEnabled({ cwd: this.dir, manifest, dependencies: this.dependencies, config: this.config }))) {
63
+ (typeof plugin.isEnabled === 'function' &&
64
+ (await plugin.isEnabled({ cwd: this.dir, manifest, dependencies: this.dependencies, config: this.config })))) {
58
65
  this.enabledPluginsMap[pluginName] = true;
59
66
  }
60
67
  }
61
68
  const enabledPlugins = getKeysByValue(this.enabledPluginsMap, true);
62
- const enabledPluginTitles = enabledPlugins.map(name => plugins[name].title);
69
+ const enabledPluginTitles = enabledPlugins.map(name => Plugins[name].title);
63
70
  debugLogObject(this.name, 'Enabled plugins', enabledPluginTitles);
64
71
  return enabledPlugins;
65
72
  }
@@ -91,7 +98,7 @@ export class WorkspaceWorker {
91
98
  }
92
99
  getPluginProjectFilePatterns() {
93
100
  const patterns = [];
94
- for (const [pluginName, plugin] of Object.entries(plugins)) {
101
+ for (const [pluginName, plugin] of PluginEntries) {
95
102
  const pluginConfig = this.getConfigForPlugin(pluginName);
96
103
  if (this.enabledPluginsMap[pluginName]) {
97
104
  const { entry, project } = pluginConfig;
@@ -102,7 +109,7 @@ export class WorkspaceWorker {
102
109
  }
103
110
  getPluginConfigPatterns() {
104
111
  const patterns = [];
105
- for (const [pluginName, plugin] of Object.entries(plugins)) {
112
+ for (const [pluginName, plugin] of PluginEntries) {
106
113
  const pluginConfig = this.getConfigForPlugin(pluginName);
107
114
  if (this.enabledPluginsMap[pluginName] && pluginConfig) {
108
115
  const { config } = pluginConfig;
@@ -111,6 +118,9 @@ export class WorkspaceWorker {
111
118
  }
112
119
  return patterns;
113
120
  }
121
+ getPluginEntryFilePatterns(patterns) {
122
+ return [patterns, this.ignoredWorkspacePatterns.map(negate)].flat();
123
+ }
114
124
  getProductionEntryFilePatterns(negatedTestFilePatterns) {
115
125
  const entry = this.config.entry.filter(hasProductionSuffix);
116
126
  if (entry.length === 0)
@@ -140,115 +150,144 @@ export class WorkspaceWorker {
140
150
  ].flat();
141
151
  }
142
152
  getConfigurationFilePatterns(pluginName) {
143
- const plugin = plugins[pluginName];
153
+ const plugin = Plugins[pluginName];
144
154
  const pluginConfig = this.getConfigForPlugin(pluginName);
145
- if (pluginConfig) {
146
- return pluginConfig.config ?? plugin.config ?? [];
147
- }
148
- return [];
155
+ return pluginConfig.config ?? plugin.config ?? [];
149
156
  }
150
157
  getIgnorePatterns() {
151
158
  return [...this.rootIgnore, ...this.config.ignore.map(pattern => prependDirToPattern(this.name, pattern))];
152
159
  }
153
160
  async findDependenciesByPlugins() {
154
- const entryFilePatterns = new Set();
155
- const productionEntryFilePatterns = new Set();
156
- const referencedDependencies = new Set();
157
161
  const name = this.name;
158
162
  const cwd = this.dir;
159
- const baseOptions = {
160
- rootCwd: this.cwd,
161
- cwd,
162
- manifest: this.manifest,
163
- manifestScriptNames: this.manifestScriptNames,
164
- dependencies: this.dependencies,
165
- isProduction: this.isProduction,
166
- enabledPlugins: this.enabledPlugins,
163
+ const rootCwd = this.cwd;
164
+ const manifest = this.manifest;
165
+ const containingFilePath = join(cwd, 'package.json');
166
+ const isProduction = this.isProduction;
167
+ const knownBinsOnly = false;
168
+ const manifestScriptNames = new Set(Object.keys(manifest.scripts ?? {}));
169
+ const baseOptions = { manifestScriptNames, cwd, rootCwd, containingFilePath, knownBinsOnly };
170
+ const baseScriptOptions = { ...baseOptions, manifest, isProduction, enabledPlugins: this.enabledPlugins };
171
+ const [productionScripts, developmentScripts] = getFilteredScripts(manifest.scripts ?? {});
172
+ const inputsFromManifest = _getInputsFromScripts(Object.values(developmentScripts), baseOptions);
173
+ const productionInputsFromManifest = _getInputsFromScripts(Object.values(productionScripts), baseOptions);
174
+ const hasProductionInput = (input) => productionInputsFromManifest.find(d => d.specifier === input.specifier && d.type === input.type);
175
+ const getInputsFromScripts = (scripts, options) => _getInputsFromScripts(scripts, { ...baseScriptOptions, ...options });
176
+ const inputs = [];
177
+ const configFiles = new Map();
178
+ const remainingPlugins = new Set(this.enabledPlugins);
179
+ const addInput = (input, containingFilePath = input.containingFilePath) => inputs.push({ ...input, containingFilePath });
180
+ const handleConfigInput = (pluginName, dependency) => {
181
+ const configFilePath = this.getReferencedInternalFilePath(dependency);
182
+ if (configFilePath) {
183
+ if (!configFiles.has(pluginName))
184
+ configFiles.set(pluginName, new Set());
185
+ configFiles.get(pluginName)?.add(configFilePath);
186
+ addInput(toEntry(dependency.specifier), dependency.containingFilePath);
187
+ }
167
188
  };
168
- for (const [pluginName, plugin] of Object.entries(plugins)) {
169
- if (this.enabledPluginsMap[pluginName]) {
170
- const hasResolveEntryPaths = typeof plugin.resolveEntryPaths === 'function';
171
- const hasResolveConfig = typeof plugin.resolveConfig === 'function';
172
- const shouldRunConfigResolver = hasResolveConfig && (!this.isProduction || (this.isProduction && 'production' in plugin));
173
- const hasResolve = typeof plugin.resolve === 'function';
174
- const pluginConfig = this.getConfigForPlugin(pluginName);
175
- if (!pluginConfig)
176
- continue;
177
- const patterns = this.getConfigurationFilePatterns(pluginName);
178
- const allConfigFilePaths = await _glob({ patterns, cwd: baseOptions.rootCwd, dir: cwd, gitignore: false });
179
- const { packageJsonPath } = plugin;
180
- const configFilePaths = allConfigFilePaths.filter(filePath => basename(filePath) !== 'package.json' ||
181
- (typeof packageJsonPath === 'function'
182
- ? packageJsonPath(this.manifest)
183
- : get(this.manifest, packageJsonPath ?? pluginName)));
189
+ for (const input of [...inputsFromManifest, ...productionInputsFromManifest]) {
190
+ if (isConfigPattern(input)) {
191
+ handleConfigInput(input.pluginName, { ...input, containingFilePath });
192
+ }
193
+ else {
194
+ if (!isProduction)
195
+ addInput(input, containingFilePath);
196
+ else if (isProduction && (input.production || hasProductionInput(input)))
197
+ addInput(input, containingFilePath);
198
+ }
199
+ }
200
+ const runPlugin = async (pluginName, patterns) => {
201
+ const plugin = Plugins[pluginName];
202
+ const hasResolveEntryPaths = typeof plugin.resolveEntryPaths === 'function';
203
+ const hasResolveConfig = typeof plugin.resolveConfig === 'function';
204
+ const shouldRunConfigResolver = hasResolveConfig && (!isProduction || (isProduction && 'production' in plugin));
205
+ const hasResolve = typeof plugin.resolve === 'function';
206
+ const config = this.getConfigForPlugin(pluginName);
207
+ if (!config)
208
+ return;
209
+ const configFilePaths = await _glob({ patterns, cwd: baseScriptOptions.rootCwd, dir: cwd, gitignore: false });
210
+ const remainingConfigFilePaths = configFilePaths.filter(filePath => !this.allConfigFilePaths.has(filePath));
211
+ for (const f of remainingConfigFilePaths)
212
+ if (basename(f) !== 'package.json')
213
+ this.allConfigFilePaths.add(f);
214
+ if (configFilePaths.length > 0)
184
215
  debugLogArray([name, plugin.title], 'config file paths', configFilePaths);
185
- const pluginDependencies = new Set();
186
- const addDependency = (specifier, configFilePath) => {
187
- pluginDependencies.add(specifier);
188
- if (isEntryPattern(specifier)) {
189
- entryFilePatterns.add(fromEntryPattern(specifier));
190
- }
191
- else if (isProductionEntryPattern(specifier)) {
192
- productionEntryFilePatterns.add(fromProductionEntryPattern(specifier));
193
- }
194
- else if (configFilePath) {
195
- referencedDependencies.add([configFilePath, toPosix(specifier)]);
196
- }
216
+ const options = {
217
+ ...baseScriptOptions,
218
+ config,
219
+ configFilePath: containingFilePath,
220
+ configFileDir: cwd,
221
+ configFileName: '',
222
+ getInputsFromScripts,
223
+ };
224
+ const configEntryPaths = [];
225
+ for (const configFilePath of remainingConfigFilePaths) {
226
+ const opts = {
227
+ ...options,
228
+ configFilePath,
229
+ configFileDir: dirname(configFilePath),
230
+ configFileName: basename(configFilePath),
197
231
  };
198
- const options = { ...baseOptions, config: pluginConfig, configFileDir: cwd, configFileName: '' };
199
- const configEntryPaths = [];
200
- for (const configFilePath of configFilePaths) {
201
- const opts = { ...options, configFileDir: dirname(configFilePath), configFileName: basename(configFilePath) };
202
- if (hasResolveEntryPaths || shouldRunConfigResolver) {
203
- const isManifest = basename(configFilePath) === 'package.json';
204
- const fd = isManifest ? undefined : this.cache.getFileDescriptor(configFilePath);
205
- if (fd?.meta?.data && !fd.changed) {
206
- if (fd.meta.data.resolveEntryPaths)
207
- for (const id of fd.meta.data.resolveEntryPaths)
208
- configEntryPaths.push(id);
209
- if (fd.meta.data.resolveConfig)
210
- for (const id of fd.meta.data.resolveConfig)
211
- addDependency(id, configFilePath);
212
- }
213
- else {
214
- const config = await loadConfigForPlugin(configFilePath, plugin, opts, pluginName);
215
- const data = {};
216
- if (config) {
217
- if (hasResolveEntryPaths) {
218
- const dependencies = (await plugin.resolveEntryPaths?.(config, opts)) ?? [];
219
- for (const id of dependencies)
220
- configEntryPaths.push(id);
221
- data.resolveEntryPaths = dependencies;
222
- }
223
- if (shouldRunConfigResolver) {
224
- const dependencies = (await plugin.resolveConfig?.(config, opts)) ?? [];
225
- for (const id of dependencies)
226
- addDependency(id, configFilePath);
227
- data.resolveConfig = dependencies;
232
+ if (hasResolveEntryPaths || shouldRunConfigResolver) {
233
+ const isManifest = basename(configFilePath) === 'package.json';
234
+ const fd = isManifest ? undefined : this.cache.getFileDescriptor(configFilePath);
235
+ if (fd?.meta?.data && !fd.changed) {
236
+ if (fd.meta.data.resolveEntryPaths)
237
+ for (const id of fd.meta.data.resolveEntryPaths)
238
+ configEntryPaths.push(id);
239
+ if (fd.meta.data.resolveConfig)
240
+ for (const id of fd.meta.data.resolveConfig)
241
+ addInput(id, configFilePath);
242
+ }
243
+ else {
244
+ const config = await loadConfigForPlugin(configFilePath, plugin, opts, pluginName);
245
+ const data = {};
246
+ if (config) {
247
+ if (hasResolveEntryPaths) {
248
+ const entryPaths = (await plugin.resolveEntryPaths?.(config, opts)) ?? [];
249
+ for (const entryPath of entryPaths)
250
+ configEntryPaths.push(entryPath);
251
+ data.resolveEntryPaths = entryPaths;
252
+ }
253
+ if (shouldRunConfigResolver) {
254
+ const inputs = (await plugin.resolveConfig?.(config, opts)) ?? [];
255
+ for (const input of inputs) {
256
+ if (isConfigPattern(input))
257
+ handleConfigInput(input.pluginName, { ...input, containingFilePath: configFilePath });
258
+ addInput(input, configFilePath);
228
259
  }
229
- if (!isManifest && fd?.changed && fd.meta)
230
- fd.meta.data = data;
260
+ data.resolveConfig = inputs;
231
261
  }
262
+ if (!isManifest && fd?.changed && fd.meta)
263
+ fd.meta.data = data;
232
264
  }
233
265
  }
234
266
  }
235
- const finalEntryPaths = getFinalEntryPaths(plugin, options, configEntryPaths);
236
- for (const id of finalEntryPaths)
237
- addDependency(id);
238
- if (hasResolve) {
239
- const dependencies = (await plugin.resolve?.(options)) ?? [];
240
- for (const id of dependencies)
241
- addDependency(id, join(cwd, 'package.json'));
242
- }
243
- debugLogArray([name, plugin.title], 'dependencies', pluginDependencies);
244
267
  }
245
- }
246
- return {
247
- entryFilePatterns,
248
- productionEntryFilePatterns,
249
- referencedDependencies,
250
- enabledPlugins: this.enabledPlugins,
268
+ const finalEntryPaths = getFinalEntryPaths(plugin, options, configEntryPaths);
269
+ for (const id of finalEntryPaths)
270
+ addInput(id, id.containingFilePath ?? containingFilePath);
271
+ if (hasResolve) {
272
+ const dependencies = (await plugin.resolve?.(options)) ?? [];
273
+ for (const id of dependencies)
274
+ addInput(id, containingFilePath);
275
+ }
251
276
  };
277
+ for (const pluginName of this.enabledPlugins) {
278
+ const patterns = [...this.getConfigurationFilePatterns(pluginName), ...(configFiles.get(pluginName) ?? [])];
279
+ configFiles.delete(pluginName);
280
+ await runPlugin(pluginName, compact(patterns));
281
+ remainingPlugins.delete(pluginName);
282
+ }
283
+ do {
284
+ for (const [pluginName, dependencies] of configFiles.entries()) {
285
+ configFiles.delete(pluginName);
286
+ await runPlugin(pluginName, Array.from(dependencies));
287
+ }
288
+ } while (remainingPlugins.size > 0 && configFiles.size > 0);
289
+ debugLogArray(name, 'Plugin dependencies', () => compact(inputs.map(toDebugString)));
290
+ return inputs;
252
291
  }
253
292
  onDispose() {
254
293
  this.cache.reconcile();
@@ -1,2 +1,3 @@
1
- import type { GetDependenciesFromScriptsOptions } from './types.js';
2
- export declare const getBinariesFromScript: (script: string, options: GetDependenciesFromScriptsOptions) => string[];
1
+ import type { GetInputsFromScriptsOptions } from '../types/config.js';
2
+ import { type Input } from '../util/input.js';
3
+ export declare const getDependenciesFromScript: (script: string, options: GetInputsFromScriptsOptions) => Input[];