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 { ngModuleJitUrl, sharedStylesheetJitUrl, templateJitUrl, templateSourceUrl } from '../compile_metadata';
|
---|
9 | import { ConstantPool } from '../constant_pool';
|
---|
10 | import * as ir from '../output/output_ast';
|
---|
11 | import { interpretStatements } from '../output/output_interpreter';
|
---|
12 | import { identifierName } from '../parse_util';
|
---|
13 | import { stringify, SyncAsync } from '../util';
|
---|
14 | /**
|
---|
15 | * An internal module of the Angular compiler that begins with component types,
|
---|
16 | * extracts templates, and eventually produces a compiled version of the component
|
---|
17 | * ready for linking into an application.
|
---|
18 | *
|
---|
19 | * @security When compiling templates at runtime, you must ensure that the entire template comes
|
---|
20 | * from a trusted source. Attacker-controlled data introduced by a template could expose your
|
---|
21 | * application to XSS risks. For more detail, see the [Security Guide](https://g.co/ng/security).
|
---|
22 | */
|
---|
23 | export class JitCompiler {
|
---|
24 | constructor(_metadataResolver, _templateParser, _styleCompiler, _viewCompiler, _ngModuleCompiler, _summaryResolver, _reflector, _jitEvaluator, _compilerConfig, _console, getExtraNgModuleProviders) {
|
---|
25 | this._metadataResolver = _metadataResolver;
|
---|
26 | this._templateParser = _templateParser;
|
---|
27 | this._styleCompiler = _styleCompiler;
|
---|
28 | this._viewCompiler = _viewCompiler;
|
---|
29 | this._ngModuleCompiler = _ngModuleCompiler;
|
---|
30 | this._summaryResolver = _summaryResolver;
|
---|
31 | this._reflector = _reflector;
|
---|
32 | this._jitEvaluator = _jitEvaluator;
|
---|
33 | this._compilerConfig = _compilerConfig;
|
---|
34 | this._console = _console;
|
---|
35 | this.getExtraNgModuleProviders = getExtraNgModuleProviders;
|
---|
36 | this._compiledTemplateCache = new Map();
|
---|
37 | this._compiledHostTemplateCache = new Map();
|
---|
38 | this._compiledDirectiveWrapperCache = new Map();
|
---|
39 | this._compiledNgModuleCache = new Map();
|
---|
40 | this._sharedStylesheetCount = 0;
|
---|
41 | this._addedAotSummaries = new Set();
|
---|
42 | }
|
---|
43 | compileModuleSync(moduleType) {
|
---|
44 | return SyncAsync.assertSync(this._compileModuleAndComponents(moduleType, true));
|
---|
45 | }
|
---|
46 | compileModuleAsync(moduleType) {
|
---|
47 | return Promise.resolve(this._compileModuleAndComponents(moduleType, false));
|
---|
48 | }
|
---|
49 | compileModuleAndAllComponentsSync(moduleType) {
|
---|
50 | return SyncAsync.assertSync(this._compileModuleAndAllComponents(moduleType, true));
|
---|
51 | }
|
---|
52 | compileModuleAndAllComponentsAsync(moduleType) {
|
---|
53 | return Promise.resolve(this._compileModuleAndAllComponents(moduleType, false));
|
---|
54 | }
|
---|
55 | getComponentFactory(component) {
|
---|
56 | const summary = this._metadataResolver.getDirectiveSummary(component);
|
---|
57 | return summary.componentFactory;
|
---|
58 | }
|
---|
59 | loadAotSummaries(summaries) {
|
---|
60 | this.clearCache();
|
---|
61 | this._addAotSummaries(summaries);
|
---|
62 | }
|
---|
63 | _addAotSummaries(fn) {
|
---|
64 | if (this._addedAotSummaries.has(fn)) {
|
---|
65 | return;
|
---|
66 | }
|
---|
67 | this._addedAotSummaries.add(fn);
|
---|
68 | const summaries = fn();
|
---|
69 | for (let i = 0; i < summaries.length; i++) {
|
---|
70 | const entry = summaries[i];
|
---|
71 | if (typeof entry === 'function') {
|
---|
72 | this._addAotSummaries(entry);
|
---|
73 | }
|
---|
74 | else {
|
---|
75 | const summary = entry;
|
---|
76 | this._summaryResolver.addSummary({ symbol: summary.type.reference, metadata: null, type: summary });
|
---|
77 | }
|
---|
78 | }
|
---|
79 | }
|
---|
80 | hasAotSummary(ref) {
|
---|
81 | return !!this._summaryResolver.resolveSummary(ref);
|
---|
82 | }
|
---|
83 | _filterJitIdentifiers(ids) {
|
---|
84 | return ids.map(mod => mod.reference).filter((ref) => !this.hasAotSummary(ref));
|
---|
85 | }
|
---|
86 | _compileModuleAndComponents(moduleType, isSync) {
|
---|
87 | return SyncAsync.then(this._loadModules(moduleType, isSync), () => {
|
---|
88 | this._compileComponents(moduleType, null);
|
---|
89 | return this._compileModule(moduleType);
|
---|
90 | });
|
---|
91 | }
|
---|
92 | _compileModuleAndAllComponents(moduleType, isSync) {
|
---|
93 | return SyncAsync.then(this._loadModules(moduleType, isSync), () => {
|
---|
94 | const componentFactories = [];
|
---|
95 | this._compileComponents(moduleType, componentFactories);
|
---|
96 | return {
|
---|
97 | ngModuleFactory: this._compileModule(moduleType),
|
---|
98 | componentFactories: componentFactories
|
---|
99 | };
|
---|
100 | });
|
---|
101 | }
|
---|
102 | _loadModules(mainModule, isSync) {
|
---|
103 | const loading = [];
|
---|
104 | const mainNgModule = this._metadataResolver.getNgModuleMetadata(mainModule);
|
---|
105 | // Note: for runtime compilation, we want to transitively compile all modules,
|
---|
106 | // so we also need to load the declared directives / pipes for all nested modules.
|
---|
107 | this._filterJitIdentifiers(mainNgModule.transitiveModule.modules).forEach((nestedNgModule) => {
|
---|
108 | // getNgModuleMetadata only returns null if the value passed in is not an NgModule
|
---|
109 | const moduleMeta = this._metadataResolver.getNgModuleMetadata(nestedNgModule);
|
---|
110 | this._filterJitIdentifiers(moduleMeta.declaredDirectives).forEach((ref) => {
|
---|
111 | const promise = this._metadataResolver.loadDirectiveMetadata(moduleMeta.type.reference, ref, isSync);
|
---|
112 | if (promise) {
|
---|
113 | loading.push(promise);
|
---|
114 | }
|
---|
115 | });
|
---|
116 | this._filterJitIdentifiers(moduleMeta.declaredPipes)
|
---|
117 | .forEach((ref) => this._metadataResolver.getOrLoadPipeMetadata(ref));
|
---|
118 | });
|
---|
119 | return SyncAsync.all(loading);
|
---|
120 | }
|
---|
121 | _compileModule(moduleType) {
|
---|
122 | let ngModuleFactory = this._compiledNgModuleCache.get(moduleType);
|
---|
123 | if (!ngModuleFactory) {
|
---|
124 | const moduleMeta = this._metadataResolver.getNgModuleMetadata(moduleType);
|
---|
125 | // Always provide a bound Compiler
|
---|
126 | const extraProviders = this.getExtraNgModuleProviders(moduleMeta.type.reference);
|
---|
127 | const outputCtx = createOutputContext();
|
---|
128 | const compileResult = this._ngModuleCompiler.compile(outputCtx, moduleMeta, extraProviders);
|
---|
129 | ngModuleFactory = this._interpretOrJit(ngModuleJitUrl(moduleMeta), outputCtx.statements)[compileResult.ngModuleFactoryVar];
|
---|
130 | this._compiledNgModuleCache.set(moduleMeta.type.reference, ngModuleFactory);
|
---|
131 | }
|
---|
132 | return ngModuleFactory;
|
---|
133 | }
|
---|
134 | /**
|
---|
135 | * @internal
|
---|
136 | */
|
---|
137 | _compileComponents(mainModule, allComponentFactories) {
|
---|
138 | const ngModule = this._metadataResolver.getNgModuleMetadata(mainModule);
|
---|
139 | const moduleByJitDirective = new Map();
|
---|
140 | const templates = new Set();
|
---|
141 | const transJitModules = this._filterJitIdentifiers(ngModule.transitiveModule.modules);
|
---|
142 | transJitModules.forEach((localMod) => {
|
---|
143 | const localModuleMeta = this._metadataResolver.getNgModuleMetadata(localMod);
|
---|
144 | this._filterJitIdentifiers(localModuleMeta.declaredDirectives).forEach((dirRef) => {
|
---|
145 | moduleByJitDirective.set(dirRef, localModuleMeta);
|
---|
146 | const dirMeta = this._metadataResolver.getDirectiveMetadata(dirRef);
|
---|
147 | if (dirMeta.isComponent) {
|
---|
148 | templates.add(this._createCompiledTemplate(dirMeta, localModuleMeta));
|
---|
149 | if (allComponentFactories) {
|
---|
150 | const template = this._createCompiledHostTemplate(dirMeta.type.reference, localModuleMeta);
|
---|
151 | templates.add(template);
|
---|
152 | allComponentFactories.push(dirMeta.componentFactory);
|
---|
153 | }
|
---|
154 | }
|
---|
155 | });
|
---|
156 | });
|
---|
157 | transJitModules.forEach((localMod) => {
|
---|
158 | const localModuleMeta = this._metadataResolver.getNgModuleMetadata(localMod);
|
---|
159 | this._filterJitIdentifiers(localModuleMeta.declaredDirectives).forEach((dirRef) => {
|
---|
160 | const dirMeta = this._metadataResolver.getDirectiveMetadata(dirRef);
|
---|
161 | if (dirMeta.isComponent) {
|
---|
162 | dirMeta.entryComponents.forEach((entryComponentType) => {
|
---|
163 | const moduleMeta = moduleByJitDirective.get(entryComponentType.componentType);
|
---|
164 | templates.add(this._createCompiledHostTemplate(entryComponentType.componentType, moduleMeta));
|
---|
165 | });
|
---|
166 | }
|
---|
167 | });
|
---|
168 | localModuleMeta.entryComponents.forEach((entryComponentType) => {
|
---|
169 | if (!this.hasAotSummary(entryComponentType.componentType)) {
|
---|
170 | const moduleMeta = moduleByJitDirective.get(entryComponentType.componentType);
|
---|
171 | templates.add(this._createCompiledHostTemplate(entryComponentType.componentType, moduleMeta));
|
---|
172 | }
|
---|
173 | });
|
---|
174 | });
|
---|
175 | templates.forEach((template) => this._compileTemplate(template));
|
---|
176 | }
|
---|
177 | clearCacheFor(type) {
|
---|
178 | this._compiledNgModuleCache.delete(type);
|
---|
179 | this._metadataResolver.clearCacheFor(type);
|
---|
180 | this._compiledHostTemplateCache.delete(type);
|
---|
181 | const compiledTemplate = this._compiledTemplateCache.get(type);
|
---|
182 | if (compiledTemplate) {
|
---|
183 | this._compiledTemplateCache.delete(type);
|
---|
184 | }
|
---|
185 | }
|
---|
186 | clearCache() {
|
---|
187 | // Note: don't clear the _addedAotSummaries, as they don't change!
|
---|
188 | this._metadataResolver.clearCache();
|
---|
189 | this._compiledTemplateCache.clear();
|
---|
190 | this._compiledHostTemplateCache.clear();
|
---|
191 | this._compiledNgModuleCache.clear();
|
---|
192 | }
|
---|
193 | _createCompiledHostTemplate(compType, ngModule) {
|
---|
194 | if (!ngModule) {
|
---|
195 | throw new Error(`Component ${stringify(compType)} is not part of any NgModule or the module has not been imported into your module.`);
|
---|
196 | }
|
---|
197 | let compiledTemplate = this._compiledHostTemplateCache.get(compType);
|
---|
198 | if (!compiledTemplate) {
|
---|
199 | const compMeta = this._metadataResolver.getDirectiveMetadata(compType);
|
---|
200 | assertComponent(compMeta);
|
---|
201 | const hostMeta = this._metadataResolver.getHostComponentMetadata(compMeta, compMeta.componentFactory.viewDefFactory);
|
---|
202 | compiledTemplate =
|
---|
203 | new CompiledTemplate(true, compMeta.type, hostMeta, ngModule, [compMeta.type]);
|
---|
204 | this._compiledHostTemplateCache.set(compType, compiledTemplate);
|
---|
205 | }
|
---|
206 | return compiledTemplate;
|
---|
207 | }
|
---|
208 | _createCompiledTemplate(compMeta, ngModule) {
|
---|
209 | let compiledTemplate = this._compiledTemplateCache.get(compMeta.type.reference);
|
---|
210 | if (!compiledTemplate) {
|
---|
211 | assertComponent(compMeta);
|
---|
212 | compiledTemplate = new CompiledTemplate(false, compMeta.type, compMeta, ngModule, ngModule.transitiveModule.directives);
|
---|
213 | this._compiledTemplateCache.set(compMeta.type.reference, compiledTemplate);
|
---|
214 | }
|
---|
215 | return compiledTemplate;
|
---|
216 | }
|
---|
217 | _compileTemplate(template) {
|
---|
218 | if (template.isCompiled) {
|
---|
219 | return;
|
---|
220 | }
|
---|
221 | const compMeta = template.compMeta;
|
---|
222 | const externalStylesheetsByModuleUrl = new Map();
|
---|
223 | const outputContext = createOutputContext();
|
---|
224 | const componentStylesheet = this._styleCompiler.compileComponent(outputContext, compMeta);
|
---|
225 | compMeta.template.externalStylesheets.forEach((stylesheetMeta) => {
|
---|
226 | const compiledStylesheet = this._styleCompiler.compileStyles(createOutputContext(), compMeta, stylesheetMeta);
|
---|
227 | externalStylesheetsByModuleUrl.set(stylesheetMeta.moduleUrl, compiledStylesheet);
|
---|
228 | });
|
---|
229 | this._resolveStylesCompileResult(componentStylesheet, externalStylesheetsByModuleUrl);
|
---|
230 | const pipes = template.ngModule.transitiveModule.pipes.map(pipe => this._metadataResolver.getPipeSummary(pipe.reference));
|
---|
231 | const { template: parsedTemplate, pipes: usedPipes } = this._parseTemplate(compMeta, template.ngModule, template.directives);
|
---|
232 | const compileResult = this._viewCompiler.compileComponent(outputContext, compMeta, parsedTemplate, ir.variable(componentStylesheet.stylesVar), usedPipes);
|
---|
233 | const evalResult = this._interpretOrJit(templateJitUrl(template.ngModule.type, template.compMeta), outputContext.statements);
|
---|
234 | const viewClass = evalResult[compileResult.viewClassVar];
|
---|
235 | const rendererType = evalResult[compileResult.rendererTypeVar];
|
---|
236 | template.compiled(viewClass, rendererType);
|
---|
237 | }
|
---|
238 | _parseTemplate(compMeta, ngModule, directiveIdentifiers) {
|
---|
239 | // Note: ! is ok here as components always have a template.
|
---|
240 | const preserveWhitespaces = compMeta.template.preserveWhitespaces;
|
---|
241 | const directives = directiveIdentifiers.map(dir => this._metadataResolver.getDirectiveSummary(dir.reference));
|
---|
242 | const pipes = ngModule.transitiveModule.pipes.map(pipe => this._metadataResolver.getPipeSummary(pipe.reference));
|
---|
243 | return this._templateParser.parse(compMeta, compMeta.template.htmlAst, directives, pipes, ngModule.schemas, templateSourceUrl(ngModule.type, compMeta, compMeta.template), preserveWhitespaces);
|
---|
244 | }
|
---|
245 | _resolveStylesCompileResult(result, externalStylesheetsByModuleUrl) {
|
---|
246 | result.dependencies.forEach((dep, i) => {
|
---|
247 | const nestedCompileResult = externalStylesheetsByModuleUrl.get(dep.moduleUrl);
|
---|
248 | const nestedStylesArr = this._resolveAndEvalStylesCompileResult(nestedCompileResult, externalStylesheetsByModuleUrl);
|
---|
249 | dep.setValue(nestedStylesArr);
|
---|
250 | });
|
---|
251 | }
|
---|
252 | _resolveAndEvalStylesCompileResult(result, externalStylesheetsByModuleUrl) {
|
---|
253 | this._resolveStylesCompileResult(result, externalStylesheetsByModuleUrl);
|
---|
254 | return this._interpretOrJit(sharedStylesheetJitUrl(result.meta, this._sharedStylesheetCount++), result.outputCtx.statements)[result.stylesVar];
|
---|
255 | }
|
---|
256 | _interpretOrJit(sourceUrl, statements) {
|
---|
257 | if (!this._compilerConfig.useJit) {
|
---|
258 | return interpretStatements(statements, this._reflector);
|
---|
259 | }
|
---|
260 | else {
|
---|
261 | return this._jitEvaluator.evaluateStatements(sourceUrl, statements, this._reflector, this._compilerConfig.jitDevMode);
|
---|
262 | }
|
---|
263 | }
|
---|
264 | }
|
---|
265 | class CompiledTemplate {
|
---|
266 | constructor(isHost, compType, compMeta, ngModule, directives) {
|
---|
267 | this.isHost = isHost;
|
---|
268 | this.compType = compType;
|
---|
269 | this.compMeta = compMeta;
|
---|
270 | this.ngModule = ngModule;
|
---|
271 | this.directives = directives;
|
---|
272 | this._viewClass = null;
|
---|
273 | this.isCompiled = false;
|
---|
274 | }
|
---|
275 | compiled(viewClass, rendererType) {
|
---|
276 | this._viewClass = viewClass;
|
---|
277 | this.compMeta.componentViewType.setDelegate(viewClass);
|
---|
278 | for (let prop in rendererType) {
|
---|
279 | this.compMeta.rendererType[prop] = rendererType[prop];
|
---|
280 | }
|
---|
281 | this.isCompiled = true;
|
---|
282 | }
|
---|
283 | }
|
---|
284 | function assertComponent(meta) {
|
---|
285 | if (!meta.isComponent) {
|
---|
286 | throw new Error(`Could not compile '${identifierName(meta.type)}' because it is not a component.`);
|
---|
287 | }
|
---|
288 | }
|
---|
289 | function createOutputContext() {
|
---|
290 | const importExpr = (symbol) => ir.importExpr({ name: identifierName(symbol), moduleName: null, runtime: symbol });
|
---|
291 | return { statements: [], genFilePath: '', importExpr, constantPool: new ConstantPool() };
|
---|
292 | }
|
---|
293 | //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiY29tcGlsZXIuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi8uLi8uLi8uLi8uLi9wYWNrYWdlcy9jb21waWxlci9zcmMvaml0L2NvbXBpbGVyLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBOzs7Ozs7R0FNRztBQUVILE9BQU8sRUFBcUgsY0FBYyxFQUFjLHNCQUFzQixFQUFFLGNBQWMsRUFBRSxpQkFBaUIsRUFBQyxNQUFNLHFCQUFxQixDQUFDO0FBRzlPLE9BQU8sRUFBQyxZQUFZLEVBQWdCLE1BQU0sa0JBQWtCLENBQUM7QUFJN0QsT0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