From 37b617dccfc7a4456043b71f78ed6dbc6defa26b Mon Sep 17 00:00:00 2001 From: Alex Eagle Date: Wed, 15 Jun 2016 06:58:57 -0700 Subject: [PATCH] chore(tsickle): add @Annotation annotations This lets users continue using runtime-sideeffect Decorators if they choose, only down-leveling the marked ones to Annotations. Also remove the "skipTemplateCodegen" option, which is no longer needed since Angular compiles with tsc-wrapped rather than ngc. The former doesn't include any codegen. --- build.sh | 2 +- modules/@angular/common/tsconfig-es2015.json | 4 ---- modules/@angular/common/tsconfig-es5.json | 4 ---- .../integrationtest/src/a/multiple_components.ts | 2 +- modules/@angular/compiler-cli/tsconfig-es5.json | 3 --- .../compiler/test/offline_compiler_util.ts | 2 +- modules/@angular/compiler/tsconfig-es2015.json | 3 --- modules/@angular/compiler/tsconfig-es5.json | 4 ---- modules/@angular/core/src/di/decorators.ts | 6 ++++++ modules/@angular/core/src/metadata.ts | 15 +++++++++++++++ .../core/test/reflection/reflector_common.ts | 6 +++--- modules/@angular/core/tsconfig-es2015.json | 4 ---- modules/@angular/core/tsconfig-es5.json | 4 ---- modules/@angular/forms/tsconfig-es2015.json | 4 ---- modules/@angular/forms/tsconfig-es5.json | 4 ---- modules/@angular/http/tsconfig-es2015.json | 4 ---- modules/@angular/http/tsconfig-es5.json | 4 ---- .../platform-browser-dynamic/tsconfig-es2015.json | 4 ---- .../platform-browser-dynamic/tsconfig-es5.json | 4 ---- .../platform-browser/tsconfig-es2015.json | 4 ---- .../@angular/platform-browser/tsconfig-es5.json | 4 ---- .../@angular/platform-server/tsconfig-es2015.json | 4 ---- .../@angular/platform-server/tsconfig-es5.json | 4 ---- .../src/lifecycle/lifecycle_annotations.ts | 1 + .../src/route_config/route_config_decorator.ts | 1 + .../router-deprecated/tsconfig-es2015.json | 4 ---- .../@angular/router-deprecated/tsconfig-es5.json | 4 ---- .../@angular/router/src/metadata/decorators.ts | 1 + modules/@angular/router/tsconfig-es2015.json | 4 ---- modules/@angular/router/tsconfig-es5.json | 4 ---- modules/@angular/upgrade/tsconfig-es2015.json | 4 ---- modules/@angular/upgrade/tsconfig-es5.json | 4 ---- modules/tsconfig.json | 4 ---- npm-shrinkwrap.clean.json | 2 +- npm-shrinkwrap.json | 4 ++-- scripts/ci-lite/test_js.sh | 5 +++-- tools/@angular/tsc-wrapped/package.json | 2 +- 37 files changed, 37 insertions(+), 106 deletions(-) diff --git a/build.sh b/build.sh index 7b373e0aba..5f3a6e7f90 100755 --- a/build.sh +++ b/build.sh @@ -85,7 +85,7 @@ do if [[ ${PACKAGE} == "router-deprecated" ]]; then echo "====== (esm)COMPILING: \$(npm bin)/tsc -p ${SRCDIR}/tsconfig-es2015.json =====" - $(npm bin)/tsc -p ${SRCDIR}/tsconfig-es2015.json + $(npm bin)/tsc --emitDecoratorMetadata -p ${SRCDIR}/tsconfig-es2015.json else echo "====== (esm)COMPILING: $TSC -p ${SRCDIR}/tsconfig-es2015.json =====" $TSC -p ${SRCDIR}/tsconfig-es2015.json diff --git a/modules/@angular/common/tsconfig-es2015.json b/modules/@angular/common/tsconfig-es2015.json index 9cc18d6dcf..eb3aafe295 100644 --- a/modules/@angular/common/tsconfig-es2015.json +++ b/modules/@angular/common/tsconfig-es2015.json @@ -1,12 +1,8 @@ { - "angularCompilerOptions": { - "skipTemplateCodegen": true - }, "compilerOptions": { "baseUrl": ".", "declaration": true, "stripInternal": true, - "emitDecoratorMetadata": true, "experimentalDecorators": true, "module": "es2015", "moduleResolution": "node", diff --git a/modules/@angular/common/tsconfig-es5.json b/modules/@angular/common/tsconfig-es5.json index b11904fff7..1ddbe55386 100644 --- a/modules/@angular/common/tsconfig-es5.json +++ b/modules/@angular/common/tsconfig-es5.json @@ -1,12 +1,8 @@ { - "angularCompilerOptions": { - "skipTemplateCodegen": true - }, "compilerOptions": { "baseUrl": ".", "declaration": true, "stripInternal": true, - "emitDecoratorMetadata": true, "experimentalDecorators": true, "module": "commonjs", "moduleResolution": "node", diff --git a/modules/@angular/compiler-cli/integrationtest/src/a/multiple_components.ts b/modules/@angular/compiler-cli/integrationtest/src/a/multiple_components.ts index fa2450e477..35624d77d9 100644 --- a/modules/@angular/compiler-cli/integrationtest/src/a/multiple_components.ts +++ b/modules/@angular/compiler-cli/integrationtest/src/a/multiple_components.ts @@ -22,7 +22,7 @@ export class HasCustomDecorator { // Verify that custom decorators have metadata collected, eg Ionic export function Page(c: any): (f: Function) => void { - return c; + return NotADirective; } @Page({template: 'Ionic template'}) diff --git a/modules/@angular/compiler-cli/tsconfig-es5.json b/modules/@angular/compiler-cli/tsconfig-es5.json index 4a0ff6f020..ee6b249db3 100644 --- a/modules/@angular/compiler-cli/tsconfig-es5.json +++ b/modules/@angular/compiler-cli/tsconfig-es5.json @@ -1,7 +1,4 @@ { - "angularCompilerOptions": { - "skipTemplateCodegen": true - }, "compilerOptions": { "module": "commonjs", "target": "es5", diff --git a/modules/@angular/compiler/test/offline_compiler_util.ts b/modules/@angular/compiler/test/offline_compiler_util.ts index 5336ccb3f6..f7aec83358 100644 --- a/modules/@angular/compiler/test/offline_compiler_util.ts +++ b/modules/@angular/compiler/test/offline_compiler_util.ts @@ -71,4 +71,4 @@ export class SimpleJsImportGenerator implements ImportGenerator { return importedUrlStr; } } -} \ No newline at end of file +} diff --git a/modules/@angular/compiler/tsconfig-es2015.json b/modules/@angular/compiler/tsconfig-es2015.json index 04d3b21b88..c37d439b74 100644 --- a/modules/@angular/compiler/tsconfig-es2015.json +++ b/modules/@angular/compiler/tsconfig-es2015.json @@ -1,7 +1,4 @@ { - "angularCompilerOptions": { - "skipTemplateCodegen": true - }, "compilerOptions": { "baseUrl": ".", "declaration": true, diff --git a/modules/@angular/compiler/tsconfig-es5.json b/modules/@angular/compiler/tsconfig-es5.json index b71e05fd7e..2a9f278580 100644 --- a/modules/@angular/compiler/tsconfig-es5.json +++ b/modules/@angular/compiler/tsconfig-es5.json @@ -1,12 +1,8 @@ { - "angularCompilerOptions": { - "skipTemplateCodegen": true - }, "compilerOptions": { "baseUrl": ".", "declaration": true, "stripInternal": true, - "emitDecoratorMetadata": true, "experimentalDecorators": true, "module": "commonjs", "moduleResolution": "node", diff --git a/modules/@angular/core/src/di/decorators.ts b/modules/@angular/core/src/di/decorators.ts index 61db34eb65..ec7cb70b1f 100644 --- a/modules/@angular/core/src/di/decorators.ts +++ b/modules/@angular/core/src/di/decorators.ts @@ -60,18 +60,21 @@ export interface SkipSelfMetadataFactory { /** * Factory for creating {@link InjectMetadata}. * @stable + * @Annotation */ export var Inject: InjectMetadataFactory = makeParamDecorator(InjectMetadata); /** * Factory for creating {@link OptionalMetadata}. * @stable + * @Annotation */ export var Optional: OptionalMetadataFactory = makeParamDecorator(OptionalMetadata); /** * Factory for creating {@link InjectableMetadata}. * @stable + * @Annotation */ export var Injectable: InjectableMetadataFactory = makeDecorator(InjectableMetadata); @@ -79,17 +82,20 @@ export var Injectable: InjectableMetadataFactory = /** * Factory for creating {@link SelfMetadata}. * @stable + * @Annotation */ export var Self: SelfMetadataFactory = makeParamDecorator(SelfMetadata); /** * Factory for creating {@link HostMetadata}. * @stable + * @Annotation */ export var Host: HostMetadataFactory = makeParamDecorator(HostMetadata); /** * Factory for creating {@link SkipSelfMetadata}. * @stable + * @Annotation */ export var SkipSelf: SkipSelfMetadataFactory = makeParamDecorator(SkipSelfMetadata); diff --git a/modules/@angular/core/src/metadata.ts b/modules/@angular/core/src/metadata.ts index 7aed836661..acf360979d 100644 --- a/modules/@angular/core/src/metadata.ts +++ b/modules/@angular/core/src/metadata.ts @@ -471,6 +471,7 @@ export interface HostListenerMetadataFactory { * * {@example core/ts/metadata/metadata.ts region='component'} * @stable + * @Annotation */ export var Component: ComponentMetadataFactory = makeDecorator(ComponentMetadata, (fn: any) => fn.View = View); @@ -854,6 +855,7 @@ export var Component: ComponentMetadataFactory = * the instantiated * view occurs on the second `
  • ` which is a sibling to the `