- Multi-interface services:
factory()now takesprovideas an array of IIDs. A single-interface service must useprovide: [MY_IID](previouslyprovide: MY_IID). onLoadcallback signature: now receives an array of IIDs —(iids, container)instead of(iid, container).ServiceFactoryshape: theinterfaceproperty is replaced byprovide: InterfaceId[]. The loaded value is a single object that must satisfy every provided interface.
- A single factory can now provide multiple interfaces; the
loadresult is typed as the intersection of all provided IID types (e.g.Adder & Multiplier) via the newFactoryLoadResulttype. - Async multi-interface factories share one load promise across all their IIDs, so the load runs only once even when several interfaces are fetched.
- Invalid service registrations (not created via
factory()orbundle()) now throw anAsimoErrorat container creation.
Full rewrite of the asimo library. ~2KB gzipped, zero dependencies.
- Complete TypeScript rewrite with
verbatimModuleSyntaxand strict mode ContainerreplacesIoCContainerwith improved generics and defaultContainer<never>when no dependencies are defined- Compile-time dependency validation via branded error types (
ServiceDependencyNotRegistered,RetryNotSupportedForSyncIID) - Phantom-based type invariance ensures correct IID tracking through the container hierarchy
- Lazy bundle loading (
bundle()): on-demand async service groups with deduplication, circular detection, and scope filtering - Retry with exponential backoff: configurable per-factory, per-bundle, or per-container via
config.maxRetries/config.retryDelayMs inspect()/dump()/entries(): runtime introspection with'loaded' | 'registered' | 'pending'status per servicehas(): check if an IID is available in the container hierarchyonLoad/onErrorcallbacks: per-container lifecycle hooks onAsimoConfig- Parent containers: frozen hierarchy with immutable
parentsarray, child-over-parent shadowing - Container name & services validation: prevents slashes in names and non-array services at creation time
AsimoErrorwithcontainerpath on every throwAsimoLoadError extends AsimoErrorwithcausefor retry exhaustion
- ESM: 5.1 kB minified / 1.9 kB gzipped
- UMD: 5.4 kB minified / 2.0 kB gzipped