-
Notifications
You must be signed in to change notification settings - Fork 0
Plugins
ModulePluginInterface
Interface
The ModulePluginInterface provides methods for integrating plugins into the container lifecycle. These methods allow adding scanner and graph plugins to extend the application's functionality.
addScannerPlugin
Method
The addScannerPlugin method is designed to integrate scanner plugins into the graph traversal lifecycle. Scanner plugins perform operations related to graph analysis. This method accepts one or more scanners and adds them to the container.
Parameters
scanner
: A scanner or an array of scanners that implement the ScannerPluginInterface.
class MyScannerPlugin implements ScannerPluginInterface {
async scan(graph: ScannerGraphInterface): Promise<void> {
// Implementation of graph scanning logic
}
}
const app: ModulePluginInterface = // initialize the application
app.addScannerPlugin(new MyScannerPlugin());
ScannerPluginInterface
Interface
The ScannerPluginInterface defines the scan method, which is called to perform graph scanning operations.
addGraphPlugin
Method
The addGraphPlugin method is designed to integrate graph plugins that work with the result of the module graph construction. Graph plugins can add nodes, edges, and perform various actions during the graph construction.
Parameters
plugin
: A graph plugin or an array of plugins that implement the GraphPluginInterface.
Methods of the GraphPluginInterface
-
onAddModuleNode<T extends Node>(node: T): T
: Hook called before adding a module node to the graph. -
onAddModuleImportEdge<T extends Edge>(edge: T)
: T: Hook called before adding a module import edge to the graph. -
onAddProviderNode<T extends Node>(node: T): T
: Hook called before adding a provider node to the graph. -
onAddProviderEdge<T extends Edge>(edge: T): T
: Hook called before adding a provider edge to the graph. -
parseModule<T extends ModuleContainerInterface = ModuleContainerInterface>(module: T, graph: ModuleGraphPlugin)
: void: Method called after analyzing the module dependencies and before analyzing the provider dependencies. -
onAddUseFactoryDependency<T extends Edge>(edge: T): T
: Hook called before adding a useFactory dependency. -
onAddUseClassDependency<T extends Edge>(edge: T): T
: Hook called before adding a useClass dependency. *onAddClassDependency<T extends Edge>(edge: T): T
: Hook called before adding a regular class dependency.