Migration Guide - v1 to v2
@brushy/di v2 splits the library into focused packages while keeping the umbrella install.
Starting a new project? See Getting Started for install order by stack.
Package structure
Import changes
Typed tokens (new)
useInjectLazy (lazy proxy)
useInjectLazy returns a proxy that resolves the service on first property or method access:
Deprecated
useLazyInject→ useuseInjectLazy
Component injection (React)
Register UI on the container withuseValue. Prefer createToken() (Symbol at runtime) over string tokens:
useInjectComponent(SIDEBAR). Types infer from the registered component; explicit generics are optional.
See Component Injection.
OpenTelemetry (optional)
@brushy/di-otel or use the umbrella /otel subpath. Requires @opentelemetry/api.
React Native
Install@brushy/di + react. Metro resolves react-native field automatically. No decorators required.
Register a custom dev error renderer for useInjectComponent:
Backend
Use@brushy/di-core or @brushy/di with server utilities. Request scope cleanup remains manual or use middleware pattern (see server docs).