fix(compiler): workaround for circular dependencies in nodejs
Closes #897
This commit is contained in:
parent
e0feeaf973
commit
f1f06018c1
|
@ -4,7 +4,7 @@ import {List, ListWrapper, MapWrapper} from 'angular2/src/facade/collection';
|
||||||
import {Injector, Key, Dependency, bind, Binding, NoProviderError, ProviderError, CyclicDependencyError} from 'angular2/di';
|
import {Injector, Key, Dependency, bind, Binding, NoProviderError, ProviderError, CyclicDependencyError} from 'angular2/di';
|
||||||
import {Parent, Ancestor} from 'angular2/src/core/annotations/visibility';
|
import {Parent, Ancestor} from 'angular2/src/core/annotations/visibility';
|
||||||
import {EventEmitter, PropertySetter} from 'angular2/src/core/annotations/di';
|
import {EventEmitter, PropertySetter} from 'angular2/src/core/annotations/di';
|
||||||
import {View, ProtoView} from 'angular2/src/core/compiler/view';
|
import * as viewModule from 'angular2/src/core/compiler/view';
|
||||||
import {LightDom, SourceLightDom, DestinationLightDom} from 'angular2/src/core/compiler/shadow_dom_emulation/light_dom';
|
import {LightDom, SourceLightDom, DestinationLightDom} from 'angular2/src/core/compiler/shadow_dom_emulation/light_dom';
|
||||||
import {ViewContainer} from 'angular2/src/core/compiler/view_container';
|
import {ViewContainer} from 'angular2/src/core/compiler/view_container';
|
||||||
import {NgElement} from 'angular2/src/core/dom/element';
|
import {NgElement} from 'angular2/src/core/dom/element';
|
||||||
|
@ -30,7 +30,7 @@ class StaticKeys {
|
||||||
|
|
||||||
constructor() {
|
constructor() {
|
||||||
//TODO: vsavkin Key.annotate(Key.get(View), 'static')
|
//TODO: vsavkin Key.annotate(Key.get(View), 'static')
|
||||||
this.viewId = Key.get(View).id;
|
this.viewId = Key.get(viewModule.View).id;
|
||||||
this.ngElementId = Key.get(NgElement).id;
|
this.ngElementId = Key.get(NgElement).id;
|
||||||
this.viewContainerId = Key.get(ViewContainer).id;
|
this.viewContainerId = Key.get(ViewContainer).id;
|
||||||
this.destinationLightDomId = Key.get(DestinationLightDom).id;
|
this.destinationLightDomId = Key.get(DestinationLightDom).id;
|
||||||
|
@ -163,7 +163,7 @@ export class DirectiveBinding extends Binding {
|
||||||
|
|
||||||
// TODO(rado): benchmark and consider rolling in as ElementInjector fields.
|
// TODO(rado): benchmark and consider rolling in as ElementInjector fields.
|
||||||
export class PreBuiltObjects {
|
export class PreBuiltObjects {
|
||||||
view:View;
|
view:viewModule.View;
|
||||||
element:NgElement;
|
element:NgElement;
|
||||||
viewContainer:ViewContainer;
|
viewContainer:ViewContainer;
|
||||||
lightDom:LightDom;
|
lightDom:LightDom;
|
||||||
|
@ -222,7 +222,7 @@ export class ProtoElementInjector {
|
||||||
_keyId9:int;
|
_keyId9:int;
|
||||||
parent:ProtoElementInjector;
|
parent:ProtoElementInjector;
|
||||||
index:int;
|
index:int;
|
||||||
view:View;
|
view:viewModule.View;
|
||||||
distanceToParent:number;
|
distanceToParent:number;
|
||||||
|
|
||||||
/** Whether the element is exported as $implicit. */
|
/** Whether the element is exported as $implicit. */
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
import {Decorator} from '../../annotations/annotations';
|
import {Decorator} from '../../annotations/annotations';
|
||||||
import {SourceLightDom, DestinationLightDom, LightDom} from './light_dom';
|
import * as ldModule from './light_dom';
|
||||||
import {Inject} from 'angular2/di';
|
import {Inject} from 'angular2/di';
|
||||||
import {DOM} from 'angular2/src/dom/dom_adapter';
|
import {DOM} from 'angular2/src/dom/dom_adapter';
|
||||||
import {isPresent} from 'angular2/src/facade/lang';
|
import {isPresent} from 'angular2/src/facade/lang';
|
||||||
|
@ -68,9 +68,9 @@ class RenderedContent extends ContentStrategy {
|
||||||
* and thus does not get rendered but only affect the distribution of its parent component.
|
* and thus does not get rendered but only affect the distribution of its parent component.
|
||||||
*/
|
*/
|
||||||
class IntermediateContent extends ContentStrategy {
|
class IntermediateContent extends ContentStrategy {
|
||||||
destinationLightDom:LightDom;
|
destinationLightDom:ldModule.LightDom;
|
||||||
|
|
||||||
constructor(destinationLightDom:LightDom) {
|
constructor(destinationLightDom:ldModule.LightDom) {
|
||||||
super();
|
super();
|
||||||
this.destinationLightDom = destinationLightDom;
|
this.destinationLightDom = destinationLightDom;
|
||||||
this.nodes = [];
|
this.nodes = [];
|
||||||
|
@ -90,7 +90,7 @@ export class Content {
|
||||||
select:string;
|
select:string;
|
||||||
_strategy:ContentStrategy;
|
_strategy:ContentStrategy;
|
||||||
|
|
||||||
constructor(@Inject(DestinationLightDom) destinationLightDom, contentEl:NgElement) {
|
constructor(@Inject(ldModule.DestinationLightDom) destinationLightDom, contentEl:NgElement) {
|
||||||
this.select = contentEl.getAttribute('select');
|
this.select = contentEl.getAttribute('select');
|
||||||
this._strategy = isPresent(destinationLightDom) ?
|
this._strategy = isPresent(destinationLightDom) ?
|
||||||
new IntermediateContent(destinationLightDom) :
|
new IntermediateContent(destinationLightDom) :
|
||||||
|
|
|
@ -2,7 +2,7 @@ import {DOM} from 'angular2/src/dom/dom_adapter';
|
||||||
import {List, ListWrapper} from 'angular2/src/facade/collection';
|
import {List, ListWrapper} from 'angular2/src/facade/collection';
|
||||||
import {isBlank, isPresent} from 'angular2/src/facade/lang';
|
import {isBlank, isPresent} from 'angular2/src/facade/lang';
|
||||||
|
|
||||||
import {View} from '../view';
|
import * as viewModule from '../view';
|
||||||
import {ElementInjector} from '../element_injector';
|
import {ElementInjector} from '../element_injector';
|
||||||
import {ViewContainer} from '../view_container';
|
import {ViewContainer} from '../view_container';
|
||||||
import {Content} from './content_tag';
|
import {Content} from './content_tag';
|
||||||
|
@ -25,14 +25,14 @@ class _Root {
|
||||||
// once interfaces are supported
|
// once interfaces are supported
|
||||||
export class LightDom {
|
export class LightDom {
|
||||||
// The light DOM of the element is enclosed inside the lightDomView
|
// The light DOM of the element is enclosed inside the lightDomView
|
||||||
lightDomView:View;
|
lightDomView:viewModule.View;
|
||||||
// The shadow DOM
|
// The shadow DOM
|
||||||
shadowDomView:View;
|
shadowDomView:viewModule.View;
|
||||||
// The nodes of the light DOM
|
// The nodes of the light DOM
|
||||||
nodes:List;
|
nodes:List;
|
||||||
roots:List<_Root>;
|
roots:List<_Root>;
|
||||||
|
|
||||||
constructor(lightDomView:View, shadowDomView:View, element) {
|
constructor(lightDomView:viewModule.View, shadowDomView:viewModule.View, element) {
|
||||||
this.lightDomView = lightDomView;
|
this.lightDomView = lightDomView;
|
||||||
this.shadowDomView = shadowDomView;
|
this.shadowDomView = shadowDomView;
|
||||||
this.nodes = DOM.childNodesAsList(element);
|
this.nodes = DOM.childNodesAsList(element);
|
||||||
|
@ -51,7 +51,7 @@ export class LightDom {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Collects the Content directives from the view and all its child views
|
// Collects the Content directives from the view and all its child views
|
||||||
_collectAllContentTags(view: View, acc:List<Content>):List<Content> {
|
_collectAllContentTags(view: viewModule.View, acc:List<Content>):List<Content> {
|
||||||
var eis = view.elementInjectors;
|
var eis = view.elementInjectors;
|
||||||
for (var i = 0; i < eis.length; ++i) {
|
for (var i = 0; i < eis.length; ++i) {
|
||||||
var ei = eis[i];
|
var ei = eis[i];
|
||||||
|
|
|
@ -4,7 +4,7 @@ import {PromiseWrapper} from 'angular2/src/facade/async';
|
||||||
|
|
||||||
import {DOM} from 'angular2/src/dom/dom_adapter';
|
import {DOM} from 'angular2/src/dom/dom_adapter';
|
||||||
|
|
||||||
import {View} from './view';
|
import * as viewModule from './view';
|
||||||
|
|
||||||
import {Content} from './shadow_dom_emulation/content_tag';
|
import {Content} from './shadow_dom_emulation/content_tag';
|
||||||
import {LightDom} from './shadow_dom_emulation/light_dom';
|
import {LightDom} from './shadow_dom_emulation/light_dom';
|
||||||
|
@ -20,8 +20,8 @@ import {CompileElement} from './pipeline/compile_element';
|
||||||
import {CompileControl} from './pipeline/compile_control';
|
import {CompileControl} from './pipeline/compile_control';
|
||||||
|
|
||||||
export class ShadowDomStrategy {
|
export class ShadowDomStrategy {
|
||||||
attachTemplate(el, view:View) {}
|
attachTemplate(el, view:viewModule.View) {}
|
||||||
constructLightDom(lightDomView:View, shadowDomView:View, el): LightDom { return null; }
|
constructLightDom(lightDomView:viewModule.View, shadowDomView:viewModule.View, el): LightDom { return null; }
|
||||||
polyfillDirectives():List<Type> { return []; }
|
polyfillDirectives():List<Type> { return []; }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -78,12 +78,12 @@ export class EmulatedUnscopedShadowDomStrategy extends ShadowDomStrategy {
|
||||||
this._styleHost = styleHost;
|
this._styleHost = styleHost;
|
||||||
}
|
}
|
||||||
|
|
||||||
attachTemplate(el, view:View){
|
attachTemplate(el, view:viewModule.View){
|
||||||
DOM.clearNodes(el);
|
DOM.clearNodes(el);
|
||||||
_moveViewNodesIntoParent(el, view);
|
_moveViewNodesIntoParent(el, view);
|
||||||
}
|
}
|
||||||
|
|
||||||
constructLightDom(lightDomView:View, shadowDomView:View, el): LightDom {
|
constructLightDom(lightDomView:viewModule.View, shadowDomView:viewModule.View, el): LightDom {
|
||||||
return new LightDom(lightDomView, shadowDomView, el);
|
return new LightDom(lightDomView, shadowDomView, el);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -147,7 +147,7 @@ export class NativeShadowDomStrategy extends ShadowDomStrategy {
|
||||||
this._styleUrlResolver = styleUrlResolver;
|
this._styleUrlResolver = styleUrlResolver;
|
||||||
}
|
}
|
||||||
|
|
||||||
attachTemplate(el, view:View){
|
attachTemplate(el, view:viewModule.View){
|
||||||
_moveViewNodesIntoParent(DOM.createShadowRoot(el), view);
|
_moveViewNodesIntoParent(DOM.createShadowRoot(el), view);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue