fix(platform-browser-dynamic): Rename CACHED_TEMPLATE_PROVIDER to RESOURCE_CACHE_PROVIDER (#10866)
* fix(platform-browser-dynamic): Rename CACHED_TEMPLATE_PROVIDER to RESOURCE_CACHE_PROVIDER Closes #9741 BREAKING CHANGE: `CACHED_TEMPLATE_PROVIDER` is now renamed to `RESOURCE_CACHE_PROVIDER` Before: ```js import {CACHED_TEMPLATE_PROVIDER} from '@angular/platform-browser-dynamic'; ``` After: ```js import {RESOURCE_CACHE_PROVIDER} from '@angular/platform-browser-dynamic'; ``` * Rename XHR -> ResourceLoader
This commit is contained in:
@ -15,7 +15,7 @@ export * from './compile_metadata';
|
||||
export * from './offline_compiler';
|
||||
export {RuntimeCompiler} from './runtime_compiler';
|
||||
export * from './url_resolver';
|
||||
export * from './xhr';
|
||||
export * from './resource_loader';
|
||||
|
||||
export {DirectiveResolver} from './directive_resolver';
|
||||
export {PipeResolver} from './pipe_resolver';
|
||||
@ -41,12 +41,13 @@ import {DirectiveResolver} from './directive_resolver';
|
||||
import {PipeResolver} from './pipe_resolver';
|
||||
import {NgModuleResolver} from './ng_module_resolver';
|
||||
import {Console, Reflector, reflector, ReflectorReader, ReflectionCapabilities} from '../core_private';
|
||||
import {XHR} from './xhr';
|
||||
import {ResourceLoader} from './resource_loader';
|
||||
import * as i18n from './i18n/index';
|
||||
|
||||
const _NO_XHR: XHR = {
|
||||
const _NO_RESOURCE_LOADER: ResourceLoader = {
|
||||
get(url: string): Promise<string>{
|
||||
throw new Error(`No XHR implementation has been provided. Can't read the url "${url}"`);}
|
||||
throw new Error(
|
||||
`No ResourceLoader implementation has been provided. Can't read the url "${url}"`);}
|
||||
};
|
||||
|
||||
/**
|
||||
@ -56,7 +57,7 @@ const _NO_XHR: XHR = {
|
||||
export const COMPILER_PROVIDERS: Array<any|Type<any>|{[k: string]: any}|any[]> = [
|
||||
{provide: Reflector, useValue: reflector},
|
||||
{provide: ReflectorReader, useExisting: Reflector},
|
||||
{provide: XHR, useValue: _NO_XHR},
|
||||
{provide: ResourceLoader, useValue: _NO_RESOURCE_LOADER},
|
||||
Console,
|
||||
Lexer,
|
||||
Parser,
|
||||
@ -101,7 +102,7 @@ export function analyzeAppProvidersForDeprecatedConfiguration(appProviders: any[
|
||||
const deprecationMessages: string[] = [];
|
||||
|
||||
// Note: This is a hack to still support the old way
|
||||
// of configuring platform directives / pipes and the compiler xhr.
|
||||
// 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);
|
||||
@ -112,11 +113,11 @@ export function analyzeAppProvidersForDeprecatedConfiguration(appProviders: any[
|
||||
deprecationMessages.push(
|
||||
`Passing CompilerConfig as a regular provider is deprecated. Use "compilerOptions" use a custom "CompilerFactory" platform provider instead.`);
|
||||
}
|
||||
const xhr = tempInj.get(XHR, null);
|
||||
if (xhr) {
|
||||
compilerProviders.push([{provide: XHR, useValue: xhr}]);
|
||||
const resourceLoader = tempInj.get(ResourceLoader, null);
|
||||
if (resourceLoader) {
|
||||
compilerProviders.push([{provide: ResourceLoader, useValue: resourceLoader}]);
|
||||
deprecationMessages.push(
|
||||
`Passing XHR as regular provider is deprecated. Pass the provider via "compilerOptions" instead.`);
|
||||
`Passing ResourceLoader as regular provider is deprecated. Pass the provider via "compilerOptions" instead.`);
|
||||
}
|
||||
const compilerOptions: CompilerOptions = {
|
||||
useJit: useJit,
|
||||
|
Reference in New Issue
Block a user