11import {
22 INestApplicationContext ,
3+ Logger ,
34 LoggerService ,
45 ShutdownSignal ,
56} from '@nestjs/common' ;
6- import { Logger } from '@nestjs/common' ;
77import { Abstract } from '@nestjs/common/interfaces' ;
88import { Type } from '@nestjs/common/interfaces/type.interface' ;
99import { isEmpty } from '@nestjs/common/utils/shared.utils' ;
10+ import { MESSAGES } from './constants' ;
1011import { UnknownElementException } from './errors/exceptions/unknown-element.exception' ;
1112import { UnknownModuleException } from './errors/exceptions/unknown-module.exception' ;
1213import { createContextId } from './helpers' ;
@@ -23,22 +24,19 @@ import { ContainerScanner } from './injector/container-scanner';
2324import { Injector } from './injector/injector' ;
2425import { InstanceWrapper } from './injector/instance-wrapper' ;
2526import { Module } from './injector/module' ;
26- import { ModuleTokenFactory } from './injector/module-token-factory' ;
27- import { MESSAGES } from './constants' ;
2827
2928/**
3029 * @publicApi
3130 */
3231export class NestApplicationContext implements INestApplicationContext {
33- protected isInitialized : boolean = false ;
32+ protected isInitialized = false ;
3433 protected readonly injector = new Injector ( ) ;
35- private readonly moduleTokenFactory = new ModuleTokenFactory ( ) ;
34+ private readonly activeShutdownSignals = new Array < string > ( ) ;
3635 private readonly containerScanner : ContainerScanner ;
37- private readonly activeShutdownSignals : string [ ] = new Array < string > ( ) ;
3836
3937 constructor (
4038 protected readonly container : NestContainer ,
41- private readonly scope : Type < any > [ ] = [ ] ,
39+ private readonly scope = new Array < Type < any > > ( ) ,
4240 private contextModule : Module = null ,
4341 ) {
4442 this . containerScanner = new ContainerScanner ( container ) ;
@@ -53,8 +51,9 @@ export class NestApplicationContext implements INestApplicationContext {
5351 const modules = this . container . getModules ( ) ;
5452 const moduleMetatype = this . contextModule . metatype ;
5553 const scope = this . scope . concat ( moduleMetatype ) ;
54+ const moduleTokenFactory = this . container . getModuleTokenFactory ( ) ;
5655
57- const token = this . moduleTokenFactory . create ( module , scope ) ;
56+ const token = moduleTokenFactory . create ( module , scope ) ;
5857 const selectedModule = modules . get ( token ) ;
5958 if ( ! selectedModule ) {
6059 throw new UnknownModuleException ( ) ;
0 commit comments