refactor(core): remove previously deprecated SystemJsComponentResolver and SystemJsCmpFactoryResolver
BREAKING CHANGE: previously deprecated SystemJsComponentResolver and SystemJsCmpFactoryResolver have been removed. Please follow deprecation instructions to migrate your code.
This commit is contained in:
parent
231ed69507
commit
b238414984
|
@ -18,7 +18,6 @@ export {NgModuleFactory, NgModuleRef} from './linker/ng_module_factory';
|
|||
export {NgModuleFactoryLoader} from './linker/ng_module_factory_loader';
|
||||
export {QueryList} from './linker/query_list';
|
||||
export {SystemJsNgModuleLoader} from './linker/system_js_ng_module_factory_loader';
|
||||
export {SystemJsCmpFactoryResolver, SystemJsComponentResolver} from './linker/systemjs_component_resolver';
|
||||
export {TemplateRef} from './linker/template_ref';
|
||||
export {ViewContainerRef} from './linker/view_container_ref';
|
||||
export {EmbeddedViewRef, ViewRef} from './linker/view_ref';
|
||||
|
|
|
@ -1,74 +0,0 @@
|
|||
/**
|
||||
* @license
|
||||
* Copyright Google Inc. All Rights Reserved.
|
||||
*
|
||||
* Use of this source code is governed by an MIT-style license that can be
|
||||
* found in the LICENSE file at https://angular.io/license
|
||||
*/
|
||||
|
||||
import {Console} from '../console';
|
||||
import {Injectable} from '../di';
|
||||
import {isString} from '../facade/lang';
|
||||
import {Type} from '../type';
|
||||
import {ComponentFactory} from './component_factory';
|
||||
import {ComponentResolver} from './component_resolver';
|
||||
|
||||
const _SEPARATOR = '#';
|
||||
|
||||
/**
|
||||
* Component resolver that can load components lazily
|
||||
*
|
||||
* @deprecated Lazy loading of components is deprecated. Use {@link SystemJsNgModuleLoader} to lazy
|
||||
* load
|
||||
* {@link NgModuleFactory}s instead.
|
||||
*/
|
||||
@Injectable()
|
||||
export class SystemJsComponentResolver implements ComponentResolver {
|
||||
constructor(private _resolver: ComponentResolver, private _console: Console) {}
|
||||
|
||||
resolveComponent(componentType: string|Type<any>): Promise<ComponentFactory<any>> {
|
||||
if (isString(componentType)) {
|
||||
this._console.warn(ComponentResolver.LazyLoadingDeprecationMsg);
|
||||
let [module, component] = componentType.split(_SEPARATOR);
|
||||
|
||||
if (component === void(0)) {
|
||||
// Use the default export when no component is specified
|
||||
component = 'default';
|
||||
}
|
||||
|
||||
return System.import(module).then(
|
||||
(module: any) => this._resolver.resolveComponent(module[component]));
|
||||
}
|
||||
|
||||
return this._resolver.resolveComponent(componentType);
|
||||
}
|
||||
|
||||
clearCache(): void {}
|
||||
}
|
||||
|
||||
const FACTORY_MODULE_SUFFIX = '.ngfactory';
|
||||
const FACTORY_CLASS_SUFFIX = 'NgFactory';
|
||||
|
||||
/**
|
||||
* Component resolver that can load component factories lazily
|
||||
*
|
||||
* @deprecated Lazy loading of components is deprecated. Use {@link SystemJsNgModuleLoader}
|
||||
* to lazy
|
||||
* load {@link NgModuleFactory}s instead.
|
||||
*/
|
||||
@Injectable()
|
||||
export class SystemJsCmpFactoryResolver implements ComponentResolver {
|
||||
constructor(private _console: Console) {}
|
||||
resolveComponent(componentType: string|Type<any>): Promise<ComponentFactory<any>> {
|
||||
if (isString(componentType)) {
|
||||
this._console.warn(ComponentResolver.LazyLoadingDeprecationMsg);
|
||||
let [module, factory] = componentType.split(_SEPARATOR);
|
||||
return System.import(module + FACTORY_MODULE_SUFFIX)
|
||||
.then((module: any) => module[factory + FACTORY_CLASS_SUFFIX]);
|
||||
}
|
||||
|
||||
return Promise.resolve(null);
|
||||
}
|
||||
|
||||
clearCache(): void {}
|
||||
}
|
|
@ -1243,20 +1243,6 @@ export declare function style(tokens: string | {
|
|||
[key: string]: string | number;
|
||||
}>): AnimationStyleMetadata;
|
||||
|
||||
/** @deprecated */
|
||||
export declare class SystemJsCmpFactoryResolver implements ComponentResolver {
|
||||
constructor(_console: Console);
|
||||
clearCache(): void;
|
||||
resolveComponent(componentType: string | Type<any>): Promise<ComponentFactory<any>>;
|
||||
}
|
||||
|
||||
/** @deprecated */
|
||||
export declare class SystemJsComponentResolver implements ComponentResolver {
|
||||
constructor(_resolver: ComponentResolver, _console: Console);
|
||||
clearCache(): void;
|
||||
resolveComponent(componentType: string | Type<any>): Promise<ComponentFactory<any>>;
|
||||
}
|
||||
|
||||
/** @experimental */
|
||||
export declare class SystemJsNgModuleLoader implements NgModuleFactoryLoader {
|
||||
constructor(_compiler: Compiler);
|
||||
|
|
Loading…
Reference in New Issue