Commit Graph

1041 Commits

Author SHA1 Message Date
Alex Rickabaugh e4c53f8529 Revert "feat(router): add a function set up router sync when used with downgradeModule"
This reverts commit f5bb999319. The commit
does not include proper tests.
2017-12-20 09:15:15 -08:00
Alex Rickabaugh b61e3e9d20 Revert "fix(router): replaceURL when reacting to a change coming from angularjs"
This reverts commit 0b2d636b75. The commit
does not include proper tests.
2017-12-20 09:14:27 -08:00
George Kalpakas 3846f19f22 docs(core): move core examples into `examples/core/` directory
This allows examples to be found during aio's `yarn serve-and-sync`, which only
looks for examples in `packages/examples/<packageName>/**/*`, where
`packageName` is the name of the package that the modified file belonged to;
e.g. `core`, `common`, etc.).
2017-12-18 12:10:29 -08:00
vsavkin 057513536b fix(upgrade): replaces get/setAngularLib with get/setAngularJSGlobal
The current names are confusing because Angular should refer to the latest version of the framework.
2017-12-18 12:10:01 -08:00
Chuck Jazdzewski 82bcd83566 feat(compiler): allow ngIf to use the ngIf expression directly as a guard
Allows a directive to use the expression passed directly to a property
as a guard instead of filtering the type through a type expression.

This more accurately matches the intent of the ngIf usage of its template
enabling better type inference.

Moved NgIf to using this type of guard instead of a function guard.

Closes: #20967
2017-12-18 12:09:21 -08:00
Alex Rickabaugh 20e1cc049f fix(service-worker): check for updates on navigation
Currently the Service Worker checks for updates only on SW startup,
an event which happens frequently but also nondeterministically. This
makes it hard for developers to observe the update process or reason
about how updates will be delivered to users. This problem is
exacerbated by the DevTools behavior of keeping the SW alive
indefinitely while opened, effectively preventing the page from
updating at all.

This change causes the SW to additionally check for updates on
navigation requests (app page reloads). This creates deterministic
update behavior, and is much easier for developers to reason about.
It does leave the old update-on-SW-startup behavior in place, as
removing that would be a breaking change.

Fixes #20877
2017-12-15 15:19:20 -08:00
vsavkin 0b2d636b75 fix(router): replaceURL when reacting to a change coming from angularjs
Closes: #20549
2017-12-15 07:59:56 -08:00
vsavkin f5bb999319 feat(router): add a function set up router sync when used with downgradeModule 2017-12-15 07:59:56 -08:00
Trotyl 05ff6c09ca fix(compiler): make tsx file aot compatible
fixes #20555
2017-12-15 07:53:46 -08:00
Chuck Jazdzewski d91ff17adc fix(compiler): generate the correct imports for summary type-check
Summaries should be ignored when importing the types used in a
type-check block.
2017-12-15 07:53:11 -08:00
Chuck Jazdzewski d213a20dfc fix(forms): avoid producing an error with hostBindingTypeCheck
Using the default value accessor no longer produces errors when
used in combination with fullTemplateTypeCheck and hostBindingTypeCheck.

Fixes: #19905
2017-12-15 07:52:52 -08:00
Martin Probst 2e7e935b02 fix(common): fix a Closure compilation issue.
Closure Compiler cannot infer that the swtich statement is exhaustive,
which causes it to complain that the method does not always return a
value.

Work around the problem by throwing an exception in the default case,
and using the `: never` type to ensure the code is unreachable.
2017-12-15 07:51:30 -08:00
Olivier Combe cbe7e39bbe build(common): don't generate .d.ts & .metadata.json files for i18n locales
Fixes #20880
2017-12-14 08:29:36 -08:00
Olivier Combe b7738e1fe5 feat(core): add source to `StaticInjectorError` message (#20817)
Closes #19302
PR Close #20817
2017-12-12 11:56:06 -08:00
Chuck Jazdzewski 634d33f5dd fix(compiler): support referencing enums in namespaces (#20947)
Due to an overly agressive assert the compiler would generate
an internal error when referencing an enum declared in
namspace.

Fixes #18170

PR Close #20947
2017-12-12 11:55:55 -08:00
Martin Probst 8c52088346 fix(compiler-cli): merge @fileoverview comments. (#20870)
Previously, this code would unconditionally add a @fileoverview
comment to generated files, and only if the contained any code at all.

However often existing fileoverview comments should be copied from the
file the generated file was originally based off of. This allows users
to e.g. include Closure Compiler directives in their original
`component.ts` file, which will then automaticallly also apply to code
generated from it.

This special cases `@license` comments, as Closure disregards directives
in comments containing `@license`.

PR Close #20870
2017-12-12 11:37:55 -08:00
George Kalpakas 81d497ce1f build: pin ChromeDriver version (#20940)
Since our version of Chromium is also pinned, a new ChromeDriver (that
drops support for our Chromium version) can cause random (and unrelated
to the corresponding changes) errors on CI.
This commit pins the version of ChromeDriver and it should now be
manually upgraded to a vrsion that is compatible with th currently used
Chromium version.

PR Close #20940
2017-12-11 15:53:04 -08:00
Chuck Jazdzewski 70cd124ede feat(compiler): add a pseudo $any() function to disable type checking (#20876)
`$any()` can now be used in a binding expression to disable type
checking for the rest of the expression. This similar to `as any` in
TypeScript and allows expression that work at runtime but do not
type-check.

PR Close #20876
2017-12-11 14:34:38 -08:00
Alex Eagle f05937db4d fix(bazel): don't equate moduleName with fileName (#20895)
Fixes broken material build.
/cc @jelbourn
PR Close #20895
2017-12-11 11:16:49 -08:00
Matias Niemelä 13e663c232 fix(animations): ensure multi-level route leave animations are queryable (#20787)
Closes #19807

PR Close #20787
2017-12-08 13:44:01 -08:00
Olivier Combe 3ce3b4d2af refactor(common): update i18n locale data to CLDR v32 (#20830)
List of changes between v31.0.1 and v32: http://cldr.unicode.org/index/downloads/cldr-32
PR Close #20830
2017-12-08 10:24:33 -08:00
Chuck Jazdzewski e7d9cb3e4c feat(compiler): narrow types of expressions used in *ngIf (#20702)
Structural directives can now specify a type guard that describes
what types can be inferred for an input expression inside the
directive's template.

NgIf was modified to declare an input guard on ngIf.

After this change, `fullTemplateTypeCheck` will infer that
usage of `ngIf` expression inside it's template is truthy.

For example, if a component has a property `person?: Person`
and a template of `<div *ngIf="person"> {{person.name}} </div>`
the compiler will no longer report that `person` might be null or
undefined.

The template compiler will generate code similar to,

```
  if (NgIf.ngIfTypeGuard(instance.person)) {
    instance.person.name
  }
```

to validate the template's use of the interpolation expression.
Calling the type guard in this fashion allows TypeScript to infer
that `person` is non-null.

Fixes: #19756?

PR Close #20702
2017-12-08 10:24:26 -08:00
Yuan Gao e544742156 refactor(core): Removed readonly getters and changed to readonly (#19842)
variables

PR Close #19842
2017-12-08 10:24:19 -08:00
luffySAMA c9ad529afc docs(common): fix mistakes in number pipe example (#20788)
PR Close #20788
2017-12-08 10:24:10 -08:00
Matias Niemelä 46aa0a1cf6 fix(animations): properly recover and cleanup DOM when CD failures occur (#20719)
Closes #19093

PR Close #20719
2017-12-07 17:16:27 -08:00
Matias Niemelä 661fdcd3e2 refactor(animations): instantiate Set-matching code with values in constructor (#20725)
For some reason, prior to this fix, the boolean set matching
code (within `animation_transition_expr.ts`) failed to remain
the same when compiled with closure. This refactor makes sure
that the code stays in tact.

Reproduction Details:
Passes without `ng build --prod`: https://burger.stackblitz.io/
Fails with `ng build --prod`: http://burger.fxck.cz/

Closes #20374

PR Close #20725
2017-12-07 17:16:21 -08:00
Matias Niemelä 590d93b30d feat(animations): re-introduce support for transition matching functions (#20723)
Closes #18959

PR Close #20723
2017-12-07 17:16:09 -08:00
Matias Niemelä c26e1bba1d fix(animations): ensure the web-animations driver properly handles empty keyframes (#20648)
Closes #15858

PR Close #20648
2017-12-07 17:16:02 -08:00
Matias Niemelä 10771d0bd8 fix(animations): support webkit-based vendor prefixes for prop validations (#19055)
Closes #18921

PR Close #19055
2017-12-07 17:15:53 -08:00
vsavkin d8cc09b76c fix(router): NavigatonError and NavigationCancel should be emitted after resetting the URL (#20803)
PR Close #20803
2017-12-07 13:34:20 -08:00
Fabian Wiles d41d2c460a feat(forms): allow nulls on setAsyncValidators (#20327)
closes #20296

PR Close #20327
2017-12-07 13:34:12 -08:00
Martin Probst 4efc32dabf fix(compiler-cli): disable checkTypes in emit. (#20828)
Closure Compiler by default will report diagnostics from type checks in
any JavaScript code, including code emitted by the Angular compiler.
Disabling `checkTypes` substantially reduces warning spam for users, and
allows them to run with stricter compiler flags (e.g. treating actual
diagnostics from user code as errors).

Closure Compiler will still type check the code and use types (where
found and correct) for optimizations.

PR Close #20828
2017-12-07 13:34:05 -08:00
Alex Eagle ef534c0cc1 build: upgrade bazel rules to latest (#20768)
Add enough BUILD files to make it possible to
`bazel build packages/core/test`

Also re-format BUILD.bazel files with Buildifier.
Add a CI lint check that they stay formatted.

PR Close #20768
2017-12-07 11:27:50 -08:00
Keen Yee Liau 073f485c72 fix(compiler-cli): Fix swallowed Error messages (#20846)
This commit fixes a bug in which non-formatted errors are silently
dropped.

Internal issue: b/67739418

PR Close #20846
2017-12-06 16:49:22 -08:00
Matias Niemelä b78ada198a fix(animations): ensure DOM is cleaned up after multiple @trigger leave animations finish (#20740)
Closes #20541

PR Close #20740
2017-12-06 07:02:42 -08:00
Alex Eagle 6790e02a13 ci: upgrade to node 8 and Bazel 0.8 (#20807)
Closes #19648

PR Close #20807
2017-12-06 06:58:33 -08:00
Fabian Wiles 7cabaa0ae7 fix(service-worker): ensure initialised in browser only (#20782)
closes #20360

PR Close #20782
2017-12-06 06:55:33 -08:00
Mathias Døhl da3563ce19 fix(service-worker): esm2015 points to wrong path (#20800)
The package.json esm2015 points to the wrong path.
"esm15" should be "esm2015"

Service Worker can't be compiled with use of Closure Compiler
PR Close #20800
2017-12-06 06:53:30 -08:00
Olivier Combe be994496cd docs(core): add docs for i18n tokens (#17920)
PR Close #17920
2017-12-05 21:56:43 -08:00
WilliamKoza 35977e3830 fix(forms): Broken link NG_VALIDATORS replace by an example (#15480)
PR Close #15480
2017-12-05 21:53:12 -08:00
Victor Berchet 6911a250ef build: set `preserveWhitespaces` to false by default on Bazel (#20783)
`preserveWhitespaces: false` will be the default in Angular 6+

You can opt-out at component or element level.

Docs: https://angular.io/api/core/Component#preserveWhitespaces

PR Close #20783
2017-12-04 16:16:01 -08:00
Alex Rickabaugh f582620d5b fix(service-worker): use relative path for ngsw.json
Not every application is served from the domain root. The Service
Worker made a bad assumption that it would be, and so requested
/ngsw.json from the domain root.

This change corrects this assumption, and requests ngsw.json without
the leading slash. This causes the request to be interpreted
relative to the SW origin, which will be the application root.
2017-12-01 14:21:07 -08:00
Alex Rickabaugh 3fbcde9048 fix(service-worker): send initialization signal from the application
The Service Worker contains a mechanism by which it will postMessage
itself a signal to initialize its caches. Through this mechanism,
initialization happens asynchronously while keeping the SW process
alive.

Unfortunately in Firefox, the SW does not have the ability to
postMessage itself during the activation event. This prevents the
above mechanism from working, and the SW initializes on the next
fetch event, which is often too late.

Therefore, this change has the application wait for SW changes and
tells each new SW to initialize itself. This happens in addition to
the self-signal that the SW attempts to send (as self-signaling is
more reliable). That way even on browsers such as Firefox,
initialization happens eagerly.
2017-12-01 14:21:07 -08:00
Alex Eagle f841fbe60f fix(compiler-cli): propagate ts.SourceFile moduleName into metadata 2017-12-01 14:19:06 -08:00
Alex Rickabaugh b9a91a5e74 fix(service-worker): don't crash if SW not supported
Currently a bug exists where attempting to inject SwPush crashes the
application if Service Workers are unsupported. This happens because
SwPush doesn't properly detect that navigator.serviceWorker isn't
set.

This change ensures that all passive observation of SwPush and
SwUpdate doesn't cause crashes, and that calling methods to perform
actions on them results in rejected Promises. It's up to applications
to detect when those services are not available, and refrain from
attempting to use them.

To that end, this change also adds an `isSupported` getter to both
services, so users don't have to rely on feature detection directly
with browser APIs. Currently this simply detects whether the SW API
is present, but in the future it will be expanded to detect whether
a particular browser supports specific APIs (such as push
notifications, for example).
2017-12-01 14:18:16 -08:00
Alex Rickabaugh 65f4fad801 fix(service-worker): allow disabling SW while still using services
Currently, the way to not use the SW is to not install its module.
However, this means that you can't inject any of its services.

This change adds a ServiceWorkerModule.disabled() MWP, that still
registers all of the right providers but acts as if the browser does
not support Service Workers.
2017-12-01 14:18:16 -08:00
Filipe Silva 71e5de646b fix(compiler-cli): fix memory leak in program creation (#20692)
Saving `oldProgram` in `AngularCompilerProgram` instances is causing a memory leak for unemitted programs.

It's not actually used so simply not saving it fixes the memory leak.

Fix #20691

PR Close #20692
2017-11-29 16:53:11 -06:00
Keen Yee Liau 3203069d6c fix(language-service): Allow empty templates (#20651)
Fixes the bug where templates with empty strings show up as error in the editor.

PR Close #19406

PR Close #20651
2017-11-29 16:52:55 -06:00
Keen Yee Liau 54bfe14313 fix(language-service): Fix crash when no script files are found (#20550)
Fixes the crash in typescript host when getScriptFileNames() returns an
empty array.

PR Close #19325

PR Close #20550
2017-11-29 16:52:48 -06:00
Miško Hevery ba850b36de Revert "fix(core): should use native addEventListener in ngZone (#20672)"
This reverts commit 65a2cb8307.
2017-11-29 14:56:29 -06:00
JiaLi.Passion 65a2cb8307 fix(core): should use native addEventListener in ngZone (#20672)
PR Close #20672
2017-11-28 22:27:25 -06:00
Alex Rickabaugh aafa75da84 fix(common): don't strip XSSI prefix for if error isn't JSON (#19958)
This changes XhrBackend to not strip the XSSI prefix from error text
if such a prefix is present but the remaining body does not parse as
JSON.

PR Close #19958
2017-11-28 22:27:10 -06:00
Alex Rickabaugh 503be69af6 fix(common): treat an empty body as null when parsing JSON in HttpClient (#19958)
Previously, XhrBackend would call JSON.parse('') if the response body was
empty (a 200 status code with content-length 0). This changes the XhrBackend
to attempt the JSON parse only if the response body is non-empty. Otherwise,
the body is left as null.

Fixes #18680.
Fixes #19413.
Fixes #19502.
Fixes #19555.

PR Close #19958
2017-11-28 22:27:10 -06:00
Alex Rickabaugh eb01ad583f fix(common): remove useless guard in HttpClient (#19958)
An invalid "if" condition is always true, and is thus useless. This
change removes it. No behavior changes.

Fixes #19223.

PR Close #19958
2017-11-28 22:27:10 -06:00
Alex Rickabaugh 15a54df7d3 fix(common): accept falsy values as HTTP bodies (#19958)
Previously, HttpClient used the overly clever test "body || null"
to determine when a body parameter was provided. This breaks when
the valid bodies '0' or 'false' are provided.

This change tests directly against 'undefined' to detect the presence
of the body parameter, and thus correctly allows falsy values through.

Fixes #19825.
Fixes #19195.

PR Close #19958
2017-11-28 22:27:10 -06:00
Matias Niemelä c2b3792a3b fix(animations): ensure multi-level leave animations work (#19455)
PR Close #19455
2017-11-28 18:24:41 -06:00
Matias Niemelä b2a586cee1 fix(animations): ensure multi-level enter animations work (#19455)
PR Close #19455
2017-11-28 18:24:40 -06:00
Chuck Jazdzewski 8bb42df47e fix(compiler): correctly detect when to serialze summary metadata (#20668)
The change to improve error messages broke the summary serialization
of summaries.

PR Close #20668
2017-11-28 16:43:35 -06:00
Miško Hevery add5953aa1 Revert "fix(animations): ensure multi-level enter animations work (#19455)"
This reverts commit dd6237ecd9.
2017-11-28 15:08:44 -06:00
Miško Hevery 6b4c24020d Revert "fix(animations): ensure multi-level leave animations work (#19455)"
This reverts commit 1366762d12.
2017-11-28 15:08:31 -06:00
Olivier Combe 24bf3e2a25 feat(common): add locale id parameter to `registerLocaleData` (#20623)
PR Close #20623
2017-11-27 17:00:06 -06:00
Chuck Jazdzewski 8ecda94899 feat(compiler-cli): improve error messages produced during structural errors (#20459)
The errors produced when error were encountered while interpreting the
content of a directive was often incomprehencible. With this change
these kind of error messages should be easier to understand and diagnose.

PR Close #20459
2017-11-27 16:59:57 -06:00
Matias Niemelä 1366762d12 fix(animations): ensure multi-level leave animations work (#19455)
PR Close #19455
2017-11-27 16:59:47 -06:00
Matias Niemelä dd6237ecd9 fix(animations): ensure multi-level enter animations work (#19455)
PR Close #19455
2017-11-27 16:59:46 -06:00
Alex Eagle 6e83204238 fix(bazel): produce named AMD modules for codegen (#20547)
fixes #19422

Signed-off-by: Alex Eagle <alexeagle@google.com>

PR Close #20547
2017-11-27 13:44:41 -06:00
Olivier Combe de78307928 fix(compiler-cli): normalize sourcepaths for i18n extracted files (#20417)
Fixes #20416
PR Close #20417
2017-11-27 12:16:07 -06:00
Juri Strumpflohner 6293ca23c3 docs(core): fix broken NgZone code example (#19291)
The current code example was broken as there were a couple of syntax errors. This commit fixes the demo.

PR Close #19291
2017-11-27 12:14:47 -06:00
Matias Niemelä ffb6dbeefe fix(animations): always fire start and done callbacks in order for noop animations (#20570)
PR Close #20570
2017-11-22 12:36:28 -06:00
Matias Niemelä 0e012c9669 fix(animations): always fire inner trigger callbacks even if blocked by parent animations (#19753)
Closes #19100

PR Close #19753
2017-11-22 10:38:02 -06:00
Olivier Combe d7a727cc07 feat(platform-browser-dynamic): export `JitCompilerFactory` (#20478)
Fixes #20125
PR Close #20478
2017-11-22 08:56:11 -06:00
Jason Aden 437a0446e2 fix(common): return ISubscription from Location.subscribe() (#20429)
Fix #20406

PR Close #20429
2017-11-22 08:55:10 -06:00
JiaLi.Passion a740e4f00a fix(core): fix #20532, should be able to cancel listener from mixed zone (#20538)
PR Close #20538
2017-11-21 11:49:36 -06:00
Chuck Jazdzewski 4ed04392d3 fix(compiler): support event bindings in `fullTemplateTypeCheck` (#20490)
The type-check block now disables type checking event access instead
of generating a reference to an undefined variable.

PR Close #20490
2017-11-20 18:39:42 -06:00
Kara Erickson 69c53c3e03 fix(forms): updateOn should check if change occurred (#20358)
Fixes #20259.

PR Close #20358
2017-11-17 16:28:46 -06:00
JiaLi.Passion 997336b790 fix(core): should support event.stopImmediatePropagation (#20469)
PR Close #20469
2017-11-16 22:43:53 -06:00
Matias Niemelä 1861e416a1 fix(animations): validate against trigger() names that use @ symbols (#20326)
PR Close #20326
2017-11-16 16:20:09 -06:00
Chuck Jazdzewski 68b53c07fd fix(compiler): emit correct type-check-blocks with TemplateRef's (#20463)
The type-check block generated with `"fullTemplateTypeCheck"` was
invalid if the it contained a template ref as would be generated
using the `else` micro-syntax of `NgIf`.

Fixes: #19485

PR Close #20463
2017-11-16 16:19:54 -06:00
Michael Giambalvo 717ac5ac4d fix(benchpress): Allow ignoring navigationStart events in perflog metric. (#20312)
PR Close #20312
2017-11-16 16:18:38 -06:00
Chuck Jazdzewski dcfffbf828 build: fix build failures (#20470) 2017-11-15 22:33:30 -08:00
Alex Eagle 5ec1717c58 fix: Update test code to type-check under TS 2.5 (#20175)
PR Close #20175
2017-11-15 18:12:16 -06:00
Alex Eagle c2a24b4241 fix(bazel): adjust mock of tsconfig for ng_module rule unit test (#20175)
Due to 7f33f01b72

PR Close #20175
2017-11-15 18:12:16 -06:00
Alex Eagle a9f3e2bd95 build: Upgrade to TypeScript 2.5 (#20175)
- update to TypeScript 2.5
- point the 2.4 typings test at the previous typescript version, so we
  don't break it accidentally
- widen the peerDeps from Angular packages that depend on TypeScript
- update to latest TypeScript 2.5 compatible Bazel rules
- move .bazelrc to tools/bazel.rc per https://docs.bazel.build/versions/master/best-practices.html#bazelrc

PR Close #20175
2017-11-15 18:12:16 -06:00
Miško Hevery f8658cdc38 Revert "fix(animations): always fire inner trigger callbacks even if blocked by parent animations (#19753)"
This reverts commit d47b2a6f70.
2017-11-15 17:04:22 -06:00
Jason Aden 043e408805 style(core): fix comment format for linter 2017-11-15 11:53:11 -08:00
George Kalpakas c004d483ab style(core): fix max line length to pass linting (#20441)
Accidentally introduced in #19920, where other linting errors (unrelated to the
PR) prevented proper linting.

PR Close #20441
2017-11-15 11:44:52 -08:00
Jason Aden 2586846ee2 Revert "fix(core): should support event.stopImmediatePropagation"
This reverts commit 5e0eb5e3d94bd7077c4d6657b89bfc8d900f2bc6.
2017-11-15 11:35:21 -08:00
Matias Niemelä d47b2a6f70 fix(animations): always fire inner trigger callbacks even if blocked by parent animations (#19753)
Closes #19100

PR Close #19753
2017-11-14 15:59:47 -08:00
Martin Hobert 12af6d356e docs(core): change from deprecated renderer to renderer2 (#19920)
We now show the proper class instead of the deprecated Renderer

Fixes #19806


PR Close #19920
2017-11-14 13:44:56 -08:00
Matias Niemelä 20aafff092 fix(animations): ensure final state() styles are applied within @.disabled animations (#20267)
Closes #20266

PR Close #20267
2017-11-14 11:01:11 -08:00
Mark Kennedy a622e19df6 fix(router): 'merge' queryParamHandling strategy should be able to remove query params (#19733)
Closes #18463, #17202

PR Close #19733
2017-11-14 11:01:04 -08:00
Chuck Jazdzewski 24cf8b3269 fix(core): ensure init lifecycle events are called (#20258)
Throwing an exception in a lifecycle event will delay but not
prevent an Init method, such as `ngOnInit`, `ngAfterContentInit`,
or `ngAfterViewInit`, from being called. Also, calling `detectChanges()`
in a way that causes duplicate change detection (such as a
child component causing a parent to call `detectChanges()` on its
own `ChangeDetectorRef`, will no longer prevent change `ngOnInit`,
`ngAfterContentInit` and `ngAfterViewInit` from being called.

With this change lifecycle methods are still not guarenteed to be
called but the Init methods will be called if at least one change
detection pass on its view is completed.

Fixes: #17035

PR Close #20258
2017-11-10 13:47:39 -08:00
Bowen Ni 743651f5e8 refactor(animations): uses a loop instead Array.map() which creates and (#19910)
returns a new array that is discarded.

This pattern will become a compilation error in google3.

PR Close #19910
2017-11-10 13:47:02 -08:00
Chuck Jazdzewski c33a57666b fix(compiler): recognize @NgModule with a redundant @Injectable (#20320)
The compiler now, again, recognizes `@NgModule()` decorators on
classes with a redundant `@Injectable()` decorator.

Fixes: #19544

PR Close #20320
2017-11-10 11:51:52 -08:00
Derek 401ead07b8 docs(common): update default display value for CurrencyPipe (#20246)
PR Close #20246
2017-11-10 11:51:17 -08:00
Fabian Wiles b55c2ba342 refactor(core): remove prolyfill from error message (#20121)
PR Close #20121
2017-11-10 11:51:15 -08:00
Keen Yee Liau eb8013e853 fix(language-service): pass compilerOptions.paths to ReflectorHost (#20222)
This commit fixes the options passed to ReflectorHost to include 'paths'
if it's specified in compiler options, so that dependency modules can
be loaded.

PR Close #20222
2017-11-10 11:51:11 -08:00
Harry Pfleger b4a39f9c30 docs(aio): fix -mm- to -MM- for month in DatePipe (#20315)
PR Close #20315
2017-11-10 10:58:45 -08:00
Chuck Jazdzewski 3257fcdcee fix(compiler): show explanatory text in template errors (#20313)
Fixes: #20076

PR Close #20313
2017-11-09 15:46:30 -08:00
Victor Berchet 9bcd7097d0 test(compiler): do not use `a` as a content selector
As it might trigger false positive in the RegExp from `_makeScopeMatcher`

closes #20256
2017-11-08 15:52:21 -08:00
Victor Berchet c32f5fd393 fix(compiler): fix corner cases in shadow CSS
`cmp:host {}` and `cmp:host some-other-selector {}` were not handled
consistently.

Note those should not match anything but are made equivalent to respectively
`:host(cmp)` and `:host(cmp) some-other-selector` to avoid breaking legacy apps.
2017-11-08 15:20:19 -08:00
Victor Berchet 6e8e3bd248 refactor(core): misc changes and integrate review feedback on #19996
closes #20224
2017-11-06 14:13:02 -08:00
Tobias Bosch a460066972 feat(compiler): introduce `TestBed.overrideTemplateUsingTestingModule`
This allows to overwrite templates for JIT and AOT components alike.

In contrast to `TestBed.overrideTemplate`, the template is compiled
in the context of the testing module, allowing to use other testing
directives.

Closes #19815
2017-11-06 14:12:30 -08:00
Tobias Bosch 05d96dc507 feat(core): allow to pass in aot summaries also to `TestBed.configureTestingModule`
Also adds caching for summaries.

Closes #19817.
2017-11-06 14:12:30 -08:00
Maxime Robert b489259a34 docs(common): fix mis-ordered lines (#20221) 2017-11-06 11:28:39 -08:00
Chuck Jazdzewski bf22f2df88 fix(compiler): report a reasonable error with invalid metadata (#20062)
The compiler would throw an internal exception if an import using
the `ngModule` syntax and the module as not a resolvable symbol.

Fixes: #20049
2017-11-06 10:01:27 -08:00
Igor Minar 3997d97806 revert: feat(elements): implement `@angular/elements` #19469 (#20152)
This PR was merged without API docs and general rollout plan.

We can't release this as is in 5.1 without a plan for documentation, cli integration, etc.
2017-11-03 15:54:54 -07:00
JiaLiPassion 200d92d030 fix(core): should support event.stopImmediatePropagation (#19222) 2017-11-03 15:22:05 -07:00
Victor Berchet f0764016f9
revert: feat(core): add source to `StaticInjectorError` message (#19482) (#20171)
This reverts commit faa621218e.
2017-11-03 14:51:06 -07:00
Olivier Combe faa621218e feat(core): add source to `StaticInjectorError` message (#19482) 2017-11-03 11:14:05 -07:00
Alex Rickabaugh 1d19d61970 fix(platform-browser): support Symbols in custom jasmineToString() method (#19794)
It's illegal to coerce a Symbol to a string, and results in a TypeError:

TypeError: Cannot convert a Symbol value to a string

Previously, the custom jasmineToString() method monkey-patched onto Maps
in platform-browser/testing/src/matchers.ts would coerce keys and values
to strings. A change in a newer version of Jasmine calls this method more
often, resulting in calls against Maps which contain Symbols in some
applications, which causes crashes.

The fix is to explicitly convert keys and values to strings, which does
work on Symbols.
2017-11-03 11:11:47 -07:00
Olivier Combe 26f82995f6 fix(compiler): don't overwrite missingTranslation's value in JIT (#19952) 2017-11-03 11:08:39 -07:00
George Kalpakas dcf8840831 feat(elements): implement `registerAsCustomElements()`
closes #19469
2017-11-02 16:09:30 -07:00
George Kalpakas 60c0b178af feat(elements): implement `NgElements` 2017-11-02 16:09:09 -07:00
George Kalpakas 0899f4f8fc feat(elements): implement `NgElementConstructor` 2017-11-02 16:09:09 -07:00
George Kalpakas aed4a11d01 feat(elements): implement `NgElement` 2017-11-02 16:09:09 -07:00
George Kalpakas 75cf70ae04 feat(elements): implement `NgElementApplicationContext` 2017-11-02 16:09:09 -07:00
George Kalpakas 6b30fbf94e feat(elements): implement `extractProjectableNodes()` 2017-11-02 16:09:09 -07:00
George Kalpakas 24f17f913a feat(elements): implement `utils` 2017-11-02 16:09:09 -07:00
George Kalpakas ebfa204af0 feat(elements): set up the `elements` package 2017-11-02 16:09:09 -07:00
JiaLiPassion a28d616e10 fix(core): __symbol__ should return __zone_symbol__ without zone.js loaded (#19541) 2017-11-02 16:06:06 -07:00
Alex Eagle 5b16ce9302 fix(compiler-cli): don't report emit diagnostics when --noEmitOnError is off (#20063) 2017-11-02 14:49:38 -07:00
Dhyey Thakore d156e72ad7 docs: Add 0 in padding of 'dd' (#20107) 2017-11-02 14:36:22 -07:00
George Kalpakas 901436e46f docs: fix link texts
Fixes #19701

PR Close #19709
2017-11-01 15:44:59 -04:00
Rado Kirov 005a78bd83 refactor: allow compilation with TypeScript 2.5 (#19966)
A small number of types need to be adjusted. The changes seem to be
backwards compatible with TS 2.4.

PR Close #19966
2017-10-31 00:26:43 -04:00
Hans Larsen 13f8648a00 fix: add missing globals from each rollup configuration (#20028)
PR Close #20028
2017-10-30 23:09:17 -04:00
Hans Larsen b6abcb2500 refactor: make all rollup config ES5 compatible (#20028)
So they can be required by other Node scripts.

PR Close #20028
2017-10-30 23:09:17 -04:00
Tobias Bosch 54480f7dfc fix(compiler): report errors properly in G3 in certain conditions (#20041)
Condition: static analysis error, given:
- noResolve:true
- generateCodeForLibraries: false
- CompilerHost.getSourceFile throws on non existent files

All of these are true in G3.
PR Close #20041
2017-10-30 21:24:30 -04:00
Tobias Bosch 420852e2f5 fix(compiler): reexport less symbols in `.ngfactory.ts` files (#19884)
* don't reexport symbols that the user already reexported
* never reexport symbols that are part of arguments of non simple function calls

Fixes #19883

PR Close #19884
2017-10-30 20:11:29 -04:00
Tobias Bosch 04eb80cc2b fix(compiler): always use relative paths to refer to generated code
Previously we generated imports like `@angular/material/index.ngfactory`,
which doesn’t make sense as we don’t ship generated code on npm

Closes #20031
2017-10-30 18:28:25 -04:00
Chuck Jazdzewski 22c66f0e02 fix(compiler-cli): avoid producing source mappings for host views (#19965)
The host view doesn't map back to user code so the template compiler
produces a blank `url` for them.

PR Close #19965
2017-10-27 22:26:57 -07:00
Hans Larsen 00bc80bb37 fix(platform-server): add missing packages to the UMD global rollup config
This adds the proper bindings for calling angular packages from platform-server in the UMD.
This was not a problem for universal apps that dont use UMD.

Fixes 19899
2017-10-27 22:26:25 -07:00
Tobias Bosch 31797d3b50 fix(compiler): make watch mode work on windows (#19953)
Fixes #19951
PR Close #19953
2017-10-26 18:43:00 -04:00
Tobias Bosch 957be960d2 fix(compiler): recover from structural errors in watch mode (#19953)
This also changes the compiler so that we throw less often
on structural changes and produce a meaningful state
in the `ng.Program` in case of errors.

Related to #19951

PR Close #19953
2017-10-26 18:43:00 -04:00
Tobias Bosch 18e9d86a3b fix(compiler): translate emit diagnostics with `noEmitOnError: true`. (#19953)
This prevents errors reported against `.ngfactory.ts` files show up
as the result of running `ngc`.

Closes #19935
PR Close #19953
2017-10-26 18:42:59 -04:00
Tobias Bosch a869aeecd2 fix(compiler): don’t store invalid state when using `listLazyRoutes` (#19953)
Previously, `listLazyRoute` would store invalid information in a compiler
internal cache, which lead to incorrect paths that were used during emit.
This commit fixes this.

PR Close #19953
2017-10-26 18:42:59 -04:00
Alex Rickabaugh eca822b756 fix(service-worker): fix improper call of Observable.merge (#19962)
Observable.merge was called using .call() as if it were an operator
and not an Observable factory. This removes the .call() and uses
the factory properly.

PR Close #19962
2017-10-26 18:09:53 -04:00
Alex Rickabaugh 17142a778a fix(service-worker): don't block initialization on registration (#19936)
Importing ServiceWorkerModule.register() will schedule registration of
the Service Worker inside an APP_INITIALIZER. Previously, the Promise
returned by navigator.serviceWorker.register() was returned from the
initializer function. This has the unwanted side effect of blocking
initialization until the SW is registered. Even worse, if the SW script
fails to load, this can cause the app initialization to fail.

The solution is to not return the registration promise from the
initializer function, essentially decoupling registration from the rest
of the initialization flow.

This change is not unit testable as there are no mocks/adapters yet for
navigator.serviceWorker. A future integration test should cover this case
with better fidelity.

PR Close #19936
2017-10-26 16:05:07 -04:00
Alex Rickabaugh 5adb7c9669 fix(service-worker): listen for messages on the right event source (#19954)
Currently, the SwUpdate service doesn't receive messages from the SW.
This is because it attempts to subscribe to the 'message' event on
ServiceWorkerRegistration, when really messages are emitted by the
ServiceWorkerContainer.

This change moves to listening on ServiceWorkerContainer and changes
the mocks to reflect the way the browser actually works.

PR Close #19954
2017-10-26 16:04:59 -04:00
Tobias Bosch d56724659f fix(compiler): automatically set `emitDecoratorMetadata` when `"annotationsAs": "static fields”` (#19927)
This is a workaround for https://github.com/angular/tsickle/issues/635.

Fixes #19916
PR Close #19927
2017-10-25 13:38:39 -04:00
Chuck Jazdzewski 56b18ff063 fix(compiler-cli): produce correct paths for windows output (#19915)
The path mapping was broken for Windows by fc0b1d5b61.
Fixed the path mapping and put code in place to make such a problem
to sneek by again.

PR Close #19915
2017-10-24 17:54:58 -04:00
Chuck Jazdzewski 7bfeac746e fix(compiler-cli): only use error collector when needed. (#19912)
The error collector changes behavior of the metadata resolver
in ways that haven't been fully hardened. This changes limits
its use to the lazy route detection and the language service.

Issue: #19906

PR Close #19912
2017-10-24 17:06:41 -04:00
Tobias Bosch c92efc15fb fix(compiler): don’t type check templates with `skipTemplateCodegen` (#19909)
This change is needed to prevent users’ builds from breaking.

If a user sets `fullTemlateTypeCheck` to true, we will
continue to check the templates even when `skipTemplateCodegen` is true
as well.

Related to #19906

PR Close #19909
2017-10-24 17:06:34 -04:00
Chuck Jazdzewski a0ae120093 fix(compiler-cli): report all diagnostic error messages (#19886)
This fixes a problem introduced in 8d45fefc31
which modified how diagnostic error messages are reported for structural
metadata errors causing some of the diagnostics to be lost.

PR Close #19886
2017-10-23 22:41:10 -04:00
vsavkin d3211a2468 feat(router): add "onSameUrlNavigation" router configuration option (#19463)
PR Close #19463
2017-10-23 20:56:53 -04:00
vsavkin adab4f3e49 fix(router): do not call `location.go` when skipping a navigation (#19463)
Closes #18036

PR Close #19463
2017-10-23 20:56:52 -04:00
vsavkin 82fed62af2 fix(router): navigating to the current location works (#19463)
Closes #13340

PR Close #19463
2017-10-23 20:56:52 -04:00
Alex Rickabaugh 6bed189e37 build(service-worker): set skipTemplateCodegen for build (#19875)
PR Close #19875
2017-10-23 19:31:42 -04:00
Alex Rickabaugh 4abacb58f1 fix(aio): add service worker entrypoint to aio build (#19875)
Fixes #19838

PR Close #19875
2017-10-23 19:31:42 -04:00
Tobias Bosch fc0b1d5b61 fix(compiler): correctly calculate the outDir if it repeats a parts of the `rootDir`. (#19836)
Fixes #19718

PR Close #19836
2017-10-23 18:46:04 -04:00
Tobias Bosch 8d45fefc31 refactor(compiler): remove old ngtools api and add listLazyRoutes to new api (#19836)
Usages of `NgTools_InternalApi_NG_2` from `@angular/compiler-cli` will now
throw an error.

Adds `listLazyRoutes` to `@angular/compiler-cli/ngtools2.ts` for getting
the lazy routes of a `ng.Program`.
PR Close #19836
2017-10-23 18:46:04 -04:00