@praxisjs/di
Changelog for @praxisjs/di — dependency injection with @Injectable, @Inject, @Scope, and token-based injection.
@praxisjs/di
1.3.15
Depends on the other @praxisjs/* packages through caret ranges (^2.3.0) instead of exact versions, so npm no longer installs a second copy of a package when two releases disagree, and upgrades no longer end in peer conflicts.
1.3.14
The published package no longer contains the package's tests (compiled tests in dist/__tests__, test sources in src/__tests__).
The package is marked "sideEffects": false, so bundlers leave out the modules of it that an app does not use.
@Inject and @InjectContainer throw a TypeError when the class is defined if they decorate an accessor instead of a plain field, naming the member to fix (see assertFieldContext).
Bug fix: a dependency cycle that runs through inject() calls in constructors (class A { b = inject(B) }, class B { a = inject(A) }) now throws [DI] Circular dependency detected: A → B → A. It used to recurse until the stack overflowed, reported as a failed instantiation.
inject() and container.resolve() return cached singletons and token values without allocating, about seven times faster. @Injectable registers the class itself instead of a subclass that added lifecycle methods to every service. @Inject keeps the resolved service on the instance and shares one accessor across instances, and @InjectContainer reads the scope directly.
1.3.3
Updated dependencies — @praxisjs/[email protected].
1.3.2
Updated dependencies — @praxisjs/[email protected], @praxisjs/[email protected].
1.3.1
Updated dependencies — @praxisjs/[email protected].
1.3.0
Add inject() — functional alternative to @Inject for use outside component context (route guards, plain functions, module initializers). Resolves from the same global container as @Inject. Supports both class constructors and Token values.
import { inject } from '@praxisjs/di'
const auth = inject(AuthService)
const url = inject(API_URL_TOKEN)1.2.8
Updated dependencies — @praxisjs/[email protected], @praxisjs/[email protected].
1.2.7
Updated dependencies — @praxisjs/[email protected].
1.2.6
Updated dependencies — @praxisjs/[email protected].
1.2.5
Updated dependencies — @praxisjs/[email protected], @praxisjs/[email protected].
1.2.4
Updated dependencies — @praxisjs/[email protected], @praxisjs/[email protected].
1.2.3
Updated dependencies — @praxisjs/[email protected], @praxisjs/[email protected].
1.2.2
Updated dependencies — @praxisjs/[email protected], @praxisjs/[email protected].
1.2.1
Refactored @Injectable and @Scope to use ClassBehavior / createClassDecorator from @praxisjs/decorators. Simplified Container.instantiate to plain new target(), removing internal TC39 metadata maps (constructorDepsMap, propDepsMap) and the associated setConstructorDeps / setPropDep helpers. No API changes.
1.2.0
Removed reflect-metadata dependency. Dependency metadata is now stored in WeakMaps instead of the reflect-metadata polyfill. Reduces external dependencies with no API changes. setConstructorDeps and setPropDep helpers exported for advanced manual metadata management.
1.1.4
Refreshed workspace dependencies for stability and security (@types/node, eslint, unocss). Updated dependencies — @praxisjs/[email protected].
1.1.3
Updated dependencies — @praxisjs/[email protected], @praxisjs/[email protected].
1.1.2
Updated dependencies — @praxisjs/[email protected].
1.1.1
Updated dependencies — @praxisjs/[email protected].
1.1.0
Circular dependency detection. The container now detects circular dependencies during resolution and throws a descriptive error showing the full chain — e.g. ServiceA → ServiceB → ServiceA.
1.0.0 — Breaking
Full decorator-based API. Functional APIs removed:
| Removed | Replacement |
|---|---|
useService() | @Inject(Service) on a field |
createScope() | @Scope(configure?) on the class |
Type Scope | Renamed to ScopeType |
The new @Scope decorator creates a child container scoped to each class instance, allowing feature modules and dialogs to have isolated dependency graphs.
0.2.0
Migrated to TC39 decorator context API.
0.1.0
Initial beta release.