feat(ivy): support pipe compilation from local metadata (#24703)
This updates the r3_pipe_compiler to not depend on global analysis, and to produce ngPipeDef instructions in the same way that the other compilers do. It's a precursor to JIT and AOT implementations of @Pipe compilation. PR Close #24703
This commit is contained in:

committed by
Miško Hevery

parent
ffbacdf4ac
commit
dbdcfed2bd
@ -226,13 +226,13 @@ export interface ComponentDef<T, Selector extends string> extends DirectiveDef<T
|
||||
*
|
||||
* See: {@link definePipe}
|
||||
*/
|
||||
export interface PipeDef<T> {
|
||||
export interface PipeDef<T, S extends string> {
|
||||
/**
|
||||
* Pipe name.
|
||||
*
|
||||
* Used to resolve pipe in templates.
|
||||
*/
|
||||
name: string;
|
||||
name: S;
|
||||
|
||||
/**
|
||||
* Factory function used to create a new pipe instance.
|
||||
@ -251,6 +251,8 @@ export interface PipeDef<T> {
|
||||
onDestroy: (() => void)|null;
|
||||
}
|
||||
|
||||
export type PipeDefInternal<T> = PipeDef<T, string>;
|
||||
|
||||
export type DirectiveDefFeature = <T>(directiveDef: DirectiveDef<T, string>) => void;
|
||||
export type ComponentDefFeature = <T>(componentDef: ComponentDef<T, string>) => void;
|
||||
|
||||
@ -276,12 +278,13 @@ export type DirectiveTypeList =
|
||||
*/
|
||||
export type PipeDefListOrFactory = (() => PipeDefList) | PipeDefList;
|
||||
|
||||
export type PipeDefList = PipeDef<any>[];
|
||||
export type PipeDefList = PipeDefInternal<any>[];
|
||||
|
||||
export type PipeTypesOrFactory = (() => DirectiveTypeList) | DirectiveTypeList;
|
||||
|
||||
export type PipeTypeList =
|
||||
(PipeDef<any>| Type<any>/* Type as workaround for: Microsoft/TypeScript/issues/4881 */)[];
|
||||
(PipeDefInternal<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
|
||||
|
@ -10,7 +10,7 @@ import {Injector} from '../../di/injector';
|
||||
import {Sanitizer} from '../../sanitization/security';
|
||||
|
||||
import {LContainer} from './container';
|
||||
import {ComponentQuery, ComponentTemplate, DirectiveDefInternal, DirectiveDefList, PipeDef, PipeDefList} from './definition';
|
||||
import {ComponentQuery, ComponentTemplate, DirectiveDefInternal, DirectiveDefList, PipeDefInternal, PipeDefList} from './definition';
|
||||
import {LContainerNode, LElementNode, LViewNode, TNode} from './node';
|
||||
import {LQueries} from './query';
|
||||
import {Renderer3} from './renderer';
|
||||
@ -456,7 +456,7 @@ export type HookData = (number | (() => void))[];
|
||||
* 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 | PipeDefInternal<any>| null)[];
|
||||
|
||||
/** Type for TView.currentMatches */
|
||||
export type CurrentMatchesList = [DirectiveDefInternal<any>, (string | number | null)];
|
||||
|
Reference in New Issue
Block a user