Added
Provider targeting
- Tag type and constants
TagValuetype for string or symbol tag valuesTAG_ROOTconstant - automatically assigned to injectors without parent that don't explicitly
specify a tagTAG_SINKconstant - sink injectors ignoreatproperty and register all incoming providers
locallyInjectorOptionsnow has optionaltag?: TagValue | nullproperty- Injectors automatically tagged as
TAG_ROOTwhen no parent and no tag specified - Child injectors have
nulltag by default unless explicitly tagged getTag(): symbol | nullmethod to retrieve injector's normalized tag
- Provider targeting with
atproperty- All provider types (
ValueProvider,ClassProvider,FactoryProvider,ExistingProvider) now
support optionalat?: TagValueproperty - Providers with
atproperty will only register on injectors with matching tags in the hierarchy - Provider registration delegates up the hierarchy until a matching tag is found
- Sink injectors (
TAG_SINK) ignoreatproperty and register all providers locally - Providers without
atproperty register on the current injector (existing behavior)
- All provider types (
CopyOptionsnow supportstag?: TagValue | nullproperty- When not specified, copied injector preserves the original injector's tag
- When explicitly set (including
null), copied injector uses the provided tag value
ForkOptionsinterface for configuring child injector creation withinjector.fork()defaultAllowOverrides?: boolean- Override setting for child injector (default: current
instance's setting)tag?: TagValue | null- Tag for child injector (default:null)
Misc:
- Added
getParent(): Injector | nullmethod to retrieve injector's parent newTestInjector()now defaults toTAG_SINKtag for predictable test isolation behavior