source: trip-planner-front/node_modules/@angular/compiler/esm2015/src/aot/compiler.js@ 6c1585f

Last change on this file since 6c1585f was 6a3a178, checked in by Ema <ema_spirova@…>, 3 years ago

initial commit

  • Property mode set to 100644
File size: 129.6 KB
Line 
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 */
8import { componentFactoryName, flatten, templateSourceUrl } from '../compile_metadata';
9import { ConstantPool } from '../constant_pool';
10import { ViewEncapsulation } from '../core';
11import { MessageBundle } from '../i18n/message_bundle';
12import { createTokenForExternalReference, Identifiers } from '../identifiers';
13import { HtmlParser } from '../ml_parser/html_parser';
14import { InterpolationConfig } from '../ml_parser/interpolation_config';
15import * as o from '../output/output_ast';
16import { identifierName, syntaxError } from '../parse_util';
17import { newArray, visitValue } from '../util';
18import { GeneratedFile } from './generated_file';
19import { listLazyRoutes, parseLazyRoute } from './lazy_routes';
20import { StaticSymbol } from './static_symbol';
21import { createForJitStub, serializeSummaries } from './summary_serializer';
22import { ngfactoryFilePath, normalizeGenFileSuffix, splitTypescriptSuffix, summaryFileName, summaryForJitFileName } from './util';
23export class AotCompiler {
24 constructor(_config, _options, _host, reflector, _metadataResolver, _templateParser, _styleCompiler, _viewCompiler, _typeCheckCompiler, _ngModuleCompiler, _injectableCompiler, _outputEmitter, _summaryResolver, _symbolResolver) {
25 this._config = _config;
26 this._options = _options;
27 this._host = _host;
28 this.reflector = reflector;
29 this._metadataResolver = _metadataResolver;
30 this._templateParser = _templateParser;
31 this._styleCompiler = _styleCompiler;
32 this._viewCompiler = _viewCompiler;
33 this._typeCheckCompiler = _typeCheckCompiler;
34 this._ngModuleCompiler = _ngModuleCompiler;
35 this._injectableCompiler = _injectableCompiler;
36 this._outputEmitter = _outputEmitter;
37 this._summaryResolver = _summaryResolver;
38 this._symbolResolver = _symbolResolver;
39 this._templateAstCache = new Map();
40 this._analyzedFiles = new Map();
41 this._analyzedFilesForInjectables = new Map();
42 }
43 clearCache() {
44 this._metadataResolver.clearCache();
45 }
46 analyzeModulesSync(rootFiles) {
47 const analyzeResult = analyzeAndValidateNgModules(rootFiles, this._host, this._symbolResolver, this._metadataResolver);
48 analyzeResult.ngModules.forEach(ngModule => this._metadataResolver.loadNgModuleDirectiveAndPipeMetadata(ngModule.type.reference, true));
49 return analyzeResult;
50 }
51 analyzeModulesAsync(rootFiles) {
52 const analyzeResult = analyzeAndValidateNgModules(rootFiles, this._host, this._symbolResolver, this._metadataResolver);
53 return Promise
54 .all(analyzeResult.ngModules.map(ngModule => this._metadataResolver.loadNgModuleDirectiveAndPipeMetadata(ngModule.type.reference, false)))
55 .then(() => analyzeResult);
56 }
57 _analyzeFile(fileName) {
58 let analyzedFile = this._analyzedFiles.get(fileName);
59 if (!analyzedFile) {
60 analyzedFile =
61 analyzeFile(this._host, this._symbolResolver, this._metadataResolver, fileName);
62 this._analyzedFiles.set(fileName, analyzedFile);
63 }
64 return analyzedFile;
65 }
66 _analyzeFileForInjectables(fileName) {
67 let analyzedFile = this._analyzedFilesForInjectables.get(fileName);
68 if (!analyzedFile) {
69 analyzedFile = analyzeFileForInjectables(this._host, this._symbolResolver, this._metadataResolver, fileName);
70 this._analyzedFilesForInjectables.set(fileName, analyzedFile);
71 }
72 return analyzedFile;
73 }
74 findGeneratedFileNames(fileName) {
75 const genFileNames = [];
76 const file = this._analyzeFile(fileName);
77 // Make sure we create a .ngfactory if we have a injectable/directive/pipe/NgModule
78 // or a reference to a non source file.
79 // Note: This is overestimating the required .ngfactory files as the real calculation is harder.
80 // Only do this for StubEmitFlags.Basic, as adding a type check block
81 // does not change this file (as we generate type check blocks based on NgModules).
82 if (this._options.allowEmptyCodegenFiles || file.directives.length || file.pipes.length ||
83 file.injectables.length || file.ngModules.length || file.exportsNonSourceFiles) {
84 genFileNames.push(ngfactoryFilePath(file.fileName, true));
85 if (this._options.enableSummariesForJit) {
86 genFileNames.push(summaryForJitFileName(file.fileName, true));
87 }
88 }
89 const fileSuffix = normalizeGenFileSuffix(splitTypescriptSuffix(file.fileName, true)[1]);
90 file.directives.forEach((dirSymbol) => {
91 const compMeta = this._metadataResolver.getNonNormalizedDirectiveMetadata(dirSymbol).metadata;
92 if (!compMeta.isComponent) {
93 return;
94 }
95 // Note: compMeta is a component and therefore template is non null.
96 compMeta.template.styleUrls.forEach((styleUrl) => {
97 const normalizedUrl = this._host.resourceNameToFileName(styleUrl, file.fileName);
98 if (!normalizedUrl) {
99 throw syntaxError(`Couldn't resolve resource ${styleUrl} relative to ${file.fileName}`);
100 }
101 const needsShim = (compMeta.template.encapsulation ||
102 this._config.defaultEncapsulation) === ViewEncapsulation.Emulated;
103 genFileNames.push(_stylesModuleUrl(normalizedUrl, needsShim, fileSuffix));
104 if (this._options.allowEmptyCodegenFiles) {
105 genFileNames.push(_stylesModuleUrl(normalizedUrl, !needsShim, fileSuffix));
106 }
107 });
108 });
109 return genFileNames;
110 }
111 emitBasicStub(genFileName, originalFileName) {
112 const outputCtx = this._createOutputContext(genFileName);
113 if (genFileName.endsWith('.ngfactory.ts')) {
114 if (!originalFileName) {
115 throw new Error(`Assertion error: require the original file for .ngfactory.ts stubs. File: ${genFileName}`);
116 }
117 const originalFile = this._analyzeFile(originalFileName);
118 this._createNgFactoryStub(outputCtx, originalFile, 1 /* Basic */);
119 }
120 else if (genFileName.endsWith('.ngsummary.ts')) {
121 if (this._options.enableSummariesForJit) {
122 if (!originalFileName) {
123 throw new Error(`Assertion error: require the original file for .ngsummary.ts stubs. File: ${genFileName}`);
124 }
125 const originalFile = this._analyzeFile(originalFileName);
126 _createEmptyStub(outputCtx);
127 originalFile.ngModules.forEach(ngModule => {
128 // create exports that user code can reference
129 createForJitStub(outputCtx, ngModule.type.reference);
130 });
131 }
132 }
133 else if (genFileName.endsWith('.ngstyle.ts')) {
134 _createEmptyStub(outputCtx);
135 }
136 // Note: for the stubs, we don't need a property srcFileUrl,
137 // as later on in emitAllImpls we will create the proper GeneratedFiles with the
138 // correct srcFileUrl.
139 // This is good as e.g. for .ngstyle.ts files we can't derive
140 // the url of components based on the genFileUrl.
141 return this._codegenSourceModule('unknown', outputCtx);
142 }
143 emitTypeCheckStub(genFileName, originalFileName) {
144 const originalFile = this._analyzeFile(originalFileName);
145 const outputCtx = this._createOutputContext(genFileName);
146 if (genFileName.endsWith('.ngfactory.ts')) {
147 this._createNgFactoryStub(outputCtx, originalFile, 2 /* TypeCheck */);
148 }
149 return outputCtx.statements.length > 0 ?
150 this._codegenSourceModule(originalFile.fileName, outputCtx) :
151 null;
152 }
153 loadFilesAsync(fileNames, tsFiles) {
154 const files = fileNames.map(fileName => this._analyzeFile(fileName));
155 const loadingPromises = [];
156 files.forEach(file => file.ngModules.forEach(ngModule => loadingPromises.push(this._metadataResolver.loadNgModuleDirectiveAndPipeMetadata(ngModule.type.reference, false))));
157 const analyzedInjectables = tsFiles.map(tsFile => this._analyzeFileForInjectables(tsFile));
158 return Promise.all(loadingPromises).then(_ => ({
159 analyzedModules: mergeAndValidateNgFiles(files),
160 analyzedInjectables: analyzedInjectables,
161 }));
162 }
163 loadFilesSync(fileNames, tsFiles) {
164 const files = fileNames.map(fileName => this._analyzeFile(fileName));
165 files.forEach(file => file.ngModules.forEach(ngModule => this._metadataResolver.loadNgModuleDirectiveAndPipeMetadata(ngModule.type.reference, true)));
166 const analyzedInjectables = tsFiles.map(tsFile => this._analyzeFileForInjectables(tsFile));
167 return {
168 analyzedModules: mergeAndValidateNgFiles(files),
169 analyzedInjectables: analyzedInjectables,
170 };
171 }
172 _createNgFactoryStub(outputCtx, file, emitFlags) {
173 let componentId = 0;
174 file.ngModules.forEach((ngModuleMeta, ngModuleIndex) => {
175 // Note: the code below needs to executed for StubEmitFlags.Basic and StubEmitFlags.TypeCheck,
176 // so we don't change the .ngfactory file too much when adding the type-check block.
177 // create exports that user code can reference
178 this._ngModuleCompiler.createStub(outputCtx, ngModuleMeta.type.reference);
179 // add references to the symbols from the metadata.
180 // These can be used by the type check block for components,
181 // and they also cause TypeScript to include these files into the program too,
182 // which will make them part of the analyzedFiles.
183 const externalReferences = [
184 // Add references that are available from all the modules and imports.
185 ...ngModuleMeta.transitiveModule.directives.map(d => d.reference),
186 ...ngModuleMeta.transitiveModule.pipes.map(d => d.reference),
187 ...ngModuleMeta.importedModules.map(m => m.type.reference),
188 ...ngModuleMeta.exportedModules.map(m => m.type.reference),
189 // Add references that might be inserted by the template compiler.
190 ...this._externalIdentifierReferences([Identifiers.TemplateRef, Identifiers.ElementRef]),
191 ];
192 const externalReferenceVars = new Map();
193 externalReferences.forEach((ref, typeIndex) => {
194 externalReferenceVars.set(ref, `_decl${ngModuleIndex}_${typeIndex}`);
195 });
196 externalReferenceVars.forEach((varName, reference) => {
197 outputCtx.statements.push(o.variable(varName)
198 .set(o.NULL_EXPR.cast(o.DYNAMIC_TYPE))
199 .toDeclStmt(o.expressionType(outputCtx.importExpr(reference, /* typeParams */ null, /* useSummaries */ false))));
200 });
201 if (emitFlags & 2 /* TypeCheck */) {
202 // add the type-check block for all components of the NgModule
203 ngModuleMeta.declaredDirectives.forEach((dirId) => {
204 const compMeta = this._metadataResolver.getDirectiveMetadata(dirId.reference);
205 if (!compMeta.isComponent) {
206 return;
207 }
208 componentId++;
209 this._createTypeCheckBlock(outputCtx, `${compMeta.type.reference.name}_Host_${componentId}`, ngModuleMeta, this._metadataResolver.getHostComponentMetadata(compMeta), [compMeta.type], externalReferenceVars);
210 this._createTypeCheckBlock(outputCtx, `${compMeta.type.reference.name}_${componentId}`, ngModuleMeta, compMeta, ngModuleMeta.transitiveModule.directives, externalReferenceVars);
211 });
212 }
213 });
214 if (outputCtx.statements.length === 0) {
215 _createEmptyStub(outputCtx);
216 }
217 }
218 _externalIdentifierReferences(references) {
219 const result = [];
220 for (let reference of references) {
221 const token = createTokenForExternalReference(this.reflector, reference);
222 if (token.identifier) {
223 result.push(token.identifier.reference);
224 }
225 }
226 return result;
227 }
228 _createTypeCheckBlock(ctx, componentId, moduleMeta, compMeta, directives, externalReferenceVars) {
229 const { template: parsedTemplate, pipes: usedPipes } = this._parseTemplate(compMeta, moduleMeta, directives);
230 ctx.statements.push(...this._typeCheckCompiler.compileComponent(componentId, compMeta, parsedTemplate, usedPipes, externalReferenceVars, ctx));
231 }
232 emitMessageBundle(analyzeResult, locale) {
233 const errors = [];
234 const htmlParser = new HtmlParser();
235 // TODO(vicb): implicit tags & attributes
236 const messageBundle = new MessageBundle(htmlParser, [], {}, locale);
237 analyzeResult.files.forEach(file => {
238 const compMetas = [];
239 file.directives.forEach(directiveType => {
240 const dirMeta = this._metadataResolver.getDirectiveMetadata(directiveType);
241 if (dirMeta && dirMeta.isComponent) {
242 compMetas.push(dirMeta);
243 }
244 });
245 compMetas.forEach(compMeta => {
246 const html = compMeta.template.template;
247 // Template URL points to either an HTML or TS file depending on whether
248 // the file is used with `templateUrl:` or `template:`, respectively.
249 const templateUrl = compMeta.template.templateUrl;
250 const interpolationConfig = InterpolationConfig.fromArray(compMeta.template.interpolation);
251 errors.push(...messageBundle.updateFromTemplate(html, templateUrl, interpolationConfig));
252 });
253 });
254 if (errors.length) {
255 throw new Error(errors.map(e => e.toString()).join('\n'));
256 }
257 return messageBundle;
258 }
259 emitAllPartialModules2(files) {
260 // Using reduce like this is a select many pattern (where map is a select pattern)
261 return files.reduce((r, file) => {
262 r.push(...this._emitPartialModule2(file.fileName, file.injectables));
263 return r;
264 }, []);
265 }
266 _emitPartialModule2(fileName, injectables) {
267 const context = this._createOutputContext(fileName);
268 injectables.forEach(injectable => this._injectableCompiler.compile(injectable, context));
269 if (context.statements && context.statements.length > 0) {
270 return [{ fileName, statements: [...context.constantPool.statements, ...context.statements] }];
271 }
272 return [];
273 }
274 emitAllImpls(analyzeResult) {
275 const { ngModuleByPipeOrDirective, files } = analyzeResult;
276 const sourceModules = files.map(file => this._compileImplFile(file.fileName, ngModuleByPipeOrDirective, file.directives, file.pipes, file.ngModules, file.injectables));
277 return flatten(sourceModules);
278 }
279 _compileImplFile(srcFileUrl, ngModuleByPipeOrDirective, directives, pipes, ngModules, injectables) {
280 const fileSuffix = normalizeGenFileSuffix(splitTypescriptSuffix(srcFileUrl, true)[1]);
281 const generatedFiles = [];
282 const outputCtx = this._createOutputContext(ngfactoryFilePath(srcFileUrl, true));
283 generatedFiles.push(...this._createSummary(srcFileUrl, directives, pipes, ngModules, injectables, outputCtx));
284 // compile all ng modules
285 ngModules.forEach((ngModuleMeta) => this._compileModule(outputCtx, ngModuleMeta));
286 // compile components
287 directives.forEach((dirType) => {
288 const compMeta = this._metadataResolver.getDirectiveMetadata(dirType);
289 if (!compMeta.isComponent) {
290 return;
291 }
292 const ngModule = ngModuleByPipeOrDirective.get(dirType);
293 if (!ngModule) {
294 throw new Error(`Internal Error: cannot determine the module for component ${identifierName(compMeta.type)}!`);
295 }
296 // compile styles
297 const componentStylesheet = this._styleCompiler.compileComponent(outputCtx, compMeta);
298 // Note: compMeta is a component and therefore template is non null.
299 compMeta.template.externalStylesheets.forEach((stylesheetMeta) => {
300 // Note: fill non shim and shim style files as they might
301 // be shared by component with and without ViewEncapsulation.
302 const shim = this._styleCompiler.needsStyleShim(compMeta);
303 generatedFiles.push(this._codegenStyles(srcFileUrl, compMeta, stylesheetMeta, shim, fileSuffix));
304 if (this._options.allowEmptyCodegenFiles) {
305 generatedFiles.push(this._codegenStyles(srcFileUrl, compMeta, stylesheetMeta, !shim, fileSuffix));
306 }
307 });
308 // compile components
309 const compViewVars = this._compileComponent(outputCtx, compMeta, ngModule, ngModule.transitiveModule.directives, componentStylesheet, fileSuffix);
310 this._compileComponentFactory(outputCtx, compMeta, ngModule, fileSuffix);
311 });
312 if (outputCtx.statements.length > 0 || this._options.allowEmptyCodegenFiles) {
313 const srcModule = this._codegenSourceModule(srcFileUrl, outputCtx);
314 generatedFiles.unshift(srcModule);
315 }
316 return generatedFiles;
317 }
318 _createSummary(srcFileName, directives, pipes, ngModules, injectables, ngFactoryCtx) {
319 const symbolSummaries = this._symbolResolver.getSymbolsOf(srcFileName)
320 .map(symbol => this._symbolResolver.resolveSymbol(symbol));
321 const typeData = [
322 ...ngModules.map(meta => ({
323 summary: this._metadataResolver.getNgModuleSummary(meta.type.reference),
324 metadata: this._metadataResolver.getNgModuleMetadata(meta.type.reference)
325 })),
326 ...directives.map(ref => ({
327 summary: this._metadataResolver.getDirectiveSummary(ref),
328 metadata: this._metadataResolver.getDirectiveMetadata(ref)
329 })),
330 ...pipes.map(ref => ({
331 summary: this._metadataResolver.getPipeSummary(ref),
332 metadata: this._metadataResolver.getPipeMetadata(ref)
333 })),
334 ...injectables.map(ref => ({
335 summary: this._metadataResolver.getInjectableSummary(ref.symbol),
336 metadata: this._metadataResolver.getInjectableSummary(ref.symbol).type
337 }))
338 ];
339 const forJitOutputCtx = this._options.enableSummariesForJit ?
340 this._createOutputContext(summaryForJitFileName(srcFileName, true)) :
341 null;
342 const { json, exportAs } = serializeSummaries(srcFileName, forJitOutputCtx, this._summaryResolver, this._symbolResolver, symbolSummaries, typeData, this._options.createExternalSymbolFactoryReexports);
343 exportAs.forEach((entry) => {
344 ngFactoryCtx.statements.push(o.variable(entry.exportAs).set(ngFactoryCtx.importExpr(entry.symbol)).toDeclStmt(null, [
345 o.StmtModifier.Exported
346 ]));
347 });
348 const summaryJson = new GeneratedFile(srcFileName, summaryFileName(srcFileName), json);
349 const result = [summaryJson];
350 if (forJitOutputCtx) {
351 result.push(this._codegenSourceModule(srcFileName, forJitOutputCtx));
352 }
353 return result;
354 }
355 _compileModule(outputCtx, ngModule) {
356 const providers = [];
357 if (this._options.locale) {
358 const normalizedLocale = this._options.locale.replace(/_/g, '-');
359 providers.push({
360 token: createTokenForExternalReference(this.reflector, Identifiers.LOCALE_ID),
361 useValue: normalizedLocale,
362 });
363 }
364 if (this._options.i18nFormat) {
365 providers.push({
366 token: createTokenForExternalReference(this.reflector, Identifiers.TRANSLATIONS_FORMAT),
367 useValue: this._options.i18nFormat
368 });
369 }
370 this._ngModuleCompiler.compile(outputCtx, ngModule, providers);
371 }
372 _compileComponentFactory(outputCtx, compMeta, ngModule, fileSuffix) {
373 const hostMeta = this._metadataResolver.getHostComponentMetadata(compMeta);
374 const hostViewFactoryVar = this._compileComponent(outputCtx, hostMeta, ngModule, [compMeta.type], null, fileSuffix)
375 .viewClassVar;
376 const compFactoryVar = componentFactoryName(compMeta.type.reference);
377 const inputsExprs = [];
378 for (let propName in compMeta.inputs) {
379 const templateName = compMeta.inputs[propName];
380 // Don't quote so that the key gets minified...
381 inputsExprs.push(new o.LiteralMapEntry(propName, o.literal(templateName), false));
382 }
383 const outputsExprs = [];
384 for (let propName in compMeta.outputs) {
385 const templateName = compMeta.outputs[propName];
386 // Don't quote so that the key gets minified...
387 outputsExprs.push(new o.LiteralMapEntry(propName, o.literal(templateName), false));
388 }
389 outputCtx.statements.push(o.variable(compFactoryVar)
390 .set(o.importExpr(Identifiers.createComponentFactory).callFn([
391 o.literal(compMeta.selector), outputCtx.importExpr(compMeta.type.reference),
392 o.variable(hostViewFactoryVar), new o.LiteralMapExpr(inputsExprs),
393 new o.LiteralMapExpr(outputsExprs),
394 o.literalArr(compMeta.template.ngContentSelectors.map(selector => o.literal(selector)))
395 ]))
396 .toDeclStmt(o.importType(Identifiers.ComponentFactory, [o.expressionType(outputCtx.importExpr(compMeta.type.reference))], [o.TypeModifier.Const]), [o.StmtModifier.Final, o.StmtModifier.Exported]));
397 }
398 _compileComponent(outputCtx, compMeta, ngModule, directiveIdentifiers, componentStyles, fileSuffix) {
399 const { template: parsedTemplate, pipes: usedPipes } = this._parseTemplate(compMeta, ngModule, directiveIdentifiers);
400 const stylesExpr = componentStyles ? o.variable(componentStyles.stylesVar) : o.literalArr([]);
401 const viewResult = this._viewCompiler.compileComponent(outputCtx, compMeta, parsedTemplate, stylesExpr, usedPipes);
402 if (componentStyles) {
403 _resolveStyleStatements(this._symbolResolver, componentStyles, this._styleCompiler.needsStyleShim(compMeta), fileSuffix);
404 }
405 return viewResult;
406 }
407 _parseTemplate(compMeta, ngModule, directiveIdentifiers) {
408 if (this._templateAstCache.has(compMeta.type.reference)) {
409 return this._templateAstCache.get(compMeta.type.reference);
410 }
411 const preserveWhitespaces = compMeta.template.preserveWhitespaces;
412 const directives = directiveIdentifiers.map(dir => this._metadataResolver.getDirectiveSummary(dir.reference));
413 const pipes = ngModule.transitiveModule.pipes.map(pipe => this._metadataResolver.getPipeSummary(pipe.reference));
414 const result = this._templateParser.parse(compMeta, compMeta.template.htmlAst, directives, pipes, ngModule.schemas, templateSourceUrl(ngModule.type, compMeta, compMeta.template), preserveWhitespaces);
415 this._templateAstCache.set(compMeta.type.reference, result);
416 return result;
417 }
418 _createOutputContext(genFilePath) {
419 const importExpr = (symbol, typeParams = null, useSummaries = true) => {
420 if (!(symbol instanceof StaticSymbol)) {
421 throw new Error(`Internal error: unknown identifier ${JSON.stringify(symbol)}`);
422 }
423 const arity = this._symbolResolver.getTypeArity(symbol) || 0;
424 const { filePath, name, members } = this._symbolResolver.getImportAs(symbol, useSummaries) || symbol;
425 const importModule = this._fileNameToModuleName(filePath, genFilePath);
426 // It should be good enough to compare filePath to genFilePath and if they are equal
427 // there is a self reference. However, ngfactory files generate to .ts but their
428 // symbols have .d.ts so a simple compare is insufficient. They should be canonical
429 // and is tracked by #17705.
430 const selfReference = this._fileNameToModuleName(genFilePath, genFilePath);
431 const moduleName = importModule === selfReference ? null : importModule;
432 // If we are in a type expression that refers to a generic type then supply
433 // the required type parameters. If there were not enough type parameters
434 // supplied, supply any as the type. Outside a type expression the reference
435 // should not supply type parameters and be treated as a simple value reference
436 // to the constructor function itself.
437 const suppliedTypeParams = typeParams || [];
438 const missingTypeParamsCount = arity - suppliedTypeParams.length;
439 const allTypeParams = suppliedTypeParams.concat(newArray(missingTypeParamsCount, o.DYNAMIC_TYPE));
440 return members.reduce((expr, memberName) => expr.prop(memberName), o.importExpr(new o.ExternalReference(moduleName, name, null), allTypeParams));
441 };
442 return { statements: [], genFilePath, importExpr, constantPool: new ConstantPool() };
443 }
444 _fileNameToModuleName(importedFilePath, containingFilePath) {
445 return this._summaryResolver.getKnownModuleName(importedFilePath) ||
446 this._symbolResolver.getKnownModuleName(importedFilePath) ||
447 this._host.fileNameToModuleName(importedFilePath, containingFilePath);
448 }
449 _codegenStyles(srcFileUrl, compMeta, stylesheetMetadata, isShimmed, fileSuffix) {
450 const outputCtx = this._createOutputContext(_stylesModuleUrl(stylesheetMetadata.moduleUrl, isShimmed, fileSuffix));
451 const compiledStylesheet = this._styleCompiler.compileStyles(outputCtx, compMeta, stylesheetMetadata, isShimmed);
452 _resolveStyleStatements(this._symbolResolver, compiledStylesheet, isShimmed, fileSuffix);
453 return this._codegenSourceModule(srcFileUrl, outputCtx);
454 }
455 _codegenSourceModule(srcFileUrl, ctx) {
456 return new GeneratedFile(srcFileUrl, ctx.genFilePath, ctx.statements);
457 }
458 listLazyRoutes(entryRoute, analyzedModules) {
459 const self = this;
460 if (entryRoute) {
461 const symbol = parseLazyRoute(entryRoute, this.reflector).referencedModule;
462 return visitLazyRoute(symbol);
463 }
464 else if (analyzedModules) {
465 const allLazyRoutes = [];
466 for (const ngModule of analyzedModules.ngModules) {
467 const lazyRoutes = listLazyRoutes(ngModule, this.reflector);
468 for (const lazyRoute of lazyRoutes) {
469 allLazyRoutes.push(lazyRoute);
470 }
471 }
472 return allLazyRoutes;
473 }
474 else {
475 throw new Error(`Either route or analyzedModules has to be specified!`);
476 }
477 function visitLazyRoute(symbol, seenRoutes = new Set(), allLazyRoutes = []) {
478 // Support pointing to default exports, but stop recursing there,
479 // as the StaticReflector does not yet support default exports.
480 if (seenRoutes.has(symbol) || !symbol.name) {
481 return allLazyRoutes;
482 }
483 seenRoutes.add(symbol);
484 const lazyRoutes = listLazyRoutes(self._metadataResolver.getNgModuleMetadata(symbol, true), self.reflector);
485 for (const lazyRoute of lazyRoutes) {
486 allLazyRoutes.push(lazyRoute);
487 visitLazyRoute(lazyRoute.referencedModule, seenRoutes, allLazyRoutes);
488 }
489 return allLazyRoutes;
490 }
491 }
492}
493function _createEmptyStub(outputCtx) {
494 // Note: We need to produce at least one import statement so that
495 // TypeScript knows that the file is an es6 module. Otherwise our generated
496 // exports / imports won't be emitted properly by TypeScript.
497 outputCtx.statements.push(o.importExpr(Identifiers.ComponentFactory).toStmt());
498}
499function _resolveStyleStatements(symbolResolver, compileResult, needsShim, fileSuffix) {
500 compileResult.dependencies.forEach((dep) => {
501 dep.setValue(symbolResolver.getStaticSymbol(_stylesModuleUrl(dep.moduleUrl, needsShim, fileSuffix), dep.name));
502 });
503}
504function _stylesModuleUrl(stylesheetUrl, shim, suffix) {
505 return `${stylesheetUrl}${shim ? '.shim' : ''}.ngstyle${suffix}`;
506}
507export function analyzeNgModules(fileNames, host, staticSymbolResolver, metadataResolver) {
508 const files = _analyzeFilesIncludingNonProgramFiles(fileNames, host, staticSymbolResolver, metadataResolver);
509 return mergeAnalyzedFiles(files);
510}
511export function analyzeAndValidateNgModules(fileNames, host, staticSymbolResolver, metadataResolver) {
512 return validateAnalyzedModules(analyzeNgModules(fileNames, host, staticSymbolResolver, metadataResolver));
513}
514function validateAnalyzedModules(analyzedModules) {
515 if (analyzedModules.symbolsMissingModule && analyzedModules.symbolsMissingModule.length) {
516 const messages = analyzedModules.symbolsMissingModule.map(s => `Cannot determine the module for class ${s.name} in ${s.filePath}! Add ${s.name} to the NgModule to fix it.`);
517 throw syntaxError(messages.join('\n'));
518 }
519 return analyzedModules;
520}
521// Analyzes all of the program files,
522// including files that are not part of the program
523// but are referenced by an NgModule.
524function _analyzeFilesIncludingNonProgramFiles(fileNames, host, staticSymbolResolver, metadataResolver) {
525 const seenFiles = new Set();
526 const files = [];
527 const visitFile = (fileName) => {
528 if (seenFiles.has(fileName) || !host.isSourceFile(fileName)) {
529 return false;
530 }
531 seenFiles.add(fileName);
532 const analyzedFile = analyzeFile(host, staticSymbolResolver, metadataResolver, fileName);
533 files.push(analyzedFile);
534 analyzedFile.ngModules.forEach(ngModule => {
535 ngModule.transitiveModule.modules.forEach(modMeta => visitFile(modMeta.reference.filePath));
536 });
537 };
538 fileNames.forEach((fileName) => visitFile(fileName));
539 return files;
540}
541export function analyzeFile(host, staticSymbolResolver, metadataResolver, fileName) {
542 const abstractDirectives = [];
543 const directives = [];
544 const pipes = [];
545 const injectables = [];
546 const ngModules = [];
547 const hasDecorators = staticSymbolResolver.hasDecorators(fileName);
548 let exportsNonSourceFiles = false;
549 const isDeclarationFile = fileName.endsWith('.d.ts');
550 // Don't analyze .d.ts files that have no decorators as a shortcut
551 // to speed up the analysis. This prevents us from
552 // resolving the references in these files.
553 // Note: exportsNonSourceFiles is only needed when compiling with summaries,
554 // which is not the case when .d.ts files are treated as input files.
555 if (!isDeclarationFile || hasDecorators) {
556 staticSymbolResolver.getSymbolsOf(fileName).forEach((symbol) => {
557 const resolvedSymbol = staticSymbolResolver.resolveSymbol(symbol);
558 const symbolMeta = resolvedSymbol.metadata;
559 if (!symbolMeta || symbolMeta.__symbolic === 'error') {
560 return;
561 }
562 let isNgSymbol = false;
563 if (symbolMeta.__symbolic === 'class') {
564 if (metadataResolver.isDirective(symbol)) {
565 isNgSymbol = true;
566 // This directive either has a selector or doesn't. Selector-less directives get tracked
567 // in abstractDirectives, not directives. The compiler doesn't deal with selector-less
568 // directives at all, really, other than to persist their metadata. This is done so that
569 // apps will have an easier time migrating to Ivy, which requires the selector-less
570 // annotations to be applied.
571 if (!metadataResolver.isAbstractDirective(symbol)) {
572 // The directive is an ordinary directive.
573 directives.push(symbol);
574 }
575 else {
576 // The directive has no selector and is an "abstract" directive, so track it
577 // accordingly.
578 abstractDirectives.push(symbol);
579 }
580 }
581 else if (metadataResolver.isPipe(symbol)) {
582 isNgSymbol = true;
583 pipes.push(symbol);
584 }
585 else if (metadataResolver.isNgModule(symbol)) {
586 const ngModule = metadataResolver.getNgModuleMetadata(symbol, false);
587 if (ngModule) {
588 isNgSymbol = true;
589 ngModules.push(ngModule);
590 }
591 }
592 else if (metadataResolver.isInjectable(symbol)) {
593 isNgSymbol = true;
594 const injectable = metadataResolver.getInjectableMetadata(symbol, null, false);
595 if (injectable) {
596 injectables.push(injectable);
597 }
598 }
599 }
600 if (!isNgSymbol) {
601 exportsNonSourceFiles =
602 exportsNonSourceFiles || isValueExportingNonSourceFile(host, symbolMeta);
603 }
604 });
605 }
606 return {
607 fileName,
608 directives,
609 abstractDirectives,
610 pipes,
611 ngModules,
612 injectables,
613 exportsNonSourceFiles,
614 };
615}
616export function analyzeFileForInjectables(host, staticSymbolResolver, metadataResolver, fileName) {
617 const injectables = [];
618 const shallowModules = [];
619 if (staticSymbolResolver.hasDecorators(fileName)) {
620 staticSymbolResolver.getSymbolsOf(fileName).forEach((symbol) => {
621 const resolvedSymbol = staticSymbolResolver.resolveSymbol(symbol);
622 const symbolMeta = resolvedSymbol.metadata;
623 if (!symbolMeta || symbolMeta.__symbolic === 'error') {
624 return;
625 }
626 if (symbolMeta.__symbolic === 'class') {
627 if (metadataResolver.isInjectable(symbol)) {
628 const injectable = metadataResolver.getInjectableMetadata(symbol, null, false);
629 if (injectable) {
630 injectables.push(injectable);
631 }
632 }
633 else if (metadataResolver.isNgModule(symbol)) {
634 const module = metadataResolver.getShallowModuleMetadata(symbol);
635 if (module) {
636 shallowModules.push(module);
637 }
638 }
639 }
640 });
641 }
642 return { fileName, injectables, shallowModules };
643}
644function isValueExportingNonSourceFile(host, metadata) {
645 let exportsNonSourceFiles = false;
646 class Visitor {
647 visitArray(arr, context) {
648 arr.forEach(v => visitValue(v, this, context));
649 }
650 visitStringMap(map, context) {
651 Object.keys(map).forEach((key) => visitValue(map[key], this, context));
652 }
653 visitPrimitive(value, context) { }
654 visitOther(value, context) {
655 if (value instanceof StaticSymbol && !host.isSourceFile(value.filePath)) {
656 exportsNonSourceFiles = true;
657 }
658 }
659 }
660 visitValue(metadata, new Visitor(), null);
661 return exportsNonSourceFiles;
662}
663export function mergeAnalyzedFiles(analyzedFiles) {
664 const allNgModules = [];
665 const ngModuleByPipeOrDirective = new Map();
666 const allPipesAndDirectives = new Set();
667 analyzedFiles.forEach(af => {
668 af.ngModules.forEach(ngModule => {
669 allNgModules.push(ngModule);
670 ngModule.declaredDirectives.forEach(d => ngModuleByPipeOrDirective.set(d.reference, ngModule));
671 ngModule.declaredPipes.forEach(p => ngModuleByPipeOrDirective.set(p.reference, ngModule));
672 });
673 af.directives.forEach(d => allPipesAndDirectives.add(d));
674 af.pipes.forEach(p => allPipesAndDirectives.add(p));
675 });
676 const symbolsMissingModule = [];
677 allPipesAndDirectives.forEach(ref => {
678 if (!ngModuleByPipeOrDirective.has(ref)) {
679 symbolsMissingModule.push(ref);
680 }
681 });
682 return {
683 ngModules: allNgModules,
684 ngModuleByPipeOrDirective,
685 symbolsMissingModule,
686 files: analyzedFiles
687 };
688}
689function mergeAndValidateNgFiles(files) {
690 return validateAnalyzedModules(mergeAnalyzedFiles(files));
691}
692//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiY29tcGlsZXIuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi8uLi8uLi8uLi8uLi9wYWNrYWdlcy9jb21waWxlci9zcmMvYW90L2NvbXBpbGVyLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBOzs7Ozs7R0FNRztBQUVILE9BQU8sRUFBbVAsb0JBQW9CLEVBQUUsT0FBTyxFQUFFLGlCQUFpQixFQUFDLE1BQU0scUJBQXFCLENBQUM7QUFFdlUsT0FBTyxFQUFDLFlBQVksRUFBZ0IsTUFBTSxrQkFBa0IsQ0FBQztBQUM3RCxPQUFPLEVBQUMsaUJBQWlCLEVBQUMsTUFBTSxTQUFTLENBQUM7QUFDMUMsT0FBTyxFQUFDLGFBQWEsRUFBQyxNQUFNLHdCQUF3QixDQUFDO0FBQ3JELE9BQU8sRUFBQywrQkFBK0IsRUFBRSxXQUFXLEVBQUMsTUFBTSxnQkFBZ0IsQ0FBQztBQUc1RSxPQUFPLEVBQUMsVUFBVSxFQUFDLE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wZS5yZWZlcmVuY2UpISxcbiAgICAgICAgICAgICAgICBtZXRhZGF0YTogdGhpcy5fbWV0YWRhdGFSZXNvbHZlci5nZXROZ01vZHVsZU1ldGFkYXRhKG1ldGEudHlwZS5yZWZlcmVuY2UpIVxuICAgICAgICAgICAgICB9KSksXG4gICAgICAgICAgLi4uZGlyZWN0aXZlcy5tYXAocmVmID0+ICh7XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzdW1tYXJ5OiB0aGlzLl9tZXRhZGF0YVJlc29sdmVyLmdldERpcmVjdGl2ZVN1bW1hcnkocmVmKSEsXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICBtZXRhZGF0YTogdGhpcy5fbWV0YWRhdGFSZXNvbHZlci5nZXREaXJlY3RpdmVNZXRhZGF0YShyZWYpIVxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pKSxcbiAgICAgICAgICAuLi5waXBlcy5tYXAocmVmID0+ICh7XG4gICAgICAgICAgICAgICAgICAgICAgICAgc3VtbWFyeTogdGhpcy5fbWV0YWRhdGFSZXNvbHZlci5nZXRQaXBlU3VtbWFyeShyZWYpISxcbiAgICAgICAgICAgICAgICAgICAgICAgICBtZXRhZGF0YTogdGhpcy5fbWV0YWRhdGFSZXNvbHZlci5nZXRQaXBlTWV0YWRhdGEocmVmKSFcbiAgICAgICAgICAgICAgICAgICAgICAgfSkpLFxuICAgICAgICAgIC4uLmluamVjdGFibGVzLm1hcChcbiAgICAgICAgICAgICAgcmVmID0+ICh7XG4gICAgICAgICAgICAgICAgc3VtbWFyeTogdGhpcy5fbWV0YWRhdGFSZXNvbHZlci5nZXRJbmplY3RhYmxlU3VtbWFyeShyZWYuc3ltYm9sKSEsXG4gICAgICAgICAgICAgICAgbWV0YWRhdGE6IHRoaXMuX21ldGFkYXRhUmVzb2x2ZXIuZ2V0SW5qZWN0YWJsZVN1bW1hcnkocmVmLnN5bWJvbCkhLnR5cGVcbiAgICAgICAgICAgICAgfSkpXG4gICAgICA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