feat(offline compiler): a replacement for tsc that compiles templates

see #7483.
This commit is contained in:
Alex Eagle
2016-04-28 21:57:16 -07:00
parent 33e53c9a59
commit 78946fe9fa
17 changed files with 743 additions and 23 deletions

View File

@ -0,0 +1 @@
<div></div>

View File

@ -0,0 +1,21 @@
import {Component} from 'angular2/core';
@Component({
selector: 'my-comp',
template: '<div></div>',
})
export class MyComp {
}
@Component({
selector: 'next-comp',
templateUrl: './multiple_components.html',
})
export class NextComp {
}
// Verify that exceptions from DirectiveResolver don't propagate
export function NotADirective(c: any): void {}
@NotADirective
export class HasCustomDecorator {
}

View File

@ -0,0 +1,2 @@
<div>{{ctxProp}}</div>
<form><input type="button" [(ngModel)]="ctxProp"/></form>

View File

@ -0,0 +1,14 @@
import {Component, Injectable} from 'angular2/core';
import {FORM_DIRECTIVES} from 'angular2/common';
import {MyComp} from './a/multiple_components';
@Component({
selector: 'basic',
templateUrl: './basic.html',
directives: [MyComp, FORM_DIRECTIVES],
})
@Injectable()
export class Basic {
ctxProp: string;
constructor() { this.ctxProp = 'initial value'; }
}

View File

@ -0,0 +1,8 @@
import {coreBootstrap, ReflectiveInjector} from 'angular2/core';
import {browserPlatform, BROWSER_APP_PROVIDERS} from 'angular2/platform/browser';
import {BasicNgFactory} from './basic.ngfactory';
import {Basic} from './basic';
const appInjector =
ReflectiveInjector.resolveAndCreate(BROWSER_APP_PROVIDERS, browserPlatform().injector);
coreBootstrap(appInjector, BasicNgFactory);

2
tools/compiler_cli/test/src/dep.d.ts vendored Normal file
View File

@ -0,0 +1,2 @@
// Verify we don't try to extract metadata for .d.ts files
export declare var a: string;