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

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

initial commit

  • Property mode set to 100644
File size: 14.0 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 { deserializeSummaries } from './summary_serializer';
9import { stripGeneratedFileSuffix, summaryFileName } from './util';
10export class AotSummaryResolver {
11 constructor(host, staticSymbolCache) {
12 this.host = host;
13 this.staticSymbolCache = staticSymbolCache;
14 // Note: this will only contain StaticSymbols without members!
15 this.summaryCache = new Map();
16 this.loadedFilePaths = new Map();
17 // Note: this will only contain StaticSymbols without members!
18 this.importAs = new Map();
19 this.knownFileNameToModuleNames = new Map();
20 }
21 isLibraryFile(filePath) {
22 // Note: We need to strip the .ngfactory. file path,
23 // so this method also works for generated files
24 // (for which host.isSourceFile will always return false).
25 return !this.host.isSourceFile(stripGeneratedFileSuffix(filePath));
26 }
27 toSummaryFileName(filePath, referringSrcFileName) {
28 return this.host.toSummaryFileName(filePath, referringSrcFileName);
29 }
30 fromSummaryFileName(fileName, referringLibFileName) {
31 return this.host.fromSummaryFileName(fileName, referringLibFileName);
32 }
33 resolveSummary(staticSymbol) {
34 const rootSymbol = staticSymbol.members.length ?
35 this.staticSymbolCache.get(staticSymbol.filePath, staticSymbol.name) :
36 staticSymbol;
37 let summary = this.summaryCache.get(rootSymbol);
38 if (!summary) {
39 this._loadSummaryFile(staticSymbol.filePath);
40 summary = this.summaryCache.get(staticSymbol);
41 }
42 return (rootSymbol === staticSymbol && summary) || null;
43 }
44 getSymbolsOf(filePath) {
45 if (this._loadSummaryFile(filePath)) {
46 return Array.from(this.summaryCache.keys()).filter((symbol) => symbol.filePath === filePath);
47 }
48 return null;
49 }
50 getImportAs(staticSymbol) {
51 staticSymbol.assertNoMembers();
52 return this.importAs.get(staticSymbol);
53 }
54 /**
55 * Converts a file path to a module name that can be used as an `import`.
56 */
57 getKnownModuleName(importedFilePath) {
58 return this.knownFileNameToModuleNames.get(importedFilePath) || null;
59 }
60 addSummary(summary) {
61 this.summaryCache.set(summary.symbol, summary);
62 }
63 _loadSummaryFile(filePath) {
64 let hasSummary = this.loadedFilePaths.get(filePath);
65 if (hasSummary != null) {
66 return hasSummary;
67 }
68 let json = null;
69 if (this.isLibraryFile(filePath)) {
70 const summaryFilePath = summaryFileName(filePath);
71 try {
72 json = this.host.loadSummary(summaryFilePath);
73 }
74 catch (e) {
75 console.error(`Error loading summary file ${summaryFilePath}`);
76 throw e;
77 }
78 }
79 hasSummary = json != null;
80 this.loadedFilePaths.set(filePath, hasSummary);
81 if (json) {
82 const { moduleName, summaries, importAs } = deserializeSummaries(this.staticSymbolCache, this, filePath, json);
83 summaries.forEach((summary) => this.summaryCache.set(summary.symbol, summary));
84 if (moduleName) {
85 this.knownFileNameToModuleNames.set(filePath, moduleName);
86 }
87 importAs.forEach((importAs) => {
88 this.importAs.set(importAs.symbol, importAs.importAs);
89 });
90 }
91 return hasSummary;
92 }
93}
94//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic3VtbWFyeV9yZXNvbHZlci5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uLy4uLy4uLy4uLy4uLy4uL3BhY2thZ2VzL2NvbXBpbGVyL3NyYy9hb3Qvc3VtbWFyeV9yZXNvbHZlci50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQTs7Ozs7O0dBTUc7QUFLSCxPQUFPLEVBQUMsb0JBQW9CLEVBQUMsTUFBTSxzQkFBc0IsQ0FBQztBQUMxRCxPQUFPLEVBQUMsd0JBQXdCLEVBQUUsZUFBZSxFQUFDLE1BQU0sUUFBUSxDQUFDO0FBNkJqRSxNQUFNLE9BQU8sa0JBQWtCO0lBUTdCLFlBQW9CLElBQTRCLEVBQVUsaUJBQW9DO1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TtcbiAgICBpZiAoanNvbikge1xuICAgICAgY29uc3Qge21vZHVsZU5hbWUsIHN1bW1hcmllcywgaW1wb3J0QXN9ID1cbiAgICAgICAgICBkZXNlcmlhbGl6ZVN1bW1hcmllcyh0aGlzLnN0YXRpY1N5bWJvbENhY2hlLCB0aGlzLCBmaWxlUGF0aCwganNvbik7XG4gICAgICBzdW1tYXJpZXMuZm9yRWFjaCgoc3VtbWFyeSkgPT4gdGhpcy5zdW1tYXJ5Q2FjaGUuc2V0KHN1bW1hcnkuc3ltYm9sLCBzdW1tYXJ5KSk7XG4gICAgICBpZiAobW9kdWxlTmFtZSkge1xuICAgICAgICB0aGlzLmtub3duRmlsZU5hbWVUb01vZHVsZU5hbWVzLnNldChmaWxlUGF0aCwgbW9kdWxlTmFtZSk7XG4gICAgICB9XG4gICAgICBpbXBvcnRBcy5mb3JFYWNoKChpbXBvcnRBcykgPT4ge1xuICAgICAgICB0aGlzLmltcG9ydEFzLnNldChpbXBvcnRBcy5zeW1ib2wsIGltcG9ydEFzLmltcG9ydEFzKTtcbiAgICAgIH0pO1xuICAgIH1cbiAgICByZXR1cm4gaGFzU3VtbWFyeTtcbiAgfVxufVxuIl19
Note: See TracBrowser for help on using the repository browser.