revert: refactor(ivy): make return value of define(Component|Directive|Pipe|Injector|Injectable) private (#23371)

This reverts commit 2c09b707ce.
This commit is contained in:
Igor Minar
2018-04-13 23:02:29 -07:00
parent 80e483ceac
commit 674c3def31
32 changed files with 172 additions and 179 deletions

View File

@ -35,24 +35,24 @@ export const enum RenderFlags {
}
/**
* A subclass of `Type` which has a static `ngComponentDef`:`ɵComponentDef` field making it
* A subclass of `Type` which has a static `ngComponentDef`:`ComponentDef` field making it
* consumable for rendering.
*/
export interface ComponentType<T> extends Type<T> { ngComponentDef: ɵComponentDef<T>; }
export interface ComponentType<T> extends Type<T> { ngComponentDef: ComponentDef<T>; }
/**
* A subclass of `Type` which has a static `ngDirectiveDef`:`ɵDirectiveDef` field making it
* A subclass of `Type` which has a static `ngDirectiveDef`:`DirectiveDef` field making it
* consumable for rendering.
*/
export interface DirectiveType<T> extends Type<T> { ngDirectiveDef: ɵDirectiveDef<T>; }
export interface DirectiveType<T> extends Type<T> { ngDirectiveDef: DirectiveDef<T>; }
export const enum DirectiveDefFlags {ContentQuery = 0b10}
/**
* A subclass of `Type` which has a static `ngPipeDef`:`ɵPipeDef` field making it
* A subclass of `Type` which has a static `ngPipeDef`:`PipeDef` field making it
* consumable for rendering.
*/
export interface PipeType<T> extends Type<T> { ngPipeDef: ɵPipeDef<T>; }
export interface PipeType<T> extends Type<T> { ngPipeDef: PipeDef<T>; }
/**
* Runtime link information for Directives.
@ -65,18 +65,13 @@ export interface PipeType<T> extends Type<T> { ngPipeDef: ɵPipeDef<T>; }
* can change between versions.
*
* See: {@link defineDirective}
*
* NOTE: This is a semi public API, and there are no guaranties that the shape of this API will
* remain consistent between version. Use with caution.
*
* @experimental
*/
export interface ɵDirectiveDef<T> {
export interface DirectiveDef<T> {
/** Token representing the directive. Used by DI. */
type: Type<T>;
/** Function that makes a directive public to the DI system. */
diPublic: ((def: ɵDirectiveDef<any>) => void)|null;
diPublic: ((def: DirectiveDef<any>) => void)|null;
/** The selectors that will be used to match nodes to this directive. */
selectors: CssSelectorList;
@ -140,13 +135,8 @@ export interface ɵDirectiveDef<T> {
* can change between versions.
*
* See: {@link defineComponent}
*
* NOTE: This is a semi public API, and there are no guaranties that the shape of this API will
* remain consistent between version. Use with caution.
*
* @experimental
*/
export interface ɵComponentDef<T> extends ɵDirectiveDef<T> {
export interface ComponentDef<T> extends DirectiveDef<T> {
/**
* The View template of the component.
*
@ -179,8 +169,8 @@ export interface ɵComponentDef<T> extends ɵDirectiveDef<T> {
/**
* Registry of directives and components that may be found in this view.
*
* The property is either an array of `ɵDirectiveDef`s or a function which returns the array of
* `ɵDirectiveDef`s. The function is necessary to be able to support forward declarations.
* The property is either an array of `DirectiveDef`s or a function which returns the array of
* `DirectiveDef`s. The function is necessary to be able to support forward declarations.
*/
directiveDefs: DirectiveDefListOrFactory|null;
@ -204,13 +194,8 @@ export interface ɵComponentDef<T> extends ɵDirectiveDef<T> {
* can change between versions.
*
* See: {@link definePipe}
*
* NOTE: This is a semi public API, and there are no guaranties that the shape of this API will
* remain consistent between version. Use with caution.
*
* @experimental
*/
export interface ɵPipeDef<T> {
export interface PipeDef<T> {
/**
* Pipe name.
*
@ -238,8 +223,8 @@ export interface ɵPipeDef<T> {
onDestroy: (() => void)|null;
}
export type DirectiveDefFeature = <T>(directiveDef: ɵDirectiveDef<T>) => void;
export type ComponentDefFeature = <T>(componentDef: ɵComponentDef<T>) => void;
export type DirectiveDefFeature = <T>(directiveDef: DirectiveDef<T>) => void;
export type ComponentDefFeature = <T>(componentDef: ComponentDef<T>) => void;
/**
* Type used for directiveDefs on component definition.
@ -248,12 +233,12 @@ export type ComponentDefFeature = <T>(componentDef: ɵComponentDef<T>) => void;
*/
export type DirectiveDefListOrFactory = (() => DirectiveDefList) | DirectiveDefList;
export type DirectiveDefList = (ɵDirectiveDef<any>| ɵComponentDef<any>)[];
export type DirectiveDefList = (DirectiveDef<any>| ComponentDef<any>)[];
export type DirectiveTypesOrFactory = (() => DirectiveTypeList) | DirectiveTypeList;
export type DirectiveTypeList =
(ɵDirectiveDef<any>| ɵComponentDef<any>|
(DirectiveDef<any>| ComponentDef<any>|
Type<any>/* Type as workaround for: Microsoft/TypeScript/issues/4881 */)[];
/**
@ -263,12 +248,12 @@ export type DirectiveTypeList =
*/
export type PipeDefListOrFactory = (() => PipeDefList) | PipeDefList;
export type PipeDefList = ɵPipeDef<any>[];
export type PipeDefList = PipeDef<any>[];
export type PipeTypesOrFactory = (() => DirectiveTypeList) | DirectiveTypeList;
export type PipeTypeList =
(ɵPipeDef<any>| Type<any>/* Type as workaround for: Microsoft/TypeScript/issues/4881 */)[];
(PipeDef<any>| Type<any>/* Type as workaround for: Microsoft/TypeScript/issues/4881 */)[];
// Note: This hack is necessary so we don't erroneously get a circular dependency

View File

@ -8,7 +8,7 @@
import {Injector} from '../../di/injector';
import {LContainer} from './container';
import {ComponentTemplate, DirectiveDefList, PipeDefList, ɵDirectiveDef, ɵPipeDef} from './definition';
import {ComponentTemplate, DirectiveDef, DirectiveDefList, PipeDef, PipeDefList} from './definition';
import {LElementNode, LViewNode, TNode} from './node';
import {LQueries} from './query';
import {Renderer3} from './renderer';
@ -428,10 +428,10 @@ export const enum LifecycleStage {
* as its pipe instance in the data array. Any nodes that do not have static
* data store a null value in tData to avoid a sparse array.
*/
export type TData = (TNode | ɵPipeDef<any>| null)[];
export type TData = (TNode | PipeDef<any>| null)[];
/** Type for TView.currentMatches */
export type CurrentMatchesList = [ɵDirectiveDef<any>, (string | number | null)];
export type CurrentMatchesList = [DirectiveDef<any>, (string | number | null)];
// Note: This hack is necessary so we don't erroneously get a circular dependency
// failure based on types.