| 
									
										
										
										
											2016-06-23 09:47:54 -07:00
										 |  |  | /** | 
					
						
							|  |  |  |  * @license | 
					
						
							|  |  |  |  * Copyright Google Inc. All Rights Reserved. | 
					
						
							|  |  |  |  * | 
					
						
							|  |  |  |  * Use of this source code is governed by an MIT-style license that can be | 
					
						
							|  |  |  |  * found in the LICENSE file at https://angular.io/license
 | 
					
						
							|  |  |  |  */ | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-12-27 09:36:47 -08:00
										 |  |  | import {ChangeDetectionStrategy, ComponentFactory, SchemaMetadata, Type, ViewEncapsulation} from '@angular/core'; | 
					
						
							| 
									
										
										
										
											2016-06-08 16:38:52 -07:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-12-05 13:26:12 -08:00
										 |  |  | import {StaticSymbol} from './aot/static_symbol'; | 
					
						
							| 
									
										
										
										
											2016-11-03 16:58:27 -07:00
										 |  |  | import {ListWrapper} from './facade/collection'; | 
					
						
							| 
									
										
										
										
											2016-11-23 09:42:19 -08:00
										 |  |  | import {isPresent, stringify} from './facade/lang'; | 
					
						
							|  |  |  | import {LifecycleHooks, reflector} from './private_import_core'; | 
					
						
							| 
									
										
										
										
											2016-04-28 17:50:03 -07:00
										 |  |  | import {CssSelector} from './selector'; | 
					
						
							| 
									
										
										
										
											2016-11-23 09:42:19 -08:00
										 |  |  | import {splitAtColon} from './util'; | 
					
						
							| 
									
										
										
										
											2016-06-08 16:38:52 -07:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-07-08 17:11:12 -07:00
										 |  |  | // group 0: "[prop] or (event) or @trigger"
 | 
					
						
							|  |  |  | // group 1: "prop" from "[prop]"
 | 
					
						
							| 
									
										
										
										
											2015-09-18 10:33:23 -07:00
										 |  |  | // group 2: "event" from "(event)"
 | 
					
						
							| 
									
										
										
										
											2016-07-08 17:11:12 -07:00
										 |  |  | // group 3: "@trigger" from "@trigger"
 | 
					
						
							| 
									
										
										
										
											2016-08-05 09:50:49 -07:00
										 |  |  | const HOST_REG_EXP = /^(?:(?:\[([^\]]+)\])|(?:\(([^\)]+)\)))|(\@[-\w]+)$/; | 
					
						
							| 
									
										
										
										
											2015-08-25 15:36:02 -07:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-05-25 12:46:22 -07:00
										 |  |  | export class CompileAnimationEntryMetadata { | 
					
						
							| 
									
										
										
										
											2016-06-08 16:38:52 -07:00
										 |  |  |   constructor( | 
					
						
							|  |  |  |       public name: string = null, public definitions: CompileAnimationStateMetadata[] = null) {} | 
					
						
							| 
									
										
										
										
											2016-05-25 12:46:22 -07:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | export abstract class CompileAnimationStateMetadata {} | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | export class CompileAnimationStateDeclarationMetadata extends CompileAnimationStateMetadata { | 
					
						
							| 
									
										
										
										
											2016-06-08 16:38:52 -07:00
										 |  |  |   constructor(public stateNameExpr: string, public styles: CompileAnimationStyleMetadata) { | 
					
						
							|  |  |  |     super(); | 
					
						
							|  |  |  |   } | 
					
						
							| 
									
										
										
										
											2016-05-25 12:46:22 -07:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | export class CompileAnimationStateTransitionMetadata extends CompileAnimationStateMetadata { | 
					
						
							| 
									
										
										
										
											2016-12-16 17:52:17 -08:00
										 |  |  |   constructor( | 
					
						
							|  |  |  |       public stateChangeExpr: string|StaticSymbol|((stateA: string, stateB: string) => boolean), | 
					
						
							|  |  |  |       public steps: CompileAnimationMetadata) { | 
					
						
							|  |  |  |     super(); | 
					
						
							|  |  |  |   } | 
					
						
							| 
									
										
										
										
											2016-05-25 12:46:22 -07:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-07-18 03:50:31 -07:00
										 |  |  | export abstract class CompileAnimationMetadata {} | 
					
						
							| 
									
										
										
										
											2016-05-25 12:46:22 -07:00
										 |  |  | 
 | 
					
						
							|  |  |  | export class CompileAnimationKeyframesSequenceMetadata extends CompileAnimationMetadata { | 
					
						
							| 
									
										
										
										
											2016-06-08 16:38:52 -07:00
										 |  |  |   constructor(public steps: CompileAnimationStyleMetadata[] = []) { super(); } | 
					
						
							| 
									
										
										
										
											2016-05-25 12:46:22 -07:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | export class CompileAnimationStyleMetadata extends CompileAnimationMetadata { | 
					
						
							| 
									
										
										
										
											2016-06-08 16:38:52 -07:00
										 |  |  |   constructor( | 
					
						
							|  |  |  |       public offset: number, public styles: Array<string|{[key: string]: string | number}> = null) { | 
					
						
							|  |  |  |     super(); | 
					
						
							|  |  |  |   } | 
					
						
							| 
									
										
										
										
											2016-05-25 12:46:22 -07:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | export class CompileAnimationAnimateMetadata extends CompileAnimationMetadata { | 
					
						
							| 
									
										
										
										
											2016-06-08 16:38:52 -07:00
										 |  |  |   constructor( | 
					
						
							|  |  |  |       public timings: string|number = 0, public styles: CompileAnimationStyleMetadata| | 
					
						
							|  |  |  |       CompileAnimationKeyframesSequenceMetadata = null) { | 
					
						
							|  |  |  |     super(); | 
					
						
							|  |  |  |   } | 
					
						
							| 
									
										
										
										
											2016-05-25 12:46:22 -07:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | export abstract class CompileAnimationWithStepsMetadata extends CompileAnimationMetadata { | 
					
						
							|  |  |  |   constructor(public steps: CompileAnimationMetadata[] = null) { super(); } | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | export class CompileAnimationSequenceMetadata extends CompileAnimationWithStepsMetadata { | 
					
						
							| 
									
										
										
										
											2016-06-08 16:38:52 -07:00
										 |  |  |   constructor(steps: CompileAnimationMetadata[] = null) { super(steps); } | 
					
						
							| 
									
										
										
										
											2016-05-25 12:46:22 -07:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | export class CompileAnimationGroupMetadata extends CompileAnimationWithStepsMetadata { | 
					
						
							| 
									
										
										
										
											2016-06-08 16:38:52 -07:00
										 |  |  |   constructor(steps: CompileAnimationMetadata[] = null) { super(steps); } | 
					
						
							| 
									
										
										
										
											2016-05-25 12:46:22 -07:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-04-10 19:36:16 -07:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-11-23 09:42:19 -08:00
										 |  |  | function _sanitizeIdentifier(name: string): string { | 
					
						
							|  |  |  |   return name.replace(/\W/g, '_'); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | let _anonymousTypeIndex = 0; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | export function identifierName(compileIdentifier: CompileIdentifierMetadata): string { | 
					
						
							|  |  |  |   if (!compileIdentifier || !compileIdentifier.reference) { | 
					
						
							|  |  |  |     return null; | 
					
						
							| 
									
										
										
										
											2016-02-26 08:01:07 -08:00
										 |  |  |   } | 
					
						
							| 
									
										
										
										
											2016-11-23 09:42:19 -08:00
										 |  |  |   const ref = compileIdentifier.reference; | 
					
						
							| 
									
										
										
										
											2016-12-05 13:26:12 -08:00
										 |  |  |   if (ref instanceof StaticSymbol) { | 
					
						
							| 
									
										
										
										
											2016-11-23 09:42:19 -08:00
										 |  |  |     return ref.name; | 
					
						
							|  |  |  |   } | 
					
						
							|  |  |  |   if (ref['__anonymousType']) { | 
					
						
							|  |  |  |     return ref['__anonymousType']; | 
					
						
							|  |  |  |   } | 
					
						
							|  |  |  |   let identifier = stringify(ref); | 
					
						
							|  |  |  |   if (identifier.indexOf('(') >= 0) { | 
					
						
							|  |  |  |     // case: anonymous functions!
 | 
					
						
							|  |  |  |     identifier = `anonymous_${_anonymousTypeIndex++}`; | 
					
						
							|  |  |  |     ref['__anonymousType'] = identifier; | 
					
						
							|  |  |  |   } else { | 
					
						
							|  |  |  |     identifier = _sanitizeIdentifier(identifier); | 
					
						
							|  |  |  |   } | 
					
						
							|  |  |  |   return identifier; | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | export function identifierModuleUrl(compileIdentifier: CompileIdentifierMetadata): string { | 
					
						
							|  |  |  |   const ref = compileIdentifier.reference; | 
					
						
							| 
									
										
										
										
											2016-12-05 13:26:12 -08:00
										 |  |  |   if (ref instanceof StaticSymbol) { | 
					
						
							| 
									
										
										
										
											2016-11-23 09:42:19 -08:00
										 |  |  |     return ref.filePath; | 
					
						
							|  |  |  |   } | 
					
						
							|  |  |  |   return reflector.importUri(ref); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-12-27 09:36:47 -08:00
										 |  |  | export function viewClassName(compType: any, embeddedTemplateIndex: number): string { | 
					
						
							|  |  |  |   return `View_${identifierName({reference: compType})}_${embeddedTemplateIndex}`; | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | export function hostViewClassName(compType: any): string { | 
					
						
							|  |  |  |   return `HostView_${identifierName({reference: compType})}`; | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | export function dirWrapperClassName(dirType: any) { | 
					
						
							|  |  |  |   return `Wrapper_${identifierName({reference: dirType})}`; | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | export function componentFactoryName(compType: any): string { | 
					
						
							|  |  |  |   return `${identifierName({reference: compType})}NgFactory`; | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | export interface ProxyClass { setDelegate(delegate: any): void; } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-11-30 10:52:51 -08:00
										 |  |  | export interface CompileIdentifierMetadata { reference: any; } | 
					
						
							| 
									
										
										
										
											2016-02-26 08:01:07 -08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-12-02 10:08:46 -08:00
										 |  |  | export enum CompileSummaryKind { | 
					
						
							|  |  |  |   Pipe, | 
					
						
							|  |  |  |   Directive, | 
					
						
							| 
									
										
										
										
											2016-12-15 09:12:40 -08:00
										 |  |  |   NgModule, | 
					
						
							|  |  |  |   Injectable | 
					
						
							| 
									
										
										
										
											2016-12-02 10:08:46 -08:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-11-10 16:27:53 -08:00
										 |  |  | /** | 
					
						
							|  |  |  |  * A CompileSummary is the data needed to use a directive / pipe / module | 
					
						
							|  |  |  |  * in other modules / components. However, this data is not enough to compile | 
					
						
							|  |  |  |  * the directive / module itself. | 
					
						
							|  |  |  |  */ | 
					
						
							| 
									
										
										
										
											2016-12-15 09:12:40 -08:00
										 |  |  | export interface CompileTypeSummary { | 
					
						
							| 
									
										
										
										
											2016-12-15 13:07:12 -08:00
										 |  |  |   summaryKind: CompileSummaryKind; | 
					
						
							| 
									
										
										
										
											2016-12-15 09:12:40 -08:00
										 |  |  |   type: CompileTypeMetadata; | 
					
						
							|  |  |  | } | 
					
						
							| 
									
										
										
										
											2016-11-29 15:36:33 -08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-11-30 10:52:51 -08:00
										 |  |  | export interface CompileDiDependencyMetadata { | 
					
						
							|  |  |  |   isAttribute?: boolean; | 
					
						
							|  |  |  |   isSelf?: boolean; | 
					
						
							|  |  |  |   isHost?: boolean; | 
					
						
							|  |  |  |   isSkipSelf?: boolean; | 
					
						
							|  |  |  |   isOptional?: boolean; | 
					
						
							|  |  |  |   isValue?: boolean; | 
					
						
							|  |  |  |   token?: CompileTokenMetadata; | 
					
						
							|  |  |  |   value?: any; | 
					
						
							| 
									
										
										
										
											2016-02-26 08:01:07 -08:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-11-30 10:52:51 -08:00
										 |  |  | export interface CompileProviderMetadata { | 
					
						
							| 
									
										
										
										
											2016-01-06 14:13:44 -08:00
										 |  |  |   token: CompileTokenMetadata; | 
					
						
							| 
									
										
										
										
											2016-11-30 10:52:51 -08:00
										 |  |  |   useClass?: CompileTypeMetadata; | 
					
						
							|  |  |  |   useValue?: any; | 
					
						
							|  |  |  |   useExisting?: CompileTokenMetadata; | 
					
						
							|  |  |  |   useFactory?: CompileFactoryMetadata; | 
					
						
							|  |  |  |   deps?: CompileDiDependencyMetadata[]; | 
					
						
							|  |  |  |   multi?: boolean; | 
					
						
							| 
									
										
										
										
											2016-02-26 08:01:07 -08:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-11-30 10:52:51 -08:00
										 |  |  | export interface CompileFactoryMetadata extends CompileIdentifierMetadata { | 
					
						
							| 
									
										
										
										
											2016-02-26 08:01:07 -08:00
										 |  |  |   diDeps: CompileDiDependencyMetadata[]; | 
					
						
							| 
									
										
										
										
											2016-11-30 10:52:51 -08:00
										 |  |  |   reference: any; | 
					
						
							| 
									
										
										
										
											2015-12-02 10:35:51 -08:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-11-23 09:42:19 -08:00
										 |  |  | export function tokenName(token: CompileTokenMetadata) { | 
					
						
							|  |  |  |   return isPresent(token.value) ? _sanitizeIdentifier(token.value) : | 
					
						
							|  |  |  |                                   identifierName(token.identifier); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | export function tokenReference(token: CompileTokenMetadata) { | 
					
						
							|  |  |  |   if (isPresent(token.identifier)) { | 
					
						
							|  |  |  |     return token.identifier.reference; | 
					
						
							|  |  |  |   } else { | 
					
						
							|  |  |  |     return token.value; | 
					
						
							|  |  |  |   } | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-11-30 10:52:51 -08:00
										 |  |  | export interface CompileTokenMetadata { | 
					
						
							|  |  |  |   value?: any; | 
					
						
							|  |  |  |   identifier?: CompileIdentifierMetadata|CompileTypeMetadata; | 
					
						
							| 
									
										
										
										
											2016-01-06 14:13:44 -08:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-12-03 15:49:09 -08:00
										 |  |  | /** | 
					
						
							|  |  |  |  * Metadata regarding compilation of a type. | 
					
						
							|  |  |  |  */ | 
					
						
							| 
									
										
										
										
											2016-11-30 10:52:51 -08:00
										 |  |  | export interface CompileTypeMetadata extends CompileIdentifierMetadata { | 
					
						
							| 
									
										
										
										
											2016-02-26 08:01:07 -08:00
										 |  |  |   diDeps: CompileDiDependencyMetadata[]; | 
					
						
							| 
									
										
										
										
											2016-08-02 01:12:24 -07:00
										 |  |  |   lifecycleHooks: LifecycleHooks[]; | 
					
						
							| 
									
										
										
										
											2016-11-30 10:52:51 -08:00
										 |  |  |   reference: any; | 
					
						
							| 
									
										
										
										
											2015-08-25 15:36:02 -07:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-11-30 10:52:51 -08:00
										 |  |  | export interface CompileQueryMetadata { | 
					
						
							| 
									
										
										
										
											2016-01-06 14:13:44 -08:00
										 |  |  |   selectors: Array<CompileTokenMetadata>; | 
					
						
							| 
									
										
										
										
											2016-02-26 08:01:07 -08:00
										 |  |  |   descendants: boolean; | 
					
						
							|  |  |  |   first: boolean; | 
					
						
							|  |  |  |   propertyName: string; | 
					
						
							| 
									
										
										
										
											2016-04-18 13:24:42 -07:00
										 |  |  |   read: CompileTokenMetadata; | 
					
						
							| 
									
										
										
										
											2016-02-26 08:01:07 -08:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-06-24 08:46:43 -07:00
										 |  |  | /** | 
					
						
							|  |  |  |  * Metadata about a stylesheet | 
					
						
							|  |  |  |  */ | 
					
						
							|  |  |  | export class CompileStylesheetMetadata { | 
					
						
							|  |  |  |   moduleUrl: string; | 
					
						
							|  |  |  |   styles: string[]; | 
					
						
							|  |  |  |   styleUrls: string[]; | 
					
						
							|  |  |  |   constructor( | 
					
						
							|  |  |  |       {moduleUrl, styles, | 
					
						
							|  |  |  |        styleUrls}: {moduleUrl?: string, styles?: string[], styleUrls?: string[]} = {}) { | 
					
						
							|  |  |  |     this.moduleUrl = moduleUrl; | 
					
						
							|  |  |  |     this.styles = _normalizeArray(styles); | 
					
						
							|  |  |  |     this.styleUrls = _normalizeArray(styleUrls); | 
					
						
							|  |  |  |   } | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-11-10 16:27:53 -08:00
										 |  |  | /** | 
					
						
							|  |  |  |  * Summary Metadata regarding compilation of a template. | 
					
						
							|  |  |  |  */ | 
					
						
							| 
									
										
										
										
											2016-12-15 09:12:40 -08:00
										 |  |  | export interface CompileTemplateSummary { | 
					
						
							| 
									
										
										
										
											2016-11-10 16:27:53 -08:00
										 |  |  |   animations: string[]; | 
					
						
							|  |  |  |   ngContentSelectors: string[]; | 
					
						
							|  |  |  |   encapsulation: ViewEncapsulation; | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-12-03 15:49:09 -08:00
										 |  |  | /** | 
					
						
							|  |  |  |  * Metadata regarding compilation of a template. | 
					
						
							|  |  |  |  */ | 
					
						
							| 
									
										
										
										
											2015-09-18 10:33:23 -07:00
										 |  |  | export class CompileTemplateMetadata { | 
					
						
							| 
									
										
										
										
											2015-09-14 15:59:09 -07:00
										 |  |  |   encapsulation: ViewEncapsulation; | 
					
						
							|  |  |  |   template: string; | 
					
						
							|  |  |  |   templateUrl: string; | 
					
						
							|  |  |  |   styles: string[]; | 
					
						
							|  |  |  |   styleUrls: string[]; | 
					
						
							| 
									
										
										
										
											2016-06-24 08:46:43 -07:00
										 |  |  |   externalStylesheets: CompileStylesheetMetadata[]; | 
					
						
							| 
									
										
										
										
											2016-05-25 12:46:22 -07:00
										 |  |  |   animations: CompileAnimationEntryMetadata[]; | 
					
						
							| 
									
										
										
										
											2015-09-18 10:33:23 -07:00
										 |  |  |   ngContentSelectors: string[]; | 
					
						
							| 
									
										
										
										
											2016-06-20 09:52:41 -07:00
										 |  |  |   interpolation: [string, string]; | 
					
						
							| 
									
										
										
										
											2016-06-08 16:38:52 -07:00
										 |  |  |   constructor( | 
					
						
							| 
									
										
										
										
											2016-06-24 08:46:43 -07:00
										 |  |  |       {encapsulation, template, templateUrl, styles, styleUrls, externalStylesheets, animations, | 
					
						
							|  |  |  |        ngContentSelectors, interpolation}: { | 
					
						
							| 
									
										
										
										
											2016-06-08 16:38:52 -07:00
										 |  |  |         encapsulation?: ViewEncapsulation, | 
					
						
							|  |  |  |         template?: string, | 
					
						
							|  |  |  |         templateUrl?: string, | 
					
						
							|  |  |  |         styles?: string[], | 
					
						
							|  |  |  |         styleUrls?: string[], | 
					
						
							| 
									
										
										
										
											2016-06-24 08:46:43 -07:00
										 |  |  |         externalStylesheets?: CompileStylesheetMetadata[], | 
					
						
							| 
									
										
										
										
											2016-06-08 16:38:52 -07:00
										 |  |  |         ngContentSelectors?: string[], | 
					
						
							| 
									
										
										
										
											2016-06-20 09:52:41 -07:00
										 |  |  |         animations?: CompileAnimationEntryMetadata[], | 
					
						
							| 
									
										
										
										
											2016-12-27 09:36:47 -08:00
										 |  |  |         interpolation?: [string, string], | 
					
						
							| 
									
										
										
										
											2016-06-08 16:38:52 -07:00
										 |  |  |       } = {}) { | 
					
						
							| 
									
										
										
										
											2016-04-03 08:34:44 +09:00
										 |  |  |     this.encapsulation = encapsulation; | 
					
						
							| 
									
										
										
										
											2015-09-14 15:59:09 -07:00
										 |  |  |     this.template = template; | 
					
						
							|  |  |  |     this.templateUrl = templateUrl; | 
					
						
							| 
									
										
										
										
											2016-06-24 08:46:43 -07:00
										 |  |  |     this.styles = _normalizeArray(styles); | 
					
						
							|  |  |  |     this.styleUrls = _normalizeArray(styleUrls); | 
					
						
							|  |  |  |     this.externalStylesheets = _normalizeArray(externalStylesheets); | 
					
						
							| 
									
										
										
										
											2016-10-21 15:14:44 -07:00
										 |  |  |     this.animations = animations ? ListWrapper.flatten(animations) : []; | 
					
						
							| 
									
										
										
										
											2016-10-07 18:11:37 -07:00
										 |  |  |     this.ngContentSelectors = ngContentSelectors || []; | 
					
						
							| 
									
										
										
										
											2016-10-21 15:14:44 -07:00
										 |  |  |     if (interpolation && interpolation.length != 2) { | 
					
						
							| 
									
										
										
										
											2016-08-25 00:50:16 -07:00
										 |  |  |       throw new Error(`'interpolation' should have a start and an end symbol.`); | 
					
						
							| 
									
										
										
										
											2016-06-20 09:52:41 -07:00
										 |  |  |     } | 
					
						
							|  |  |  |     this.interpolation = interpolation; | 
					
						
							| 
									
										
										
										
											2015-09-14 15:59:09 -07:00
										 |  |  |   } | 
					
						
							| 
									
										
										
										
											2016-11-10 16:27:53 -08:00
										 |  |  | 
 | 
					
						
							|  |  |  |   toSummary(): CompileTemplateSummary { | 
					
						
							|  |  |  |     return { | 
					
						
							|  |  |  |       animations: this.animations.map(anim => anim.name), | 
					
						
							|  |  |  |       ngContentSelectors: this.ngContentSelectors, | 
					
						
							| 
									
										
										
										
											2016-12-27 09:36:47 -08:00
										 |  |  |       encapsulation: this.encapsulation, | 
					
						
							| 
									
										
										
										
											2016-11-10 16:27:53 -08:00
										 |  |  |     }; | 
					
						
							|  |  |  |   } | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-12-27 09:36:47 -08:00
										 |  |  | export interface CompileEntryComponentMetadata { | 
					
						
							|  |  |  |   componentType: any; | 
					
						
							|  |  |  |   componentFactory: StaticSymbol|ComponentFactory<any>; | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-11-30 10:52:51 -08:00
										 |  |  | // Note: This should only use interfaces as nested data types
 | 
					
						
							|  |  |  | // as we need to be able to serialize this from/to JSON!
 | 
					
						
							| 
									
										
										
										
											2016-11-29 15:36:33 -08:00
										 |  |  | export interface CompileDirectiveSummary extends CompileTypeSummary { | 
					
						
							| 
									
										
										
										
											2016-11-10 16:27:53 -08:00
										 |  |  |   type: CompileTypeMetadata; | 
					
						
							|  |  |  |   isComponent: boolean; | 
					
						
							|  |  |  |   selector: string; | 
					
						
							|  |  |  |   exportAs: string; | 
					
						
							|  |  |  |   inputs: {[key: string]: string}; | 
					
						
							|  |  |  |   outputs: {[key: string]: string}; | 
					
						
							|  |  |  |   hostListeners: {[key: string]: string}; | 
					
						
							|  |  |  |   hostProperties: {[key: string]: string}; | 
					
						
							|  |  |  |   hostAttributes: {[key: string]: string}; | 
					
						
							|  |  |  |   providers: CompileProviderMetadata[]; | 
					
						
							|  |  |  |   viewProviders: CompileProviderMetadata[]; | 
					
						
							|  |  |  |   queries: CompileQueryMetadata[]; | 
					
						
							| 
									
										
										
										
											2016-12-27 09:36:47 -08:00
										 |  |  |   entryComponents: CompileEntryComponentMetadata[]; | 
					
						
							| 
									
										
										
										
											2016-11-10 16:27:53 -08:00
										 |  |  |   changeDetection: ChangeDetectionStrategy; | 
					
						
							|  |  |  |   template: CompileTemplateSummary; | 
					
						
							| 
									
										
										
										
											2016-12-27 09:36:47 -08:00
										 |  |  |   wrapperType: StaticSymbol|ProxyClass; | 
					
						
							|  |  |  |   componentViewType: StaticSymbol|ProxyClass; | 
					
						
							|  |  |  |   componentFactory: StaticSymbol|ComponentFactory<any>; | 
					
						
							| 
									
										
										
										
											2015-08-25 15:36:02 -07:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-12-03 15:49:09 -08:00
										 |  |  | /** | 
					
						
							|  |  |  |  * Metadata regarding compilation of a directive. | 
					
						
							|  |  |  |  */ | 
					
						
							| 
									
										
										
										
											2016-11-23 09:42:19 -08:00
										 |  |  | export class CompileDirectiveMetadata { | 
					
						
							| 
									
										
										
										
											2016-06-08 16:38:52 -07:00
										 |  |  |   static create( | 
					
						
							| 
									
										
										
										
											2016-11-23 09:42:19 -08:00
										 |  |  |       {isHost, type, isComponent, selector, exportAs, changeDetection, inputs, outputs, host, | 
					
						
							| 
									
										
										
										
											2016-12-27 09:36:47 -08:00
										 |  |  |        providers, viewProviders, queries, viewQueries, entryComponents, template, wrapperType, | 
					
						
							|  |  |  |        componentViewType, componentFactory}: { | 
					
						
							| 
									
										
										
										
											2016-11-23 09:42:19 -08:00
										 |  |  |         isHost?: boolean, | 
					
						
							| 
									
										
										
										
											2016-06-08 16:38:52 -07:00
										 |  |  |         type?: CompileTypeMetadata, | 
					
						
							|  |  |  |         isComponent?: boolean, | 
					
						
							|  |  |  |         selector?: string, | 
					
						
							|  |  |  |         exportAs?: string, | 
					
						
							|  |  |  |         changeDetection?: ChangeDetectionStrategy, | 
					
						
							|  |  |  |         inputs?: string[], | 
					
						
							|  |  |  |         outputs?: string[], | 
					
						
							|  |  |  |         host?: {[key: string]: string}, | 
					
						
							| 
									
										
										
										
											2016-11-30 10:52:51 -08:00
										 |  |  |         providers?: CompileProviderMetadata[], | 
					
						
							|  |  |  |         viewProviders?: CompileProviderMetadata[], | 
					
						
							| 
									
										
										
										
											2016-06-08 16:38:52 -07:00
										 |  |  |         queries?: CompileQueryMetadata[], | 
					
						
							|  |  |  |         viewQueries?: CompileQueryMetadata[], | 
					
						
							| 
									
										
										
										
											2016-12-27 09:36:47 -08:00
										 |  |  |         entryComponents?: CompileEntryComponentMetadata[], | 
					
						
							|  |  |  |         template?: CompileTemplateMetadata, | 
					
						
							|  |  |  |         wrapperType?: StaticSymbol|ProxyClass, | 
					
						
							|  |  |  |         componentViewType?: StaticSymbol|ProxyClass, | 
					
						
							|  |  |  |         componentFactory?: StaticSymbol|ComponentFactory<any>, | 
					
						
							| 
									
										
										
										
											2016-06-08 16:38:52 -07:00
										 |  |  |       } = {}): CompileDirectiveMetadata { | 
					
						
							| 
									
										
										
										
											2016-11-12 14:08:58 +01:00
										 |  |  |     const hostListeners: {[key: string]: string} = {}; | 
					
						
							|  |  |  |     const hostProperties: {[key: string]: string} = {}; | 
					
						
							|  |  |  |     const hostAttributes: {[key: string]: string} = {}; | 
					
						
							| 
									
										
										
										
											2015-09-18 10:33:23 -07:00
										 |  |  |     if (isPresent(host)) { | 
					
						
							| 
									
										
										
										
											2016-10-03 16:46:05 -07:00
										 |  |  |       Object.keys(host).forEach(key => { | 
					
						
							|  |  |  |         const value = host[key]; | 
					
						
							| 
									
										
										
										
											2016-08-05 09:50:49 -07:00
										 |  |  |         const matches = key.match(HOST_REG_EXP); | 
					
						
							|  |  |  |         if (matches === null) { | 
					
						
							| 
									
										
										
										
											2015-09-18 10:33:23 -07:00
										 |  |  |           hostAttributes[key] = value; | 
					
						
							|  |  |  |         } else if (isPresent(matches[1])) { | 
					
						
							|  |  |  |           hostProperties[matches[1]] = value; | 
					
						
							|  |  |  |         } else if (isPresent(matches[2])) { | 
					
						
							|  |  |  |           hostListeners[matches[2]] = value; | 
					
						
							|  |  |  |         } | 
					
						
							|  |  |  |       }); | 
					
						
							|  |  |  |     } | 
					
						
							| 
									
										
										
										
											2016-11-12 14:08:58 +01:00
										 |  |  |     const inputsMap: {[key: string]: string} = {}; | 
					
						
							| 
									
										
										
										
											2015-09-30 20:59:23 -07:00
										 |  |  |     if (isPresent(inputs)) { | 
					
						
							|  |  |  |       inputs.forEach((bindConfig: string) => { | 
					
						
							| 
									
										
										
										
											2015-09-18 10:33:23 -07:00
										 |  |  |         // canonical syntax: `dirProp: elProp`
 | 
					
						
							|  |  |  |         // if there is no `:`, use dirProp = elProp
 | 
					
						
							| 
									
										
										
										
											2016-11-12 14:08:58 +01:00
										 |  |  |         const parts = splitAtColon(bindConfig, [bindConfig, bindConfig]); | 
					
						
							| 
									
										
										
										
											2015-09-30 20:59:23 -07:00
										 |  |  |         inputsMap[parts[0]] = parts[1]; | 
					
						
							| 
									
										
										
										
											2015-09-18 10:33:23 -07:00
										 |  |  |       }); | 
					
						
							|  |  |  |     } | 
					
						
							| 
									
										
										
										
											2016-11-12 14:08:58 +01:00
										 |  |  |     const outputsMap: {[key: string]: string} = {}; | 
					
						
							| 
									
										
										
										
											2015-09-30 20:59:23 -07:00
										 |  |  |     if (isPresent(outputs)) { | 
					
						
							|  |  |  |       outputs.forEach((bindConfig: string) => { | 
					
						
							| 
									
										
										
										
											2015-09-18 10:33:23 -07:00
										 |  |  |         // canonical syntax: `dirProp: elProp`
 | 
					
						
							|  |  |  |         // if there is no `:`, use dirProp = elProp
 | 
					
						
							| 
									
										
										
										
											2016-11-12 14:08:58 +01:00
										 |  |  |         const parts = splitAtColon(bindConfig, [bindConfig, bindConfig]); | 
					
						
							| 
									
										
										
										
											2015-09-30 20:59:23 -07:00
										 |  |  |         outputsMap[parts[0]] = parts[1]; | 
					
						
							| 
									
										
										
										
											2015-09-18 10:33:23 -07:00
										 |  |  |       }); | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     return new CompileDirectiveMetadata({ | 
					
						
							| 
									
										
										
										
											2016-11-23 09:42:19 -08:00
										 |  |  |       isHost, | 
					
						
							| 
									
										
										
										
											2016-06-22 17:25:42 -07:00
										 |  |  |       type, | 
					
						
							| 
									
										
										
										
											2016-10-21 15:14:44 -07:00
										 |  |  |       isComponent: !!isComponent, selector, exportAs, changeDetection, | 
					
						
							| 
									
										
										
										
											2015-09-30 20:59:23 -07:00
										 |  |  |       inputs: inputsMap, | 
					
						
							| 
									
										
										
										
											2016-08-02 01:12:24 -07:00
										 |  |  |       outputs: outputsMap, | 
					
						
							|  |  |  |       hostListeners, | 
					
						
							|  |  |  |       hostProperties, | 
					
						
							|  |  |  |       hostAttributes, | 
					
						
							| 
									
										
										
										
											2016-06-22 17:25:42 -07:00
										 |  |  |       providers, | 
					
						
							|  |  |  |       viewProviders, | 
					
						
							|  |  |  |       queries, | 
					
						
							|  |  |  |       viewQueries, | 
					
						
							| 
									
										
										
										
											2016-07-25 00:36:30 -07:00
										 |  |  |       entryComponents, | 
					
						
							| 
									
										
										
										
											2016-06-22 17:25:42 -07:00
										 |  |  |       template, | 
					
						
							| 
									
										
										
										
											2016-12-27 09:36:47 -08:00
										 |  |  |       wrapperType, | 
					
						
							|  |  |  |       componentViewType, | 
					
						
							|  |  |  |       componentFactory, | 
					
						
							| 
									
										
										
										
											2015-09-18 10:33:23 -07:00
										 |  |  |     }); | 
					
						
							|  |  |  |   } | 
					
						
							| 
									
										
										
										
											2016-11-23 09:42:19 -08:00
										 |  |  |   isHost: boolean; | 
					
						
							| 
									
										
										
										
											2015-09-18 10:33:23 -07:00
										 |  |  |   type: CompileTypeMetadata; | 
					
						
							| 
									
										
										
										
											2015-08-27 09:03:18 -07:00
										 |  |  |   isComponent: boolean; | 
					
						
							| 
									
										
										
										
											2015-08-25 15:36:02 -07:00
										 |  |  |   selector: string; | 
					
						
							| 
									
										
										
										
											2015-09-18 10:33:23 -07:00
										 |  |  |   exportAs: string; | 
					
						
							|  |  |  |   changeDetection: ChangeDetectionStrategy; | 
					
						
							| 
									
										
										
										
											2015-10-02 16:47:54 -07:00
										 |  |  |   inputs: {[key: string]: string}; | 
					
						
							|  |  |  |   outputs: {[key: string]: string}; | 
					
						
							|  |  |  |   hostListeners: {[key: string]: string}; | 
					
						
							|  |  |  |   hostProperties: {[key: string]: string}; | 
					
						
							|  |  |  |   hostAttributes: {[key: string]: string}; | 
					
						
							| 
									
										
										
										
											2016-01-06 14:13:44 -08:00
										 |  |  |   providers: CompileProviderMetadata[]; | 
					
						
							|  |  |  |   viewProviders: CompileProviderMetadata[]; | 
					
						
							| 
									
										
										
										
											2016-02-26 08:01:07 -08:00
										 |  |  |   queries: CompileQueryMetadata[]; | 
					
						
							|  |  |  |   viewQueries: CompileQueryMetadata[]; | 
					
						
							| 
									
										
										
										
											2016-12-27 09:36:47 -08:00
										 |  |  |   entryComponents: CompileEntryComponentMetadata[]; | 
					
						
							| 
									
										
										
										
											2016-07-28 06:31:26 -07:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-09-18 10:33:23 -07:00
										 |  |  |   template: CompileTemplateMetadata; | 
					
						
							| 
									
										
										
										
											2016-06-22 17:25:42 -07:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-12-27 09:36:47 -08:00
										 |  |  |   wrapperType: StaticSymbol|ProxyClass; | 
					
						
							|  |  |  |   componentViewType: StaticSymbol|ProxyClass; | 
					
						
							|  |  |  |   componentFactory: StaticSymbol|ComponentFactory<any>; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   constructor({isHost,          type,      isComponent,   selector,          exportAs, | 
					
						
							|  |  |  |                changeDetection, inputs,    outputs,       hostListeners,     hostProperties, | 
					
						
							|  |  |  |                hostAttributes,  providers, viewProviders, queries,           viewQueries, | 
					
						
							|  |  |  |                entryComponents, template,  wrapperType,   componentViewType, componentFactory}: { | 
					
						
							|  |  |  |     isHost?: boolean, | 
					
						
							|  |  |  |     type?: CompileTypeMetadata, | 
					
						
							|  |  |  |     isComponent?: boolean, | 
					
						
							|  |  |  |     selector?: string, | 
					
						
							|  |  |  |     exportAs?: string, | 
					
						
							|  |  |  |     changeDetection?: ChangeDetectionStrategy, | 
					
						
							|  |  |  |     inputs?: {[key: string]: string}, | 
					
						
							|  |  |  |     outputs?: {[key: string]: string}, | 
					
						
							|  |  |  |     hostListeners?: {[key: string]: string}, | 
					
						
							|  |  |  |     hostProperties?: {[key: string]: string}, | 
					
						
							|  |  |  |     hostAttributes?: {[key: string]: string}, | 
					
						
							|  |  |  |     providers?: CompileProviderMetadata[], | 
					
						
							|  |  |  |     viewProviders?: CompileProviderMetadata[], | 
					
						
							|  |  |  |     queries?: CompileQueryMetadata[], | 
					
						
							|  |  |  |     viewQueries?: CompileQueryMetadata[], | 
					
						
							|  |  |  |     entryComponents?: CompileEntryComponentMetadata[], | 
					
						
							|  |  |  |     template?: CompileTemplateMetadata, | 
					
						
							|  |  |  |     wrapperType?: StaticSymbol|ProxyClass, | 
					
						
							|  |  |  |     componentViewType?: StaticSymbol|ProxyClass, | 
					
						
							|  |  |  |     componentFactory?: StaticSymbol|ComponentFactory<any>, | 
					
						
							|  |  |  |   } = {}) { | 
					
						
							| 
									
										
										
										
											2016-11-23 09:42:19 -08:00
										 |  |  |     this.isHost = !!isHost; | 
					
						
							| 
									
										
										
										
											2015-08-25 15:36:02 -07:00
										 |  |  |     this.type = type; | 
					
						
							| 
									
										
										
										
											2015-09-18 10:33:23 -07:00
										 |  |  |     this.isComponent = isComponent; | 
					
						
							| 
									
										
										
										
											2015-08-25 15:36:02 -07:00
										 |  |  |     this.selector = selector; | 
					
						
							| 
									
										
										
										
											2015-09-18 10:33:23 -07:00
										 |  |  |     this.exportAs = exportAs; | 
					
						
							| 
									
										
										
										
											2015-08-27 16:29:02 -07:00
										 |  |  |     this.changeDetection = changeDetection; | 
					
						
							| 
									
										
										
										
											2015-09-30 20:59:23 -07:00
										 |  |  |     this.inputs = inputs; | 
					
						
							|  |  |  |     this.outputs = outputs; | 
					
						
							| 
									
										
										
										
											2015-09-18 10:33:23 -07:00
										 |  |  |     this.hostListeners = hostListeners; | 
					
						
							|  |  |  |     this.hostProperties = hostProperties; | 
					
						
							|  |  |  |     this.hostAttributes = hostAttributes; | 
					
						
							| 
									
										
										
										
											2016-01-06 14:13:44 -08:00
										 |  |  |     this.providers = _normalizeArray(providers); | 
					
						
							|  |  |  |     this.viewProviders = _normalizeArray(viewProviders); | 
					
						
							|  |  |  |     this.queries = _normalizeArray(queries); | 
					
						
							|  |  |  |     this.viewQueries = _normalizeArray(viewQueries); | 
					
						
							| 
									
										
										
										
											2016-07-25 00:36:30 -07:00
										 |  |  |     this.entryComponents = _normalizeArray(entryComponents); | 
					
						
							| 
									
										
										
										
											2015-08-25 15:36:02 -07:00
										 |  |  |     this.template = template; | 
					
						
							| 
									
										
										
										
											2016-12-27 09:36:47 -08:00
										 |  |  | 
 | 
					
						
							|  |  |  |     this.wrapperType = wrapperType; | 
					
						
							|  |  |  |     this.componentViewType = componentViewType; | 
					
						
							|  |  |  |     this.componentFactory = componentFactory; | 
					
						
							| 
									
										
										
										
											2015-08-25 15:36:02 -07:00
										 |  |  |   } | 
					
						
							| 
									
										
										
										
											2015-09-11 13:35:46 -07:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-11-10 16:27:53 -08:00
										 |  |  |   toSummary(): CompileDirectiveSummary { | 
					
						
							|  |  |  |     return { | 
					
						
							| 
									
										
										
										
											2016-12-02 10:08:46 -08:00
										 |  |  |       summaryKind: CompileSummaryKind.Directive, | 
					
						
							| 
									
										
										
										
											2016-11-10 16:27:53 -08:00
										 |  |  |       type: this.type, | 
					
						
							|  |  |  |       isComponent: this.isComponent, | 
					
						
							|  |  |  |       selector: this.selector, | 
					
						
							|  |  |  |       exportAs: this.exportAs, | 
					
						
							|  |  |  |       inputs: this.inputs, | 
					
						
							|  |  |  |       outputs: this.outputs, | 
					
						
							|  |  |  |       hostListeners: this.hostListeners, | 
					
						
							|  |  |  |       hostProperties: this.hostProperties, | 
					
						
							|  |  |  |       hostAttributes: this.hostAttributes, | 
					
						
							|  |  |  |       providers: this.providers, | 
					
						
							|  |  |  |       viewProviders: this.viewProviders, | 
					
						
							|  |  |  |       queries: this.queries, | 
					
						
							|  |  |  |       entryComponents: this.entryComponents, | 
					
						
							|  |  |  |       changeDetection: this.changeDetection, | 
					
						
							| 
									
										
										
										
											2016-12-27 09:36:47 -08:00
										 |  |  |       template: this.template && this.template.toSummary(), | 
					
						
							|  |  |  |       wrapperType: this.wrapperType, | 
					
						
							|  |  |  |       componentViewType: this.componentViewType, | 
					
						
							|  |  |  |       componentFactory: this.componentFactory | 
					
						
							| 
									
										
										
										
											2016-11-10 16:27:53 -08:00
										 |  |  |     }; | 
					
						
							|  |  |  |   } | 
					
						
							| 
									
										
										
										
											2015-08-25 15:36:02 -07:00
										 |  |  | } | 
					
						
							| 
									
										
										
										
											2015-09-02 15:07:31 -07:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-12-03 15:49:09 -08:00
										 |  |  | /** | 
					
						
							|  |  |  |  * Construct {@link CompileDirectiveMetadata} from {@link ComponentTypeMetadata} and a selector. | 
					
						
							|  |  |  |  */ | 
					
						
							| 
									
										
										
										
											2016-11-23 09:42:19 -08:00
										 |  |  | export function createHostComponentMeta( | 
					
						
							| 
									
										
										
										
											2016-12-27 09:36:47 -08:00
										 |  |  |     hostTypeReference: any, compMeta: CompileDirectiveMetadata, | 
					
						
							|  |  |  |     hostViewType: StaticSymbol | ProxyClass): CompileDirectiveMetadata { | 
					
						
							| 
									
										
										
										
											2016-11-12 14:08:58 +01:00
										 |  |  |   const template = CssSelector.parse(compMeta.selector)[0].getMatchingElementTemplate(); | 
					
						
							| 
									
										
										
										
											2015-09-18 10:33:23 -07:00
										 |  |  |   return CompileDirectiveMetadata.create({ | 
					
						
							| 
									
										
										
										
											2016-11-23 09:42:19 -08:00
										 |  |  |     isHost: true, | 
					
						
							| 
									
										
										
										
											2016-12-27 09:36:47 -08:00
										 |  |  |     type: {reference: hostTypeReference, diDeps: [], lifecycleHooks: []}, | 
					
						
							| 
									
										
										
										
											2016-06-08 16:38:52 -07:00
										 |  |  |     template: new CompileTemplateMetadata({ | 
					
						
							| 
									
										
										
										
											2016-08-24 17:39:49 -07:00
										 |  |  |       encapsulation: ViewEncapsulation.None, | 
					
						
							| 
									
										
										
										
											2016-06-08 16:38:52 -07:00
										 |  |  |       template: template, | 
					
						
							|  |  |  |       templateUrl: '', | 
					
						
							|  |  |  |       styles: [], | 
					
						
							|  |  |  |       styleUrls: [], | 
					
						
							|  |  |  |       ngContentSelectors: [], | 
					
						
							|  |  |  |       animations: [] | 
					
						
							|  |  |  |     }), | 
					
						
							| 
									
										
										
										
											2015-09-18 10:33:23 -07:00
										 |  |  |     changeDetection: ChangeDetectionStrategy.Default, | 
					
						
							| 
									
										
										
										
											2015-09-30 20:59:23 -07:00
										 |  |  |     inputs: [], | 
					
						
							|  |  |  |     outputs: [], | 
					
						
							| 
									
										
										
										
											2015-09-18 10:33:23 -07:00
										 |  |  |     host: {}, | 
					
						
							| 
									
										
										
										
											2015-09-14 15:59:09 -07:00
										 |  |  |     isComponent: true, | 
					
						
							| 
									
										
										
										
											2016-02-26 08:01:07 -08:00
										 |  |  |     selector: '*', | 
					
						
							|  |  |  |     providers: [], | 
					
						
							|  |  |  |     viewProviders: [], | 
					
						
							|  |  |  |     queries: [], | 
					
						
							| 
									
										
										
										
											2016-12-27 09:36:47 -08:00
										 |  |  |     viewQueries: [], | 
					
						
							|  |  |  |     componentViewType: hostViewType | 
					
						
							| 
									
										
										
										
											2015-09-14 15:59:09 -07:00
										 |  |  |   }); | 
					
						
							| 
									
										
										
										
											2015-09-02 15:07:31 -07:00
										 |  |  | } | 
					
						
							| 
									
										
										
										
											2015-12-02 10:35:51 -08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-11-29 15:36:33 -08:00
										 |  |  | export interface CompilePipeSummary extends CompileTypeSummary { | 
					
						
							| 
									
										
										
										
											2016-11-10 16:27:53 -08:00
										 |  |  |   type: CompileTypeMetadata; | 
					
						
							|  |  |  |   name: string; | 
					
						
							|  |  |  |   pure: boolean; | 
					
						
							|  |  |  | } | 
					
						
							| 
									
										
										
										
											2015-12-02 10:35:51 -08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-11-23 09:42:19 -08:00
										 |  |  | export class CompilePipeMetadata { | 
					
						
							| 
									
										
										
										
											2015-12-02 10:35:51 -08:00
										 |  |  |   type: CompileTypeMetadata; | 
					
						
							|  |  |  |   name: string; | 
					
						
							|  |  |  |   pure: boolean; | 
					
						
							| 
									
										
										
										
											2016-01-06 14:13:44 -08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-08-02 01:12:24 -07:00
										 |  |  |   constructor({type, name, pure}: { | 
					
						
							| 
									
										
										
										
											2016-01-06 14:13:44 -08:00
										 |  |  |     type?: CompileTypeMetadata, | 
					
						
							|  |  |  |     name?: string, | 
					
						
							|  |  |  |     pure?: boolean, | 
					
						
							|  |  |  |   } = {}) { | 
					
						
							| 
									
										
										
										
											2015-12-02 10:35:51 -08:00
										 |  |  |     this.type = type; | 
					
						
							|  |  |  |     this.name = name; | 
					
						
							| 
									
										
										
										
											2016-10-21 15:14:44 -07:00
										 |  |  |     this.pure = !!pure; | 
					
						
							| 
									
										
										
										
											2015-12-02 10:35:51 -08:00
										 |  |  |   } | 
					
						
							| 
									
										
										
										
											2016-11-10 16:27:53 -08:00
										 |  |  | 
 | 
					
						
							|  |  |  |   toSummary(): CompilePipeSummary { | 
					
						
							| 
									
										
										
										
											2016-12-02 10:08:46 -08:00
										 |  |  |     return { | 
					
						
							|  |  |  |       summaryKind: CompileSummaryKind.Pipe, | 
					
						
							|  |  |  |       type: this.type, | 
					
						
							|  |  |  |       name: this.name, | 
					
						
							|  |  |  |       pure: this.pure | 
					
						
							|  |  |  |     }; | 
					
						
							| 
									
										
										
										
											2016-11-10 16:27:53 -08:00
										 |  |  |   } | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-11-30 10:52:51 -08:00
										 |  |  | // Note: This should only use interfaces as nested data types
 | 
					
						
							|  |  |  | // as we need to be able to serialize this from/to JSON!
 | 
					
						
							| 
									
										
										
										
											2016-11-29 15:36:33 -08:00
										 |  |  | export interface CompileNgModuleSummary extends CompileTypeSummary { | 
					
						
							| 
									
										
										
										
											2016-11-10 16:27:53 -08:00
										 |  |  |   type: CompileTypeMetadata; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-12-02 10:08:46 -08:00
										 |  |  |   // Note: This is transitive over the exported modules.
 | 
					
						
							| 
									
										
										
										
											2016-11-10 16:27:53 -08:00
										 |  |  |   exportedDirectives: CompileIdentifierMetadata[]; | 
					
						
							| 
									
										
										
										
											2016-12-02 10:08:46 -08:00
										 |  |  |   // Note: This is transitive over the exported modules.
 | 
					
						
							| 
									
										
										
										
											2016-11-10 16:27:53 -08:00
										 |  |  |   exportedPipes: CompileIdentifierMetadata[]; | 
					
						
							| 
									
										
										
										
											2015-12-02 10:35:51 -08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-11-29 08:08:22 -08:00
										 |  |  |   // Note: This is transitive.
 | 
					
						
							| 
									
										
										
										
											2016-12-27 09:36:47 -08:00
										 |  |  |   entryComponents: CompileEntryComponentMetadata[]; | 
					
						
							| 
									
										
										
										
											2016-11-29 08:08:22 -08:00
										 |  |  |   // Note: This is transitive.
 | 
					
						
							| 
									
										
										
										
											2016-11-29 15:36:33 -08:00
										 |  |  |   providers: {provider: CompileProviderMetadata, module: CompileIdentifierMetadata}[]; | 
					
						
							|  |  |  |   // Note: This is transitive.
 | 
					
						
							|  |  |  |   modules: CompileTypeMetadata[]; | 
					
						
							| 
									
										
										
										
											2016-11-29 08:08:22 -08:00
										 |  |  | } | 
					
						
							| 
									
										
										
										
											2016-11-10 16:27:53 -08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-06-28 09:54:42 -07:00
										 |  |  | /** | 
					
						
							| 
									
										
										
										
											2016-10-24 13:28:23 -07:00
										 |  |  |  * Metadata regarding compilation of a module. | 
					
						
							| 
									
										
										
										
											2016-06-28 09:54:42 -07:00
										 |  |  |  */ | 
					
						
							| 
									
										
										
										
											2016-11-23 09:42:19 -08:00
										 |  |  | export class CompileNgModuleMetadata { | 
					
						
							| 
									
										
										
										
											2016-06-28 09:54:42 -07:00
										 |  |  |   type: CompileTypeMetadata; | 
					
						
							| 
									
										
										
										
											2016-11-10 14:07:30 -08:00
										 |  |  |   declaredDirectives: CompileIdentifierMetadata[]; | 
					
						
							|  |  |  |   exportedDirectives: CompileIdentifierMetadata[]; | 
					
						
							|  |  |  |   declaredPipes: CompileIdentifierMetadata[]; | 
					
						
							| 
									
										
										
										
											2016-11-29 08:08:22 -08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-11-10 14:07:30 -08:00
										 |  |  |   exportedPipes: CompileIdentifierMetadata[]; | 
					
						
							| 
									
										
										
										
											2016-12-27 09:36:47 -08:00
										 |  |  |   entryComponents: CompileEntryComponentMetadata[]; | 
					
						
							| 
									
										
										
										
											2016-11-10 14:07:30 -08:00
										 |  |  |   bootstrapComponents: CompileIdentifierMetadata[]; | 
					
						
							| 
									
										
										
										
											2016-07-18 03:50:31 -07:00
										 |  |  |   providers: CompileProviderMetadata[]; | 
					
						
							| 
									
										
										
										
											2016-06-28 09:54:42 -07:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-11-10 16:27:53 -08:00
										 |  |  |   importedModules: CompileNgModuleSummary[]; | 
					
						
							|  |  |  |   exportedModules: CompileNgModuleSummary[]; | 
					
						
							| 
									
										
										
										
											2016-07-25 03:02:57 -07:00
										 |  |  |   schemas: SchemaMetadata[]; | 
					
						
							| 
									
										
										
										
											2016-09-01 13:46:08 -07:00
										 |  |  |   id: string; | 
					
						
							| 
									
										
										
										
											2016-07-18 03:50:31 -07:00
										 |  |  | 
 | 
					
						
							|  |  |  |   transitiveModule: TransitiveCompileNgModuleMetadata; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   constructor( | 
					
						
							|  |  |  |       {type, providers, declaredDirectives, exportedDirectives, declaredPipes, exportedPipes, | 
					
						
							| 
									
										
										
										
											2016-08-02 06:54:08 -07:00
										 |  |  |        entryComponents, bootstrapComponents, importedModules, exportedModules, schemas, | 
					
						
							| 
									
										
										
										
											2016-09-01 13:46:08 -07:00
										 |  |  |        transitiveModule, id}: { | 
					
						
							| 
									
										
										
										
											2016-07-18 03:50:31 -07:00
										 |  |  |         type?: CompileTypeMetadata, | 
					
						
							| 
									
										
										
										
											2016-11-30 10:52:51 -08:00
										 |  |  |         providers?: CompileProviderMetadata[], | 
					
						
							| 
									
										
										
										
											2016-11-10 14:07:30 -08:00
										 |  |  |         declaredDirectives?: CompileIdentifierMetadata[], | 
					
						
							|  |  |  |         exportedDirectives?: CompileIdentifierMetadata[], | 
					
						
							|  |  |  |         declaredPipes?: CompileIdentifierMetadata[], | 
					
						
							|  |  |  |         exportedPipes?: CompileIdentifierMetadata[], | 
					
						
							| 
									
										
										
										
											2016-12-27 09:36:47 -08:00
										 |  |  |         entryComponents?: CompileEntryComponentMetadata[], | 
					
						
							| 
									
										
										
										
											2016-11-10 14:07:30 -08:00
										 |  |  |         bootstrapComponents?: CompileIdentifierMetadata[], | 
					
						
							| 
									
										
										
										
											2016-11-10 16:27:53 -08:00
										 |  |  |         importedModules?: CompileNgModuleSummary[], | 
					
						
							|  |  |  |         exportedModules?: CompileNgModuleSummary[], | 
					
						
							| 
									
										
										
										
											2016-07-25 03:02:57 -07:00
										 |  |  |         transitiveModule?: TransitiveCompileNgModuleMetadata, | 
					
						
							| 
									
										
										
										
											2016-09-01 13:46:08 -07:00
										 |  |  |         schemas?: SchemaMetadata[], | 
					
						
							|  |  |  |         id?: string | 
					
						
							| 
									
										
										
										
											2016-07-18 03:50:31 -07:00
										 |  |  |       } = {}) { | 
					
						
							| 
									
										
										
										
											2016-06-28 09:54:42 -07:00
										 |  |  |     this.type = type; | 
					
						
							| 
									
										
										
										
											2016-07-18 03:50:31 -07:00
										 |  |  |     this.declaredDirectives = _normalizeArray(declaredDirectives); | 
					
						
							|  |  |  |     this.exportedDirectives = _normalizeArray(exportedDirectives); | 
					
						
							|  |  |  |     this.declaredPipes = _normalizeArray(declaredPipes); | 
					
						
							|  |  |  |     this.exportedPipes = _normalizeArray(exportedPipes); | 
					
						
							| 
									
										
										
										
											2016-06-28 09:54:42 -07:00
										 |  |  |     this.providers = _normalizeArray(providers); | 
					
						
							| 
									
										
										
										
											2016-07-25 00:36:30 -07:00
										 |  |  |     this.entryComponents = _normalizeArray(entryComponents); | 
					
						
							| 
									
										
										
										
											2016-08-02 06:54:08 -07:00
										 |  |  |     this.bootstrapComponents = _normalizeArray(bootstrapComponents); | 
					
						
							| 
									
										
										
										
											2016-07-18 03:50:31 -07:00
										 |  |  |     this.importedModules = _normalizeArray(importedModules); | 
					
						
							|  |  |  |     this.exportedModules = _normalizeArray(exportedModules); | 
					
						
							| 
									
										
										
										
											2016-07-25 03:02:57 -07:00
										 |  |  |     this.schemas = _normalizeArray(schemas); | 
					
						
							| 
									
										
										
										
											2016-09-01 13:46:08 -07:00
										 |  |  |     this.id = id; | 
					
						
							| 
									
										
										
										
											2016-07-18 03:50:31 -07:00
										 |  |  |     this.transitiveModule = transitiveModule; | 
					
						
							| 
									
										
										
										
											2016-06-28 09:54:42 -07:00
										 |  |  |   } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-11-10 16:27:53 -08:00
										 |  |  |   toSummary(): CompileNgModuleSummary { | 
					
						
							|  |  |  |     return { | 
					
						
							| 
									
										
										
										
											2016-12-02 10:08:46 -08:00
										 |  |  |       summaryKind: CompileSummaryKind.NgModule, | 
					
						
							| 
									
										
										
										
											2016-11-10 16:27:53 -08:00
										 |  |  |       type: this.type, | 
					
						
							| 
									
										
										
										
											2016-11-29 08:08:22 -08:00
										 |  |  |       entryComponents: this.transitiveModule.entryComponents, | 
					
						
							|  |  |  |       providers: this.transitiveModule.providers, | 
					
						
							|  |  |  |       modules: this.transitiveModule.modules, | 
					
						
							| 
									
										
										
										
											2016-12-02 10:08:46 -08:00
										 |  |  |       exportedDirectives: this.transitiveModule.exportedDirectives, | 
					
						
							|  |  |  |       exportedPipes: this.transitiveModule.exportedPipes | 
					
						
							| 
									
										
										
										
											2016-11-10 16:27:53 -08:00
										 |  |  |     }; | 
					
						
							|  |  |  |   } | 
					
						
							| 
									
										
										
										
											2016-06-28 09:54:42 -07:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-07-18 03:50:31 -07:00
										 |  |  | export class TransitiveCompileNgModuleMetadata { | 
					
						
							| 
									
										
										
										
											2016-11-10 14:07:30 -08:00
										 |  |  |   directivesSet = new Set<any>(); | 
					
						
							| 
									
										
										
										
											2016-12-02 10:08:46 -08:00
										 |  |  |   directives: CompileIdentifierMetadata[] = []; | 
					
						
							|  |  |  |   exportedDirectivesSet = new Set<any>(); | 
					
						
							|  |  |  |   exportedDirectives: CompileIdentifierMetadata[] = []; | 
					
						
							| 
									
										
										
										
											2016-11-10 14:07:30 -08:00
										 |  |  |   pipesSet = new Set<any>(); | 
					
						
							| 
									
										
										
										
											2016-12-02 10:08:46 -08:00
										 |  |  |   pipes: CompileIdentifierMetadata[] = []; | 
					
						
							|  |  |  |   exportedPipesSet = new Set<any>(); | 
					
						
							|  |  |  |   exportedPipes: CompileIdentifierMetadata[] = []; | 
					
						
							|  |  |  |   modulesSet = new Set<any>(); | 
					
						
							|  |  |  |   modules: CompileTypeMetadata[] = []; | 
					
						
							|  |  |  |   entryComponentsSet = new Set<any>(); | 
					
						
							| 
									
										
										
										
											2016-12-27 09:36:47 -08:00
										 |  |  |   entryComponents: CompileEntryComponentMetadata[] = []; | 
					
						
							| 
									
										
										
										
											2016-12-02 10:08:46 -08:00
										 |  |  | 
 | 
					
						
							|  |  |  |   providers: {provider: CompileProviderMetadata, module: CompileIdentifierMetadata}[] = []; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   addProvider(provider: CompileProviderMetadata, module: CompileIdentifierMetadata) { | 
					
						
							|  |  |  |     this.providers.push({provider: provider, module: module}); | 
					
						
							|  |  |  |   } | 
					
						
							| 
									
										
										
										
											2016-10-24 13:28:23 -07:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-12-02 10:08:46 -08:00
										 |  |  |   addDirective(id: CompileIdentifierMetadata) { | 
					
						
							|  |  |  |     if (!this.directivesSet.has(id.reference)) { | 
					
						
							|  |  |  |       this.directivesSet.add(id.reference); | 
					
						
							|  |  |  |       this.directives.push(id); | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  |   } | 
					
						
							|  |  |  |   addExportedDirective(id: CompileIdentifierMetadata) { | 
					
						
							|  |  |  |     if (!this.exportedDirectivesSet.has(id.reference)) { | 
					
						
							|  |  |  |       this.exportedDirectivesSet.add(id.reference); | 
					
						
							|  |  |  |       this.exportedDirectives.push(id); | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  |   } | 
					
						
							|  |  |  |   addPipe(id: CompileIdentifierMetadata) { | 
					
						
							|  |  |  |     if (!this.pipesSet.has(id.reference)) { | 
					
						
							|  |  |  |       this.pipesSet.add(id.reference); | 
					
						
							|  |  |  |       this.pipes.push(id); | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  |   } | 
					
						
							|  |  |  |   addExportedPipe(id: CompileIdentifierMetadata) { | 
					
						
							|  |  |  |     if (!this.exportedPipesSet.has(id.reference)) { | 
					
						
							|  |  |  |       this.exportedPipesSet.add(id.reference); | 
					
						
							|  |  |  |       this.exportedPipes.push(id); | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  |   } | 
					
						
							|  |  |  |   addModule(id: CompileTypeMetadata) { | 
					
						
							|  |  |  |     if (!this.modulesSet.has(id.reference)) { | 
					
						
							|  |  |  |       this.modulesSet.add(id.reference); | 
					
						
							|  |  |  |       this.modules.push(id); | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  |   } | 
					
						
							| 
									
										
										
										
											2016-12-27 09:36:47 -08:00
										 |  |  |   addEntryComponent(ec: CompileEntryComponentMetadata) { | 
					
						
							|  |  |  |     if (!this.entryComponentsSet.has(ec.componentType)) { | 
					
						
							|  |  |  |       this.entryComponentsSet.add(ec.componentType); | 
					
						
							|  |  |  |       this.entryComponents.push(ec); | 
					
						
							| 
									
										
										
										
											2016-12-02 10:08:46 -08:00
										 |  |  |     } | 
					
						
							| 
									
										
										
										
											2016-07-18 03:50:31 -07:00
										 |  |  |   } | 
					
						
							| 
									
										
										
										
											2016-02-26 08:01:07 -08:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-01-06 14:13:44 -08:00
										 |  |  | function _normalizeArray(obj: any[]): any[] { | 
					
						
							| 
									
										
										
										
											2016-10-07 18:11:37 -07:00
										 |  |  |   return obj || []; | 
					
						
							| 
									
										
										
										
											2016-01-06 14:13:44 -08:00
										 |  |  | } | 
					
						
							| 
									
										
										
										
											2016-06-28 09:54:42 -07:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-08-15 19:37:42 -07:00
										 |  |  | export class ProviderMeta { | 
					
						
							|  |  |  |   token: any; | 
					
						
							|  |  |  |   useClass: Type<any>; | 
					
						
							|  |  |  |   useValue: any; | 
					
						
							|  |  |  |   useExisting: any; | 
					
						
							|  |  |  |   useFactory: Function; | 
					
						
							|  |  |  |   dependencies: Object[]; | 
					
						
							|  |  |  |   multi: boolean; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   constructor(token: any, {useClass, useValue, useExisting, useFactory, deps, multi}: { | 
					
						
							|  |  |  |     useClass?: Type<any>, | 
					
						
							|  |  |  |     useValue?: any, | 
					
						
							|  |  |  |     useExisting?: any, | 
					
						
							|  |  |  |     useFactory?: Function, | 
					
						
							|  |  |  |     deps?: Object[], | 
					
						
							|  |  |  |     multi?: boolean | 
					
						
							|  |  |  |   }) { | 
					
						
							|  |  |  |     this.token = token; | 
					
						
							|  |  |  |     this.useClass = useClass; | 
					
						
							|  |  |  |     this.useValue = useValue; | 
					
						
							|  |  |  |     this.useExisting = useExisting; | 
					
						
							|  |  |  |     this.useFactory = useFactory; | 
					
						
							|  |  |  |     this.dependencies = deps; | 
					
						
							|  |  |  |     this.multi = !!multi; | 
					
						
							|  |  |  |   } | 
					
						
							|  |  |  | } |