@lppedd/di-wise-neo 0.26.0 → 0.26.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -440,7 +440,10 @@ interface Container {
440
440
  */
441
441
  register<Value, ProviderValue extends Value>(token: Token<Value>, provider: ValueProvider<ProviderValue>): Container;
442
442
  /**
443
- * Removes all registrations for the given token from the container's internal registry.
443
+ * Removes registrations for the given token from the container's internal registry.
444
+ *
445
+ * When a `name` is provided, only the registration with that `name` is removed.
446
+ * Otherwise, all registrations are removed.
444
447
  *
445
448
  * Returns an array of the distinct values that were cached by this container for the
446
449
  * removed registrations. Values from {@link ValueProvider} registrations are not included,
package/dist/es/index.mjs CHANGED
@@ -790,7 +790,7 @@ function isDisposable(value) {
790
790
  // Register the class itself
791
791
  this.myTokenRegistry.put(Class, registration);
792
792
  // Register additional aliasing tokens specified via class decorators.
793
- // These tokens will point to the original Class token and will have the same scope.
793
+ // These tokens will point to the original class token and will have the same scope.
794
794
  for (const aliasToken of metadata.tokenRef.getRefTokens()){
795
795
  this.myTokenRegistry.put(aliasToken, {
796
796
  name: name,
@@ -814,9 +814,10 @@ function isDisposable(value) {
814
814
  check(name === undefined || name.trim(), `name qualifier for token ${getTokenName(token)} must not be empty`);
815
815
  if (isClassProvider(provider)) {
816
816
  const metadata = getMetadata(provider.useClass);
817
+ // An explicit provider name overrides what is specified via @Named
818
+ const effectiveName = name ?? metadata.name;
817
819
  const registration = {
818
- // An explicit provider name overrides what is specified via @Named
819
- name: metadata.name ?? name,
820
+ name: effectiveName,
820
821
  provider: metadata.provider,
821
822
  options: {
822
823
  // Explicit registration options override what is specified via class decorators (e.g., @Scoped)
@@ -825,16 +826,17 @@ function isDisposable(value) {
825
826
  },
826
827
  dependencies: metadata.dependencies
827
828
  };
829
+ // Register the class itself
828
830
  this.myTokenRegistry.put(token, registration);
829
831
  // Register additional aliasing tokens specified via class decorators.
830
- // These tokens will point to the original token and will have the same scope.
832
+ // These tokens will point to the original class token and will have the same scope.
831
833
  for (const aliasToken of metadata.tokenRef.getRefTokens()){
832
834
  this.myTokenRegistry.put(aliasToken, {
833
- name: name,
835
+ name: effectiveName,
834
836
  provider: {
835
837
  useExisting: [
836
838
  token,
837
- name
839
+ effectiveName
838
840
  ]
839
841
  }
840
842
  });