A package.json based plugin loading system for the Magnum DI dependency injection framework.
$ npm install magnum-loader --save
Magnum Loader is a topologically ordered, hook based plugin system. Plugins can be automatically loaded from the requiring modules package.json, as well as from a configurable plugin directory.
Plugin hook functions are provided several parameters with which to interact with the loader as well as several context dependent properties bound to "this" inside the hook functions.
Plugin Hooks are run in layer order, each plugin has the ability to add dependencies to the Magnum DI injector, allowing subsequent layers access to the dependencies added by previous layers.
A plugin module can return one plugin or several in an array, and each individual plugin can inject a single dependency object, merge with an existing object, inject a factory function, or return an array of the above.
var dependencies = ;var loader =var options =prefix: 'myframework' // loads myframework-*layers: 'core' 'dependency' 'platform'logger: consoleloader =loader;loaderloaderloaderloader// Listen for Interrupt and attempt to gracefully stop// our plugins.process;