@tsed/di 7.28.0 → 7.29.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.
- package/jest.config.js +2 -2
- package/lib/cjs/domain/DIContext.js +3 -3
- package/lib/cjs/domain/DIContext.js.map +1 -1
- package/lib/cjs/index.js +1 -0
- package/lib/cjs/index.js.map +1 -1
- package/lib/cjs/services/InjectorService.js +4 -4
- package/lib/cjs/services/InjectorService.js.map +1 -1
- package/lib/cjs/utils/attachLogger.js +10 -0
- package/lib/cjs/utils/attachLogger.js.map +1 -0
- package/lib/esm/domain/DIContext.js +3 -3
- package/lib/esm/domain/DIContext.js.map +1 -1
- package/lib/esm/index.js +1 -0
- package/lib/esm/index.js.map +1 -1
- package/lib/esm/services/InjectorService.js +4 -4
- package/lib/esm/services/InjectorService.js.map +1 -1
- package/lib/esm/utils/attachLogger.js +6 -0
- package/lib/esm/utils/attachLogger.js.map +1 -0
- package/lib/tsconfig.esm.tsbuildinfo +1 -1
- package/lib/tsconfig.tsbuildinfo +1 -1
- package/lib/types/index.d.ts +1 -0
- package/lib/types/utils/attachLogger.d.ts +3 -0
- package/package.json +7 -7
- package/readme.md +8 -2
package/lib/types/index.d.ts
CHANGED
|
@@ -52,6 +52,7 @@ export * from "./services/DILogger";
|
|
|
52
52
|
export * from "./services/DITest";
|
|
53
53
|
export * from "./services/InjectorService";
|
|
54
54
|
export * from "./utils/asyncHookContext";
|
|
55
|
+
export * from "./utils/attachLogger";
|
|
55
56
|
export * from "./utils/colors";
|
|
56
57
|
export * from "./utils/createContainer";
|
|
57
58
|
export * from "./utils/getConfiguration";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tsed/di",
|
|
3
|
-
"version": "7.
|
|
3
|
+
"version": "7.29.1",
|
|
4
4
|
"description": "DI module for Ts.ED Framework",
|
|
5
5
|
"private": false,
|
|
6
6
|
"source": "./src/index.ts",
|
|
@@ -25,17 +25,17 @@
|
|
|
25
25
|
"tslib": "2.5.0"
|
|
26
26
|
},
|
|
27
27
|
"devDependencies": {
|
|
28
|
-
"@tsed/core": "7.
|
|
29
|
-
"@tsed/eslint": "7.
|
|
28
|
+
"@tsed/core": "7.29.1",
|
|
29
|
+
"@tsed/eslint": "7.29.1",
|
|
30
30
|
"@tsed/logger": ">=6.2.2",
|
|
31
|
-
"@tsed/schema": "7.
|
|
32
|
-
"@tsed/typescript": "7.
|
|
31
|
+
"@tsed/schema": "7.29.1",
|
|
32
|
+
"@tsed/typescript": "7.29.1",
|
|
33
33
|
"eslint": "^8.12.0"
|
|
34
34
|
},
|
|
35
35
|
"peerDependencies": {
|
|
36
|
-
"@tsed/core": "^7.
|
|
36
|
+
"@tsed/core": "^7.29.1",
|
|
37
37
|
"@tsed/logger": ">=6.2.2",
|
|
38
|
-
"@tsed/schema": "^7.
|
|
38
|
+
"@tsed/schema": "^7.29.1"
|
|
39
39
|
},
|
|
40
40
|
"peerDependenciesMeta": {
|
|
41
41
|
"@tsed/core": {
|
package/readme.md
CHANGED
|
@@ -118,19 +118,25 @@ export class CalendarCtrl {
|
|
|
118
118
|
Finally, we can load the injector and use:
|
|
119
119
|
|
|
120
120
|
```typescript
|
|
121
|
-
import {InjectorService} from "@tsed/di";
|
|
121
|
+
import {InjectorService, attachLogger} from "@tsed/di";
|
|
122
|
+
import {$log} from "@tsed/logger";
|
|
122
123
|
import {CalendarCtrl} from "./CalendarCtrl";
|
|
123
124
|
|
|
124
125
|
async function bootstrap() {
|
|
125
126
|
const injector = new InjectorService();
|
|
126
127
|
|
|
128
|
+
// configure the default logger
|
|
129
|
+
attachLogger(injector, $log);
|
|
130
|
+
|
|
127
131
|
// Load all providers registered via @Injectable decorator
|
|
128
132
|
await injector.load();
|
|
129
133
|
|
|
130
134
|
const calendarController = injector.get<CalendarCtrl>();
|
|
131
|
-
|
|
132
135
|
await calendarController.create(new Calendar());
|
|
133
136
|
|
|
137
|
+
// emit event to trigger actions for third parties modules
|
|
138
|
+
await injector.emit("$onReady");
|
|
139
|
+
|
|
134
140
|
// And finally destroy injector and his instances (see injector hooks)
|
|
135
141
|
await injector.destroy();
|
|
136
142
|
}
|