1 | import { Program } from 'typescript';
|
2 | import { SchemaMetadata } from '@angular/core';
|
3 | import { StaticSymbol, DirectiveResolver, CompileMetadataResolver, StaticReflector, DirectiveNormalizer, CompilePipeSummary, CompileNgModuleMetadata, CompileTemplateMetadata, CompileDirectiveMetadata, TemplateAst, ParseError, CompileDirectiveSummary } from '@angular/compiler';
|
4 | import { ProjectSymbols } from './project-symbols';
|
5 | import { Symbol } from './symbol';
|
6 | import { ResourceResolver } from './resource-resolver';
|
7 | import { CssAst } from './css-parser/css-ast';
|
8 | import { ProviderSymbol } from './provider-symbol';
|
9 | /**
|
10 | * The context into which the template of given
|
11 | * directive will be compiled.
|
12 | *
|
13 | * @export
|
14 | * @interface DirectiveContext
|
15 | */
|
16 | export interface DirectiveContext {
|
17 | /**
|
18 | * The directives that are available for the compilation
|
19 | * of the compilation of given template.
|
20 | *
|
21 | * @type {CompileDirectiveSummary[]}
|
22 | * @memberOf DirectiveContext
|
23 | */
|
24 | directives: CompileDirectiveSummary[];
|
25 | /**
|
26 | * The pipes which are available for the compilation
|
27 | * of the template of given target component.
|
28 | *
|
29 | * @type {CompilePipeSummary[]}
|
30 | * @memberOf DirectiveContext
|
31 | */
|
32 | pipes: CompilePipeSummary[];
|
33 | /**
|
34 | * The schemas that are used for the compilation of the template
|
35 | * of given component.
|
36 | *
|
37 | * @type {SchemaMetadata[]}
|
38 | * @memberOf DirectiveContext
|
39 | */
|
40 | schemas: SchemaMetadata[];
|
41 | }
|
42 | /**
|
43 | * The result of the compilation of the template of given component.
|
44 | *
|
45 | * @export
|
46 | * @interface TemplateAstResult
|
47 | */
|
48 | export interface TemplateAstResult {
|
49 | /**
|
50 | * The root template nodes.
|
51 | *
|
52 | * @type {TemplateAst[]}
|
53 | * @memberOf TemplateAstResult
|
54 | */
|
55 | templateAst?: TemplateAst[];
|
56 | /**
|
57 | * All the parse errors.
|
58 | *
|
59 | * @type {ParseError[]}
|
60 | * @memberOf TemplateAstResult
|
61 | */
|
62 | parseErrors?: ParseError[];
|
63 | /**
|
64 | * Non-parse errors occured during compilation.
|
65 | *
|
66 | * @type {{message: string}[]}
|
67 | * @memberOf TemplateAstResult
|
68 | */
|
69 | errors?: {
|
70 | message: string;
|
71 | }[];
|
72 | }
|
73 | /**
|
74 | * This class represents the individual directives and wrapps
|
75 | * their `StaticSymbol`s produced by the `@angular/compiler`.
|
76 | *
|
77 | * @export
|
78 | * @class DirectiveSymbol
|
79 | * @extends {Symbol}
|
80 | */
|
81 | export declare class DirectiveSymbol extends Symbol {
|
82 | private metadataResolver;
|
83 | private directiveNormalizer;
|
84 | private resolver;
|
85 | private reflector;
|
86 | private resourceResolver;
|
87 | private projectSymbols;
|
88 | private urlResolver;
|
89 | /**
|
90 | * Creates an instance of DirectiveSymbol.
|
91 | *
|
92 | * @param {Program} program
|
93 | * @param {StaticSymbol} symbol
|
94 | * @param {CompileMetadataResolver} metadataResolver
|
95 | * @param {DirectiveNormalizer} directiveNormalizer
|
96 | * @param {DirectiveResolver} resolver
|
97 | * @param {StaticReflector} reflector
|
98 | * @param {ResourceResolver} resourceResolver
|
99 | * @param {ContextSymbols} projectSymbols
|
100 | *
|
101 | * @memberOf DirectiveSymbol
|
102 | */
|
103 | constructor(program: Program, symbol: StaticSymbol, metadataResolver: CompileMetadataResolver, directiveNormalizer: DirectiveNormalizer, resolver: DirectiveResolver, reflector: StaticReflector, resourceResolver: ResourceResolver, projectSymbols: ProjectSymbols);
|
104 | /**
|
105 | * Returns the non-resolved metadata for given directive.
|
106 | * If it is a component, this means that the external templates
|
107 | * and styles won't be read from the drive. Also, the paths to
|
108 | * external metadata won't be resolved.
|
109 | *
|
110 | * @returns {CompileDirectiveMetadata}
|
111 | *
|
112 | * DirectiveSymbol
|
113 | */
|
114 | getNonResolvedMetadata(): CompileDirectiveMetadata | null;
|
115 | /**
|
116 | * Returns the normalized and resolved metadata for given directive or component.
|
117 | * For components, all the external templates and styles will be read and
|
118 | * set as values of the returned `CompileTemplateMetadata` properties.
|
119 | *
|
120 | * @returns {CompileTemplateMetadata}
|
121 | *
|
122 | * @memberOf DirectiveSymbol
|
123 | */
|
124 | getResolvedMetadata(): CompileTemplateMetadata | null;
|
125 | /**
|
126 | * Returns the module where the given directive has been declared.
|
127 | *
|
128 | * @returns {(CompileNgModuleMetadata | undefined)}
|
129 | *
|
130 | * @memberOf DirectiveSymbol
|
131 | */
|
132 | getModule(): CompileNgModuleMetadata | undefined;
|
133 | /**
|
134 | * Returns the ASTs of all styles of the target directive.
|
135 | *
|
136 | * @returns {CssAst[]}
|
137 | *
|
138 | * @memberOf DirectiveSymbol
|
139 | */
|
140 | getStyleAsts(): CssAst[] | null;
|
141 | /**
|
142 | * Returns the context into which the template of given
|
143 | * component is going to be compiled.
|
144 | *
|
145 | * @returns {DirectiveContext}
|
146 | *
|
147 | * @memberOf DirectiveSymbol
|
148 | */
|
149 | getDirectiveContext(): DirectiveContext;
|
150 | /**
|
151 | * Returns the compiled template of the target component.
|
152 | *
|
153 | * @returns {TemplateAstResult}
|
154 | *
|
155 | * @memberOf DirectiveSymbol
|
156 | */
|
157 | getTemplateAst(): TemplateAstResult;
|
158 | getDependencies(): ProviderSymbol[];
|
159 | getProviders(): ProviderSymbol[];
|
160 | getViewProviders(): ProviderSymbol[];
|
161 | /**
|
162 | * Returns if the target directive is a component.
|
163 | *
|
164 | * @returns {boolean}
|
165 | *
|
166 | * @memberOf DirectiveSymbol
|
167 | */
|
168 | isComponent(): boolean;
|
169 | }
|