Dependency injection container creation by config, inspired by mezzio-config.
- node: 16
- @chubbyts/chubbyts-dic: ^1.2.0
- @chubbyts/chubbyts-dic-types: ^1.2.1
Through NPM as @chubbyts/chubbyts-dic-config.
npm i @chubbyts/chubbyts-dic-config@^1.2.0
import {
createContainerByConfigFactory,
ConfigFactory,
ConfigDelegator,
} from '@chubbyts/chubbyts-dic-config/dist/dic-config';
const containerByConfigFactory = createContainerByConfigFactory({
dependencies: {
services: new Map<string, any>(),
factories: new Map<string, ConfigFactory>(),
aliases: new Map<string, string>(),
delegators: new Map<string, Array<ConfigDelegator>>(),
},
// ... other configuration
});
const container = containerByConfigFactory();
2024 Dominik Zogg