Issue raised in PR #6745.
Previously, the transformer name conversion functions could return the
input string on unexpected input, which is almost certainly an error.
`throw` in this case instead, so we know early that something has likely
gone wrong.
Closes#6753
Previously, every .dart file in a package was processed to ensure proper
initialization of deferred loaded libraries.
Update the transformer to avoid processing libraries which we know do
not import any deferred libraries.
Closes#6745
Handle some cases which would previously result in broken code.
- Importing bootstrap.dart deferred
- Using combinators when importing bootstrap.dart
- Importing bootstrap.dart with a prefix
Closes#6749
Previously, we generated the code to initialize the reflector into the
<file>.ng_deps.dart and the compiled template and change detector code
into <file>.template.dart.
Update the transformer to generate all code into <file>.template.dart to
avoid the additional HTTP requests necessary when debugging
applications in Dartium.
Now, using `ng.probe(element)` in the browser console returns
a DebugElement when in dev mode.
`ComponentFixture#debugElement` also returns a new DebugElement.
Breaking Change:
This is a breaking change for unit tests. The API for the DebugElement
has changed. Now, there is a DebugElement or DebugNode for every node
in the DOM, not only nodes with an ElementRef. `componentViewChildren` is
removed, and `childNodes` is a list of ElementNodes corresponding to every
child in the DOM. `query` no longer takes a scope parameter, since
the entire rendered DOM is included in the `childNodes`.
Before:
```
componentFixture.debugElement.componentViewChildren[0];
```
After
```
// Depending on the DOM structure of your component, the
// index may have changed or the first component child
// may be a sub-child.
componentFixture.debugElement.children[0];
```
Before:
```
debugElement.query(By.css('div'), Scope.all());
```
After:
```
debugElement.query(By.css('div'));
```
Before:
```
componentFixture.debugElement.elementRef;
```
After:
```
componentFixture.elementRef;
```
BEFORE:
The following would throw in the dev mode because `f` would return a new array when called by checkNoChanges.
@Component({
template: `
{{f()}}
`
})
class A {
f() { return [1]; }
}
AFTER:
The checkNoChanges function compares only primitives types for equality, and deeply compares iterables. Other objects cannot cause checkNoChanges to throw. This means that the dev mode would never fail given a legal program, but may allow some illegal programs.
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
This is needed to prevent memory leaks. The DOM
listeners don’t need to be removed for simple examples,
but a big internal app shows memory leaks because of them.
BREAKING CHANGE:
- `Renderer.listen` now has to return a function that
removes the event listener.
Previously, template codegen was done asynchronously, which could result
in reflector state being overwritten and leading to compile errors.
Update the codegen to run synchronously to ensure this does not happen.
Closes#6603