source: trip-planner-front/node_modules/@angular/compiler/src/directive_normalizer.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: 44.3 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 */
8(function (factory) {
9 if (typeof module === "object" && typeof module.exports === "object") {
10 var v = factory(require, exports);
11 if (v !== undefined) module.exports = v;
12 }
13 else if (typeof define === "function" && define.amd) {
14 define("@angular/compiler/src/directive_normalizer", ["require", "exports", "tslib", "@angular/compiler/src/compile_metadata", "@angular/compiler/src/config", "@angular/compiler/src/core", "@angular/compiler/src/ml_parser/ast", "@angular/compiler/src/ml_parser/interpolation_config", "@angular/compiler/src/parse_util", "@angular/compiler/src/style_url_resolver", "@angular/compiler/src/template_parser/template_preparser", "@angular/compiler/src/util"], factory);
15 }
16})(function (require, exports) {
17 "use strict";
18 Object.defineProperty(exports, "__esModule", { value: true });
19 exports.DirectiveNormalizer = void 0;
20 var tslib_1 = require("tslib");
21 var compile_metadata_1 = require("@angular/compiler/src/compile_metadata");
22 var config_1 = require("@angular/compiler/src/config");
23 var core_1 = require("@angular/compiler/src/core");
24 var html = require("@angular/compiler/src/ml_parser/ast");
25 var interpolation_config_1 = require("@angular/compiler/src/ml_parser/interpolation_config");
26 var parse_util_1 = require("@angular/compiler/src/parse_util");
27 var style_url_resolver_1 = require("@angular/compiler/src/style_url_resolver");
28 var template_preparser_1 = require("@angular/compiler/src/template_parser/template_preparser");
29 var util_1 = require("@angular/compiler/src/util");
30 var DirectiveNormalizer = /** @class */ (function () {
31 function DirectiveNormalizer(_resourceLoader, _urlResolver, _htmlParser, _config) {
32 this._resourceLoader = _resourceLoader;
33 this._urlResolver = _urlResolver;
34 this._htmlParser = _htmlParser;
35 this._config = _config;
36 this._resourceLoaderCache = new Map();
37 }
38 DirectiveNormalizer.prototype.clearCache = function () {
39 this._resourceLoaderCache.clear();
40 };
41 DirectiveNormalizer.prototype.clearCacheFor = function (normalizedDirective) {
42 var _this = this;
43 if (!normalizedDirective.isComponent) {
44 return;
45 }
46 var template = normalizedDirective.template;
47 this._resourceLoaderCache.delete(template.templateUrl);
48 template.externalStylesheets.forEach(function (stylesheet) {
49 _this._resourceLoaderCache.delete(stylesheet.moduleUrl);
50 });
51 };
52 DirectiveNormalizer.prototype._fetch = function (url) {
53 var result = this._resourceLoaderCache.get(url);
54 if (!result) {
55 result = this._resourceLoader.get(url);
56 this._resourceLoaderCache.set(url, result);
57 }
58 return result;
59 };
60 DirectiveNormalizer.prototype.normalizeTemplate = function (prenormData) {
61 var _this = this;
62 if (util_1.isDefined(prenormData.template)) {
63 if (util_1.isDefined(prenormData.templateUrl)) {
64 throw parse_util_1.syntaxError("'" + util_1.stringify(prenormData
65 .componentType) + "' component cannot define both template and templateUrl");
66 }
67 if (typeof prenormData.template !== 'string') {
68 throw parse_util_1.syntaxError("The template specified for component " + util_1.stringify(prenormData.componentType) + " is not a string");
69 }
70 }
71 else if (util_1.isDefined(prenormData.templateUrl)) {
72 if (typeof prenormData.templateUrl !== 'string') {
73 throw parse_util_1.syntaxError("The templateUrl specified for component " + util_1.stringify(prenormData.componentType) + " is not a string");
74 }
75 }
76 else {
77 throw parse_util_1.syntaxError("No template specified for component " + util_1.stringify(prenormData.componentType));
78 }
79 if (util_1.isDefined(prenormData.preserveWhitespaces) &&
80 typeof prenormData.preserveWhitespaces !== 'boolean') {
81 throw parse_util_1.syntaxError("The preserveWhitespaces option for component " + util_1.stringify(prenormData.componentType) + " must be a boolean");
82 }
83 return util_1.SyncAsync.then(this._preParseTemplate(prenormData), function (preparsedTemplate) { return _this._normalizeTemplateMetadata(prenormData, preparsedTemplate); });
84 };
85 DirectiveNormalizer.prototype._preParseTemplate = function (prenomData) {
86 var _this = this;
87 var template;
88 var templateUrl;
89 if (prenomData.template != null) {
90 template = prenomData.template;
91 templateUrl = prenomData.moduleUrl;
92 }
93 else {
94 templateUrl = this._urlResolver.resolve(prenomData.moduleUrl, prenomData.templateUrl);
95 template = this._fetch(templateUrl);
96 }
97 return util_1.SyncAsync.then(template, function (template) { return _this._preparseLoadedTemplate(prenomData, template, templateUrl); });
98 };
99 DirectiveNormalizer.prototype._preparseLoadedTemplate = function (prenormData, template, templateAbsUrl) {
100 var isInline = !!prenormData.template;
101 var interpolationConfig = interpolation_config_1.InterpolationConfig.fromArray(prenormData.interpolation);
102 var templateUrl = compile_metadata_1.templateSourceUrl({ reference: prenormData.ngModuleType }, { type: { reference: prenormData.componentType } }, { isInline: isInline, templateUrl: templateAbsUrl });
103 var rootNodesAndErrors = this._htmlParser.parse(template, templateUrl, { tokenizeExpansionForms: true, interpolationConfig: interpolationConfig });
104 if (rootNodesAndErrors.errors.length > 0) {
105 var errorString = rootNodesAndErrors.errors.join('\n');
106 throw parse_util_1.syntaxError("Template parse errors:\n" + errorString);
107 }
108 var templateMetadataStyles = this._normalizeStylesheet(new compile_metadata_1.CompileStylesheetMetadata({ styles: prenormData.styles, moduleUrl: prenormData.moduleUrl }));
109 var visitor = new TemplatePreparseVisitor();
110 html.visitAll(visitor, rootNodesAndErrors.rootNodes);
111 var templateStyles = this._normalizeStylesheet(new compile_metadata_1.CompileStylesheetMetadata({ styles: visitor.styles, styleUrls: visitor.styleUrls, moduleUrl: templateAbsUrl }));
112 var styles = templateMetadataStyles.styles.concat(templateStyles.styles);
113 var inlineStyleUrls = templateMetadataStyles.styleUrls.concat(templateStyles.styleUrls);
114 var styleUrls = this
115 ._normalizeStylesheet(new compile_metadata_1.CompileStylesheetMetadata({ styleUrls: prenormData.styleUrls, moduleUrl: prenormData.moduleUrl }))
116 .styleUrls;
117 return {
118 template: template,
119 templateUrl: templateAbsUrl,
120 isInline: isInline,
121 htmlAst: rootNodesAndErrors,
122 styles: styles,
123 inlineStyleUrls: inlineStyleUrls,
124 styleUrls: styleUrls,
125 ngContentSelectors: visitor.ngContentSelectors,
126 };
127 };
128 DirectiveNormalizer.prototype._normalizeTemplateMetadata = function (prenormData, preparsedTemplate) {
129 var _this = this;
130 return util_1.SyncAsync.then(this._loadMissingExternalStylesheets(preparsedTemplate.styleUrls.concat(preparsedTemplate.inlineStyleUrls)), function (externalStylesheets) { return _this._normalizeLoadedTemplateMetadata(prenormData, preparsedTemplate, externalStylesheets); });
131 };
132 DirectiveNormalizer.prototype._normalizeLoadedTemplateMetadata = function (prenormData, preparsedTemplate, stylesheets) {
133 // Algorithm:
134 // - produce exactly 1 entry per original styleUrl in
135 // CompileTemplateMetadata.externalStylesheets with all styles inlined
136 // - inline all styles that are referenced by the template into CompileTemplateMetadata.styles.
137 // Reason: be able to determine how many stylesheets there are even without loading
138 // the template nor the stylesheets, so we can create a stub for TypeScript always synchronously
139 // (as resource loading may be async)
140 var _this = this;
141 var styles = tslib_1.__spreadArray([], tslib_1.__read(preparsedTemplate.styles));
142 this._inlineStyles(preparsedTemplate.inlineStyleUrls, stylesheets, styles);
143 var styleUrls = preparsedTemplate.styleUrls;
144 var externalStylesheets = styleUrls.map(function (styleUrl) {
145 var stylesheet = stylesheets.get(styleUrl);
146 var styles = tslib_1.__spreadArray([], tslib_1.__read(stylesheet.styles));
147 _this._inlineStyles(stylesheet.styleUrls, stylesheets, styles);
148 return new compile_metadata_1.CompileStylesheetMetadata({ moduleUrl: styleUrl, styles: styles });
149 });
150 var encapsulation = prenormData.encapsulation;
151 if (encapsulation == null) {
152 encapsulation = this._config.defaultEncapsulation;
153 }
154 if (encapsulation === core_1.ViewEncapsulation.Emulated && styles.length === 0 &&
155 styleUrls.length === 0) {
156 encapsulation = core_1.ViewEncapsulation.None;
157 }
158 return new compile_metadata_1.CompileTemplateMetadata({
159 encapsulation: encapsulation,
160 template: preparsedTemplate.template,
161 templateUrl: preparsedTemplate.templateUrl,
162 htmlAst: preparsedTemplate.htmlAst,
163 styles: styles,
164 styleUrls: styleUrls,
165 ngContentSelectors: preparsedTemplate.ngContentSelectors,
166 animations: prenormData.animations,
167 interpolation: prenormData.interpolation,
168 isInline: preparsedTemplate.isInline,
169 externalStylesheets: externalStylesheets,
170 preserveWhitespaces: config_1.preserveWhitespacesDefault(prenormData.preserveWhitespaces, this._config.preserveWhitespaces),
171 });
172 };
173 DirectiveNormalizer.prototype._inlineStyles = function (styleUrls, stylesheets, targetStyles) {
174 var _this = this;
175 styleUrls.forEach(function (styleUrl) {
176 var stylesheet = stylesheets.get(styleUrl);
177 stylesheet.styles.forEach(function (style) { return targetStyles.push(style); });
178 _this._inlineStyles(stylesheet.styleUrls, stylesheets, targetStyles);
179 });
180 };
181 DirectiveNormalizer.prototype._loadMissingExternalStylesheets = function (styleUrls, loadedStylesheets) {
182 var _this = this;
183 if (loadedStylesheets === void 0) { loadedStylesheets = new Map(); }
184 return util_1.SyncAsync.then(util_1.SyncAsync.all(styleUrls.filter(function (styleUrl) { return !loadedStylesheets.has(styleUrl); })
185 .map(function (styleUrl) { return util_1.SyncAsync.then(_this._fetch(styleUrl), function (loadedStyle) {
186 var stylesheet = _this._normalizeStylesheet(new compile_metadata_1.CompileStylesheetMetadata({ styles: [loadedStyle], moduleUrl: styleUrl }));
187 loadedStylesheets.set(styleUrl, stylesheet);
188 return _this._loadMissingExternalStylesheets(stylesheet.styleUrls, loadedStylesheets);
189 }); })), function (_) { return loadedStylesheets; });
190 };
191 DirectiveNormalizer.prototype._normalizeStylesheet = function (stylesheet) {
192 var _this = this;
193 var moduleUrl = stylesheet.moduleUrl;
194 var allStyleUrls = stylesheet.styleUrls.filter(style_url_resolver_1.isStyleUrlResolvable)
195 .map(function (url) { return _this._urlResolver.resolve(moduleUrl, url); });
196 var allStyles = stylesheet.styles.map(function (style) {
197 var styleWithImports = style_url_resolver_1.extractStyleUrls(_this._urlResolver, moduleUrl, style);
198 allStyleUrls.push.apply(allStyleUrls, tslib_1.__spreadArray([], tslib_1.__read(styleWithImports.styleUrls)));
199 return styleWithImports.style;
200 });
201 return new compile_metadata_1.CompileStylesheetMetadata({ styles: allStyles, styleUrls: allStyleUrls, moduleUrl: moduleUrl });
202 };
203 return DirectiveNormalizer;
204 }());
205 exports.DirectiveNormalizer = DirectiveNormalizer;
206 var TemplatePreparseVisitor = /** @class */ (function () {
207 function TemplatePreparseVisitor() {
208 this.ngContentSelectors = [];
209 this.styles = [];
210 this.styleUrls = [];
211 this.ngNonBindableStackCount = 0;
212 }
213 TemplatePreparseVisitor.prototype.visitElement = function (ast, context) {
214 var preparsedElement = template_preparser_1.preparseElement(ast);
215 switch (preparsedElement.type) {
216 case template_preparser_1.PreparsedElementType.NG_CONTENT:
217 if (this.ngNonBindableStackCount === 0) {
218 this.ngContentSelectors.push(preparsedElement.selectAttr);
219 }
220 break;
221 case template_preparser_1.PreparsedElementType.STYLE:
222 var textContent_1 = '';
223 ast.children.forEach(function (child) {
224 if (child instanceof html.Text) {
225 textContent_1 += child.value;
226 }
227 });
228 this.styles.push(textContent_1);
229 break;
230 case template_preparser_1.PreparsedElementType.STYLESHEET:
231 this.styleUrls.push(preparsedElement.hrefAttr);
232 break;
233 default:
234 break;
235 }
236 if (preparsedElement.nonBindable) {
237 this.ngNonBindableStackCount++;
238 }
239 html.visitAll(this, ast.children);
240 if (preparsedElement.nonBindable) {
241 this.ngNonBindableStackCount--;
242 }
243 return null;
244 };
245 TemplatePreparseVisitor.prototype.visitExpansion = function (ast, context) {
246 html.visitAll(this, ast.cases);
247 };
248 TemplatePreparseVisitor.prototype.visitExpansionCase = function (ast, context) {
249 html.visitAll(this, ast.expression);
250 };
251 TemplatePreparseVisitor.prototype.visitComment = function (ast, context) {
252 return null;
253 };
254 TemplatePreparseVisitor.prototype.visitAttribute = function (ast, context) {
255 return null;
256 };
257 TemplatePreparseVisitor.prototype.visitText = function (ast, context) {
258 return null;
259 };
260 return TemplatePreparseVisitor;
261 }());
262});
263//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZGlyZWN0aXZlX25vcm1hbGl6ZXIuanMiLCJzb3VyY2VSb290Ij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gICAgICAgICAgICAgICAgICAobG9hZGVkU3R5bGUpID0+IHtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNvbnN0IHN0eWxlc2hlZXQgPVxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRoaXMuX25vcm1hbGl6ZVN0eWxlc2hlZXQobmV3IENvbXBpbGVTdHlsZXNoZWV0TWV0YWRhdGEoXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHtzdHlsZXM6IFtsb2FkZWRTdHlsZV0sIG1vZHVsZVVybDogc3R5bGVVcmx9KSk7XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBsb2FkZWRTdHlsZXNoZWV0cy5zZXQoc3R5bGVVcmwsIHN0eWxlc2hlZXQpO1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHRoaXMuX2xvYWRNaXNzaW5nRXh0ZXJuYWxTdHlsZXNoZWV0cyhcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzdHlsZXNoZWV0LnN0eWxlVXJscywgbG9hZGVkU3R5bGVzaGVldHMpO1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pKSksXG4gICAgICAgIChfKSA9PiBsb2FkZWRTdHlsZXNoZWV0cyk7XG4gIH1cblxuICBwcml2YXRlIF9ub3JtYWxpemVTdHlsZXNoZWV0KHN0eWxlc2hlZXQ6IENvbXBpbGVTdHlsZXNoZWV0TWV0YWRhdGEpOiBDb21waWxlU3R5bGVzaGVldE1ldGFkYXRhIHtcbiAgICBjb25zdCBtb2R1bGVVcmwgPSBzdHlsZXNoZWV0Lm1vZHVsZVVybCE7XG4gICAgY29uc3QgYWxsU3R5bGVVcmxzID0gc3R5bGVzaGVldC5zdHlsZVVybHMuZmlsdGVyKGlzU3R5bGVVcmxSZXNvbHZhYmxlKVxuICAgICAgICAgICAgICAgICAgICAgICAgIC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fVxuICAgIGlmIChwcmVwYXJzZWRFbGVtZW50Lm5vbkJpbmRhYmxlKSB7XG4gICAgICB0aGlzLm5nTm9uQmluZGFibGVTdGFja0NvdW50Kys7XG4gICAgfVxuICAgIGh0bWwudmlzaXRBbGwodGhpcywgYXN0LmNoaWxkcmVuKTtcbiAgICBpZiAocHJlcGFyc2VkRWxlbWVudC5ub25CaW5kYWJsZSkge1xuICAgICAgdGhpcy5uZ05vbkJpbmRhYmxlU3RhY2tDb3VudC0tO1xuICAgIH1cbiAgICByZXR1cm4gbnVsbDtcbiAgfVxuXG4gIHZpc2l0RXhwYW5zaW9uKGFzdDogaHRtbC5FeHBhbnNpb24sIGNvbnRleHQ6IGFueSk6IGFueSB7XG4gICAgaHRtbC52aXNpdEFsbCh0aGlzLCBhc3QuY2FzZXMpO1xuICB9XG5cbiAgdmlzaXRFeHBhbnNpb25DYXNlKGFzdDogaHRtbC5FeHBhbnNpb25DYXNlLCBjb250ZXh0OiBhbnkpOiBhbnkge1xuICAgIGh0bWwudmlzaXRBbGwodGhpcywgYXN0LmV4cHJlc3Npb24pO1xuICB9XG5cbiAgdmlzaXRDb21tZW50KGFzdDogaHRtbC5Db21tZW50LCBjb250ZXh0OiBhbnkpOiBhbnkge1xuICAgIHJldHVybiBudWxsO1xuICB9XG4gIHZpc2l0QXR0cmlidXRlKGFzdDogaHRtbC5BdHRyaWJ1dGUsIGNvbnRleHQ6IGFueSk6IGFueSB7XG4gICAgcmV0dXJuIG51bGw7XG4gIH1cbiAgdmlzaXRUZXh0KGFzdDogaHRtbC5UZXh0LCBjb250ZXh0OiBhbnkpOiBhbnkge1xuICAgIHJldHVybiBudWxsO1xuICB9XG59XG4iXX0=
Note: See TracBrowser for help on using the repository browser.