Commit Graph

117 Commits

Author SHA1 Message Date
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
Alan Agius 01ec5fd6b0 fix(service-worker): `Cache-Control: no-cache` on assets breaks service worker (#25408)
At the moment `cacheAge` can we undefined when having `Cache-Control` set to `no-cache` due the mapping method in `needToRevalidate`

Closes #25442

PR Close #25408
2018-08-14 16:40:15 -07:00
Alex Eagle 86203736e9 fix(service-worker): don't include sourceMappingURL in ngsw-worker (#24877)
Fixes #23596

PR Close #24877
2018-07-20 11:49:46 -07:00
George Kalpakas 52d43a99ef fix(service-worker): avoid network requests when looking up hashed resources in cache (#24127)
PR Close #24127
2018-07-06 13:50:37 -07:00
George Kalpakas 45feb10c46 refactor(service-worker): avoid unnecessary operations and remove unused code (#24127)
PR Close #24127
2018-07-06 13:50:37 -07:00
George Kalpakas 250527ca68 feat(service-worker): add support for `?` in SW config globbing (#24105)
The globbing is used in the following sections:
- `assetGroups` > `resources` > `files`/`versionedFiles`
- `assetGroups` > `resources` > `urls`
- `dataGroups` > `urls`
- `navigationUrls`

Query params are ignored for `files`/`versionedFiles` and
`navigationUrls`, but they are still taken into account for
`assetGroups`/`dataGroups` `urls`. To avoid a breaking change, `?` is
matched literally for these patterns.

PR Close #24105
2018-07-06 13:50:17 -07:00
George Kalpakas e01b539ee5 refactor: infer type for `it()` assertion functions (#19904)
PR Close #19904
2018-07-06 13:48:02 -07:00
George Kalpakas 00c110b055 build: upgrade jasmine (and related typings) to latest version (#19904)
With these changes, the types are a little stricter now and also not
compatible with Protractor's jasmine-like syntax. So, we have to also
use `@types/jasminewd2` for e2e tests (but not for non-e2e tests).

I also had to "augment" `@types/jasminewd2`, because the latest
typings from [DefinitelyTyped][1] do not reflect the fact that the
`jasminewd2` version (v2.1.0) currently used by Protractor supports
passing a `done` callback to a spec.

[1]: 566e039485/types/jasminewd2/index.d.ts (L9-L15)

Fixes #23952
Closes #24733

PR Close #19904
2018-07-06 13:48:02 -07:00
Rado Kirov c95437f15d build(bazel): Turning on strictPropertyInitialization for Angular. (#24572)
All errors for existing fields have been detected and suppressed with a
`!` assertion.

Issue/24571 is tracking proper clean up of those instances.

One-line change required in ivy/compilation.ts, because it appears that
the new syntax causes tsickle emitted node to no longer track their
original sourceFiles.

PR Close #24572
2018-06-25 07:57:13 -07:00
Alex Eagle c2b5ebfa24 build: update buildifier to latest (#24296)
this matches the version in ngcontainer:0.3.1

PR Close #24296
2018-06-12 11:42:35 -07:00
George Kalpakas 3ed2d75336 fix(service-worker): fix `SwPush.unsubscribe()` (#24162)
Fixes #24095

PR Close #24162
2018-06-11 14:04:30 -04:00
George Kalpakas 4d55dfd9d9 test(service-worker): allow `SwPush` tests to run on Node.js (#24162)
PR Close #24162
2018-06-11 14:04:30 -04:00