refactor(ivy): prefix all generated instructions (#29692)
- Updates all instructions to be prefixed with the Greek delta symbol PR Close #29692
This commit is contained in:
@ -18,7 +18,7 @@ import {stringify} from '../util/stringify';
|
||||
|
||||
import {EMPTY_ARRAY, EMPTY_OBJ} from './empty';
|
||||
import {NG_COMPONENT_DEF, NG_DIRECTIVE_DEF, NG_MODULE_DEF, NG_PIPE_DEF} from './fields';
|
||||
import {BaseDef, ComponentDef, ComponentDefFeature, ComponentTemplate, ComponentType, ContentQueriesFunction, DirectiveDef, DirectiveDefFeature, DirectiveType, DirectiveTypesOrFactory, FactoryFn, HostBindingsFunction, PipeDef, PipeType, PipeTypesOrFactory, ViewQueriesFunction} from './interfaces/definition';
|
||||
import {ComponentDef, ComponentDefFeature, ComponentTemplate, ComponentType, ContentQueriesFunction, DirectiveDef, DirectiveDefFeature, DirectiveType, DirectiveTypesOrFactory, FactoryFn, HostBindingsFunction, PipeDef, PipeType, PipeTypesOrFactory, ViewQueriesFunction, ΔBaseDef} from './interfaces/definition';
|
||||
// while SelectorFlags is unused here, it's required so that types don't get resolved lazily
|
||||
// see: https://github.com/Microsoft/web-build-tools/issues/1050
|
||||
import {CssSelectorList, SelectorFlags} from './interfaces/projection';
|
||||
@ -39,8 +39,9 @@ let _renderCompCount = 0;
|
||||
* });
|
||||
* }
|
||||
* ```
|
||||
* @publicApi
|
||||
*/
|
||||
export function defineComponent<T>(componentDefinition: {
|
||||
export function ΔdefineComponent<T>(componentDefinition: {
|
||||
/**
|
||||
* Directive type, needed to configure the injector.
|
||||
*/
|
||||
@ -303,7 +304,10 @@ export function defineComponent<T>(componentDefinition: {
|
||||
return def as never;
|
||||
}
|
||||
|
||||
export function setComponentScope(
|
||||
/**
|
||||
* @publicApi
|
||||
*/
|
||||
export function ΔsetComponentScope(
|
||||
type: ComponentType<any>, directives: Type<any>[], pipes: Type<any>[]): void {
|
||||
const def = (type.ngComponentDef as ComponentDef<any>);
|
||||
def.directiveDefs = () => directives.map(extractDirectiveDef);
|
||||
@ -327,7 +331,10 @@ export function extractPipeDef(type: PipeType<any>): PipeDef<any> {
|
||||
return def !;
|
||||
}
|
||||
|
||||
export function defineNgModule<T>(def: {
|
||||
/**
|
||||
* @publicApi
|
||||
*/
|
||||
export function ΔdefineNgModule<T>(def: {
|
||||
/** Token representing the module. Used by DI. */
|
||||
type: T;
|
||||
|
||||
@ -368,8 +375,10 @@ export function defineNgModule<T>(def: {
|
||||
* Scope metadata of modules is not used in production builds, so calls to this function can be
|
||||
* marked pure to tree-shake it from the bundle, allowing for all referenced declarations
|
||||
* to become eligible for tree-shaking as well.
|
||||
*
|
||||
* @publicApi
|
||||
*/
|
||||
export function setNgModuleScope(type: any, scope: {
|
||||
export function ΔsetNgModuleScope(type: any, scope: {
|
||||
/** List of components, directives, and pipes declared by this module. */
|
||||
declarations?: Type<any>[] | (() => Type<any>[]);
|
||||
|
||||
@ -469,15 +478,19 @@ function invertObject<T>(
|
||||
* Create a base definition
|
||||
*
|
||||
* # Example
|
||||
* ```
|
||||
* ```ts
|
||||
* class ShouldBeInherited {
|
||||
* static ngBaseDef = defineBase({
|
||||
* static ngBaseDef = ΔdefineBase({
|
||||
* ...
|
||||
* })
|
||||
* }
|
||||
* ```
|
||||
*
|
||||
* @param baseDefinition The base definition parameters
|
||||
*
|
||||
* @publicApi
|
||||
*/
|
||||
export function defineBase<T>(baseDefinition: {
|
||||
export function ΔdefineBase<T>(baseDefinition: {
|
||||
/**
|
||||
* A map of input names.
|
||||
*
|
||||
@ -534,7 +547,7 @@ export function defineBase<T>(baseDefinition: {
|
||||
* of properties.
|
||||
*/
|
||||
outputs?: {[P in keyof T]?: string};
|
||||
}): BaseDef<T> {
|
||||
}): ΔBaseDef<T> {
|
||||
const declaredInputs: {[P in keyof T]: string} = {} as any;
|
||||
return {
|
||||
inputs: invertObject<T>(baseDefinition.inputs as any, declaredInputs),
|
||||
@ -547,17 +560,19 @@ export function defineBase<T>(baseDefinition: {
|
||||
* Create a directive definition object.
|
||||
*
|
||||
* # Example
|
||||
* ```
|
||||
* ```ts
|
||||
* class MyDirective {
|
||||
* // Generated by Angular Template Compiler
|
||||
* // [Symbol] syntax will not be supported by TypeScript until v2.7
|
||||
* static ngDirectiveDef = defineDirective({
|
||||
* static ngDirectiveDef = ΔdefineDirective({
|
||||
* ...
|
||||
* });
|
||||
* }
|
||||
* ```
|
||||
*
|
||||
* @publicApi
|
||||
*/
|
||||
export const defineDirective = defineComponent as any as<T>(directiveDefinition: {
|
||||
export const ΔdefineDirective = ΔdefineComponent as any as<T>(directiveDefinition: {
|
||||
/**
|
||||
* Directive type, needed to configure the injector.
|
||||
*/
|
||||
@ -672,8 +687,10 @@ export const defineDirective = defineComponent as any as<T>(directiveDefinition:
|
||||
* }
|
||||
* ```
|
||||
* @param pipeDef Pipe definition generated by the compiler
|
||||
*
|
||||
* @publicApi
|
||||
*/
|
||||
export function definePipe<T>(pipeDef: {
|
||||
export function ΔdefinePipe<T>(pipeDef: {
|
||||
/** Name of the pipe. Used for matching pipes in template to pipe defs. */
|
||||
name: string,
|
||||
|
||||
|
Reference in New Issue
Block a user