refactor: remove obsolete analyzeAppProvidersForDeprecatedConfiguration
closes #11028
This commit is contained in:
parent
ea2e5521e8
commit
566d4361e2
|
@ -13,7 +13,7 @@
|
||||||
*/
|
*/
|
||||||
import * as i18n from './src/i18n/index';
|
import * as i18n from './src/i18n/index';
|
||||||
|
|
||||||
export {COMPILER_PROVIDERS, CompileDiDependencyMetadata, CompileDirectiveMetadata, CompileFactoryMetadata, CompileIdentifierMetadata, CompileMetadataWithIdentifier, CompilePipeMetadata, CompileProviderMetadata, CompileQueryMetadata, CompileTemplateMetadata, CompileTokenMetadata, CompileTypeMetadata, CompilerConfig, DEFAULT_PACKAGE_URL_PROVIDER, DirectiveResolver, NgModuleResolver, OfflineCompiler, PipeResolver, RenderTypes, ResourceLoader, RuntimeCompiler, SourceModule, TEMPLATE_TRANSFORMS, UrlResolver, analyzeAppProvidersForDeprecatedConfiguration, createOfflineCompileUrlResolver, platformCoreDynamic} from './src/compiler';
|
export {COMPILER_PROVIDERS, CompileDiDependencyMetadata, CompileDirectiveMetadata, CompileFactoryMetadata, CompileIdentifierMetadata, CompileMetadataWithIdentifier, CompilePipeMetadata, CompileProviderMetadata, CompileQueryMetadata, CompileTemplateMetadata, CompileTokenMetadata, CompileTypeMetadata, CompilerConfig, DEFAULT_PACKAGE_URL_PROVIDER, DirectiveResolver, NgModuleResolver, OfflineCompiler, PipeResolver, RenderTypes, ResourceLoader, RuntimeCompiler, SourceModule, TEMPLATE_TRANSFORMS, UrlResolver, createOfflineCompileUrlResolver, platformCoreDynamic} from './src/compiler';
|
||||||
export {DEFAULT_INTERPOLATION_CONFIG, InterpolationConfig} from './src/ml_parser/interpolation_config';
|
export {DEFAULT_INTERPOLATION_CONFIG, InterpolationConfig} from './src/ml_parser/interpolation_config';
|
||||||
export {ElementSchemaRegistry} from './src/schema/element_schema_registry';
|
export {ElementSchemaRegistry} from './src/schema/element_schema_registry';
|
||||||
export {i18n};
|
export {i18n};
|
||||||
|
|
|
@ -88,44 +88,6 @@ export const COMPILER_PROVIDERS: Array<any|Type<any>|{[k: string]: any}|any[]> =
|
||||||
NgModuleResolver
|
NgModuleResolver
|
||||||
];
|
];
|
||||||
|
|
||||||
export function analyzeAppProvidersForDeprecatedConfiguration(appProviders: any[] = []): {
|
|
||||||
compilerOptions: CompilerOptions,
|
|
||||||
moduleDeclarations: Type<any>[],
|
|
||||||
deprecationMessages: string[]
|
|
||||||
} {
|
|
||||||
let compilerProviders: any[] = [];
|
|
||||||
let useDebug: boolean;
|
|
||||||
let useJit: boolean;
|
|
||||||
let defaultEncapsulation: ViewEncapsulation;
|
|
||||||
const deprecationMessages: string[] = [];
|
|
||||||
|
|
||||||
// Note: This is a hack to still support the old way
|
|
||||||
// of configuring platform directives / pipes and the compiler resource loader.
|
|
||||||
// This will soon be deprecated!
|
|
||||||
const tempInj = ReflectiveInjector.resolveAndCreate(appProviders);
|
|
||||||
const compilerConfig: CompilerConfig = tempInj.get(CompilerConfig, null);
|
|
||||||
if (compilerConfig) {
|
|
||||||
useJit = compilerConfig.useJit;
|
|
||||||
useDebug = compilerConfig.genDebugInfo;
|
|
||||||
defaultEncapsulation = compilerConfig.defaultEncapsulation;
|
|
||||||
deprecationMessages.push(
|
|
||||||
`Passing CompilerConfig as a regular provider is deprecated. Use "compilerOptions" use a custom "CompilerFactory" platform provider instead.`);
|
|
||||||
}
|
|
||||||
const resourceLoader = tempInj.get(ResourceLoader, null);
|
|
||||||
if (resourceLoader) {
|
|
||||||
compilerProviders.push([{provide: ResourceLoader, useValue: resourceLoader}]);
|
|
||||||
deprecationMessages.push(
|
|
||||||
`Passing ResourceLoader as regular provider is deprecated. Pass the provider via "compilerOptions" instead.`);
|
|
||||||
}
|
|
||||||
const compilerOptions: CompilerOptions = {
|
|
||||||
useJit: useJit,
|
|
||||||
useDebug: useDebug,
|
|
||||||
defaultEncapsulation: defaultEncapsulation,
|
|
||||||
providers: compilerProviders
|
|
||||||
};
|
|
||||||
|
|
||||||
return {compilerOptions, moduleDeclarations: [], deprecationMessages: deprecationMessages};
|
|
||||||
}
|
|
||||||
|
|
||||||
@Injectable()
|
@Injectable()
|
||||||
export class RuntimeCompilerFactory implements CompilerFactory {
|
export class RuntimeCompilerFactory implements CompilerFactory {
|
||||||
|
|
Loading…
Reference in New Issue