Skip to content
Permalink
Browse files

refactor(compiler): split compiler and core (#18683)

After this, neither @angular/compiler nor @angular/comnpiler-cli depend
on @angular/core.

This add a duplication of some interfaces and enums which is stored
in @angular/compiler/src/core.ts

BREAKING CHANGE:
- `@angular/platform-server` now additionally depends on
  `@angular/platform-browser-dynamic` as a peer dependency.


PR Close #18683
  • Loading branch information...
tbosch authored and mhevery committed Aug 16, 2017
1 parent a0ca01d commit 0cc77b4a6954e563b6eb7999c9d3f08e2ba7dfeb
Showing with 1,501 additions and 1,561 deletions.
  1. +1 −1 packages/common/test/pipes/date_pipe_spec.ts
  2. +1 −1 packages/common/test/pipes/i18n_plural_pipe_spec.ts
  3. +1 −1 packages/common/test/pipes/i18n_select_pipe_spec.ts
  4. +0 −1 packages/compiler-cli/BUILD.bazel
  5. +1 −2 packages/compiler-cli/package.json
  6. +5 −6 packages/compiler-cli/src/codegen.ts
  7. +0 −1 packages/compiler-cli/src/diagnostics/typescript_symbols.ts
  8. +6 −4 packages/compiler-cli/src/ngtools_impl.ts
  9. +5 −6 packages/compiler-cli/src/transformers/program.ts
  10. +1 −1 packages/compiler-cli/src/version.ts
  11. +0 −5 packages/compiler-cli/tsconfig-build.json
  12. +1 −1 packages/compiler/BUILD.bazel
  13. +0 −3 packages/compiler/package.json
  14. +1 −3 packages/compiler/src/aot/compiler_factory.ts
  15. +1 −1 packages/compiler/src/aot/compiler_options.ts
  16. +41 −48 packages/compiler/src/aot/static_reflector.ts
  17. +2 −5 packages/compiler/src/assertions.ts
  18. +15 −15 packages/compiler/src/compile_metadata.ts
  19. +1 −1 packages/compiler/src/compile_reflector.ts
  20. +8 −5 packages/compiler/src/compiler.ts
  21. +9 −3 packages/compiler/src/config.ts
  22. +262 −0 packages/compiler/src/core.ts
  23. +2 −5 packages/compiler/src/directive_normalizer.ts
  24. +40 −37 packages/compiler/src/directive_resolver.ts
  25. +0 −2 packages/compiler/src/expression_parser/lexer.ts
  26. +0 −2 packages/compiler/src/expression_parser/parser.ts
  27. +3 −3 packages/compiler/src/i18n/extractor.ts
  28. +2 −2 packages/compiler/src/i18n/i18n_html_parser.ts
  29. +4 −1 packages/compiler/src/i18n/translation_bundle.ts
  30. +47 −60 packages/compiler/src/identifiers.ts
  31. +0 −17 packages/compiler/src/injectable.ts
  32. +55 −102 packages/compiler/src/jit/compiler.ts
  33. +0 −46 packages/compiler/src/jit/jit_reflector.ts
  34. +62 −64 packages/compiler/src/metadata_resolver.ts
  35. +0 −3 packages/compiler/src/ml_parser/html_parser.ts
  36. +1 −4 packages/compiler/src/ng_module_compiler.ts
  37. +6 −10 packages/compiler/src/ng_module_resolver.ts
  38. +2 −1 packages/compiler/src/output/output_ast.ts
  39. +9 −3 packages/compiler/src/output/output_interpreter.ts
  40. +13 −8 packages/compiler/src/output/output_jit.ts
  41. +6 −12 packages/compiler/src/pipe_resolver.ts
  42. +1 −3 packages/compiler/src/schema/dom_element_schema_registry.ts
  43. +1 −1 packages/compiler/src/schema/dom_security_schema.ts
  44. +1 −1 packages/compiler/src/schema/element_schema_registry.ts
  45. +1 −4 packages/compiler/src/style_compiler.ts
  46. +7 −9 packages/compiler/src/summary_resolver.ts
  47. +1 −2 packages/compiler/src/template_parser/binding_parser.ts
  48. +1 −2 packages/compiler/src/template_parser/template_ast.ts
  49. +3 −15 packages/compiler/src/template_parser/template_parser.ts
  50. +6 −12 packages/compiler/src/url_resolver.ts
  51. +66 −4 packages/compiler/src/util.ts
  52. +1 −1 packages/compiler/src/version.ts
  53. +1 −2 packages/compiler/src/view_compiler/provider_compiler.ts
  54. +5 −4 packages/compiler/src/view_compiler/view_compiler.ts
  55. +14 −7 packages/compiler/test/aot/compiler_spec.ts
  56. +8 −1 packages/compiler/test/aot/jit_summaries_spec.ts
  57. +229 −431 packages/compiler/test/aot/static_reflector_spec.ts
  58. +16 −5 packages/compiler/test/aot/test_util.ts
  59. +1 −1 packages/compiler/test/directive_lifecycle_spec.ts
  60. +1 −1 packages/compiler/test/directive_normalizer_spec.ts
  61. +3 −45 packages/compiler/test/directive_resolver_mock_spec.ts
  62. +5 −4 packages/compiler/test/directive_resolver_spec.ts
  63. +1 −1 packages/compiler/test/i18n/extractor_merger_spec.ts
  64. +1 −1 packages/compiler/test/metadata_resolver_spec.ts
  65. +2 −2 packages/compiler/test/ng_module_resolver_mock_spec.ts
  66. +1 −1 packages/compiler/test/ng_module_resolver_spec.ts
  67. +2 −1 packages/compiler/test/output/output_jit_spec.ts
  68. +2 −2 packages/compiler/test/pipe_resolver_mock_spec.ts
  69. +1 −1 packages/compiler/test/pipe_resolver_spec.ts
  70. +4 −3 packages/compiler/test/runtime_compiler_spec.ts
  71. +27 −59 packages/compiler/test/template_parser/template_parser_spec.ts
  72. +2 −2 packages/compiler/{testing/src → test}/test_bindings.ts
  73. +10 −126 packages/compiler/testing/src/directive_resolver_mock.ts
  74. +5 −12 packages/compiler/testing/src/ng_module_resolver_mock.ts
  75. +5 −14 packages/compiler/testing/src/pipe_resolver_mock.ts
  76. +5 −6 packages/compiler/testing/src/schema_registry_mock.ts
  77. +1 −115 packages/compiler/testing/src/testing.ts
  78. +0 −2 packages/compiler/testing/tsconfig-build.json
  79. +1 −8 packages/compiler/tsconfig-build.json
  80. +2 −2 packages/core/src/change_detection/constants.ts
  81. +0 −2 packages/core/src/core_private_export.ts
  82. +3 −0 packages/core/src/di/injection_token.ts
  83. +0 −1 packages/core/src/errors.ts
  84. +3 −3 packages/core/src/i18n/tokens.ts
  85. +3 −63 packages/core/src/metadata/view.ts
  86. +6 −6 packages/core/src/security.ts
  87. +3 −3 packages/core/src/util/decorators.ts
  88. +7 −7 packages/core/src/view/types.ts
  89. +13 −5 packages/core/test/linker/change_detection_integration_spec.ts
  90. +4 −7 packages/core/testing/src/test_bed.ts
  91. +6 −0 packages/core/testing/src/test_compiler.ts
  92. +76 −46 packages/{compiler/src/jit → platform-browser-dynamic/src}/compiler_factory.ts
  93. +149 −0 packages/platform-browser-dynamic/src/compiler_reflector.ts
  94. +4 −2 packages/platform-browser-dynamic/src/platform-browser-dynamic.ts
  95. +20 −0 packages/platform-browser-dynamic/src/platform_core_dynamic.ts
  96. +2 −0 packages/platform-browser-dynamic/src/private_export.ts
  97. 0 packages/{compiler → platform-browser-dynamic}/test/metadata_overrider_spec.ts
  98. +106 −0 packages/platform-browser-dynamic/testing/src/compiler_factory.ts
  99. 0 packages/{compiler → platform-browser-dynamic}/testing/src/metadata_overrider.ts
  100. +27 −0 packages/platform-browser-dynamic/testing/src/platform_core_dynamic_testing.ts
  101. +1 −0 packages/platform-browser-dynamic/testing/src/private_export_testing.ts
  102. +1 −1 packages/platform-browser-dynamic/testing/src/testing.ts
  103. +1 −0 packages/platform-server/integrationtest/package.json
  104. +2 −1 packages/platform-server/package.json
  105. +1 −1 packages/platform-server/src/server.ts
  106. +1 −2 packages/platform-server/testing/src/server.ts
  107. +4 −2 packages/platform-webworker-dynamic/src/platform-webworker-dynamic.ts
@@ -7,8 +7,8 @@
*/

import {DatePipe} from '@angular/common';
import {JitReflector} from '@angular/compiler';
import {PipeResolver} from '@angular/compiler/src/pipe_resolver';
import {JitReflector} from '@angular/platform-browser-dynamic/src/compiler_reflector';
import {browserDetection} from '@angular/platform-browser/testing/src/browser_util';

export function main() {
@@ -7,9 +7,9 @@
*/

import {I18nPluralPipe, NgLocalization} from '@angular/common';
import {JitReflector} from '@angular/compiler';
import {PipeResolver} from '@angular/compiler/src/pipe_resolver';
import {beforeEach, describe, expect, it} from '@angular/core/testing/src/testing_internal';
import {JitReflector} from '@angular/platform-browser-dynamic/src/compiler_reflector';

export function main() {
describe('I18nPluralPipe', () => {
@@ -7,8 +7,8 @@
*/

import {I18nSelectPipe} from '@angular/common';
import {JitReflector} from '@angular/compiler';
import {PipeResolver} from '@angular/compiler/src/pipe_resolver';
import {JitReflector} from '@angular/platform-browser-dynamic/src/compiler_reflector';

export function main() {
describe('I18nSelectPipe', () => {
@@ -10,7 +10,6 @@ ts_library(
module_name = "@angular/compiler-cli",
deps = [
"//packages/compiler",
"//packages/core",
"//packages/tsc-wrapped",
],
tsconfig = ":tsconfig-build.json",
@@ -16,8 +16,7 @@
},
"peerDependencies": {
"typescript": "^2.0.2",
"@angular/compiler": "0.0.0-PLACEHOLDER",
"@angular/core": "0.0.0-PLACEHOLDER"
"@angular/compiler": "0.0.0-PLACEHOLDER"
},
"repository": {
"type": "git",
@@ -11,7 +11,6 @@
* Intended to be used in a build step.
*/
import * as compiler from '@angular/compiler';
import {MissingTranslationStrategy} from '@angular/core';
import {AngularCompilerOptions, NgcCliOptions} from '@angular/tsc-wrapped';
import {readFileSync} from 'fs';
import * as ts from 'typescript';
@@ -78,25 +77,25 @@ export class CodeGenerator {
}
transContent = readFileSync(cliOptions.i18nFile, 'utf8');
}
let missingTranslation = MissingTranslationStrategy.Warning;
let missingTranslation = compiler.core.MissingTranslationStrategy.Warning;
if (cliOptions.missingTranslation) {
switch (cliOptions.missingTranslation) {
case 'error':
missingTranslation = MissingTranslationStrategy.Error;
missingTranslation = compiler.core.MissingTranslationStrategy.Error;
break;
case 'warning':
missingTranslation = MissingTranslationStrategy.Warning;
missingTranslation = compiler.core.MissingTranslationStrategy.Warning;
break;
case 'ignore':
missingTranslation = MissingTranslationStrategy.Ignore;
missingTranslation = compiler.core.MissingTranslationStrategy.Ignore;
break;
default:
throw new Error(
`Unknown option for missingTranslation (${cliOptions.missingTranslation}). Use either error, warning or ignore.`);
}
}
if (!transContent) {
missingTranslation = MissingTranslationStrategy.Ignore;
missingTranslation = compiler.core.MissingTranslationStrategy.Ignore;
}
const {compiler: aotCompiler} = compiler.createAotCompiler(ngCompilerHost, {
translations: transContent,
@@ -7,7 +7,6 @@
*/

import {AotSummaryResolver, CompileMetadataResolver, CompilePipeSummary, CompilerConfig, DEFAULT_INTERPOLATION_CONFIG, DirectiveNormalizer, DirectiveResolver, DomElementSchemaRegistry, HtmlParser, InterpolationConfig, NgAnalyzedModules, NgModuleResolver, ParseTreeResult, PipeResolver, ResourceLoader, StaticReflector, StaticSymbol, StaticSymbolCache, StaticSymbolResolver, SummaryResolver, analyzeNgModules, extractProgramSymbols} from '@angular/compiler';
import {ViewEncapsulation, ɵConsole as Console} from '@angular/core';
import * as fs from 'fs';
import * as path from 'path';
import * as ts from 'typescript';
@@ -12,8 +12,8 @@
* This API should be stable for NG 2. It can be removed in NG 4..., but should be replaced by
* something else.
*/
import {AotCompilerHost, StaticReflector, StaticSymbol} from '@angular/compiler';
import {NgModule} from '@angular/core';
import {AotCompilerHost, StaticReflector, StaticSymbol, core} from '@angular/compiler';


// We cannot depend directly to @angular/router.
type Route = any;
@@ -168,8 +168,10 @@ function _extractLazyRoutesFromStaticModule(
/**
* Get the NgModule Metadata of a symbol.
*/
function _getNgModuleMetadata(staticSymbol: StaticSymbol, reflector: StaticReflector): NgModule {
const ngModules = reflector.annotations(staticSymbol).filter((s: any) => s instanceof NgModule);
function _getNgModuleMetadata(
staticSymbol: StaticSymbol, reflector: StaticReflector): core.NgModule {
const ngModules =
reflector.annotations(staticSymbol).filter((s: any) => core.createNgModule.isTypeOf(s));
if (ngModules.length === 0) {
throw new Error(`${staticSymbol.name} is not an NgModule`);
}
@@ -6,8 +6,7 @@
* found in the LICENSE file at https://angular.io/license
*/

import {AotCompiler, AotCompilerHost, AotCompilerOptions, GeneratedFile, NgAnalyzedModules, createAotCompiler, getParseErrors, isSyntaxError, toTypeScript} from '@angular/compiler';
import {MissingTranslationStrategy} from '@angular/core';
import {AotCompiler, AotCompilerHost, AotCompilerOptions, GeneratedFile, NgAnalyzedModules, core, createAotCompiler, getParseErrors, isSyntaxError, toTypeScript} from '@angular/compiler';
import {createBundleIndexHost} from '@angular/tsc-wrapped';
import * as fs from 'fs';
import * as path from 'path';
@@ -337,14 +336,14 @@ export function createProgram(

// Compute the AotCompiler options
function getAotCompilerOptions(options: CompilerOptions): AotCompilerOptions {
let missingTranslation = MissingTranslationStrategy.Warning;
let missingTranslation = core.MissingTranslationStrategy.Warning;

switch (options.i18nInMissingTranslations) {
case 'ignore':
missingTranslation = MissingTranslationStrategy.Ignore;
missingTranslation = core.MissingTranslationStrategy.Ignore;
break;
case 'error':
missingTranslation = MissingTranslationStrategy.Error;
missingTranslation = core.MissingTranslationStrategy.Error;
break;
}

@@ -358,7 +357,7 @@ function getAotCompilerOptions(options: CompilerOptions): AotCompilerOptions {
} else {
// No translations are provided, ignore any errors
// We still go through i18n to remove i18n attributes
missingTranslation = MissingTranslationStrategy.Ignore;
missingTranslation = core.MissingTranslationStrategy.Ignore;
}

return {
@@ -12,7 +12,7 @@
* Entry point for all public APIs of the common package.
*/

import {Version} from '@angular/core';
import {Version} from '@angular/compiler';
/**
* @stable
*/
@@ -8,12 +8,7 @@
"module": "commonjs",
"outDir": "../../dist/packages/compiler-cli",
"paths": {
"@angular/core": ["../../dist/packages/core"],
"@angular/common": ["../../dist/packages/common"],
"@angular/compiler": ["../../dist/packages/compiler"],
"@angular/http": ["../../dist/packages/http"],
"@angular/platform-server": ["../../dist/packages/platform-server"],
"@angular/platform-browser": ["../../dist/packages/platform-browser"],
"@angular/tsc-wrapped": ["../../dist/packages-dist/tsc-wrapped"]
},
"rootDir": ".",
@@ -8,6 +8,6 @@ ts_library(
"testing/**",
]),
module_name = "@angular/compiler",
deps = ["//packages/core"],
deps = [],
tsconfig = ":tsconfig-build.json",
)
@@ -11,9 +11,6 @@
"dependencies": {
"tslib": "^1.7.1"
},
"peerDependencies": {
"@angular/core": "0.0.0-PLACEHOLDER"
},
"repository": {
"type": "git",
"url": "https://github.com/angular/angular.git"
@@ -6,9 +6,8 @@
* found in the LICENSE file at https://angular.io/license
*/

import {MissingTranslationStrategy, ViewEncapsulation, ɵConsole as Console} from '@angular/core';

import {CompilerConfig} from '../config';
import {MissingTranslationStrategy, ViewEncapsulation} from '../core';
import {DirectiveNormalizer} from '../directive_normalizer';
import {DirectiveResolver} from '../directive_resolver';
import {Lexer} from '../expression_parser/lexer';
@@ -61,7 +60,6 @@ export function createAotCompiler(compilerHost: AotCompilerHost, options: AotCom
const summaryResolver = new AotSummaryResolver(compilerHost, symbolCache);
const symbolResolver = new StaticSymbolResolver(compilerHost, symbolCache, summaryResolver);
const staticReflector = new StaticReflector(summaryResolver, symbolResolver);
const console = new Console();
const htmlParser = new I18NHtmlParser(
new HtmlParser(), translations, options.i18nFormat, options.missingTranslation, console);
const config = new CompilerConfig({
@@ -6,7 +6,7 @@
* found in the LICENSE file at https://angular.io/license
*/

import {MissingTranslationStrategy} from '@angular/core';
import {MissingTranslationStrategy} from '../core';

export interface AotCompilerOptions {
locale?: string;
@@ -6,10 +6,9 @@
* found in the LICENSE file at https://angular.io/license
*/

import {Attribute, Component, ContentChild, ContentChildren, Directive, Host, HostBinding, HostListener, Inject, Injectable, Input, NgModule, Optional, Output, Pipe, Self, SkipSelf, ViewChild, ViewChildren, animate, group, keyframes, sequence, state, style, transition, trigger} from '@angular/core';

import {CompileSummaryKind} from '../compile_metadata';
import {CompileReflector} from '../compile_reflector';
import {MetadataFactory, createAttribute, createComponent, createContentChild, createContentChildren, createDirective, createHost, createHostBinding, createHostListener, createInject, createInjectable, createInput, createNgModule, createOptional, createOutput, createPipe, createSelf, createSkipSelf, createViewChild, createViewChildren} from '../core';
import * as o from '../output/output_ast';
import {SummaryResolver} from '../summary_resolver';
import {syntaxError} from '../util';
@@ -48,8 +47,8 @@ export class StaticReflector implements CompileReflector {
private opaqueToken: StaticSymbol;
private ROUTES: StaticSymbol;
private ANALYZE_FOR_ENTRY_COMPONENTS: StaticSymbol;
private annotationForParentClassWithSummaryKind = new Map<CompileSummaryKind, any[]>();
private annotationNames = new Map<any, string>();
private annotationForParentClassWithSummaryKind =
new Map<CompileSummaryKind, MetadataFactory<any>[]>();

constructor(
private summaryResolver: SummaryResolver<StaticSymbol>,
@@ -64,16 +63,12 @@ export class StaticReflector implements CompileReflector {
knownMetadataFunctions.forEach(
(kf) => this._registerFunction(this.getStaticSymbol(kf.filePath, kf.name), kf.fn));
this.annotationForParentClassWithSummaryKind.set(
CompileSummaryKind.Directive, [Directive, Component]);
this.annotationForParentClassWithSummaryKind.set(CompileSummaryKind.Pipe, [Pipe]);
this.annotationForParentClassWithSummaryKind.set(CompileSummaryKind.NgModule, [NgModule]);
CompileSummaryKind.Directive, [createDirective, createComponent]);
this.annotationForParentClassWithSummaryKind.set(CompileSummaryKind.Pipe, [createPipe]);
this.annotationForParentClassWithSummaryKind.set(CompileSummaryKind.NgModule, [createNgModule]);
this.annotationForParentClassWithSummaryKind.set(
CompileSummaryKind.Injectable, [Injectable, Pipe, Directive, Component, NgModule]);
this.annotationNames.set(Directive, 'Directive');
this.annotationNames.set(Component, 'Component');
this.annotationNames.set(Pipe, 'Pipe');
this.annotationNames.set(NgModule, 'NgModule');
this.annotationNames.set(Injectable, 'Injectable');
CompileSummaryKind.Injectable,
[createInjectable, createPipe, createDirective, createComponent, createNgModule]);
}

componentModuleUrl(typeOrFunc: StaticSymbol): string {
@@ -129,12 +124,12 @@ export class StaticReflector implements CompileReflector {
const requiredAnnotationTypes =
this.annotationForParentClassWithSummaryKind.get(summary.type.summaryKind !) !;
const typeHasRequiredAnnotation = requiredAnnotationTypes.some(
(requiredType: any) => ownAnnotations.some(ann => ann instanceof requiredType));
(requiredType) => ownAnnotations.some(ann => requiredType.isTypeOf(ann)));
if (!typeHasRequiredAnnotation) {
this.reportError(
syntaxError(
`Class ${type.name} in ${type.filePath} extends from a ${CompileSummaryKind[summary.type.summaryKind!]} in another compilation unit without duplicating the decorator. ` +
`Please add a ${requiredAnnotationTypes.map((type: any) => this.annotationNames.get(type)).join(' or ')} decorator to the class.`),
`Please add a ${requiredAnnotationTypes.map((type) => type.ngMetadataName).join(' or ')} decorator to the class.`),
type);
}
}
@@ -281,50 +276,48 @@ export class StaticReflector implements CompileReflector {
this.ANALYZE_FOR_ENTRY_COMPONENTS =
this.findDeclaration(ANGULAR_CORE, 'ANALYZE_FOR_ENTRY_COMPONENTS');

this._registerDecoratorOrConstructor(this.findDeclaration(ANGULAR_CORE, 'Host'), Host);
this._registerDecoratorOrConstructor(this.findDeclaration(ANGULAR_CORE, 'Host'), createHost);
this._registerDecoratorOrConstructor(
this.findDeclaration(ANGULAR_CORE, 'Injectable'), createInjectable);
this._registerDecoratorOrConstructor(this.findDeclaration(ANGULAR_CORE, 'Self'), createSelf);
this._registerDecoratorOrConstructor(
this.findDeclaration(ANGULAR_CORE, 'SkipSelf'), createSkipSelf);
this._registerDecoratorOrConstructor(
this.findDeclaration(ANGULAR_CORE, 'Inject'), createInject);
this._registerDecoratorOrConstructor(
this.findDeclaration(ANGULAR_CORE, 'Optional'), createOptional);
this._registerDecoratorOrConstructor(
this.findDeclaration(ANGULAR_CORE, 'Injectable'), Injectable);
this._registerDecoratorOrConstructor(this.findDeclaration(ANGULAR_CORE, 'Self'), Self);
this._registerDecoratorOrConstructor(this.findDeclaration(ANGULAR_CORE, 'SkipSelf'), SkipSelf);
this._registerDecoratorOrConstructor(this.findDeclaration(ANGULAR_CORE, 'Inject'), Inject);
this._registerDecoratorOrConstructor(this.findDeclaration(ANGULAR_CORE, 'Optional'), Optional);
this.findDeclaration(ANGULAR_CORE, 'Attribute'), createAttribute);
this._registerDecoratorOrConstructor(
this.findDeclaration(ANGULAR_CORE, 'Attribute'), Attribute);
this.findDeclaration(ANGULAR_CORE, 'ContentChild'), createContentChild);
this._registerDecoratorOrConstructor(
this.findDeclaration(ANGULAR_CORE, 'ContentChild'), ContentChild);
this.findDeclaration(ANGULAR_CORE, 'ContentChildren'), createContentChildren);
this._registerDecoratorOrConstructor(
this.findDeclaration(ANGULAR_CORE, 'ContentChildren'), ContentChildren);
this.findDeclaration(ANGULAR_CORE, 'ViewChild'), createViewChild);
this._registerDecoratorOrConstructor(
this.findDeclaration(ANGULAR_CORE, 'ViewChild'), ViewChild);
this.findDeclaration(ANGULAR_CORE, 'ViewChildren'), createViewChildren);
this._registerDecoratorOrConstructor(this.findDeclaration(ANGULAR_CORE, 'Input'), createInput);
this._registerDecoratorOrConstructor(
this.findDeclaration(ANGULAR_CORE, 'ViewChildren'), ViewChildren);
this._registerDecoratorOrConstructor(this.findDeclaration(ANGULAR_CORE, 'Input'), Input);
this._registerDecoratorOrConstructor(this.findDeclaration(ANGULAR_CORE, 'Output'), Output);
this._registerDecoratorOrConstructor(this.findDeclaration(ANGULAR_CORE, 'Pipe'), Pipe);
this.findDeclaration(ANGULAR_CORE, 'Output'), createOutput);
this._registerDecoratorOrConstructor(this.findDeclaration(ANGULAR_CORE, 'Pipe'), createPipe);
this._registerDecoratorOrConstructor(
this.findDeclaration(ANGULAR_CORE, 'HostBinding'), HostBinding);
this.findDeclaration(ANGULAR_CORE, 'HostBinding'), createHostBinding);
this._registerDecoratorOrConstructor(
this.findDeclaration(ANGULAR_CORE, 'HostListener'), HostListener);
this.findDeclaration(ANGULAR_CORE, 'HostListener'), createHostListener);
this._registerDecoratorOrConstructor(
this.findDeclaration(ANGULAR_CORE, 'Directive'), Directive);
this.findDeclaration(ANGULAR_CORE, 'Directive'), createDirective);
this._registerDecoratorOrConstructor(
this.findDeclaration(ANGULAR_CORE, 'Component'), Component);
this._registerDecoratorOrConstructor(this.findDeclaration(ANGULAR_CORE, 'NgModule'), NgModule);
this.findDeclaration(ANGULAR_CORE, 'Component'), createComponent);
this._registerDecoratorOrConstructor(
this.findDeclaration(ANGULAR_CORE, 'NgModule'), createNgModule);

// Note: Some metadata classes can be used directly with Provider.deps.
this._registerDecoratorOrConstructor(this.findDeclaration(ANGULAR_CORE, 'Host'), Host);
this._registerDecoratorOrConstructor(this.findDeclaration(ANGULAR_CORE, 'Self'), Self);
this._registerDecoratorOrConstructor(this.findDeclaration(ANGULAR_CORE, 'SkipSelf'), SkipSelf);
this._registerDecoratorOrConstructor(this.findDeclaration(ANGULAR_CORE, 'Optional'), Optional);

this._registerFunction(this.findDeclaration(ANGULAR_CORE, 'trigger'), trigger);
this._registerFunction(this.findDeclaration(ANGULAR_CORE, 'state'), state);
this._registerFunction(this.findDeclaration(ANGULAR_CORE, 'transition'), transition);
this._registerFunction(this.findDeclaration(ANGULAR_CORE, 'style'), style);
this._registerFunction(this.findDeclaration(ANGULAR_CORE, 'animate'), animate);
this._registerFunction(this.findDeclaration(ANGULAR_CORE, 'keyframes'), keyframes);
this._registerFunction(this.findDeclaration(ANGULAR_CORE, 'sequence'), sequence);
this._registerFunction(this.findDeclaration(ANGULAR_CORE, 'group'), group);
this._registerDecoratorOrConstructor(this.findDeclaration(ANGULAR_CORE, 'Host'), createHost);
this._registerDecoratorOrConstructor(this.findDeclaration(ANGULAR_CORE, 'Self'), createSelf);
this._registerDecoratorOrConstructor(
this.findDeclaration(ANGULAR_CORE, 'SkipSelf'), createSkipSelf);
this._registerDecoratorOrConstructor(
this.findDeclaration(ANGULAR_CORE, 'Optional'), createOptional);
}

/**
@@ -755,4 +748,4 @@ function positionalError(message: string, fileName: string, line: number, column
(result as any).line = line;
(result as any).column = column;
return result;
}
}
@@ -6,11 +6,8 @@
* found in the LICENSE file at https://angular.io/license
*/

import {isDevMode} from '@angular/core';


export function assertArrayOfStrings(identifier: string, value: any) {
if (!isDevMode() || value == null) {
if (value == null) {
return;
}
if (!Array.isArray(value)) {
@@ -34,7 +31,7 @@ const INTERPOLATION_BLACKLIST_REGEXPS = [
export function assertInterpolationSymbols(identifier: string, value: any): void {
if (value != null && !(Array.isArray(value) && value.length == 2)) {
throw new Error(`Expected '${identifier}' to be an array, [start, end].`);
} else if (isDevMode() && value != null) {
} else if (value != null) {
const start = value[0] as string;
const end = value[1] as string;
// black list checking

0 comments on commit 0cc77b4

Please sign in to comment.
You can’t perform that action at this time.