11/* ********* TEMPORARILY HERE **************
22 * - will be on npm soon -
3- * import { ngAspnetCoreEngine } from `@ng-universal/ng- aspnetcore-engine`;
3+ * import { ngAspnetCoreEngine } from `@nguniversal/ aspnetcore-engine`;
44 */
55import { Type , NgModuleFactory , NgModuleRef , ApplicationRef , Provider , CompilerFactory , Compiler } from '@angular/core' ;
66import { platformServer , platformDynamicServer , PlatformState , INITIAL_CONFIG , renderModuleFactory } from '@angular/platform-server' ;
@@ -10,8 +10,6 @@ import * as fs from 'fs';
1010import { REQUEST } from '../app/shared/constants/request' ;
1111import { ORIGIN_URL } from '../app/shared/constants/baseurl.constants' ;
1212
13- // import { FileLoader } from './file-loader';
14-
1513export function createTransferScript ( transferData : Object ) : string {
1614 return `<script>window['TRANSFER_CACHE'] = ${ JSON . stringify ( transferData ) } ;</script>` ;
1715}
@@ -127,17 +125,12 @@ export function ngAspnetCoreEngine(
127125 const LINKS = [ ] ;
128126 let TITLE = '' ;
129127
130- //let STYLES_STRING = htmlDoc.substring(
131- //htmlDoc.indexOf('<style ng-transition'),
132- //htmlDoc.lastIndexOf('</style>') + 8
133- //);
134- let STYLES_STRING : string = htmlDoc . indexOf ( '<style ng-transition' ) > - 1
128+ let STYLES_STRING : string = htmlDoc . indexOf ( '<style ng-transition' ) > - 1
135129 ? htmlDoc . substring (
136130 htmlDoc . indexOf ( '<style ng-transition' ) ,
137131 htmlDoc . lastIndexOf ( '</style>' ) + 8 )
138132 : null ;
139- // STYLES_STRING = STYLES_STRING.replace(/\s/g, '').replace('<styleng-transition', '<style ng-transition');
140-
133+
141134 const HEAD = AST_DOCUMENT . head ;
142135
143136 let count = 0 ;
@@ -233,26 +226,24 @@ const factoryCacheMap = new Map<Type<{}>, NgModuleFactory<{}>>();
233226function getFactory (
234227 moduleOrFactory : Type < { } > | NgModuleFactory < { } > , compiler : Compiler
235228) : Promise < NgModuleFactory < { } > > {
229+
236230 return new Promise < NgModuleFactory < { } > > ( ( resolve , reject ) => {
237231 // If module has been compiled AoT
238232 if ( moduleOrFactory instanceof NgModuleFactory ) {
239- console . log ( 'Already AoT?' ) ;
240233 resolve ( moduleOrFactory ) ;
241234 return ;
242235 } else {
243236 let moduleFactory = factoryCacheMap . get ( moduleOrFactory ) ;
244237
245238 // If module factory is cached
246239 if ( moduleFactory ) {
247- console . log ( '\n\n\n WE FOUND ONE!! USE IT!!\n\n\n' ) ;
248240 resolve ( moduleFactory ) ;
249241 return ;
250242 }
251243
252244 // Compile the module and cache it
253245 compiler . compileModuleAsync ( moduleOrFactory )
254246 . then ( ( factory ) => {
255- console . log ( '\n\n\n\n MAP THIS THING!!!!\n\n\n ' ) ;
256247 factoryCacheMap . set ( moduleOrFactory , factory ) ;
257248 resolve ( factory ) ;
258249 } , ( err => {
0 commit comments