Commit Graph

128 Commits

Author SHA1 Message Date
George Kalpakas 6cd3743b44 refactor(service-worker): use `Adapter#parseUrl()` for all URL parsing (#27080)
This commit also ensures that the correct implementation is used on
environments that do not support `URL` (e.g. Node.js).

PR Close #27080
2019-03-21 12:07:56 -04:00
George Kalpakas a24f4b51b3 test(service-worker): test support for multiple apps on different subpaths of a domain (#27080)
PR Close #27080
2019-03-21 12:07:56 -04:00
George Kalpakas 84baa0bb08 test(service-worker): make it easy to use a different SW scope in tests (#27080)
PR Close #27080
2019-03-21 12:07:56 -04:00
Sheik Althaf e721c08c7f feat(service-worker): support multiple apps on different subpaths of a domain (#27080)
Previously, it was not possible to have multiple apps (using
`@angular/service-worker`) on different subpaths of the same domain,
because each SW would overwrite the caches of the others (even though
their scope was different).

This commit fixes it by ensuring that the cache names created by the SW
are different for each scope.

Fixes #21388

PR Close #27080
2019-03-21 12:07:56 -04:00
George Kalpakas 37a154e4e6 test(service-worker): do not create testing artifacts on environments that do not support SW (#27080)
The tests will not be run anyway, so the artifacts are never used and
there might be errors if creating the testing artifacts relies on APIs
that are not available in that environment (e.g. `URL`).

PR Close #27080
2019-03-21 12:07:56 -04:00
George Kalpakas 415de9a291 test(service-worker): ensure `SwTestHarness#parseUrl()` behaves the same on browser and Node.js (#27080)
PR Close #27080
2019-03-21 12:07:56 -04:00
George Kalpakas b3dda0ebc1 refactor(service-worker): make second parameter to `Adapter#parseUrl()` optional (#27080)
PR Close #27080
2019-03-21 12:07:56 -04:00
Matias Niemelä fc8048ddaf build: update to nodejs rules 0.27 (#29210)
PR Close #29210
2019-03-14 19:35:00 -07:00
Matias Niemelä b2aadffbbc revert: build: update to nodejs rules 0.27 (#29210)
This reverts commit 08231f0bfa.
2019-03-14 17:38:35 -07:00
Greg Magolan 08231f0bfa build: update to nodejs rules 0.27 (#29210)
PR Close #29210
2019-03-14 11:38:12 -04:00
Alan 9a1959269f build: remove now redundant `bundle_dts = True` attribute (#29128)
This is now turned on by default in the ng_module macro

PR Close #29128
2019-03-07 10:47:20 -08:00
Cyrille Tuzi 3bee0f684d feat(service-worker): add JSON schema for service worker config (#27859)
Fixes #19847

PR Close #27859
2019-03-05 16:48:26 -08:00
George Kalpakas 586234bb01 fix(service-worker): detect new version even if files are identical to an old one (#26006)
Previously, if an app version contained the same files as an older
version (e.g. making a change, then rolling it back), the SW would not
detect it as the latest version (and update clients).

This commit fixes it by adding a `timestamp` field in `ngsw.json`, which
makes each build unique (with sufficiently high probability).

Fixes #24338

PR Close #26006
2019-03-05 09:41:44 -08:00
George Kalpakas 48214e2a05 fix(service-worker): ignore passive mixed content requests (#25994)
Although [passive mixed content][1] requests (like images) only produce
a warning without a ServiceWorker, fetching it via a ServiceWorker
results in an error. See
https://github.com/angular/angular/issues/23012#issuecomment-376430187
for more details.

This commit makes the ServiceWorker ignore such requests and let them be
handled by the browser directly to avoid breaking apps that would work
without the ServiceWorker.

[1]: https://developers.google.com/web/fundamentals/security/prevent-mixed-content/what-is-mixed-content#passive_mixed_content

Fixes #23012

PR Close #25994
2019-03-04 11:51:05 -08:00
Greg Magolan ea09430039 build: rules_nodejs 0.26.0 & use @npm instead of @ngdeps now that downstream angular build uses angular bundles (#28871)
PR Close #28871
2019-02-28 12:06:36 -08:00
Wassim Chegham ce68b4d839 style: enforce buildifier lint on CI (#28186)
PR Close #28186
2019-02-26 16:57:41 -08:00
Alan Agius fd4e1d69ee build: enable bundle_dts for a number of packages (#28726)
This change enables dts bundling for the following packages and their secondary entry points:

- @angular/animations
- @angular/elements
- @angular/http
- @angular/platform-browser
- @angular/platform-browser-dynamic
- @angular/platform-server
- @angular/platform-webworker
- @angular/platform-webworker-dynamic
- @angular/servce-worker

Dts bundling happens in `ng_module` bazel definition, hence packages such as `@angular/compiler`, `@angular/compiler-cli` and `@angular/langauge service` cannot be flattened as they use `ts_library`.

`@angular/core`, `@angular/common`, `@angular/upgrade` and `@angular/forms` will be done seperatly as it requires some changes either to their source or specs.

PR Close #28726
2019-02-19 16:30:38 -08:00
Greg Magolan 25aae64274 build(bazel): do not build rxjs from source under Bazel (#28720)
PR Close #28720
2019-02-19 16:28:14 -08:00
Paul Gschwendtner 7cbc36fdac build: remove unused rollup.config.js files (#28646)
Since we build and publish the individual packages
using Bazel and `build.sh` has been removed, we can
safely remove the `rollup.config.js` files which are no
longer needed because the `ng_package` bazel rule
automatically handles the rollup settings and globals.

PR Close #28646
2019-02-14 19:28:08 +00:00
Alex Eagle 38343a2388 build: set a default module_name for ts_library rules (#28051)
PR Close #28051
2019-01-18 10:16:39 -08:00
Serginho d49d1e7d73 fix(service-worker): navigation urls backwards compatibility (#27244)
PR Close #27244
2019-01-15 09:50:31 -08:00
Alan Agius b61dafaeac refactor: remove redundant error in catch (#25478)
PR Close #25478
2019-01-04 15:42:19 -08:00
Alex Eagle d32939d51a build: restrict visibility of npm_package targets (#27611)
dependencies on these cause very long rebuilds which have to re-package angular.
Such tests belong in the integration/ folder

PR Close #27611
2018-12-14 10:20:40 -08:00
Alex Eagle 50687e11cf build: fix type-check errors introduced during rules_ts 0.21 (#27586)
PR Close #27586
2018-12-10 16:33:41 -08:00
Igor Minar 95f8b63265 test(service-worker): run the remaining service-worker tests under bazel (#27386)
PR Close #27386
2018-12-05 20:55:31 -08:00
Andrew Kushnir eb99753e4a test(ivy): enable @angular/service-worker targets to run on CI (#27310)
PR Close #27310
2018-11-29 21:32:19 -08:00
joostme aca8ea9c0b refactor(service-worker): Format comments and add additional test (#25860)
- Format JSDoc for notificationClicks
- Add comment on why handleClick does not use hasOwnProperty
- Add additional test that uses handleClick without action

PR Close #25860
2018-11-01 15:13:33 -07:00
Joost Zöllner 4a01ada291 fix(service-worker): Fix public api guard typing (#25860)
PR Close #25860
2018-11-01 15:13:33 -07:00
Joost Zöllner 10618752e6 fix(service-worker): Add typing to public api guard and fix lint errors (#25860)
PR Close #25860
2018-11-01 15:13:33 -07:00
Joost Zöllner c60418b1f4 refactor(service-worker): Rework notification click handler (#25860)
- Add missing image and timestamp properties
- Remove focus from click handler

PR Close #25860
2018-11-01 15:13:33 -07:00
Joost Zöllner c78c221028 feat(service-worker): Add typing for messagesClicked in SwPush service (#25860)
- Properly type messagesClicked Observable stream
- Add new NotificationObject interface

PR Close #25860
2018-11-01 15:13:32 -07:00
Joost Zöllner 1aca54da06 refactor(service-worker): Code optimizations (#25860)
- Add missing new line in tests
- Add proper noop method in MockNotificationEvent

PR Close #25860
2018-11-01 15:13:32 -07:00
Joost Zöllner f5d5a3df59 feat(service-worker): close notifications and focus window on click (#25860)
- Serialize notification object before using postMessage
- Close notification on click
- Focus browser if it is not already focused on click

PR Close #25860
2018-11-01 15:13:32 -07:00
Joost Zöllner f017b26e5d refactor(service-worker): update tests based of review feedback (#25860)
- Rename invalid click event name
- Make test expects more explicit
- Remove NotificationClickEvent in favor of NotificationEvent

PR Close #25860
2018-11-01 15:13:32 -07:00
Joost Zoellner cf6ea283bb feat(service-worker): handle 'notificationclick' events (#25860)
The previous version did not support the 'notificationclick' event.
Add event handler for the event and provide an observable of
clicked notifications in the SwPush service.

Closes #20956, #22311

PR Close #25860
2018-11-01 15:13:32 -07:00
Igor Minar 40bbfbf961 test(ivy): fix or disable failing ivy tests (#26735)
These tests were previously not running on CI so they have always been broken,
or got broken just recently :-(.

test(ivy): mark failing test targets with fixme-ivy-jit and fixme-ivy-local tags

PR Close #26735
2018-10-26 14:48:05 -04:00
Igor Minar ee0b857172 build: rename the ivy compile mode 'local' to 'aot' (#26686)
PR Close #26686
2018-10-23 14:14:49 -07:00
Igor Minar 4237c34c78 test(ivy): mark failing test targets with fixme-ivy-jit and fixme-ivy-local tags (#26471)
We are close enough to blacklist a few test targets, rather than whitelist targets to run...

Because bazel rules can be composed of other rules that don't inherit tags automatically,
I had to explicitly mark all of our ts_library and ng_module targes with "ivy-local" and
"ivy-jit" tags so that we can create a query that excludes all fixme- tagged targets even
if those targets are composed of other targets that don't inherit this tag.

This is the updated overview of ivy related bazel tags:

- ivy-only: target that builds or runs only under ivy
- fixme-ivy-jit: target that doesn't yet build or run under ivy with --compile=jit
- fixme-ivy-local: target that doesn't yet build or run under ivy with --compile=local
- no-ivy-jit: target that is not intended to build or run under ivy with --compile=jit
- no-ivy-local: target that is not intended to build or run under ivy with --compile=local

PR Close #26471
2018-10-23 08:57:42 -07:00
Igor Minar 361eaf1888 build: remove obsolete files (#26471)
PR Close #26471
2018-10-23 08:57:41 -07:00
Greg Magolan 1f3331f5e6 build(bazel): use fine-grained npm deps (#26111) (#26488)
PR Close #26488
2018-10-19 20:59:29 -07:00
Pete Bacon Darwin 24521f549c docs: convert all `@experimental` tags to `@publicApi` tags (#26595)
PR Close #26595
2018-10-19 14:35:52 -07:00
George Kalpakas 2326b9c294 fix(service-worker): clean up caches from old SW versions (#26319)
Since the SW immediately takes over all clients, it is safe to delete
caches used by older (e.g. beta) `@angular/service-worker` versions to
avoid running into browser storage quota limitations.

PR Close #26319
2018-10-16 14:12:07 -07:00
Judy Bogart f543d71cc3 docs: add package doc files (#26047)
PR Close #26047
2018-10-05 15:42:14 -07:00
George Kalpakas bfeed842ee docs(service-worker): improve API docs for `SwPush`/`SwUpdate` (#23138)
PR Close #23138
2018-10-05 13:48:14 -07:00
George Kalpakas 77942cc690 refactor(service-worker): simplify/improve `NgswCommChannel` typings (#23138)
PR Close #23138
2018-10-05 13:48:14 -07:00
George Kalpakas 7aed64d3a1 docs(service-worker): add `UpdateActivated`/`AvailableEvent` to the public API (#23138)
PR Close #23138
2018-10-05 13:48:14 -07:00
George Kalpakas 2bd767c4a6 fix(service-worker): do not blow up when caches are unwritable (#26042)
In some cases, example when the user clears the caches in DevTools but
the SW remains active on another tab and keeps references to the deleted
caches, trying to write to the cache throws errors (e.g.
`Entry was not found`).

When this happens, the SW can no longer work correctly and should enter
a degraded mode allowing requests to be served from the network.

Possibly related:
- https://github.com/GoogleChrome/workbox/issues/792
- https://bugs.chromium.org/p/chromium/issues/detail?id=639034

This commits remedies this situation, by ensuring the SW can enter the
degraded `EXISTING_CLIENTS_ONLY` mode and forward requests to the
network.

PR Close #26042
2018-09-24 09:53:39 -07:00
Alex Eagle cbbad1b791 refactor(ivy): pre-factor: set explicit type parameters for ModuleWithProviders (#25970)
Ivy depends on having the generic type token later when reading the ModuleWithProviders from a .d.ts file.

PR Close #25970
2018-09-18 13:28:44 -07:00
Greg Magolan b99d7ed5bf build(bazel): update to rules_typescript 0.17.0 & rules_nodejs 0.13.4 (#25920)
PR Close #25920
2018-09-18 13:05:38 -07:00
Alan Agius 5653fada32 feat: add TypeScript 3 support (#25275)
PR Close #25275
2018-08-27 21:07:53 -04:00