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