refactor(core): move DI bindings of compiler into core/compiler/compiler.ts

Closes #4470
This commit is contained in:
Tobias Bosch 2015-10-02 11:10:08 -07:00
parent 13161ae5aa
commit 4342a1eb7b
5 changed files with 13 additions and 35 deletions

View File

@ -15,6 +15,7 @@ import {DOM} from 'angular2/src/core/dom/dom_adapter';
import {Promise, PromiseWrapper, PromiseCompleter} from 'angular2/src/core/facade/async';
import {XHR} from 'angular2/src/core/compiler/xhr';
import {XHRImpl} from 'angular2/src/core/compiler/xhr_impl';
import {
EventManager,
DomEventsPlugin,
@ -22,8 +23,6 @@ import {
} from 'angular2/src/core/render/dom/events/event_manager';
import {KeyEventsPlugin} from 'angular2/src/core/render/dom/events/key_events';
import {HammerGesturesPlugin} from 'angular2/src/core/render/dom/events/hammer_gestures';
import {AppRootUrl} from 'angular2/src/core/compiler/app_root_url';
import {AnchorBasedAppRootUrl} from 'angular2/src/core/compiler/anchor_based_app_root_url';
import {
ComponentRef,
DynamicComponentLoader
@ -31,11 +30,6 @@ import {
import {TestabilityRegistry, Testability} from 'angular2/src/core/testability/testability';
import {Renderer} from 'angular2/src/core/render/api';
import {DomRenderer, DOCUMENT} from 'angular2/src/core/render/render';
import {APP_ID_RANDOM_BINDING} from 'angular2/src/core/application_tokens';
import {ElementSchemaRegistry} from 'angular2/src/core/compiler/schema/element_schema_registry';
import {
DomElementSchemaRegistry
} from 'angular2/src/core/compiler/schema/dom_element_schema_registry';
import {
SharedStylesHost,
DomSharedStylesHost
@ -63,15 +57,11 @@ export function applicationDomBindings(): Array<Type | Binding | any[]> {
new Binding(EVENT_MANAGER_PLUGINS, {toClass: HammerGesturesPlugin, multi: true}),
DomRenderer,
bind(Renderer).toAlias(DomRenderer),
APP_ID_RANDOM_BINDING,
bind(ElementSchemaRegistry).toValue(new DomElementSchemaRegistry()),
DomSharedStylesHost,
bind(SharedStylesHost).toAlias(DomSharedStylesHost),
EXCEPTION_BINDING,
bind(XHR).toValue(new XHRImpl()),
Testability,
AnchorBasedAppRootUrl,
bind(AppRootUrl).toAlias(AnchorBasedAppRootUrl),
BrowserDetails,
AnimationBuilder,
FORM_BINDINGS

View File

@ -23,8 +23,6 @@ import {DOM} from 'angular2/src/core/dom/dom_adapter';
import {internalView} from 'angular2/src/core/linker/view_ref';
import {LifeCycle} from 'angular2/src/core/life_cycle/life_cycle';
import {
Parser,
Lexer,
IterableDiffers,
defaultIterableDiffers,
KeyValueDiffers,
@ -39,7 +37,6 @@ import {DEFAULT_PIPES} from 'angular2/src/core/pipes';
import {ViewResolver} from './linker/view_resolver';
import {DirectiveResolver} from './linker/directive_resolver';
import {PipeResolver} from './linker/pipe_resolver';
import {UrlResolver} from 'angular2/src/core/compiler/url_resolver';
import {Compiler} from 'angular2/src/core/linker/compiler';
/**
@ -99,10 +96,7 @@ export function applicationCommonBindings(): Array<Type | Binding | any[]> {
bind(IterableDiffers).toValue(defaultIterableDiffers),
bind(KeyValueDiffers).toValue(defaultKeyValueDiffers),
DirectiveResolver,
UrlResolver,
PipeResolver,
Parser,
Lexer,
DynamicComponentLoader,
bind(LifeCycle).toFactory((exceptionHandler) => new LifeCycle(null, assertionsEnabled()),
[ExceptionHandler]),

View File

@ -7,7 +7,7 @@ export 'dart:core' show List;
export 'package:angular2/src/core/change_detection/abstract_change_detector.dart'
show AbstractChangeDetector;
export 'package:angular2/src/core/change_detection/change_detection.dart'
show preGeneratedProtoDetectors, ChangeDetectionStrategy;
show ChangeDetectionStrategy;
export 'package:angular2/src/core/change_detection/directive_record.dart'
show DirectiveIndex, DirectiveRecord;
export 'package:angular2/src/core/change_detection/interfaces.dart'

View File

@ -23,9 +23,15 @@ import {ElementSchemaRegistry} from 'angular2/src/core/compiler/schema/element_s
import {
DomElementSchemaRegistry
} from 'angular2/src/core/compiler/schema/dom_element_schema_registry';
import {UrlResolver} from 'angular2/src/core/compiler/url_resolver';
import {AppRootUrl} from 'angular2/src/core/compiler/app_root_url';
import {AnchorBasedAppRootUrl} from 'angular2/src/core/compiler/anchor_based_app_root_url';
import {Parser, Lexer} from 'angular2/src/core/change_detection/change_detection';
export function compilerBindings(): Array<Type | Binding | any[]> {
return [
Lexer,
Parser,
HtmlParser,
TemplateParser,
TemplateNormalizer,
@ -40,6 +46,9 @@ export function compilerBindings(): Array<Type | Binding | any[]> {
RuntimeCompiler,
bind(Compiler).toAlias(RuntimeCompiler),
DomElementSchemaRegistry,
bind(ElementSchemaRegistry).toAlias(DomElementSchemaRegistry)
bind(ElementSchemaRegistry).toAlias(DomElementSchemaRegistry),
AnchorBasedAppRootUrl,
bind(AppRootUrl).toAlias(AnchorBasedAppRootUrl),
UrlResolver
];
}

View File

@ -6,8 +6,6 @@ import {MockAnimationBuilder} from 'angular2/src/mock/animation_builder_mock';
import {ProtoViewFactory} from 'angular2/src/core/linker/proto_view_factory';
import {Reflector, reflector} from 'angular2/src/core/reflection/reflection';
import {
Parser,
Lexer,
IterableDiffers,
defaultIterableDiffers,
KeyValueDiffers,
@ -20,9 +18,6 @@ import {DirectiveResolver} from 'angular2/src/core/linker/directive_resolver';
import {PipeResolver} from 'angular2/src/core/linker/pipe_resolver';
import {DynamicComponentLoader} from 'angular2/src/core/linker/dynamic_component_loader';
import {XHR} from 'angular2/src/core/compiler/xhr';
import {UrlResolver} from 'angular2/src/core/compiler/url_resolver';
import {AppRootUrl} from 'angular2/src/core/compiler/app_root_url';
import {AnchorBasedAppRootUrl} from 'angular2/src/core/compiler/anchor_based_app_root_url';
import {NgZone} from 'angular2/src/core/zone/ng_zone';
import {DOM} from 'angular2/src/core/dom/dom_adapter';
@ -58,11 +53,7 @@ import {
SharedStylesHost,
DomSharedStylesHost
} from 'angular2/src/core/render/render';
import {APP_ID} from 'angular2/src/core/application_tokens' import { ElementSchemaRegistry }
from 'angular2/src/core/compiler/schema/element_schema_registry';
import {
DomElementSchemaRegistry
} from 'angular2/src/core/compiler/schema/dom_element_schema_registry';
import {APP_ID} from 'angular2/src/core/application_tokens';
import {Serializer} from "angular2/src/web_workers/shared/serializer";
import {Log} from './utils';
import {compilerBindings} from 'angular2/src/core/compiler/compiler';
@ -105,7 +96,6 @@ function _getAppBindings() {
DomRenderer,
bind(Renderer).toAlias(DomRenderer),
bind(APP_ID).toValue('a'),
bind(ElementSchemaRegistry).toValue(new DomElementSchemaRegistry()),
DomSharedStylesHost,
bind(SharedStylesHost).toAlias(DomSharedStylesHost),
AppViewPool,
@ -123,14 +113,9 @@ function _getAppBindings() {
Log,
DynamicComponentLoader,
PipeResolver,
Parser,
Lexer,
bind(ExceptionHandler).toValue(new ExceptionHandler(DOM)),
bind(LocationStrategy).toClass(MockLocationStrategy),
bind(XHR).toClass(MockXHR),
UrlResolver,
AnchorBasedAppRootUrl,
bind(AppRootUrl).toAlias(AnchorBasedAppRootUrl),
TestComponentBuilder,
bind(NgZone).toClass(MockNgZone),
bind(AnimationBuilder).toClass(MockAnimationBuilder),