Tobias Bosch 3f55aa609f feat(browser): use AppModules for bootstrap in the browser
This introduces the `BrowserModule` to be used for long form
bootstrap and offline compile bootstrap:

```
@AppModule({
  modules: [BrowserModule],
  precompile: [MainComponent],
  providers: […], // additional providers
  directives: […], // additional platform directives
  pipes: […] // additional platform pipes
})
class MyModule {
  constructor(appRef: ApplicationRef) {
    appRef.bootstrap(MainComponent);
  }
}

// offline compile
import {bootstrapModuleFactory} from ‘@angular/platform-browser’;
bootstrapModuleFactory(MyModuleNgFactory);

// runtime compile long form
import {bootstrapModule} from ‘@angular/platform-browser-dynamic’;
bootstrapModule(MyModule);
```

The short form, `bootstrap(...)`, can now creates a module on the fly,
given `directives`, `pipes, `providers`, `precompile` and `modules`
properties.

Related changes:
- make `SanitizationService`, `SecurityContext` public in `@angular/core` so that the offline compiler can resolve the token
- move `AnimationDriver` to `platform-browser` and make it
  public so that the offline compiler can resolve the token

BREAKING CHANGES:
- short form bootstrap does no longer allow
  to inject compiler internals (i.e. everything 
  from `@angular/compiler). Inject `Compiler` instead.
  To provide custom providers for the compiler,
  create a custom compiler via `browserCompiler({providers: [...]})`
  and pass that into the `bootstrap` method.
2016-07-02 20:35:09 -07:00

47 lines
2.1 KiB
TypeScript

/**
* @license
* Copyright Google Inc. All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.io/license
*/
import * as browser from './src/browser';
import * as ng_proble from './src/dom/debug/ng_probe';
import * as dom_adapter from './src/dom/dom_adapter';
import * as dom_renderer from './src/dom/dom_renderer';
import * as dom_events from './src/dom/events/dom_events';
import * as shared_styles_host from './src/dom/shared_styles_host';
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 ELEMENT_PROBE_PROVIDERS: typeof ng_proble.ELEMENT_PROBE_PROVIDERS;
export type DomEventsPlugin = dom_events.DomEventsPlugin;
export var DomEventsPlugin: typeof dom_events.DomEventsPlugin;
export var initDomAdapter: typeof browser.initDomAdapter;
}
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,
ELEMENT_PROBE_PROVIDERS: ng_proble.ELEMENT_PROBE_PROVIDERS,
DomEventsPlugin: dom_events.DomEventsPlugin,
initDomAdapter: browser.initDomAdapter
};