@tstdl/base 0.92.81 → 0.92.82

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.
@@ -89,21 +89,22 @@ let Application = class Application {
89
89
  return this.#shutdownPromise;
90
90
  }
91
91
  async _run(functionsAndModules, options = {}) {
92
- for (const fnOrModule of functionsAndModules.flatMap((fns) => fns)) {
93
- if (fnOrModule.prototype instanceof ModuleBase) {
94
- this.registerModule(fnOrModule);
95
- }
96
- else {
97
- this.registerModuleFunction(fnOrModule);
92
+ let modules;
93
+ try {
94
+ for (const fnOrModule of functionsAndModules.flatMap((fns) => fns)) {
95
+ if (fnOrModule.prototype instanceof ModuleBase) {
96
+ this.registerModule(fnOrModule);
97
+ }
98
+ else {
99
+ this.registerModuleFunction(fnOrModule);
100
+ }
98
101
  }
99
- }
100
- if (isDefined(options.bootstrap)) {
101
- for (const fn of toArray(options.bootstrap)) {
102
- await runInInjectionContext(this.#injector, fn);
102
+ if (isDefined(options.bootstrap)) {
103
+ for (const fn of toArray(options.bootstrap)) {
104
+ await runInInjectionContext(this.#injector, fn);
105
+ }
103
106
  }
104
- }
105
- const modules = await toArrayAsync(mapAsync(this.#moduleTypesAndInstances, async (instanceOrType) => (isFunction(instanceOrType) ? this.#injector.resolveAsync(instanceOrType) : instanceOrType)));
106
- try {
107
+ modules = await toArrayAsync(mapAsync(this.#moduleTypesAndInstances, async (instanceOrType) => (isFunction(instanceOrType) ? this.#injector.resolveAsync(instanceOrType) : instanceOrType)));
107
108
  await Promise.race([
108
109
  this.runModules(modules),
109
110
  this.shutdownSignal
@@ -115,7 +116,9 @@ let Application = class Application {
115
116
  finally {
116
117
  this.requestShutdown();
117
118
  this.#logger.info('Shutting down');
118
- await this.stopModules(modules);
119
+ if (isDefined(modules)) {
120
+ await this.stopModules(modules);
121
+ }
119
122
  await this.#injector.dispose();
120
123
  this.#logger.info('Bye');
121
124
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tstdl/base",
3
- "version": "0.92.81",
3
+ "version": "0.92.82",
4
4
  "author": "Patrick Hein",
5
5
  "publishConfig": {
6
6
  "access": "public"