feat(ivy): Add AOT handling for bare classes with Input and Output decorators (#25367)

PR Close #25367
This commit is contained in:
Ben Lesh
2018-08-07 12:04:39 -07:00
parent 26066f282e
commit a0a29fdd27
22 changed files with 483 additions and 60 deletions

View File

@ -8,6 +8,7 @@
// clang-format off
export {
defineBase as ɵdefineBase,
defineComponent as ɵdefineComponent,
defineDirective as ɵdefineDirective,
definePipe as ɵdefinePipe,
@ -97,6 +98,7 @@ export {
st as ɵst,
ld as ɵld,
Pp as ɵPp,
BaseDef as ɵBaseDef,
ComponentDef as ɵComponentDef,
ComponentDefInternal as ɵComponentDefInternal,
DirectiveDef as ɵDirectiveDef,

View File

@ -779,6 +779,11 @@ const initializeBaseDef = (target: any): void => {
}
};
/**
* Used to get the minified alias of ngBaseDef
*/
const NG_BASE_DEF = Object.keys({ngBaseDef: true})[0];
/**
* Does the work of creating the `ngBaseDef` property for the @Input and @Output decorators.
* @param key "inputs" or "outputs"
@ -787,7 +792,7 @@ const updateBaseDefFromIOProp = (getProp: (baseDef: {inputs?: any, outputs?: any
(target: any, name: string, ...args: any[]) => {
const constructor = target.constructor;
if (!constructor.hasOwnProperty('ngBaseDef')) {
if (!constructor.hasOwnProperty(NG_BASE_DEF)) {
initializeBaseDef(target);
}

View File

@ -11,7 +11,7 @@ import {defineBase, defineComponent, defineDirective, defineNgModule, definePipe
import {InheritDefinitionFeature} from './features/inherit_definition_feature';
import {NgOnChangesFeature} from './features/ng_onchanges_feature';
import {PublicFeature} from './features/public_feature';
import {ComponentDef, ComponentDefInternal, ComponentTemplate, ComponentType, DirectiveDef, DirectiveDefFlags, DirectiveDefInternal, DirectiveType, PipeDef} from './interfaces/definition';
import {BaseDef, ComponentDef, ComponentDefInternal, ComponentTemplate, ComponentType, DirectiveDef, DirectiveDefFlags, DirectiveDefInternal, DirectiveType, PipeDef} from './interfaces/definition';
export {ComponentFactory, ComponentFactoryResolver, ComponentRef, WRAP_RENDERER_FACTORY2} from './component_ref';
export {Render3DebugRendererFactory2} from './debug';
@ -152,6 +152,7 @@ export {
// clang-format on
export {
BaseDef,
ComponentDef,
ComponentDefInternal,
ComponentTemplate,

View File

@ -18,6 +18,7 @@ import * as sanitization from '../../sanitization/sanitization';
* This should be kept up to date with the public exports of @angular/core.
*/
export const angularCoreEnv: {[name: string]: Function} = {
'ɵdefineBase': r3.defineBase,
'ɵdefineComponent': r3.defineComponent,
'ɵdefineDirective': r3.defineDirective,
'defineInjectable': defineInjectable,