This contains major changes to the compiler, bootstrap of the platforms
and test environment initialization.
Main part of #10043Closes#10164
BREAKING CHANGE:
- Semantics and name of `@AppModule` (now `@NgModule`) changed quite a bit.
This is actually not breaking as `@AppModules` were not part of rc.4.
We will have detailed docs on `@NgModule` separately.
- `coreLoadAndBootstrap` and `coreBootstrap` can't be used any more (without migration support).
Use `bootstrapModule` / `bootstrapModuleFactory` instead.
- All Components listed in routes have to be part of the `declarations` of an NgModule.
Either directly on the bootstrap module / lazy loaded module, or in an NgModule imported by them.
- 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
This lets users continue using runtime-sideeffect Decorators if they choose,
only down-leveling the marked ones to Annotations.
Also remove the "skipTemplateCodegen" option, which is no longer needed
since Angular compiles with tsc-wrapped rather than ngc. The former doesn't
include any codegen.
* Revert "fix(d.ts): enable angular2 compilation with TS flag --strictNullChecks (#8902)"
This reverts commit 7e352a27f7.
* test: add typescript test for our typings
This ensures we run in a clean directory, using our real distribution. It finds bugs like @internal
APIs needed to type-check in the offline compiler, as well as problems in package.json.
Also move tsc-wrapped under tools/@angular
This allows angular's build to depend on some extensions, but not on code generation, and breaks a cycle in the angular build
We now merge ts-metadata-collector into tsc-wrapped and stop publishing the former.
BREAKING CHANGE:
- Renderer:
* renderComponent method is removed form `Renderer`, only present on `RootRenderer`
* Renderer.setDebugInfo is removed. Renderer.createElement / createText / createTemplateAnchor
now take the DebugInfo directly.
- Query semantics:
* Queries don't work with dynamically loaded components.
* e.g. for router-outlet: loaded components can't be queries via @ViewQuery,
but router-outlet emits an event `activate` now that emits the activated component
- Exception classes and the context inside changed (renamed fields)
- DebugElement.attributes is an Object and not a Map in JS any more
- ChangeDetectorGenConfig was renamed into CompilerConfig
- AppViewManager.createEmbeddedViewInContainer / AppViewManager.createHostViewInContainer
are removed, use the methods in ViewContainerRef instead
- Change detection order changed:
* 1. dirty check component inputs
* 2. dirty check content children
* 3. update render nodes
Closes#6301Closes#6567
To workaround https://github.com/Microsoft/TypeScript/issues/7573
we must remove the readonly keyword from generated .d.ts files.
This solution will not scale, but will probably buy enough time to require our users move to a 2.0 beta.
Closes#8003
Also enable DDC checks across all non-web worker playground apps. We are
now down to 2 DDC errors across all of them. The remaining two need to be
fixed in package:analyzer, not in angular.
BREAKING CHANGE:
- there's a chance of breakage as router's Instruction constructor
signature changed.
Closes#6693
Previously we grepped all hand-written Dart code and ran analyzer in strong mode against it.
Now we run it against transformed playground apps, which:
1. does not analyze unnecessary code (we primarily care about stuff that runs in the browser)
2. analyzes generated code, which does run in the browser and which we failed to analyze in the previous version of the build
Closes#6436
This is to prevent Travis from prematurely shut down the VM while we are still waiting for the sauce connect client
to tear down the tunnel.
Closes#4335
Originally we ran gulp enforce-format at the beginning of the build.
This was annoying because you came back from lunch to find that no tests
ran so you have to start your PR over.
Then we changed it to run the linters at the end. This is annoying because
you might be ready to merge to master, and could have fixed the lint
issues immediately, but now much wait for another PR.
The solution is to run the lint checks in another build. This marks
your PR red very early, but you still get the feedback of whether the
tests are passing.
Regen-ed the CHANGELOG.md (for consistency). Seems like some old commits
are not present in new the CHANGELOG.md, but it doesn't seem worthy of
further investigation.
closes#3204, #3172
Don't precompile Dart2JS for pull requests, instead serve the dart
sources with pub serve. We were already testing with Dartium so
all we lose is some test coverage of defects exposed only by the
Dart2JS transpiler.
This still runs the dart transformer.
Fixes#3030
The pub publish process was not following through with publishing
packages because the -f flag was not be provided to pub publish,
causing the process to prompt for confirmation before publishing,
which was causing the pub_publish.sh script to skip publishing.
Closes#3077
second attempt after rollback of https://github.com/angular/angular/pull/2946
After each successful build in the dart stable variant, this uploads just enough of the dart
artifacts to mirror what we would push to pub.
By uploading the files instead of a zip, this lets dart users depend on an unreleased snapshot
of angular2, and lets us easily fetch the dart artifacts for sync into google3
without having to re-build (potentially in a subtly different environment).
This doesn't upload anything for pull requests.
In order to speedup the startup time of test.unit.js task, we are moving the circular dependency check into
a pre-test check that executes only on travis. Similarly we are moving the style check to a post-test check
that executes on travis.
This way if a circular dependency issue occurs, we find it before running tests on CI and if the code
is not formatted we fail the build only if all the tests pass.
Related to #2536
Related to #2094
The `build.http.example` task was removed from gulp and replaced by another task, but a reference to the task was not removed from `test_e2e_dart.sh`.
Fixes#2509
This implementation only works in JavaScript, while the Observable transpilation
story gets worked out. Right now, the service just makes a simple request,
and returns an Observable of Response.
Additional functionality will be captured in separate issues.
Fixes#2028