diff --git a/tools/public_api_guard/core/index.d.ts b/tools/public_api_guard/core/index.d.ts index 61b230e2d8..c6f51984cf 100644 --- a/tools/public_api_guard/core/index.d.ts +++ b/tools/public_api_guard/core/index.d.ts @@ -237,11 +237,12 @@ export declare class CollectionChangeRecord { /** @stable */ export declare class Compiler { - _injector: Injector; clearCache(): void; clearCacheFor(type: Type): void; compileComponentAsync(component: ConcreteType, ngModule?: Type): Promise>; compileComponentSync(component: ConcreteType, ngModule?: Type): ComponentFactory; + compileModuleAndAllComponentsAsync(moduleType: ConcreteType): Promise>; + compileModuleAndAllComponentsSync(moduleType: ConcreteType): ModuleWithComponentFactories; compileModuleAsync(moduleType: ConcreteType): Promise>; compileModuleSync(moduleType: ConcreteType): NgModuleFactory; } @@ -259,17 +260,6 @@ export declare var Component: ComponentMetadataFactory; /** @stable */ export interface ComponentDecorator extends TypeDecorator { - View(obj: { - templateUrl?: string; - template?: string; - directives?: Array; - pipes?: Array; - renderer?: string; - styles?: string[]; - styleUrls?: string[]; - animations?: AnimationEntryMetadata[]; - interpolation?: [string, string]; - }): ViewDecorator; } /** @stable */ @@ -287,7 +277,7 @@ export declare abstract class ComponentFactoryResolver { } /** @stable */ -export declare class ComponentMetadata extends DirectiveMetadata { +export declare class ComponentMetadata extends DirectiveMetadata implements ComponentMetadataType { animations: AnimationEntryMetadata[]; changeDetection: ChangeDetectionStrategy; directives: Array; @@ -301,93 +291,30 @@ export declare class ComponentMetadata extends DirectiveMetadata { template: string; templateUrl: string; viewProviders: any[]; - constructor({selector, inputs, outputs, properties, events, host, exportAs, moduleId, providers, viewProviders, changeDetection, queries, templateUrl, template, styleUrls, styles, animations, directives, pipes, encapsulation, interpolation, precompile, entryComponents}?: { - selector?: string; - inputs?: string[]; - outputs?: string[]; properties?: string[]; events?: string[]; - host?: { - [key: string]: string; - }; - providers?: any[]; - exportAs?: string; - moduleId?: string; - viewProviders?: any[]; - queries?: { - [key: string]: any; - }; - changeDetection?: ChangeDetectionStrategy; - templateUrl?: string; - template?: string; - styleUrls?: string[]; - styles?: string[]; - animations?: AnimationEntryMetadata[]; - directives?: Array; - pipes?: Array; - encapsulation?: ViewEncapsulation; - interpolation?: [string, string]; - precompile?: Array; - entryComponents?: Array; - }); + constructor({selector, inputs, outputs, properties, events, host, exportAs, moduleId, providers, viewProviders, changeDetection, queries, templateUrl, template, styleUrls, styles, animations, directives, pipes, encapsulation, interpolation, entryComponents}?: ComponentMetadataType); } /** @stable */ export interface ComponentMetadataFactory { - (obj: { - selector?: string; - inputs?: string[]; - outputs?: string[]; - properties?: string[]; - events?: string[]; - host?: { - [key: string]: string; - }; - providers?: any[]; - exportAs?: string; - moduleId?: string; - queries?: { - [key: string]: any; - }; - viewProviders?: any[]; - changeDetection?: ChangeDetectionStrategy; - templateUrl?: string; - template?: string; - styleUrls?: string[]; - styles?: string[]; - animations?: AnimationEntryMetadata[]; - directives?: Array; - pipes?: Array; - encapsulation?: ViewEncapsulation; - interpolation?: [string, string]; - entryComponents?: Array; - }): ComponentDecorator; - new (obj: { - selector?: string; - inputs?: string[]; - outputs?: string[]; - properties?: string[]; - events?: string[]; - host?: { - [key: string]: string; - }; - providers?: any[]; - exportAs?: string; - moduleId?: string; - queries?: { - [key: string]: any; - }; - viewProviders?: any[]; - changeDetection?: ChangeDetectionStrategy; - templateUrl?: string; - template?: string; - styleUrls?: string[]; - styles?: string[]; - animations?: AnimationEntryMetadata[]; - directives?: Array; - pipes?: Array; - encapsulation?: ViewEncapsulation; - interpolation?: [string, string]; - entryComponents?: Array; - }): ComponentMetadata; + (obj: ComponentMetadataType): ComponentDecorator; + new (obj: ComponentMetadataType): ComponentMetadata; +} + +/** @experimental */ +export interface ComponentMetadataType extends DirectiveMetadataType { + animations?: AnimationEntryMetadata[]; + changeDetection?: ChangeDetectionStrategy; + directives?: Array; + encapsulation?: ViewEncapsulation; + entryComponents?: Array; + interpolation?: [string, string]; + moduleId?: string; + pipes?: Array; + styleUrls?: string[]; + styles?: string[]; + template?: string; + templateUrl?: string; + viewProviders?: any[]; } /** @stable */ @@ -550,7 +477,7 @@ export interface DirectiveDecorator extends TypeDecorator { } /** @stable */ -export declare class DirectiveMetadata extends InjectableMetadata { +export declare class DirectiveMetadata extends InjectableMetadata implements DirectiveMetadataType { /** @deprecated */ events: string[]; exportAs: string; host: { @@ -564,53 +491,30 @@ export declare class DirectiveMetadata extends InjectableMetadata { [key: string]: any; }; selector: string; - constructor({selector, inputs, outputs, properties, events, host, providers, exportAs, queries}?: { - selector?: string; - inputs?: string[]; - outputs?: string[]; properties?: string[]; events?: string[]; - host?: { - [key: string]: string; - }; - providers?: any[]; - exportAs?: string; - queries?: { - [key: string]: any; - }; - }); + constructor({selector, inputs, outputs, properties, events, host, providers, exportAs, queries}?: DirectiveMetadataType); } /** @stable */ export interface DirectiveMetadataFactory { - (obj: { - selector?: string; - inputs?: string[]; - outputs?: string[]; - properties?: string[]; - events?: string[]; - host?: { - [key: string]: string; - }; - providers?: any[]; - exportAs?: string; - queries?: { - [key: string]: any; - }; - }): DirectiveDecorator; - new (obj: { - selector?: string; - inputs?: string[]; - outputs?: string[]; - properties?: string[]; - events?: string[]; - host?: { - [key: string]: string; - }; - providers?: any[]; - exportAs?: string; - queries?: { - [key: string]: any; - }; - }): DirectiveMetadata; + (obj: DirectiveMetadataType): DirectiveDecorator; + new (obj: DirectiveMetadataType): DirectiveMetadata; +} + +/** @experimental */ +export interface DirectiveMetadataType { + events?: string[]; + exportAs?: string; + host?: { + [key: string]: string; + }; + inputs?: string[]; + outputs?: string[]; + properties?: string[]; + providers?: any[]; + queries?: { + [key: string]: any; + }; + selector?: string; } /** @experimental */ @@ -859,6 +763,13 @@ export declare class KeyValueDiffers { /** @deprecated */ export declare function lockRunMode(): void; +/** @experimental */ +export declare class ModuleWithComponentFactories { + componentFactories: ComponentFactory[]; + ngModuleFactory: NgModuleFactory; + constructor(ngModuleFactory: NgModuleFactory, componentFactories: ComponentFactory[]); +} + /** @experimental */ export interface ModuleWithProviders { ngModule: Type; @@ -887,41 +798,30 @@ export declare abstract class NgModuleFactoryLoader { } /** @experimental */ -export declare class NgModuleMetadata extends InjectableMetadata { +export declare class NgModuleMetadata extends InjectableMetadata implements NgModuleMetadataType { declarations: Array; entryComponents: Array; exports: Array; imports: Array; providers: any[]; schemas: Array; - constructor({providers, declarations, imports, exports, entryComponents, schemas}?: { - providers?: any[]; - declarations?: Array; - imports?: Array; - exports?: Array; - entryComponents?: Array; - schemas?: Array; - }); + constructor({providers, declarations, imports, exports, entryComponents, schemas}?: NgModuleMetadataType); } /** @experimental */ export interface NgModuleMetadataFactory { - (obj?: { - providers?: any[]; - declarations?: Array; - imports?: Array; - exports?: Array; - entryComponents?: Array; - schemas?: Array; - }): NgModuleDecorator; - new (obj?: { - providers?: any[]; - declarations?: Array; - imports?: Array; - exports?: Array; - entryComponents?: Array; - schemas?: Array; - }): NgModuleMetadata; + (obj?: NgModuleMetadataType): NgModuleDecorator; + new (obj?: NgModuleMetadataType): NgModuleMetadata; +} + +/** @experimental */ +export interface NgModuleMetadataType { + declarations?: Array; + entryComponents?: Array; + exports?: Array; + imports?: Array; + providers?: any[]; + schemas?: Array; } /** @experimental */ @@ -1036,25 +936,22 @@ export declare const PACKAGE_ROOT_URL: any; export declare var Pipe: PipeMetadataFactory; /** @stable */ -export declare class PipeMetadata extends InjectableMetadata { +export declare class PipeMetadata extends InjectableMetadata implements PipeMetadataType { name: string; pure: boolean; - constructor({name, pure}: { - name: string; - pure?: boolean; - }); + constructor({name, pure}: PipeMetadataType); } /** @stable */ export interface PipeMetadataFactory { - (obj: { - name: string; - pure?: boolean; - }): any; - new (obj: { - name: string; - pure?: boolean; - }): any; + (obj: PipeMetadataType): any; + new (obj: PipeMetadataType): any; +} + +/** @experimental */ +export interface PipeMetadataType { + name: string; + pure?: boolean; } /** @stable */ @@ -1476,21 +1373,6 @@ export declare abstract class ViewContainerRef { abstract remove(index?: number): void; } -/** @experimental */ -export interface ViewDecorator extends TypeDecorator { - View(obj: { - templateUrl?: string; - template?: string; - directives?: Array; - pipes?: Array; - renderer?: string; - styles?: string[]; - styleUrls?: string[]; - animations?: AnimationEntryMetadata[]; - interpolation?: [string, string]; - }): ViewDecorator; -} - /** @stable */ export declare enum ViewEncapsulation { Emulated = 0, @@ -1498,7 +1380,7 @@ export declare enum ViewEncapsulation { None = 2, } -/** @experimental */ +/** @deprecated */ export declare class ViewMetadata { animations: AnimationEntryMetadata[]; directives: Array; @@ -1522,32 +1404,6 @@ export declare class ViewMetadata { }); } -/** @experimental */ -export interface ViewMetadataFactory { - (obj: { - templateUrl?: string; - template?: string; - directives?: Array; - pipes?: Array; - encapsulation?: ViewEncapsulation; - styles?: string[]; - styleUrls?: string[]; - animations?: AnimationEntryMetadata[]; - interpolation?: [string, string]; - }): ViewDecorator; - new (obj: { - templateUrl?: string; - template?: string; - directives?: Array; - pipes?: Array; - encapsulation?: ViewEncapsulation; - styles?: string[]; - styleUrls?: string[]; - animations?: AnimationEntryMetadata[]; - interpolation?: [string, string]; - }): ViewMetadata; -} - /** @deprecated */ export declare var ViewQuery: QueryMetadataFactory; diff --git a/tools/public_api_guard/core/testing.d.ts b/tools/public_api_guard/core/testing.d.ts index df73a33362..534fbfe06f 100644 --- a/tools/public_api_guard/core/testing.d.ts +++ b/tools/public_api_guard/core/testing.d.ts @@ -1,4 +1,4 @@ -/** @stable */ +/** @deprecated */ export declare function addProviders(providers: Array): void; /** @stable */ @@ -28,27 +28,9 @@ export declare var ComponentFixtureAutoDetect: OpaqueToken; /** @experimental */ export declare var ComponentFixtureNoNgZone: OpaqueToken; -/** @stable */ -export declare function configureCompiler(config: { - providers?: any[]; - useJit?: boolean; -}): void; - -/** @stable */ -export declare function configureModule(moduleDef: { - providers?: any[]; - declarations?: any[]; - imports?: any[]; - entryComponents?: any[]; - schemas?: Array; -}): void; - /** @experimental */ export declare function discardPeriodicTasks(): void; -/** @experimental */ -export declare function doAsyncEntryPointCompilation(): Promise; - /** @experimental */ export declare function fakeAsync(fn: Function): (...args: any[]) => any; @@ -61,29 +43,25 @@ export declare function getTestBed(): TestBed; /** @deprecated */ export declare function getTestInjector(): TestBed; -/** @experimental */ -export declare function initTestEnvironment(ngModule: Type, platform: PlatformRef): Injector; - /** @stable */ export declare function inject(tokens: any[], fn: Function): () => any; /** @experimental */ export declare class InjectSetupWrapper { - constructor(_moduleDef: () => { - providers?: any[]; - declarations?: any[]; - imports?: any[]; - entryComponents?: any[]; - }); + constructor(_moduleDef: () => TestModuleMetadata); inject(tokens: any[], fn: Function): () => any; } +/** @experimental */ +export declare type MetadataOverride = { + add?: T; + remove?: T; + set?: T; +}; + /** @deprecated */ export declare function resetBaseTestProviders(): void; -/** @experimental */ -export declare function resetTestEnvironment(): void; - /** @deprecated */ export declare function setBaseTestProviders(platformProviders: Array, applicationProviders: Array): void; @@ -91,32 +69,47 @@ export declare function setBaseTestProviders(platformProviders: Array; configureCompiler(config: { providers?: any[]; useJit?: boolean; }): void; - configureModule(moduleDef: { - providers?: any[]; - declarations?: any[]; - imports?: any[]; - entryComponents?: any[]; - schemas?: Array; - }): void; - createModuleFactory(): Promise>; + configureTestingModule(moduleDef: TestModuleMetadata): void; + createComponent(component: ConcreteType): ComponentFixture; execute(tokens: any[], fn: Function): any; get(token: any, notFoundValue?: any): any; - initTestModule(): void; - reset(): void; + /** @experimental */ initTestEnvironment(ngModule: Type, platform: PlatformRef): void; + overrideComponent(component: ConcreteType, override: MetadataOverride): void; + overrideDirective(directive: ConcreteType, override: MetadataOverride): void; + overrideModule(ngModule: ConcreteType, override: MetadataOverride): void; + overridePipe(pipe: ConcreteType, override: MetadataOverride): void; + /** @deprecated */ reset(): void; + /** @experimental */ resetTestEnvironment(): void; + resetTestingModule(): void; + static compileComponents(): Promise; + static configureCompiler(config: { + providers?: any[]; + useJit?: boolean; + }): typeof TestBed; + static configureTestingModule(moduleDef: TestModuleMetadata): typeof TestBed; + static createComponent(component: ConcreteType): ComponentFixture; + /** @experimental */ static initTestEnvironment(ngModule: Type, platform: PlatformRef): TestBed; + static overrideComponent(component: ConcreteType, override: MetadataOverride): typeof TestBed; + static overrideDirective(directive: ConcreteType, override: MetadataOverride): typeof TestBed; + static overrideModule(ngModule: ConcreteType, override: MetadataOverride): typeof TestBed; + static overridePipe(pipe: ConcreteType, override: MetadataOverride): typeof TestBed; + /** @experimental */ static resetTestEnvironment(): void; + static resetTestingModule(): typeof TestBed; } -/** @stable */ +/** @deprecated */ export declare class TestComponentBuilder { protected _injector: Injector; constructor(_injector: Injector); - createAsync(rootComponentType: ConcreteType, ngModule?: ConcreteType): Promise>; - createFakeAsync(rootComponentType: ConcreteType, ngModule?: ConcreteType): ComponentFixture; + createAsync(rootComponentType: ConcreteType): Promise>; + createFakeAsync(rootComponentType: ConcreteType): ComponentFixture; protected createFromFactory(ngZone: NgZone, componentFactory: ComponentFactory): ComponentFixture; - createSync(rootComponentType: ConcreteType, ngModule?: ConcreteType): ComponentFixture; + createSync(rootComponentType: ConcreteType): ComponentFixture; overrideAnimations(componentType: Type, animations: AnimationEntryMetadata[]): TestComponentBuilder; overrideDirective(componentType: Type, from: Type, to: Type): TestComponentBuilder; overrideProviders(type: Type, providers: any[]): TestComponentBuilder; @@ -131,16 +124,18 @@ export declare class TestComponentRenderer { } /** @experimental */ -export declare function tick(millis?: number): void; - -/** @experimental */ -export declare function withModule(moduleDef: () => { +export declare type TestModuleMetadata = { providers?: any[]; declarations?: any[]; imports?: any[]; - entryComponents?: any[]; schemas?: Array; -}): InjectSetupWrapper; +}; /** @experimental */ +export declare function tick(millis?: number): void; + +/** @experimental */ +export declare function withModule(moduleDef: TestModuleMetadata): InjectSetupWrapper; + +/** @deprecated */ export declare function withProviders(providers: () => any): InjectSetupWrapper;