@@ -15,9 +15,11 @@ function isCompatiblePlugin(obj: any, propertyName: string = 'isGitProxyPlugin')
1515 // valid plugin objects will have the appropriate property set to true
1616 // if the prototype chain is exhausted, return false
1717 while ( obj != null ) {
18- if ( Object . prototype . hasOwnProperty . call ( obj , propertyName ) &&
18+ if (
19+ Object . prototype . hasOwnProperty . call ( obj , propertyName ) &&
1920 obj . isGitProxyPlugin &&
20- Object . keys ( obj ) . includes ( 'exec' ) ) {
21+ Object . keys ( obj ) . includes ( 'exec' )
22+ ) {
2123 return true ;
2224 }
2325 obj = Object . getPrototypeOf ( obj ) ;
@@ -55,42 +57,48 @@ class PluginLoader {
5557 */
5658 async load ( ) : Promise < void > {
5759 try {
58- const modulePromises = this . targets . map ( target =>
59- this . _loadPluginModule ( target ) . catch ( error => {
60+ const modulePromises = this . targets . map ( ( target ) =>
61+ this . _loadPluginModule ( target ) . catch ( ( error ) => {
6062 console . error ( `Failed to load plugin: ${ error } ` ) ; // TODO: log.error()
6163 return Promise . reject ( error ) ; // Or return an error object to handle it later
62- } )
64+ } ) ,
6365 ) ;
6466
6567 const moduleResults = await Promise . allSettled ( modulePromises ) ;
6668 const loadedModules = moduleResults
67- . filter ( ( result ) : result is PromiseFulfilledResult < any > => result . status === 'fulfilled' && result . value !== null )
68- . map ( result => result . value ) ;
69+ . filter (
70+ ( result ) : result is PromiseFulfilledResult < any > =>
71+ result . status === 'fulfilled' && result . value !== null ,
72+ )
73+ . map ( ( result ) => result . value ) ;
6974
7075 console . log ( `Found ${ loadedModules . length } plugin modules` ) ; // TODO: log.debug()
7176
72- const pluginTypeResultPromises = loadedModules . map ( mod =>
73- this . _getPluginObjects ( mod ) . catch ( error => {
77+ const pluginTypeResultPromises = loadedModules . map ( ( mod ) =>
78+ this . _getPluginObjects ( mod ) . catch ( ( error ) => {
7479 console . error ( `Failed to cast plugin objects: ${ error } ` ) ; // TODO: log.error()
7580 return Promise . reject ( error ) ; // Or return an error object to handle it later
76- } )
81+ } ) ,
7782 ) ;
7883
7984 const settledPluginTypeResults = await Promise . allSettled ( pluginTypeResultPromises ) ;
8085 /**
8186 * @type {PluginTypeResult[] } List of resolved PluginTypeResult objects
8287 */
8388 const pluginTypeResults = settledPluginTypeResults
84- . filter ( ( result ) : result is PromiseFulfilledResult < any > => result . status === 'fulfilled' && result . value !== null )
85- . map ( result => result . value ) ;
89+ . filter (
90+ ( result ) : result is PromiseFulfilledResult < any > =>
91+ result . status === 'fulfilled' && result . value !== null ,
92+ )
93+ . map ( ( result ) => result . value ) ;
8694
8795 for ( const result of pluginTypeResults ) {
88- this . pushPlugins . push ( ...result . pushAction )
89- this . pullPlugins . push ( ...result . pullAction )
96+ this . pushPlugins . push ( ...result . pushAction ) ;
97+ this . pullPlugins . push ( ...result . pullAction ) ;
9098 }
9199
92100 const combinedPlugins = [ ...this . pushPlugins , ...this . pullPlugins ] ;
93- combinedPlugins . forEach ( plugin => {
101+ combinedPlugins . forEach ( ( plugin ) => {
94102 console . log ( `Loaded plugin: ${ plugin . constructor . name } ` ) ;
95103 } ) ;
96104 } catch ( error ) {
@@ -128,15 +136,17 @@ class PluginLoader {
128136 console . log ( 'found pull plugin' , potentialModule . constructor . name ) ;
129137 plugins . pullAction . push ( potentialModule ) ;
130138 } else {
131- console . error ( `Error: Object ${ potentialModule . constructor . name } does not seem to be a compatible plugin type` ) ;
139+ console . error (
140+ `Error: Object ${ potentialModule . constructor . name } does not seem to be a compatible plugin type` ,
141+ ) ;
132142 }
133143 }
134144
135145 // handles the default export case
136146 // `module.exports = new ProxyPlugin()` in CJS or `exports default new ProxyPlugin()` in ESM
137147 // the "module" is a single object that could be a plugin
138148 if ( isCompatiblePlugin ( pluginModule ) ) {
139- handlePlugin ( pluginModule )
149+ handlePlugin ( pluginModule ) ;
140150 } else {
141151 // handle the typical case of a module which exports multiple objects
142152 // module.exports = { x, y } (CJS) or multiple `export ...` statements (ESM)
@@ -173,11 +183,11 @@ class PushActionPlugin extends ProxyPlugin {
173183 * Wrapper class which contains at least one function executed as part of the action chain for git push operations.
174184 * The function must be called `exec` and take in two parameters: an Express Request (req) and the current Action
175185 * executed in the chain (action). This function should return a Promise that resolves to an Action.
176- *
186+ *
177187 * Optionally, child classes which extend this can simply define the `exec` function as their own property.
178188 * This is the preferred implementation when a custom plugin (subclass) has its own state or additional methods
179189 * that are required.
180- *
190+ *
181191 * @param {function } exec - A function that:
182192 * - Takes in an Express Request object as the first parameter (`req`).
183193 * - Takes in an Action object as the second parameter (`action`).
@@ -201,11 +211,11 @@ class PullActionPlugin extends ProxyPlugin {
201211 * Wrapper class which contains at least one function executed as part of the action chain for git pull operations.
202212 * The function must be called `exec` and take in two parameters: an Express Request (req) and the current Action
203213 * executed in the chain (action). This function should return a Promise that resolves to an Action.
204- *
214+ *
205215 * Optionally, child classes which extend this can simply define the `exec` function as their own property.
206216 * This is the preferred implementation when a custom plugin (subclass) has its own state or additional methods
207217 * that are required.
208- *
218+ *
209219 * @param {function } exec - A function that:
210220 * - Takes in an Express Request object as the first parameter (`req`).
211221 * - Takes in an Action object as the second parameter (`action`).
@@ -218,9 +228,4 @@ class PullActionPlugin extends ProxyPlugin {
218228 }
219229}
220230
221- export {
222- PluginLoader ,
223- PushActionPlugin ,
224- PullActionPlugin ,
225- isCompatiblePlugin ,
226- }
231+ export { PluginLoader , PushActionPlugin , PullActionPlugin , isCompatiblePlugin } ;
0 commit comments