@nexus-ioc/core 0.6.1 → 0.7.0

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.
Files changed (222) hide show
  1. package/README.md +731 -1
  2. package/dist/cjs/browser.js +2 -2
  3. package/dist/cjs/browser.js.map +1 -1
  4. package/dist/cjs/core/child-module.js +32 -0
  5. package/dist/cjs/core/child-module.js.map +1 -0
  6. package/dist/cjs/core/graph/analyze-lazy-module.js +54 -0
  7. package/dist/cjs/core/graph/analyze-lazy-module.js.map +1 -0
  8. package/dist/cjs/core/graph/analyze-module.js +11 -0
  9. package/dist/cjs/core/graph/analyze-module.js.map +1 -1
  10. package/dist/cjs/core/graph/module-graph.js +685 -70
  11. package/dist/cjs/core/graph/module-graph.js.map +1 -1
  12. package/dist/cjs/core/injection/injection-context.js +29 -0
  13. package/dist/cjs/core/injection/injection-context.js.map +1 -0
  14. package/dist/cjs/core/lazy-module-loader.js +41 -0
  15. package/dist/cjs/core/lazy-module-loader.js.map +1 -0
  16. package/dist/cjs/core/module-ref.js +84 -0
  17. package/dist/cjs/core/module-ref.js.map +1 -0
  18. package/dist/cjs/core/modules/container.js +305 -17
  19. package/dist/cjs/core/modules/container.js.map +1 -1
  20. package/dist/cjs/core/modules/module-container-factory.js +2 -2
  21. package/dist/cjs/core/modules/module-container-factory.js.map +1 -1
  22. package/dist/cjs/core/modules/module-container.js +54 -16
  23. package/dist/cjs/core/modules/module-container.js.map +1 -1
  24. package/dist/cjs/core/modules/module-token-factory.js.map +1 -1
  25. package/dist/cjs/core/modules/modules-container.js +43 -3
  26. package/dist/cjs/core/modules/modules-container.js.map +1 -1
  27. package/dist/cjs/core/nexus-applications.browser.js +57 -15
  28. package/dist/cjs/core/nexus-applications.browser.js.map +1 -1
  29. package/dist/cjs/core/nexus-applications.js +440 -82
  30. package/dist/cjs/core/nexus-applications.js.map +1 -1
  31. package/dist/cjs/core/nexus-applications.server.js +57 -15
  32. package/dist/cjs/core/nexus-applications.server.js.map +1 -1
  33. package/dist/cjs/core/resolver/providers-container.js.map +1 -1
  34. package/dist/cjs/core/resolver/resolution-context.js +62 -0
  35. package/dist/cjs/core/resolver/resolution-context.js.map +1 -0
  36. package/dist/cjs/core/resolver/resolver.js +523 -99
  37. package/dist/cjs/core/resolver/resolver.js.map +1 -1
  38. package/dist/cjs/decorators/inject.js +6 -3
  39. package/dist/cjs/decorators/inject.js.map +1 -1
  40. package/dist/cjs/decorators/injectable.js +0 -7
  41. package/dist/cjs/decorators/injectable.js.map +1 -1
  42. package/dist/cjs/decorators/{nsModule.js → module.js} +9 -7
  43. package/dist/cjs/decorators/module.js.map +1 -0
  44. package/dist/cjs/errors/bootstrap-error.js +47 -0
  45. package/dist/cjs/errors/bootstrap-error.js.map +1 -0
  46. package/dist/cjs/errors/child-errors.js +21 -0
  47. package/dist/cjs/errors/child-errors.js.map +1 -0
  48. package/dist/cjs/errors/index.js +24 -0
  49. package/dist/cjs/errors/index.js.map +1 -0
  50. package/dist/cjs/errors/injection-errors.js +25 -0
  51. package/dist/cjs/errors/injection-errors.js.map +1 -0
  52. package/dist/cjs/errors/lazy-module-errors.js +26 -0
  53. package/dist/cjs/errors/lazy-module-errors.js.map +1 -0
  54. package/dist/cjs/errors/provider-errors.js +95 -0
  55. package/dist/cjs/errors/provider-errors.js.map +1 -0
  56. package/dist/cjs/index.js +30 -6
  57. package/dist/cjs/index.js.map +1 -1
  58. package/dist/cjs/interfaces/index.js +1 -0
  59. package/dist/cjs/interfaces/index.js.map +1 -1
  60. package/dist/cjs/interfaces/modules/index.js +1 -0
  61. package/dist/cjs/interfaces/modules/index.js.map +1 -1
  62. package/dist/cjs/interfaces/modules/module-graph.interface.js +2 -0
  63. package/dist/cjs/interfaces/modules/module-graph.interface.js.map +1 -1
  64. package/dist/cjs/interfaces/modules/parent-link.interface.js +3 -0
  65. package/dist/cjs/interfaces/modules/parent-link.interface.js.map +1 -0
  66. package/dist/cjs/interfaces/on-module-destroy.interface.js +3 -0
  67. package/dist/cjs/interfaces/on-module-destroy.interface.js.map +1 -0
  68. package/dist/cjs/interfaces/scope.interface.js +2 -55
  69. package/dist/cjs/interfaces/scope.interface.js.map +1 -1
  70. package/dist/cjs/interfaces/validate-module-keys.js +2 -0
  71. package/dist/cjs/interfaces/validate-module-keys.js.map +1 -1
  72. package/dist/cjs/internal.js +9 -0
  73. package/dist/cjs/internal.js.map +1 -0
  74. package/dist/cjs/server.js +2 -2
  75. package/dist/cjs/server.js.map +1 -1
  76. package/dist/cjs/utils/forward-ref.js +14 -0
  77. package/dist/cjs/utils/forward-ref.js.map +1 -0
  78. package/dist/cjs/utils/helpers.js +14 -4
  79. package/dist/cjs/utils/helpers.js.map +1 -1
  80. package/dist/cjs/utils/lazy-module.js +33 -0
  81. package/dist/cjs/utils/lazy-module.js.map +1 -0
  82. package/dist/esm/browser.js +1 -1
  83. package/dist/esm/browser.js.map +1 -1
  84. package/dist/esm/core/child-module.js +29 -0
  85. package/dist/esm/core/child-module.js.map +1 -0
  86. package/dist/esm/core/graph/analyze-lazy-module.js +50 -0
  87. package/dist/esm/core/graph/analyze-lazy-module.js.map +1 -0
  88. package/dist/esm/core/graph/analyze-module.js +11 -0
  89. package/dist/esm/core/graph/analyze-module.js.map +1 -1
  90. package/dist/esm/core/graph/module-graph.js +686 -71
  91. package/dist/esm/core/graph/module-graph.js.map +1 -1
  92. package/dist/esm/core/injection/injection-context.js +25 -0
  93. package/dist/esm/core/injection/injection-context.js.map +1 -0
  94. package/dist/esm/core/lazy-module-loader.js +36 -0
  95. package/dist/esm/core/lazy-module-loader.js.map +1 -0
  96. package/dist/esm/core/module-ref.js +80 -0
  97. package/dist/esm/core/module-ref.js.map +1 -0
  98. package/dist/esm/core/modules/container.js +305 -17
  99. package/dist/esm/core/modules/container.js.map +1 -1
  100. package/dist/esm/core/modules/module-container-factory.js +2 -2
  101. package/dist/esm/core/modules/module-container-factory.js.map +1 -1
  102. package/dist/esm/core/modules/module-container.js +55 -17
  103. package/dist/esm/core/modules/module-container.js.map +1 -1
  104. package/dist/esm/core/modules/module-token-factory.js.map +1 -1
  105. package/dist/esm/core/modules/modules-container.js +43 -3
  106. package/dist/esm/core/modules/modules-container.js.map +1 -1
  107. package/dist/esm/core/nexus-applications.browser.js +55 -13
  108. package/dist/esm/core/nexus-applications.browser.js.map +1 -1
  109. package/dist/esm/core/nexus-applications.js +439 -81
  110. package/dist/esm/core/nexus-applications.js.map +1 -1
  111. package/dist/esm/core/nexus-applications.server.js +55 -13
  112. package/dist/esm/core/nexus-applications.server.js.map +1 -1
  113. package/dist/esm/core/resolver/providers-container.js.map +1 -1
  114. package/dist/esm/core/resolver/resolution-context.js +58 -0
  115. package/dist/esm/core/resolver/resolution-context.js.map +1 -0
  116. package/dist/esm/core/resolver/resolver.js +524 -100
  117. package/dist/esm/core/resolver/resolver.js.map +1 -1
  118. package/dist/esm/decorators/inject.js +6 -3
  119. package/dist/esm/decorators/inject.js.map +1 -1
  120. package/dist/esm/decorators/injectable.js +0 -7
  121. package/dist/esm/decorators/injectable.js.map +1 -1
  122. package/dist/esm/decorators/{nsModule.js → module.js} +8 -6
  123. package/dist/esm/decorators/module.js.map +1 -0
  124. package/dist/esm/errors/bootstrap-error.js +42 -0
  125. package/dist/esm/errors/bootstrap-error.js.map +1 -0
  126. package/dist/esm/errors/child-errors.js +17 -0
  127. package/dist/esm/errors/child-errors.js.map +1 -0
  128. package/dist/esm/errors/index.js +6 -0
  129. package/dist/esm/errors/index.js.map +1 -0
  130. package/dist/esm/errors/injection-errors.js +20 -0
  131. package/dist/esm/errors/injection-errors.js.map +1 -0
  132. package/dist/esm/errors/lazy-module-errors.js +21 -0
  133. package/dist/esm/errors/lazy-module-errors.js.map +1 -0
  134. package/dist/esm/errors/provider-errors.js +84 -0
  135. package/dist/esm/errors/provider-errors.js.map +1 -0
  136. package/dist/esm/index.js +9 -4
  137. package/dist/esm/index.js.map +1 -1
  138. package/dist/esm/interfaces/index.js +1 -0
  139. package/dist/esm/interfaces/index.js.map +1 -1
  140. package/dist/esm/interfaces/modules/index.js +1 -0
  141. package/dist/esm/interfaces/modules/index.js.map +1 -1
  142. package/dist/esm/interfaces/modules/module-graph.interface.js +2 -0
  143. package/dist/esm/interfaces/modules/module-graph.interface.js.map +1 -1
  144. package/dist/esm/interfaces/modules/parent-link.interface.js +2 -0
  145. package/dist/esm/interfaces/modules/parent-link.interface.js.map +1 -0
  146. package/dist/esm/interfaces/on-module-destroy.interface.js +2 -0
  147. package/dist/esm/interfaces/on-module-destroy.interface.js.map +1 -0
  148. package/dist/esm/interfaces/scope.interface.js +1 -55
  149. package/dist/esm/interfaces/scope.interface.js.map +1 -1
  150. package/dist/esm/interfaces/validate-module-keys.js +2 -0
  151. package/dist/esm/interfaces/validate-module-keys.js.map +1 -1
  152. package/dist/esm/internal.js +3 -0
  153. package/dist/esm/internal.js.map +1 -0
  154. package/dist/esm/server.js +1 -1
  155. package/dist/esm/server.js.map +1 -1
  156. package/dist/esm/utils/forward-ref.js +10 -0
  157. package/dist/esm/utils/forward-ref.js.map +1 -0
  158. package/dist/esm/utils/helpers.js +14 -4
  159. package/dist/esm/utils/helpers.js.map +1 -1
  160. package/dist/esm/utils/lazy-module.js +29 -0
  161. package/dist/esm/utils/lazy-module.js.map +1 -0
  162. package/dist/types/browser.d.ts +1 -1
  163. package/dist/types/core/child-module.d.ts +8 -0
  164. package/dist/types/core/graph/analyze-lazy-module.d.ts +28 -0
  165. package/dist/types/core/graph/analyze-module.d.ts +4 -2
  166. package/dist/types/core/graph/analyze-provider.d.ts +4 -4
  167. package/dist/types/core/graph/module-graph.d.ts +200 -7
  168. package/dist/types/core/graph/providers/analyze-class-provider.d.ts +1 -1
  169. package/dist/types/core/graph/providers/analyze-factory-provider.d.ts +2 -2
  170. package/dist/types/core/graph/providers/analyze-value-provider.d.ts +1 -1
  171. package/dist/types/core/injection/injection-context.d.ts +29 -0
  172. package/dist/types/core/lazy-module-loader.d.ts +17 -0
  173. package/dist/types/core/module-ref.d.ts +34 -0
  174. package/dist/types/core/modules/container.d.ts +134 -18
  175. package/dist/types/core/modules/module-container-factory.d.ts +3 -3
  176. package/dist/types/core/modules/module-container.d.ts +44 -5
  177. package/dist/types/core/modules/module-token-factory.d.ts +2 -2
  178. package/dist/types/core/modules/modules-container.d.ts +23 -4
  179. package/dist/types/core/nexus-applications.browser.d.ts +30 -8
  180. package/dist/types/core/nexus-applications.d.ts +219 -55
  181. package/dist/types/core/nexus-applications.server.d.ts +30 -8
  182. package/dist/types/core/resolver/providers-container.d.ts +2 -2
  183. package/dist/types/core/resolver/resolution-context.d.ts +22 -0
  184. package/dist/types/core/resolver/resolver.d.ts +122 -4
  185. package/dist/types/decorators/inject.d.ts +9 -5
  186. package/dist/types/decorators/injectable.d.ts +0 -7
  187. package/dist/types/decorators/{nsModule.d.ts → module.d.ts} +6 -5
  188. package/dist/types/errors/bootstrap-error.d.ts +6 -0
  189. package/dist/types/errors/child-errors.d.ts +10 -0
  190. package/dist/types/errors/index.d.ts +5 -0
  191. package/dist/types/errors/injection-errors.d.ts +11 -0
  192. package/dist/types/errors/lazy-module-errors.d.ts +12 -0
  193. package/dist/types/errors/provider-errors.d.ts +47 -0
  194. package/dist/types/index.d.ts +13 -4
  195. package/dist/types/interfaces/abstract.interface.d.ts +1 -3
  196. package/dist/types/interfaces/dynamic-module.interface.d.ts +7 -5
  197. package/dist/types/interfaces/index.d.ts +1 -0
  198. package/dist/types/interfaces/injection-token.interface.d.ts +1 -3
  199. package/dist/types/interfaces/module-metadata.interface.d.ts +12 -4
  200. package/dist/types/interfaces/module-types.interface.d.ts +21 -24
  201. package/dist/types/interfaces/modules/container.interface.d.ts +10 -4
  202. package/dist/types/interfaces/modules/index.d.ts +1 -0
  203. package/dist/types/interfaces/modules/module-container-factory.interface.d.ts +2 -2
  204. package/dist/types/interfaces/modules/module-graph.interface.d.ts +85 -12
  205. package/dist/types/interfaces/modules/module-token-factory.interface.d.ts +2 -2
  206. package/dist/types/interfaces/modules/modules-container.interface.d.ts +5 -4
  207. package/dist/types/interfaces/modules/parent-link.interface.d.ts +12 -0
  208. package/dist/types/interfaces/nexus-application.interface.d.ts +49 -6
  209. package/dist/types/interfaces/on-module-destroy.interface.d.ts +3 -0
  210. package/dist/types/interfaces/plugins/scanner-plugin.interface.d.ts +1 -1
  211. package/dist/types/interfaces/scope.interface.d.ts +1 -54
  212. package/dist/types/interfaces/validate-module-keys.d.ts +1 -0
  213. package/dist/types/internal.d.ts +3 -0
  214. package/dist/types/server.d.ts +1 -1
  215. package/dist/types/utils/forward-ref.d.ts +5 -0
  216. package/dist/types/utils/helpers.d.ts +8 -8
  217. package/dist/types/utils/lazy-module.d.ts +20 -0
  218. package/package.json +23 -7
  219. package/dist/cjs/decorators/nsModule.js.map +0 -1
  220. package/dist/esm/decorators/nsModule.js.map +0 -1
  221. package/dist/tsconfig.cjs.tsbuildinfo +0 -1
  222. package/dist/tsconfig.esm.tsbuildinfo +0 -1
@@ -1,60 +1,296 @@
1
- import { NodeTypeEnum, Scope, } from "../interfaces/index.js";
1
+ import { ContainerNotCompiledError } from "@nexus-ioc/shared";
2
+ import { BootstrapError, ChildModuleNotDeclaredError, ContainerClosedError, LazyModuleLoadError, ProviderNotFoundError, } from "../errors/index.js";
3
+ import { MODULE_WATERMARK, } from "../interfaces/index.js";
2
4
  import { HashUtil } from "../utils/hash-utils.js";
5
+ import { getModuleLabel, isDynamicModule } from "../utils/helpers.js";
6
+ import { isLazyModule } from "../utils/lazy-module.js";
7
+ import { withExtraProviders } from "./child-module.js";
8
+ import { createInternalModule, LazyModuleLoader } from "./lazy-module-loader.js";
9
+ import { ModuleRef } from "./module-ref.js";
3
10
  import { Container } from "./modules/container.js";
11
+ function flattenErrors(error) {
12
+ return error instanceof AggregateError ? [...error.errors] : [error];
13
+ }
14
+ /** Closes `apps` one at a time, in order; returns their flattened errors. */
15
+ async function closeAll(apps) {
16
+ const errors = [];
17
+ for (const app of apps) {
18
+ try {
19
+ await app.close();
20
+ }
21
+ catch (error) {
22
+ errors.push(...flattenErrors(error));
23
+ }
24
+ }
25
+ return errors;
26
+ }
4
27
  /**
5
- * NexusApplications is the main application class that provides a high-level
28
+ * NexusApplication is the main application class that provides a high-level
6
29
  * API for creating and managing IoC containers.
7
30
  *
8
31
  * This class wraps the Container and provides additional features:
9
32
  * - Automatic singleton initialization
10
33
  * - Scanner plugin support for custom metadata processing
11
- * - Parent-child container hierarchies
12
- * - Async/sync container modes
34
+ * - Child containers for modules declared in `@Module({ children })`
35
+ * - Lazy/eager container modes
13
36
  *
14
37
  * @example
15
38
  * ```typescript
16
- * const app = NexusApplications.create(AppModule);
39
+ * const app = NexusApplication.create(AppModule);
17
40
  * await app.bootstrap();
18
- * const service = await app.get(MyService);
41
+ * const service = app.get(MyService);
19
42
  * ```
20
43
  */
21
- export class NexusApplications {
44
+ export class NexusApplication {
22
45
  /**
23
- * Creates a new NexusApplications instance.
46
+ * Creates a new NexusApplication instance.
24
47
  *
25
48
  * @param rootModule - The root module of the application
26
49
  * @param options - Optional configuration
27
50
  * @param options.hashFn - Custom hash function for module identification
28
51
  */
29
- constructor(rootModule, options) {
52
+ constructor(rootModule, options, child) {
30
53
  this.rootModule = rootModule;
31
- this.hashUtil = new HashUtil();
54
+ this.options = options;
32
55
  this.isAsyncContainer = false;
33
- this.container = new Container(this.hashUtil);
34
56
  this.scannerPlugins = [];
35
- this._parentContainer = null;
36
- if (options?.hashFn && typeof options?.hashFn === "function") {
37
- this.hashUtil = new options.hashFn();
38
- }
57
+ this.closePromise = null;
58
+ /**
59
+ * Children created by `createChild()` and not closed yet, in creation
60
+ * order. The only reference the parent keeps to a child.
61
+ */
62
+ this.liveChildren = new Set();
63
+ /**
64
+ * Lazy child code, per lazy ref id, with the token of the declaring
65
+ * module; a failed load is not cached, and an unload that destroys the
66
+ * declaring module drops the entry.
67
+ */
68
+ this.loadedChildren = new Map();
69
+ this.pendingLoads = new Set();
70
+ this.lazyModuleLoader = new LazyModuleLoader((lazyModule) => this.load(lazyModule), (ref) => this.unload(ref));
71
+ this.hashUtil =
72
+ typeof options?.hashFn === "function"
73
+ ? new options.hashFn()
74
+ : new HashUtil();
75
+ this.container = new Container(this.hashUtil);
76
+ this.link = child?.link ?? null;
77
+ this.onClosed = child?.onClosed ?? null;
78
+ this.declaredIn = child?.declaredIn ?? null;
79
+ this.container.onUnloading((modules) => this.closeChildrenDeclaredIn(modules));
39
80
  }
40
81
  /**
41
- * Creates a new NexusApplications instance.
82
+ * Creates a new NexusApplication instance.
42
83
  *
43
84
  * This is the main entry point for creating an application.
44
85
  *
45
86
  * @param rootModule - The root module of the application
46
87
  * @param options - Optional configuration
47
88
  * @param options.hashFn - Custom hash function for module identification
48
- * @returns A new NexusApplications instance
89
+ * @returns A new NexusApplication instance
49
90
  *
50
91
  * @example
51
92
  * ```typescript
52
- * const app = NexusApplications.create(AppModule);
93
+ * const app = NexusApplication.create(AppModule);
53
94
  * await app.bootstrap();
54
95
  * ```
55
96
  */
56
97
  static create(rootModule, options) {
57
- return new NexusApplications(rootModule, options);
98
+ return new NexusApplication(rootModule, options);
99
+ }
100
+ /**
101
+ * Creates a not-yet-bootstrapped child application. Private: the only
102
+ * public way to get a child is `createChild()`.
103
+ */
104
+ static createAsChild(root, wiring, options) {
105
+ return new NexusApplication(root, options, wiring);
106
+ }
107
+ /**
108
+ * Creates a child application for a module declared in
109
+ * `@Module({ children })` somewhere in this application's graph. The
110
+ * child is returned bootstrapped, with its singletons created.
111
+ *
112
+ * - `Type` matches a declared class; `DynamicModule` matches by its
113
+ * `.module`; a `LazyModule` matches a declared ref by identity, and its
114
+ * loader runs once per ref (a failed load is retried next time).
115
+ * - `options.providers` are appended to the child root module's providers.
116
+ * - The child's `get()`/`resolve()` look in the child first, then at what
117
+ * the declaring module sees in this application, then up this
118
+ * application's own parent chain.
119
+ *
120
+ * @throws {ContainerNotCompiledError} If this application is not bootstrapped
121
+ * @throws {ContainerClosedError} If this application is closed or closing
122
+ * @throws {ChildModuleNotDeclaredError} If no module declares `child`, or
123
+ * (`reason: "unloaded"`) the lazy module declaring it was unloaded while
124
+ * the child was being created; the child is closed then
125
+ * @throws {LazyModuleLoadError} If a lazy child's loader fails or returns a non-module
126
+ *
127
+ * @example
128
+ * ```typescript
129
+ * @Module({ children: [ProfileModule] })
130
+ * class AppModule {}
131
+ *
132
+ * const app = await NexusApplication.create(AppModule).bootstrap();
133
+ * const profile = await app.createChild(ProfileModule, {
134
+ * providers: [{ provide: PROFILE_ID, useValue: "p1" }],
135
+ * });
136
+ * ```
137
+ */
138
+ async createChild(child, options) {
139
+ this.assertUsable();
140
+ const key = isLazyModule(child)
141
+ ? child
142
+ : isDynamicModule(child)
143
+ ? child.module
144
+ : child;
145
+ const childName = isLazyModule(child) ? child.name : getModuleLabel(child);
146
+ const declaredIn = this.container.graph.findChildDeclaration(key);
147
+ if (!declaredIn) {
148
+ throw new ChildModuleNotDeclaredError(childName);
149
+ }
150
+ // The declaring module may live in a lazy segment that is unloaded
151
+ // (and maybe loaded again, as a new module) while this call awaits.
152
+ const assertStillDeclared = () => {
153
+ if (this.container.graph.findChildDeclaration(key) !== declaredIn) {
154
+ throw new ChildModuleNotDeclaredError(childName, "unloaded");
155
+ }
156
+ };
157
+ let module;
158
+ if (isLazyModule(child)) {
159
+ try {
160
+ module = await this.loadChildModule(child, declaredIn.token);
161
+ }
162
+ catch (error) {
163
+ // A parent that started closing reports that, not the load failure.
164
+ this.assertOpen();
165
+ throw error;
166
+ }
167
+ // The parent may have started closing, or the declaring segment
168
+ // unloading, while the code loaded.
169
+ this.assertOpen();
170
+ assertStillDeclared();
171
+ }
172
+ else {
173
+ module = child;
174
+ }
175
+ const app = NexusApplication.createAsChild(withExtraProviders(module, options?.providers), {
176
+ link: this.linkFor(declaredIn),
177
+ onClosed: () => this.liveChildren.delete(app),
178
+ declaredIn: declaredIn.token,
179
+ }, this.options);
180
+ // Registered before bootstrap so a concurrent close() sees it.
181
+ this.liveChildren.add(app);
182
+ // Only this application can close a child still bootstrapping: its
183
+ // close() cascade or an unload of the declaring module. The caller
184
+ // hears about the parent closing first, then about the unload.
185
+ const reportClosedWhileCreating = () => {
186
+ this.assertOpen();
187
+ if (app.isClosed) {
188
+ throw new ChildModuleNotDeclaredError(childName, "unloaded");
189
+ }
190
+ assertStillDeclared();
191
+ };
192
+ try {
193
+ await app.bootstrap();
194
+ }
195
+ catch (error) {
196
+ const closedByParent = app.isClosed;
197
+ this.liveChildren.delete(app);
198
+ await app.close().catch(() => undefined);
199
+ this.assertOpen();
200
+ if (closedByParent) {
201
+ reportClosedWhileCreating();
202
+ }
203
+ throw error;
204
+ }
205
+ try {
206
+ reportClosedWhileCreating();
207
+ }
208
+ catch (error) {
209
+ await app.close();
210
+ throw error;
211
+ }
212
+ return app;
213
+ }
214
+ /** Runs a lazy child's loader once per ref; a failure is not cached. */
215
+ loadChildModule(ref, declaredIn) {
216
+ const cached = this.loadedChildren.get(ref.id);
217
+ if (cached) {
218
+ return cached.module;
219
+ }
220
+ const entry = {
221
+ declaredIn,
222
+ module: this.runChildLoader(ref).catch((error) => {
223
+ // Only this load's entry: an unload may have dropped it already.
224
+ if (this.loadedChildren.get(ref.id) === entry) {
225
+ this.loadedChildren.delete(ref.id);
226
+ }
227
+ throw error;
228
+ }),
229
+ };
230
+ this.loadedChildren.set(ref.id, entry);
231
+ return entry.module;
232
+ }
233
+ async runChildLoader(ref) {
234
+ let loaded;
235
+ try {
236
+ loaded = await ref.load();
237
+ }
238
+ catch (error) {
239
+ throw new LazyModuleLoadError(ref.name, error instanceof Error ? error.message : String(error));
240
+ }
241
+ const metatype = loaded && isDynamicModule(loaded) ? loaded.module : loaded;
242
+ if (typeof metatype !== "function" ||
243
+ !Reflect.hasMetadata(MODULE_WATERMARK, metatype)) {
244
+ throw new LazyModuleLoadError(ref.name, "loader did not return a class decorated with @Module()");
245
+ }
246
+ return loaded;
247
+ }
248
+ /**
249
+ * The link a child declared in `declaredIn` uses: what that module sees
250
+ * in this application, then this application's own parent chain. It
251
+ * never caches instances, only which tokens the declaring module sees,
252
+ * so a `canProvide` followed by `get` walks the imports once per token
253
+ * (until a load or unload changes the graph) instead of twice per call.
254
+ * Once this application closes, `canProvide` still answers from the
255
+ * graph, so `get`/`resolve` of a token the child would have taken from
256
+ * here throw `ContainerClosedError` (even with `optional`) instead of
257
+ * quietly reporting it missing.
258
+ */
259
+ linkFor(declaredIn) {
260
+ // Memoised per token: the visibility walk is a breadth-first search
261
+ // over the declaring module's imports. Valid until a load or unload
262
+ // changes the graph, which bumps `graph.version`.
263
+ const visibility = new Map();
264
+ let visibilityVersion = -1;
265
+ const seesLocally = (token) => {
266
+ const { version } = this.container.graph;
267
+ if (version !== visibilityVersion) {
268
+ visibility.clear();
269
+ visibilityVersion = version;
270
+ }
271
+ let sees = visibility.get(token);
272
+ if (sees === undefined) {
273
+ sees =
274
+ this.container.hasProvider(token) &&
275
+ this.container.graph.isProviderVisible(declaredIn, token);
276
+ visibility.set(token, sees);
277
+ }
278
+ return sees;
279
+ };
280
+ return {
281
+ canProvide: (token) => seesLocally(token) || (this.link?.canProvide(token) ?? false),
282
+ get: (token) => seesLocally(token)
283
+ ? this.container.get(token)
284
+ : this.requireLink(token).get(token),
285
+ resolve: (token) => seesLocally(token)
286
+ ? this.container.resolve(token)
287
+ : this.requireLink(token).resolve(token),
288
+ };
289
+ }
290
+ requireLink(token) {
291
+ if (!this.link)
292
+ throw new ProviderNotFoundError(token);
293
+ return this.link;
58
294
  }
59
295
  /**
60
296
  * Bootstraps the application by initializing the container and all providers.
@@ -69,26 +305,135 @@ export class NexusApplications {
69
305
  *
70
306
  * @example
71
307
  * ```typescript
72
- * const app = NexusApplications.create(AppModule);
308
+ * const app = NexusApplication.create(AppModule);
73
309
  * await app.bootstrap();
74
310
  * // Application is now ready to use
75
311
  * ```
76
312
  */
77
- async bootstrap() {
78
- await this.container.run(this.rootModule);
313
+ async bootstrap(options) {
314
+ await this.container.run(this.rootModule, [createInternalModule(this.lazyModuleLoader)], this.link ? { link: this.link } : {});
79
315
  for (const scannerPlugin of this.scannerPlugins) {
80
316
  await scannerPlugin.scan(this.container.graph);
81
317
  }
82
- if (!this.isAsyncContainer) {
83
- for (const [token, node] of this.container.graph.nodes) {
84
- if (node.type === NodeTypeEnum.PROVIDER &&
85
- node.scope === Scope.Singleton) {
86
- await this.container.get(token);
87
- }
88
- }
318
+ if (this.container.errors.length > 0 && options?.throwOnError !== false) {
319
+ throw new BootstrapError(this.container.errors);
89
320
  }
321
+ await this.warmUpSingletons(this.container.graph.nodes.keys());
90
322
  return this;
91
323
  }
324
+ /**
325
+ * Pre-instantiates the singleton providers named by `tokens`, unless the
326
+ * application is running in lazy mode.
327
+ */
328
+ async warmUpSingletons(tokens) {
329
+ if (this.isAsyncContainer) {
330
+ return;
331
+ }
332
+ await this.container.instantiateSingletons(tokens);
333
+ }
334
+ /**
335
+ * Closes the application and cleans up resources.
336
+ *
337
+ * - The closed flag is set synchronously: from this call on, `get`,
338
+ * `resolve` and `load` throw `ContainerClosedError`.
339
+ * - Waits for in-flight lazy loads, then runs on the compile queue so it
340
+ * never interleaves with `load`/`unload`.
341
+ * - Calls every `onModuleDestroy` in reverse creation order, even if some
342
+ * throw; failures are collected into a single `AggregateError`.
343
+ * - Idempotent: later calls return the same promise.
344
+ * - A child application removes itself from its parent's live children
345
+ * once closed.
346
+ *
347
+ * @returns A promise that resolves when the application is closed
348
+ * @throws {AggregateError} If one or more `onModuleDestroy` hooks failed
349
+ *
350
+ * @example
351
+ * ```typescript
352
+ * const app = await NexusApplication.create(AppModule).bootstrap();
353
+ * await app.close();
354
+ * ```
355
+ */
356
+ close() {
357
+ if (!this.closePromise) {
358
+ // Mark the container closed before draining, so module refs are
359
+ // rejected during the drain window too.
360
+ this.container.markClosed();
361
+ this.closePromise = this.closeChildrenThenSelf().finally(() => {
362
+ this.onClosed?.();
363
+ });
364
+ }
365
+ return this.closePromise;
366
+ }
367
+ /**
368
+ * Closes the live children (newest first, one at a time), then this
369
+ * application. Every failure, a child's or its own, ends up in one
370
+ * `AggregateError`, flattened so a child's `AggregateError` contributes
371
+ * its errors rather than nesting.
372
+ */
373
+ async closeChildrenThenSelf() {
374
+ const errors = await closeAll([...this.liveChildren].reverse());
375
+ try {
376
+ await this.drainAndClose();
377
+ }
378
+ catch (error) {
379
+ errors.push(...flattenErrors(error));
380
+ }
381
+ if (errors.length > 0) {
382
+ throw new AggregateError(errors, "One or more onModuleDestroy hooks failed");
383
+ }
384
+ }
385
+ /**
386
+ * Waits for in-flight `load()` calls (including their singleton warm-up,
387
+ * which bypasses the closed guard) so nothing is instantiated after the
388
+ * destroy pass, then tears the container down.
389
+ */
390
+ async drainAndClose() {
391
+ await Promise.allSettled([...this.pendingLoads]);
392
+ await this.container.close();
393
+ }
394
+ /**
395
+ * Unload hook (see `Container.onUnloading`): closes the live children
396
+ * declared by a module the unload destroys, newest first, and forgets
397
+ * the lazy child code those modules declared.
398
+ */
399
+ async closeChildrenDeclaredIn(destroyedModules) {
400
+ const destroyed = new Set(destroyedModules);
401
+ for (const [id, entry] of this.loadedChildren) {
402
+ if (destroyed.has(entry.declaredIn)) {
403
+ this.loadedChildren.delete(id);
404
+ }
405
+ }
406
+ const doomed = [...this.liveChildren]
407
+ .filter((child) => child.declaredIn && destroyed.has(child.declaredIn))
408
+ .reverse();
409
+ // A child someone else is already closing is waited for (it may still
410
+ // use the parent's providers) but neither counted nor re-reported.
411
+ const closingElsewhere = doomed.filter((child) => child.isClosed);
412
+ const started = doomed.filter((child) => !child.isClosed);
413
+ const errors = await closeAll(started);
414
+ await Promise.allSettled(closingElsewhere.map((child) => child.close()));
415
+ return {
416
+ closed: started.length,
417
+ error: errors.length > 0
418
+ ? new AggregateError(errors, "One or more child applications failed to close")
419
+ : undefined,
420
+ };
421
+ }
422
+ /** True once `close()` has been called (the app may still be closing). */
423
+ get isClosed() {
424
+ return this.closePromise !== null;
425
+ }
426
+ assertOpen() {
427
+ if (this.closePromise) {
428
+ throw new ContainerClosedError();
429
+ }
430
+ }
431
+ assertUsable() {
432
+ this.assertOpen();
433
+ if (!this.container.isCompiled) {
434
+ throw new ContainerNotCompiledError();
435
+ }
436
+ }
92
437
  /**
93
438
  * Adds one or more scanner plugins to the application.
94
439
  *
@@ -101,7 +446,7 @@ export class NexusApplications {
101
446
  *
102
447
  * @example
103
448
  * ```typescript
104
- * const app = NexusApplications.create(AppModule)
449
+ * const app = NexusApplication.create(AppModule)
105
450
  * .addScannerPlugin(new CustomScanner())
106
451
  * .addScannerPlugin([new Scanner1(), new Scanner2()]);
107
452
  * await app.bootstrap();
@@ -112,30 +457,63 @@ export class NexusApplications {
112
457
  this.scannerPlugins.push(...plugins);
113
458
  return this;
114
459
  }
460
+ get(token, options = {}) {
461
+ this.assertUsable();
462
+ if (this.container.hasProvider(token)) {
463
+ return this.container.get(token);
464
+ }
465
+ if (this.link?.canProvide(token)) {
466
+ return this.link.get(token);
467
+ }
468
+ if (options.optional) {
469
+ return undefined;
470
+ }
471
+ throw new ProviderNotFoundError(token);
472
+ }
473
+ async resolve(token, options = {}) {
474
+ this.assertUsable();
475
+ if (this.container.hasProvider(token)) {
476
+ return this.container.resolve(token);
477
+ }
478
+ if (this.link?.canProvide(token)) {
479
+ return this.link.resolve(token);
480
+ }
481
+ if (options.optional) {
482
+ return undefined;
483
+ }
484
+ throw new ProviderNotFoundError(token);
485
+ }
115
486
  /**
116
- * Resolves and returns an instance of a provider by its injection token.
117
- *
118
- * If the provider is not found in this container, it will attempt to
119
- * resolve it from the parent container (if set).
120
- *
121
- * @template T - The type of the provider to resolve
122
- * @param token - The injection token (class, string, or symbol)
123
- * @returns A promise that resolves to the provider instance, or undefined if not found
487
+ * Loads a lazy module declared with `lazy()` into this application's
488
+ * container and returns a handle to it. Repeated calls for the same ref
489
+ * return the same providers; the loader runs once.
124
490
  *
125
- * @example
126
- * ```typescript
127
- * const app = await NexusApplications.create(AppModule).bootstrap();
128
- * const userService = await app.get(UserService);
129
- * const config = await app.get('CONFIG');
130
- * ```
491
+ * @throws {LazyModuleLoadError} if the loader fails or returns a non-module
492
+ * @throws {LazyModuleGraphError} if the module's dependency graph is invalid
131
493
  */
132
- async get(token) {
133
- const dependency = await this.container.get(token);
134
- // Check for undefined specifically, not falsy values (null, 0, false, etc. are valid)
135
- if (dependency === undefined) {
136
- return this._parentContainer?.get(token);
494
+ async load(lazyModule) {
495
+ this.assertOpen();
496
+ const loading = this.loadAndWarmUp(lazyModule);
497
+ this.pendingLoads.add(loading);
498
+ try {
499
+ return await loading;
500
+ }
501
+ finally {
502
+ this.pendingLoads.delete(loading);
137
503
  }
138
- return dependency;
504
+ }
505
+ async loadAndWarmUp(lazyModule) {
506
+ const segment = await this.container.load(lazyModule);
507
+ await this.warmUpSingletons(segment.providerTokens);
508
+ return new ModuleRef(this.container, segment);
509
+ }
510
+ /**
511
+ * Unloads a lazy module previously returned by `load()` (directly or via
512
+ * `LazyModuleLoader`): destroys every singleton and module nothing else
513
+ * still needs. A no-op if `ref` is already unloaded.
514
+ */
515
+ async unload(ref) {
516
+ return ref.unload();
139
517
  }
140
518
  /**
141
519
  * Gets all errors that occurred during graph compilation.
@@ -144,7 +522,7 @@ export class NexusApplications {
144
522
  *
145
523
  * @example
146
524
  * ```typescript
147
- * const app = await NexusApplications.create(AppModule).bootstrap();
525
+ * const app = await NexusApplication.create(AppModule).bootstrap();
148
526
  * if (app.errors.length > 0) {
149
527
  * console.error('Application errors:', app.errors);
150
528
  * }
@@ -154,47 +532,27 @@ export class NexusApplications {
154
532
  return this.container.errors;
155
533
  }
156
534
  /**
157
- * Enables async mode for the container.
535
+ * Enables lazy mode for the container.
536
+ *
537
+ * In lazy mode, singleton providers are NOT pre-instantiated during
538
+ * bootstrap. They will be created lazily on first access via resolve();
539
+ * get() throws ProviderNotInstantiatedError until then.
158
540
  *
159
- * In async mode, singleton providers are NOT pre-instantiated during
160
- * bootstrap. They will be created lazily on first access via get().
161
- * This can improve startup time for large applications.
541
+ * @deprecated Use lazy modules (lazy()/load()) instead; in this mode get() throws ProviderNotInstantiatedError until resolve() is called.
162
542
  *
163
543
  * @returns This instance for method chaining
164
544
  *
165
545
  * @example
166
546
  * ```typescript
167
- * const app = NexusApplications.create(AppModule)
168
- * .async();
547
+ * const app = NexusApplication.create(AppModule)
548
+ * .lazy();
169
549
  * await app.bootstrap(); // Singletons are NOT created yet
170
- * const service = await app.get(MyService); // Created on first access
550
+ * const service = await app.resolve(MyService); // Created on first access
171
551
  * ```
172
552
  */
173
- async() {
553
+ lazy() {
174
554
  this.isAsyncContainer = true;
175
555
  return this;
176
556
  }
177
- /**
178
- * Sets a parent container for this application.
179
- *
180
- * When a provider is not found in this container, it will be looked up
181
- * in the parent container. This enables hierarchical container structures.
182
- *
183
- * @param parentContainer - The parent container
184
- * @returns This instance for method chaining
185
- *
186
- * @example
187
- * ```typescript
188
- * const parentApp = await NexusApplications.create(ParentModule).bootstrap();
189
- * const childApp = await NexusApplications.create(ChildModule)
190
- * .setParent(parentApp)
191
- * .bootstrap();
192
- * // childApp can access providers from parentApp
193
- * ```
194
- */
195
- setParent(parentContainer) {
196
- this._parentContainer = parentContainer;
197
- return this;
198
- }
199
557
  }
200
558
  //# sourceMappingURL=nexus-applications.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"nexus-applications.js","sourceRoot":"","sources":["../../../src/core/nexus-applications.ts"],"names":[],"mappings":"AAAA,OAAO,EAKN,YAAY,EAEZ,KAAK,GACL,MAAM,eAAe,CAAC;AACvB,OAAO,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AAC/C,OAAO,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAEhD;;;;;;;;;;;;;;;;GAgBG;AACH,MAAM,OAAO,iBAAiB;IAO7B;;;;;;OAMG;IACH,YACkB,UAAkB,EACnC,OAAiD;QADhC,eAAU,GAAV,UAAU,CAAQ;QAd5B,aAAQ,GAAsB,IAAI,QAAQ,EAAE,CAAC;QAC7C,qBAAgB,GAAG,KAAK,CAAC;QAChB,cAAS,GAAG,IAAI,S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,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC;QAC7D,IAAI,CAAC,cAAc,CAAC,IAAI,CAAC,GAAG,OAAO,CAAC,CAAC;QACrC,OAAO,IAAI,CAAC;IACb,CAAC;IAED;;;;;;;;;;;;;;;;OAgBG;IACI,KAAK,CAAC,GAAG,CAAI,KAAqB;QACxC,MAAM,UAAU,GAAG,MAAM,IAAI,CAAC,SAAS,CAAC,GAAG,CAAI,KAAK,CAAC,CAAC;QAEtD,sFAAsF;QACtF,IAAI,UAAU,KAAK,SAAS,EAAE,CAAC;YAC9B,OAAO,IAAI,CAAC,gBAAgB,EAAE,GAAG,CAAI,KAAK,CAAC,CAAC;QAC7C,CAAC;QAED,OAAO,UAAU,CAAC;IACnB,CAAC;IAED;;;;;;;;;;;;OAYG;IACH,IAAW,MAAM;QAChB,OAAO,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC;IAC9B,CAAC;IAED;;;;;;;;;;;;;;;;OAgBG;IACI,KAAK;QACX,IAAI,CAAC,gBAAgB,GAAG,IAAI,CAAC;QAC7B,OAAO,IAAI,CAAC;IACb,CAAC;IAED;;;;;;;;;;;;;;;;;OAiBG;IACI,SAAS,CAAC,eAA0C;QAC1D,IAAI,CAAC,gBAAgB,GAAG,eAAe,CAAC;QACxC,OAAO,IAAI,CAAC;IACb,CAAC;CACD"}
1
+ {"version":3,"file":"nexus-applications.js","sourceRoot":"","sources":["../../../src/core/nexus-applications.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,yBAAyB,EAAE,MAAM,mBAAmB,CAAC;AAC9D,OAAO,EACN,cAAc,EACd,2BAA2B,EAC3B,oBAAoB,EACpB,mBAAmB,EACnB,qBAAqB,GACrB,MAAM,WAAW,CAAC;AACnB,OAAO,EAON,gBAAgB,GAQhB,MAAM,eAAe,CAAC;AACvB,OAAO,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AAC/C,OAAO,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