angular-docs-cn/tools
Tobias Bosch fa47890032 refactor(core): clean up platform bootstrap and initTestEnvironment
- Introduces `CompilerFactory` which can be part of a `PlatformRef`.
- Introduces `WorkerAppModule`, `WorkerUiModule`, `ServerModule`
- Introduces `serverDynamicPlatform` for applications using runtime compilation
  on the server.
- Changes browser bootstrap for runtime and offline compilation (see below for an example).
  * introduces `bootstrapModule` and `bootstrapModuleFactory` in `@angular/core`
  * introduces new `browserDynamicPlatform` in `@angular/platform-browser-dynamic
- Changes `initTestEnvironment` (which used to be `setBaseTestProviders`) to not take a compiler factory any more (see below for an example).

BREAKING CHANGE:

## Migration from `setBaseTestProviders` to `initTestEnvironment`:

- For the browser platform:
  BEFORE:
  ```
  import {setBaseTestProviders} from ‘@angular/core/testing’;
  import {TEST_BROWSER_DYNAMIC_PLATFORM_PROVIDERS,
      TEST_BROWSER_DYNAMIC_APPLICATION_PROVIDERS} from ‘@angular/platform-browser-dynamic/testing’;

  setBaseTestProviders(TEST_BROWSER_DYNAMIC_PLATFORM_PROVIDERS,
      TEST_BROWSER_DYNAMIC_APPLICATION_PROVIDERS);
  ```

  AFTER:
  ```
  import {initTestEnvironment} from ‘@angular/core/testing’;
  import {browserDynamicTestPlatform,
      BrowserDynamicTestModule} from ‘@angular/platform-browser-dynamic/testing’;

  initTestEnvironment(
      BrowserDynamicTestModule,
      browserDynamicTestPlatform());

  ```
- For the server platform:
  BEFORE:
  ```
  import {setBaseTestProviders} from ‘@angular/core/testing’;
  import {TEST_SERVER_PLATFORM_PROVIDERS,
      TEST_SERVER_APPLICATION_PROVIDERS} from ‘@angular/platform-server/testing/server’;

  setBaseTestProviders(TEST_SERVER_PLATFORM_PROVIDERS,
      TEST_SERVER_APPLICATION_PROVIDERS);
  ```

  AFTER:
  ```
  import {initTestEnvironment} from ‘@angular/core/testing’;
  import {serverTestPlatform,
      ServerTestModule} from ‘@angular/platform-browser-dynamic/testing’;

  initTestEnvironment(
      ServerTestModule,
      serverTestPlatform());

  ```

## Bootstrap changes
```
@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 {browserPlatform} from ‘@angular/platform-browser’;
import {bootstrapModuleFactory} from ‘@angular/core’;

bootstrapModuleFactory(MyModuleNgFactory, browserPlatform());

// runtime compile long form
import {browserDynamicPlatform} from ‘@angular/platform-browser-dynamic’;
import {bootstrapModule} from ‘@angular/core’;

bootstrapModule(MyModule, browserDynamicPlatform());
```

Closes #9922
Part of #9726
2016-07-08 13:41:38 -07:00
..
@angular/tsc-wrapped fix(ngc): work with typescript@next 2016-06-24 10:27:31 -07:00
analytics chore(): remove all angular2_material code. 2016-03-16 13:37:37 -07:00
broccoli cleanup(router): removes router 2016-06-20 08:47:54 -07:00
build chore(ngc): refactor out tsc-wrapped 2016-05-25 09:45:55 -07:00
cjs-jasmine refactor(core): clean up platform bootstrap and initTestEnvironment 2016-07-08 13:41:38 -07:00
code.angularjs.org chore(publish): add Rx bundles to code.angularjs.org publish step 2015-12-15 17:12:42 +00:00
karma fix(test-runner): make karma internal reporter compatible with 0.13.20 (#8977) 2016-06-03 10:48:55 -07:00
npm build(npm): short-circuit npm install if node_modules are healthy 2016-05-13 22:07:41 +02:00
public_api_guard refactor(core): clean up platform bootstrap and initTestEnvironment 2016-07-08 13:41:38 -07:00
travis build(travis): add travis log folding for verbose tasks 2015-10-03 21:33:57 +00:00
tree-shaking-test test: add tree-shaking test 2016-06-08 12:20:42 -07:00
tsc-watch feat(core): introduce `@AppModule` 2016-06-30 11:34:40 -07:00
tslint chore(lint): Add lint check for license headers 2016-06-23 09:46:32 -07:00
typings-test fix(typings): don't test compiler-cli typings on TS 1.8 2016-06-23 10:57:03 -07:00
check-environment.js chore(lint): re-enable clang-format on tools/ 2016-05-26 15:46:03 -07:00
chromedriverpatch.js chore(testing): update protractor to version 2.1.0 2015-05-20 17:28:23 -07:00
jsconfig.json chore(vscode): add jsconfig.json and remove .settings dir 2015-10-29 13:53:21 +00:00
tsconfig.json test: upgrade ts-api-guardian to v0.1.2 2016-06-23 14:26:40 -07:00
types.d.ts build: remove dependency on tsd and use @types/* instead 2016-05-25 16:42:28 -07:00
utils.inc feat(bundle): add script to push bundles to code.angularjs.org 2015-04-14 14:50:53 -07:00