5
5
* Use of this source code is governed by an MIT-style license that can be
6
6
* found in the LICENSE file at https://angular.io/license
7
7
*/
8
- import { Type , NgModuleFactory , CompilerFactory , Compiler , StaticProvider } from '@angular/core' ;
9
- import { platformDynamicServer } from '@angular/platform-server' ;
10
8
import { DOCUMENT } from '@angular/common' ;
11
9
import { ResourceLoader } from '@angular/compiler' ;
10
+ import { Compiler , CompilerFactory , NgModuleFactory , StaticProvider , Type } from '@angular/core' ;
11
+ import { platformDynamicServer } from '@angular/platform-server' ;
12
12
13
- import { REQUEST , ORIGIN_URL } from '@nguniversal/aspnetcore-engine/tokens' ;
13
+ import { ORIGIN_URL , REQUEST } from '@nguniversal/aspnetcore-engine/tokens' ;
14
14
import { FileLoader } from './file-loader' ;
15
15
import { IEngineOptions } from './interfaces/engine-options' ;
16
16
import { IEngineRenderResult } from './interfaces/engine-render-result' ;
@@ -37,7 +37,9 @@ function _getUniversalData(doc: Document): UniversalData {
37
37
const META : string [ ] = [ ] ;
38
38
const LINKS : string [ ] = [ ] ;
39
39
40
+ // tslint:disable-next-line: no-non-null-assertion
40
41
for ( let i = 0 ; i < doc . head ! . children . length ; i ++ ) {
42
+ // tslint:disable-next-line: no-non-null-assertion
41
43
const element = doc . head ! . children [ i ] ;
42
44
const tagName = element . tagName . toUpperCase ( ) ;
43
45
@@ -83,6 +85,7 @@ function _getUniversalData(doc: Document): UniversalData {
83
85
84
86
return {
85
87
title : doc . title ,
88
+ // tslint:disable-next-line: no-non-null-assertion
86
89
appNode : doc . querySelector ( appSelector ) ! . outerHTML ,
87
90
scripts : SCRIPTS . join ( '\n' ) ,
88
91
styles : STYLES . join ( '\n' ) ,
@@ -158,6 +161,7 @@ function getReqResProviders(origin: string, request: string): StaticProvider[] {
158
161
useValue : request
159
162
}
160
163
] ;
164
+
161
165
return providers ;
162
166
}
163
167
@@ -170,7 +174,7 @@ async function getFactory(
170
174
if ( moduleOrFactory instanceof NgModuleFactory ) {
171
175
return moduleOrFactory ;
172
176
} else {
173
- let moduleFactory = factoryCacheMap . get ( moduleOrFactory ) ;
177
+ const moduleFactory = factoryCacheMap . get ( moduleOrFactory ) ;
174
178
// If module factory is cached
175
179
if ( moduleFactory ) {
176
180
return moduleFactory ;
@@ -179,6 +183,7 @@ async function getFactory(
179
183
// Compile the module and cache it
180
184
const factory = await compiler . compileModuleAsync ( moduleOrFactory ) ;
181
185
factoryCacheMap . set ( moduleOrFactory , factory ) ;
186
+
182
187
return factory ;
183
188
}
184
189
}
0 commit comments