@@ -13,6 +13,7 @@ import {
1313} from "./config-state.js" ;
1414import { getCurrentPluginMetadataSnapshot } from "./current-plugin-metadata-snapshot.js" ;
1515import type { PluginDiscoveryResult } from "./discovery.js" ;
16+ import type { PluginManifestRegistry } from "./manifest-registry.js" ;
1617
1718type PluginActivationCompatConfig = {
1819 enablementPluginIds ?: readonly string [ ] ;
@@ -58,6 +59,7 @@ type BundledPluginCompatibleActivationParams = {
5859 onlyPluginIds ?: readonly string [ ] ;
5960 } ) => string [ ] ;
6061 discovery ?: PluginDiscoveryResult ;
62+ manifestRegistry ?: PluginManifestRegistry ;
6163} ;
6264
6365export function withActivatedPluginIds ( params : {
@@ -147,15 +149,18 @@ function applyPluginAutoEnableForActivation(params: {
147149 env : NodeJS . ProcessEnv ;
148150 workspaceDir ?: string ;
149151 discovery ?: PluginDiscoveryResult ;
152+ manifestRegistry ?: PluginManifestRegistry ;
150153} ) {
151- const currentSnapshot = getCurrentPluginMetadataSnapshot ( {
152- config : params . config ,
153- env : params . env ,
154- workspaceDir : params . workspaceDir ,
155- allowWorkspaceScopedSnapshot : true ,
156- } ) ;
154+ const currentSnapshot = params . manifestRegistry
155+ ? undefined
156+ : getCurrentPluginMetadataSnapshot ( {
157+ config : params . config ,
158+ env : params . env ,
159+ workspaceDir : params . workspaceDir ,
160+ allowWorkspaceScopedSnapshot : true ,
161+ } ) ;
157162 const defaultDiscoverySnapshot =
158- normalizePluginsConfig ( params . config . plugins ) . loadPaths . length === 0
163+ ! params . manifestRegistry && normalizePluginsConfig ( params . config . plugins ) . loadPaths . length === 0
159164 ? getCurrentPluginMetadataSnapshot ( {
160165 env : params . env ,
161166 workspaceDir : params . workspaceDir ,
@@ -164,12 +169,15 @@ function applyPluginAutoEnableForActivation(params: {
164169 } )
165170 : undefined ;
166171 const currentManifestRegistry =
167- currentSnapshot ?. manifestRegistry ?? defaultDiscoverySnapshot ?. manifestRegistry ;
172+ params . manifestRegistry ??
173+ currentSnapshot ?. manifestRegistry ??
174+ defaultDiscoverySnapshot ?. manifestRegistry ;
168175 return applyPluginAutoEnable ( {
169176 config : params . config ,
170177 env : params . env ,
171178 manifestRegistry : currentManifestRegistry ,
172- discovery : params . discovery ,
179+ discovery :
180+ params . discovery ?? currentSnapshot ?. discovery ?? defaultDiscoverySnapshot ?. discovery ,
173181 } ) ;
174182}
175183
@@ -181,6 +189,7 @@ function resolvePluginActivationSnapshot(params: {
181189 workspaceDir ?: string ;
182190 applyAutoEnable ?: boolean ;
183191 discovery ?: PluginDiscoveryResult ;
192+ manifestRegistry ?: PluginManifestRegistry ;
184193} ) : PluginActivationInputs {
185194 const env = params . env ?? process . env ;
186195 const rawConfig = params . rawConfig ?? params . resolvedConfig ;
@@ -193,6 +202,7 @@ function resolvePluginActivationSnapshot(params: {
193202 env,
194203 workspaceDir : params . workspaceDir ,
195204 discovery : params . discovery ,
205+ manifestRegistry : params . manifestRegistry ,
196206 } ) ;
197207 resolvedConfig = autoEnabled . config ;
198208 autoEnabledReasons = autoEnabled . autoEnabledReasons ;
@@ -219,6 +229,7 @@ function resolvePluginActivationInputs(params: {
219229 compat ?: PluginActivationCompatConfig ;
220230 applyAutoEnable ?: boolean ;
221231 discovery ?: PluginDiscoveryResult ;
232+ manifestRegistry ?: PluginManifestRegistry ;
222233} ) : PluginActivationInputs {
223234 const env = params . env ?? process . env ;
224235 const snapshot = resolvePluginActivationSnapshot ( {
@@ -229,6 +240,7 @@ function resolvePluginActivationInputs(params: {
229240 workspaceDir : params . workspaceDir ,
230241 applyAutoEnable : params . applyAutoEnable ,
231242 discovery : params . discovery ,
243+ manifestRegistry : params . manifestRegistry ,
232244 } ) ;
233245 const config = applyPluginCompatibilityOverrides ( {
234246 config : snapshot . config ,
@@ -257,6 +269,7 @@ export function resolveBundledPluginCompatibleActivationInputs(
257269 workspaceDir : params . workspaceDir ,
258270 applyAutoEnable : params . applyAutoEnable ,
259271 discovery : params . discovery ,
272+ manifestRegistry : params . manifestRegistry ,
260273 } ) ;
261274 const shouldResolveCompatPluginIds = shouldResolveBundledCompatPluginIds ( {
262275 compatMode : params . compatMode ,
@@ -280,6 +293,7 @@ export function resolveBundledPluginCompatibleActivationInputs(
280293 compatPluginIds,
281294 } ) ,
282295 discovery : params . discovery ,
296+ manifestRegistry : params . manifestRegistry ,
283297 } ) ;
284298
285299 return {
@@ -302,6 +316,7 @@ export function resolveBundledPluginCompatibleLoadValues(
302316 env,
303317 workspaceDir : params . workspaceDir ,
304318 discovery : params . discovery ,
319+ manifestRegistry : params . manifestRegistry ,
305320 } ) ;
306321 resolvedConfig = autoEnabled . config ;
307322 autoEnabledReasons = autoEnabled . autoEnabledReasons ;
0 commit comments