@vercube/di 0.0.33 → 0.0.35
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/README.md +30 -24
- package/dist/index.d.mts +3 -3
- package/dist/index.mjs +4 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,34 +1,40 @@
|
|
|
1
1
|
<div align="center">
|
|
2
|
-
<
|
|
2
|
+
<img src="https://raw.githubusercontent.com/vercube/vercube/refs/heads/main/.github/assets/cover.png" width="100%" alt="Vercube - Unleash your server development." />
|
|
3
3
|
<br>
|
|
4
4
|
<br>
|
|
5
5
|
|
|
6
|
-
#
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
<a href="https://codecov.io/gh/vercube/vercube" target="_blank">
|
|
20
|
-
<img src="https://img.shields.io/codecov/c/github/vercube/vercube?style=for-the-badge&color=%23767eff" alt="Coverage"/>
|
|
21
|
-
</a>
|
|
22
|
-
<br/>
|
|
23
|
-
<br/>
|
|
6
|
+
# @vercube/di
|
|
7
|
+
|
|
8
|
+
### Dependency Injection container
|
|
9
|
+
|
|
10
|
+
[&labelColor=%23000&color=%232f2f2f>)](https://deepwiki.com/vercube/vercube)
|
|
11
|
+
&labelColor=%23000&color=%232e2e2e&link=https%3A%2F%2Fwww.npmjs.com%2Fpackage%2F%40vercube%2Fdi>)
|
|
12
|
+
&labelColor=%23000&color=%232f2f2f>)
|
|
13
|
+
&labelColor=%23000&color=%232f2f2f>)
|
|
14
|
+
|
|
15
|
+
**IoC container that powers Vercube - bind services, inject dependencies, swap implementations for tests. Simple `@Inject` and you're done.**
|
|
16
|
+
|
|
17
|
+
[Website](https://vercube.dev) • [Documentation](https://vercube.dev/docs/getting-started)
|
|
18
|
+
|
|
24
19
|
</div>
|
|
25
20
|
|
|
26
|
-
|
|
21
|
+
## ✨ Features
|
|
22
|
+
|
|
23
|
+
- **Property injection** - `@Inject(Service)` on any class property
|
|
24
|
+
- **Flexible binding** - singletons, transients, or existing instances
|
|
25
|
+
- **Interface support** - bind interfaces to implementations with symbols
|
|
26
|
+
- **Testing friendly** - `bindMock` makes unit tests a breeze
|
|
27
|
+
|
|
28
|
+
## 📦 Installation
|
|
29
|
+
|
|
30
|
+
```bash
|
|
31
|
+
pnpm add @vercube/di
|
|
32
|
+
```
|
|
27
33
|
|
|
28
|
-
##
|
|
34
|
+
## 📖 Usage
|
|
29
35
|
|
|
30
|
-
|
|
36
|
+
Check out the full [documentation](https://vercube.dev/docs/core-features/container)
|
|
31
37
|
|
|
32
|
-
##
|
|
38
|
+
## 📜 License
|
|
33
39
|
|
|
34
|
-
|
|
40
|
+
[MIT](https://github.com/vercube/vercube/blob/main/LICENSE)
|
package/dist/index.d.mts
CHANGED
|
@@ -236,7 +236,7 @@ declare namespace IOC {
|
|
|
236
236
|
enum ServiceFactoryType {
|
|
237
237
|
CLASS = "CLASS",
|
|
238
238
|
CLASS_SINGLETON = "CLASS_SINGLETON",
|
|
239
|
-
INSTANCE = "INSTANCE"
|
|
239
|
+
INSTANCE = "INSTANCE"
|
|
240
240
|
}
|
|
241
241
|
/**
|
|
242
242
|
* Standard class.
|
|
@@ -277,7 +277,7 @@ declare namespace IOC {
|
|
|
277
277
|
*/
|
|
278
278
|
enum InjectMethod {
|
|
279
279
|
LAZY = "LAZY",
|
|
280
|
-
STATIC = "STATIC"
|
|
280
|
+
STATIC = "STATIC"
|
|
281
281
|
}
|
|
282
282
|
/**
|
|
283
283
|
* This type represents unique service identity. For now, its symbol, but we leave
|
|
@@ -309,7 +309,7 @@ declare namespace IOC {
|
|
|
309
309
|
*/
|
|
310
310
|
enum DependencyType {
|
|
311
311
|
STANDARD = 0,
|
|
312
|
-
OPTIONAL = 1
|
|
312
|
+
OPTIONAL = 1
|
|
313
313
|
}
|
|
314
314
|
}
|
|
315
315
|
//#endregion
|
package/dist/index.mjs
CHANGED
|
@@ -509,6 +509,10 @@ let IOC;
|
|
|
509
509
|
//#endregion
|
|
510
510
|
//#region src/Domain/Engine.ts
|
|
511
511
|
/**
|
|
512
|
+
* This module is responsible for internal work of IOC engine inject mechanics. Its written in
|
|
513
|
+
* "raw" (non-OOP) style to maximize simplicity and execution speed.
|
|
514
|
+
*/
|
|
515
|
+
/**
|
|
512
516
|
* This map holds metadata for ALL classes in system along with their dependencies. Original idea was
|
|
513
517
|
* to store those informations in object prototype, but accessing this map is blazing fast with Map
|
|
514
518
|
* container (<1ms).
|