Skip to content

Releases: Anderson-Reges/syrinject

v2.0.0

Choose a tag to compare

@Anderson-Reges Anderson-Reges released this 21 Sep 15:23
d8e8533

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.0

The 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) and registerClass(X, options) ignored the class's static deps / dependencies and the constructor received undefined. They now fall back to them when options.deps is not given. Explicit options.deps still takes priority.

    class UserService {
      static deps = [LoggerToken];
      constructor(private readonly logger: LoggerService) {}
    }
    
    container.register(UserService, UserService, { singleton: true }); // logger is injected
  • Singletons resolving to undefined are created once. A singleton factory or class whose value is undefined was rebuilt on every resolve. 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 new registerClass token.
  • Added CHANGELOG.md.

Full diff: v1.0.0...v2.0.0 · PR #1

v1.0.0

Choose a tag to compare

@Anderson-Reges Anderson-Reges released this 02 Feb 19:19

Release notes

Date: February 2, 2026

v1.0.0

Added

  • Remove assets file from bundle

Full Changelog: Chore...v1.0.0

v0.1.2

Choose a tag to compare

@Anderson-Reges Anderson-Reges released this 01 Feb 19:25

Release notes

Date: February 1, 2026

v0.1.2

Added

  • The README content has been added.

v0.1.1

Choose a tag to compare

@Anderson-Reges Anderson-Reges released this 01 Feb 18:40

Release notes

Date: February 1, 2026

v0.1.1

Added

  • Test cases for the container have been added.