diff --git a/modules/@angular/compiler/test/test_bindings.ts b/modules/@angular/compiler/test/test_bindings.ts index dd9ee13ff1..2ee6254913 100644 --- a/modules/@angular/compiler/test/test_bindings.ts +++ b/modules/@angular/compiler/test/test_bindings.ts @@ -1,7 +1,6 @@ import {ElementSchemaRegistry, UrlResolver, XHR} from '@angular/compiler'; import {createUrlResolverWithoutPackagePrefix} from '@angular/compiler/src/url_resolver'; import {MockSchemaRegistry, MockXHR} from '@angular/compiler/testing'; -import {provide} from '@angular/core'; export var TEST_PROVIDERS: any[] = [ {provide: ElementSchemaRegistry, useValue: new MockSchemaRegistry({}, {})}, diff --git a/modules/@angular/core/test/linker/change_detection_integration_spec.ts b/modules/@angular/core/test/linker/change_detection_integration_spec.ts index c729adba35..67a7b20f37 100644 --- a/modules/@angular/core/test/linker/change_detection_integration_spec.ts +++ b/modules/@angular/core/test/linker/change_detection_integration_spec.ts @@ -17,7 +17,7 @@ import {EventEmitter, ObservableWrapper} from '../../src/facade/async'; import {Component, DebugElement, Directive, TemplateRef, ChangeDetectorRef, ViewContainerRef, Input, Output, forwardRef, ViewMetadata, Pipe, RootRenderer, Renderer, RenderComponentType, Injectable, provide, OnInit, DoCheck, OnChanges, AfterContentInit, AfterContentChecked, AfterViewInit, AfterViewChecked} from '@angular/core'; -import {NgFor} from '@angular/common'; +import {NgFor, NgIf} from '@angular/common'; import {By} from '@angular/platform-browser/src/dom/debug/by'; import {AsyncPipe} from '@angular/common'; diff --git a/modules/@angular/examples/compiler/ts/url_resolver/url_resolver.ts b/modules/@angular/examples/compiler/ts/url_resolver/url_resolver.ts index f27b01c4a8..ab06b6a1da 100644 --- a/modules/@angular/examples/compiler/ts/url_resolver/url_resolver.ts +++ b/modules/@angular/examples/compiler/ts/url_resolver/url_resolver.ts @@ -1,6 +1,6 @@ import {UrlResolver} from '@angular/compiler'; import {provide} from '@angular/core'; -import {bootstrap} from '@angular/platform-browser'; +import {bootstrap} from '@angular/platform-browser-dynamic'; var MyApp: any; diff --git a/modules/@angular/examples/core/forms/ts/ng_validators/ng_validators.ts b/modules/@angular/examples/core/forms/ts/ng_validators/ng_validators.ts index 065e2cc0a2..bc4b7bbefb 100644 --- a/modules/@angular/examples/core/forms/ts/ng_validators/ng_validators.ts +++ b/modules/@angular/examples/core/forms/ts/ng_validators/ng_validators.ts @@ -1,5 +1,5 @@ import {NG_VALIDATORS} from '@angular/common'; -import {bootstrap} from '@angular/platform-browser'; +import {bootstrap} from '@angular/platform-browser-dynamic'; let MyApp: Function = null; let myValidator: any = null; diff --git a/modules/@angular/examples/core/pipes/ts/async_pipe/async_pipe_example.ts b/modules/@angular/examples/core/pipes/ts/async_pipe/async_pipe_example.ts index b82206283d..1968f5fd94 100644 --- a/modules/@angular/examples/core/pipes/ts/async_pipe/async_pipe_example.ts +++ b/modules/@angular/examples/core/pipes/ts/async_pipe/async_pipe_example.ts @@ -1,5 +1,5 @@ -import {Component, provide} from '@angular/core'; -import {bootstrap} from '@angular/platform-browser'; +import {Component} from '@angular/core'; +import {bootstrap} from '@angular/platform-browser-dynamic'; import {Observable, Subscriber} from 'rxjs/Rx'; // #docregion AsyncPipePromise diff --git a/modules/@angular/examples/core/pipes/ts/date_pipe/date_pipe_example.ts b/modules/@angular/examples/core/pipes/ts/date_pipe/date_pipe_example.ts index 548cddf9af..33631072ce 100644 --- a/modules/@angular/examples/core/pipes/ts/date_pipe/date_pipe_example.ts +++ b/modules/@angular/examples/core/pipes/ts/date_pipe/date_pipe_example.ts @@ -1,5 +1,5 @@ -import {Component, provide} from '@angular/core'; -import {bootstrap} from '@angular/platform-browser'; +import {Component} from '@angular/core'; +import {bootstrap} from '@angular/platform-browser-dynamic'; // #docregion DatePipe @Component({ diff --git a/modules/@angular/examples/core/pipes/ts/json_pipe/json_pipe_example.ts b/modules/@angular/examples/core/pipes/ts/json_pipe/json_pipe_example.ts index 73b7188612..1638ff227e 100644 --- a/modules/@angular/examples/core/pipes/ts/json_pipe/json_pipe_example.ts +++ b/modules/@angular/examples/core/pipes/ts/json_pipe/json_pipe_example.ts @@ -1,5 +1,5 @@ -import {Component, provide} from '@angular/core'; -import {bootstrap} from '@angular/platform-browser'; +import {Component} from '@angular/core'; +import {bootstrap} from '@angular/platform-browser-dynamic'; // #docregion JsonPipe @Component({ diff --git a/modules/@angular/examples/core/pipes/ts/lowerupper_pipe/lowerupper_pipe_example.ts b/modules/@angular/examples/core/pipes/ts/lowerupper_pipe/lowerupper_pipe_example.ts index 536c7fadca..f6aa6dd6f7 100644 --- a/modules/@angular/examples/core/pipes/ts/lowerupper_pipe/lowerupper_pipe_example.ts +++ b/modules/@angular/examples/core/pipes/ts/lowerupper_pipe/lowerupper_pipe_example.ts @@ -1,5 +1,5 @@ -import {Component, provide} from '@angular/core'; -import {bootstrap} from '@angular/platform-browser'; +import {Component} from '@angular/core'; +import {bootstrap} from '@angular/platform-browser-dynamic'; // #docregion LowerUpperPipe @Component({ diff --git a/modules/@angular/examples/core/pipes/ts/number_pipe/number_pipe_example.ts b/modules/@angular/examples/core/pipes/ts/number_pipe/number_pipe_example.ts index a576d82817..b9c2a87be3 100644 --- a/modules/@angular/examples/core/pipes/ts/number_pipe/number_pipe_example.ts +++ b/modules/@angular/examples/core/pipes/ts/number_pipe/number_pipe_example.ts @@ -1,5 +1,5 @@ -import {Component, provide} from '@angular/core'; -import {bootstrap} from '@angular/platform-browser'; +import {Component} from '@angular/core'; +import {bootstrap} from '@angular/platform-browser-dynamic'; // #docregion NumberPipe @Component({ diff --git a/modules/@angular/examples/core/pipes/ts/slice_pipe/slice_pipe_example.ts b/modules/@angular/examples/core/pipes/ts/slice_pipe/slice_pipe_example.ts index 484f754e6e..acb783279b 100644 --- a/modules/@angular/examples/core/pipes/ts/slice_pipe/slice_pipe_example.ts +++ b/modules/@angular/examples/core/pipes/ts/slice_pipe/slice_pipe_example.ts @@ -1,5 +1,5 @@ -import {Component, provide} from '@angular/core'; -import {bootstrap} from '@angular/platform-browser'; +import {Component} from '@angular/core'; +import {bootstrap} from '@angular/platform-browser-dynamic'; // #docregion SlicePipe_string @Component({ diff --git a/modules/@angular/examples/core/ts/bootstrap/bootstrap.ts b/modules/@angular/examples/core/ts/bootstrap/bootstrap.ts index e5ed9621ff..77340272a3 100644 --- a/modules/@angular/examples/core/ts/bootstrap/bootstrap.ts +++ b/modules/@angular/examples/core/ts/bootstrap/bootstrap.ts @@ -1,5 +1,5 @@ import {Component} from '@angular/core'; -import {bootstrap} from '@angular/platform-browser'; +import {bootstrap} from '@angular/platform-browser-dynamic'; // #docregion bootstrap @Component({selector: 'my-app', template: 'Hello {{ name }}!'}) diff --git a/modules/@angular/examples/core/ts/prod_mode/prod_mode_example.ts b/modules/@angular/examples/core/ts/prod_mode/prod_mode_example.ts index ce54a12916..072b22a197 100644 --- a/modules/@angular/examples/core/ts/prod_mode/prod_mode_example.ts +++ b/modules/@angular/examples/core/ts/prod_mode/prod_mode_example.ts @@ -1,6 +1,6 @@ // #docregion enableProdMode import {enableProdMode} from '@angular/core'; -import {bootstrap} from '@angular/platform-browser'; +import {bootstrap} from '@angular/platform-browser-dynamic'; import {MyComponent} from './my_component'; enableProdMode(); diff --git a/modules/@angular/examples/platform-browser/dom/debug/ts/debug_element_view_listener/providers.ts b/modules/@angular/examples/platform-browser/dom/debug/ts/debug_element_view_listener/providers.ts index 21e9b33d92..ee5781be72 100644 --- a/modules/@angular/examples/platform-browser/dom/debug/ts/debug_element_view_listener/providers.ts +++ b/modules/@angular/examples/platform-browser/dom/debug/ts/debug_element_view_listener/providers.ts @@ -1,5 +1,6 @@ import {Component} from '@angular/core'; -import {ELEMENT_PROBE_PROVIDERS, bootstrap} from '@angular/platform-browser'; +import {ELEMENT_PROBE_PROVIDERS} from '@angular/platform-browser'; +import {bootstrap} from '@angular/platform-browser-dynamic'; @Component({selector: 'my-component'}) class MyAppComponent { diff --git a/modules/@angular/examples/router_deprecated/ts/can_activate/can_activate_example.ts b/modules/@angular/examples/router_deprecated/ts/can_activate/can_activate_example.ts index a38281cd58..919912a761 100644 --- a/modules/@angular/examples/router_deprecated/ts/can_activate/can_activate_example.ts +++ b/modules/@angular/examples/router_deprecated/ts/can_activate/can_activate_example.ts @@ -1,6 +1,6 @@ import {APP_BASE_HREF} from '@angular/common'; import {Component, ComponentRef} from '@angular/core'; -import {bootstrap} from '@angular/platform-browser'; +import {bootstrap} from '@angular/platform-browser-dynamic'; import {CanActivate, ComponentInstruction, ROUTER_DIRECTIVES, RouteConfig} from '@angular/router-deprecated'; function checkIfWeHavePermission(instruction: ComponentInstruction) { diff --git a/modules/@angular/examples/router_deprecated/ts/can_deactivate/can_deactivate_example.ts b/modules/@angular/examples/router_deprecated/ts/can_deactivate/can_deactivate_example.ts index e301a63de5..7efd26e152 100644 --- a/modules/@angular/examples/router_deprecated/ts/can_deactivate/can_deactivate_example.ts +++ b/modules/@angular/examples/router_deprecated/ts/can_deactivate/can_deactivate_example.ts @@ -1,6 +1,6 @@ import {APP_BASE_HREF} from '@angular/common'; import {Component, ComponentRef, provide} from '@angular/core'; -import {bootstrap} from '@angular/platform-browser'; +import {bootstrap} from '@angular/platform-browser-dynamic'; import {CanDeactivate, ComponentInstruction, ROUTER_DIRECTIVES, RouteConfig, RouteParams} from '@angular/router-deprecated'; diff --git a/modules/@angular/examples/router_deprecated/ts/on_activate/on_activate_example.ts b/modules/@angular/examples/router_deprecated/ts/on_activate/on_activate_example.ts index a00e532fd2..6f5110f024 100644 --- a/modules/@angular/examples/router_deprecated/ts/on_activate/on_activate_example.ts +++ b/modules/@angular/examples/router_deprecated/ts/on_activate/on_activate_example.ts @@ -1,6 +1,6 @@ import {APP_BASE_HREF} from '@angular/common'; import {Component, ComponentRef, provide} from '@angular/core'; -import {bootstrap} from '@angular/platform-browser'; +import {bootstrap} from '@angular/platform-browser-dynamic'; import {ComponentInstruction, OnActivate, ROUTER_DIRECTIVES, RouteConfig} from '@angular/router-deprecated'; diff --git a/modules/@angular/examples/router_deprecated/ts/on_deactivate/on_deactivate_example.ts b/modules/@angular/examples/router_deprecated/ts/on_deactivate/on_deactivate_example.ts index 2eed994447..3b2c7eb8b6 100644 --- a/modules/@angular/examples/router_deprecated/ts/on_deactivate/on_deactivate_example.ts +++ b/modules/@angular/examples/router_deprecated/ts/on_deactivate/on_deactivate_example.ts @@ -1,6 +1,6 @@ import {APP_BASE_HREF} from '@angular/common'; import {Component, ComponentRef, Injectable} from '@angular/core'; -import {bootstrap} from '@angular/platform-browser'; +import {bootstrap} from '@angular/platform-browser-dynamic'; import {ComponentInstruction, OnDeactivate, ROUTER_DIRECTIVES, RouteConfig} from '@angular/router-deprecated'; diff --git a/modules/@angular/examples/router_deprecated/ts/reuse/reuse_example.ts b/modules/@angular/examples/router_deprecated/ts/reuse/reuse_example.ts index a603c02c06..33d5f2e69b 100644 --- a/modules/@angular/examples/router_deprecated/ts/reuse/reuse_example.ts +++ b/modules/@angular/examples/router_deprecated/ts/reuse/reuse_example.ts @@ -1,6 +1,6 @@ import {APP_BASE_HREF} from '@angular/common'; import {Component, ComponentRef} from '@angular/core'; -import {bootstrap} from '@angular/platform-browser'; +import {bootstrap} from '@angular/platform-browser-dynamic'; import {CanReuse, ComponentInstruction, OnReuse, ROUTER_DIRECTIVES, RouteConfig, RouteParams} from '@angular/router-deprecated'; diff --git a/modules/@angular/platform-browser-dynamic/core_private.ts b/modules/@angular/platform-browser-dynamic/core_private.ts new file mode 100644 index 0000000000..28c63d8140 --- /dev/null +++ b/modules/@angular/platform-browser-dynamic/core_private.ts @@ -0,0 +1,4 @@ +import {__core_private__ as r, __core_private_types__ as t} from '@angular/core'; + +export var ReflectionCapabilities: typeof t.ReflectionCapabilities = r.ReflectionCapabilities; +export var reflector: typeof t.reflector = r.reflector; diff --git a/modules/@angular/platform-browser-dynamic/index.ts b/modules/@angular/platform-browser-dynamic/index.ts index 372fc62af6..bfacad444e 100644 --- a/modules/@angular/platform-browser-dynamic/index.ts +++ b/modules/@angular/platform-browser-dynamic/index.ts @@ -1,10 +1,148 @@ -import {BROWSER_APP_COMPILER_PROVIDERS, BROWSER_APP_PROVIDERS} from '@angular/platform-browser'; +import {COMMON_DIRECTIVES, COMMON_PIPES} from '@angular/common'; +import {COMPILER_PROVIDERS, CompilerConfig, XHR} from '@angular/compiler'; +import {ApplicationRef, ComponentRef, ReflectiveInjector, Type, coreLoadAndBootstrap} from '@angular/core'; +import {BROWSER_APP_PROVIDERS, WORKER_APP_APPLICATION_PROVIDERS, WORKER_RENDER_APPLICATION_PROVIDERS, WORKER_SCRIPT, browserPlatform, workerAppPlatform, workerRenderPlatform} from '@angular/platform-browser'; -export {CACHED_TEMPLATE_PROVIDER, bootstrap} from '@angular/platform-browser'; +import {ReflectionCapabilities, reflector} from './core_private'; +import {PromiseWrapper} from './src/facade/async'; +import {isPresent} from './src/facade/lang'; +import {CachedXHR} from './src/xhr/xhr_cache'; +import {XHRImpl} from './src/xhr/xhr_impl'; -/* @deprecated the platform-browser-dynamic module is deprecated. */ -export const BROWSER_APP_DYNAMIC_PROVIDERS: Array = - [BROWSER_APP_PROVIDERS, BROWSER_APP_COMPILER_PROVIDERS]; +export const BROWSER_APP_COMPILER_PROVIDERS: Array = [ + COMPILER_PROVIDERS, + { + provide: CompilerConfig, + useValue: + new CompilerConfig({platformDirectives: COMMON_DIRECTIVES, platformPipes: COMMON_PIPES}) + }, + {provide: XHR, useClass: XHRImpl}, +]; -console.log(`platform-browser-dynamic is deprecated, use platform-browser instead`); + +export const CACHED_TEMPLATE_PROVIDER: Array = + [{provide: XHR, useClass: CachedXHR}]; + + + +/** + * 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 + * + * + * + * loading... + * + * + * ``` + * + * 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: + * + * {@example core/ts/bootstrap/bootstrap.ts region='bootstrap'} + * + * 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): Promise> { + reflector.reflectionCapabilities = new ReflectionCapabilities(); + let providers = [ + BROWSER_APP_PROVIDERS, BROWSER_APP_COMPILER_PROVIDERS, + isPresent(customProviders) ? customProviders : [] + ]; + var appInjector = ReflectiveInjector.resolveAndCreate(providers, browserPlatform().injector); + return coreLoadAndBootstrap(appComponentType, appInjector); +} + + +export function bootstrapRender( + workerScriptUri: string, + customProviders?: Array): Promise { + var app = ReflectiveInjector.resolveAndCreate( + [ + WORKER_RENDER_APPLICATION_PROVIDERS, BROWSER_APP_COMPILER_PROVIDERS, + {provide: WORKER_SCRIPT, useValue: workerScriptUri}, + isPresent(customProviders) ? customProviders : [] + ], + workerRenderPlatform().injector); + // Return a promise so that we keep the same semantics as Dart, + // and we might want to wait for the app side to come up + // in the future... + return PromiseWrapper.resolve(app.get(ApplicationRef)); +} + + +const WORKER_APP_COMPILER_PROVIDERS: Array = [ + COMPILER_PROVIDERS, + { + provide: CompilerConfig, + useValue: + new CompilerConfig({platformDirectives: COMMON_DIRECTIVES, platformPipes: COMMON_PIPES}) + }, + {provide: XHR, useClass: XHRImpl}, +]; + + +export function bootstrapApp( + appComponentType: Type, + customProviders?: Array): Promise> { + var appInjector = ReflectiveInjector.resolveAndCreate( + [ + WORKER_APP_APPLICATION_PROVIDERS, WORKER_APP_COMPILER_PROVIDERS, + isPresent(customProviders) ? customProviders : [] + ], + workerAppPlatform().injector); + return coreLoadAndBootstrap(appComponentType, appInjector); +} diff --git a/modules/@angular/platform-browser-dynamic/platform_browser_private.ts b/modules/@angular/platform-browser-dynamic/platform_browser_private.ts new file mode 100644 index 0000000000..be0d7e24c9 --- /dev/null +++ b/modules/@angular/platform-browser-dynamic/platform_browser_private.ts @@ -0,0 +1,3 @@ +import {__platform_browser_private__ as r, __platform_browser_private__ as t} from '@angular/platform-browser'; + +export var getDOM: typeof t.getDOM = r.getDOM; diff --git a/modules/@angular/platform-browser-dynamic/src/facade b/modules/@angular/platform-browser-dynamic/src/facade new file mode 120000 index 0000000000..e084c803c6 --- /dev/null +++ b/modules/@angular/platform-browser-dynamic/src/facade @@ -0,0 +1 @@ +../../facade/src \ No newline at end of file diff --git a/modules/@angular/platform-browser/src/xhr/xhr_cache.ts b/modules/@angular/platform-browser-dynamic/src/xhr/xhr_cache.ts similarity index 100% rename from modules/@angular/platform-browser/src/xhr/xhr_cache.ts rename to modules/@angular/platform-browser-dynamic/src/xhr/xhr_cache.ts diff --git a/modules/@angular/platform-browser/src/xhr/xhr_impl.ts b/modules/@angular/platform-browser-dynamic/src/xhr/xhr_impl.ts similarity index 100% rename from modules/@angular/platform-browser/src/xhr/xhr_impl.ts rename to modules/@angular/platform-browser-dynamic/src/xhr/xhr_impl.ts diff --git a/modules/@angular/platform-browser/test/testing_public_browser_spec.ts b/modules/@angular/platform-browser-dynamic/test/testing_public_browser_spec.ts similarity index 100% rename from modules/@angular/platform-browser/test/testing_public_browser_spec.ts rename to modules/@angular/platform-browser-dynamic/test/testing_public_browser_spec.ts diff --git a/modules/@angular/platform-browser/test/xhr/xhr_cache_setter.ts b/modules/@angular/platform-browser-dynamic/test/xhr/xhr_cache_setter.ts similarity index 100% rename from modules/@angular/platform-browser/test/xhr/xhr_cache_setter.ts rename to modules/@angular/platform-browser-dynamic/test/xhr/xhr_cache_setter.ts diff --git a/modules/@angular/platform-browser/test/xhr/xhr_cache_spec.ts b/modules/@angular/platform-browser-dynamic/test/xhr/xhr_cache_spec.ts similarity index 100% rename from modules/@angular/platform-browser/test/xhr/xhr_cache_spec.ts rename to modules/@angular/platform-browser-dynamic/test/xhr/xhr_cache_spec.ts diff --git a/modules/@angular/platform-browser/test/xhr/xhr_impl_spec.ts b/modules/@angular/platform-browser-dynamic/test/xhr/xhr_impl_spec.ts similarity index 100% rename from modules/@angular/platform-browser/test/xhr/xhr_impl_spec.ts rename to modules/@angular/platform-browser-dynamic/test/xhr/xhr_impl_spec.ts diff --git a/modules/@angular/platform-browser-dynamic/testing.ts b/modules/@angular/platform-browser-dynamic/testing.ts index cee7d611a9..b84efb3653 100644 --- a/modules/@angular/platform-browser-dynamic/testing.ts +++ b/modules/@angular/platform-browser-dynamic/testing.ts @@ -1,3 +1,25 @@ -export * from '@angular/platform-browser/testing'; +import {DirectiveResolver, ViewResolver} from '@angular/compiler'; +import {MockDirectiveResolver, MockViewResolver, TestComponentBuilder, TestComponentRenderer} from '@angular/compiler/testing'; +import {TEST_BROWSER_APPLICATION_PROVIDERS, TEST_BROWSER_PLATFORM_PROVIDERS} from '@angular/platform-browser/testing'; -console.log(`platform-browser-dynamic/testing is deprecated, use platform-browser/testing instead`); +import {BROWSER_APP_COMPILER_PROVIDERS} from './index'; +import {DOMTestComponentRenderer} from './testing/dom_test_component_renderer'; + +/** + * Default platform providers for testing. + */ +export const TEST_BROWSER_DYNAMIC_PLATFORM_PROVIDERS: Array = + [TEST_BROWSER_PLATFORM_PROVIDERS]; + +/** + * Default application providers for testing. + */ +export const TEST_BROWSER_DYNAMIC_APPLICATION_PROVIDERS: Array = [ + TEST_BROWSER_APPLICATION_PROVIDERS, BROWSER_APP_COMPILER_PROVIDERS, + [ + {provide: DirectiveResolver, useClass: MockDirectiveResolver}, + {provide: ViewResolver, useClass: MockViewResolver}, + TestComponentBuilder, + {provide: TestComponentRenderer, useClass: DOMTestComponentRenderer}, + ] +]; diff --git a/modules/@angular/platform-browser/testing/dom_test_component_renderer.ts b/modules/@angular/platform-browser-dynamic/testing/dom_test_component_renderer.ts similarity index 81% rename from modules/@angular/platform-browser/testing/dom_test_component_renderer.ts rename to modules/@angular/platform-browser-dynamic/testing/dom_test_component_renderer.ts index e2cb8b29cd..4c92753cd0 100644 --- a/modules/@angular/platform-browser/testing/dom_test_component_renderer.ts +++ b/modules/@angular/platform-browser-dynamic/testing/dom_test_component_renderer.ts @@ -1,10 +1,10 @@ import {TestComponentRenderer} from '@angular/compiler/testing'; import {Inject, Injectable} from '@angular/core'; +import {DOCUMENT} from '@angular/platform-browser'; +import {el} from '@angular/platform-browser/testing'; -import {getDOM} from '../src/dom/dom_adapter'; -import {DOCUMENT} from '../src/dom/dom_tokens'; +import {getDOM} from '../platform_browser_private'; -import {el} from './browser_util'; /** diff --git a/modules/@angular/platform-browser-dynamic/testing_e2e.ts b/modules/@angular/platform-browser-dynamic/testing_e2e.ts deleted file mode 100644 index a7d5c0d9cd..0000000000 --- a/modules/@angular/platform-browser-dynamic/testing_e2e.ts +++ /dev/null @@ -1,4 +0,0 @@ -export * from '@angular/platform-browser/testing/e2e_util'; - -console.log( - `platform-browser-dynamic/testing_e2e is deprecated, use platform-browser/testing_e2e instead`); \ No newline at end of file diff --git a/modules/@angular/platform-browser-dynamic/tsconfig-es2015.json b/modules/@angular/platform-browser-dynamic/tsconfig-es2015.json index ddf966bf72..327906edf4 100644 --- a/modules/@angular/platform-browser-dynamic/tsconfig-es2015.json +++ b/modules/@angular/platform-browser-dynamic/tsconfig-es2015.json @@ -12,10 +12,12 @@ "moduleResolution": "node", "outDir": "../../../dist/packages-dist/platform-browser-dynamic/esm", "paths": { - "@angular/common": ["../../../dist/packages-dist/common/"], - "@angular/compiler": ["../../../dist/packages-dist/compiler/"], + "@angular/core": ["../../../dist/packages-dist/core"], + "@angular/core/testing": ["../../../dist/packages-dist/core/testing"], + "@angular/common": ["../../../dist/packages-dist/common"], + "@angular/common/testing": ["../../../dist/packages-dist/common/testing"], + "@angular/compiler": ["../../../dist/packages-dist/compiler"], "@angular/compiler/testing": ["../../../dist/packages-dist/compiler/testing"], - "@angular/core": ["../../../dist/packages-dist/core/"], "@angular/platform-browser": ["../../../dist/packages-dist/platform-browser"], "@angular/platform-browser/testing": ["../../../dist/packages-dist/platform-browser/testing"] }, @@ -27,9 +29,7 @@ "files": [ "index.ts", "testing.ts", - "../../../node_modules/@types/hammerjs/index.d.ts", - "../../../node_modules/@types/protractor/index.d.ts", "../../../node_modules/@types/jasmine/index.d.ts", "../../../node_modules/zone.js/dist/zone.js.d.ts" ] -} \ No newline at end of file +} diff --git a/modules/@angular/platform-browser-dynamic/tsconfig-es5.json b/modules/@angular/platform-browser-dynamic/tsconfig-es5.json index 19989b70ac..e169935ee1 100644 --- a/modules/@angular/platform-browser-dynamic/tsconfig-es5.json +++ b/modules/@angular/platform-browser-dynamic/tsconfig-es5.json @@ -13,7 +13,9 @@ "outDir": "../../../dist/packages-dist/platform-browser-dynamic/", "paths": { "@angular/core": ["../../../dist/packages-dist/core"], + "@angular/core/testing": ["../../../dist/packages-dist/core/testing"], "@angular/common": ["../../../dist/packages-dist/common"], + "@angular/common/testing": ["../../../dist/packages-dist/common/testing"], "@angular/compiler": ["../../../dist/packages-dist/compiler"], "@angular/compiler/testing": ["../../../dist/packages-dist/compiler/testing"], "@angular/platform-browser": ["../../../dist/packages-dist/platform-browser"], @@ -28,9 +30,7 @@ "files": [ "index.ts", "testing.ts", - "../../../node_modules/@types/hammerjs/index.d.ts", - "../../../node_modules/@types/protractor/index.d.ts", "../../../node_modules/@types/jasmine/index.d.ts", "../../../node_modules/zone.js/dist/zone.js.d.ts" ] -} \ No newline at end of file +} diff --git a/modules/@angular/platform-browser/dynamic.ts b/modules/@angular/platform-browser/dynamic.ts new file mode 100644 index 0000000000..e69de29bb2 diff --git a/modules/@angular/platform-browser/private_export.ts b/modules/@angular/platform-browser/private_export.ts index 6b3eae5a24..6046db3e4d 100644 --- a/modules/@angular/platform-browser/private_export.ts +++ b/modules/@angular/platform-browser/private_export.ts @@ -2,22 +2,27 @@ import * as dom_adapter from './src/dom/dom_adapter'; import * as dom_renderer from './src/dom/dom_renderer'; import * as shared_styles_host from './src/dom/shared_styles_host'; -export namespace __platform_browser_private__ { -export type DomAdapter = dom_adapter.DomAdapter; -export var DomAdapter = dom_adapter.DomAdapter; - -export function getDOM(): DomAdapter { - return dom_adapter.getDOM(); +export declare namespace __platform_browser_private_types__ { + export type DomAdapter = dom_adapter.DomAdapter; + export var DomAdapter: typeof dom_adapter.DomAdapter; + export var getDOM: typeof dom_adapter.getDOM; + export var setRootDomAdapter: typeof dom_adapter.setRootDomAdapter; + export type DomRootRenderer = dom_renderer.DomRootRenderer; + export var DomRootRenderer: typeof dom_renderer.DomRootRenderer; + export type DomRootRenderer_ = dom_renderer.DomRootRenderer_; + export var DomRootRenderer_: typeof dom_renderer.DomRootRenderer_; + export type DomSharedStylesHost = shared_styles_host.DomSharedStylesHost; + export var DomSharedStylesHost: typeof shared_styles_host.DomSharedStylesHost; + export type SharedStylesHost = shared_styles_host.SharedStylesHost; + export var SharedStylesHost: typeof shared_styles_host.SharedStylesHost; } -export var setRootDomAdapter = dom_adapter.setRootDomAdapter; - -export type DomRootRenderer = dom_renderer.DomRootRenderer; -export var DomRootRenderer = dom_renderer.DomRootRenderer; -export type DomRootRenderer_ = dom_renderer.DomRootRenderer_; -export var DomRootRenderer_ = dom_renderer.DomRootRenderer_; -export type DomSharedStylesHost = shared_styles_host.DomSharedStylesHost; -export var DomSharedStylesHost = shared_styles_host.DomSharedStylesHost; -export type SharedStylesHost = shared_styles_host.SharedStylesHost; -export var SharedStylesHost = shared_styles_host.SharedStylesHost; -} +export var __platform_browser_private__ = { + DomAdapter: dom_adapter.DomAdapter, + getDOM: dom_adapter.getDOM, + setRootDomAdapter: dom_adapter.setRootDomAdapter, + DomRootRenderer: dom_renderer.DomRootRenderer, + DomRootRenderer_: dom_renderer.DomRootRenderer_, + DomSharedStylesHost: shared_styles_host.DomSharedStylesHost, + SharedStylesHost: shared_styles_host.SharedStylesHost +}; diff --git a/modules/@angular/platform-browser/rollup.config.js b/modules/@angular/platform-browser/rollup.config.js index 2bc225d647..4ac59434f0 100644 --- a/modules/@angular/platform-browser/rollup.config.js +++ b/modules/@angular/platform-browser/rollup.config.js @@ -7,7 +7,6 @@ export default { globals: { '@angular/core': 'ng.core', '@angular/common': 'ng.common', - '@angular/compiler': 'ng.compiler', 'rxjs/Subject': 'Rx', 'rxjs/observable/PromiseObservable': 'Rx', // this is wrong, but this stuff has changed in rxjs b.6 so we need to fix it when we update. 'rxjs/operator/toPromise': 'Rx.Observable.prototype', diff --git a/modules/@angular/platform-browser/src/browser.ts b/modules/@angular/platform-browser/src/browser.ts index 7ad9f39fda..acc6120c9d 100644 --- a/modules/@angular/platform-browser/src/browser.ts +++ b/modules/@angular/platform-browser/src/browser.ts @@ -1,8 +1,7 @@ -import {COMMON_DIRECTIVES, COMMON_PIPES, FORM_PROVIDERS, PlatformLocation} from '@angular/common'; -import {COMPILER_PROVIDERS, CompilerConfig, XHR} from '@angular/compiler'; -import {APPLICATION_COMMON_PROVIDERS, ComponentRef, ExceptionHandler, OpaqueToken, PLATFORM_COMMON_PROVIDERS, PLATFORM_INITIALIZER, PlatformRef, ReflectiveInjector, RootRenderer, Testability, Type, assertPlatform, coreLoadAndBootstrap, createPlatform, getPlatform} from '@angular/core'; +import {FORM_PROVIDERS, PlatformLocation} from '@angular/common'; +import {APPLICATION_COMMON_PROVIDERS, ExceptionHandler, OpaqueToken, PLATFORM_COMMON_PROVIDERS, PLATFORM_INITIALIZER, PlatformRef, ReflectiveInjector, RootRenderer, Testability, assertPlatform, createPlatform, getPlatform} from '@angular/core'; -import {AnimationDriver, NoOpAnimationDriver, ReflectionCapabilities, SanitizationService, reflector, wtfInit} from '../core_private'; +import {AnimationDriver, NoOpAnimationDriver, SanitizationService, wtfInit} from '../core_private'; import {WebAnimationsDriver} from '../src/dom/web_animations_driver'; import {BrowserDomAdapter} from './browser/browser_adapter'; @@ -17,13 +16,9 @@ import {EVENT_MANAGER_PLUGINS, EventManager} from './dom/events/event_manager'; import {HAMMER_GESTURE_CONFIG, HammerGestureConfig, HammerGesturesPlugin} from './dom/events/hammer_gestures'; import {KeyEventsPlugin} from './dom/events/key_events'; import {DomSharedStylesHost, SharedStylesHost} from './dom/shared_styles_host'; -import {assertionsEnabled, isBlank, isPresent} from './facade/lang'; +import {isBlank} from './facade/lang'; import {DomSanitizationService, DomSanitizationServiceImpl} from './security/dom_sanitization_service'; -import {CachedXHR} from './xhr/xhr_cache'; -import {XHRImpl} from './xhr/xhr_impl'; -export const CACHED_TEMPLATE_PROVIDER: Array = - [{provide: XHR, useClass: CachedXHR}]; const BROWSER_PLATFORM_MARKER = new OpaqueToken('BrowserPlatformMarker'); @@ -63,15 +58,6 @@ export const BROWSER_APP_PROVIDERS: Array = [ Testability, EventManager, ELEMENT_PROBE_PROVIDERS ]; -export const BROWSER_APP_COMPILER_PROVIDERS: Array = [ - COMPILER_PROVIDERS, - { - provide: CompilerConfig, - useValue: - new CompilerConfig({platformDirectives: COMMON_DIRECTIVES, platformPipes: COMMON_PIPES}) - }, - {provide: XHR, useClass: XHRImpl}, -]; export function browserPlatform(): PlatformRef { if (isBlank(getPlatform())) { @@ -80,86 +66,6 @@ export function browserPlatform(): PlatformRef { return assertPlatform(BROWSER_PLATFORM_MARKER); } -/** - * 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 - * - * - * - * loading... - * - * - * ``` - * - * 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: - * - * {@example core/ts/bootstrap/bootstrap.ts region='bootstrap'} - * - * 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): Promise> { - reflector.reflectionCapabilities = new ReflectionCapabilities(); - let providers = [ - BROWSER_APP_PROVIDERS, BROWSER_APP_COMPILER_PROVIDERS, - isPresent(customProviders) ? customProviders : [] - ]; - var appInjector = ReflectiveInjector.resolveAndCreate(providers, browserPlatform().injector); - return coreLoadAndBootstrap(appComponentType, appInjector); -} - function initDomAdapter() { BrowserDomAdapter.makeCurrent(); wtfInit(); diff --git a/modules/@angular/platform-browser/src/worker_app.ts b/modules/@angular/platform-browser/src/worker_app.ts index 0ca39c24cd..17d840c519 100644 --- a/modules/@angular/platform-browser/src/worker_app.ts +++ b/modules/@angular/platform-browser/src/worker_app.ts @@ -1,9 +1,8 @@ -import {COMMON_DIRECTIVES, COMMON_PIPES, FORM_PROVIDERS} from '@angular/common'; -import {COMPILER_PROVIDERS, CompilerConfig, XHR} from '@angular/compiler'; -import {APPLICATION_COMMON_PROVIDERS, APP_INITIALIZER, ComponentRef, ExceptionHandler, NgZone, OpaqueToken, PLATFORM_COMMON_PROVIDERS, PlatformRef, ReflectiveInjector, RootRenderer, Type, assertPlatform, coreLoadAndBootstrap, createPlatform, getPlatform} from '@angular/core'; +import {FORM_PROVIDERS} from '@angular/common'; +import {APPLICATION_COMMON_PROVIDERS, APP_INITIALIZER, ExceptionHandler, NgZone, OpaqueToken, PLATFORM_COMMON_PROVIDERS, PlatformRef, ReflectiveInjector, RootRenderer, assertPlatform, createPlatform, getPlatform} from '@angular/core'; import {BROWSER_SANITIZATION_PROVIDERS} from './browser'; -import {assertionsEnabled, isBlank, isPresent, print} from './facade/lang'; +import {isBlank, print} from './facade/lang'; import {ON_WEB_WORKER} from './web_workers/shared/api'; import {ClientMessageBrokerFactory, ClientMessageBrokerFactory_} from './web_workers/shared/client_message_broker'; import {MessageBus} from './web_workers/shared/message_bus'; @@ -13,7 +12,6 @@ import {Serializer} from './web_workers/shared/serializer'; import {ServiceMessageBrokerFactory, ServiceMessageBrokerFactory_} from './web_workers/shared/service_message_broker'; import {WebWorkerRootRenderer} from './web_workers/worker/renderer'; import {WorkerDomAdapter} from './web_workers/worker/worker_adapter'; -import {XHRImpl} from './xhr/xhr_impl'; class PrintLogger { log = print; @@ -45,29 +43,6 @@ export function workerAppPlatform(): PlatformRef { return assertPlatform(WORKER_APP_PLATFORM_MARKER); } -const WORKER_APP_COMPILER_PROVIDERS: Array = [ - COMPILER_PROVIDERS, - { - provide: CompilerConfig, - useValue: - new CompilerConfig({platformDirectives: COMMON_DIRECTIVES, platformPipes: COMMON_PIPES}) - }, - {provide: XHR, useClass: XHRImpl}, -]; - -export function bootstrapApp( - appComponentType: Type, - customProviders?: Array): Promise> { - var appInjector = ReflectiveInjector.resolveAndCreate( - [ - WORKER_APP_APPLICATION_PROVIDERS, WORKER_APP_COMPILER_PROVIDERS, - isPresent(customProviders) ? customProviders : [] - ], - workerAppPlatform().injector); - return coreLoadAndBootstrap(appComponentType, appInjector); -} - - function _exceptionHandler(): ExceptionHandler { return new ExceptionHandler(new PrintLogger()); } @@ -89,4 +64,4 @@ function createMessageBus(zone: NgZone): MessageBus { function setupWebWorker(): void { WorkerDomAdapter.makeCurrent(); -} \ No newline at end of file +} diff --git a/modules/@angular/platform-browser/src/worker_render.ts b/modules/@angular/platform-browser/src/worker_render.ts index 56886a80ee..70ef1ddbe3 100644 --- a/modules/@angular/platform-browser/src/worker_render.ts +++ b/modules/@angular/platform-browser/src/worker_render.ts @@ -2,7 +2,7 @@ import {APPLICATION_COMMON_PROVIDERS, APP_INITIALIZER, ApplicationRef, Exception import {AnimationDriver, NoOpAnimationDriver, wtfInit} from '../core_private'; -import {BROWSER_APP_COMPILER_PROVIDERS, BROWSER_SANITIZATION_PROVIDERS} from './browser'; +import {BROWSER_SANITIZATION_PROVIDERS} from './browser'; import {BrowserDomAdapter} from './browser/browser_adapter'; import {BrowserGetTestability} from './browser/testability'; import {getDOM} from './dom/dom_adapter'; @@ -13,9 +13,8 @@ import {EVENT_MANAGER_PLUGINS, EventManager} from './dom/events/event_manager'; import {HAMMER_GESTURE_CONFIG, HammerGestureConfig, HammerGesturesPlugin} from './dom/events/hammer_gestures'; import {KeyEventsPlugin} from './dom/events/key_events'; import {DomSharedStylesHost, SharedStylesHost} from './dom/shared_styles_host'; -import {PromiseWrapper} from './facade/async'; import {BaseException} from './facade/exceptions'; -import {isBlank, isPresent} from './facade/lang'; +import {isBlank} from './facade/lang'; import {ON_WEB_WORKER} from './web_workers/shared/api'; import {ClientMessageBrokerFactory, ClientMessageBrokerFactory_} from './web_workers/shared/client_message_broker'; import {MessageBus} from './web_workers/shared/message_bus'; @@ -103,22 +102,6 @@ export function initializeGenericWorkerRenderer(injector: Injector) { zone.runGuarded(() => { services.forEach((svc: any /** TODO #9100 */) => { svc.start(); }); }); } -export function bootstrapRender( - workerScriptUri: string, - customProviders?: Array): Promise { - var app = ReflectiveInjector.resolveAndCreate( - [ - WORKER_RENDER_APPLICATION_PROVIDERS, BROWSER_APP_COMPILER_PROVIDERS, - {provide: WORKER_SCRIPT, useValue: workerScriptUri}, - isPresent(customProviders) ? customProviders : [] - ], - workerRenderPlatform().injector); - // Return a promise so that we keep the same semantics as Dart, - // and we might want to wait for the app side to come up - // in the future... - return PromiseWrapper.resolve(app.get(ApplicationRef)); -} - function messageBusFactory(instance: WebWorkerInstance): MessageBus { return instance.bus; } diff --git a/modules/@angular/platform-browser/test/browser/bootstrap_spec.ts b/modules/@angular/platform-browser/test/browser/bootstrap_spec.ts index 6738802971..6910a43a37 100644 --- a/modules/@angular/platform-browser/test/browser/bootstrap_spec.ts +++ b/modules/@angular/platform-browser/test/browser/bootstrap_spec.ts @@ -5,7 +5,8 @@ import {ComponentRef} from '@angular/core/src/linker/component_factory'; import {Testability, TestabilityRegistry} from '@angular/core/src/testability/testability'; import {Log} from '@angular/core/testing'; import {AsyncTestCompleter, afterEach, beforeEach, describe, expect, inject, it} from '@angular/core/testing/testing_internal'; -import {BROWSER_APP_COMPILER_PROVIDERS, BROWSER_APP_PROVIDERS, BROWSER_PLATFORM_PROVIDERS, bootstrap} from '@angular/platform-browser'; +import {BROWSER_APP_PROVIDERS, BROWSER_PLATFORM_PROVIDERS} from '@angular/platform-browser'; +import {BROWSER_APP_COMPILER_PROVIDERS, bootstrap} from '@angular/platform-browser-dynamic'; import {getDOM} from '@angular/platform-browser/src/dom/dom_adapter'; import {DOCUMENT} from '@angular/platform-browser/src/dom/dom_tokens'; diff --git a/modules/@angular/platform-browser/testing.ts b/modules/@angular/platform-browser/testing.ts index a01ddd8f69..f794e607d0 100644 --- a/modules/@angular/platform-browser/testing.ts +++ b/modules/@angular/platform-browser/testing.ts @@ -1,5 +1,3 @@ export * from './testing/browser_util'; -export * from './testing/browser_static'; export * from './testing/matchers'; export * from './testing/browser'; -export * from './testing/dom_test_component_renderer'; diff --git a/modules/@angular/platform-browser/testing/browser.ts b/modules/@angular/platform-browser/testing/browser.ts index 6751d7ec36..c970b11f3d 100644 --- a/modules/@angular/platform-browser/testing/browser.ts +++ b/modules/@angular/platform-browser/testing/browser.ts @@ -1,30 +1,50 @@ -import {DirectiveResolver, ViewResolver} from '@angular/compiler'; -import {MockDirectiveResolver, MockViewResolver, TestComponentBuilder, TestComponentRenderer} from '@angular/compiler/testing'; +import {LocationStrategy} from '@angular/common'; +import {MockLocationStrategy} from '@angular/common/testing'; +import {APP_ID, NgZone, PLATFORM_COMMON_PROVIDERS, PLATFORM_INITIALIZER} from '@angular/core'; +import {Log} from '@angular/core/testing'; -import {BROWSER_APP_COMPILER_PROVIDERS, BROWSER_APP_PROVIDERS} from '../index'; +import {AnimationDriver, NoOpAnimationDriver} from '../core_private'; +import {BROWSER_APP_PROVIDERS} from '../src/browser'; +import {BrowserDomAdapter} from '../src/browser/browser_adapter'; +import {ELEMENT_PROBE_PROVIDERS} from '../src/dom/debug/ng_probe'; -import {ADDITIONAL_TEST_BROWSER_STATIC_PROVIDERS, TEST_BROWSER_STATIC_PLATFORM_PROVIDERS} from './browser_static'; -import {DOMTestComponentRenderer} from './dom_test_component_renderer'; +import {BrowserDetection} from './browser_util'; + + +/** + * Default platform providers for testing without a compiler. + */ +const TEST_BROWSER_STATIC_PLATFORM_PROVIDERS: Array = [ + PLATFORM_COMMON_PROVIDERS, + {provide: PLATFORM_INITIALIZER, useValue: initBrowserTests, multi: true} +]; + +const ADDITIONAL_TEST_BROWSER_STATIC_PROVIDERS: Array = [ + {provide: APP_ID, useValue: 'a'}, ELEMENT_PROBE_PROVIDERS, Log, + {provide: NgZone, useFactory: createNgZone}, + {provide: LocationStrategy, useClass: MockLocationStrategy}, + {provide: AnimationDriver, useClass: NoOpAnimationDriver} +]; + + +function initBrowserTests() { + BrowserDomAdapter.makeCurrent(); + BrowserDetection.setup(); +} + +function createNgZone(): NgZone { + return new NgZone({enableLongStackTrace: true}); +} /** * Default platform providers for testing. */ export const TEST_BROWSER_PLATFORM_PROVIDERS: Array = - [TEST_BROWSER_STATIC_PLATFORM_PROVIDERS]; - - -export const ADDITIONAL_TEST_BROWSER_PROVIDERS = [ - {provide: DirectiveResolver, useClass: MockDirectiveResolver}, - {provide: ViewResolver, useClass: MockViewResolver}, - TestComponentBuilder, - {provide: TestComponentRenderer, useClass: DOMTestComponentRenderer}, -]; + TEST_BROWSER_STATIC_PLATFORM_PROVIDERS; /** - * Default application providers for testing. + * Default application providers for testing without a compiler. */ -export const TEST_BROWSER_APPLICATION_PROVIDERS: Array = [ - BROWSER_APP_PROVIDERS, BROWSER_APP_COMPILER_PROVIDERS, ADDITIONAL_TEST_BROWSER_STATIC_PROVIDERS, - ADDITIONAL_TEST_BROWSER_PROVIDERS -]; +export const TEST_BROWSER_APPLICATION_PROVIDERS: Array = + [BROWSER_APP_PROVIDERS, ADDITIONAL_TEST_BROWSER_STATIC_PROVIDERS]; diff --git a/modules/@angular/platform-browser/testing/browser_static.ts b/modules/@angular/platform-browser/testing/browser_static.ts deleted file mode 100644 index ca9b3deade..0000000000 --- a/modules/@angular/platform-browser/testing/browser_static.ts +++ /dev/null @@ -1,42 +0,0 @@ -import {LocationStrategy} from '@angular/common'; -import {MockLocationStrategy} from '@angular/common/testing'; -import {APP_ID, NgZone, PLATFORM_COMMON_PROVIDERS, PLATFORM_INITIALIZER} from '@angular/core'; -import {Log} from '@angular/core/testing'; - -import {AnimationDriver, NoOpAnimationDriver} from '../core_private'; -import {BROWSER_APP_PROVIDERS} from '../src/browser'; -import {BrowserDomAdapter} from '../src/browser/browser_adapter'; -import {ELEMENT_PROBE_PROVIDERS} from '../src/dom/debug/ng_probe'; - -import {BrowserDetection} from './browser_util'; - - -/** - * Default platform providers for testing without a compiler. - */ -export const TEST_BROWSER_STATIC_PLATFORM_PROVIDERS: Array = [ - PLATFORM_COMMON_PROVIDERS, - {provide: PLATFORM_INITIALIZER, useValue: initBrowserTests, multi: true} -]; - -export const ADDITIONAL_TEST_BROWSER_STATIC_PROVIDERS: Array = [ - {provide: APP_ID, useValue: 'a'}, ELEMENT_PROBE_PROVIDERS, Log, - {provide: NgZone, useFactory: createNgZone}, - {provide: LocationStrategy, useClass: MockLocationStrategy}, - {provide: AnimationDriver, useClass: NoOpAnimationDriver} -]; - -/** - * Default application providers for testing without a compiler. - */ -export const TEST_BROWSER_STATIC_APPLICATION_PROVIDERS: Array = - [BROWSER_APP_PROVIDERS, ADDITIONAL_TEST_BROWSER_STATIC_PROVIDERS]; - -function initBrowserTests() { - BrowserDomAdapter.makeCurrent(); - BrowserDetection.setup(); -} - -function createNgZone(): NgZone { - return new NgZone({enableLongStackTrace: true}); -} diff --git a/modules/@angular/platform-browser/tsconfig-es2015.json b/modules/@angular/platform-browser/tsconfig-es2015.json index e624c1e05f..4d2a797f16 100644 --- a/modules/@angular/platform-browser/tsconfig-es2015.json +++ b/modules/@angular/platform-browser/tsconfig-es2015.json @@ -16,8 +16,7 @@ "@angular/core/testing": ["../../../dist/packages-dist/core/testing"], "@angular/common": ["../../../dist/packages-dist/common"], "@angular/common/testing": ["../../../dist/packages-dist/common/testing"], - "@angular/compiler": ["../../../dist/packages-dist/compiler"], - "@angular/compiler/testing": ["../../../dist/packages-dist/compiler/testing"], + // workaround for https://github.com/Microsoft/TypeScript/issues/8723 // we can get rid of this once we update to typescript 1.9.0-dev.20160525-1.0 or newer "selenium-webdriver": ["../../../node_modules/@types/selenium-webdriver/index.d.ts"] @@ -32,8 +31,8 @@ "testing.ts", "testing_e2e.ts", "../../../node_modules/@types/hammerjs/index.d.ts", - "../../../node_modules/@types/protractor/index.d.ts", "../../../node_modules/@types/jasmine/index.d.ts", + "../../../node_modules/@types/protractor/index.d.ts", "../../../node_modules/zone.js/dist/zone.js.d.ts" ] } diff --git a/modules/@angular/platform-browser/tsconfig-es5.json b/modules/@angular/platform-browser/tsconfig-es5.json index f7071c646e..399dfea56b 100644 --- a/modules/@angular/platform-browser/tsconfig-es5.json +++ b/modules/@angular/platform-browser/tsconfig-es5.json @@ -16,8 +16,7 @@ "@angular/core/testing": ["../../../dist/packages-dist/core/testing"], "@angular/common": ["../../../dist/packages-dist/common"], "@angular/common/testing": ["../../../dist/packages-dist/common/testing"], - "@angular/compiler": ["../../../dist/packages-dist/compiler"], - "@angular/compiler/testing": ["../../../dist/packages-dist/compiler/testing"], + // workaround for https://github.com/Microsoft/TypeScript/issues/8723 // we can get rid of this once we update to typescript 1.9.0-dev.20160525-1.0 or newer "selenium-webdriver": ["../../../node_modules/@types/selenium-webdriver/index.d.ts"] @@ -33,8 +32,8 @@ "testing.ts", "testing_e2e.ts", "../../../node_modules/@types/hammerjs/index.d.ts", - "../../../node_modules/@types/protractor/index.d.ts", "../../../node_modules/@types/jasmine/index.d.ts", + "../../../node_modules/@types/protractor/index.d.ts", "../../../node_modules/zone.js/dist/zone.js.d.ts" ] } diff --git a/modules/@angular/platform-server/platform_browser_private.ts b/modules/@angular/platform-server/platform_browser_private.ts index 0a030949e9..53b691c91a 100644 --- a/modules/@angular/platform-server/platform_browser_private.ts +++ b/modules/@angular/platform-server/platform_browser_private.ts @@ -1,14 +1,14 @@ -import {__platform_browser_private__ as _} from '@angular/platform-browser'; +import {__platform_browser_private__ as r, __platform_browser_private_types__ as t} from '@angular/platform-browser'; -export type DomAdapter = typeof _.DomAdapter; -export var DomAdapter: typeof _.DomAdapter = _.DomAdapter; -export var setRootDomAdapter: typeof _.setRootDomAdapter = _.setRootDomAdapter; -export var getDOM: typeof _.getDOM = _.getDOM; -export type DomRootRenderer = typeof _.DomRootRenderer; -export var DomRootRenderer: typeof _.DomRootRenderer = _.DomRootRenderer; -export type DomRootRenderer_ = typeof _.DomRootRenderer_; -export var DomRootRenderer_: typeof _.DomRootRenderer_ = _.DomRootRenderer_; -export type DomSharedStylesHost = typeof _.DomSharedStylesHost; -export var DomSharedStylesHost: typeof _.DomSharedStylesHost = _.DomSharedStylesHost; -export type SharedStylesHost = typeof _.SharedStylesHost; -export var SharedStylesHost: typeof _.SharedStylesHost = _.SharedStylesHost; +export type DomAdapter = typeof t.DomAdapter; +export var DomAdapter: typeof t.DomAdapter = r.DomAdapter; +export var setRootDomAdapter: typeof t.setRootDomAdapter = r.setRootDomAdapter; +export var getDOM: typeof t.getDOM = r.getDOM; +export type DomRootRenderer = typeof t.DomRootRenderer; +export var DomRootRenderer: typeof t.DomRootRenderer = r.DomRootRenderer; +export type DomRootRenderer_ = typeof t.DomRootRenderer_; +export var DomRootRenderer_: typeof t.DomRootRenderer_ = r.DomRootRenderer_; +export type DomSharedStylesHost = typeof t.DomSharedStylesHost; +export var DomSharedStylesHost: typeof t.DomSharedStylesHost = r.DomSharedStylesHost; +export type SharedStylesHost = typeof t.SharedStylesHost; +export var SharedStylesHost: typeof t.SharedStylesHost = r.SharedStylesHost; diff --git a/modules/@angular/platform-server/src/server.ts b/modules/@angular/platform-server/src/server.ts index 7507951314..03b1d949cc 100644 --- a/modules/@angular/platform-server/src/server.ts +++ b/modules/@angular/platform-server/src/server.ts @@ -1,6 +1,7 @@ import {PlatformLocation} from '@angular/common'; import {ComponentRef, OpaqueToken, PLATFORM_COMMON_PROVIDERS, PLATFORM_INITIALIZER, PlatformRef, ReflectiveInjector, Type, assertPlatform, coreLoadAndBootstrap, createPlatform, getPlatform} from '@angular/core'; -import {BROWSER_APP_COMPILER_PROVIDERS, BROWSER_APP_PROVIDERS, BrowserPlatformLocation} from '@angular/platform-browser'; +import {BROWSER_APP_PROVIDERS, BrowserPlatformLocation} from '@angular/platform-browser'; +import {BROWSER_APP_COMPILER_PROVIDERS} from '@angular/platform-browser-dynamic'; import {ReflectionCapabilities, reflector, wtfInit} from '../core_private'; diff --git a/modules/@angular/platform-server/testing/server.ts b/modules/@angular/platform-server/testing/server.ts index 9c6ffa6739..3ae70e654f 100644 --- a/modules/@angular/platform-server/testing/server.ts +++ b/modules/@angular/platform-server/testing/server.ts @@ -2,7 +2,8 @@ import {MockLocationStrategy} from '@angular/common/testing'; import {COMPILER_PROVIDERS, DirectiveResolver, ViewResolver, XHR} from '@angular/compiler'; import {MockDirectiveResolver, MockViewResolver, TestComponentBuilder, TestComponentRenderer} from '@angular/compiler/testing'; import {APPLICATION_COMMON_PROVIDERS, APP_ID, NgZone, PLATFORM_COMMON_PROVIDERS, PLATFORM_INITIALIZER, RootRenderer} from '@angular/core'; -import {BrowserDetection, DOMTestComponentRenderer} from '@angular/platform-browser/testing'; +import {DOMTestComponentRenderer} from '@angular/platform-browser-dynamic/testing'; +import {BrowserDetection} from '@angular/platform-browser/testing'; import {AnimationDriver, NoOpAnimationDriver} from '../core_private'; import {Parse5DomAdapter} from '../src/parse5_adapter'; diff --git a/modules/@angular/platform-server/tsconfig-es2015.json b/modules/@angular/platform-server/tsconfig-es2015.json index a67229b7c5..18216e6d59 100644 --- a/modules/@angular/platform-server/tsconfig-es2015.json +++ b/modules/@angular/platform-server/tsconfig-es2015.json @@ -19,7 +19,9 @@ "@angular/compiler": ["../../../dist/packages-dist/compiler/"], "@angular/compiler/testing": ["../../../dist/packages-dist/compiler/testing"], "@angular/platform-browser": ["../../../dist/packages-dist/platform-browser/"], - "@angular/platform-browser/testing": ["../../../dist/packages-dist/platform-browser/testing"] + "@angular/platform-browser/testing": ["../../../dist/packages-dist/platform-browser/testing"], + "@angular/platform-browser-dynamic": ["../../../dist/packages-dist/platform-browser-dynamic"], + "@angular/platform-browser-dynamic/testing": ["../../../dist/packages-dist/platform-browser-dynamic/testing"] }, "rootDir": ".", "sourceMap": true, diff --git a/modules/@angular/platform-server/tsconfig-es5.json b/modules/@angular/platform-server/tsconfig-es5.json index 23539fc378..1a5d04856c 100644 --- a/modules/@angular/platform-server/tsconfig-es5.json +++ b/modules/@angular/platform-server/tsconfig-es5.json @@ -19,7 +19,9 @@ "@angular/compiler": ["../../../dist/packages-dist/compiler/"], "@angular/compiler/testing": ["../../../dist/packages-dist/compiler/testing"], "@angular/platform-browser": ["../../../dist/packages-dist/platform-browser/"], - "@angular/platform-browser/testing": ["../../../dist/packages-dist/platform-browser/testing"] + "@angular/platform-browser/testing": ["../../../dist/packages-dist/platform-browser/testing"], + "@angular/platform-browser-dynamic": ["../../../dist/packages-dist/platform-browser-dynamic"], + "@angular/platform-browser-dynamic/testing": ["../../../dist/packages-dist/platform-browser-dynamic/testing"] }, "rootDir": ".", "sourceMap": true, diff --git a/modules/@angular/router-deprecated/test/integration/bootstrap_spec.ts b/modules/@angular/router-deprecated/test/integration/bootstrap_spec.ts index d60f31cf78..fb4813c753 100644 --- a/modules/@angular/router-deprecated/test/integration/bootstrap_spec.ts +++ b/modules/@angular/router-deprecated/test/integration/bootstrap_spec.ts @@ -2,16 +2,15 @@ import {beforeEach, beforeEachProviders, ddescribe, describe, expect, iit, injec import {AsyncTestCompleter} from '@angular/core/testing/testing_internal'; import {TestComponentBuilder} from '@angular/compiler/testing'; -import {bootstrap} from '@angular/platform-browser'; +import {bootstrap} from '@angular/platform-browser-dynamic'; import {APP_BASE_HREF, LocationStrategy} from '@angular/common'; -import {Component, Directive} from '@angular/core/src/metadata'; +import {Component} from '@angular/core/src/metadata'; import {getDOM} from '@angular/platform-browser/src/dom/dom_adapter'; import {Console} from '@angular/core/src/console'; -import {provide} from '@angular/core'; import {DOCUMENT} from '@angular/platform-browser/src/dom/dom_tokens'; -import {RouteConfig, Route, Redirect, AuxRoute} from '../../src/route_config/route_config_decorator'; +import {RouteConfig, Route, AuxRoute} from '../../src/route_config/route_config_decorator'; import {PromiseWrapper} from '../../src/facade/async'; -import {BaseException, WrappedException} from '../../src/facade/exceptions'; +import {BaseException} from '../../src/facade/exceptions'; import {ROUTER_PROVIDERS, ROUTER_PRIMARY_COMPONENT, RouteParams, Router, ROUTER_DIRECTIVES} from '@angular/router-deprecated'; import {MockLocationStrategy} from '@angular/common/testing'; diff --git a/modules/@angular/router-deprecated/test/route_config/route_config_spec.ts b/modules/@angular/router-deprecated/test/route_config/route_config_spec.ts index 316419a839..a23c08684e 100644 --- a/modules/@angular/router-deprecated/test/route_config/route_config_spec.ts +++ b/modules/@angular/router-deprecated/test/route_config/route_config_spec.ts @@ -1,6 +1,6 @@ import {beforeEach, ddescribe, describe, expect, iit, inject, it, xdescribe, xit,} from '@angular/core/testing/testing_internal'; -import {bootstrap} from '@angular/platform-browser'; +import {bootstrap} from '@angular/platform-browser-dynamic'; import {APP_BASE_HREF, LocationStrategy} from '@angular/common'; import {Component, Directive} from '@angular/core/src/metadata'; import {getDOM} from '@angular/platform-browser/src/dom/dom_adapter'; diff --git a/modules/@angular/upgrade/rollup.config.js b/modules/@angular/upgrade/rollup.config.js index 5d7e809f7c..014fbbb4fc 100644 --- a/modules/@angular/upgrade/rollup.config.js +++ b/modules/@angular/upgrade/rollup.config.js @@ -9,6 +9,7 @@ export default { '@angular/common': 'ng.common', '@angular/compiler': 'ng.compiler', '@angular/platform-browser': 'ng.platformBrowser', + '@angular/platform-browser-dynamic': 'ng.platformBrowser.dynamic', 'rxjs/Subject': 'Rx', 'rxjs/observable/PromiseObservable': 'Rx', // this is wrong, but this stuff has changed in rxjs b.6 so we need to fix it when we update. 'rxjs/operator/toPromise': 'Rx.Observable.prototype', diff --git a/modules/@angular/upgrade/src/upgrade_adapter.ts b/modules/@angular/upgrade/src/upgrade_adapter.ts index 9fe78b159b..7fbae0a753 100644 --- a/modules/@angular/upgrade/src/upgrade_adapter.ts +++ b/modules/@angular/upgrade/src/upgrade_adapter.ts @@ -1,5 +1,6 @@ import {ApplicationRef, ComponentFactory, ComponentResolver, Injector, NgZone, PlatformRef, Provider, ReflectiveInjector, Testability, Type, provide} from '@angular/core'; -import {BROWSER_APP_COMPILER_PROVIDERS, BROWSER_APP_PROVIDERS, browserPlatform} from '@angular/platform-browser'; +import {BROWSER_APP_PROVIDERS, browserPlatform} from '@angular/platform-browser'; +import {BROWSER_APP_COMPILER_PROVIDERS} from '@angular/platform-browser-dynamic'; import * as angular from './angular_js'; import {NG1_COMPILE, NG1_INJECTOR, NG1_PARSE, NG1_ROOT_SCOPE, NG1_TESTABILITY, NG2_COMPILER, NG2_COMPONENT_FACTORY_REF_MAP, NG2_INJECTOR, NG2_ZONE, REQUIRE_INJECTOR} from './constants'; diff --git a/modules/@angular/upgrade/tsconfig-es2015.json b/modules/@angular/upgrade/tsconfig-es2015.json index 0e652a0c63..883c6fcceb 100644 --- a/modules/@angular/upgrade/tsconfig-es2015.json +++ b/modules/@angular/upgrade/tsconfig-es2015.json @@ -15,7 +15,8 @@ "@angular/core": ["../../../dist/packages-dist/core"], "@angular/common": ["../../../dist/packages-dist/common"], "@angular/compiler": ["../../../dist/packages-dist/compiler"], - "@angular/platform-browser": ["../../../dist/packages-dist/platform-browser"] + "@angular/platform-browser": ["../../../dist/packages-dist/platform-browser"], + "@angular/platform-browser-dynamic": ["../../../dist/packages-dist/platform-browser-dynamic"] }, "rootDir": ".", "sourceMap": true, diff --git a/modules/@angular/upgrade/tsconfig-es5.json b/modules/@angular/upgrade/tsconfig-es5.json index 180a612c46..381a51df61 100644 --- a/modules/@angular/upgrade/tsconfig-es5.json +++ b/modules/@angular/upgrade/tsconfig-es5.json @@ -15,7 +15,8 @@ "@angular/core": ["../../../dist/packages-dist/core"], "@angular/common": ["../../../dist/packages-dist/common"], "@angular/compiler": ["../../../dist/packages-dist/compiler"], - "@angular/platform-browser": ["../../../dist/packages-dist/platform-browser"] + "@angular/platform-browser": ["../../../dist/packages-dist/platform-browser"], + "@angular/platform-browser-dynamic": ["../../../dist/packages-dist/platform-browser-dynamic"] }, "rootDir": ".", "sourceMap": true, diff --git a/modules/playground/src/alt_routing/index.ts b/modules/playground/src/alt_routing/index.ts index 90f6799173..e829e12149 100644 --- a/modules/playground/src/alt_routing/index.ts +++ b/modules/playground/src/alt_routing/index.ts @@ -1,5 +1,5 @@ import {InboxApp} from './app/inbox-app'; -import {bootstrap} from '@angular/platform-browser'; +import {bootstrap} from '@angular/platform-browser-dynamic'; import {HashLocationStrategy, LocationStrategy} from '@angular/common'; import {ROUTER_PROVIDERS} from '@angular/router-deprecated'; diff --git a/modules/playground/src/animate/index.ts b/modules/playground/src/animate/index.ts index b33448a66e..d3a649e9de 100644 --- a/modules/playground/src/animate/index.ts +++ b/modules/playground/src/animate/index.ts @@ -1,5 +1,5 @@ import {AnimateApp} from './app/animate-app'; -import {bootstrap} from '@angular/platform-browser'; +import {bootstrap} from '@angular/platform-browser-dynamic'; export function main() { bootstrap(AnimateApp); diff --git a/modules/playground/src/async/index.ts b/modules/playground/src/async/index.ts index c44894c0c2..708e786d70 100644 --- a/modules/playground/src/async/index.ts +++ b/modules/playground/src/async/index.ts @@ -1,4 +1,4 @@ -import {bootstrap} from '@angular/platform-browser'; +import {bootstrap} from '@angular/platform-browser-dynamic'; import {Component} from '@angular/core'; import {NgIf} from '@angular/common'; import {TimerWrapper} from '@angular/core/src/facade/async'; diff --git a/modules/playground/src/bootstrap.ts b/modules/playground/src/bootstrap.ts index d07f3bce14..0ae0731808 100644 --- a/modules/playground/src/bootstrap.ts +++ b/modules/playground/src/bootstrap.ts @@ -22,6 +22,7 @@ declare var System: any; '@angular/common': '/packages-dist/common/bundles/common.umd.js', '@angular/compiler': '/packages-dist/compiler/bundles/compiler.umd.js', '@angular/platform-browser': '/packages-dist/platform-browser/bundles/platform-browser.umd.js', + '@angular/platform-browser-dynamic': '/packages-dist/platform-browser-dynamic/bundles/platform-browser-dynamic.umd.js', '@angular/http': '/packages-dist/http/bundles/http.umd.js', '@angular/upgrade': '/packages-dist/upgrade/bundles/upgrade.umd.js', '@angular/router': '/packages-dist/router/bundles/router.umd.js', @@ -49,6 +50,7 @@ declare var System: any; '@angular/compiler': {main: 'index.js', defaultExtension: 'js'}, '@angular/common': {main: 'index.js', defaultExtension: 'js'}, '@angular/platform-browser': {main: 'index.js', defaultExtension: 'js'}, + '@angular/platform-browser-dynamic': {main: 'index.js', defaultExtension: 'js'}, '@angular/router': {main: 'index.js', defaultExtension: 'js'}, // 'rxjs': { // defaultExtension: 'js' diff --git a/modules/playground/src/gestures/index.ts b/modules/playground/src/gestures/index.ts index 686108f953..a683c153c7 100644 --- a/modules/playground/src/gestures/index.ts +++ b/modules/playground/src/gestures/index.ts @@ -1,4 +1,4 @@ -import {bootstrap} from '@angular/platform-browser'; +import {bootstrap} from '@angular/platform-browser-dynamic'; import {Component} from '@angular/core'; @Component({selector: 'gestures-app', templateUrl: 'template.html'}) diff --git a/modules/playground/src/hash_routing/index.ts b/modules/playground/src/hash_routing/index.ts index 84e016e388..f4a91b7d9d 100644 --- a/modules/playground/src/hash_routing/index.ts +++ b/modules/playground/src/hash_routing/index.ts @@ -1,5 +1,5 @@ import {Component} from '@angular/core'; -import {bootstrap} from '@angular/platform-browser'; +import {bootstrap} from '@angular/platform-browser-dynamic'; import {RouteConfig, Route, ROUTER_PROVIDERS, ROUTER_DIRECTIVES} from '@angular/router-deprecated'; import {HashLocationStrategy, LocationStrategy} from '@angular/common'; diff --git a/modules/playground/src/hello_world/index.ts b/modules/playground/src/hello_world/index.ts index 0c2e2bfaff..1d68bfc1a9 100644 --- a/modules/playground/src/hello_world/index.ts +++ b/modules/playground/src/hello_world/index.ts @@ -1,4 +1,4 @@ -import {bootstrap} from '@angular/platform-browser'; +import {bootstrap} from '@angular/platform-browser-dynamic'; import {Renderer, ElementRef, Component, Directive, Injectable} from '@angular/core'; export function main() { diff --git a/modules/playground/src/http/index.ts b/modules/playground/src/http/index.ts index 2eca25e33d..320586d4cd 100644 --- a/modules/playground/src/http/index.ts +++ b/modules/playground/src/http/index.ts @@ -1,4 +1,4 @@ -import {bootstrap} from '@angular/platform-browser'; +import {bootstrap} from '@angular/platform-browser-dynamic'; import {HTTP_PROVIDERS} from '@angular/http'; import {HttpCmp} from './app/http_comp'; diff --git a/modules/playground/src/jsonp/index.ts b/modules/playground/src/jsonp/index.ts index 6fedde6891..42d5e43801 100644 --- a/modules/playground/src/jsonp/index.ts +++ b/modules/playground/src/jsonp/index.ts @@ -1,4 +1,4 @@ -import {bootstrap} from '@angular/platform-browser'; +import {bootstrap} from '@angular/platform-browser-dynamic'; import {JSONP_PROVIDERS} from '@angular/http'; import {JsonpCmp} from './app/jsonp_comp'; diff --git a/modules/playground/src/key_events/index.ts b/modules/playground/src/key_events/index.ts index 4c44075dfe..f8e1c0840c 100644 --- a/modules/playground/src/key_events/index.ts +++ b/modules/playground/src/key_events/index.ts @@ -1,4 +1,4 @@ -import {bootstrap} from '@angular/platform-browser'; +import {bootstrap} from '@angular/platform-browser-dynamic'; import {Component} from '@angular/core'; import {KeyEventsPlugin} from '@angular/platform-browser'; diff --git a/modules/playground/src/model_driven_forms/index.ts b/modules/playground/src/model_driven_forms/index.ts index 5a4f36dff6..8893fdd524 100644 --- a/modules/playground/src/model_driven_forms/index.ts +++ b/modules/playground/src/model_driven_forms/index.ts @@ -1,4 +1,4 @@ -import {bootstrap} from '@angular/platform-browser'; +import {bootstrap} from '@angular/platform-browser-dynamic'; import { FORM_DIRECTIVES, ControlGroup, diff --git a/modules/playground/src/order_management/index.ts b/modules/playground/src/order_management/index.ts index ea3cc968ab..db6f9ec78a 100644 --- a/modules/playground/src/order_management/index.ts +++ b/modules/playground/src/order_management/index.ts @@ -1,4 +1,4 @@ -import {bootstrap} from '@angular/platform-browser'; +import {bootstrap} from '@angular/platform-browser-dynamic'; import { Component, EventEmitter, diff --git a/modules/playground/src/person_management/index.ts b/modules/playground/src/person_management/index.ts index 23feb62ba4..cdb952b9d4 100644 --- a/modules/playground/src/person_management/index.ts +++ b/modules/playground/src/person_management/index.ts @@ -1,4 +1,4 @@ -import {bootstrap} from '@angular/platform-browser'; +import {bootstrap} from '@angular/platform-browser-dynamic'; import {Component, Injectable} from '@angular/core'; import {NgIf, NgFor, FORM_DIRECTIVES} from '@angular/common'; diff --git a/modules/playground/src/relative_assets/index.ts b/modules/playground/src/relative_assets/index.ts index 440fb4ef95..f1aba8c605 100644 --- a/modules/playground/src/relative_assets/index.ts +++ b/modules/playground/src/relative_assets/index.ts @@ -1,4 +1,4 @@ -import {bootstrap} from '@angular/platform-browser'; +import {bootstrap} from '@angular/platform-browser-dynamic'; import {Component} from '@angular/core'; import {MyCmp} from './app/my_cmp'; diff --git a/modules/playground/src/routing/index.ts b/modules/playground/src/routing/index.ts index 90f6799173..e829e12149 100644 --- a/modules/playground/src/routing/index.ts +++ b/modules/playground/src/routing/index.ts @@ -1,5 +1,5 @@ import {InboxApp} from './app/inbox-app'; -import {bootstrap} from '@angular/platform-browser'; +import {bootstrap} from '@angular/platform-browser-dynamic'; import {HashLocationStrategy, LocationStrategy} from '@angular/common'; import {ROUTER_PROVIDERS} from '@angular/router-deprecated'; diff --git a/modules/playground/src/sourcemap/index.ts b/modules/playground/src/sourcemap/index.ts index 4808761369..891928062f 100644 --- a/modules/playground/src/sourcemap/index.ts +++ b/modules/playground/src/sourcemap/index.ts @@ -1,5 +1,5 @@ import {BaseException} from '@angular/core/src/facade/exceptions'; -import {bootstrap} from '@angular/platform-browser'; +import {bootstrap} from '@angular/platform-browser-dynamic'; import {Component} from '@angular/core'; @Component({ diff --git a/modules/playground/src/svg/index.ts b/modules/playground/src/svg/index.ts index 0129981a24..3cc6e60b2f 100644 --- a/modules/playground/src/svg/index.ts +++ b/modules/playground/src/svg/index.ts @@ -1,4 +1,4 @@ -import {bootstrap} from '@angular/platform-browser'; +import {bootstrap} from '@angular/platform-browser-dynamic'; import {Component} from '@angular/core'; @Component({selector: '[svg-group]', template: `Hello`}) diff --git a/modules/playground/src/template_driven_forms/index.ts b/modules/playground/src/template_driven_forms/index.ts index 9cf29c378d..fcdfa95740 100644 --- a/modules/playground/src/template_driven_forms/index.ts +++ b/modules/playground/src/template_driven_forms/index.ts @@ -1,4 +1,4 @@ -import {bootstrap} from '@angular/platform-browser'; +import {bootstrap} from '@angular/platform-browser-dynamic'; import {Component, Directive, Host} from '@angular/core'; import { ControlGroup, diff --git a/modules/playground/src/todo/index.ts b/modules/playground/src/todo/index.ts index 5e9d81314d..211c366faf 100644 --- a/modules/playground/src/todo/index.ts +++ b/modules/playground/src/todo/index.ts @@ -1,4 +1,4 @@ -import {bootstrap} from '@angular/platform-browser'; +import {bootstrap} from '@angular/platform-browser-dynamic'; import {Component} from '@angular/core'; import {NgFor} from '@angular/common'; import {Store, Todo, TodoFactory} from './app/TodoStore'; diff --git a/modules/playground/src/web_workers/images/background_index.ts b/modules/playground/src/web_workers/images/background_index.ts index a78baf4676..c6d25f74c1 100644 --- a/modules/playground/src/web_workers/images/background_index.ts +++ b/modules/playground/src/web_workers/images/background_index.ts @@ -1,5 +1,5 @@ import {ImageDemo} from './index_common'; -import {bootstrapApp} from '@angular/platform-browser'; +import {bootstrapApp} from '@angular/platform-browser-dynamic'; export function main() { bootstrapApp(ImageDemo); diff --git a/modules/playground/src/web_workers/images/index.ts b/modules/playground/src/web_workers/images/index.ts index 4704774b03..eec4c2a8ac 100644 --- a/modules/playground/src/web_workers/images/index.ts +++ b/modules/playground/src/web_workers/images/index.ts @@ -1,4 +1,4 @@ -import {bootstrapRender} from '@angular/platform-browser'; +import {bootstrapRender} from '@angular/platform-browser-dynamic'; export function main() { bootstrapRender("loader.js"); diff --git a/modules/playground/src/web_workers/images/single_thread.ts b/modules/playground/src/web_workers/images/single_thread.ts index dd692c1b57..df5a09f733 100644 --- a/modules/playground/src/web_workers/images/single_thread.ts +++ b/modules/playground/src/web_workers/images/single_thread.ts @@ -1,4 +1,4 @@ -import {bootstrap} from '@angular/platform-browser'; +import {bootstrap} from '@angular/platform-browser-dynamic'; import {ImageDemo} from './index_common'; export function main() { diff --git a/modules/playground/src/web_workers/input/background_index.ts b/modules/playground/src/web_workers/input/background_index.ts index 0fecb95fca..d2e16ec932 100644 --- a/modules/playground/src/web_workers/input/background_index.ts +++ b/modules/playground/src/web_workers/input/background_index.ts @@ -1,5 +1,5 @@ import {InputCmp} from './index_common'; -import {bootstrapApp} from '@angular/platform-browser'; +import {bootstrapApp} from '@angular/platform-browser-dynamic'; export function main() { bootstrapApp(InputCmp); diff --git a/modules/playground/src/web_workers/input/index.ts b/modules/playground/src/web_workers/input/index.ts index 4704774b03..eec4c2a8ac 100644 --- a/modules/playground/src/web_workers/input/index.ts +++ b/modules/playground/src/web_workers/input/index.ts @@ -1,4 +1,4 @@ -import {bootstrapRender} from '@angular/platform-browser'; +import {bootstrapRender} from '@angular/platform-browser-dynamic'; export function main() { bootstrapRender("loader.js"); diff --git a/modules/playground/src/web_workers/input/loader.js b/modules/playground/src/web_workers/input/loader.js index 52a69df851..c1dbcadac2 100644 --- a/modules/playground/src/web_workers/input/loader.js +++ b/modules/playground/src/web_workers/input/loader.js @@ -15,6 +15,7 @@ System.config({ '@angular/compiler': {main: 'index.js', defaultExtension: 'js'}, '@angular/common': {main: 'index.js', defaultExtension: 'js'}, '@angular/platform-browser': {main: 'index.js', defaultExtension: 'js'}, + '@angular/platform-browser-dynamic': {main: 'index.js', defaultExtension: 'js'}, '@angular/router': {main: 'index.js', defaultExtension: 'js'}, 'rxjs': { defaultExtension: 'js' diff --git a/modules/playground/src/web_workers/kitchen_sink/background_index.ts b/modules/playground/src/web_workers/kitchen_sink/background_index.ts index d701445113..e04f3476c8 100644 --- a/modules/playground/src/web_workers/kitchen_sink/background_index.ts +++ b/modules/playground/src/web_workers/kitchen_sink/background_index.ts @@ -1,5 +1,5 @@ import {HelloCmp} from './index_common'; -import {bootstrapApp} from '@angular/platform-browser'; +import {bootstrapApp} from '@angular/platform-browser-dynamic'; export function main() { bootstrapApp(HelloCmp); diff --git a/modules/playground/src/web_workers/kitchen_sink/index.ts b/modules/playground/src/web_workers/kitchen_sink/index.ts index 4704774b03..eec4c2a8ac 100644 --- a/modules/playground/src/web_workers/kitchen_sink/index.ts +++ b/modules/playground/src/web_workers/kitchen_sink/index.ts @@ -1,4 +1,4 @@ -import {bootstrapRender} from '@angular/platform-browser'; +import {bootstrapRender} from '@angular/platform-browser-dynamic'; export function main() { bootstrapRender("loader.js"); diff --git a/modules/playground/src/web_workers/kitchen_sink/loader.js b/modules/playground/src/web_workers/kitchen_sink/loader.js index 47628465e5..53436e7535 100644 --- a/modules/playground/src/web_workers/kitchen_sink/loader.js +++ b/modules/playground/src/web_workers/kitchen_sink/loader.js @@ -15,6 +15,7 @@ System.config({ '@angular/compiler': {main: 'index.js', defaultExtension: 'js'}, '@angular/common': {main: 'index.js', defaultExtension: 'js'}, '@angular/platform-browser': {main: 'index.js', defaultExtension: 'js'}, + '@angular/platform-browser-dynamic': {main: 'index.js', defaultExtension: 'js'}, '@angular/router': {main: 'index.js', defaultExtension: 'js'}, 'rxjs': { defaultExtension: 'js' diff --git a/modules/playground/src/web_workers/message_broker/background_index.ts b/modules/playground/src/web_workers/message_broker/background_index.ts index 35af0b7d23..d499f5a3f6 100644 --- a/modules/playground/src/web_workers/message_broker/background_index.ts +++ b/modules/playground/src/web_workers/message_broker/background_index.ts @@ -1,4 +1,4 @@ -import {bootstrapApp} from '@angular/platform-browser'; +import {bootstrapApp} from '@angular/platform-browser-dynamic'; import {App} from './index_common'; export function main() { diff --git a/modules/playground/src/web_workers/message_broker/index.ts b/modules/playground/src/web_workers/message_broker/index.ts index f478a223fb..881162ec41 100644 --- a/modules/playground/src/web_workers/message_broker/index.ts +++ b/modules/playground/src/web_workers/message_broker/index.ts @@ -1,5 +1,6 @@ import {ApplicationRef} from '@angular/core'; -import {bootstrapRender, UiArguments, FnArg, PRIMITIVE, ClientMessageBrokerFactory} from '@angular/platform-browser'; +import {UiArguments, FnArg, PRIMITIVE, ClientMessageBrokerFactory} from '@angular/platform-browser'; +import {bootstrapRender} from "@angular/platform-browser-dynamic"; const ECHO_CHANNEL = "ECHO"; diff --git a/modules/playground/src/web_workers/message_broker/loader.js b/modules/playground/src/web_workers/message_broker/loader.js index 94e6c5f250..8701b0620e 100644 --- a/modules/playground/src/web_workers/message_broker/loader.js +++ b/modules/playground/src/web_workers/message_broker/loader.js @@ -15,6 +15,7 @@ System.config({ '@angular/compiler': {main: 'index.js', defaultExtension: 'js'}, '@angular/common': {main: 'index.js', defaultExtension: 'js'}, '@angular/platform-browser': {main: 'index.js', defaultExtension: 'js'}, + '@angular/platform-browser-dynamic': {main: 'index.js', defaultExtension: 'js'}, '@angular/router': {main: 'index.js', defaultExtension: 'js'}, 'rxjs': { defaultExtension: 'js' diff --git a/modules/playground/src/web_workers/router/background_index.ts b/modules/playground/src/web_workers/router/background_index.ts index c0ca8915dd..7dea1f79a2 100644 --- a/modules/playground/src/web_workers/router/background_index.ts +++ b/modules/playground/src/web_workers/router/background_index.ts @@ -1,5 +1,6 @@ import {ROUTER_PROVIDERS} from '@angular/router-deprecated'; -import {bootstrapApp, WORKER_APP_LOCATION_PROVIDERS} from '@angular/platform-browser'; +import {WORKER_APP_LOCATION_PROVIDERS} from '@angular/platform-browser'; +import {bootstrapApp} from '@angular/platform-browser-dynamic'; import {HashLocationStrategy, LocationStrategy} from '@angular/common'; import {App} from './index_common'; diff --git a/modules/playground/src/web_workers/router/index.ts b/modules/playground/src/web_workers/router/index.ts index 90919c2f70..49e6b2267a 100644 --- a/modules/playground/src/web_workers/router/index.ts +++ b/modules/playground/src/web_workers/router/index.ts @@ -1,4 +1,5 @@ -import {bootstrapRender, WORKER_RENDER_LOCATION_PROVIDERS} from '@angular/platform-browser'; +import {WORKER_RENDER_LOCATION_PROVIDERS} from '@angular/platform-browser'; +import {bootstrapRender} from "@angular/platform-browser-dynamic"; export function main() { bootstrapRender("loader.js", WORKER_RENDER_LOCATION_PROVIDERS); diff --git a/modules/playground/src/web_workers/router/loader.js b/modules/playground/src/web_workers/router/loader.js index 67debb089c..ac7ab9469f 100644 --- a/modules/playground/src/web_workers/router/loader.js +++ b/modules/playground/src/web_workers/router/loader.js @@ -15,6 +15,7 @@ System.config({ '@angular/compiler': {main: 'index.js', defaultExtension: 'js'}, '@angular/common': {main: 'index.js', defaultExtension: 'js'}, '@angular/platform-browser': {main: 'index.js', defaultExtension: 'js'}, + '@angular/platform-browser-dynamic': {main: 'index.js', defaultExtension: 'js'}, '@angular/router': {main: 'index.js', defaultExtension: 'js'}, '@angular/router-deprecated': {main: 'index.js', defaultExtension: 'js'}, 'rxjs': { diff --git a/modules/playground/src/web_workers/todo/background_index.ts b/modules/playground/src/web_workers/todo/background_index.ts index a6c0e4da2b..3540b38138 100644 --- a/modules/playground/src/web_workers/todo/background_index.ts +++ b/modules/playground/src/web_workers/todo/background_index.ts @@ -1,5 +1,5 @@ import {TodoApp} from './index_common'; -import {bootstrapApp} from '@angular/platform-browser'; +import {bootstrapApp} from '@angular/platform-browser-dynamic'; export function main() { bootstrapApp(TodoApp); diff --git a/modules/playground/src/web_workers/todo/index.ts b/modules/playground/src/web_workers/todo/index.ts index 4704774b03..eec4c2a8ac 100644 --- a/modules/playground/src/web_workers/todo/index.ts +++ b/modules/playground/src/web_workers/todo/index.ts @@ -1,4 +1,4 @@ -import {bootstrapRender} from '@angular/platform-browser'; +import {bootstrapRender} from '@angular/platform-browser-dynamic'; export function main() { bootstrapRender("loader.js"); diff --git a/modules/playground/src/web_workers/todo/loader.js b/modules/playground/src/web_workers/todo/loader.js index 33a496c630..e5ea058175 100644 --- a/modules/playground/src/web_workers/todo/loader.js +++ b/modules/playground/src/web_workers/todo/loader.js @@ -15,6 +15,7 @@ System.config({ '@angular/compiler': {main: 'index.js', defaultExtension: 'js'}, '@angular/common': {main: 'index.js', defaultExtension: 'js'}, '@angular/platform-browser': {main: 'index.js', defaultExtension: 'js'}, + '@angular/platform-browser-dynamic': {main: 'index.js', defaultExtension: 'js'}, '@angular/router': {main: 'index.js', defaultExtension: 'js'}, 'rxjs': { defaultExtension: 'js' diff --git a/modules/playground/src/zippy_component/index.ts b/modules/playground/src/zippy_component/index.ts index 88ef27b7b6..6423fcb430 100644 --- a/modules/playground/src/zippy_component/index.ts +++ b/modules/playground/src/zippy_component/index.ts @@ -1,4 +1,4 @@ -import {bootstrap} from '@angular/platform-browser'; +import {bootstrap} from '@angular/platform-browser-dynamic'; import {Component} from '@angular/core'; import {Zippy} from './app/zippy'; diff --git a/test-main.js b/test-main.js index 97935afbd5..f4e23eef28 100644 --- a/test-main.js +++ b/test-main.js @@ -57,6 +57,10 @@ System.config({ main: 'index.js', defaultExtension: 'js' }, + '@angular/platform-browser-dynamic': { + main: 'index.js', + defaultExtension: 'js' + }, '@angular/platform-server': { main: 'index.js', defaultExtension: 'js' @@ -69,11 +73,11 @@ System.config({ // method and kick off Karma (Jasmine). System.import('@angular/core/testing') .then(function(coreTesting){ - return System.import('@angular/platform-browser/testing') + return System.import('@angular/platform-browser-dynamic/testing') .then(function(browserTesting){ coreTesting.setBaseTestProviders( - browserTesting.TEST_BROWSER_PLATFORM_PROVIDERS, - browserTesting.TEST_BROWSER_APPLICATION_PROVIDERS + browserTesting.TEST_BROWSER_DYNAMIC_PLATFORM_PROVIDERS, + browserTesting.TEST_BROWSER_DYNAMIC_APPLICATION_PROVIDERS ); }); }) diff --git a/tools/cjs-jasmine/index.ts b/tools/cjs-jasmine/index.ts index 8edea3992b..d8c744cd45 100644 --- a/tools/cjs-jasmine/index.ts +++ b/tools/cjs-jasmine/index.ts @@ -39,6 +39,7 @@ var specFiles: any = ignore: [ // the following code and tests are not compatible with CJS/node environment '@angular/platform-browser/**', + '@angular/platform-browser-dynamic/**', '@angular/core/test/zone/**', '@angular/core/test/fake_async_spec.*', '@angular/common/test/forms/**', diff --git a/tools/public_api_guard/public_api_spec.ts b/tools/public_api_guard/public_api_spec.ts index d2f726a48e..fb0af64105 100644 --- a/tools/public_api_guard/public_api_spec.ts +++ b/tools/public_api_guard/public_api_spec.ts @@ -1483,9 +1483,6 @@ const UPGRADE = [ ]; const PLATFORM_BROWSER = [ - 'bootstrap(appComponentType:Type, customProviders?:Array):Promise>', - 'bootstrapApp(appComponentType:Type, customProviders?:Array):Promise>', - 'bootstrapRender(workerScriptUri:string, customProviders?:Array):Promise', 'browserPlatform():PlatformRef', 'BrowserPlatformLocation', 'BrowserPlatformLocation.back():void', @@ -1509,12 +1506,10 @@ const PLATFORM_BROWSER = [ 'ClientMessageBroker.runOnService(args:UiArguments, returnType:Type):Promise', 'ClientMessageBrokerFactory', 'ClientMessageBrokerFactory.createMessageBroker(channel:string, runInZone?:boolean):ClientMessageBroker', - 'const BROWSER_APP_COMPILER_PROVIDERS:Array', 'const BROWSER_APP_PROVIDERS:Array', 'const BROWSER_PLATFORM_PROVIDERS:Array', 'const BROWSER_PROVIDERS:any[]', 'const BROWSER_SANITIZATION_PROVIDERS:Array', - 'const CACHED_TEMPLATE_PROVIDER:Array', 'const DOCUMENT:OpaqueToken', 'const ELEMENT_PROBE_PROVIDERS:any[]', 'const EVENT_MANAGER_PLUGINS:OpaqueToken', @@ -1597,6 +1592,7 @@ const PLATFORM_BROWSER = [ 'UiArguments.args?:FnArg[]', 'UiArguments.constructor(method:string, args?:FnArg[])', 'UiArguments.method:string', + 'var __platform_browser_private__:any', 'var SecurityContext:unknown', 'WebWorkerInstance', 'WebWorkerInstance.bus:MessageBus', @@ -1619,16 +1615,9 @@ const PLATFORM_BROWSER_TESTING = [ 'BrowserDetection.isWebkit:boolean', 'BrowserDetection.setup():any', 'BrowserDetection.supportsIntlApi:boolean', - 'const ADDITIONAL_TEST_BROWSER_PROVIDERS:any', - 'const ADDITIONAL_TEST_BROWSER_STATIC_PROVIDERS:Array', 'const TEST_BROWSER_APPLICATION_PROVIDERS:Array', 'const TEST_BROWSER_PLATFORM_PROVIDERS:Array', - 'const TEST_BROWSER_STATIC_APPLICATION_PROVIDERS:Array', - 'const TEST_BROWSER_STATIC_PLATFORM_PROVIDERS:Array', 'dispatchEvent(element:any, eventType:any):void', - 'DOMTestComponentRenderer', - 'DOMTestComponentRenderer.constructor(_doc:any)', - 'DOMTestComponentRenderer.insertRootElement(rootElId:string):any', 'el(html:string):HTMLElement', 'NgMatchers', 'NgMatchers.not:NgMatchers', @@ -1654,6 +1643,23 @@ const PLATFORM_BROWSER_TESTING_E2E = [ 'verifyNoBrowserErrors():any', ]; + +const PLATFORM_BROWSER_DYNAMIC = [ + 'bootstrap(appComponentType:Type, customProviders?:Array):Promise>', + 'bootstrapApp(appComponentType:Type, customProviders?:Array):Promise>', + 'bootstrapRender(workerScriptUri:string, customProviders?:Array):Promise', + 'const BROWSER_APP_COMPILER_PROVIDERS:Array', + 'const CACHED_TEMPLATE_PROVIDER:Array', +]; + + +const PLATFORM_BROWSER_DYNAMIC_TESTING = [ + 'const TEST_BROWSER_DYNAMIC_APPLICATION_PROVIDERS:Array', + 'const TEST_BROWSER_DYNAMIC_PLATFORM_PROVIDERS:Array', +]; + + + const PLATFORM_SERVER = [ 'const SERVER_APPLICATION_PROVIDERS:Array', 'const SERVER_PLATFORM_PROVIDERS:Array', @@ -1854,6 +1860,8 @@ describe('public API', () => { check('@angular/platform-browser/index.ts', PLATFORM_BROWSER); check('@angular/platform-browser/testing.ts', PLATFORM_BROWSER_TESTING); check('@angular/platform-browser/testing_e2e.ts', PLATFORM_BROWSER_TESTING_E2E); + check('@angular/platform-browser-dynamic/index.ts', PLATFORM_BROWSER_DYNAMIC); + check('@angular/platform-browser-dynamic/testing.ts', PLATFORM_BROWSER_DYNAMIC_TESTING); check('@angular/platform-server/index.ts', PLATFORM_SERVER); check('@angular/platform-server/testing.ts', PLATFORM_SERVER_TESTING); check('@angular/http/index.ts', HTTP);