@nestjs/core 11.0.0-next.3 → 11.0.0-next.4
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/injector/container.js +2 -2
- package/package.json +2 -2
- package/scanner.js +3 -2
package/injector/container.js
CHANGED
|
@@ -100,9 +100,9 @@ class NestContainer {
|
|
|
100
100
|
await this.addDynamicMetadata(token, dynamicMetadata, updatedScope);
|
|
101
101
|
if (this.isGlobalModule(type, dynamicMetadata)) {
|
|
102
102
|
moduleRef.isGlobal = true;
|
|
103
|
-
// Set global module distance to
|
|
103
|
+
// Set global module distance to MAX_VALUE to ensure their lifecycle hooks
|
|
104
104
|
// are always executed first (when initializing the application)
|
|
105
|
-
moduleRef.distance =
|
|
105
|
+
moduleRef.distance = Number.MAX_VALUE;
|
|
106
106
|
this.addGlobalModule(moduleRef);
|
|
107
107
|
}
|
|
108
108
|
return moduleRef;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nestjs/core",
|
|
3
|
-
"version": "11.0.0-next.
|
|
3
|
+
"version": "11.0.0-next.4",
|
|
4
4
|
"description": "Nest - modern, fast, powerful node.js web framework (@core)",
|
|
5
5
|
"author": "Kamil Mysliwiec",
|
|
6
6
|
"license": "MIT",
|
|
@@ -36,7 +36,7 @@
|
|
|
36
36
|
"uid": "2.0.2"
|
|
37
37
|
},
|
|
38
38
|
"devDependencies": {
|
|
39
|
-
"@nestjs/common": "^11.0.0-next.
|
|
39
|
+
"@nestjs/common": "^11.0.0-next.4"
|
|
40
40
|
},
|
|
41
41
|
"peerDependencies": {
|
|
42
42
|
"@nestjs/common": "^10.0.0",
|
package/scanner.js
CHANGED
|
@@ -32,7 +32,7 @@ class DependenciesScanner {
|
|
|
32
32
|
this.addScopedEnhancersMetadata();
|
|
33
33
|
// Modules distance calculation should be done after all modules are scanned
|
|
34
34
|
// but before global modules are registered (linked to all modules).
|
|
35
|
-
// Global modules have their distance set to
|
|
35
|
+
// Global modules have their distance set to MAX anyway.
|
|
36
36
|
this.calculateModulesDistance();
|
|
37
37
|
this.container.bindGlobalScope();
|
|
38
38
|
}
|
|
@@ -210,7 +210,8 @@ class DependenciesScanner {
|
|
|
210
210
|
const moduleImports = moduleRef.imports;
|
|
211
211
|
moduleImports.forEach(importedModuleRef => {
|
|
212
212
|
if (importedModuleRef) {
|
|
213
|
-
if (distance > importedModuleRef.distance
|
|
213
|
+
if (distance > importedModuleRef.distance &&
|
|
214
|
+
!importedModuleRef.isGlobal) {
|
|
214
215
|
importedModuleRef.distance = distance;
|
|
215
216
|
}
|
|
216
217
|
calculateDistance(importedModuleRef, distance + 1, localModulesStack);
|