|
1 | 1 | import type { PluginManifestRegistry } from "../plugins/manifest-registry.js"; |
2 | | -import { detectPluginAutoEnableCandidates } from "./plugin-auto-enable.detect.js"; |
3 | 2 | import { |
4 | 3 | materializePluginAutoEnableCandidatesInternal, |
| 4 | +resolveConfiguredPluginAutoEnableCandidates, |
5 | 5 | resolvePluginAutoEnableManifestRegistry, |
| 6 | +resolvePluginAutoEnableReadiness, |
6 | 7 | } from "./plugin-auto-enable.shared.js"; |
7 | 8 | import type { |
8 | 9 | PluginAutoEnableCandidate, |
@@ -45,11 +46,27 @@ export function applyPluginAutoEnable(params: {
|
45 | 46 | env?: NodeJS.ProcessEnv; |
46 | 47 | manifestRegistry?: PluginManifestRegistry; |
47 | 48 | }): PluginAutoEnableResult { |
48 | | -const candidates = detectPluginAutoEnableCandidates(params); |
| 49 | +const env = params.env ?? process.env; |
| 50 | +const config = params.config ?? {}; |
| 51 | +const readiness = resolvePluginAutoEnableReadiness(config, env); |
| 52 | +if (!readiness.mayNeedAutoEnable) { |
| 53 | +return { config, changes: [], autoEnabledReasons: {} }; |
| 54 | +} |
| 55 | +const manifestRegistry = resolvePluginAutoEnableManifestRegistry({ |
| 56 | + config, |
| 57 | + env, |
| 58 | +manifestRegistry: params.manifestRegistry, |
| 59 | +}); |
| 60 | +const candidates = resolveConfiguredPluginAutoEnableCandidates({ |
| 61 | + config, |
| 62 | + env, |
| 63 | +registry: manifestRegistry, |
| 64 | +configuredChannelIds: readiness.configuredChannelIds, |
| 65 | +}); |
49 | 66 | return materializePluginAutoEnableCandidates({ |
50 | | -config: params.config, |
| 67 | + config, |
51 | 68 | candidates, |
52 | | -env: params.env, |
53 | | -manifestRegistry: params.manifestRegistry, |
| 69 | + env, |
| 70 | + manifestRegistry, |
54 | 71 | }); |
55 | 72 | } |