@@ -20,7 +20,7 @@ export class PluginCollection {
2020 private resourceToPluginMapping = new Map < string , string > ( )
2121 private pluginToResourceMapping = new Map < string , string [ ] > ( )
2222
23- async initialize ( project : Project ) : Promise < Map < string , string [ ] > > {
23+ async initialize ( project ? : Project ) : Promise < Map < string , string [ ] > > {
2424 const plugins = await this . resolvePlugins ( project ) ;
2525
2626 for ( const plugin of plugins ) {
@@ -62,15 +62,17 @@ export class PluginCollection {
6262 }
6363
6464 async apply ( planResponseData : PlanResponseData [ ] ) : Promise < void > {
65- for ( const { planId, resourceType } of planResponseData ) {
65+ for ( const plan of planResponseData ) {
66+ const { resourceType } = plan ;
67+
6668 ctx . subprocessStarted ( SubProcessName . APPLYING_RESOURCE , resourceType ) ;
6769
6870 const pluginName = this . resourceToPluginMapping . get ( resourceType ) ;
6971 if ( ! pluginName ) {
7072 throw new Error ( `Internal error: unable to determine plugin for apply: ${ resourceType } ` ) ;
7173 }
7274
73- await this . plugins . get ( pluginName ) ! . apply ( planId ) ;
75+ await this . plugins . get ( pluginName ) ! . apply ( plan ) ;
7476
7577 ctx . subprocessFinished ( SubProcessName . APPLYING_RESOURCE , resourceType ) ;
7678 }
@@ -82,15 +84,19 @@ export class PluginCollection {
8284 }
8385 }
8486
85- private async resolvePlugins ( project : Project ) : Promise < Plugin [ ] > {
87+ private async resolvePlugins ( project ? : Project ) : Promise < Plugin [ ] > {
8688 const pluginDefinitions : Record < string , string > = {
8789 ...DEFAULT_PLUGINS ,
88- ...project . projectConfig ?. plugins ,
90+ ...project ? .projectConfig ?. plugins ,
8991 } ;
9092
91- return Promise . all ( Object . entries ( pluginDefinitions ) . map ( ( [ name , version ] ) =>
93+ const configPlugins = await Promise . all ( Object . entries ( pluginDefinitions ) . map ( ( [ name , version ] ) =>
9294 PluginResolver . resolve ( name , version )
9395 ) ) ;
96+
97+ const existingPlugins = await PluginResolver . resolveExisting ( Object . keys ( pluginDefinitions ) ) ;
98+
99+ return [ ...existingPlugins , ...configPlugins ] ;
94100 }
95101
96102 private async initializePlugins ( plugins : Plugin [ ] ) : Promise < Map < string , string [ ] > > {
0 commit comments