feat(core): extract platforms out of core

Currently, core depends on the browser, which means that other platforms (e.g., NativeScript or webworker) cannot use the bootstrapping logic core provides.
This PR extract makes bootstrapping logic in core completely platform-independent. The browser-specific code was moved to "angular2/platforms/browser".

BREAKING CHANGE

A few private helpers (e.g., platformCommon or applicationCommon) were removed or replaced with other helpers. Look at PLATFORM_COMMON_PROVIDERS, APPLICATION_COMMON_PROVIDERS, BROWSER_PROVIDERS, BROWSER_APP_PROVIDERS to see if they export the providers you need.

Closes #5219
This commit is contained in:
vsavkin 2015-11-12 08:55:22 -08:00 committed by Victor Savkin
parent 4e02e00373
commit 3f4628c0b0
38 changed files with 451 additions and 468 deletions

View File

@ -13,3 +13,4 @@ export 'package:angular2/lifecycle_hooks.dart';
export 'package:angular2/src/core/application_tokens.dart'
hide APP_COMPONENT_REF_PROMISE, APP_ID_RANDOM_PROVIDER;
export 'package:angular2/src/core/render/dom/dom_tokens.dart';
export 'package:angular2/platform/browser_static.dart' hide bootstrapStatic;

View File

@ -2,5 +2,5 @@ export * from './common';
export * from './core';
export * from './profile';
export * from './lifecycle_hooks';
export * from './bootstrap';
export * from './platform/browser';
export * from './upgrade';

View File

@ -1,5 +1,5 @@
/**
* This file is only used for dart applications and for internal examples
* that compile with both JavaScript and Dart.
* See {@link bootstrap} for more information.
* @deprecated
*/
export {bootstrap} from 'angular2/src/core/bootstrap';
export {bootstrap} from 'angular2/platform/browser';

View File

@ -1,3 +0,0 @@
library angular2.bootstrap_static;
export 'src/core/application_static.dart';

View File

@ -0,0 +1,5 @@
/**
* See {@link bootstrap} for more information.
* @deprecated
*/
export {bootstrapStatic} from 'angular2/platform/browser_static';

View File

@ -4,4 +4,5 @@
* Starting point to import all compiler APIs.
*/
export * from './src/compiler/url_resolver';
export * from './src/compiler/xhr';
export * from './src/compiler/xhr';
export * from './src/compiler/compiler';

View File

@ -7,8 +7,6 @@ export 'package:angular2/src/core/dev_mode.dart';
export 'package:angular2/src/core/di.dart';
export 'package:angular2/src/common/pipes.dart';
export 'package:angular2/src/facade/facade.dart';
// Do not export application for dart. Must import from angular2/bootstrap
//export 'package:angular2/src/core/application.dart';
export 'package:angular2/src/core/application_ref.dart'
hide ApplicationRef_, PlatformRef_;
export 'package:angular2/src/core/services.dart';
@ -20,3 +18,6 @@ export 'package:angular2/src/common/forms.dart';
export 'package:angular2/src/core/debug.dart';
export 'package:angular2/src/core/change_detection.dart';
export 'package:angular2/src/core/platform_directives_and_pipes.dart';
export 'package:angular2/src/core/platform_common_providers.dart';
export 'package:angular2/src/core/application_common_providers.dart';
export 'package:angular2/src/core/reflection/reflection.dart';

View File

@ -8,11 +8,10 @@ export * from './src/core/util';
export * from './src/core/di';
export * from './src/common/pipes';
export * from './src/facade/facade';
export * from './src/core/application';
export * from './src/core/bootstrap';
export * from './src/core/services';
export * from './src/core/linker';
export {ApplicationRef} from './src/core/application_ref';
export {platform, createNgZone, PlatformRef, ApplicationRef} from './src/core/application_ref';
export {APP_ID, APP_COMPONENT} from './src/core/application_tokens';
export * from './src/core/zone';
export * from './src/core/render';
export * from './src/common/directives';
@ -21,3 +20,6 @@ export * from './src/core/debug';
export * from './src/core/change_detection';
export * from './src/core/platform_directives_and_pipes';
export * from './src/core/dev_mode';
export * from './src/core/reflection/reflection';
export * from './src/core/application_common_providers';
export * from './src/core/platform_common_providers';

View File

@ -1,5 +1,5 @@
// #docregion enableDevMode
import {bootstrap, enableDevMode} from 'angular2/core';
import {bootstrap, enableDevMode} from 'angular2/angular2';
import {MyComponent} from 'my_component';
enableDevMode();

View File

@ -0,0 +1,113 @@
export {BROWSER_PROVIDERS} from 'angular2/src/platform/browser_common';
import {Type, isPresent, CONST_EXPR} from 'angular2/src/facade/lang';
import {Promise} from 'angular2/src/facade/promise';
import {
BROWSER_PROVIDERS,
BROWSER_APP_COMMON_PROVIDERS,
initBrowser
} from 'angular2/src/platform/browser_common';
import {COMPILER_PROVIDERS} from 'angular2/compiler';
import {ComponentRef, platform, reflector} from 'angular2/core';
import {ReflectionCapabilities} from 'angular2/src/core/reflection/reflection_capabilities';
/**
* An array of providers that should be passed into `application()` when bootstrapping a component.
*/
export const BROWSER_APP_PROVIDERS: Array<any /*Type | Provider | any[]*/> =
CONST_EXPR([BROWSER_APP_COMMON_PROVIDERS, COMPILER_PROVIDERS]);
/**
* Bootstrapping for Angular applications.
*
* You instantiate an Angular application by explicitly specifying a component to use
* as the root component for your application via the `bootstrap()` method.
*
* ## Simple Example
*
* Assuming this `index.html`:
*
* ```html
* <html>
* <!-- load Angular script tags here. -->
* <body>
* <my-app>loading...</my-app>
* </body>
* </html>
* ```
*
* An application is bootstrapped inside an existing browser DOM, typically `index.html`.
* Unlike Angular 1, Angular 2 does not compile/process providers in `index.html`. This is
* mainly for security reasons, as well as architectural changes in Angular 2. This means
* that `index.html` can safely be processed using server-side technologies such as
* providers. Bindings can thus use double-curly `{{ syntax }}` without collision from
* Angular 2 component double-curly `{{ syntax }}`.
*
* We can use this script code:
*
* ```
* @Component({
* selector: 'my-app',
* template: 'Hello {{ name }}!'
* })
* class MyApp {
* name:string;
*
* constructor() {
* this.name = 'World';
* }
* }
*
* main() {
* return bootstrap(MyApp);
* }
* ```
*
* When the app developer invokes `bootstrap()` with the root component `MyApp` as its
* argument, Angular performs the following tasks:
*
* 1. It uses the component's `selector` property to locate the DOM element which needs
* to be upgraded into the angular component.
* 2. It creates a new child injector (from the platform injector). Optionally, you can
* also override the injector configuration for an app by invoking `bootstrap` with the
* `componentInjectableBindings` argument.
* 3. It creates a new `Zone` and connects it to the angular application's change detection
* domain instance.
* 4. It creates an emulated or shadow DOM on the selected component's host element and loads the
* template into it.
* 5. It instantiates the specified component.
* 6. Finally, Angular performs change detection to apply the initial data providers for the
* application.
*
*
* ## Bootstrapping Multiple Applications
*
* When working within a browser window, there are many singleton resources: cookies, title,
* location, and others. Angular services that represent these resources must likewise be
* shared across all Angular applications that occupy the same browser window. For this
* reason, Angular creates exactly one global platform object which stores all shared
* services, and each angular application injector has the platform injector as its parent.
*
* Each application has its own private injector as well. When there are multiple
* applications on a page, Angular treats each application injector's services as private
* to that application.
*
* ## API
*
* - `appComponentType`: The root component which should act as the application. This is
* a reference to a `Type` which is annotated with `@Component(...)`.
* - `customProviders`: An additional set of providers that can be added to the
* app injector to override default injection behavior.
*
* Returns a `Promise` of {@link ComponentRef}.
*/
export function bootstrap(
appComponentType: Type,
customProviders?: Array<any /*Type | Provider | any[]*/>): Promise<ComponentRef> {
reflector.reflectionCapabilities = new ReflectionCapabilities();
initBrowser();
let appProviders =
isPresent(customProviders) ? [BROWSER_APP_PROVIDERS, customProviders] : BROWSER_APP_PROVIDERS;
return platform(BROWSER_PROVIDERS).application(appProviders).bootstrap(appComponentType);
}

View File

@ -0,0 +1,34 @@
export {BROWSER_PROVIDERS} from 'angular2/src/platform/browser_common';
import {Type, isPresent, CONST_EXPR} from 'angular2/src/facade/lang';
import {Promise} from 'angular2/src/facade/promise';
import {
BROWSER_PROVIDERS,
BROWSER_APP_COMMON_PROVIDERS,
initBrowser
} from 'angular2/src/platform/browser_common';
import {ComponentRef, platform, reflector} from 'angular2/core';
/**
* An array of providers that should be passed into `application()` when bootstrapping a component
* when all templates
* have been precompiled offline.
*/
export const BROWSER_APP_PROVIDERS: Array<any /*Type | Provider | any[]*/> =
BROWSER_APP_COMMON_PROVIDERS;
/**
* See {@link bootstrap} for more information.
*/
export function bootstrapStatic(appComponentType: Type,
customProviders?: Array<any /*Type | Provider | any[]*/>,
initReflector?: Function): Promise<ComponentRef> {
initBrowser();
if (isPresent(initReflector)) {
initReflector();
}
let appProviders =
isPresent(customProviders) ? [BROWSER_APP_PROVIDERS, customProviders] : BROWSER_APP_PROVIDERS;
return platform(BROWSER_PROVIDERS).application(appProviders).bootstrap(appComponentType);
}

View File

@ -8,7 +8,7 @@ export {
export {SourceModule, SourceWithImports} from './source_module';
export {PLATFORM_DIRECTIVES, PLATFORM_PIPES} from 'angular2/src/core/platform_directives_and_pipes';
import {assertionsEnabled, Type} from 'angular2/src/facade/lang';
import {assertionsEnabled, Type, CONST_EXPR} from 'angular2/src/facade/lang';
import {provide, Provider} from 'angular2/src/core/di';
import {TemplateParser} from 'angular2/src/compiler/template_parser';
import {HtmlParser} from 'angular2/src/compiler/html_parser';
@ -28,26 +28,27 @@ import {AppRootUrl} from 'angular2/src/compiler/app_root_url';
import {AnchorBasedAppRootUrl} from 'angular2/src/compiler/anchor_based_app_root_url';
import {Parser, Lexer} from 'angular2/src/core/change_detection/change_detection';
export function compilerProviders(): Array<Type | Provider | any[]> {
return [
Lexer,
Parser,
HtmlParser,
TemplateParser,
TemplateNormalizer,
RuntimeMetadataResolver,
StyleCompiler,
CommandCompiler,
ChangeDetectionCompiler,
provide(ChangeDetectorGenConfig,
{useValue: new ChangeDetectorGenConfig(assertionsEnabled(), false, true)}),
TemplateCompiler,
provide(RuntimeCompiler, {useClass: RuntimeCompiler_}),
provide(Compiler, {useExisting: RuntimeCompiler}),
DomElementSchemaRegistry,
provide(ElementSchemaRegistry, {useExisting: DomElementSchemaRegistry}),
AnchorBasedAppRootUrl,
provide(AppRootUrl, {useExisting: AnchorBasedAppRootUrl}),
UrlResolver
];
function _createChangeDetectorGenConfig() {
return new ChangeDetectorGenConfig(assertionsEnabled(), false, true);
}
export const COMPILER_PROVIDERS: Array<Type | Provider | any[]> = CONST_EXPR([
Lexer,
Parser,
HtmlParser,
TemplateParser,
TemplateNormalizer,
RuntimeMetadataResolver,
StyleCompiler,
CommandCompiler,
ChangeDetectionCompiler,
new Provider(ChangeDetectorGenConfig, {useFactory: _createChangeDetectorGenConfig, deps: []}),
TemplateCompiler,
new Provider(RuntimeCompiler, {useClass: RuntimeCompiler_}),
new Provider(Compiler, {useExisting: RuntimeCompiler}),
DomElementSchemaRegistry,
new Provider(ElementSchemaRegistry, {useExisting: DomElementSchemaRegistry}),
AnchorBasedAppRootUrl,
new Provider(AppRootUrl, {useExisting: AnchorBasedAppRootUrl}),
UrlResolver
]);

View File

@ -1,29 +0,0 @@
library angular2.src.core.application;
import 'dart:async';
import 'package:angular2/src/core/reflection/reflection.dart' show reflector;
import 'package:angular2/src/core/reflection/reflection_capabilities.dart'
show ReflectionCapabilities;
import 'application_common.dart';
import 'package:angular2/src/compiler/compiler.dart';
import 'package:angular2/src/core/linker/dynamic_component_loader.dart';
export 'package:angular2/src/core/linker/dynamic_component_loader.dart'
show ComponentRef;
/// Starts an application from a root component. This implementation uses
/// mirrors. Angular 2 transformer automatically replaces this method with a
/// static implementation (see `application_static.dart`) that does not use
/// mirrors and produces a faster and more compact JS code.
///
/// See [commonBootstrap] for detailed documentation.
Future<ComponentRef> bootstrap(Type appComponentType,
[List componentInjectableProviders]) {
reflector.reflectionCapabilities = new ReflectionCapabilities();
var providers = [compilerProviders()];
if (componentInjectableProviders != null) {
providers.add(componentInjectableProviders);
}
return commonBootstrap(appComponentType, providers);
}

View File

@ -1,29 +0,0 @@
// Public API for Application
import {Provider} from './di';
import {Type, isPresent} from 'angular2/src/facade/lang';
import {Promise} from 'angular2/src/facade/async';
import {compilerProviders} from 'angular2/src/compiler/compiler';
import {commonBootstrap} from './application_common';
import {ComponentRef} from './linker/dynamic_component_loader';
export {APP_COMPONENT, APP_ID} from './application_tokens';
export {platform} from './application_common';
export {
PlatformRef,
ApplicationRef,
applicationCommonProviders,
createNgZone,
platformCommon,
platformProviders
} from './application_ref';
/// See [commonBootstrap] for detailed documentation.
export function bootstrap(
appComponentType: /*Type*/ any,
appProviders: Array<Type | Provider | any[]> = null): Promise<ComponentRef> {
var providers = [compilerProviders()];
if (isPresent(appProviders)) {
providers.push(appProviders);
}
return commonBootstrap(appComponentType, providers);
}

View File

@ -1,219 +0,0 @@
import {FORM_PROVIDERS} from 'angular2/src/common/forms';
import {provide, Provider} from 'angular2/src/core/di';
import {Type, isBlank, isPresent, stringify} from 'angular2/src/facade/lang';
import {BrowserDomAdapter} from 'angular2/src/core/dom/browser_adapter';
import {BrowserGetTestability} from 'angular2/src/core/testability/browser_testability';
import {DOM} from 'angular2/src/core/dom/dom_adapter';
import {Promise} from 'angular2/src/facade/async';
import {XHR} from 'angular2/src/compiler/xhr';
import {XHRImpl} from 'angular2/src/compiler/xhr_impl';
import {
EventManager,
DomEventsPlugin,
EVENT_MANAGER_PLUGINS
} 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 {ComponentRef} from 'angular2/src/core/linker/dynamic_component_loader';
import {Testability} from 'angular2/src/core/testability/testability';
import {Renderer} from 'angular2/src/core/render/api';
import {DomRenderer, DomRenderer_, DOCUMENT} from 'angular2/src/core/render/render';
import {
SharedStylesHost,
DomSharedStylesHost
} from 'angular2/src/core/render/dom/shared_styles_host';
import {EXCEPTION_PROVIDER} from './platform_bindings';
import {AnimationBuilder} from 'angular2/src/animate/animation_builder';
import {BrowserDetails} from 'angular2/src/animate/browser_details';
import {wtfInit} from './profile/wtf_init';
import {platformCommon, PlatformRef, applicationCommonProviders} from './application_ref';
/**
* A default set of providers which apply only to an Angular application running on
* the UI thread.
*/
export function applicationDomProviders(): Array<Type | Provider | any[]> {
if (isBlank(DOM)) {
throw "Must set a root DOM adapter first.";
}
return [
provide(DOCUMENT, {useValue: DOM.defaultDoc()}),
EventManager,
new Provider(EVENT_MANAGER_PLUGINS, {useClass: DomEventsPlugin, multi: true}),
new Provider(EVENT_MANAGER_PLUGINS, {useClass: KeyEventsPlugin, multi: true}),
new Provider(EVENT_MANAGER_PLUGINS, {useClass: HammerGesturesPlugin, multi: true}),
provide(DomRenderer, {useClass: DomRenderer_}),
provide(Renderer, {useExisting: DomRenderer}),
DomSharedStylesHost,
provide(SharedStylesHost, {useExisting: DomSharedStylesHost}),
EXCEPTION_PROVIDER,
provide(XHR, {useValue: new XHRImpl()}),
Testability,
BrowserDetails,
AnimationBuilder,
FORM_PROVIDERS
];
}
/**
* Initialize the Angular 'platform' on the page.
*
* See {@link PlatformRef} for details on the Angular platform.
*
*##Without specified providers
*
* If no providers are specified, `platform`'s behavior depends on whether an existing
* platform exists:
*
* If no platform exists, a new one will be created with the default {@link platformProviders}.
*
* If a platform already exists, it will be returned (regardless of what providers it
* was created with). This is a convenience feature, allowing for multiple applications
* to be loaded into the same platform without awareness of each other.
*
*##With specified providers
*
* It is also possible to specify providers to be made in the new platform. These providers
* will be shared between all applications on the page. For example, an abstraction for
* the browser cookie jar should be bound at the platform level, because there is only one
* cookie jar regardless of how many applications on the page will be accessing it.
*
* If providers are specified directly, `platform` will create the Angular platform with
* them if a platform did not exist already. If it did exist, however, an error will be
* thrown.
*
*##DOM Applications
*
* This version of `platform` initializes Angular to run in the UI thread, with direct
* DOM access. Web-worker applications should call `platform` from
* `src/web_workers/worker/application_common` instead.
*/
export function platform(providers?: Array<Type | Provider | any[]>): PlatformRef {
return platformCommon(providers, () => {
BrowserDomAdapter.makeCurrent();
wtfInit();
BrowserGetTestability.init();
});
}
/**
* Bootstrapping for Angular applications.
*
* You instantiate an Angular application by explicitly specifying a component to use
* as the root component for your application via the `bootstrap()` method.
*
* ## Simple Example
*
* Assuming this `index.html`:
*
* ```html
* <html>
* <!-- load Angular script tags here. -->
* <body>
* <my-app>loading...</my-app>
* </body>
* </html>
* ```
*
* An application is bootstrapped inside an existing browser DOM, typically `index.html`.
* Unlike Angular 1, Angular 2 does not compile/process providers in `index.html`. This is
* mainly for security reasons, as well as architectural changes in Angular 2. This means
* that `index.html` can safely be processed using server-side technologies such as
* providers. Bindings can thus use double-curly `{{ syntax }}` without collision from
* Angular 2 component double-curly `{{ syntax }}`.
*
* We can use this script code:
*
* ```
* @Component({
* selector: 'my-app',
* template: 'Hello {{ name }}!'
* })
* class MyApp {
* name:string;
*
* constructor() {
* this.name = 'World';
* }
* }
*
* main() {
* return bootstrap(MyApp);
* }
* ```
*
* When the app developer invokes `bootstrap()` with the root component `MyApp` as its
* argument, Angular performs the following tasks:
*
* 1. It uses the component's `selector` property to locate the DOM element which needs
* to be upgraded into the angular component.
* 2. It creates a new child injector (from the platform injector). Optionally, you can
* also override the injector configuration for an app by invoking `bootstrap` with the
* `componentInjectableBindings` argument.
* 3. It creates a new `Zone` and connects it to the angular application's change detection
* domain instance.
* 4. It creates an emulated or shadow DOM on the selected component's host element and loads the
* template into it.
* 5. It instantiates the specified component.
* 6. Finally, Angular performs change detection to apply the initial data providers for the
* application.
*
*
* ## Instantiating Multiple Applications on a Single Page
*
* There are two ways to do this.
*
* ### Isolated Applications
*
* Angular creates a new application each time that the `bootstrap()` method is invoked.
* When multiple applications are created for a page, Angular treats each application as
* independent within an isolated change detection and `Zone` domain. If you need to share
* data between applications, use the strategy described in the next section, "Applications
* That Share Change Detection."
*
*
* ### Applications That Share Change Detection
*
* If you need to bootstrap multiple applications that share common data, the applications
* must share a common change detection and zone. To do that, create a meta-component that
* lists the application components in its template.
*
* By only invoking the `bootstrap()` method once, with the meta-component as its argument,
* you ensure that only a single change detection zone is created and therefore data can be
* shared across the applications.
*
*
* ## Platform Injector
*
* When working within a browser window, there are many singleton resources: cookies, title,
* location, and others. Angular services that represent these resources must likewise be
* shared across all Angular applications that occupy the same browser window. For this
* reason, Angular creates exactly one global platform injector which stores all shared
* services, and each angular application injector has the platform injector as its parent.
*
* Each application has its own private injector as well. When there are multiple
* applications on a page, Angular treats each application injector's services as private
* to that application.
*
*
*##API
* - `appComponentType`: The root component which should act as the application. This is
* a reference to a `Type` which is annotated with `@Component(...)`.
* - `componentInjectableBindings`: An additional set of providers that can be added to the
* app injector to override default injection behavior.
* - `errorReporter`: `function(exception:any, stackTrace:string)` a default error reporter
* for unhandled exceptions.
*
* Returns a `Promise` of {@link ComponentRef}.
*/
export function commonBootstrap(
appComponentType: /*Type*/ any,
appProviders: Array<Type | Provider | any[]> = null): Promise<ComponentRef> {
var p = platform();
var bindings = [applicationCommonProviders(), applicationDomProviders()];
if (isPresent(appProviders)) {
bindings.push(appProviders);
}
return p.application(bindings).bootstrap(appComponentType);
}

View File

@ -0,0 +1,49 @@
import {Type, CONST_EXPR} from 'angular2/src/facade/lang';
import {provide, Provider, Injector, OpaqueToken} from 'angular2/src/core/di';
import {
APP_COMPONENT_REF_PROMISE,
APP_COMPONENT,
APP_ID_RANDOM_PROVIDER
} from './application_tokens';
import {
IterableDiffers,
defaultIterableDiffers,
KeyValueDiffers,
defaultKeyValueDiffers
} from './change_detection/change_detection';
import {AppViewPool, APP_VIEW_POOL_CAPACITY} from './linker/view_pool';
import {AppViewManager} from './linker/view_manager';
import {AppViewManager_} from "./linker/view_manager";
import {AppViewManagerUtils} from './linker/view_manager_utils';
import {ViewResolver} from './linker/view_resolver';
import {AppViewListener} from './linker/view_listener';
import {ProtoViewFactory} from './linker/proto_view_factory';
import {DirectiveResolver} from './linker/directive_resolver';
import {PipeResolver} from './linker/pipe_resolver';
import {Compiler} from './linker/compiler';
import {Compiler_} from "./linker/compiler";
import {DynamicComponentLoader} from './linker/dynamic_component_loader';
import {DynamicComponentLoader_} from "./linker/dynamic_component_loader";
import {EventManager} from './render/dom/events/event_manager';
/**
* A default set of providers which should be included in any Angular
* application, regardless of the platform it runs onto.
*/
export const APPLICATION_COMMON_PROVIDERS: Array<Type | Provider | any[]> = CONST_EXPR([
new Provider(Compiler, {useClass: Compiler_}),
APP_ID_RANDOM_PROVIDER,
AppViewPool,
new Provider(APP_VIEW_POOL_CAPACITY, {useValue: 10000}),
new Provider(AppViewManager, {useClass: AppViewManager_}),
AppViewManagerUtils,
AppViewListener,
ProtoViewFactory,
ViewResolver,
new Provider(IterableDiffers, {useValue: defaultIterableDiffers}),
new Provider(KeyValueDiffers, {useValue: defaultKeyValueDiffers}),
DirectiveResolver,
PipeResolver,
new Provider(DynamicComponentLoader, {useClass: DynamicComponentLoader_}),
EventManager
]);

View File

@ -13,7 +13,6 @@ import {
ObservableWrapper
} from 'angular2/src/facade/async';
import {ListWrapper} from 'angular2/src/facade/collection';
import {Reflector, reflector} from 'angular2/src/core/reflection/reflection';
import {TestabilityRegistry, Testability} from 'angular2/src/core/testability/testability';
import {
ComponentRef,
@ -27,39 +26,10 @@ import {
} from 'angular2/src/facade/exceptions';
import {DOM} from 'angular2/src/core/dom/dom_adapter';
import {internalView} from 'angular2/src/core/linker/view_ref';
import {
IterableDiffers,
defaultIterableDiffers,
KeyValueDiffers,
defaultKeyValueDiffers
} from 'angular2/src/core/change_detection/change_detection';
import {AppViewPool, APP_VIEW_POOL_CAPACITY} from 'angular2/src/core/linker/view_pool';
import {AppViewManager} from 'angular2/src/core/linker/view_manager';
import {AppViewManagerUtils} from 'angular2/src/core/linker/view_manager_utils';
import {AppViewListener} from 'angular2/src/core/linker/view_listener';
import {ProtoViewFactory} from './linker/proto_view_factory';
import {ViewResolver} from './linker/view_resolver';
import {DirectiveResolver} from './linker/directive_resolver';
import {PipeResolver} from './linker/pipe_resolver';
import {Compiler} from 'angular2/src/core/linker/compiler';
import {DynamicComponentLoader_} from "./linker/dynamic_component_loader";
import {AppViewManager_} from "./linker/view_manager";
import {Compiler_} from "./linker/compiler";
import {wtfLeave, wtfCreateScope, WtfScopeFn} from './profile/profile';
import {ChangeDetectorRef} from 'angular2/src/core/change_detection/change_detector_ref';
import {PLATFORM_DIRECTIVES, PLATFORM_PIPES} from "angular2/src/core/platform_directives_and_pipes";
import {lockDevMode} from 'angular2/src/facade/lang';
import {COMMON_DIRECTIVES, COMMON_PIPES} from "angular2/common";
/**
* Constructs the set of providers meant for use at the platform level.
*
* These are providers that should be singletons shared among all Angular applications
* running on the page.
*/
export function platformProviders(): Array<Type | Provider | any[]> {
return [provide(Reflector, {useValue: reflector}), TestabilityRegistry];
}
/**
* Construct providers specific to an individual root component.
@ -96,31 +66,6 @@ function _componentProviders(appComponentType: Type): Array<Type | Provider | an
];
}
/**
* Construct a default set of providers which should be included in any Angular
* application, regardless of whether it runs on the UI thread or in a web worker.
*/
export function applicationCommonProviders(): Array<Type | Provider | any[]> {
return [
provide(Compiler, {useClass: Compiler_}),
APP_ID_RANDOM_PROVIDER,
AppViewPool,
provide(APP_VIEW_POOL_CAPACITY, {useValue: 10000}),
provide(AppViewManager, {useClass: AppViewManager_}),
AppViewManagerUtils,
AppViewListener,
ProtoViewFactory,
ViewResolver,
provide(IterableDiffers, {useValue: defaultIterableDiffers}),
provide(KeyValueDiffers, {useValue: defaultKeyValueDiffers}),
DirectiveResolver,
PipeResolver,
provide(PLATFORM_PIPES, {useValue: COMMON_PIPES, multi: true}),
provide(PLATFORM_DIRECTIVES, {useValue: COMMON_DIRECTIVES, multi: true}),
provide(DynamicComponentLoader, {useClass: DynamicComponentLoader_})
];
}
/**
* Create an Angular zone.
*/
@ -129,25 +74,41 @@ export function createNgZone(): NgZone {
}
var _platform: PlatformRef;
var _platformProviders: any[];
export function platformCommon(providers?: Array<Type | Provider | any[]>,
initializer?: () => void): PlatformRef {
/**
* Initialize the Angular 'platform' on the page.
*
* See {@link PlatformRef} for details on the Angular platform.
*
* It is also possible to specify providers to be made in the new platform. These providers
* will be shared between all applications on the page. For example, an abstraction for
* the browser cookie jar should be bound at the platform level, because there is only one
* cookie jar regardless of how many applications on the page will be accessing it.
*
* The platform function can be called multiple times as long as the same list of providers
* is passed into each call. If the platform function is called with a different set of
* provides, Angular will throw an exception.
*/
export function platform(providers?: Array<Type | Provider | any[]>): PlatformRef {
lockDevMode();
if (isPresent(_platform)) {
if (isBlank(providers)) {
if (ListWrapper.equals(_platformProviders, providers)) {
return _platform;
} else {
throw new BaseException("platform cannot be initialized with different sets of providers.");
}
throw "platform() can only be called once per page";
} else {
return _createPlatform(providers);
}
}
if (isPresent(initializer)) {
initializer();
}
if (isBlank(providers)) {
providers = platformProviders();
}
_platform = new PlatformRef_(Injector.resolveAndCreate(providers), () => { _platform = null; });
function _createPlatform(providers?: Array<Type | Provider | any[]>): PlatformRef {
_platformProviders = providers;
_platform = new PlatformRef_(Injector.resolveAndCreate(providers), () => {
_platform = null;
_platformProviders = null;
});
return _platform;
}
@ -192,7 +153,7 @@ export abstract class PlatformRef {
* var myAppProviders = [MyAppService];
*
* platform()
* .application([applicationCommonProviders(), applicationDomProviders(), myAppProviders])
* .application([myAppProviders])
* .bootstrap(MyTopLevelComponent);
* ```
*##See Also
@ -255,8 +216,10 @@ export class PlatformRef_ extends PlatformRef {
var injector: Injector;
var app: ApplicationRef;
zone.run(() => {
providers.push(provide(NgZone, {useValue: zone}));
providers.push(provide(ApplicationRef, {useFactory: (): ApplicationRef => app, deps: []}));
providers = ListWrapper.concat(providers, [
provide(NgZone, {useValue: zone}),
provide(ApplicationRef, {useFactory: (): ApplicationRef => app, deps: []})
]);
var exceptionHandler;
try {
@ -320,7 +283,7 @@ export abstract class ApplicationRef {
*
* ### Example
* ```
* var app = platform.application([applicationCommonProviders(), applicationDomProviders()];
* var app = platform.application([appProviders];
* app.bootstrap(FirstRootComponent);
* app.bootstrap(SecondRootComponent, [provide(OverrideBinding, {useClass: OverriddenBinding})]);
* ```

View File

@ -1,17 +0,0 @@
library angular2.src.core.application_static;
import 'dart:async';
import 'application_common.dart';
import 'package:angular2/src/core/linker/dynamic_component_loader.dart'
show ComponentRef;
/// Starts an application from a root component.
///
/// See [commonBootstrap] for detailed documentation.
Future<ComponentRef> bootstrapStatic(Type appComponentType,
[List componentInjectableBindings, void initReflector()]) {
if (initReflector != null) {
initReflector();
}
return commonBootstrap(appComponentType, componentInjectableBindings);
}

View File

@ -1,3 +0,0 @@
library angular2.src.core.bootstrap;
export './application.dart' show bootstrap;

View File

@ -1,4 +0,0 @@
// Note: This file only exists so that Dart users can import
// bootstrap from angular2/bootstrap. JS users should import
// from angular2/core.
export {bootstrap} from './application';

View File

@ -1,7 +1,7 @@
import {ListWrapper, StringMapWrapper} from 'angular2/src/facade/collection';
import {isPresent, isFunction, Type} from 'angular2/src/facade/lang';
import {DomAdapter} from './dom_adapter';
import {XHRImpl} from 'angular2/src/compiler/xhr_impl';
import {XHRImpl} from 'angular2/src/platform/browser/xhr_impl';
/**

View File

@ -1,12 +0,0 @@
library angular2.src.core.platform_bindings;
import 'package:angular2/core.dart';
import 'package:angular2/src/facade/exceptions.dart';
import 'package:angular2/src/core/dom/dom_adapter.dart';
exceptionFactory() => new ExceptionHandler(DOM, true);
const EXCEPTION_PROVIDER = const Binding(ExceptionHandler,
toFactory: exceptionFactory, deps: const []);
const EXCEPTION_BINDING = EXCEPTION_PROVIDER;

View File

@ -1,8 +0,0 @@
import {provide} from 'angular2/src/core/di';
import {ExceptionHandler} from 'angular2/src/facade/exceptions';
import {DOM} from 'angular2/src/core/dom/dom_adapter';
export const EXCEPTION_PROVIDER =
provide(ExceptionHandler, {useFactory: () => new ExceptionHandler(DOM, false), deps: []});
export const EXCEPTION_BINDING = EXCEPTION_PROVIDER;

View File

@ -0,0 +1,14 @@
import {Type, isBlank, isPresent, assertionsEnabled, CONST_EXPR} from 'angular2/src/facade/lang';
import {provide, Provider, Injector, OpaqueToken} from 'angular2/src/core/di';
import {Reflector, reflector} from './reflection/reflection';
import {TestabilityRegistry} from 'angular2/src/core/testability/testability';
function _reflector(): Reflector {
return reflector;
}
/**
* A default set of providers which should be included in any Angular platform.
*/
export const PLATFORM_COMMON_PROVIDERS: Array<Type | Provider | any[]> =
CONST_EXPR([new Provider(Reflector, {useFactory: _reflector, deps: []}), TestabilityRegistry]);

View File

@ -3,7 +3,7 @@ library angular2.src.services.xhr_impl;
import 'dart:async' show Future;
import 'dart:html' show HttpRequest;
import 'package:angular2/core.dart';
import './xhr.dart' show XHR;
import 'package:angular2/compiler.dart' show XHR;
@Injectable()
class XHRImpl extends XHR {

View File

@ -1,6 +1,6 @@
import {Promise, PromiseWrapper, PromiseCompleter} from 'angular2/src/facade/promise';
import {isPresent} from 'angular2/src/facade/lang';
import {XHR} from './xhr';
import {XHR} from 'angular2/src/compiler/xhr';
export class XHRImpl extends XHR {
get(url: string): Promise<string> {

View File

@ -0,0 +1,75 @@
import {CONST_EXPR} from 'angular2/src/facade/lang';
import {provide, Provider, Injector, OpaqueToken} from 'angular2/src/core/di';
import {XHR} from 'angular2/compiler';
import {
PLATFORM_DIRECTIVES,
PLATFORM_PIPES,
ComponentRef,
platform,
ExceptionHandler,
Reflector,
reflector,
APPLICATION_COMMON_PROVIDERS,
PLATFORM_COMMON_PROVIDERS
} from "angular2/core";
import {COMMON_DIRECTIVES, COMMON_PIPES, FORM_PROVIDERS} from "angular2/common";
import {Renderer} from 'angular2/render';
import {XHRImpl} from "angular2/src/platform/browser/xhr_impl";
import {Testability} from 'angular2/src/core/testability/testability';
// TODO change these imports once dom_adapter is moved out of core
import {DOM} from 'angular2/src/core/dom/dom_adapter';
import {
DomEventsPlugin,
EVENT_MANAGER_PLUGINS
} 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 {DOCUMENT} from 'angular2/src/core/render/dom/dom_tokens';
import {DomRenderer, DomRenderer_} from 'angular2/src/core/render/dom/dom_renderer';
import {DomSharedStylesHost} from 'angular2/src/core/render/dom/shared_styles_host';
import {SharedStylesHost} from "angular2/src/core/render/dom/shared_styles_host";
import {BrowserDetails} from "angular2/src/animate/browser_details";
import {AnimationBuilder} from "angular2/src/animate/animation_builder";
import {BrowserDomAdapter} from 'angular2/src/core/dom/browser_adapter';
import {BrowserGetTestability} from 'angular2/src/core/testability/browser_testability';
import {wtfInit} from 'angular2/src/core/profile/wtf_init';
export const BROWSER_PROVIDERS: Array<any /*Type | Provider | any[]*/> =
CONST_EXPR([PLATFORM_COMMON_PROVIDERS]);
function _exceptionHandler(): ExceptionHandler {
return new ExceptionHandler(DOM, false);
}
function _document(): any {
return DOM.defaultDoc();
}
export const BROWSER_APP_COMMON_PROVIDERS: Array<any /*Type | Provider | any[]*/> = CONST_EXPR([
APPLICATION_COMMON_PROVIDERS,
FORM_PROVIDERS,
new Provider(PLATFORM_PIPES, {useValue: COMMON_PIPES, multi: true}),
new Provider(PLATFORM_DIRECTIVES, {useValue: COMMON_DIRECTIVES, multi: true}),
new Provider(ExceptionHandler, {useFactory: _exceptionHandler, deps: []}),
new Provider(DOCUMENT, {useFactory: _document, deps: []}),
new Provider(EVENT_MANAGER_PLUGINS, {useClass: DomEventsPlugin, multi: true}),
new Provider(EVENT_MANAGER_PLUGINS, {useClass: KeyEventsPlugin, multi: true}),
new Provider(EVENT_MANAGER_PLUGINS, {useClass: HammerGesturesPlugin, multi: true}),
new Provider(DomRenderer, {useClass: DomRenderer_}),
new Provider(Renderer, {useExisting: DomRenderer}),
new Provider(SharedStylesHost, {useExisting: DomSharedStylesHost}),
new Provider(XHR, {useClass: XHRImpl}),
DomSharedStylesHost,
Testability,
BrowserDetails,
AnimationBuilder
]);
export function initBrowser() {
// TODO: refactor into a generic init function
BrowserDomAdapter.makeCurrent();
wtfInit();
BrowserGetTestability.init();
}

View File

@ -54,7 +54,7 @@ import {
import {APP_ID} from 'angular2/src/core/application_tokens';
import {Serializer} from "angular2/src/web_workers/shared/serializer";
import {Log} from './utils';
import {compilerProviders} from 'angular2/src/compiler/compiler';
import {COMPILER_PROVIDERS} from 'angular2/src/compiler/compiler';
import {DomRenderer_} from "angular2/src/core/render/dom/dom_renderer";
import {DynamicComponentLoader_} from "angular2/src/core/linker/dynamic_component_loader";
import {AppViewManager_} from "angular2/src/core/linker/view_manager";
@ -88,7 +88,7 @@ function _getAppBindings() {
}
return [
compilerProviders(),
COMPILER_PROVIDERS,
provide(ChangeDetectorGenConfig, {useValue: new ChangeDetectorGenConfig(true, false, true)}),
provide(DOCUMENT, {useValue: appDoc}),
provide(DomRenderer, {useClass: DomRenderer_}),

View File

@ -13,10 +13,10 @@ import {
Provider,
Type
} from 'angular2/angular2';
import {applicationDomProviders} from 'angular2/src/core/application_common';
import {applicationCommonProviders} from 'angular2/src/core/application_ref';
import {compilerProviders} from 'angular2/src/compiler/compiler';
import {APPLICATION_COMMON_PROVIDERS} from 'angular2/core';
import {COMPILER_PROVIDERS} from 'angular2/src/compiler/compiler';
import {ObservableWrapper} from 'angular2/src/facade/async';
import {BROWSER_PROVIDERS, BROWSER_APP_PROVIDERS} from 'angular2/platform/browser';
import {getComponentInfo, ComponentInfo} from './metadata';
import {onError, controllerKey} from './util';
@ -296,11 +296,9 @@ export class UpgradeAdapter {
config?: angular.IAngularBootstrapConfig): UpgradeAdapterRef {
var upgrade = new UpgradeAdapterRef();
var ng1Injector: angular.IInjectorService = null;
var platformRef: PlatformRef = platform();
var platformRef: PlatformRef = platform(BROWSER_PROVIDERS);
var applicationRef: ApplicationRef = platformRef.application([
applicationCommonProviders(),
applicationDomProviders(),
compilerProviders(),
BROWSER_APP_PROVIDERS,
provide(NG1_INJECTOR, {useFactory: () => ng1Injector}),
provide(NG1_COMPILE, {useFactory: () => ng1Injector.get(NG1_COMPILE)}),
this.providers

View File

@ -40,7 +40,7 @@ import {
import {UrlResolver} from 'angular2/src/compiler/url_resolver';
import {Testability} from 'angular2/src/core/testability/testability';
import {XHR} from 'angular2/src/compiler/xhr';
import {XHRImpl} from 'angular2/src/compiler/xhr_impl';
import {XHRImpl} from 'angular2/src/platform/browser/xhr_impl';
import {Serializer} from 'angular2/src/web_workers/shared/serializer';
import {ON_WEB_WORKER} from 'angular2/src/web_workers/shared/api';
import {RenderProtoViewRefStore} from 'angular2/src/web_workers/shared/render_proto_view_ref_store';

View File

@ -26,11 +26,12 @@ import {
} from 'angular2/src/web_workers/shared/service_message_broker';
import {MessageBus} from 'angular2/src/web_workers/shared/message_bus';
import {
platformCommon,
PlatformRef,
ApplicationRef,
applicationCommonProviders
} from 'angular2/src/core/application_ref';
APPLICATION_COMMON_PROVIDERS,
PLATFORM_COMMON_PROVIDERS
} from 'angular2/core';
import * as core from 'angular2/core';
import {Serializer} from "angular2/src/web_workers/shared/serializer";
import {ON_WEB_WORKER} from "angular2/src/web_workers/shared/api";
import {RenderProtoViewRefStore} from 'angular2/src/web_workers/shared/render_proto_view_ref_store';
@ -42,7 +43,7 @@ import {SETUP_CHANNEL} from 'angular2/src/web_workers/shared/messaging_api';
import {WebWorkerEventDispatcher} from 'angular2/src/web_workers/worker/event_dispatcher';
import {ComponentRef} from 'angular2/src/core/linker/dynamic_component_loader';
import {NgZone} from 'angular2/src/core/zone/ng_zone';
import {compilerProviders} from 'angular2/src/compiler/compiler';
import {COMPILER_PROVIDERS} from 'angular2/src/compiler/compiler';
/**
* Initialize the Angular 'platform' on the page in a manner suitable for applications
@ -73,15 +74,17 @@ import {compilerProviders} from 'angular2/src/compiler/compiler';
* them if a platform did not exist already. If it did exist, however, an error will be
* thrown.
*
*##For Web Worker Appplications
*##For Web Worker Applications
*
* This version of `platform` initializes Angular for use with applications
* that do not directly touch the DOM, such as applications which run in a
* web worker context. Applications that need direct access to the DOM should
* use `platform` from `core/application_common` instead.
*/
export function platform(bindings?: Array<Type | Provider | any[]>): PlatformRef {
return platformCommon(bindings);
export function platform(providers?: Array<Type | Provider | any[]>): PlatformRef {
let platformProviders =
isPresent(providers) ? [PLATFORM_COMMON_PROVIDERS, providers] : PLATFORM_COMMON_PROVIDERS;
return core.platform(platformProviders);
}
class PrintLogger {
@ -94,7 +97,7 @@ class PrintLogger {
function webWorkerProviders(appComponentType, bus: MessageBus,
initData: {[key: string]: any}): Array<Type | Provider | any[]> {
return [
compilerProviders(),
COMPILER_PROVIDERS,
Serializer,
provide(MessageBus, {useValue: bus}),
provide(ClientMessageBrokerFactory, {useClass: ClientMessageBrokerFactory_}),
@ -129,7 +132,7 @@ export function bootstrapWebWorkerCommon(
var emitter = bus.from(SETUP_CHANNEL);
subscription = ObservableWrapper.subscribe(emitter, (message: {[key: string]: any}) => {
var bindings =
[applicationCommonProviders(), webWorkerProviders(appComponentType, bus, message)];
[APPLICATION_COMMON_PROVIDERS, webWorkerProviders(appComponentType, bus, message)];
if (isPresent(appProviders)) {
bindings.push(appProviders);
}

View File

@ -11,10 +11,10 @@ import {
xit
} from 'angular2/testing_internal';
import {IS_DART, isPresent, stringify} from 'angular2/src/facade/lang';
import {bootstrap} from 'angular2/bootstrap';
import {platform, applicationDomProviders} from 'angular2/src/core/application_common';
import {applicationCommonProviders, ApplicationRef} from 'angular2/src/core/application_ref';
import {Component, Directive, View} from 'angular2/core';
import {bootstrap} from 'angular2/platform/browser';
import {ApplicationRef} from 'angular2/src/core/application_ref';
import {Component, Directive, View, platform} from 'angular2/core';
import {BROWSER_PROVIDERS, BROWSER_APP_PROVIDERS} from 'angular2/platform/browser';
import {DOM} from 'angular2/src/core/dom/dom_adapter';
import {DOCUMENT} from 'angular2/render';
import {PromiseWrapper} from 'angular2/src/facade/async';
@ -22,7 +22,6 @@ import {provide, Inject, Injector} from 'angular2/core';
import {ExceptionHandler} from 'angular2/src/facade/exceptions';
import {Testability, TestabilityRegistry} from 'angular2/src/core/testability/testability';
import {ComponentRef_} from "angular2/src/core/linker/dynamic_component_loader";
import {compilerProviders} from 'angular2/src/compiler/compiler';
@Component({selector: 'hello-app'})
@View({template: '{{greeting}} world!'})
@ -163,14 +162,10 @@ export function main() {
async.done();
});
}));
it('should unregister change detectors when components are disposed',
inject([AsyncTestCompleter], (async) => {
var app = platform().application([
applicationCommonProviders(),
applicationDomProviders(),
compilerProviders(),
testProviders
]);
var app = platform(BROWSER_PROVIDERS).application([BROWSER_APP_PROVIDERS, testProviders]);
app.bootstrap(HelloRootCmp)
.then((ref) => {
ref.dispose();

View File

@ -10,7 +10,7 @@ import {
xit
} from 'angular2/testing_internal';
import {XHRImpl} from 'angular2/src/compiler/xhr_impl';
import {XHRImpl} from 'angular2/src/platform/browser/xhr_impl';
import {PromiseWrapper} from 'angular2/src/facade/async';
export function main() {

View File

@ -97,6 +97,7 @@ var NG_ALL = [
'ApplicationRef.injector:js',
'ApplicationRef.zone:js',
'ApplicationRef.componentTypes:js',
'APPLICATION_COMMON_PROVIDERS',
/*
Abstract methods
'ApplicationRef.bootstrap()',
@ -126,6 +127,8 @@ var NG_ALL = [
'Binding.toClass',
'Binding.toFactory',
'Binding.toValue',
'BROWSER_APP_PROVIDERS',
'BROWSER_PROVIDERS',
'Provider',
'Provider.dependencies',
'Provider.multi',
@ -1232,7 +1235,6 @@ var NG_ALL = [
'WrappedValue.wrapped=',
'WtfScopeFn:dart',
'ZeroArgFunction:dart',
'applicationCommonProviders()',
'asNativeElements()',
'bind()',
'provide()',
@ -1242,10 +1244,9 @@ var NG_ALL = [
'inspectElement()',
'inspectNativeElement()',
'platform():js',
'platformProviders()',
'platformCommon()',
'resolveForwardRef():js',
'wtfCreateScope():js',
'PLATFORM_COMMON_PROVIDERS',
'wtfCreateScope:dart',
'wtfEndTimeRange():js',
'wtfEndTimeRange:dart',
@ -1272,6 +1273,7 @@ var NG_ALL = [
'OnInit:dart',
'PipeOnDestroy:dart',
'PipeTransform:dart',
'reflector',
'RenderBeginCmd:dart',
'RenderBeginCmd.isBound',
'RenderBeginCmd.ngContentIndex',
@ -1347,6 +1349,54 @@ var NG_ALL = [
'Stream.toSet():dart',
'Stream.transform():dart',
'Stream.where():dart',
"GetterFn:dart",
"MethodFn:dart",
"NoReflectionCapabilities:dart",
"NoReflectionCapabilities.annotations():dart",
"NoReflectionCapabilities.factory():dart",
"NoReflectionCapabilities.getter():dart",
"NoReflectionCapabilities.importUri():dart",
"NoReflectionCapabilities.interfaces():dart",
"NoReflectionCapabilities.isReflectionEnabled():dart",
"NoReflectionCapabilities.method():dart",
"NoReflectionCapabilities.moduleId():dart",
"NoReflectionCapabilities.parameters():dart",
"NoReflectionCapabilities.propMetadata():dart",
"NoReflectionCapabilities.setter():dart",
"PlatformReflectionCapabilities:dart",
"ReflectionInfo:dart",
"ReflectionInfo.annotations:dart",
"ReflectionInfo.annotations=:dart",
"ReflectionInfo.factory:dart",
"ReflectionInfo.factory=:dart",
"ReflectionInfo.interfaces:dart",
"ReflectionInfo.interfaces=:dart",
"ReflectionInfo.parameters:dart",
"ReflectionInfo.parameters=:dart",
"ReflectionInfo.propMetadata:dart",
"ReflectionInfo.propMetadata=:dart",
"Reflector:dart",
"Reflector.annotations():dart",
"Reflector.factory():dart",
"Reflector.getter():dart",
"Reflector.importUri():dart",
"Reflector.interfaces():dart",
"Reflector.isReflectionEnabled():dart",
"Reflector.listUnusedKeys():dart",
"Reflector.method():dart",
"Reflector.parameters():dart",
"Reflector.propMetadata():dart",
"Reflector.reflectionCapabilities:dart",
"Reflector.reflectionCapabilities=:dart",
"Reflector.registerFunction():dart",
"Reflector.registerGetters():dart",
"Reflector.registerMethods():dart",
"Reflector.registerSetters():dart",
"Reflector.registerType():dart",
"Reflector.setter():dart",
"Reflector.trackUsage():dart",
"SetterFn:dart"
];
var NG_UPGRADE = [

View File

@ -17,7 +17,7 @@ import {
import {Injectable, NgIf, bind} from 'angular2/core';
import {Directive, Component, View, ViewMetadata} from 'angular2/angular2';
import {XHR} from 'angular2/src/compiler/xhr';
import {XHRImpl} from 'angular2/src/compiler/xhr_impl';
import {XHRImpl} from 'angular2/src/platform/browser/xhr_impl';
// Services, and components for the tests.

View File

@ -11,6 +11,7 @@
// not even be in src/*. Move them!
'angular2/src/testing/benchmark_util': {defaultExtension: 'js'},
'angular2/src/facade/browser': {defaultExtension: 'js'},
'angular2/bootstrap': {defaultExtension: 'js'},
}
});
</script>

View File

@ -12,6 +12,7 @@
// not even be in src/*. Move them!
'angular2/src/testing/benchmark_util': {defaultExtension: 'js'},
'angular2/src/facade/browser': {defaultExtension: 'js'},
'angular2/bootstrap': {defaultExtension: 'js'},
}
});
</script>

View File

@ -24,7 +24,7 @@ module.exports = function makeNodeTree(destinationPath) {
'angular2/test/core/zone/**',
'angular2/test/testing/fake_async_spec.ts',
'angular2/test/testing/testing_public_spec.ts',
'angular2/test/compiler/xhr_impl_spec.ts',
'angular2/test/platform/xhr_impl_spec.ts',
'angular2/test/common/forms/**',
'angular2/test/tools/tools_spec.ts',
'angular1_router/**',