[6a3a178] | 1 | /**
|
---|
| 2 | * @license
|
---|
| 3 | * Copyright Google LLC All Rights Reserved.
|
---|
| 4 | *
|
---|
| 5 | * Use of this source code is governed by an MIT-style license that can be
|
---|
| 6 | * found in the LICENSE file at https://angular.io/license
|
---|
| 7 | */
|
---|
| 8 | import { StaticSymbol } from './aot/static_symbol';
|
---|
| 9 | import { ChangeDetectionStrategy, SchemaMetadata, Type, ViewEncapsulation } from './core';
|
---|
| 10 | import { LifecycleHooks } from './lifecycle_reflector';
|
---|
| 11 | import { ParseTreeResult as HtmlParseTreeResult } from './ml_parser/parser';
|
---|
| 12 | import { CompileIdentifierMetadata } from './parse_util';
|
---|
| 13 | export declare function viewClassName(compType: any, embeddedTemplateIndex: number): string;
|
---|
| 14 | export declare function rendererTypeName(compType: any): string;
|
---|
| 15 | export declare function hostViewClassName(compType: any): string;
|
---|
| 16 | export declare function componentFactoryName(compType: any): string;
|
---|
| 17 | export interface ProxyClass {
|
---|
| 18 | setDelegate(delegate: any): void;
|
---|
| 19 | }
|
---|
| 20 | export declare enum CompileSummaryKind {
|
---|
| 21 | Pipe = 0,
|
---|
| 22 | Directive = 1,
|
---|
| 23 | NgModule = 2,
|
---|
| 24 | Injectable = 3
|
---|
| 25 | }
|
---|
| 26 | /**
|
---|
| 27 | * A CompileSummary is the data needed to use a directive / pipe / module
|
---|
| 28 | * in other modules / components. However, this data is not enough to compile
|
---|
| 29 | * the directive / module itself.
|
---|
| 30 | */
|
---|
| 31 | export interface CompileTypeSummary {
|
---|
| 32 | summaryKind: CompileSummaryKind | null;
|
---|
| 33 | type: CompileTypeMetadata;
|
---|
| 34 | }
|
---|
| 35 | export interface CompileDiDependencyMetadata {
|
---|
| 36 | isAttribute?: boolean;
|
---|
| 37 | isSelf?: boolean;
|
---|
| 38 | isHost?: boolean;
|
---|
| 39 | isSkipSelf?: boolean;
|
---|
| 40 | isOptional?: boolean;
|
---|
| 41 | isValue?: boolean;
|
---|
| 42 | token?: CompileTokenMetadata;
|
---|
| 43 | value?: any;
|
---|
| 44 | }
|
---|
| 45 | export interface CompileProviderMetadata {
|
---|
| 46 | token: CompileTokenMetadata;
|
---|
| 47 | useClass?: CompileTypeMetadata;
|
---|
| 48 | useValue?: any;
|
---|
| 49 | useExisting?: CompileTokenMetadata;
|
---|
| 50 | useFactory?: CompileFactoryMetadata;
|
---|
| 51 | deps?: CompileDiDependencyMetadata[];
|
---|
| 52 | multi?: boolean;
|
---|
| 53 | }
|
---|
| 54 | export interface CompileFactoryMetadata extends CompileIdentifierMetadata {
|
---|
| 55 | diDeps: CompileDiDependencyMetadata[];
|
---|
| 56 | reference: any;
|
---|
| 57 | }
|
---|
| 58 | export declare function tokenName(token: CompileTokenMetadata): string | null;
|
---|
| 59 | export declare function tokenReference(token: CompileTokenMetadata): any;
|
---|
| 60 | export interface CompileTokenMetadata {
|
---|
| 61 | value?: any;
|
---|
| 62 | identifier?: CompileIdentifierMetadata | CompileTypeMetadata;
|
---|
| 63 | }
|
---|
| 64 | export interface CompileInjectableMetadata {
|
---|
| 65 | symbol: StaticSymbol;
|
---|
| 66 | type: CompileTypeMetadata;
|
---|
| 67 | providedIn?: StaticSymbol;
|
---|
| 68 | useValue?: any;
|
---|
| 69 | useClass?: StaticSymbol;
|
---|
| 70 | useExisting?: StaticSymbol;
|
---|
| 71 | useFactory?: StaticSymbol;
|
---|
| 72 | deps?: any[];
|
---|
| 73 | }
|
---|
| 74 | /**
|
---|
| 75 | * Metadata regarding compilation of a type.
|
---|
| 76 | */
|
---|
| 77 | export interface CompileTypeMetadata extends CompileIdentifierMetadata {
|
---|
| 78 | diDeps: CompileDiDependencyMetadata[];
|
---|
| 79 | lifecycleHooks: LifecycleHooks[];
|
---|
| 80 | reference: any;
|
---|
| 81 | }
|
---|
| 82 | export interface CompileQueryMetadata {
|
---|
| 83 | selectors: Array<CompileTokenMetadata>;
|
---|
| 84 | descendants: boolean;
|
---|
| 85 | first: boolean;
|
---|
| 86 | propertyName: string;
|
---|
| 87 | read: CompileTokenMetadata;
|
---|
| 88 | static?: boolean;
|
---|
| 89 | emitDistinctChangesOnly?: boolean;
|
---|
| 90 | }
|
---|
| 91 | /**
|
---|
| 92 | * Metadata about a stylesheet
|
---|
| 93 | */
|
---|
| 94 | export declare class CompileStylesheetMetadata {
|
---|
| 95 | moduleUrl: string | null;
|
---|
| 96 | styles: string[];
|
---|
| 97 | styleUrls: string[];
|
---|
| 98 | constructor({ moduleUrl, styles, styleUrls }?: {
|
---|
| 99 | moduleUrl?: string;
|
---|
| 100 | styles?: string[];
|
---|
| 101 | styleUrls?: string[];
|
---|
| 102 | });
|
---|
| 103 | }
|
---|
| 104 | /**
|
---|
| 105 | * Summary Metadata regarding compilation of a template.
|
---|
| 106 | */
|
---|
| 107 | export interface CompileTemplateSummary {
|
---|
| 108 | ngContentSelectors: string[];
|
---|
| 109 | encapsulation: ViewEncapsulation | null;
|
---|
| 110 | styles: string[];
|
---|
| 111 | animations: any[] | null;
|
---|
| 112 | }
|
---|
| 113 | /**
|
---|
| 114 | * Metadata regarding compilation of a template.
|
---|
| 115 | */
|
---|
| 116 | export declare class CompileTemplateMetadata {
|
---|
| 117 | encapsulation: ViewEncapsulation | null;
|
---|
| 118 | template: string | null;
|
---|
| 119 | templateUrl: string | null;
|
---|
| 120 | htmlAst: HtmlParseTreeResult | null;
|
---|
| 121 | isInline: boolean;
|
---|
| 122 | styles: string[];
|
---|
| 123 | styleUrls: string[];
|
---|
| 124 | externalStylesheets: CompileStylesheetMetadata[];
|
---|
| 125 | animations: any[];
|
---|
| 126 | ngContentSelectors: string[];
|
---|
| 127 | interpolation: [string, string] | null;
|
---|
| 128 | preserveWhitespaces: boolean;
|
---|
| 129 | constructor({ encapsulation, template, templateUrl, htmlAst, styles, styleUrls, externalStylesheets, animations, ngContentSelectors, interpolation, isInline, preserveWhitespaces }: {
|
---|
| 130 | encapsulation: ViewEncapsulation | null;
|
---|
| 131 | template: string | null;
|
---|
| 132 | templateUrl: string | null;
|
---|
| 133 | htmlAst: HtmlParseTreeResult | null;
|
---|
| 134 | styles: string[];
|
---|
| 135 | styleUrls: string[];
|
---|
| 136 | externalStylesheets: CompileStylesheetMetadata[];
|
---|
| 137 | ngContentSelectors: string[];
|
---|
| 138 | animations: any[];
|
---|
| 139 | interpolation: [string, string] | null;
|
---|
| 140 | isInline: boolean;
|
---|
| 141 | preserveWhitespaces: boolean;
|
---|
| 142 | });
|
---|
| 143 | toSummary(): CompileTemplateSummary;
|
---|
| 144 | }
|
---|
| 145 | export interface CompileEntryComponentMetadata {
|
---|
| 146 | componentType: any;
|
---|
| 147 | componentFactory: StaticSymbol | object;
|
---|
| 148 | }
|
---|
| 149 | export interface CompileDirectiveSummary extends CompileTypeSummary {
|
---|
| 150 | type: CompileTypeMetadata;
|
---|
| 151 | isComponent: boolean;
|
---|
| 152 | selector: string | null;
|
---|
| 153 | exportAs: string | null;
|
---|
| 154 | inputs: {
|
---|
| 155 | [key: string]: string;
|
---|
| 156 | };
|
---|
| 157 | outputs: {
|
---|
| 158 | [key: string]: string;
|
---|
| 159 | };
|
---|
| 160 | hostListeners: {
|
---|
| 161 | [key: string]: string;
|
---|
| 162 | };
|
---|
| 163 | hostProperties: {
|
---|
| 164 | [key: string]: string;
|
---|
| 165 | };
|
---|
| 166 | hostAttributes: {
|
---|
| 167 | [key: string]: string;
|
---|
| 168 | };
|
---|
| 169 | providers: CompileProviderMetadata[];
|
---|
| 170 | viewProviders: CompileProviderMetadata[];
|
---|
| 171 | queries: CompileQueryMetadata[];
|
---|
| 172 | guards: {
|
---|
| 173 | [key: string]: any;
|
---|
| 174 | };
|
---|
| 175 | viewQueries: CompileQueryMetadata[];
|
---|
| 176 | entryComponents: CompileEntryComponentMetadata[];
|
---|
| 177 | changeDetection: ChangeDetectionStrategy | null;
|
---|
| 178 | template: CompileTemplateSummary | null;
|
---|
| 179 | componentViewType: StaticSymbol | ProxyClass | null;
|
---|
| 180 | rendererType: StaticSymbol | object | null;
|
---|
| 181 | componentFactory: StaticSymbol | object | null;
|
---|
| 182 | }
|
---|
| 183 | /**
|
---|
| 184 | * Metadata regarding compilation of a directive.
|
---|
| 185 | */
|
---|
| 186 | export declare class CompileDirectiveMetadata {
|
---|
| 187 | static create({ isHost, type, isComponent, selector, exportAs, changeDetection, inputs, outputs, host, providers, viewProviders, queries, guards, viewQueries, entryComponents, template, componentViewType, rendererType, componentFactory }: {
|
---|
| 188 | isHost: boolean;
|
---|
| 189 | type: CompileTypeMetadata;
|
---|
| 190 | isComponent: boolean;
|
---|
| 191 | selector: string | null;
|
---|
| 192 | exportAs: string | null;
|
---|
| 193 | changeDetection: ChangeDetectionStrategy | null;
|
---|
| 194 | inputs: string[];
|
---|
| 195 | outputs: string[];
|
---|
| 196 | host: {
|
---|
| 197 | [key: string]: string;
|
---|
| 198 | };
|
---|
| 199 | providers: CompileProviderMetadata[];
|
---|
| 200 | viewProviders: CompileProviderMetadata[];
|
---|
| 201 | queries: CompileQueryMetadata[];
|
---|
| 202 | guards: {
|
---|
| 203 | [key: string]: any;
|
---|
| 204 | };
|
---|
| 205 | viewQueries: CompileQueryMetadata[];
|
---|
| 206 | entryComponents: CompileEntryComponentMetadata[];
|
---|
| 207 | template: CompileTemplateMetadata;
|
---|
| 208 | componentViewType: StaticSymbol | ProxyClass | null;
|
---|
| 209 | rendererType: StaticSymbol | object | null;
|
---|
| 210 | componentFactory: StaticSymbol | object | null;
|
---|
| 211 | }): CompileDirectiveMetadata;
|
---|
| 212 | isHost: boolean;
|
---|
| 213 | type: CompileTypeMetadata;
|
---|
| 214 | isComponent: boolean;
|
---|
| 215 | selector: string | null;
|
---|
| 216 | exportAs: string | null;
|
---|
| 217 | changeDetection: ChangeDetectionStrategy | null;
|
---|
| 218 | inputs: {
|
---|
| 219 | [key: string]: string;
|
---|
| 220 | };
|
---|
| 221 | outputs: {
|
---|
| 222 | [key: string]: string;
|
---|
| 223 | };
|
---|
| 224 | hostListeners: {
|
---|
| 225 | [key: string]: string;
|
---|
| 226 | };
|
---|
| 227 | hostProperties: {
|
---|
| 228 | [key: string]: string;
|
---|
| 229 | };
|
---|
| 230 | hostAttributes: {
|
---|
| 231 | [key: string]: string;
|
---|
| 232 | };
|
---|
| 233 | providers: CompileProviderMetadata[];
|
---|
| 234 | viewProviders: CompileProviderMetadata[];
|
---|
| 235 | queries: CompileQueryMetadata[];
|
---|
| 236 | guards: {
|
---|
| 237 | [key: string]: any;
|
---|
| 238 | };
|
---|
| 239 | viewQueries: CompileQueryMetadata[];
|
---|
| 240 | entryComponents: CompileEntryComponentMetadata[];
|
---|
| 241 | template: CompileTemplateMetadata | null;
|
---|
| 242 | componentViewType: StaticSymbol | ProxyClass | null;
|
---|
| 243 | rendererType: StaticSymbol | object | null;
|
---|
| 244 | componentFactory: StaticSymbol | object | null;
|
---|
| 245 | constructor({ isHost, type, isComponent, selector, exportAs, changeDetection, inputs, outputs, hostListeners, hostProperties, hostAttributes, providers, viewProviders, queries, guards, viewQueries, entryComponents, template, componentViewType, rendererType, componentFactory }: {
|
---|
| 246 | isHost: boolean;
|
---|
| 247 | type: CompileTypeMetadata;
|
---|
| 248 | isComponent: boolean;
|
---|
| 249 | selector: string | null;
|
---|
| 250 | exportAs: string | null;
|
---|
| 251 | changeDetection: ChangeDetectionStrategy | null;
|
---|
| 252 | inputs: {
|
---|
| 253 | [key: string]: string;
|
---|
| 254 | };
|
---|
| 255 | outputs: {
|
---|
| 256 | [key: string]: string;
|
---|
| 257 | };
|
---|
| 258 | hostListeners: {
|
---|
| 259 | [key: string]: string;
|
---|
| 260 | };
|
---|
| 261 | hostProperties: {
|
---|
| 262 | [key: string]: string;
|
---|
| 263 | };
|
---|
| 264 | hostAttributes: {
|
---|
| 265 | [key: string]: string;
|
---|
| 266 | };
|
---|
| 267 | providers: CompileProviderMetadata[];
|
---|
| 268 | viewProviders: CompileProviderMetadata[];
|
---|
| 269 | queries: CompileQueryMetadata[];
|
---|
| 270 | guards: {
|
---|
| 271 | [key: string]: any;
|
---|
| 272 | };
|
---|
| 273 | viewQueries: CompileQueryMetadata[];
|
---|
| 274 | entryComponents: CompileEntryComponentMetadata[];
|
---|
| 275 | template: CompileTemplateMetadata | null;
|
---|
| 276 | componentViewType: StaticSymbol | ProxyClass | null;
|
---|
| 277 | rendererType: StaticSymbol | object | null;
|
---|
| 278 | componentFactory: StaticSymbol | object | null;
|
---|
| 279 | });
|
---|
| 280 | toSummary(): CompileDirectiveSummary;
|
---|
| 281 | }
|
---|
| 282 | export interface CompilePipeSummary extends CompileTypeSummary {
|
---|
| 283 | type: CompileTypeMetadata;
|
---|
| 284 | name: string;
|
---|
| 285 | pure: boolean;
|
---|
| 286 | }
|
---|
| 287 | export declare class CompilePipeMetadata {
|
---|
| 288 | type: CompileTypeMetadata;
|
---|
| 289 | name: string;
|
---|
| 290 | pure: boolean;
|
---|
| 291 | constructor({ type, name, pure }: {
|
---|
| 292 | type: CompileTypeMetadata;
|
---|
| 293 | name: string;
|
---|
| 294 | pure: boolean;
|
---|
| 295 | });
|
---|
| 296 | toSummary(): CompilePipeSummary;
|
---|
| 297 | }
|
---|
| 298 | export interface CompileNgModuleSummary extends CompileTypeSummary {
|
---|
| 299 | type: CompileTypeMetadata;
|
---|
| 300 | exportedDirectives: CompileIdentifierMetadata[];
|
---|
| 301 | exportedPipes: CompileIdentifierMetadata[];
|
---|
| 302 | entryComponents: CompileEntryComponentMetadata[];
|
---|
| 303 | providers: {
|
---|
| 304 | provider: CompileProviderMetadata;
|
---|
| 305 | module: CompileIdentifierMetadata;
|
---|
| 306 | }[];
|
---|
| 307 | modules: CompileTypeMetadata[];
|
---|
| 308 | }
|
---|
| 309 | export declare class CompileShallowModuleMetadata {
|
---|
| 310 | type: CompileTypeMetadata;
|
---|
| 311 | rawExports: any;
|
---|
| 312 | rawImports: any;
|
---|
| 313 | rawProviders: any;
|
---|
| 314 | }
|
---|
| 315 | /**
|
---|
| 316 | * Metadata regarding compilation of a module.
|
---|
| 317 | */
|
---|
| 318 | export declare class CompileNgModuleMetadata {
|
---|
| 319 | type: CompileTypeMetadata;
|
---|
| 320 | declaredDirectives: CompileIdentifierMetadata[];
|
---|
| 321 | exportedDirectives: CompileIdentifierMetadata[];
|
---|
| 322 | declaredPipes: CompileIdentifierMetadata[];
|
---|
| 323 | exportedPipes: CompileIdentifierMetadata[];
|
---|
| 324 | entryComponents: CompileEntryComponentMetadata[];
|
---|
| 325 | bootstrapComponents: CompileIdentifierMetadata[];
|
---|
| 326 | providers: CompileProviderMetadata[];
|
---|
| 327 | importedModules: CompileNgModuleSummary[];
|
---|
| 328 | exportedModules: CompileNgModuleSummary[];
|
---|
| 329 | schemas: SchemaMetadata[];
|
---|
| 330 | id: string | null;
|
---|
| 331 | transitiveModule: TransitiveCompileNgModuleMetadata;
|
---|
| 332 | constructor({ type, providers, declaredDirectives, exportedDirectives, declaredPipes, exportedPipes, entryComponents, bootstrapComponents, importedModules, exportedModules, schemas, transitiveModule, id }: {
|
---|
| 333 | type: CompileTypeMetadata;
|
---|
| 334 | providers: CompileProviderMetadata[];
|
---|
| 335 | declaredDirectives: CompileIdentifierMetadata[];
|
---|
| 336 | exportedDirectives: CompileIdentifierMetadata[];
|
---|
| 337 | declaredPipes: CompileIdentifierMetadata[];
|
---|
| 338 | exportedPipes: CompileIdentifierMetadata[];
|
---|
| 339 | entryComponents: CompileEntryComponentMetadata[];
|
---|
| 340 | bootstrapComponents: CompileIdentifierMetadata[];
|
---|
| 341 | importedModules: CompileNgModuleSummary[];
|
---|
| 342 | exportedModules: CompileNgModuleSummary[];
|
---|
| 343 | transitiveModule: TransitiveCompileNgModuleMetadata;
|
---|
| 344 | schemas: SchemaMetadata[];
|
---|
| 345 | id: string | null;
|
---|
| 346 | });
|
---|
| 347 | toSummary(): CompileNgModuleSummary;
|
---|
| 348 | }
|
---|
| 349 | export declare class TransitiveCompileNgModuleMetadata {
|
---|
| 350 | directivesSet: Set<any>;
|
---|
| 351 | directives: CompileIdentifierMetadata[];
|
---|
| 352 | exportedDirectivesSet: Set<any>;
|
---|
| 353 | exportedDirectives: CompileIdentifierMetadata[];
|
---|
| 354 | pipesSet: Set<any>;
|
---|
| 355 | pipes: CompileIdentifierMetadata[];
|
---|
| 356 | exportedPipesSet: Set<any>;
|
---|
| 357 | exportedPipes: CompileIdentifierMetadata[];
|
---|
| 358 | modulesSet: Set<any>;
|
---|
| 359 | modules: CompileTypeMetadata[];
|
---|
| 360 | entryComponentsSet: Set<any>;
|
---|
| 361 | entryComponents: CompileEntryComponentMetadata[];
|
---|
| 362 | providers: {
|
---|
| 363 | provider: CompileProviderMetadata;
|
---|
| 364 | module: CompileIdentifierMetadata;
|
---|
| 365 | }[];
|
---|
| 366 | addProvider(provider: CompileProviderMetadata, module: CompileIdentifierMetadata): void;
|
---|
| 367 | addDirective(id: CompileIdentifierMetadata): void;
|
---|
| 368 | addExportedDirective(id: CompileIdentifierMetadata): void;
|
---|
| 369 | addPipe(id: CompileIdentifierMetadata): void;
|
---|
| 370 | addExportedPipe(id: CompileIdentifierMetadata): void;
|
---|
| 371 | addModule(id: CompileTypeMetadata): void;
|
---|
| 372 | addEntryComponent(ec: CompileEntryComponentMetadata): void;
|
---|
| 373 | }
|
---|
| 374 | export declare class ProviderMeta {
|
---|
| 375 | token: any;
|
---|
| 376 | useClass: Type | null;
|
---|
| 377 | useValue: any;
|
---|
| 378 | useExisting: any;
|
---|
| 379 | useFactory: Function | null;
|
---|
| 380 | dependencies: Object[] | null;
|
---|
| 381 | multi: boolean;
|
---|
| 382 | constructor(token: any, { useClass, useValue, useExisting, useFactory, deps, multi }: {
|
---|
| 383 | useClass?: Type;
|
---|
| 384 | useValue?: any;
|
---|
| 385 | useExisting?: any;
|
---|
| 386 | useFactory?: Function | null;
|
---|
| 387 | deps?: Object[] | null;
|
---|
| 388 | multi?: boolean;
|
---|
| 389 | });
|
---|
| 390 | }
|
---|
| 391 | export declare function flatten<T>(list: Array<T | T[]>): T[];
|
---|
| 392 | export declare function templateSourceUrl(ngModuleType: CompileIdentifierMetadata, compMeta: {
|
---|
| 393 | type: CompileIdentifierMetadata;
|
---|
| 394 | }, templateMeta: {
|
---|
| 395 | isInline: boolean;
|
---|
| 396 | templateUrl: string | null;
|
---|
| 397 | }): string;
|
---|
| 398 | export declare function sharedStylesheetJitUrl(meta: CompileStylesheetMetadata, id: number): string;
|
---|
| 399 | export declare function ngModuleJitUrl(moduleMeta: CompileNgModuleMetadata): string;
|
---|
| 400 | export declare function templateJitUrl(ngModuleType: CompileIdentifierMetadata, compMeta: CompileDirectiveMetadata): string;
|
---|