feat(compiler): initial version of the compiler.

Supports:
- binds text nodes, element properties and directive properties
- locates decorator, component and template directives.
- inline templates of components

The compiler is built using a pipeline design,
see core/src/compiler/pipeline package.

Integration tests to show how the compiler, change_detection and DI work
together:
core/test/compiler/integration_spec.js
This commit is contained in:
Tobias Bosch
2014-11-11 17:33:47 -08:00
parent 62efb56b0a
commit 7a70f8f92d
53 changed files with 2877 additions and 386 deletions
+5 -2
View File
@@ -1,10 +1,11 @@
import {Directive} from './directive';
import {ABSTRACT, CONST} from 'facade/lang';
import {CONST} from 'facade/lang';
export class Component extends Directive {
@CONST()
constructor({
selector,
bind,
lightDomServices,
implementsTypes,
template,
@@ -12,15 +13,17 @@ export class Component extends Directive {
componentServices
}:{
selector:String,
bind:Object,
template:TemplateConfig,
lightDomServices:DomServicesFunction,
shadowDomServices:DomServicesFunction,
componentServices:ComponentServicesFunction,
implementsTypes:Array<Type>
})
}={})
{
super({
selector: selector,
bind: bind,
lightDomServices: lightDomServices,
implementsTypes: implementsTypes});
this.template = template;
+25
View File
@@ -0,0 +1,25 @@
import {Directive} from './directive';
import {CONST} from 'facade/lang';
export class Decorator extends Directive {
@CONST()
constructor({
selector,
bind,
lightDomServices,
implementsTypes
}:{
selector:String,
bind:Object,
lightDomServices:ElementServicesFunction,
implementsTypes:Array<Type>
}={})
{
super({
selector: selector,
bind: bind,
lightDomServices: lightDomServices,
implementsTypes: implementsTypes
});
}
}
@@ -8,10 +8,12 @@ export class Directive {
@CONST()
constructor({
selector,
bind,
lightDomServices,
implementsTypes
}:{
selector:String,
bind:Object,
lightDomServices:ElementServicesFunction,
implementsTypes:Array<Type>
})
@@ -19,5 +21,6 @@ export class Directive {
this.selector = selector;
this.lightDomServices = lightDomServices;
this.implementsTypes = implementsTypes;
this.bind = bind;
}
}
+25
View File
@@ -0,0 +1,25 @@
import {Directive} from './directive';
import {CONST} from 'facade/lang';
export class Template extends Directive {
@CONST()
constructor({
selector,
bind,
lightDomServices,
implementsTypes
}:{
selector:String,
bind:Object,
lightDomServices:ElementServicesFunction,
implementsTypes:Array<Type>
}={})
{
super({
selector: selector,
bind: bind,
lightDomServices: lightDomServices,
implementsTypes: implementsTypes
});
}
}
@@ -5,17 +5,20 @@ export class TemplateConfig {
@CONST()
constructor({
url,
inline,
directives,
formatters,
source
}: {
url: String,
inline: String,
directives: List<Type>,
formatters: List<Type>,
source: List<TemplateConfig>
})
{
this.url = url;
this.inline = inline;
this.directives = directives;
this.formatters = formatters;
this.source = source;