angular/modules/@angular/compiler/src
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
..
animation revert: fix(animations): ensure all child elements are rendered before running animations 2016-07-07 14:12:17 -07:00
expression_parser feat(compiler): Expression span information and error correction (#9772) 2016-07-06 14:06:47 -07:00
i18n chore(lint): Added license headers to most TypeScript files 2016-06-23 09:47:54 -07:00
output chore: enable cyclic dependency check 2016-06-30 14:28:22 -07:00
schema feat(browser): use AppModules for bootstrap in the browser 2016-07-02 20:35:09 -07:00
view_compiler refactor: misc cleanup 2016-07-08 10:34:22 -07:00
app_module_compiler.ts chore(compiler): fix cyclic dependency 2016-06-30 14:28:22 -07:00
assertions.dart repackaging: all the file moves 2016-05-01 20:51:00 -07:00
assertions.ts chore(lint): Added license headers to most TypeScript files 2016-06-23 09:47:54 -07:00
chars.ts chore(lint): Added license headers to most TypeScript files 2016-06-23 09:47:54 -07:00
compile_metadata.ts feat(core): introduce @AppModule 2016-06-30 11:34:40 -07:00
compiler.ts refactor(core): clean up platform bootstrap and initTestEnvironment 2016-07-08 13:41:38 -07:00
config.ts refactor: add types (#9606) 2016-06-28 11:35:59 -07:00
css_ast.ts refactor(core): ensure CSS parser uses ParseSourceSpan to track ast locations 2016-07-06 11:22:45 -07:00
css_lexer.ts refactor(core): ensure CSS parser uses ParseSourceSpan to track ast locations 2016-07-06 11:22:45 -07:00
css_parser.ts refactor(core): ensure CSS parser uses ParseSourceSpan to track ast locations 2016-07-06 11:22:45 -07:00
directive_lifecycle_reflector.ts refactor: add types (#9606) 2016-06-28 11:35:59 -07:00
directive_normalizer.ts feat(core): introduce @AppModule 2016-06-30 11:34:40 -07:00
directive_resolver.ts refactor: add types (#9606) 2016-06-28 11:35:59 -07:00
facade repackaging: all the repackaging changes squashed 2016-05-01 20:51:00 -07:00
html_ast.ts chore(lint): Added license headers to most TypeScript files 2016-06-23 09:47:54 -07:00
html_lexer.ts chore(lint): Added license headers to most TypeScript files 2016-06-23 09:47:54 -07:00
html_parser.ts chore(lint): Added license headers to most TypeScript files 2016-06-23 09:47:54 -07:00
html_tags.ts chore(lint): Added license headers to most TypeScript files 2016-06-23 09:47:54 -07:00
identifiers.ts refactor: misc cleanup 2016-07-08 10:34:22 -07:00
interpolation_config.ts chore(lint): Added license headers to most TypeScript files 2016-06-23 09:47:54 -07:00
metadata_resolver.ts feat(core): allow to add precompiled tokens via a provider 2016-07-07 12:16:48 -07:00
offline_compiler.ts feat(core): introduce @AppModule 2016-06-30 11:34:40 -07:00
parse_util.ts feat(core): introduce @AppModule 2016-06-30 11:34:40 -07:00
pipe_resolver.ts chore(lint): Added license headers to most TypeScript files 2016-06-23 09:47:54 -07:00
provider_parser.ts feat(core): introduce @AppModule 2016-06-30 11:34:40 -07:00
runtime_compiler.ts feat(testing): add implicit test module 2016-07-06 18:04:19 -07:00
selector.ts chore(lint): Added license headers to most TypeScript files 2016-06-23 09:47:54 -07:00
shadow_css.ts chore(lint): Added license headers to most TypeScript files 2016-06-23 09:47:54 -07:00
style_compiler.ts feat(compiler): support sync runtime compile 2016-06-28 10:26:16 -07:00
style_url_resolver.ts chore(lint): Added license headers to most TypeScript files 2016-06-23 09:47:54 -07:00
template_ast.ts feat(browser): use AppModules for bootstrap in the browser 2016-07-02 20:35:09 -07:00
template_parser.ts fix(TemplateParser): add support for data-template attribute 2016-07-08 13:07:01 -07:00
template_preparser.ts chore(lint): Added license headers to most TypeScript files 2016-06-23 09:47:54 -07:00
url_resolver.dart repackaging: all the file moves 2016-05-01 20:51:00 -07:00
url_resolver.ts docs(security): security api doc update and fix stability marker for Type 2016-06-28 14:01:48 -07:00
util.ts feat(core): introduce @AppModule 2016-06-30 11:34:40 -07:00
view_resolver.ts feat(compiler): support sync runtime compile 2016-06-28 10:26:16 -07:00
xhr.ts chore(lint): Added license headers to most TypeScript files 2016-06-23 09:47:54 -07:00