/** * Lightweight DI Container Implementation. * * Supports singleton, scoped, and transient lifetimes. * Async-first design for services that require initialization. */ import type { IContainer, Lifetime, Factory, SyncFactory } from './IContainer'; /** * Lightweight DI Container. */ export declare class Container implements IContainer { private readonly registrations; private readonly singletons; private readonly scopedInstances; private readonly parent; private disposed; constructor(parent?: Container | null); /** * Register a service factory with a lifetime scope. */ register(token: symbol, factory: Factory, lifetime: Lifetime): void; /** * Register a synchronous factory (wrapped as async). */ registerSync(token: symbol, factory: SyncFactory, lifetime: Lifetime): void; /** * Register an existing instance as a singleton. */ registerInstance(token: symbol, instance: T): void; /** * Resolve a service by its token. */ resolve(token: symbol): Promise; /** * Check if a service is registered (including parent). */ isRegistered(token: symbol): boolean; /** * Create a child scope. * Singletons are shared, scoped services get fresh instances. */ createScope(): IContainer; /** * Dispose the container and all disposable services. */ dispose(): Promise; /** * Get registration from this container or parent. */ private getRegistration; /** * Resolve a singleton (shared with parent if exists). */ private resolveSingleton; /** * Resolve a scoped instance (per-scope). */ private resolveScoped; /** * Get the root container. */ private getRoot; /** * Throw if disposed. */ private ensureNotDisposed; } /** * Create a new root container. */ export declare function createContainer(): IContainer; //# sourceMappingURL=Container.d.ts.map