2016-06-23 12:47:54 -04:00
|
|
|
/**
|
|
|
|
* @license
|
|
|
|
* Copyright Google Inc. All Rights Reserved.
|
|
|
|
*
|
|
|
|
* Use of this source code is governed by an MIT-style license that can be
|
|
|
|
* found in the LICENSE file at https://angular.io/license
|
|
|
|
*/
|
|
|
|
|
2016-06-28 12:54:42 -04:00
|
|
|
import {AnimationAnimateMetadata, AnimationEntryMetadata, AnimationGroupMetadata, AnimationKeyframesSequenceMetadata, AnimationMetadata, AnimationStateDeclarationMetadata, AnimationStateMetadata, AnimationStateTransitionMetadata, AnimationStyleMetadata, AnimationWithStepsMetadata, AppModuleMetadata, AttributeMetadata, ComponentMetadata, HostMetadata, Inject, InjectMetadata, Injectable, Optional, OptionalMetadata, Provider, QueryMetadata, SelfMetadata, SkipSelfMetadata, ViewMetadata, ViewQueryMetadata, resolveForwardRef} from '@angular/core';
|
2016-06-08 19:38:52 -04:00
|
|
|
|
|
|
|
import {LIFECYCLE_HOOKS_VALUES, ReflectorReader, createProvider, isProviderLiteral, reflector} from '../core_private';
|
2016-04-28 20:50:03 -04:00
|
|
|
import {StringMapWrapper} from '../src/facade/collection';
|
|
|
|
import {BaseException} from '../src/facade/exceptions';
|
2016-06-08 19:38:52 -04:00
|
|
|
import {Type, isArray, isBlank, isPresent, isString, isStringMap, stringify} from '../src/facade/lang';
|
|
|
|
|
2016-06-20 12:52:41 -04:00
|
|
|
import {assertArrayOfStrings, assertInterpolationSymbols} from './assertions';
|
2016-01-06 17:13:44 -05:00
|
|
|
import * as cpl from './compile_metadata';
|
2016-06-13 11:35:31 -04:00
|
|
|
import {CompilerConfig} from './config';
|
2016-06-08 19:38:52 -04:00
|
|
|
import {hasLifecycleHook} from './directive_lifecycle_reflector';
|
2016-01-06 17:13:44 -05:00
|
|
|
import {DirectiveResolver} from './directive_resolver';
|
2016-07-07 13:05:55 -04:00
|
|
|
import {Identifiers, identifierToken} from './identifiers';
|
2016-01-06 17:13:44 -05:00
|
|
|
import {PipeResolver} from './pipe_resolver';
|
2016-04-28 20:50:03 -04:00
|
|
|
import {getUrlScheme} from './url_resolver';
|
2016-06-08 19:38:52 -04:00
|
|
|
import {MODULE_SUFFIX, ValueTransformer, sanitizeIdentifier, visitValue} from './util';
|
|
|
|
import {ViewResolver} from './view_resolver';
|
2016-04-28 20:50:03 -04:00
|
|
|
|
2015-09-14 18:59:09 -04:00
|
|
|
@Injectable()
|
2016-02-18 13:53:21 -05:00
|
|
|
export class CompileMetadataResolver {
|
2015-12-02 13:35:51 -05:00
|
|
|
private _directiveCache = new Map<Type, cpl.CompileDirectiveMetadata>();
|
|
|
|
private _pipeCache = new Map<Type, cpl.CompilePipeMetadata>();
|
2016-06-28 12:54:42 -04:00
|
|
|
private _appModuleCache = new Map<Type, cpl.CompileAppModuleMetadata>();
|
2016-03-29 20:15:07 -04:00
|
|
|
private _anonymousTypes = new Map<Object, number>();
|
|
|
|
private _anonymousTypeIndex = 0;
|
2015-09-14 18:59:09 -04:00
|
|
|
|
2016-06-08 19:38:52 -04:00
|
|
|
constructor(
|
|
|
|
private _directiveResolver: DirectiveResolver, private _pipeResolver: PipeResolver,
|
2016-06-13 11:35:31 -04:00
|
|
|
private _viewResolver: ViewResolver, private _config: CompilerConfig,
|
2016-06-17 13:57:50 -04:00
|
|
|
private _reflector: ReflectorReader = reflector) {}
|
2015-09-14 18:59:09 -04:00
|
|
|
|
2016-04-20 21:10:19 -04:00
|
|
|
private sanitizeTokenName(token: any): string {
|
|
|
|
let identifier = stringify(token);
|
|
|
|
if (identifier.indexOf('(') >= 0) {
|
|
|
|
// case: anonymous functions!
|
|
|
|
let found = this._anonymousTypes.get(token);
|
|
|
|
if (isBlank(found)) {
|
|
|
|
this._anonymousTypes.set(token, this._anonymousTypeIndex++);
|
|
|
|
found = this._anonymousTypes.get(token);
|
|
|
|
}
|
|
|
|
identifier = `anonymous_token_${found}_`;
|
2016-03-29 20:15:07 -04:00
|
|
|
}
|
2016-04-20 21:10:19 -04:00
|
|
|
return sanitizeIdentifier(identifier);
|
2016-03-29 20:15:07 -04:00
|
|
|
}
|
|
|
|
|
2016-06-28 12:54:42 -04:00
|
|
|
clearCacheFor(type: Type) {
|
|
|
|
this._directiveCache.delete(type);
|
|
|
|
this._pipeCache.delete(type);
|
|
|
|
this._appModuleCache.delete(type);
|
2016-06-24 11:46:43 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
clearCache() {
|
|
|
|
this._directiveCache.clear();
|
|
|
|
this._pipeCache.clear();
|
2016-06-28 12:54:42 -04:00
|
|
|
this._appModuleCache.clear();
|
2016-06-24 11:46:43 -04:00
|
|
|
}
|
|
|
|
|
2016-05-26 18:07:51 -04:00
|
|
|
getAnimationEntryMetadata(entry: AnimationEntryMetadata): cpl.CompileAnimationEntryMetadata {
|
2016-05-25 15:46:22 -04:00
|
|
|
var defs = entry.definitions.map(def => this.getAnimationStateMetadata(def));
|
|
|
|
return new cpl.CompileAnimationEntryMetadata(entry.name, defs);
|
|
|
|
}
|
|
|
|
|
2016-05-26 18:07:51 -04:00
|
|
|
getAnimationStateMetadata(value: AnimationStateMetadata): cpl.CompileAnimationStateMetadata {
|
|
|
|
if (value instanceof AnimationStateDeclarationMetadata) {
|
2016-05-25 15:46:22 -04:00
|
|
|
var styles = this.getAnimationStyleMetadata(value.styles);
|
|
|
|
return new cpl.CompileAnimationStateDeclarationMetadata(value.stateNameExpr, styles);
|
2016-05-26 18:07:51 -04:00
|
|
|
} else if (value instanceof AnimationStateTransitionMetadata) {
|
2016-06-08 19:38:52 -04:00
|
|
|
return new cpl.CompileAnimationStateTransitionMetadata(
|
|
|
|
value.stateChangeExpr, this.getAnimationMetadata(value.steps));
|
2016-05-25 15:46:22 -04:00
|
|
|
}
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
|
2016-05-26 18:07:51 -04:00
|
|
|
getAnimationStyleMetadata(value: AnimationStyleMetadata): cpl.CompileAnimationStyleMetadata {
|
2016-05-25 15:46:22 -04:00
|
|
|
return new cpl.CompileAnimationStyleMetadata(value.offset, value.styles);
|
|
|
|
}
|
|
|
|
|
2016-05-26 18:07:51 -04:00
|
|
|
getAnimationMetadata(value: AnimationMetadata): cpl.CompileAnimationMetadata {
|
|
|
|
if (value instanceof AnimationStyleMetadata) {
|
2016-05-25 15:46:22 -04:00
|
|
|
return this.getAnimationStyleMetadata(value);
|
2016-05-26 18:07:51 -04:00
|
|
|
} else if (value instanceof AnimationKeyframesSequenceMetadata) {
|
2016-06-08 19:38:52 -04:00
|
|
|
return new cpl.CompileAnimationKeyframesSequenceMetadata(
|
|
|
|
value.steps.map(entry => this.getAnimationStyleMetadata(entry)));
|
2016-05-26 18:07:51 -04:00
|
|
|
} else if (value instanceof AnimationAnimateMetadata) {
|
2016-06-08 19:38:52 -04:00
|
|
|
let animateData =
|
|
|
|
<cpl.CompileAnimationStyleMetadata|cpl.CompileAnimationKeyframesSequenceMetadata>this
|
|
|
|
.getAnimationMetadata(value.styles);
|
2016-05-25 15:46:22 -04:00
|
|
|
return new cpl.CompileAnimationAnimateMetadata(value.timings, animateData);
|
2016-05-26 18:07:51 -04:00
|
|
|
} else if (value instanceof AnimationWithStepsMetadata) {
|
2016-05-25 15:46:22 -04:00
|
|
|
var steps = value.steps.map(step => this.getAnimationMetadata(step));
|
2016-05-26 18:07:51 -04:00
|
|
|
if (value instanceof AnimationGroupMetadata) {
|
2016-05-25 15:46:22 -04:00
|
|
|
return new cpl.CompileAnimationGroupMetadata(steps);
|
|
|
|
} else {
|
|
|
|
return new cpl.CompileAnimationSequenceMetadata(steps);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
|
2015-12-02 13:35:51 -05:00
|
|
|
getDirectiveMetadata(directiveType: Type): cpl.CompileDirectiveMetadata {
|
2016-06-28 12:54:42 -04:00
|
|
|
directiveType = resolveForwardRef(directiveType);
|
2015-12-02 13:35:51 -05:00
|
|
|
var meta = this._directiveCache.get(directiveType);
|
2015-09-14 18:59:09 -04:00
|
|
|
if (isBlank(meta)) {
|
2015-10-23 18:55:48 -04:00
|
|
|
var dirMeta = this._directiveResolver.resolve(directiveType);
|
2016-06-12 00:23:37 -04:00
|
|
|
var templateMeta: cpl.CompileTemplateMetadata = null;
|
2016-06-08 18:45:15 -04:00
|
|
|
var changeDetectionStrategy: any /** TODO #9100 */ = null;
|
|
|
|
var viewProviders: any[] /** TODO #9100 */ = [];
|
2016-05-02 19:45:43 -04:00
|
|
|
var moduleUrl = staticTypeModuleUrl(directiveType);
|
2016-06-22 17:06:23 -04:00
|
|
|
var precompileTypes: cpl.CompileTypeMetadata[] = [];
|
2016-04-28 20:50:03 -04:00
|
|
|
if (dirMeta instanceof ComponentMetadata) {
|
|
|
|
var cmpMeta = <ComponentMetadata>dirMeta;
|
2015-10-23 18:55:48 -04:00
|
|
|
var viewMeta = this._viewResolver.resolve(directiveType);
|
2016-03-09 17:55:27 -05:00
|
|
|
assertArrayOfStrings('styles', viewMeta.styles);
|
2016-06-20 12:52:41 -04:00
|
|
|
assertInterpolationSymbols('interpolation', viewMeta.interpolation);
|
2016-06-08 19:38:52 -04:00
|
|
|
var animations = isPresent(viewMeta.animations) ?
|
|
|
|
viewMeta.animations.map(e => this.getAnimationEntryMetadata(e)) :
|
|
|
|
null;
|
2016-06-24 11:46:43 -04:00
|
|
|
assertArrayOfStrings('styles', viewMeta.styles);
|
|
|
|
assertArrayOfStrings('styleUrls', viewMeta.styleUrls);
|
2016-05-25 15:46:22 -04:00
|
|
|
|
2015-09-18 13:33:23 -04:00
|
|
|
templateMeta = new cpl.CompileTemplateMetadata({
|
2015-10-23 18:55:48 -04:00
|
|
|
encapsulation: viewMeta.encapsulation,
|
|
|
|
template: viewMeta.template,
|
|
|
|
templateUrl: viewMeta.templateUrl,
|
|
|
|
styles: viewMeta.styles,
|
2016-05-25 15:46:22 -04:00
|
|
|
styleUrls: viewMeta.styleUrls,
|
2016-06-20 12:52:41 -04:00
|
|
|
animations: animations,
|
|
|
|
interpolation: viewMeta.interpolation
|
2015-09-14 18:59:09 -04:00
|
|
|
});
|
2015-10-23 18:55:48 -04:00
|
|
|
changeDetectionStrategy = cmpMeta.changeDetection;
|
2016-01-06 17:13:44 -05:00
|
|
|
if (isPresent(dirMeta.viewProviders)) {
|
2016-06-21 20:27:27 -04:00
|
|
|
viewProviders = this.getProvidersMetadata(
|
2016-07-07 13:05:55 -04:00
|
|
|
verifyNonBlankProviders(directiveType, dirMeta.viewProviders, 'viewProviders'), []);
|
2016-01-06 17:13:44 -05:00
|
|
|
}
|
2016-05-02 19:45:43 -04:00
|
|
|
moduleUrl = componentModuleUrl(this._reflector, directiveType, cmpMeta);
|
2016-06-22 17:06:23 -04:00
|
|
|
if (cmpMeta.precompile) {
|
|
|
|
precompileTypes = flattenArray(cmpMeta.precompile)
|
|
|
|
.map((cmp) => this.getTypeMetadata(cmp, staticTypeModuleUrl(cmp)));
|
|
|
|
}
|
2016-01-06 17:13:44 -05:00
|
|
|
}
|
|
|
|
|
2016-06-08 18:45:15 -04:00
|
|
|
var providers: any[] /** TODO #9100 */ = [];
|
2016-01-06 17:13:44 -05:00
|
|
|
if (isPresent(dirMeta.providers)) {
|
2016-06-21 20:27:27 -04:00
|
|
|
providers = this.getProvidersMetadata(
|
2016-07-07 13:05:55 -04:00
|
|
|
verifyNonBlankProviders(directiveType, dirMeta.providers, 'providers'),
|
|
|
|
precompileTypes);
|
2016-01-06 17:13:44 -05:00
|
|
|
}
|
2016-07-07 13:05:55 -04:00
|
|
|
var queries: cpl.CompileQueryMetadata[] = [];
|
|
|
|
var viewQueries: cpl.CompileQueryMetadata[] = [];
|
2016-01-06 17:13:44 -05:00
|
|
|
if (isPresent(dirMeta.queries)) {
|
2016-06-04 22:46:03 -04:00
|
|
|
queries = this.getQueriesMetadata(dirMeta.queries, false, directiveType);
|
|
|
|
viewQueries = this.getQueriesMetadata(dirMeta.queries, true, directiveType);
|
2015-09-14 18:59:09 -04:00
|
|
|
}
|
2015-09-18 13:33:23 -04:00
|
|
|
meta = cpl.CompileDirectiveMetadata.create({
|
2015-10-23 18:55:48 -04:00
|
|
|
selector: dirMeta.selector,
|
|
|
|
exportAs: dirMeta.exportAs,
|
2015-09-14 18:59:09 -04:00
|
|
|
isComponent: isPresent(templateMeta),
|
2016-05-02 19:45:43 -04:00
|
|
|
type: this.getTypeMetadata(directiveType, moduleUrl),
|
2015-09-14 18:59:09 -04:00
|
|
|
template: templateMeta,
|
2015-09-18 13:33:23 -04:00
|
|
|
changeDetection: changeDetectionStrategy,
|
2015-10-23 18:55:48 -04:00
|
|
|
inputs: dirMeta.inputs,
|
|
|
|
outputs: dirMeta.outputs,
|
|
|
|
host: dirMeta.host,
|
2016-01-06 17:13:44 -05:00
|
|
|
lifecycleHooks:
|
|
|
|
LIFECYCLE_HOOKS_VALUES.filter(hook => hasLifecycleHook(hook, directiveType)),
|
|
|
|
providers: providers,
|
|
|
|
viewProviders: viewProviders,
|
|
|
|
queries: queries,
|
2016-06-22 17:06:23 -04:00
|
|
|
viewQueries: viewQueries,
|
|
|
|
precompile: precompileTypes
|
2015-09-14 18:59:09 -04:00
|
|
|
});
|
2015-12-02 13:35:51 -05:00
|
|
|
this._directiveCache.set(directiveType, meta);
|
|
|
|
}
|
|
|
|
return meta;
|
|
|
|
}
|
|
|
|
|
2016-06-28 12:54:42 -04:00
|
|
|
getAppModuleMetadata(moduleType: any, meta: AppModuleMetadata = null):
|
|
|
|
cpl.CompileAppModuleMetadata {
|
|
|
|
// Only cache if we read the metadata via the reflector,
|
|
|
|
// as we use the moduleType as cache key.
|
|
|
|
let useCache = !meta;
|
|
|
|
moduleType = resolveForwardRef(moduleType);
|
|
|
|
var compileMeta = this._appModuleCache.get(moduleType);
|
|
|
|
if (isBlank(compileMeta) || !useCache) {
|
|
|
|
if (!meta) {
|
|
|
|
meta = this._reflector.annotations(moduleType)
|
|
|
|
.find((meta) => meta instanceof AppModuleMetadata);
|
|
|
|
}
|
|
|
|
if (!meta) {
|
|
|
|
throw new BaseException(
|
|
|
|
`Could not compile '${stringify(moduleType)}' because it is not an AppModule.`);
|
|
|
|
}
|
feat(browser): use AppModules for bootstrap in the browser
This introduces the `BrowserModule` to be used for long form
bootstrap and offline compile bootstrap:
```
@AppModule({
modules: [BrowserModule],
precompile: [MainComponent],
providers: […], // additional providers
directives: […], // additional platform directives
pipes: […] // additional platform pipes
})
class MyModule {
constructor(appRef: ApplicationRef) {
appRef.bootstrap(MainComponent);
}
}
// offline compile
import {bootstrapModuleFactory} from ‘@angular/platform-browser’;
bootstrapModuleFactory(MyModuleNgFactory);
// runtime compile long form
import {bootstrapModule} from ‘@angular/platform-browser-dynamic’;
bootstrapModule(MyModule);
```
The short form, `bootstrap(...)`, can now creates a module on the fly,
given `directives`, `pipes, `providers`, `precompile` and `modules`
properties.
Related changes:
- make `SanitizationService`, `SecurityContext` public in `@angular/core` so that the offline compiler can resolve the token
- move `AnimationDriver` to `platform-browser` and make it
public so that the offline compiler can resolve the token
BREAKING CHANGES:
- short form bootstrap does no longer allow
to inject compiler internals (i.e. everything
from `@angular/compiler). Inject `Compiler` instead.
To provide custom providers for the compiler,
create a custom compiler via `browserCompiler({providers: [...]})`
and pass that into the `bootstrap` method.
2016-06-30 16:07:17 -04:00
|
|
|
let modules: cpl.CompileTypeMetadata[] = [];
|
2016-06-28 12:54:42 -04:00
|
|
|
let providers: any[] = [];
|
feat(browser): use AppModules for bootstrap in the browser
This introduces the `BrowserModule` to be used for long form
bootstrap and offline compile bootstrap:
```
@AppModule({
modules: [BrowserModule],
precompile: [MainComponent],
providers: […], // additional providers
directives: […], // additional platform directives
pipes: […] // additional platform pipes
})
class MyModule {
constructor(appRef: ApplicationRef) {
appRef.bootstrap(MainComponent);
}
}
// offline compile
import {bootstrapModuleFactory} from ‘@angular/platform-browser’;
bootstrapModuleFactory(MyModuleNgFactory);
// runtime compile long form
import {bootstrapModule} from ‘@angular/platform-browser-dynamic’;
bootstrapModule(MyModule);
```
The short form, `bootstrap(...)`, can now creates a module on the fly,
given `directives`, `pipes, `providers`, `precompile` and `modules`
properties.
Related changes:
- make `SanitizationService`, `SecurityContext` public in `@angular/core` so that the offline compiler can resolve the token
- move `AnimationDriver` to `platform-browser` and make it
public so that the offline compiler can resolve the token
BREAKING CHANGES:
- short form bootstrap does no longer allow
to inject compiler internals (i.e. everything
from `@angular/compiler). Inject `Compiler` instead.
To provide custom providers for the compiler,
create a custom compiler via `browserCompiler({providers: [...]})`
and pass that into the `bootstrap` method.
2016-06-30 16:07:17 -04:00
|
|
|
let directives: cpl.CompileTypeMetadata[] = [];
|
|
|
|
let pipes: cpl.CompileTypeMetadata[] = [];
|
|
|
|
let precompile: cpl.CompileTypeMetadata[] = [];
|
|
|
|
if (meta.modules) {
|
|
|
|
flattenArray(meta.modules).forEach((moduleType) => {
|
|
|
|
var meta = this.getAppModuleMetadata(moduleType);
|
|
|
|
providers.push(...meta.providers);
|
|
|
|
directives.push(...meta.directives);
|
|
|
|
pipes.push(...meta.pipes);
|
|
|
|
precompile.push(...meta.precompile);
|
|
|
|
modules.push(meta.type);
|
|
|
|
modules.push(...meta.modules);
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
2016-06-28 12:54:42 -04:00
|
|
|
if (meta.providers) {
|
2016-07-07 13:05:55 -04:00
|
|
|
providers.push(...this.getProvidersMetadata(meta.providers, precompile));
|
2016-06-28 12:54:42 -04:00
|
|
|
}
|
|
|
|
if (meta.directives) {
|
|
|
|
directives.push(...flattenArray(meta.directives)
|
|
|
|
.map(type => this.getTypeMetadata(type, staticTypeModuleUrl(type))));
|
|
|
|
}
|
|
|
|
if (meta.pipes) {
|
|
|
|
pipes.push(...flattenArray(meta.pipes)
|
|
|
|
.map(type => this.getTypeMetadata(type, staticTypeModuleUrl(type))));
|
|
|
|
}
|
|
|
|
if (meta.precompile) {
|
|
|
|
precompile.push(...flattenArray(meta.precompile)
|
|
|
|
.map(type => this.getTypeMetadata(type, staticTypeModuleUrl(type))));
|
|
|
|
}
|
|
|
|
|
|
|
|
compileMeta = new cpl.CompileAppModuleMetadata({
|
|
|
|
type: this.getTypeMetadata(moduleType, staticTypeModuleUrl(moduleType)),
|
|
|
|
providers: providers,
|
|
|
|
directives: directives,
|
|
|
|
pipes: pipes,
|
|
|
|
precompile: precompile,
|
|
|
|
modules: modules
|
|
|
|
});
|
|
|
|
if (useCache) {
|
|
|
|
this._appModuleCache.set(moduleType, compileMeta);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return compileMeta;
|
|
|
|
}
|
|
|
|
|
2016-02-18 13:53:21 -05:00
|
|
|
/**
|
|
|
|
* @param someType a symbol which may or may not be a directive type
|
|
|
|
* @returns {cpl.CompileDirectiveMetadata} if possible, otherwise null.
|
|
|
|
*/
|
|
|
|
maybeGetDirectiveMetadata(someType: Type): cpl.CompileDirectiveMetadata {
|
|
|
|
try {
|
|
|
|
return this.getDirectiveMetadata(someType);
|
|
|
|
} catch (e) {
|
|
|
|
if (e.message.indexOf('No Directive annotation') !== -1) {
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
throw e;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2016-06-18 12:42:34 -04:00
|
|
|
getTypeMetadata(type: Type, moduleUrl: string, dependencies: any[] = null):
|
|
|
|
cpl.CompileTypeMetadata {
|
2016-06-28 12:54:42 -04:00
|
|
|
type = resolveForwardRef(type);
|
2016-01-06 17:13:44 -05:00
|
|
|
return new cpl.CompileTypeMetadata({
|
2016-04-20 21:10:19 -04:00
|
|
|
name: this.sanitizeTokenName(type),
|
2016-01-06 17:13:44 -05:00
|
|
|
moduleUrl: moduleUrl,
|
|
|
|
runtime: type,
|
2016-06-18 12:42:34 -04:00
|
|
|
diDeps: this.getDependenciesMetadata(type, dependencies)
|
2016-01-06 17:13:44 -05:00
|
|
|
});
|
|
|
|
}
|
|
|
|
|
2016-06-18 12:42:34 -04:00
|
|
|
getFactoryMetadata(factory: Function, moduleUrl: string, dependencies: any[] = null):
|
|
|
|
cpl.CompileFactoryMetadata {
|
2016-06-28 12:54:42 -04:00
|
|
|
factory = resolveForwardRef(factory);
|
2016-01-06 17:13:44 -05:00
|
|
|
return new cpl.CompileFactoryMetadata({
|
2016-04-20 21:10:19 -04:00
|
|
|
name: this.sanitizeTokenName(factory),
|
2016-01-06 17:13:44 -05:00
|
|
|
moduleUrl: moduleUrl,
|
|
|
|
runtime: factory,
|
2016-06-18 12:42:34 -04:00
|
|
|
diDeps: this.getDependenciesMetadata(factory, dependencies)
|
2016-01-06 17:13:44 -05:00
|
|
|
});
|
|
|
|
}
|
|
|
|
|
2015-12-02 13:35:51 -05:00
|
|
|
getPipeMetadata(pipeType: Type): cpl.CompilePipeMetadata {
|
2016-06-28 12:54:42 -04:00
|
|
|
pipeType = resolveForwardRef(pipeType);
|
2015-12-02 13:35:51 -05:00
|
|
|
var meta = this._pipeCache.get(pipeType);
|
|
|
|
if (isBlank(meta)) {
|
|
|
|
var pipeMeta = this._pipeResolver.resolve(pipeType);
|
|
|
|
meta = new cpl.CompilePipeMetadata({
|
2016-02-18 13:53:21 -05:00
|
|
|
type: this.getTypeMetadata(pipeType, staticTypeModuleUrl(pipeType)),
|
2015-12-02 13:35:51 -05:00
|
|
|
name: pipeMeta.name,
|
2016-01-06 17:13:44 -05:00
|
|
|
pure: pipeMeta.pure,
|
|
|
|
lifecycleHooks: LIFECYCLE_HOOKS_VALUES.filter(hook => hasLifecycleHook(hook, pipeType)),
|
2015-12-02 13:35:51 -05:00
|
|
|
});
|
|
|
|
this._pipeCache.set(pipeType, meta);
|
2015-09-14 18:59:09 -04:00
|
|
|
}
|
|
|
|
return meta;
|
|
|
|
}
|
|
|
|
|
2015-09-18 13:33:23 -04:00
|
|
|
getViewDirectivesMetadata(component: Type): cpl.CompileDirectiveMetadata[] {
|
2015-09-14 18:59:09 -04:00
|
|
|
var view = this._viewResolver.resolve(component);
|
2016-06-13 11:35:31 -04:00
|
|
|
var directives = flattenDirectives(view, this._config.platformDirectives);
|
2015-09-14 18:59:09 -04:00
|
|
|
for (var i = 0; i < directives.length; i++) {
|
2015-12-02 13:35:51 -05:00
|
|
|
if (!isValidType(directives[i])) {
|
2015-09-14 18:59:09 -04:00
|
|
|
throw new BaseException(
|
|
|
|
`Unexpected directive value '${stringify(directives[i])}' on the View of component '${stringify(component)}'`);
|
|
|
|
}
|
|
|
|
}
|
2015-12-02 13:35:51 -05:00
|
|
|
return directives.map(type => this.getDirectiveMetadata(type));
|
|
|
|
}
|
|
|
|
|
|
|
|
getViewPipesMetadata(component: Type): cpl.CompilePipeMetadata[] {
|
|
|
|
var view = this._viewResolver.resolve(component);
|
2016-06-13 11:35:31 -04:00
|
|
|
var pipes = flattenPipes(view, this._config.platformPipes);
|
2015-12-02 13:35:51 -05:00
|
|
|
for (var i = 0; i < pipes.length; i++) {
|
|
|
|
if (!isValidType(pipes[i])) {
|
|
|
|
throw new BaseException(
|
|
|
|
`Unexpected piped value '${stringify(pipes[i])}' on the View of component '${stringify(component)}'`);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return pipes.map(type => this.getPipeMetadata(type));
|
2015-09-14 18:59:09 -04:00
|
|
|
}
|
2016-01-06 17:13:44 -05:00
|
|
|
|
2016-06-08 19:38:52 -04:00
|
|
|
getDependenciesMetadata(typeOrFunc: Type|Function, dependencies: any[]):
|
|
|
|
cpl.CompileDiDependencyMetadata[] {
|
2016-06-09 19:07:06 -04:00
|
|
|
let hasUnknownDeps = false;
|
2016-02-18 13:53:21 -05:00
|
|
|
let params = isPresent(dependencies) ? dependencies : this._reflector.parameters(typeOrFunc);
|
|
|
|
if (isBlank(params)) {
|
|
|
|
params = [];
|
2016-01-06 17:13:44 -05:00
|
|
|
}
|
2016-06-09 19:07:06 -04:00
|
|
|
let dependenciesMetadata: cpl.CompileDiDependencyMetadata[] = params.map((param) => {
|
2016-02-18 13:53:21 -05:00
|
|
|
let isAttribute = false;
|
|
|
|
let isHost = false;
|
|
|
|
let isSelf = false;
|
|
|
|
let isSkipSelf = false;
|
|
|
|
let isOptional = false;
|
2016-04-28 20:50:03 -04:00
|
|
|
let query: QueryMetadata = null;
|
|
|
|
let viewQuery: ViewQueryMetadata = null;
|
2016-06-17 13:57:50 -04:00
|
|
|
var token: any = null;
|
2016-02-18 13:53:21 -05:00
|
|
|
if (isArray(param)) {
|
2016-06-08 19:38:52 -04:00
|
|
|
(<any[]>param).forEach((paramEntry) => {
|
|
|
|
if (paramEntry instanceof HostMetadata) {
|
|
|
|
isHost = true;
|
|
|
|
} else if (paramEntry instanceof SelfMetadata) {
|
|
|
|
isSelf = true;
|
|
|
|
} else if (paramEntry instanceof SkipSelfMetadata) {
|
|
|
|
isSkipSelf = true;
|
|
|
|
} else if (paramEntry instanceof OptionalMetadata) {
|
|
|
|
isOptional = true;
|
|
|
|
} else if (paramEntry instanceof AttributeMetadata) {
|
|
|
|
isAttribute = true;
|
|
|
|
token = paramEntry.attributeName;
|
|
|
|
} else if (paramEntry instanceof QueryMetadata) {
|
|
|
|
if (paramEntry.isViewQuery) {
|
|
|
|
viewQuery = paramEntry;
|
|
|
|
} else {
|
|
|
|
query = paramEntry;
|
|
|
|
}
|
|
|
|
} else if (paramEntry instanceof InjectMetadata) {
|
|
|
|
token = paramEntry.token;
|
|
|
|
} else if (isValidType(paramEntry) && isBlank(token)) {
|
|
|
|
token = paramEntry;
|
|
|
|
}
|
|
|
|
});
|
2016-01-06 17:13:44 -05:00
|
|
|
} else {
|
2016-02-18 13:53:21 -05:00
|
|
|
token = param;
|
2016-01-06 17:13:44 -05:00
|
|
|
}
|
2016-02-18 13:53:21 -05:00
|
|
|
if (isBlank(token)) {
|
2016-06-09 19:07:06 -04:00
|
|
|
hasUnknownDeps = true;
|
2016-02-18 13:53:21 -05:00
|
|
|
return null;
|
2016-01-06 17:13:44 -05:00
|
|
|
}
|
|
|
|
return new cpl.CompileDiDependencyMetadata({
|
|
|
|
isAttribute: isAttribute,
|
2016-02-18 13:53:21 -05:00
|
|
|
isHost: isHost,
|
|
|
|
isSelf: isSelf,
|
|
|
|
isSkipSelf: isSkipSelf,
|
|
|
|
isOptional: isOptional,
|
2016-06-04 22:46:03 -04:00
|
|
|
query: isPresent(query) ? this.getQueryMetadata(query, null, typeOrFunc) : null,
|
|
|
|
viewQuery: isPresent(viewQuery) ? this.getQueryMetadata(viewQuery, null, typeOrFunc) : null,
|
2016-02-18 13:53:21 -05:00
|
|
|
token: this.getTokenMetadata(token)
|
2016-01-06 17:13:44 -05:00
|
|
|
});
|
2016-02-18 13:53:21 -05:00
|
|
|
|
2016-01-06 17:13:44 -05:00
|
|
|
});
|
2016-06-09 19:07:06 -04:00
|
|
|
|
|
|
|
if (hasUnknownDeps) {
|
2016-06-08 19:38:52 -04:00
|
|
|
let depsTokens =
|
|
|
|
dependenciesMetadata.map((dep) => { return dep ? stringify(dep.token) : '?'; })
|
|
|
|
.join(', ');
|
|
|
|
throw new BaseException(
|
|
|
|
`Can't resolve all parameters for ${stringify(typeOrFunc)}: (${depsTokens}).`);
|
2016-06-09 19:07:06 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
return dependenciesMetadata;
|
2016-01-06 17:13:44 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
getTokenMetadata(token: any): cpl.CompileTokenMetadata {
|
|
|
|
token = resolveForwardRef(token);
|
2016-06-08 18:45:15 -04:00
|
|
|
var compileToken: any /** TODO #9100 */;
|
2016-01-06 17:13:44 -05:00
|
|
|
if (isString(token)) {
|
|
|
|
compileToken = new cpl.CompileTokenMetadata({value: token});
|
|
|
|
} else {
|
2016-04-20 21:10:19 -04:00
|
|
|
compileToken = new cpl.CompileTokenMetadata({
|
2016-02-18 13:53:21 -05:00
|
|
|
identifier: new cpl.CompileIdentifierMetadata({
|
|
|
|
runtime: token,
|
|
|
|
name: this.sanitizeTokenName(token),
|
|
|
|
moduleUrl: staticTypeModuleUrl(token)
|
|
|
|
})
|
2016-04-20 21:10:19 -04:00
|
|
|
});
|
2016-01-06 17:13:44 -05:00
|
|
|
}
|
|
|
|
return compileToken;
|
|
|
|
}
|
|
|
|
|
2016-07-07 13:05:55 -04:00
|
|
|
getProvidersMetadata(providers: any[], targetPrecompileComponents: cpl.CompileTypeMetadata[]):
|
2016-06-08 19:38:52 -04:00
|
|
|
Array<cpl.CompileProviderMetadata|cpl.CompileTypeMetadata|any[]> {
|
2016-07-07 13:05:55 -04:00
|
|
|
const compileProviders: Array<cpl.CompileProviderMetadata|cpl.CompileTypeMetadata|any[]> = [];
|
|
|
|
providers.forEach((provider) => {
|
2016-01-06 17:13:44 -05:00
|
|
|
provider = resolveForwardRef(provider);
|
2016-07-07 13:05:55 -04:00
|
|
|
if (isProviderLiteral(provider)) {
|
|
|
|
provider = createProvider(provider);
|
|
|
|
}
|
|
|
|
let compileProvider: cpl.CompileProviderMetadata|cpl.CompileTypeMetadata|any[];
|
2016-01-06 17:13:44 -05:00
|
|
|
if (isArray(provider)) {
|
2016-07-07 13:05:55 -04:00
|
|
|
compileProvider = this.getProvidersMetadata(provider, targetPrecompileComponents);
|
2016-01-06 17:13:44 -05:00
|
|
|
} else if (provider instanceof Provider) {
|
2016-07-07 13:05:55 -04:00
|
|
|
let tokenMeta = this.getTokenMetadata(provider.token);
|
|
|
|
if (tokenMeta.equalsTo(identifierToken(Identifiers.ANALYZE_FOR_PRECOMPILE))) {
|
|
|
|
targetPrecompileComponents.push(...this.getPrecompileComponentsFromProvider(provider));
|
|
|
|
} else {
|
|
|
|
compileProvider = this.getProviderMetadata(provider);
|
|
|
|
}
|
2016-06-28 12:54:42 -04:00
|
|
|
} else if (isValidType(provider)) {
|
2016-07-07 13:05:55 -04:00
|
|
|
compileProvider = this.getTypeMetadata(provider, staticTypeModuleUrl(provider));
|
2016-06-28 12:54:42 -04:00
|
|
|
} else {
|
|
|
|
throw new BaseException(
|
|
|
|
`Invalid provider - only instances of Provider and Type are allowed, got: ${stringify(provider)}`);
|
2016-01-06 17:13:44 -05:00
|
|
|
}
|
2016-07-07 13:05:55 -04:00
|
|
|
if (compileProvider) {
|
|
|
|
compileProviders.push(compileProvider);
|
|
|
|
}
|
|
|
|
});
|
|
|
|
return compileProviders;
|
|
|
|
}
|
|
|
|
|
|
|
|
getPrecompileComponentsFromProvider(provider: Provider): cpl.CompileTypeMetadata[] {
|
|
|
|
let components: cpl.CompileTypeMetadata[] = [];
|
|
|
|
let collectedIdentifiers: cpl.CompileIdentifierMetadata[] = [];
|
|
|
|
if (provider.useFactory || provider.useExisting || provider.useClass) {
|
|
|
|
throw new BaseException(`The ANALYZE_FOR_PRECOMPILE token only supports useValue!`);
|
|
|
|
}
|
|
|
|
if (!provider.multi) {
|
|
|
|
throw new BaseException(`The ANALYZE_FOR_PRECOMPILE token only supports 'multi = true'!`);
|
|
|
|
}
|
|
|
|
convertToCompileValue(provider.useValue, collectedIdentifiers);
|
|
|
|
collectedIdentifiers.forEach((identifier) => {
|
|
|
|
let dirMeta = this.maybeGetDirectiveMetadata(identifier.runtime);
|
|
|
|
if (dirMeta) {
|
|
|
|
components.push(dirMeta.type);
|
|
|
|
}
|
2016-01-06 17:13:44 -05:00
|
|
|
});
|
2016-07-07 13:05:55 -04:00
|
|
|
return components;
|
2016-01-06 17:13:44 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
getProviderMetadata(provider: Provider): cpl.CompileProviderMetadata {
|
2016-06-18 12:42:34 -04:00
|
|
|
var compileDeps: cpl.CompileDiDependencyMetadata[];
|
|
|
|
var compileTypeMetadata: cpl.CompileTypeMetadata = null;
|
|
|
|
var compileFactoryMetadata: cpl.CompileFactoryMetadata = null;
|
|
|
|
|
2016-01-06 17:13:44 -05:00
|
|
|
if (isPresent(provider.useClass)) {
|
2016-06-18 12:42:34 -04:00
|
|
|
compileTypeMetadata = this.getTypeMetadata(
|
|
|
|
provider.useClass, staticTypeModuleUrl(provider.useClass), provider.dependencies);
|
|
|
|
compileDeps = compileTypeMetadata.diDeps;
|
2016-01-06 17:13:44 -05:00
|
|
|
} else if (isPresent(provider.useFactory)) {
|
2016-06-18 12:42:34 -04:00
|
|
|
compileFactoryMetadata = this.getFactoryMetadata(
|
|
|
|
provider.useFactory, staticTypeModuleUrl(provider.useFactory), provider.dependencies);
|
|
|
|
compileDeps = compileFactoryMetadata.diDeps;
|
2016-01-06 17:13:44 -05:00
|
|
|
}
|
2016-06-18 12:42:34 -04:00
|
|
|
|
2016-01-06 17:13:44 -05:00
|
|
|
return new cpl.CompileProviderMetadata({
|
|
|
|
token: this.getTokenMetadata(provider.token),
|
2016-06-18 12:42:34 -04:00
|
|
|
useClass: compileTypeMetadata,
|
2016-07-07 13:05:55 -04:00
|
|
|
useValue: convertToCompileValue(provider.useValue, []),
|
2016-06-18 12:42:34 -04:00
|
|
|
useFactory: compileFactoryMetadata,
|
2016-01-06 17:13:44 -05:00
|
|
|
useExisting: isPresent(provider.useExisting) ? this.getTokenMetadata(provider.useExisting) :
|
|
|
|
null,
|
|
|
|
deps: compileDeps,
|
|
|
|
multi: provider.multi
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
2016-06-08 19:38:52 -04:00
|
|
|
getQueriesMetadata(
|
|
|
|
queries: {[key: string]: QueryMetadata}, isViewQuery: boolean,
|
|
|
|
directiveType: Type): cpl.CompileQueryMetadata[] {
|
2016-06-08 18:45:15 -04:00
|
|
|
var compileQueries: any[] /** TODO #9100 */ = [];
|
2016-06-08 19:38:52 -04:00
|
|
|
StringMapWrapper.forEach(
|
|
|
|
queries, (query: any /** TODO #9100 */, propertyName: any /** TODO #9100 */) => {
|
|
|
|
if (query.isViewQuery === isViewQuery) {
|
|
|
|
compileQueries.push(this.getQueryMetadata(query, propertyName, directiveType));
|
|
|
|
}
|
|
|
|
});
|
2016-01-06 17:13:44 -05:00
|
|
|
return compileQueries;
|
|
|
|
}
|
|
|
|
|
2016-06-08 19:38:52 -04:00
|
|
|
getQueryMetadata(q: QueryMetadata, propertyName: string, typeOrFunc: Type|Function):
|
|
|
|
cpl.CompileQueryMetadata {
|
2016-06-17 13:57:50 -04:00
|
|
|
var selectors: cpl.CompileTokenMetadata[];
|
2016-01-06 17:13:44 -05:00
|
|
|
if (q.isVarBindingQuery) {
|
|
|
|
selectors = q.varBindings.map(varName => this.getTokenMetadata(varName));
|
|
|
|
} else {
|
2016-06-04 22:46:03 -04:00
|
|
|
if (!isPresent(q.selector)) {
|
2016-06-08 19:38:52 -04:00
|
|
|
throw new BaseException(
|
|
|
|
`Can't construct a query for the property "${propertyName}" of "${stringify(typeOrFunc)}" since the query selector wasn't defined.`);
|
2016-06-04 22:46:03 -04:00
|
|
|
}
|
2016-01-06 17:13:44 -05:00
|
|
|
selectors = [this.getTokenMetadata(q.selector)];
|
|
|
|
}
|
|
|
|
return new cpl.CompileQueryMetadata({
|
|
|
|
selectors: selectors,
|
|
|
|
first: q.first,
|
|
|
|
descendants: q.descendants,
|
2016-04-18 16:24:42 -04:00
|
|
|
propertyName: propertyName,
|
|
|
|
read: isPresent(q.read) ? this.getTokenMetadata(q.read) : null
|
2016-01-06 17:13:44 -05:00
|
|
|
});
|
|
|
|
}
|
2015-09-14 18:59:09 -04:00
|
|
|
}
|
|
|
|
|
2015-11-09 17:33:22 -05:00
|
|
|
function flattenDirectives(view: ViewMetadata, platformDirectives: any[]): Type[] {
|
2016-06-17 13:57:50 -04:00
|
|
|
let directives: Type[] = [];
|
2015-11-09 17:33:22 -05:00
|
|
|
if (isPresent(platformDirectives)) {
|
|
|
|
flattenArray(platformDirectives, directives);
|
2015-11-02 19:03:42 -05:00
|
|
|
}
|
|
|
|
if (isPresent(view.directives)) {
|
|
|
|
flattenArray(view.directives, directives);
|
|
|
|
}
|
2015-09-14 18:59:09 -04:00
|
|
|
return directives;
|
|
|
|
}
|
|
|
|
|
2015-12-02 13:35:51 -05:00
|
|
|
function flattenPipes(view: ViewMetadata, platformPipes: any[]): Type[] {
|
2016-06-17 13:57:50 -04:00
|
|
|
let pipes: Type[] = [];
|
2015-12-02 13:35:51 -05:00
|
|
|
if (isPresent(platformPipes)) {
|
|
|
|
flattenArray(platformPipes, pipes);
|
|
|
|
}
|
|
|
|
if (isPresent(view.pipes)) {
|
|
|
|
flattenArray(view.pipes, pipes);
|
|
|
|
}
|
|
|
|
return pipes;
|
|
|
|
}
|
|
|
|
|
2016-06-22 17:06:23 -04:00
|
|
|
function flattenArray(tree: any[], out: Array<Type> = []): Array<Type> {
|
2015-09-14 18:59:09 -04:00
|
|
|
for (var i = 0; i < tree.length; i++) {
|
|
|
|
var item = resolveForwardRef(tree[i]);
|
|
|
|
if (isArray(item)) {
|
2015-11-02 19:03:42 -05:00
|
|
|
flattenArray(item, out);
|
2015-09-14 18:59:09 -04:00
|
|
|
} else {
|
|
|
|
out.push(item);
|
|
|
|
}
|
|
|
|
}
|
2016-06-22 17:06:23 -04:00
|
|
|
return out;
|
2015-09-14 18:59:09 -04:00
|
|
|
}
|
|
|
|
|
2016-06-21 20:27:27 -04:00
|
|
|
function verifyNonBlankProviders(
|
|
|
|
directiveType: Type, providersTree: any[], providersType: string): any[] {
|
|
|
|
var flat: any[] = [];
|
|
|
|
var errMsg: string;
|
|
|
|
|
|
|
|
flattenArray(providersTree, flat);
|
|
|
|
for (var i = 0; i < flat.length; i++) {
|
|
|
|
if (isBlank(flat[i])) {
|
|
|
|
errMsg = flat.map(provider => isBlank(provider) ? '?' : stringify(provider)).join(', ');
|
|
|
|
throw new BaseException(
|
|
|
|
`One or more of ${providersType} for "${stringify(directiveType)}" were not defined: [${errMsg}].`);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return providersTree;
|
|
|
|
}
|
|
|
|
|
2016-02-18 13:53:21 -05:00
|
|
|
function isValidType(value: any): boolean {
|
2016-06-28 12:54:42 -04:00
|
|
|
return cpl.isStaticSymbol(value) || (value instanceof Type);
|
2016-02-18 13:53:21 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
function staticTypeModuleUrl(value: any): string {
|
2016-06-28 12:54:42 -04:00
|
|
|
return cpl.isStaticSymbol(value) ? value.filePath : null;
|
2015-09-14 18:59:09 -04:00
|
|
|
}
|
|
|
|
|
2016-06-08 19:38:52 -04:00
|
|
|
function componentModuleUrl(
|
|
|
|
reflector: ReflectorReader, type: any, cmpMetadata: ComponentMetadata): string {
|
2016-06-28 12:54:42 -04:00
|
|
|
if (cpl.isStaticSymbol(type)) {
|
2016-05-02 12:38:46 -04:00
|
|
|
return staticTypeModuleUrl(type);
|
2016-04-29 00:54:02 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
if (isPresent(cmpMetadata.moduleId)) {
|
|
|
|
var moduleId = cmpMetadata.moduleId;
|
2015-12-05 05:21:38 -05:00
|
|
|
var scheme = getUrlScheme(moduleId);
|
|
|
|
return isPresent(scheme) && scheme.length > 0 ? moduleId :
|
2016-05-02 01:50:37 -04:00
|
|
|
`package:${moduleId}${MODULE_SUFFIX}`;
|
2015-09-14 18:59:09 -04:00
|
|
|
}
|
2016-04-29 00:54:02 -04:00
|
|
|
|
|
|
|
return reflector.importUri(type);
|
2015-09-14 18:59:09 -04:00
|
|
|
}
|
2016-04-30 19:13:03 -04:00
|
|
|
|
2016-07-07 13:05:55 -04:00
|
|
|
function convertToCompileValue(
|
|
|
|
value: any, targetIdentifiers: cpl.CompileIdentifierMetadata[]): any {
|
|
|
|
return visitValue(value, new _CompileValueConverter(), targetIdentifiers);
|
2016-04-30 19:13:03 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
class _CompileValueConverter extends ValueTransformer {
|
2016-07-07 13:05:55 -04:00
|
|
|
visitOther(value: any, targetIdentifiers: cpl.CompileIdentifierMetadata[]): any {
|
|
|
|
let identifier: cpl.CompileIdentifierMetadata;
|
2016-06-28 12:54:42 -04:00
|
|
|
if (cpl.isStaticSymbol(value)) {
|
2016-07-07 13:05:55 -04:00
|
|
|
identifier = new cpl.CompileIdentifierMetadata(
|
|
|
|
{name: value.name, moduleUrl: value.filePath, runtime: value});
|
2016-04-30 19:13:03 -04:00
|
|
|
} else {
|
2016-07-07 13:05:55 -04:00
|
|
|
identifier = new cpl.CompileIdentifierMetadata({runtime: value});
|
2016-04-30 19:13:03 -04:00
|
|
|
}
|
2016-07-07 13:05:55 -04:00
|
|
|
targetIdentifiers.push(identifier);
|
|
|
|
return identifier;
|
2016-04-30 19:13:03 -04:00
|
|
|
}
|
|
|
|
}
|