chore: upgrade to ts2dart@0.9.9

This commit is contained in:
Misko Hevery 2016-04-25 21:31:46 -07:00 committed by Martin Probst
parent 46cd868827
commit d2527b504a
18 changed files with 178 additions and 119 deletions

View File

@ -25,7 +25,7 @@ import * as modelModule from '../model';
*/
export interface Validator { validate(c: modelModule.AbstractControl): {[key: string]: any}; }
const REQUIRED = Validators.required;
const REQUIRED = /*@ts2dart_const*/(Validators.required);
export const REQUIRED_VALIDATOR =
CONST_EXPR(new Provider(NG_VALIDATORS, {useValue: REQUIRED, multi: true}));

View File

@ -1,63 +1,63 @@
export const $EOF = 0;
export const $TAB = 9;
export const $LF = 10;
export const $VTAB = 11;
export const $FF = 12;
export const $CR = 13;
export const $SPACE = 32;
export const $BANG = 33;
export const $DQ = 34;
export const $HASH = 35;
export const $$ = 36;
export const $PERCENT = 37;
export const $AMPERSAND = 38;
export const $SQ = 39;
export const $LPAREN = 40;
export const $RPAREN = 41;
export const $STAR = 42;
export const $PLUS = 43;
export const $COMMA = 44;
export const $MINUS = 45;
export const $PERIOD = 46;
export const $SLASH = 47;
export const $COLON = 58;
export const $SEMICOLON = 59;
export const $LT = 60;
export const $EQ = 61;
export const $GT = 62;
export const $QUESTION = 63;
export const $EOF = /*@ts2dart_const*/(0);
export const $TAB = /*@ts2dart_const*/(9);
export const $LF = /*@ts2dart_const*/(10);
export const $VTAB = /*@ts2dart_const*/(11);
export const $FF = /*@ts2dart_const*/(12);
export const $CR = /*@ts2dart_const*/(13);
export const $SPACE = /*@ts2dart_const*/(32);
export const $BANG = /*@ts2dart_const*/(33);
export const $DQ = /*@ts2dart_const*/(34);
export const $HASH = /*@ts2dart_const*/(35);
export const $$ = /*@ts2dart_const*/(36);
export const $PERCENT = /*@ts2dart_const*/(37);
export const $AMPERSAND = /*@ts2dart_const*/(38);
export const $SQ = /*@ts2dart_const*/(39);
export const $LPAREN = /*@ts2dart_const*/(40);
export const $RPAREN = /*@ts2dart_const*/(41);
export const $STAR = /*@ts2dart_const*/(42);
export const $PLUS = /*@ts2dart_const*/(43);
export const $COMMA = /*@ts2dart_const*/(44);
export const $MINUS = /*@ts2dart_const*/(45);
export const $PERIOD = /*@ts2dart_const*/(46);
export const $SLASH = /*@ts2dart_const*/(47);
export const $COLON = /*@ts2dart_const*/(58);
export const $SEMICOLON = /*@ts2dart_const*/(59);
export const $LT = /*@ts2dart_const*/(60);
export const $EQ = /*@ts2dart_const*/(61);
export const $GT = /*@ts2dart_const*/(62);
export const $QUESTION = /*@ts2dart_const*/(63);
export const $0 = 48;
export const $9 = 57;
export const $0 = /*@ts2dart_const*/(48);
export const $9 = /*@ts2dart_const*/(57);
export const $A = 65;
export const $E = 69;
export const $Z = 90;
export const $A = /*@ts2dart_const*/(65);
export const $E = /*@ts2dart_const*/(69);
export const $Z = /*@ts2dart_const*/(90);
export const $LBRACKET = 91;
export const $BACKSLASH = 92;
export const $RBRACKET = 93;
export const $CARET = 94;
export const $_ = 95;
export const $LBRACKET = /*@ts2dart_const*/(91);
export const $BACKSLASH = /*@ts2dart_const*/(92);
export const $RBRACKET = /*@ts2dart_const*/(93);
export const $CARET = /*@ts2dart_const*/(94);
export const $_ = /*@ts2dart_const*/(95);
export const $a = 97;
export const $e = 101;
export const $f = 102;
export const $n = 110;
export const $r = 114;
export const $t = 116;
export const $u = 117;
export const $v = 118;
export const $z = 122;
export const $a = /*@ts2dart_const*/(97);
export const $e = /*@ts2dart_const*/(101);
export const $f = /*@ts2dart_const*/(102);
export const $n = /*@ts2dart_const*/(110);
export const $r = /*@ts2dart_const*/(114);
export const $t = /*@ts2dart_const*/(116);
export const $u = /*@ts2dart_const*/(117);
export const $v = /*@ts2dart_const*/(118);
export const $z = /*@ts2dart_const*/(122);
export const $LBRACE = 123;
export const $BAR = 124;
export const $RBRACE = 125;
export const $NBSP = 160;
export const $LBRACE = /*@ts2dart_const*/(123);
export const $BAR = /*@ts2dart_const*/(124);
export const $RBRACE = /*@ts2dart_const*/(125);
export const $NBSP = /*@ts2dart_const*/(160);
export const $PIPE = 124;
export const $TILDA = 126;
export const $AT = 64;
export const $PIPE = /*@ts2dart_const*/(124);
export const $TILDA = /*@ts2dart_const*/(126);
export const $AT = /*@ts2dart_const*/(64);
export function isWhitespace(code: number): boolean {
return (code >= $TAB && code <= $SPACE) || (code == $NBSP);

View File

@ -110,52 +110,54 @@ function newNumberToken(index: number, n: number): Token {
export var EOF: Token = new Token(-1, TokenType.Character, 0, "");
export const $EOF = 0;
export const $TAB = 9;
export const $LF = 10;
export const $VTAB = 11;
export const $FF = 12;
export const $CR = 13;
export const $SPACE = 32;
export const $BANG = 33;
export const $DQ = 34;
export const $HASH = 35;
export const $$ = 36;
export const $PERCENT = 37;
export const $AMPERSAND = 38;
export const $SQ = 39;
export const $LPAREN = 40;
export const $RPAREN = 41;
export const $STAR = 42;
export const $PLUS = 43;
export const $COMMA = 44;
export const $MINUS = 45;
export const $PERIOD = 46;
export const $SLASH = 47;
export const $COLON = 58;
export const $SEMICOLON = 59;
export const $LT = 60;
export const $EQ = 61;
export const $GT = 62;
export const $QUESTION = 63;
export const $EOF = /*@ts2dart_const*/(0);
export const $TAB = /*@ts2dart_const*/(9);
export const $LF = /*@ts2dart_const*/(10);
export const $VTAB = /*@ts2dart_const*/(11);
export const $FF = /*@ts2dart_const*/(12);
export const $CR = /*@ts2dart_const*/(13);
export const $SPACE = /*@ts2dart_const*/(32);
export const $BANG = /*@ts2dart_const*/(33);
export const $DQ = /*@ts2dart_const*/(34);
export const $HASH = /*@ts2dart_const*/(35);
export const $$ = /*@ts2dart_const*/(36);
export const $PERCENT = /*@ts2dart_const*/(37);
export const $AMPERSAND = /*@ts2dart_const*/(38);
export const $SQ = /*@ts2dart_const*/(39);
export const $LPAREN = /*@ts2dart_const*/(40);
export const $RPAREN = /*@ts2dart_const*/(41);
export const $STAR = /*@ts2dart_const*/(42);
export const $PLUS = /*@ts2dart_const*/(43);
export const $COMMA = /*@ts2dart_const*/(44);
export const $MINUS = /*@ts2dart_const*/(45);
export const $PERIOD = /*@ts2dart_const*/(46);
export const $SLASH = /*@ts2dart_const*/(47);
export const $COLON = /*@ts2dart_const*/(58);
export const $SEMICOLON = /*@ts2dart_const*/(59);
export const $LT = /*@ts2dart_const*/(60);
export const $EQ = /*@ts2dart_const*/(61);
export const $GT = /*@ts2dart_const*/(62);
export const $QUESTION = /*@ts2dart_const*/(63);
const $0 = 48;
const $9 = 57;
const $0 = /*@ts2dart_const*/(48);
const $9 = /*@ts2dart_const*/(57);
const $A = 65, $E = 69, $Z = 90;
const $A = /*@ts2dart_const*/(65), $E = /*@ts2dart_const*/(69), $Z = /*@ts2dart_const*/(90);
export const $LBRACKET = 91;
export const $BACKSLASH = 92;
export const $RBRACKET = 93;
const $CARET = 94;
const $_ = 95;
export const $BT = 96;
const $a = 97, $e = 101, $f = 102, $n = 110, $r = 114, $t = 116, $u = 117, $v = 118, $z = 122;
export const $LBRACKET = /*@ts2dart_const*/(91);
export const $BACKSLASH = /*@ts2dart_const*/(92);
export const $RBRACKET = /*@ts2dart_const*/(93);
const $CARET = /*@ts2dart_const*/(94);
const $_ = /*@ts2dart_const*/(95);
export const $BT = /*@ts2dart_const*/(96);
const $a = /*@ts2dart_const*/(97), $e = /*@ts2dart_const*/(101), $f = /*@ts2dart_const*/(102);
const $n = /*@ts2dart_const*/(110), $r = /*@ts2dart_const*/(114), $t = /*@ts2dart_const*/(116)
const $u = /*@ts2dart_const*/(117), $v = /*@ts2dart_const*/(118), $z = /*@ts2dart_const*/(122);
export const $LBRACE = 123;
export const $BAR = 124;
export const $RBRACE = 125;
const $NBSP = 160;
export const $LBRACE = /*@ts2dart_const*/(123);
export const $BAR = /*@ts2dart_const*/(124);
export const $RBRACE = /*@ts2dart_const*/(125);
const $NBSP = /*@ts2dart_const*/(160);
export class ScannerError extends BaseException {
constructor(public message) { super(); }

View File

@ -374,7 +374,7 @@ export class ApplicationRef_ extends ApplicationRef {
}
this._loadComponent(compRef);
let c = this._injector.get(Console);
let c: Console = this._injector.get(Console);
if (assertionsEnabled()) {
c.log(
"Angular 2 is running in the development mode. Call enableProdMode() to enable the production mode.");

View File

@ -4,8 +4,9 @@ import {BaseException} from 'angular2/src/facade/exceptions';
import {ChangeDetectorRef} from '../change_detector_ref';
import {KeyValueDiffer, KeyValueDifferFactory} from '../differs/keyvalue_differs';
@CONST()
/*@ts2dart_const*/
export class DefaultKeyValueDifferFactory implements KeyValueDifferFactory {
constructor() {}
supports(obj: any): boolean { return obj instanceof Map || isJsObject(obj); }
create(cdRef: ChangeDetectorRef): KeyValueDiffer { return new DefaultKeyValueDiffer(); }

View File

@ -30,6 +30,7 @@ export interface IterableDifferFactory {
/**
* A repository of different iterable diffing strategies used by NgFor, NgClass, and others.
* @ts2dart_const
*/
@CONST()
export class IterableDiffers {

View File

@ -22,6 +22,7 @@ export interface KeyValueDifferFactory {
/**
* A repository of different Map diffing strategies used by NgClass, NgStyle, and others.
* @ts2dart_const
*/
@CONST()
export class KeyValueDiffers {

View File

@ -69,9 +69,13 @@ export class ComponentRef_ extends ComponentRef {
onDestroy(callback: Function): void { this.hostView.onDestroy(callback); }
}
<<<<<<< HEAD
const EMPTY_CONTEXT = CONST_EXPR(new Object());
@CONST()
=======
/* @ts2dart_const */
>>>>>>> 176ffd8... chore: upgrade to ts2dart@0.9.9
export class ComponentFactory {
constructor(public selector: string, private _viewFactory: Function,
private _componentType: Type) {}

View File

@ -351,7 +351,7 @@ export function main() {
.then((fixture) => {
fixture.detectChanges();
expect(fixture.debugElement.children[0].inject(Logger).log)
expect((<Logger>(fixture.debugElement.children[0].inject(Logger))).log)
.toEqual(['parent', 'nestedparent', 'child', 'nestedchild']);
async.done();

View File

@ -90,7 +90,7 @@ export function main() {
view.debugElement.componentInstance.shouldShow = true;
view.detectChanges();
var q = view.debugElement.children[0].references['q'];
var q: NeedsContentChild = view.debugElement.children[0].references['q'];
expect(q.log).toEqual([["setter", "foo"], ["init", "foo"], ["check", "foo"]]);
@ -117,7 +117,7 @@ export function main() {
.createAsync(MyComp)
.then((view) => {
view.detectChanges();
var q = view.debugElement.children[0].references['q'];
var q: NeedsViewChild = view.debugElement.children[0].references['q'];
expect(q.log).toEqual([["setter", "foo"], ["init", "foo"], ["check", "foo"]]);
@ -146,7 +146,7 @@ export function main() {
.createAsync(MyComp)
.then((view) => {
view.detectChanges();
var q = view.debugElement.children[0].references['q'];
var q: NeedsViewChild = view.debugElement.children[0].references['q'];
expect(q.log).toEqual([["setter", "foo"], ["init", "foo"], ["check", "foo"]]);

View File

@ -39,8 +39,11 @@ function creditCardValidator(c): {[key: string]: boolean} {
}
}
const creditCardValidatorBinding =
CONST_EXPR(new Provider(NG_VALIDATORS, {useValue: creditCardValidator, multi: true}));
const creditCardValidatorBinding = /** @ts2dart_const */ /** @ts2dart_Provider */ {
provide: NG_VALIDATORS,
useValue: creditCardValidator,
multi: true
};
@Directive({selector: '[credit-card]', providers: [creditCardValidatorBinding]})
class CreditCardValidator {

View File

@ -0,0 +1,33 @@
{
"compilerOptions": {
"baseUrl": ".",
"declaration": true,
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"module": "commonjs",
"moduleResolution": "node",
"outDir": "../dist/packages-ts2dart/",
"paths": {
"selenium-webdriver": ["angular2/typings/selenium-webdriver/selenium-webdriver.d.ts"],
"rxjs/*": ["../node_modules/rxjs/*"],
"angular2/upgrade": ["./upgrade-ts2dart.d.ts"],
"angular2/*": ["./angular2/*"]
},
"rootDir": ".",
"sourceMap": true,
"sourceRoot": ".",
"target": "es6"
},
"exclude": [
"angular2/upgrade/",
"angular2/core/test/typings.d.ts",
"angular2/manual_typings/globals.d.ts",
"angular2/typings/es6-collections/es6-collections.d.ts",
"angular2/typings/es6-promise/es6-promise.d.ts",
"angular2/typings/tsd.d.ts",
"angular2/typings.d.ts",
"angular1_router",
"rollup-test"
]
}

View File

@ -5333,7 +5333,7 @@
}
},
"ts2dart": {
"version": "0.7.31",
"version": "0.9.9",
"dependencies": {
"source-map": {
"version": "0.4.4"
@ -5345,9 +5345,6 @@
"version": "0.1.32"
}
}
},
"typescript": {
"version": "1.7.3"
}
}
},

10
npm-shrinkwrap.json generated
View File

@ -8503,9 +8503,8 @@
}
},
"ts2dart": {
"version": "0.7.31",
"from": "ts2dart@0.7.31",
"resolved": "https://registry.npmjs.org/ts2dart/-/ts2dart-0.7.31.tgz",
"version": "0.9.9",
"from": "ts2dart@0.9.9",
"dependencies": {
"source-map": {
"version": "0.4.4",
@ -8523,11 +8522,6 @@
"resolved": "https://registry.npmjs.org/source-map/-/source-map-0.1.32.tgz"
}
}
},
"typescript": {
"version": "1.7.3",
"from": "typescript@1.7.3",
"resolved": "https://registry.npmjs.org/typescript/-/typescript-1.7.3.tgz"
}
}
},

View File

@ -111,7 +111,7 @@
"systemjs-builder": "^0.10.3",
"through2": "^0.6.5",
"ts-api-guardian": "0.0.2",
"ts2dart": "^0.7.31",
"ts2dart": "^0.9.9",
"tsd": "^0.6.5-beta",
"tsickle": "^0.1.0",
"tslint": "^3.7.0-dev.2",

View File

@ -14,6 +14,7 @@ class TSToDartTranspiler implements DiffingBroccoliPlugin {
constructor(public inputPath: string, public cachePath: string,
public options: any /*ts2dart.TranspilerOptions*/) {
options.basePath = inputPath;
options.tsconfig = path.join(inputPath, options.tsconfig);
// Workaround for https://github.com/dart-lang/dart_style/issues/493
var ts2dart = require('ts2dart');
this.transpiler = new ts2dart.Transpiler(options);

View File

@ -83,6 +83,7 @@ class DiffingTSCompiler implements DiffingBroccoliPlugin {
}
this.tsOpts.rootDir = inputPath;
this.tsOpts.baseUrl = inputPath;
this.tsOpts.outDir = this.cachePath;
this.tsServiceHost = new CustomLanguageServiceHost(this.tsOpts, this.rootFilePaths,

View File

@ -63,11 +63,30 @@ function stripModulePrefix(relativePath: string): string {
}
function getSourceTree(options: AngularBuilderOptions) {
var tsInputTree = modulesFunnel(['**/*.js', '**/*.ts', '**/*.dart'], ['angular1_router/**/*']);
var tsInputTree = modulesFunnel(
[
'tsconfig-ts2dart.json',
'upgrade-ts2dart.d.ts',
'zone-ts2dart.d.ts',
'**/*.js',
'**/*.ts',
'**/*.dart'
], [
'rollup-test/**/*',
'angular1_router/**/*',
'angular2/upgrade/**/*',
'angular2/core/test/typings.d.ts',
'angular2/manual_typings/globals.d.ts',
'angular2/typings/es6-collections/es6-collections.d.ts',
'angular2/typings/es6-promise/es6-promise.d.ts',
'angular2/typings/tsd.d.ts',
'angular2/typings.d.ts',
]);
var transpiled = ts2dart(tsInputTree, {
generateLibraryName: true,
generateSourceMap: false,
translateBuiltins: true,
tsconfig: 'tsconfig-ts2dart.json'
});
// Native sources, dart only examples, etc.
@ -157,6 +176,8 @@ function getDocsTree() {
srcPath: 'LICENSE',
targetPatterns: ['modules/*'],
exclude: [
'*/@angular',
'*/angular2',
'*/angular1_router',
'*/angular2/src/http',
'*/payload_tests',