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/provider_analyzer", ["require", "exports", "tslib", "@angular/compiler/src/compile_metadata", "@angular/compiler/src/identifiers", "@angular/compiler/src/parse_util", "@angular/compiler/src/template_parser/template_ast"], factory);
|
---|
15 | }
|
---|
16 | })(function (require, exports) {
|
---|
17 | "use strict";
|
---|
18 | Object.defineProperty(exports, "__esModule", { value: true });
|
---|
19 | exports.NgModuleProviderAnalyzer = exports.ProviderElementContext = exports.ProviderViewContext = exports.ProviderError = void 0;
|
---|
20 | var tslib_1 = require("tslib");
|
---|
21 | var compile_metadata_1 = require("@angular/compiler/src/compile_metadata");
|
---|
22 | var identifiers_1 = require("@angular/compiler/src/identifiers");
|
---|
23 | var parse_util_1 = require("@angular/compiler/src/parse_util");
|
---|
24 | var template_ast_1 = require("@angular/compiler/src/template_parser/template_ast");
|
---|
25 | var ProviderError = /** @class */ (function (_super) {
|
---|
26 | tslib_1.__extends(ProviderError, _super);
|
---|
27 | function ProviderError(message, span) {
|
---|
28 | return _super.call(this, span, message) || this;
|
---|
29 | }
|
---|
30 | return ProviderError;
|
---|
31 | }(parse_util_1.ParseError));
|
---|
32 | exports.ProviderError = ProviderError;
|
---|
33 | var ProviderViewContext = /** @class */ (function () {
|
---|
34 | function ProviderViewContext(reflector, component) {
|
---|
35 | var _this = this;
|
---|
36 | this.reflector = reflector;
|
---|
37 | this.component = component;
|
---|
38 | this.errors = [];
|
---|
39 | this.viewQueries = _getViewQueries(component);
|
---|
40 | this.viewProviders = new Map();
|
---|
41 | component.viewProviders.forEach(function (provider) {
|
---|
42 | if (_this.viewProviders.get(compile_metadata_1.tokenReference(provider.token)) == null) {
|
---|
43 | _this.viewProviders.set(compile_metadata_1.tokenReference(provider.token), true);
|
---|
44 | }
|
---|
45 | });
|
---|
46 | }
|
---|
47 | return ProviderViewContext;
|
---|
48 | }());
|
---|
49 | exports.ProviderViewContext = ProviderViewContext;
|
---|
50 | var ProviderElementContext = /** @class */ (function () {
|
---|
51 | function ProviderElementContext(viewContext, _parent, _isViewRoot, _directiveAsts, attrs, refs, isTemplate, contentQueryStartId, _sourceSpan) {
|
---|
52 | var _this = this;
|
---|
53 | this.viewContext = viewContext;
|
---|
54 | this._parent = _parent;
|
---|
55 | this._isViewRoot = _isViewRoot;
|
---|
56 | this._directiveAsts = _directiveAsts;
|
---|
57 | this._sourceSpan = _sourceSpan;
|
---|
58 | this._transformedProviders = new Map();
|
---|
59 | this._seenProviders = new Map();
|
---|
60 | this._queriedTokens = new Map();
|
---|
61 | this.transformedHasViewContainer = false;
|
---|
62 | this._attrs = {};
|
---|
63 | attrs.forEach(function (attrAst) { return _this._attrs[attrAst.name] = attrAst.value; });
|
---|
64 | var directivesMeta = _directiveAsts.map(function (directiveAst) { return directiveAst.directive; });
|
---|
65 | this._allProviders =
|
---|
66 | _resolveProvidersFromDirectives(directivesMeta, _sourceSpan, viewContext.errors);
|
---|
67 | this._contentQueries = _getContentQueries(contentQueryStartId, directivesMeta);
|
---|
68 | Array.from(this._allProviders.values()).forEach(function (provider) {
|
---|
69 | _this._addQueryReadsTo(provider.token, provider.token, _this._queriedTokens);
|
---|
70 | });
|
---|
71 | if (isTemplate) {
|
---|
72 | var templateRefId = identifiers_1.createTokenForExternalReference(this.viewContext.reflector, identifiers_1.Identifiers.TemplateRef);
|
---|
73 | this._addQueryReadsTo(templateRefId, templateRefId, this._queriedTokens);
|
---|
74 | }
|
---|
75 | refs.forEach(function (refAst) {
|
---|
76 | var defaultQueryValue = refAst.value ||
|
---|
77 | identifiers_1.createTokenForExternalReference(_this.viewContext.reflector, identifiers_1.Identifiers.ElementRef);
|
---|
78 | _this._addQueryReadsTo({ value: refAst.name }, defaultQueryValue, _this._queriedTokens);
|
---|
79 | });
|
---|
80 | if (this._queriedTokens.get(this.viewContext.reflector.resolveExternalReference(identifiers_1.Identifiers.ViewContainerRef))) {
|
---|
81 | this.transformedHasViewContainer = true;
|
---|
82 | }
|
---|
83 | // create the providers that we know are eager first
|
---|
84 | Array.from(this._allProviders.values()).forEach(function (provider) {
|
---|
85 | var eager = provider.eager || _this._queriedTokens.get(compile_metadata_1.tokenReference(provider.token));
|
---|
86 | if (eager) {
|
---|
87 | _this._getOrCreateLocalProvider(provider.providerType, provider.token, true);
|
---|
88 | }
|
---|
89 | });
|
---|
90 | }
|
---|
91 | ProviderElementContext.prototype.afterElement = function () {
|
---|
92 | var _this = this;
|
---|
93 | // collect lazy providers
|
---|
94 | Array.from(this._allProviders.values()).forEach(function (provider) {
|
---|
95 | _this._getOrCreateLocalProvider(provider.providerType, provider.token, false);
|
---|
96 | });
|
---|
97 | };
|
---|
98 | Object.defineProperty(ProviderElementContext.prototype, "transformProviders", {
|
---|
99 | get: function () {
|
---|
100 | // Note: Maps keep their insertion order.
|
---|
101 | var lazyProviders = [];
|
---|
102 | var eagerProviders = [];
|
---|
103 | this._transformedProviders.forEach(function (provider) {
|
---|
104 | if (provider.eager) {
|
---|
105 | eagerProviders.push(provider);
|
---|
106 | }
|
---|
107 | else {
|
---|
108 | lazyProviders.push(provider);
|
---|
109 | }
|
---|
110 | });
|
---|
111 | return lazyProviders.concat(eagerProviders);
|
---|
112 | },
|
---|
113 | enumerable: false,
|
---|
114 | configurable: true
|
---|
115 | });
|
---|
116 | Object.defineProperty(ProviderElementContext.prototype, "transformedDirectiveAsts", {
|
---|
117 | get: function () {
|
---|
118 | var sortedProviderTypes = this.transformProviders.map(function (provider) { return provider.token.identifier; });
|
---|
119 | var sortedDirectives = this._directiveAsts.slice();
|
---|
120 | sortedDirectives.sort(function (dir1, dir2) { return sortedProviderTypes.indexOf(dir1.directive.type) -
|
---|
121 | sortedProviderTypes.indexOf(dir2.directive.type); });
|
---|
122 | return sortedDirectives;
|
---|
123 | },
|
---|
124 | enumerable: false,
|
---|
125 | configurable: true
|
---|
126 | });
|
---|
127 | Object.defineProperty(ProviderElementContext.prototype, "queryMatches", {
|
---|
128 | get: function () {
|
---|
129 | var allMatches = [];
|
---|
130 | this._queriedTokens.forEach(function (matches) {
|
---|
131 | allMatches.push.apply(allMatches, tslib_1.__spreadArray([], tslib_1.__read(matches)));
|
---|
132 | });
|
---|
133 | return allMatches;
|
---|
134 | },
|
---|
135 | enumerable: false,
|
---|
136 | configurable: true
|
---|
137 | });
|
---|
138 | ProviderElementContext.prototype._addQueryReadsTo = function (token, defaultValue, queryReadTokens) {
|
---|
139 | this._getQueriesFor(token).forEach(function (query) {
|
---|
140 | var queryValue = query.meta.read || defaultValue;
|
---|
141 | var tokenRef = compile_metadata_1.tokenReference(queryValue);
|
---|
142 | var queryMatches = queryReadTokens.get(tokenRef);
|
---|
143 | if (!queryMatches) {
|
---|
144 | queryMatches = [];
|
---|
145 | queryReadTokens.set(tokenRef, queryMatches);
|
---|
146 | }
|
---|
147 | queryMatches.push({ queryId: query.queryId, value: queryValue });
|
---|
148 | });
|
---|
149 | };
|
---|
150 | ProviderElementContext.prototype._getQueriesFor = function (token) {
|
---|
151 | var result = [];
|
---|
152 | var currentEl = this;
|
---|
153 | var distance = 0;
|
---|
154 | var queries;
|
---|
155 | while (currentEl !== null) {
|
---|
156 | queries = currentEl._contentQueries.get(compile_metadata_1.tokenReference(token));
|
---|
157 | if (queries) {
|
---|
158 | result.push.apply(result, tslib_1.__spreadArray([], tslib_1.__read(queries.filter(function (query) { return query.meta.descendants || distance <= 1; }))));
|
---|
159 | }
|
---|
160 | if (currentEl._directiveAsts.length > 0) {
|
---|
161 | distance++;
|
---|
162 | }
|
---|
163 | currentEl = currentEl._parent;
|
---|
164 | }
|
---|
165 | queries = this.viewContext.viewQueries.get(compile_metadata_1.tokenReference(token));
|
---|
166 | if (queries) {
|
---|
167 | result.push.apply(result, tslib_1.__spreadArray([], tslib_1.__read(queries)));
|
---|
168 | }
|
---|
169 | return result;
|
---|
170 | };
|
---|
171 | ProviderElementContext.prototype._getOrCreateLocalProvider = function (requestingProviderType, token, eager) {
|
---|
172 | var _this = this;
|
---|
173 | var resolvedProvider = this._allProviders.get(compile_metadata_1.tokenReference(token));
|
---|
174 | if (!resolvedProvider ||
|
---|
175 | ((requestingProviderType === template_ast_1.ProviderAstType.Directive ||
|
---|
176 | requestingProviderType === template_ast_1.ProviderAstType.PublicService) &&
|
---|
177 | resolvedProvider.providerType === template_ast_1.ProviderAstType.PrivateService) ||
|
---|
178 | ((requestingProviderType === template_ast_1.ProviderAstType.PrivateService ||
|
---|
179 | requestingProviderType === template_ast_1.ProviderAstType.PublicService) &&
|
---|
180 | resolvedProvider.providerType === template_ast_1.ProviderAstType.Builtin)) {
|
---|
181 | return null;
|
---|
182 | }
|
---|
183 | var transformedProviderAst = this._transformedProviders.get(compile_metadata_1.tokenReference(token));
|
---|
184 | if (transformedProviderAst) {
|
---|
185 | return transformedProviderAst;
|
---|
186 | }
|
---|
187 | if (this._seenProviders.get(compile_metadata_1.tokenReference(token)) != null) {
|
---|
188 | this.viewContext.errors.push(new ProviderError("Cannot instantiate cyclic dependency! " + compile_metadata_1.tokenName(token), this._sourceSpan));
|
---|
189 | return null;
|
---|
190 | }
|
---|
191 | this._seenProviders.set(compile_metadata_1.tokenReference(token), true);
|
---|
192 | var transformedProviders = resolvedProvider.providers.map(function (provider) {
|
---|
193 | var transformedUseValue = provider.useValue;
|
---|
194 | var transformedUseExisting = provider.useExisting;
|
---|
195 | var transformedDeps = undefined;
|
---|
196 | if (provider.useExisting != null) {
|
---|
197 | var existingDiDep = _this._getDependency(resolvedProvider.providerType, { token: provider.useExisting }, eager);
|
---|
198 | if (existingDiDep.token != null) {
|
---|
199 | transformedUseExisting = existingDiDep.token;
|
---|
200 | }
|
---|
201 | else {
|
---|
202 | transformedUseExisting = null;
|
---|
203 | transformedUseValue = existingDiDep.value;
|
---|
204 | }
|
---|
205 | }
|
---|
206 | else if (provider.useFactory) {
|
---|
207 | var deps = provider.deps || provider.useFactory.diDeps;
|
---|
208 | transformedDeps =
|
---|
209 | deps.map(function (dep) { return _this._getDependency(resolvedProvider.providerType, dep, eager); });
|
---|
210 | }
|
---|
211 | else if (provider.useClass) {
|
---|
212 | var deps = provider.deps || provider.useClass.diDeps;
|
---|
213 | transformedDeps =
|
---|
214 | deps.map(function (dep) { return _this._getDependency(resolvedProvider.providerType, dep, eager); });
|
---|
215 | }
|
---|
216 | return _transformProvider(provider, {
|
---|
217 | useExisting: transformedUseExisting,
|
---|
218 | useValue: transformedUseValue,
|
---|
219 | deps: transformedDeps
|
---|
220 | });
|
---|
221 | });
|
---|
222 | transformedProviderAst =
|
---|
223 | _transformProviderAst(resolvedProvider, { eager: eager, providers: transformedProviders });
|
---|
224 | this._transformedProviders.set(compile_metadata_1.tokenReference(token), transformedProviderAst);
|
---|
225 | return transformedProviderAst;
|
---|
226 | };
|
---|
227 | ProviderElementContext.prototype._getLocalDependency = function (requestingProviderType, dep, eager) {
|
---|
228 | if (eager === void 0) { eager = false; }
|
---|
229 | if (dep.isAttribute) {
|
---|
230 | var attrValue = this._attrs[dep.token.value];
|
---|
231 | return { isValue: true, value: attrValue == null ? null : attrValue };
|
---|
232 | }
|
---|
233 | if (dep.token != null) {
|
---|
234 | // access builtints
|
---|
235 | if ((requestingProviderType === template_ast_1.ProviderAstType.Directive ||
|
---|
236 | requestingProviderType === template_ast_1.ProviderAstType.Component)) {
|
---|
237 | if (compile_metadata_1.tokenReference(dep.token) ===
|
---|
238 | this.viewContext.reflector.resolveExternalReference(identifiers_1.Identifiers.Renderer) ||
|
---|
239 | compile_metadata_1.tokenReference(dep.token) ===
|
---|
240 | this.viewContext.reflector.resolveExternalReference(identifiers_1.Identifiers.ElementRef) ||
|
---|
241 | compile_metadata_1.tokenReference(dep.token) ===
|
---|
242 | this.viewContext.reflector.resolveExternalReference(identifiers_1.Identifiers.ChangeDetectorRef) ||
|
---|
243 | compile_metadata_1.tokenReference(dep.token) ===
|
---|
244 | this.viewContext.reflector.resolveExternalReference(identifiers_1.Identifiers.TemplateRef)) {
|
---|
245 | return dep;
|
---|
246 | }
|
---|
247 | if (compile_metadata_1.tokenReference(dep.token) ===
|
---|
248 | this.viewContext.reflector.resolveExternalReference(identifiers_1.Identifiers.ViewContainerRef)) {
|
---|
249 | this.transformedHasViewContainer = true;
|
---|
250 | }
|
---|
251 | }
|
---|
252 | // access the injector
|
---|
253 | if (compile_metadata_1.tokenReference(dep.token) ===
|
---|
254 | this.viewContext.reflector.resolveExternalReference(identifiers_1.Identifiers.Injector)) {
|
---|
255 | return dep;
|
---|
256 | }
|
---|
257 | // access providers
|
---|
258 | if (this._getOrCreateLocalProvider(requestingProviderType, dep.token, eager) != null) {
|
---|
259 | return dep;
|
---|
260 | }
|
---|
261 | }
|
---|
262 | return null;
|
---|
263 | };
|
---|
264 | ProviderElementContext.prototype._getDependency = function (requestingProviderType, dep, eager) {
|
---|
265 | if (eager === void 0) { eager = false; }
|
---|
266 | var currElement = this;
|
---|
267 | var currEager = eager;
|
---|
268 | var result = null;
|
---|
269 | if (!dep.isSkipSelf) {
|
---|
270 | result = this._getLocalDependency(requestingProviderType, dep, eager);
|
---|
271 | }
|
---|
272 | if (dep.isSelf) {
|
---|
273 | if (!result && dep.isOptional) {
|
---|
274 | result = { isValue: true, value: null };
|
---|
275 | }
|
---|
276 | }
|
---|
277 | else {
|
---|
278 | // check parent elements
|
---|
279 | while (!result && currElement._parent) {
|
---|
280 | var prevElement = currElement;
|
---|
281 | currElement = currElement._parent;
|
---|
282 | if (prevElement._isViewRoot) {
|
---|
283 | currEager = false;
|
---|
284 | }
|
---|
285 | result = currElement._getLocalDependency(template_ast_1.ProviderAstType.PublicService, dep, currEager);
|
---|
286 | }
|
---|
287 | // check @Host restriction
|
---|
288 | if (!result) {
|
---|
289 | if (!dep.isHost || this.viewContext.component.isHost ||
|
---|
290 | this.viewContext.component.type.reference === compile_metadata_1.tokenReference(dep.token) ||
|
---|
291 | this.viewContext.viewProviders.get(compile_metadata_1.tokenReference(dep.token)) != null) {
|
---|
292 | result = dep;
|
---|
293 | }
|
---|
294 | else {
|
---|
295 | result = dep.isOptional ? { isValue: true, value: null } : null;
|
---|
296 | }
|
---|
297 | }
|
---|
298 | }
|
---|
299 | if (!result) {
|
---|
300 | this.viewContext.errors.push(new ProviderError("No provider for " + compile_metadata_1.tokenName(dep.token), this._sourceSpan));
|
---|
301 | }
|
---|
302 | return result;
|
---|
303 | };
|
---|
304 | return ProviderElementContext;
|
---|
305 | }());
|
---|
306 | exports.ProviderElementContext = ProviderElementContext;
|
---|
307 | var NgModuleProviderAnalyzer = /** @class */ (function () {
|
---|
308 | function NgModuleProviderAnalyzer(reflector, ngModule, extraProviders, sourceSpan) {
|
---|
309 | var _this = this;
|
---|
310 | this.reflector = reflector;
|
---|
311 | this._transformedProviders = new Map();
|
---|
312 | this._seenProviders = new Map();
|
---|
313 | this._errors = [];
|
---|
314 | this._allProviders = new Map();
|
---|
315 | ngModule.transitiveModule.modules.forEach(function (ngModuleType) {
|
---|
316 | var ngModuleProvider = { token: { identifier: ngModuleType }, useClass: ngModuleType };
|
---|
317 | _resolveProviders([ngModuleProvider], template_ast_1.ProviderAstType.PublicService, true, sourceSpan, _this._errors, _this._allProviders, /* isModule */ true);
|
---|
318 | });
|
---|
319 | _resolveProviders(ngModule.transitiveModule.providers.map(function (entry) { return entry.provider; }).concat(extraProviders), template_ast_1.ProviderAstType.PublicService, false, sourceSpan, this._errors, this._allProviders,
|
---|
320 | /* isModule */ false);
|
---|
321 | }
|
---|
322 | NgModuleProviderAnalyzer.prototype.parse = function () {
|
---|
323 | var _this = this;
|
---|
324 | Array.from(this._allProviders.values()).forEach(function (provider) {
|
---|
325 | _this._getOrCreateLocalProvider(provider.token, provider.eager);
|
---|
326 | });
|
---|
327 | if (this._errors.length > 0) {
|
---|
328 | var errorString = this._errors.join('\n');
|
---|
329 | throw new Error("Provider parse errors:\n" + errorString);
|
---|
330 | }
|
---|
331 | // Note: Maps keep their insertion order.
|
---|
332 | var lazyProviders = [];
|
---|
333 | var eagerProviders = [];
|
---|
334 | this._transformedProviders.forEach(function (provider) {
|
---|
335 | if (provider.eager) {
|
---|
336 | eagerProviders.push(provider);
|
---|
337 | }
|
---|
338 | else {
|
---|
339 | lazyProviders.push(provider);
|
---|
340 | }
|
---|
341 | });
|
---|
342 | return lazyProviders.concat(eagerProviders);
|
---|
343 | };
|
---|
344 | NgModuleProviderAnalyzer.prototype._getOrCreateLocalProvider = function (token, eager) {
|
---|
345 | var _this = this;
|
---|
346 | var resolvedProvider = this._allProviders.get(compile_metadata_1.tokenReference(token));
|
---|
347 | if (!resolvedProvider) {
|
---|
348 | return null;
|
---|
349 | }
|
---|
350 | var transformedProviderAst = this._transformedProviders.get(compile_metadata_1.tokenReference(token));
|
---|
351 | if (transformedProviderAst) {
|
---|
352 | return transformedProviderAst;
|
---|
353 | }
|
---|
354 | if (this._seenProviders.get(compile_metadata_1.tokenReference(token)) != null) {
|
---|
355 | this._errors.push(new ProviderError("Cannot instantiate cyclic dependency! " + compile_metadata_1.tokenName(token), resolvedProvider.sourceSpan));
|
---|
356 | return null;
|
---|
357 | }
|
---|
358 | this._seenProviders.set(compile_metadata_1.tokenReference(token), true);
|
---|
359 | var transformedProviders = resolvedProvider.providers.map(function (provider) {
|
---|
360 | var transformedUseValue = provider.useValue;
|
---|
361 | var transformedUseExisting = provider.useExisting;
|
---|
362 | var transformedDeps = undefined;
|
---|
363 | if (provider.useExisting != null) {
|
---|
364 | var existingDiDep = _this._getDependency({ token: provider.useExisting }, eager, resolvedProvider.sourceSpan);
|
---|
365 | if (existingDiDep.token != null) {
|
---|
366 | transformedUseExisting = existingDiDep.token;
|
---|
367 | }
|
---|
368 | else {
|
---|
369 | transformedUseExisting = null;
|
---|
370 | transformedUseValue = existingDiDep.value;
|
---|
371 | }
|
---|
372 | }
|
---|
373 | else if (provider.useFactory) {
|
---|
374 | var deps = provider.deps || provider.useFactory.diDeps;
|
---|
375 | transformedDeps =
|
---|
376 | deps.map(function (dep) { return _this._getDependency(dep, eager, resolvedProvider.sourceSpan); });
|
---|
377 | }
|
---|
378 | else if (provider.useClass) {
|
---|
379 | var deps = provider.deps || provider.useClass.diDeps;
|
---|
380 | transformedDeps =
|
---|
381 | deps.map(function (dep) { return _this._getDependency(dep, eager, resolvedProvider.sourceSpan); });
|
---|
382 | }
|
---|
383 | return _transformProvider(provider, {
|
---|
384 | useExisting: transformedUseExisting,
|
---|
385 | useValue: transformedUseValue,
|
---|
386 | deps: transformedDeps
|
---|
387 | });
|
---|
388 | });
|
---|
389 | transformedProviderAst =
|
---|
390 | _transformProviderAst(resolvedProvider, { eager: eager, providers: transformedProviders });
|
---|
391 | this._transformedProviders.set(compile_metadata_1.tokenReference(token), transformedProviderAst);
|
---|
392 | return transformedProviderAst;
|
---|
393 | };
|
---|
394 | NgModuleProviderAnalyzer.prototype._getDependency = function (dep, eager, requestorSourceSpan) {
|
---|
395 | if (eager === void 0) { eager = false; }
|
---|
396 | var foundLocal = false;
|
---|
397 | if (!dep.isSkipSelf && dep.token != null) {
|
---|
398 | // access the injector
|
---|
399 | if (compile_metadata_1.tokenReference(dep.token) ===
|
---|
400 | this.reflector.resolveExternalReference(identifiers_1.Identifiers.Injector) ||
|
---|
401 | compile_metadata_1.tokenReference(dep.token) ===
|
---|
402 | this.reflector.resolveExternalReference(identifiers_1.Identifiers.ComponentFactoryResolver)) {
|
---|
403 | foundLocal = true;
|
---|
404 | // access providers
|
---|
405 | }
|
---|
406 | else if (this._getOrCreateLocalProvider(dep.token, eager) != null) {
|
---|
407 | foundLocal = true;
|
---|
408 | }
|
---|
409 | }
|
---|
410 | return dep;
|
---|
411 | };
|
---|
412 | return NgModuleProviderAnalyzer;
|
---|
413 | }());
|
---|
414 | exports.NgModuleProviderAnalyzer = NgModuleProviderAnalyzer;
|
---|
415 | function _transformProvider(provider, _a) {
|
---|
416 | var useExisting = _a.useExisting, useValue = _a.useValue, deps = _a.deps;
|
---|
417 | return {
|
---|
418 | token: provider.token,
|
---|
419 | useClass: provider.useClass,
|
---|
420 | useExisting: useExisting,
|
---|
421 | useFactory: provider.useFactory,
|
---|
422 | useValue: useValue,
|
---|
423 | deps: deps,
|
---|
424 | multi: provider.multi
|
---|
425 | };
|
---|
426 | }
|
---|
427 | function _transformProviderAst(provider, _a) {
|
---|
428 | var eager = _a.eager, providers = _a.providers;
|
---|
429 | return new template_ast_1.ProviderAst(provider.token, provider.multiProvider, provider.eager || eager, providers, provider.providerType, provider.lifecycleHooks, provider.sourceSpan, provider.isModule);
|
---|
430 | }
|
---|
431 | function _resolveProvidersFromDirectives(directives, sourceSpan, targetErrors) {
|
---|
432 | var providersByToken = new Map();
|
---|
433 | directives.forEach(function (directive) {
|
---|
434 | var dirProvider = { token: { identifier: directive.type }, useClass: directive.type };
|
---|
435 | _resolveProviders([dirProvider], directive.isComponent ? template_ast_1.ProviderAstType.Component : template_ast_1.ProviderAstType.Directive, true, sourceSpan, targetErrors, providersByToken, /* isModule */ false);
|
---|
436 | });
|
---|
437 | // Note: directives need to be able to overwrite providers of a component!
|
---|
438 | var directivesWithComponentFirst = directives.filter(function (dir) { return dir.isComponent; }).concat(directives.filter(function (dir) { return !dir.isComponent; }));
|
---|
439 | directivesWithComponentFirst.forEach(function (directive) {
|
---|
440 | _resolveProviders(directive.providers, template_ast_1.ProviderAstType.PublicService, false, sourceSpan, targetErrors, providersByToken, /* isModule */ false);
|
---|
441 | _resolveProviders(directive.viewProviders, template_ast_1.ProviderAstType.PrivateService, false, sourceSpan, targetErrors, providersByToken, /* isModule */ false);
|
---|
442 | });
|
---|
443 | return providersByToken;
|
---|
444 | }
|
---|
445 | function _resolveProviders(providers, providerType, eager, sourceSpan, targetErrors, targetProvidersByToken, isModule) {
|
---|
446 | providers.forEach(function (provider) {
|
---|
447 | var resolvedProvider = targetProvidersByToken.get(compile_metadata_1.tokenReference(provider.token));
|
---|
448 | if (resolvedProvider != null && !!resolvedProvider.multiProvider !== !!provider.multi) {
|
---|
449 | targetErrors.push(new ProviderError("Mixing multi and non multi provider is not possible for token " + compile_metadata_1.tokenName(resolvedProvider.token), sourceSpan));
|
---|
450 | }
|
---|
451 | if (!resolvedProvider) {
|
---|
452 | var lifecycleHooks = provider.token.identifier &&
|
---|
453 | provider.token.identifier.lifecycleHooks ?
|
---|
454 | provider.token.identifier.lifecycleHooks :
|
---|
455 | [];
|
---|
456 | var isUseValue = !(provider.useClass || provider.useExisting || provider.useFactory);
|
---|
457 | resolvedProvider = new template_ast_1.ProviderAst(provider.token, !!provider.multi, eager || isUseValue, [provider], providerType, lifecycleHooks, sourceSpan, isModule);
|
---|
458 | targetProvidersByToken.set(compile_metadata_1.tokenReference(provider.token), resolvedProvider);
|
---|
459 | }
|
---|
460 | else {
|
---|
461 | if (!provider.multi) {
|
---|
462 | resolvedProvider.providers.length = 0;
|
---|
463 | }
|
---|
464 | resolvedProvider.providers.push(provider);
|
---|
465 | }
|
---|
466 | });
|
---|
467 | }
|
---|
468 | function _getViewQueries(component) {
|
---|
469 | // Note: queries start with id 1 so we can use the number in a Bloom filter!
|
---|
470 | var viewQueryId = 1;
|
---|
471 | var viewQueries = new Map();
|
---|
472 | if (component.viewQueries) {
|
---|
473 | component.viewQueries.forEach(function (query) { return _addQueryToTokenMap(viewQueries, { meta: query, queryId: viewQueryId++ }); });
|
---|
474 | }
|
---|
475 | return viewQueries;
|
---|
476 | }
|
---|
477 | function _getContentQueries(contentQueryStartId, directives) {
|
---|
478 | var contentQueryId = contentQueryStartId;
|
---|
479 | var contentQueries = new Map();
|
---|
480 | directives.forEach(function (directive, directiveIndex) {
|
---|
481 | if (directive.queries) {
|
---|
482 | directive.queries.forEach(function (query) { return _addQueryToTokenMap(contentQueries, { meta: query, queryId: contentQueryId++ }); });
|
---|
483 | }
|
---|
484 | });
|
---|
485 | return contentQueries;
|
---|
486 | }
|
---|
487 | function _addQueryToTokenMap(map, query) {
|
---|
488 | query.meta.selectors.forEach(function (token) {
|
---|
489 | var entry = map.get(compile_metadata_1.tokenReference(token));
|
---|
490 | if (!entry) {
|
---|
491 | entry = [];
|
---|
492 | map.set(compile_metadata_1.tokenReference(token), entry);
|
---|
493 | }
|
---|
494 | entry.push(query);
|
---|
495 | });
|
---|
496 | }
|
---|
497 | });
|
---|
498 | //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoicHJvdmlkZXJfYW5hbHl6ZXIuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi8uLi8uLi8uLi9wYWNrYWdlcy9jb21waWxlci9zcmMvcHJvdmlkZXJfYW5hbHl6ZXIudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUE7Ozs7OztHQU1HOzs7Ozs7Ozs7Ozs7OztJQUdILDJFQUFnUTtJQUVoUSxpRUFBMkU7SUFDM0UsK0RBQXlEO0lBQ3pELG1GQUE2SDtJQUU3SDtRQUFtQyx5Q0FBVTtRQUMzQyx1QkFBWSxPQUFlLEVBQUUsSUFBcUI7bUJBQ2hELGtCQUFNLElBQUksRUFBRSxPQUFPLENBQUM7UUFDdEIsQ0FBQztRQUNILG9CQUFDO0lBQUQsQ0FBQyxBQUpELENBQW1DLHVCQUFVLEdBSTVDO0lBSlksc0NBQWE7SUFXMUI7UUFXRSw2QkFBbUIsU0FBMkIsRUFBUyxTQUFtQztZQUExRixpQkFRQztZQVJrQixjQUFTLEdBQVQsU0FBUyxDQUFrQjtZQUFTLGNBQVMsR0FBVCxTQUFTLENBQTBCO1lBRjFGLFdBQU0sR0FBb0IsRUFBRSxDQUFDO1lBRzNCLElBQUksQ0FBQyxXQUFXLEdBQUcsZUFBZSxDQUFDLFNBQVMsQ0FBQyxDQUFDO1lBQ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