@lppedd/di-wise-neo 0.26.0 → 0.26.2
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.
- package/dist/cjs/index.d.ts +4 -5
- package/dist/cjs/index.js +8 -7
- package/dist/cjs/index.js.map +1 -1
- package/dist/es/index.d.mts +4 -5
- package/dist/es/index.mjs +8 -7
- package/dist/es/index.mjs.map +1 -1
- package/package.json +1 -2
package/dist/es/index.d.mts
CHANGED
|
@@ -75,10 +75,6 @@ interface Type<T> extends ParameterDecorator {
|
|
|
75
75
|
* An injectable type `T` with a default {@link Provider} and optional default registration options.
|
|
76
76
|
*/
|
|
77
77
|
interface ProviderType<T> extends Type<T> {
|
|
78
|
-
/**
|
|
79
|
-
* The underlying `Type<T>`.
|
|
80
|
-
*/
|
|
81
|
-
readonly type: Type<T>;
|
|
82
78
|
/**
|
|
83
79
|
* The type's default provider.
|
|
84
80
|
*/
|
|
@@ -440,7 +436,10 @@ interface Container {
|
|
|
440
436
|
*/
|
|
441
437
|
register<Value, ProviderValue extends Value>(token: Token<Value>, provider: ValueProvider<ProviderValue>): Container;
|
|
442
438
|
/**
|
|
443
|
-
* Removes
|
|
439
|
+
* Removes registrations for the given token from the container's internal registry.
|
|
440
|
+
*
|
|
441
|
+
* When a `name` is provided, only the registration with that `name` is removed.
|
|
442
|
+
* Otherwise, all registrations are removed.
|
|
444
443
|
*
|
|
445
444
|
* Returns an array of the distinct values that were cached by this container for the
|
|
446
445
|
* removed registrations. Values from {@link ValueProvider} registrations are not included,
|
package/dist/es/index.mjs
CHANGED
|
@@ -451,7 +451,6 @@ function createType(debugName, provider, options) {
|
|
|
451
451
|
type.__type = undefined;
|
|
452
452
|
type.toString = ()=>name;
|
|
453
453
|
if (provider) {
|
|
454
|
-
type.type = type;
|
|
455
454
|
type.provider = provider;
|
|
456
455
|
type.options = options;
|
|
457
456
|
}
|
|
@@ -790,7 +789,7 @@ function isDisposable(value) {
|
|
|
790
789
|
// Register the class itself
|
|
791
790
|
this.myTokenRegistry.put(Class, registration);
|
|
792
791
|
// Register additional aliasing tokens specified via class decorators.
|
|
793
|
-
// These tokens will point to the original
|
|
792
|
+
// These tokens will point to the original class token and will have the same scope.
|
|
794
793
|
for (const aliasToken of metadata.tokenRef.getRefTokens()){
|
|
795
794
|
this.myTokenRegistry.put(aliasToken, {
|
|
796
795
|
name: name,
|
|
@@ -814,9 +813,10 @@ function isDisposable(value) {
|
|
|
814
813
|
check(name === undefined || name.trim(), `name qualifier for token ${getTokenName(token)} must not be empty`);
|
|
815
814
|
if (isClassProvider(provider)) {
|
|
816
815
|
const metadata = getMetadata(provider.useClass);
|
|
816
|
+
// An explicit provider name overrides what is specified via @Named
|
|
817
|
+
const effectiveName = name ?? metadata.name;
|
|
817
818
|
const registration = {
|
|
818
|
-
|
|
819
|
-
name: metadata.name ?? name,
|
|
819
|
+
name: effectiveName,
|
|
820
820
|
provider: metadata.provider,
|
|
821
821
|
options: {
|
|
822
822
|
// Explicit registration options override what is specified via class decorators (e.g., @Scoped)
|
|
@@ -825,16 +825,17 @@ function isDisposable(value) {
|
|
|
825
825
|
},
|
|
826
826
|
dependencies: metadata.dependencies
|
|
827
827
|
};
|
|
828
|
+
// Register the class itself
|
|
828
829
|
this.myTokenRegistry.put(token, registration);
|
|
829
830
|
// Register additional aliasing tokens specified via class decorators.
|
|
830
|
-
// These tokens will point to the original token and will have the same scope.
|
|
831
|
+
// These tokens will point to the original class token and will have the same scope.
|
|
831
832
|
for (const aliasToken of metadata.tokenRef.getRefTokens()){
|
|
832
833
|
this.myTokenRegistry.put(aliasToken, {
|
|
833
|
-
name:
|
|
834
|
+
name: effectiveName,
|
|
834
835
|
provider: {
|
|
835
836
|
useExisting: [
|
|
836
837
|
token,
|
|
837
|
-
|
|
838
|
+
effectiveName
|
|
838
839
|
]
|
|
839
840
|
}
|
|
840
841
|
});
|