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.
This commit is contained in:
Alex Eagle 2016-06-15 06:58:57 -07:00
parent c60ef45bc8
commit 37b617dccf
37 changed files with 37 additions and 106 deletions

View File

@ -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

View File

@ -1,12 +1,8 @@
{
"angularCompilerOptions": {
"skipTemplateCodegen": true
},
"compilerOptions": {
"baseUrl": ".",
"declaration": true,
"stripInternal": true,
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"module": "es2015",
"moduleResolution": "node",

View File

@ -1,12 +1,8 @@
{
"angularCompilerOptions": {
"skipTemplateCodegen": true
},
"compilerOptions": {
"baseUrl": ".",
"declaration": true,
"stripInternal": true,
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"module": "commonjs",
"moduleResolution": "node",

View File

@ -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'})

View File

@ -1,7 +1,4 @@
{
"angularCompilerOptions": {
"skipTemplateCodegen": true
},
"compilerOptions": {
"module": "commonjs",
"target": "es5",

View File

@ -71,4 +71,4 @@ export class SimpleJsImportGenerator implements ImportGenerator {
return importedUrlStr;
}
}
}
}

View File

@ -1,7 +1,4 @@
{
"angularCompilerOptions": {
"skipTemplateCodegen": true
},
"compilerOptions": {
"baseUrl": ".",
"declaration": true,

View File

@ -1,12 +1,8 @@
{
"angularCompilerOptions": {
"skipTemplateCodegen": true
},
"compilerOptions": {
"baseUrl": ".",
"declaration": true,
"stripInternal": true,
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"module": "commonjs",
"moduleResolution": "node",

View File

@ -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 =
<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);

View File

@ -471,6 +471,7 @@ export interface HostListenerMetadataFactory {
*
* {@example core/ts/metadata/metadata.ts region='component'}
* @stable
* @Annotation
*/
export var Component: ComponentMetadataFactory =
<ComponentMetadataFactory>makeDecorator(ComponentMetadata, (fn: any) => fn.View = View);
@ -854,6 +855,7 @@ export var Component: ComponentMetadataFactory =
* the instantiated
* view occurs on the second `<li></li>` which is a sibling to the `<template>` element.
* @stable
* @Annotation
*/
export var Directive: DirectiveMetadataFactory =
<DirectiveMetadataFactory>makeDecorator(DirectiveMetadata);
@ -888,6 +890,7 @@ export var Directive: DirectiveMetadataFactory =
* }
* ```
* @deprecated
* @Annotation
*/
var View: ViewMetadataFactory =
<ViewMetadataFactory>makeDecorator(ViewMetadata, (fn: any) => fn.View = View);
@ -909,6 +912,7 @@ var View: ViewMetadataFactory =
*
* {@example core/ts/metadata/metadata.ts region='attributeMetadata'}
* @stable
* @Annotation
*/
export var Attribute: AttributeMetadataFactory = makeParamDecorator(AttributeMetadata);
@ -1020,6 +1024,7 @@ export var Attribute: AttributeMetadataFactory = makeParamDecorator(AttributeMet
* The injected object is an unmodifiable live list.
* See {@link QueryList} for more details.
* @deprecated
* @Annotation
*/
export var Query: QueryMetadataFactory = makeParamDecorator(QueryMetadata);
@ -1044,6 +1049,7 @@ export var Query: QueryMetadataFactory = makeParamDecorator(QueryMetadata);
* }
* ```
* @stable
* @Annotation
*/
export var ContentChildren: ContentChildrenMetadataFactory =
makePropDecorator(ContentChildrenMetadata);
@ -1078,6 +1084,7 @@ export var ContentChildren: ContentChildrenMetadataFactory =
* </container>
* ```
* @stable
* @Annotation
*/
export var ContentChild: ContentChildMetadataFactory = makePropDecorator(ContentChildMetadata);
@ -1161,6 +1168,7 @@ export var ContentChild: ContentChildMetadataFactory = makePropDecorator(Content
*
* See also: [ViewChildrenMetadata]
* @stable
* @Annotation
*/
export var ViewChildren: ViewChildrenMetadataFactory = makePropDecorator(ViewChildrenMetadata);
@ -1235,6 +1243,7 @@ export var ViewChildren: ViewChildrenMetadataFactory = makePropDecorator(ViewChi
* ```
* See also: [ViewChildMetadata]
* @stable
* @Annotation
*/
export var ViewChild: ViewChildMetadataFactory = makePropDecorator(ViewChildMetadata);
@ -1274,6 +1283,7 @@ export var ViewChild: ViewChildMetadataFactory = makePropDecorator(ViewChildMeta
* The injected object is an iterable and observable live list.
* See {@link QueryList} for more details.
* @deprecated
* @Annotation
*/
export var ViewQuery: QueryMetadataFactory = makeParamDecorator(ViewQueryMetadata);
@ -1285,6 +1295,7 @@ export var ViewQuery: QueryMetadataFactory = makeParamDecorator(ViewQueryMetadat
*
* {@example core/ts/metadata/metadata.ts region='pipe'}
* @stable
* @Annotation
*/
export var Pipe: PipeMetadataFactory = <PipeMetadataFactory>makeDecorator(PipeMetadata);
@ -1330,6 +1341,7 @@ export var Pipe: PipeMetadataFactory = <PipeMetadataFactory>makeDecorator(PipeMe
* bootstrap(App);
* ```
* @stable
* @Annotation
*/
export var Input: InputMetadataFactory = makePropDecorator(InputMetadata);
@ -1375,6 +1387,7 @@ export var Input: InputMetadataFactory = makePropDecorator(InputMetadata);
* bootstrap(App);
* ```
* @stable
* @Annotation
*/
export var Output: OutputMetadataFactory = makePropDecorator(OutputMetadata);
@ -1414,6 +1427,7 @@ export var Output: OutputMetadataFactory = makePropDecorator(OutputMetadata);
* bootstrap(App);
* ```
* @stable
* @Annotation
*/
export var HostBinding: HostBindingMetadataFactory = makePropDecorator(HostBindingMetadata);
@ -1452,5 +1466,6 @@ export var HostBinding: HostBindingMetadataFactory = makePropDecorator(HostBindi
* bootstrap(App);
* ```
* @stable
* @Annotation
*/
export var HostListener: HostListenerMetadataFactory = makePropDecorator(HostListenerMetadata);

View File

@ -24,9 +24,9 @@ export function propDecorator(value: any /** TODO #9100 */) {
return new PropDecoratorMeta(value);
}
export var ClassDecorator = makeDecorator(ClassDecoratorMeta);
export var ParamDecorator = makeParamDecorator(ParamDecoratorMeta);
export var PropDecorator = makePropDecorator(PropDecoratorMeta);
/** @Annotation */ export var ClassDecorator = makeDecorator(ClassDecoratorMeta);
/** @Annotation */ export var ParamDecorator = makeParamDecorator(ParamDecoratorMeta);
/** @Annotation */ export var PropDecorator = makePropDecorator(PropDecoratorMeta);
// used only in Dart
export class HasGetterAndSetterDecorators {}

View File

@ -1,12 +1,8 @@
{
"angularCompilerOptions": {
"skipTemplateCodegen": true
},
"compilerOptions": {
"baseUrl": ".",
"declaration": true,
"stripInternal": true,
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"module": "es2015",
"moduleResolution": "node",

View File

@ -1,12 +1,8 @@
{
"angularCompilerOptions": {
"skipTemplateCodegen": true
},
"compilerOptions": {
"baseUrl": ".",
"declaration": true,
"stripInternal": true,
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"module": "commonjs",
"moduleResolution": "node",

View File

@ -1,12 +1,8 @@
{
"angularCompilerOptions": {
"skipTemplateCodegen": true
},
"compilerOptions": {
"baseUrl": ".",
"declaration": true,
"stripInternal": true,
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"module": "es2015",
"moduleResolution": "node",

View File

@ -1,12 +1,8 @@
{
"angularCompilerOptions": {
"skipTemplateCodegen": true
},
"compilerOptions": {
"baseUrl": ".",
"declaration": true,
"stripInternal": true,
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"module": "commonjs",
"moduleResolution": "node",

View File

@ -1,12 +1,8 @@
{
"angularCompilerOptions": {
"skipTemplateCodegen": true
},
"compilerOptions": {
"baseUrl": ".",
"declaration": true,
"stripInternal": true,
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"module": "es2015",
"moduleResolution": "node",

View File

@ -1,12 +1,8 @@
{
"angularCompilerOptions": {
"skipTemplateCodegen": true
},
"compilerOptions": {
"baseUrl": ".",
"declaration": true,
"stripInternal": true,
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"module": "commonjs",
"moduleResolution": "node",

View File

@ -1,12 +1,8 @@
{
"angularCompilerOptions": {
"skipTemplateCodegen": true
},
"compilerOptions": {
"baseUrl": ".",
"declaration": true,
"stripInternal": true,
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"module": "es2015",
"moduleResolution": "node",

View File

@ -1,12 +1,8 @@
{
"angularCompilerOptions": {
"skipTemplateCodegen": true
},
"compilerOptions": {
"baseUrl": ".",
"declaration": true,
"stripInternal": true,
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"module": "commonjs",
"moduleResolution": "node",

View File

@ -1,12 +1,8 @@
{
"angularCompilerOptions": {
"skipTemplateCodegen": true
},
"compilerOptions": {
"baseUrl": ".",
"declaration": true,
"stripInternal": true,
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"module": "es2015",
"moduleResolution": "node",

View File

@ -1,12 +1,8 @@
{
"angularCompilerOptions": {
"skipTemplateCodegen": true
},
"compilerOptions": {
"baseUrl": ".",
"declaration": true,
"stripInternal": true,
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"module": "commonjs",
"moduleResolution": "node",

View File

@ -1,12 +1,8 @@
{
"angularCompilerOptions": {
"skipTemplateCodegen": true
},
"compilerOptions": {
"baseUrl": ".",
"declaration": true,
"stripInternal": true,
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"module": "es2015",
"moduleResolution": "node",

View File

@ -1,12 +1,8 @@
{
"angularCompilerOptions": {
"skipTemplateCodegen": true
},
"compilerOptions": {
"baseUrl": ".",
"declaration": true,
"stripInternal": true,
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"module": "commonjs",
"moduleResolution": "node",

View File

@ -36,6 +36,7 @@ export {routerCanDeactivate, routerCanReuse, routerOnActivate, routerOnDeactivat
* ### Example
*
* {@example router/ts/can_activate/can_activate_example.ts region='canActivate' }
* @Annotation
*/
export var CanActivate:
(hook: (next: ComponentInstruction, prev: ComponentInstruction) => Promise<boolean>| boolean) =>

View File

@ -10,6 +10,7 @@ export {AsyncRoute, AuxRoute, Redirect, Route, RouteDefinition} from './route_co
* The `RouteConfig` decorator defines routes for a given component.
*
* It takes an array of {@link RouteDefinition}s.
* @Annotation
*/
export var RouteConfig: (configs: RouteDefinition[]) => ClassDecorator =
makeDecorator(RouteConfigAnnotation);

View File

@ -1,12 +1,8 @@
{
"angularCompilerOptions": {
"skipTemplateCodegen": true
},
"compilerOptions": {
"baseUrl": ".",
"declaration": true,
"stripInternal": true,
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"module": "es2015",
"moduleResolution": "node",

View File

@ -1,12 +1,8 @@
{
"angularCompilerOptions": {
"skipTemplateCodegen": true
},
"compilerOptions": {
"baseUrl": ".",
"declaration": true,
"stripInternal": true,
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"module": "commonjs",
"moduleResolution": "node",

View File

@ -17,5 +17,6 @@ export interface RoutesFactory {
* Defines routes for a given component.
*
* It takes an array of {@link RouteMetadata}s.
* @Annotation
*/
export var Routes: RoutesFactory = <RoutesFactory>makeDecorator(RoutesMetadata);

View File

@ -1,12 +1,8 @@
{
"angularCompilerOptions": {
"skipTemplateCodegen": true
},
"compilerOptions": {
"baseUrl": ".",
"declaration": true,
"stripInternal": true,
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"module": "es2015",
"moduleResolution": "node",

View File

@ -1,12 +1,8 @@
{
"angularCompilerOptions": {
"skipTemplateCodegen": true
},
"compilerOptions": {
"baseUrl": ".",
"declaration": true,
"stripInternal": true,
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"module": "commonjs",
"moduleResolution": "node",

View File

@ -1,12 +1,8 @@
{
"angularCompilerOptions": {
"skipTemplateCodegen": true
},
"compilerOptions": {
"baseUrl": ".",
"declaration": true,
"stripInternal": true,
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"module": "es2015",
"moduleResolution": "node",

View File

@ -1,12 +1,8 @@
{
"angularCompilerOptions": {
"skipTemplateCodegen": true
},
"compilerOptions": {
"baseUrl": ".",
"declaration": true,
"stripInternal": true,
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"module": "commonjs",
"moduleResolution": "node",

View File

@ -1,11 +1,7 @@
{
"angularCompilerOptions": {
"skipTemplateCodegen": true
},
"compilerOptions": {
"baseUrl": ".",
"declaration": true,
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"module": "commonjs",
"moduleResolution": "node",

View File

@ -5203,7 +5203,7 @@
}
},
"tsickle": {
"version": "0.1.4",
"version": "0.1.6",
"dependencies": {
"source-map": {
"version": "0.4.4"

4
npm-shrinkwrap.json generated
View File

@ -8293,8 +8293,8 @@
}
},
"tsickle": {
"version": "0.1.4",
"from": "tsickle@0.1.4",
"version": "0.1.6",
"from": "tsickle@0.1.6",
"dependencies": {
"source-map": {
"version": "0.4.4",

View File

@ -33,8 +33,9 @@ echo 'travis_fold:end:test.unit.node'
echo 'travis_fold:start:test.unit.localChrome'
# rebuild to codegen files in @angular/compiler/test
node dist/all/@angular/compiler-cli/src/main -p modules/tsconfig.json
# rebuild to revert files in @angular/compiler/test
# TODO(tbosch): remove this and teach karma to serve the right files
node dist/tools/@angular/tsc-wrapped/src/main -p modules/tsconfig.json
# Run unit tests in local chrome
if [[ ${TRAVIS} ]]; then

View File

@ -11,7 +11,7 @@
"license": "MIT",
"repository": {"type":"git","url":"https://github.com/angular/angular.git"},
"dependencies": {
"tsickle": "0.1.4"
"tsickle": "0.1.6"
},
"peerDependencies": {
"typescript": "^1.9.0-dev"