Repository navigation
Releases: Anderson-Reges/syrinject
Release list
v2.0.0
Fixes class registration in Container: the shorthand forms now inject static deps, registerClass(X) registers under the class itself, and singletons that resolve to undefined are cached.
npm install syrinject@2.0.0⚠️ Breaking change
registerClass(X) now uses the class X as the token instead of the string X.name.
container.registerClass(UserService, { singleton: true });
container.resolve(UserService); // ✅ 2.0.0
container.resolve("UserService"); // ❌ throws DependencyNotFoundError in 2.0.0The old string token made resolve(UserService) fail, changed under minification (class a) and collided for two classes with the same name. If you resolve by name today, switch to the class, or register the string token explicitly: container.register("UserService", UserService).
Fixes
-
Shorthand registration now reads
static deps.register(X, X, options)andregisterClass(X, options)ignored the class's staticdeps/dependenciesand the constructor receivedundefined. They now fall back to them whenoptions.depsis not given. Explicitoptions.depsstill takes priority.class UserService { static deps = [LoggerToken]; constructor(private readonly logger: LoggerService) {} } container.register(UserService, UserService, { singleton: true }); // logger is injected
-
Singletons resolving to
undefinedare created once. A singleton factory or class whose value isundefinedwas rebuilt on everyresolve. It is now cached like any other value.
The provider form register(X, { useClass: X, ... }) was not affected and behaves the same.
Docs
- README documents the shorthand
register(token, Class, options?)form and the newregisterClasstoken. - Added
CHANGELOG.md.
Full diff: v1.0.0...v2.0.0 · PR #1
v1.0.0
Release notes
Date: February 2, 2026
v1.0.0
Added
- Remove assets file from bundle
Full Changelog: Chore...v1.0.0
v0.1.2
Release notes
Date: February 1, 2026
v0.1.2
Added
- The README content has been added.
v0.1.1
Release notes
Date: February 1, 2026
v0.1.1
Added
- Test cases for the container have been added.