
Security News
PyPI Expands Trusted Publishing to GitLab Self-Managed as Adoption Passes 25 Percent
PyPI adds Trusted Publishing support for GitLab Self-Managed as adoption reaches 25% of uploads
Minimal, convention-based, inversion-of-control/dependency injection for Node.js. Originally written for Appraise.
Designed to work with minimal impact on client code and make unit testing easy.
npm inistall minidi
For a quick example, check out the Example Project. Run node main.js in the example directory to see it in action.
Each component should have a constructor with a single argument, a key-value map for the configuration. The component can access other components or any generic configuration passed to the component builder simply by accessing properties of the configuration. MiniDi will dynamically instantiate components as they are needed.
For unit testing purposes, instantiate the component class directly and pass mock collaborators or test stubs into the second argument.
module.exports = class Sender {
// constructor for components receives all other components
constructor(config) {
// just ask for a component by name, it will be lazily-initialised if required
this.receiver = config.receiver;
}
send(message) {
this.receiver.receive(message);
}
};
Create a new instance of minidi and pass in two arguments: component objects and component modules.
__dirname to ensure that local paths are resolved based on the current file, for example path.join(__dirname, 'sender').Just access any component directly as a property of the container instance, using the name from the components map.
const MiniDi = require('minidi'),
path = require('path'),
// static properties to pass into components
config = {
name: 'Tom'
},
// dynamic components to instantiate
modules = {
//keys are component names
//values are module names or local file paths with
sender: 'some-node-module',
receiver: path.join(__dirname, 'receiver')
},
minidi = new MiniDi(config, modules);
minidi.singer.sing(/*... */); // just access a component by property name
MIT, see the License
FAQs
Minimal, convention-based, inversion-of-control/dependency injection for Node
We found that minidi demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
PyPI adds Trusted Publishing support for GitLab Self-Managed as adoption reaches 25% of uploads

Research
/Security News
A malicious Chrome extension posing as an Ethereum wallet steals seed phrases by encoding them into Sui transactions, enabling full wallet takeover.

Security News
Socket is heading to London! Stop by our booth or schedule a meeting to see what we've been working on.