ts-ioc-container 30.3.0 → 30.3.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.
|
@@ -26,18 +26,15 @@ class Container {
|
|
|
26
26
|
resolve(token, { args = [], child = this } = {}) {
|
|
27
27
|
this.validateContainer();
|
|
28
28
|
if ((0, IContainer_1.isConstructor)(token)) {
|
|
29
|
-
|
|
29
|
+
const instance = this.injector.resolve(this, token, ...args);
|
|
30
|
+
this.instances.add(instance);
|
|
31
|
+
return instance;
|
|
30
32
|
}
|
|
31
33
|
const provider = this.providers.get(token);
|
|
32
34
|
return provider?.isVisible(this, child)
|
|
33
35
|
? provider.resolve(this, ...args)
|
|
34
36
|
: this.parent.resolve(token, { args, child });
|
|
35
37
|
}
|
|
36
|
-
resolveByConstructor(token, ...args) {
|
|
37
|
-
const instance = this.injector.resolve(this, token, ...args);
|
|
38
|
-
this.instances.add(instance);
|
|
39
|
-
return instance;
|
|
40
|
-
}
|
|
41
38
|
createScope(...tags) {
|
|
42
39
|
this.validateContainer();
|
|
43
40
|
const scope = new Container(this.injector, { parent: this, tags });
|
|
@@ -23,18 +23,15 @@ export class Container {
|
|
|
23
23
|
resolve(token, { args = [], child = this } = {}) {
|
|
24
24
|
this.validateContainer();
|
|
25
25
|
if (isConstructor(token)) {
|
|
26
|
-
|
|
26
|
+
const instance = this.injector.resolve(this, token, ...args);
|
|
27
|
+
this.instances.add(instance);
|
|
28
|
+
return instance;
|
|
27
29
|
}
|
|
28
30
|
const provider = this.providers.get(token);
|
|
29
31
|
return provider?.isVisible(this, child)
|
|
30
32
|
? provider.resolve(this, ...args)
|
|
31
33
|
: this.parent.resolve(token, { args, child });
|
|
32
34
|
}
|
|
33
|
-
resolveByConstructor(token, ...args) {
|
|
34
|
-
const instance = this.injector.resolve(this, token, ...args);
|
|
35
|
-
this.instances.add(instance);
|
|
36
|
-
return instance;
|
|
37
|
-
}
|
|
38
35
|
createScope(...tags) {
|
|
39
36
|
this.validateContainer();
|
|
40
37
|
const scope = new Container(this.injector, { parent: this, tags });
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "ts-ioc-container",
|
|
3
|
-
"version": "30.3.
|
|
3
|
+
"version": "30.3.1",
|
|
4
4
|
"description": "Typescript IoC container",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public",
|
|
@@ -59,5 +59,5 @@
|
|
|
59
59
|
"ts-node": "^10.9.1",
|
|
60
60
|
"typescript": "5.4.3"
|
|
61
61
|
},
|
|
62
|
-
"gitHead": "
|
|
62
|
+
"gitHead": "43c40c903f8822f679e2f832d657bd72945a8680"
|
|
63
63
|
}
|
|
@@ -16,7 +16,6 @@ export declare class Container implements IContainer {
|
|
|
16
16
|
});
|
|
17
17
|
register(key: DependencyKey, provider: IProvider, aliases?: Alias[]): this;
|
|
18
18
|
resolve<T>(token: InjectionToken<T>, { args, child }?: ResolveOptions): T;
|
|
19
|
-
private resolveByConstructor;
|
|
20
19
|
createScope(...tags: Tag[]): Container;
|
|
21
20
|
dispose(): void;
|
|
22
21
|
getInstances(): unknown[];
|