@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/cjs/index.js CHANGED
@@ -792,7 +792,7 @@ function isDisposable(value) {
792
792
  // Register the class itself
793
793
  this.myTokenRegistry.put(Class, registration);
794
794
  // Register additional aliasing tokens specified via class decorators.
795
- // These tokens will point to the original Class token and will have the same scope.
795
+ // These tokens will point to the original class token and will have the same scope.
796
796
  for (const aliasToken of metadata.tokenRef.getRefTokens()){
797
797
  this.myTokenRegistry.put(aliasToken, {
798
798
  name: name,
@@ -816,9 +816,10 @@ function isDisposable(value) {
816
816
  check(name === undefined || name.trim(), `name qualifier for token ${getTokenName(token)} must not be empty`);
817
817
  if (isClassProvider(provider)) {
818
818
  const metadata = getMetadata(provider.useClass);
819
+ // An explicit provider name overrides what is specified via @Named
820
+ const effectiveName = name ?? metadata.name;
819
821
  const registration = {
820
- // An explicit provider name overrides what is specified via @Named
821
- name: metadata.name ?? name,
822
+ name: effectiveName,
822
823
  provider: metadata.provider,
823
824
  options: {
824
825
  // Explicit registration options override what is specified via class decorators (e.g., @Scoped)
@@ -827,16 +828,17 @@ function isDisposable(value) {
827
828
  },
828
829
  dependencies: metadata.dependencies
829
830
  };
831
+ // Register the class itself
830
832
  this.myTokenRegistry.put(token, registration);
831
833
  // Register additional aliasing tokens specified via class decorators.
832
- // These tokens will point to the original token and will have the same scope.
834
+ // These tokens will point to the original class token and will have the same scope.
833
835
  for (const aliasToken of metadata.tokenRef.getRefTokens()){
834
836
  this.myTokenRegistry.put(aliasToken, {
835
- name: name,
837
+ name: effectiveName,
836
838
  provider: {
837
839
  useExisting: [
838
840
  token,
839
- name
841
+ effectiveName
840
842
  ]
841
843
  }
842
844
  });