@@ -36,9 +36,14 @@ import * as path from 'path';
3636import * as ts from 'typescript' ;
3737import { Compiler , compilation } from 'webpack' ;
3838import { time , timeEnd } from './benchmark' ;
39- import { WebpackCompilerHost , workaroundResolve } from './compiler_host' ;
39+ import { WebpackCompilerHost } from './compiler_host' ;
4040import { resolveEntryModuleFromMain } from './entry_resolver' ;
4141import { DiagnosticMode , gatherDiagnostics , hasErrors } from './gather_diagnostics' ;
42+ import {
43+ AngularCompilerPluginOptions ,
44+ ContextElementDependencyConstructor ,
45+ PLATFORM ,
46+ } from './interfaces' ;
4247import { LazyRouteMap , findLazyRoutes } from './lazy_routes' ;
4348import { TypeScriptPathsPlugin } from './paths-plugin' ;
4449import { WebpackResourceLoader } from './resource_loader' ;
@@ -63,6 +68,7 @@ import {
6368 MESSAGE_KIND ,
6469 UpdateMessage ,
6570} from './type_checker_messages' ;
71+ import { workaroundResolve } from './utils' ;
6672import {
6773 VirtualFileSystemDecorator ,
6874 VirtualWatchFileSystemDecorator ,
@@ -76,61 +82,6 @@ import { WebpackInputHost } from './webpack-input-host';
7682
7783const treeKill = require ( 'tree-kill' ) ;
7884
79- export interface ContextElementDependency { }
80-
81- export interface ContextElementDependencyConstructor {
82- new ( modulePath : string , name : string ) : ContextElementDependency ;
83- }
84-
85- /**
86- * Option Constants
87- */
88- export interface AngularCompilerPluginOptions {
89- sourceMap ?: boolean ;
90- tsConfigPath : string ;
91- basePath ?: string ;
92- entryModule ?: string ;
93- mainPath ?: string ;
94- skipCodeGeneration ?: boolean ;
95- hostReplacementPaths ?: { [ path : string ] : string } | ( ( path : string ) => string ) ;
96- forkTypeChecker ?: boolean ;
97- i18nInFile ?: string ;
98- i18nInFormat ?: string ;
99- i18nOutFile ?: string ;
100- i18nOutFormat ?: string ;
101- locale ?: string ;
102- missingTranslation ?: string ;
103- platform ?: PLATFORM ;
104- nameLazyFiles ?: boolean ;
105- logger ?: logging . Logger ;
106- directTemplateLoading ?: boolean ;
107- // When using the loadChildren string syntax, @ngtools/webpack must query @angular/compiler-cli
108- // via a private API to know which lazy routes exist. This increases build and rebuild time.
109- // When using Ivy, the string syntax is not supported at all. Thus we shouldn't attempt that.
110- // This option is also used for when the compilation doesn't need this sort of processing at all.
111- discoverLazyRoutes ?: boolean ;
112- importFactories ?: boolean ;
113-
114- // added to the list of lazy routes
115- additionalLazyModules ?: { [ module : string ] : string } ;
116- additionalLazyModuleResources ?: string [ ] ;
117-
118- // The ContextElementDependency of correct Webpack compilation.
119- // This is needed when there are multiple Webpack installs.
120- contextElementDependencyConstructor ?: ContextElementDependencyConstructor ;
121-
122- // Use tsconfig to include path globs.
123- compilerOptions ?: ts . CompilerOptions ;
124-
125- host ?: virtualFs . Host < fs . Stats > ;
126- platformTransformers ?: ts . TransformerFactory < ts . SourceFile > [ ] ;
127- }
128-
129- export enum PLATFORM {
130- Browser ,
131- Server ,
132- }
133-
13485export class AngularCompilerPlugin {
13586 private _options : AngularCompilerPluginOptions ;
13687
@@ -701,6 +652,7 @@ export class AngularCompilerPlugin {
701652 host ,
702653 true ,
703654 this . _options . directTemplateLoading ,
655+ this . _platform ,
704656 ) ;
705657
706658 // Create and set a new WebpackResourceLoader in AOT
0 commit comments