Commit Graph

21519 Commits

Author SHA1 Message Date
Paul Gschwendtner 9db69a9c9e build: use api-golden tool from dev-infra for testing public API (#42688)
Switches our TS API guardian targets to rather use the new tool from
dev-infra that relies on Microsoft's API extractor.

PR Close #42688
2021-06-30 11:43:48 -07:00
Paul Gschwendtner 56bd21de6f feat(dev-infra): introduce shared tool for validating API signature (#42688)
For the last years the Angular repositories relied on `ts-api-guardian`
for testing the public API signature. This project worked well in
general but its another inconvenience to maintain if we could rely on
Microsoft's `api-extractor` tool.

Especially since with TypeScript 4.3 issues with export aliases appeared
that would require us to extend TS API guardian to support such exports.
This is not as straightforward as it sounds, given it requires rewriting
of declarations to show-case the proper name in the API golden. Microsoft's
API extractor has integrated support for this.

As of TypeScript 4.3, we want to start using the new `override` keyword.
We are not able to use that keyword currently because an old version of
API extractor is used in the `ng_module` rule to flatten the types into
a single file. To fix this, we need to update `api-extractor`, but this
unveils the issue with TS API guardian because the most recent version
of api-extractor uses alias exports to avoid potential conflicts
with globals available through the TypeScript default libraries (e.g.
`dom.d.ts`).

PR Close #42688
2021-06-30 11:43:48 -07:00
mgechev 0e20b05f7d docs: add last updated date to roadmap (#42615)
PR Close #42615
2021-06-30 11:41:57 -07:00
Kristiyan Kostadinov 9f5cc7c808 feat(compiler): support number separators in templates (#42672)
As of ES2021, JavaScript allows using underscores as separators inside numbers, in order to make them more readable (e.g. `1_000_000` vs `1000000`). TypeScript has had support for separators for a while so these changes expand the template parser to handle them as well.

PR Close #42672
2021-06-30 10:36:15 -07:00
Pete Bacon Darwin 234b5edcc7 fix(platform-browser): in `Meta.addTag()` do not add duplicate meta tags (#42703)
Previously, if there were two tags with the same "name" or "property" attribute selector,
then only the first was checked for duplicates when deciding whether to add a new meta
tag.

Fixes #42700
Fixes #19606

PR Close #42703
2021-06-30 10:35:30 -07:00
pavlenko f3965ff834 docs: setting context value inside an interceptor (#42699)
Usage of `get`/`set` methods should be done on a context object instead of a `HttpRequest` instance.

PR Close #42699
2021-06-30 09:13:46 -07:00
Alan Agius 8528073f6c fix(dev-infra): remove bots from special thanks section (#42697)
With this change we remove known used bots from special thanks section in the changelog.

PR Close #42697
2021-06-29 11:13:50 -07:00
Paul Gschwendtner f29fe5ced0 fix(dev-infra): use API pagination for retrieving project branches (#42666)
We rely on a Github API `/branches` request to determine the active
release trains. Currently this logic is broken if more than 100
protected branches exist within a repository. This issue surfaced
recently where the `items_per_page` setting was set to `30`, causing
the merge tooling and release tooling to not detect the proper "latest"
release train.

This commit uses Github pagination for retrieving branches to determine
the active release trains, and makes the logic more long-term proof.

PR Close #42666
2021-06-29 10:33:54 -07:00
Paul Gschwendtner 279e63f65f refactor(dev-infra): update octokit to latest version v18 (#42666)
We previously held off with updating Octokit to v18 due to
their more noticable issues with typings. This commit updates
us to the latest version in order to take advantage of the new
pagination API (which is also strongly-typed), and to not fall
behind too much over time (Octokit seems to change quite often..)

We work around the problem with the types for `getContent` by just
using a type cast with a TODO (and link to the issue). Similarly we
work around a problem where the Octokit types have an incorrect type
for the name of the labels array in an API response.

PR Close #42666
2021-06-29 10:33:54 -07:00
George Kalpakas 02742552f3 refactor(docs-infra): make angular.io and docs examples compatible with RxJS v7 (#42660)
This commit applies the necessary changes to make angular.io and (most)
docs examples compatible with both RxJS v6 and v7. It also adds new
steps to relevant CI jobs to test angular.io and docs examples against
RxJS v7 as well (to catch potential regressions).

NOTE:
Some of the docs examples are not compatible with RxJS v7 and are
therefore excluded from the tests. The SystemJS-based ngUpgrade
examples in particular are excluded, since they require a different
SystemJS configs to run against RxJS v6 and v7 and the extra complexity
of managing that is not worth it for the 4 affected examples.

PR Close #42660
2021-06-29 10:29:58 -07:00
George Kalpakas 188a73852e test(docs-infra): allow excluding certain docs examples from tests (#42660)
This commit adds support for excluding certain docs examples from the
command used to run tests. This is useful to run extra tests on CI that
might not be compatible with all examples (for example, run tests with
different versions of a dependency).

In a subsequent commit, this will be used to run tests against RxJS v7
as a quick way to catch potential regressions.

PR Close #42660
2021-06-29 10:29:58 -07:00
George Looshch 2c490d5c6c docs: remove duplicate link to `guide/inputs-outputs.md` (#42654)
When you click on `Understanding Angular > Components > Sharing data between
child and parent directives and components` in navigation sidebar, another
item gets selected: `Understanding Angular > Templates > Inputs and Outputs`
Both of them are linked to the same guide but the view cannot handle
situations when several entries point to the same guide.

This commit fixes that by removing the second entry.

Fixes #42652

PR Close #42654
2021-06-29 09:27:47 -07:00
Paul Gschwendtner 41823ff277 feat(dev-infra): add command for printing release train information (#42644)
Currently the active release trains are printed when a developer
runs `ng-dev publish release`. This is not ideal because it requires
the developer to provide an OAuth token, to be on the next branch, and
to have no uncommitted changes, while the actual release train
information is not dependent on these checks.

This commit introduces a new command called `ng-dev release info` that
can be used to retrieve relase information without the aforementioned
requirements. Note that this command provides more detailed information
about release branches than the `ng-dev caretaker check` command (which
also requires on authentication as a side note). The `release info`
command also prints active LTS branches for example.

PR Close #42644
2021-06-28 11:50:57 -07:00
Alan Agius b54e8aee37 docs: update fonts optimization options description (#42642)
In version 12.1, we included font inlining for Adobe fonts, see: https://github.com/angular/angular-cli/pull/21189

PR Close #42642
2021-06-28 11:28:01 -07:00
Lars Gyrup Brink Nielsen c93df7dc6d docs: correct literal string example (#42623)
Change literal string example `pi` to `'pi'`.

PR Close #42623
2021-06-28 10:05:09 -07:00
codebriefcase 1142b51462 fix(docs-infra): styling fix on error pages (#42627)
Add Center Aligment for heading texts and additional styles on 404 (not found) related pages

PR Close #42627
2021-06-28 09:50:24 -07:00
Dario Piotrowicz 4bea630baa docs(core): add context jsdoc param to createEmbeddedView (#42675)
PR Close #42675
2021-06-28 09:34:17 -07:00
George Kalpakas 2a260dc249 docs: update Roadmap section header from "Done" to "Completed" (#42620)
"Completed" just sounds better (to me).

PR Close #42620
2021-06-28 09:33:18 -07:00
George Kalpakas 70def3d3ed fix(docs-infra): fix styling of `<summary>` elements on dark theme (#42620)
Previously, the color of `<summary>` elements was hard-coded to `black`.
This did not work well on the dark theme, where the background color of
the page is also very dark.

This commit fixes it by removing the explicit color style, thus letting
`<summary>` elements inherit the color of their container.

Closes #42616

PR Close #42620
2021-06-28 09:33:18 -07:00
George Kalpakas e5b4b83778 fix(docs-infra): improve styling of completed Roadmap projects (#42620)
This commit improves the styling of the "Completed projects" section of
the Roadmap by (a) making it consistent with the rest of the Roadmap
sections and (b) making it more similar with `<details>` elements on
other pages.

**Before:**
  _Collapsed:_ ![completed projects collapsed (before)][1]
  _Expanded:_ ![completed projects expanded (before)][2]
**After:**
  _Collapsed:_ ![completed projects collapsed (after)][3]
  _Expanded:_ ![completed projects expanded (after)][4]

[1]: https://user-images.githubusercontent.com/8604205/122917101-50c2ca00-d366-11eb-8348-01efd69cedf2.png
[2]: https://user-images.githubusercontent.com/8604205/122917109-515b6080-d366-11eb-9f18-c794fcea8dd1.png
[3]: https://user-images.githubusercontent.com/8604205/122917115-528c8d80-d366-11eb-947a-2d7da3950069.png
[4]: https://user-images.githubusercontent.com/8604205/122917117-53252400-d366-11eb-93e7-9384a7431c0d.png

PR Close #42620
2021-06-28 09:33:17 -07:00
George Kalpakas fd78678284 refactor(docs-infra): make `<details>` styles more re-usable (#42620)
This commit makes the styling for `<details>` elements (including
expand/collapse actions in their `<summary>`) more re-usable.

PR Close #42620
2021-06-28 09:33:17 -07:00
George Kalpakas 09ec62a357 refactor(docs-infra): merge duplicate `code.scss` files (#42620)
PR #41129 reorganized the SCSS files of the angular.io app moving most
of them in sub-directories. Due to incorrectly resolved merge conflicts
for PRs targeting the SCSS files around that time, we ended up with
duplicate style files for `<code>` elements:
- `styles/2-modules/_code.scss`
- `styles/2-modules/code/_code.scss` +
  `styles/2-modules/code/_code-theme.scss`

This commit gets rid of the extra file (`styles/2-modules/_code.scss`)
and ports any changes from it to the correct files inside the `code/`
sub-directory.

PR Close #42620
2021-06-28 09:33:17 -07:00
dario-piotrowicz 56fb4eb08d docs(compiler): interally typo fixed (#42676)
PR Close #42676
2021-06-28 09:32:23 -07:00
Zach Arend 37a740c659 fix(compiler-cli): add support for partially evaluating types (#41661)
Add support to the partial evaluator for evaluating literal types and
tuples.

resolves #41338

PR Close #41661
2021-06-25 09:59:27 -07:00
marvinbeckert 45d24d28a6 docs: remove default linting tool in workspace guide (#42655)
PR Close #42655
2021-06-25 09:55:53 -07:00
Alex Rickabaugh 261b060fa1 fix(dev-infra): fetch 100 branches from Github instead of 30 (#42658)
This commit fixes an issue with the ng-dev tool, where Github's API returns
paginated branch data. Only 30 branches are returned by default, and Angular
now has more than 30 branches in its repo. This commit increases the number
of branches returned to the API limit of 100, which should buy us some time
until we can implement proper pagination.

PR Close #42658
2021-06-24 17:26:24 -07:00
Jessica Janiuk 6e84ede412 release: cut the v12.2.0-next.0 release 2021-06-24 14:30:33 -07:00
Jessica Janiuk d71d521f9b release: cut the v12.1.0 release 2021-06-24 14:02:10 -07:00
George Kalpakas 2203217c40 build(docs-infra): disambiguate doc paths for global APIs (#42648)
In #41788, the `disambiguateDocsPathsProcessor` was introduced to fix
an issue with case-insensitively equal paths. This processor may alter
the output paths of some docs. Due to its nature, the
`disambiguateDocPathsProcessor` must be the last processor in the
pipeline that updates a doc's output path. However, the
`updateGlobalApiPathProcess` (which also alters the output paths of some
docs) was not configured to run before `disambiguateDocPathsProcessor`.
As a result, the changes made by `disambiguateDocPathsProcessor` were
overridden by `updateGlobalApiPathProcess`, resulting in the app's
failing to load such global API docs pages. An example of such an API
page is: https://angular.io/api/core/global/ngApplyChanges

This commit fixes it by ensuring that the `updateGlobalApiPathProcess`
is explicitly run before the `disambiguateDocPathsProcessor`, so that
the former does not override the changes made by the latter.

PR Close #42648
2021-06-24 12:28:21 -07:00
Dale Harris 637ac00fd5 docs: Fix reference to SwUpdate.isEnabled boolean (#42634)
SwUpdate has an `isEnabled` boolean rather than an `isEnabled()` method. Removed parentheses for accuracy.
PR Close #42634
2021-06-24 12:27:38 -07:00
George Kalpakas c88e18a051 ci: exclude `service-worker/` sub-directories from `fw-testing` PullApprove group (#42631)
The `fw-testing` PullApprove group, which by default owns all `testing/`
sub-directories, is supposed to own resources related to testing Angular
applications (from an end-user's perspective). The `service-worker`
package source code includes some `testing/` sub-directories which are
intended for internal use only (i.e. to test the `service-worker`
package itself) and are not distributed to end-users of the package.

Previously, changes in these `testing/` sub-directories would
incorrectly require approval from the `fw-testing` group.

This commit fixes this by excluding the `service-worker` package
sub-directories from the files owned by the `fw-testing` group.

PR Close #42631
2021-06-24 12:26:51 -07:00
Renovate Bot 4e46aef17b build: update dependency madge to v5 (#42629)
PR Close #42629
2021-06-24 10:10:32 -07:00
George Kalpakas cc30dc0713 fix(service-worker): ensure obsolete caches are always cleaned up (#42622)
Previously, the SW was only able to clean up caches for app-versions
found in the `Driver`'s `versions` map. If (for some reason) the
`Driver` failed to load a valid stored state (including app-versions)
and ended up with an [empty `versions` map][1], any obsolete versions
would remain in the cache storage. This case was rare but possible.

This commit makes the cache clean-up logic more robust by ensuring that
all app-version caches are removed unless they are currently used by the
SW to serve active clients (with the exception of the latest
app-version, which is always retained).

Fixes #41728

[1]: 9de65dbdce/packages/service-worker/worker/src/driver.ts (L515-L529)

PR Close #42622
2021-06-24 09:55:32 -07:00
George Kalpakas 01128f5b5d fix(service-worker): ensure caches are cleaned up when failing to load state (#42622)
Previously, obsolete caches were only cleaned up when successfully
loading the stored state. When the state failed to be loaded, cleaning
up the caches would be skipped until the next SW initialization.

This commit changes this, ensuring that the caches are cleaned up
regardless if the stored state was loaded successfully or not.

PR Close #42622
2021-06-24 09:55:32 -07:00
George Kalpakas 356dd2107b refactor(service-worker): simplify accessing `CacheStorage` throughout the ServiceWorker (#42622)
This commit simplifies/systemizes accessing the `CacheStorage` through a
wrapper, with the following benefits:
- Ensuring a consistent cache name prefix is used for all caches
  (without having to repeat the prefix in different places).
- Allowing referring to caches using their name without the common
  cache name prefix.
- Exposing the cache name on cache instances, which for example makes it
  easier to delete caches without having to keep track of the name used
  to create them.

PR Close #42622
2021-06-24 09:55:32 -07:00
George Kalpakas 73b0275dc2 fix(service-worker): improve ServiceWorker cache names (#42622)
This commit improves the cache names generated by the ServiceWorker by
making them shorter and non-repetitive. In particular, the following
changes are made:

- Data-group cache names no longer include the `dynamic` infix, since it
  does not add any value.
  Before: `ngsw:<...>:data:dynamic:<...>`
  After:  `ngsw:<...>:data:<...>`

- `CacheDatabase` table names no longer include the `ngsw:<path>` prefix
  twice.
  Before: `ngsw:<path>:db:ngsw:<path>:<...>`
  After:  `ngsw:<path>:db:<...>`

NOTE 1:
This change will result in different cache names being generated for the
same app-versions with the new SericeWorker script. This means that some
of the previously cached data will need to be re-downloaded (because the
ServiceWorker will not be able to re-use the old caches), but that
should be transparent for the end user.
While possible, adding logic to allow the ServiceWorker to retrieve data
from the old caches is not worth the extra complecity and maintenance
cost.

NOTE 2:
Generating different cache names for some of the caches means that the
ServiceWorker will not be able to clean-up some of the old caches. This
will be taken care of in a subsequent commit that will rework the
clean-up logic to be more robust (covering changes such as this one and
other edgecases).

PR Close #42622
2021-06-24 09:55:32 -07:00
George Kalpakas 7507ed2e54 fix(service-worker): use correct names when listing `CacheDatabase` tables (#42622)
`CacheDatabase` uses the un-prefixed table names to interact with
database tables. However, the `list()` method returns the raw, prefixed
table names (which are not useful, since they cannot be used to
open/delete a table).

This commit fixes this by removing the prefix from the cache names
returned by the `list()` method.

NOTE:
This method is currently not used anywhere, so this change does not
affect the ServiceWorker behavior.

PR Close #42622
2021-06-24 09:55:32 -07:00
George Kalpakas 53fe557da7 feat(service-worker): include ServiceWorker version in debug info (#42622)
This commit includes the ServiceWorker version in the debug info shown
at `/ngsw/state` to make it easier to know what version of the
ServiceWorker script is controlling the page.

PR Close #42622
2021-06-24 09:55:32 -07:00
George Kalpakas 4962ef5330 refactor(service-worker): minor refactorings to improve readability/maintainability (#42622)
This commit makes some minor refactorings to improve the code
readability and maintainability, including:
- Avoiding code duplication.
- Using more descriptive variable names.
- Using `async/await` instead of `Promise#then()`.
- Accessing variables directly instead of via `this` when possible.

PR Close #42622
2021-06-24 09:55:32 -07:00
Pete Bacon Darwin 874de59d35 fix(compiler-cli): change default ngcc hash algorithm to be FIPS compliant (#42582)
The previous default algorithm was `md5`, which is not compliant with FIPS.
The default is now set to `sha256`, which is compliant.

Fixes #42577

PR Close #42582
2021-06-24 08:42:38 -07:00
Pete Bacon Darwin b8ef83b10f refactor(compiler-cli): ngcc entry-point manifest hash is now configurable (#42582)
The hash algorithm for the entry-point manifest was hardcoded to `md5`.
This can now be configured by the `hashAlgorithm` property on the
ngcc.config.js project configuration.

PR Close #42582
2021-06-24 08:42:38 -07:00
Pete Bacon Darwin a3b6d65580 refactor(compiler-cli): make ngcc configuration hash algorithm configurable! (#42582)
The ngcc configuration gets hashed to be used when caching
but it was hardcoded to use the `md5` algorithm, which is
not FIPS compliant.

Now the hash algorithm can be configured in the ngcc.config.js
file at the project level.

PR Close #42582
2021-06-24 08:42:38 -07:00
Paul Gschwendtner 8da6f66f7b ci: replace RBE instance name for components-repo-unit-tests job (#42636)
Temporarily replaces the RBE instance name for the
`components-repo-unit-tests` job until
https://github.com/angular/components/pull/23056 is available.

PR Close #42636
2021-06-24 08:28:57 -07:00
Joey Perrott 2340cbcab8 build: update to new remote instance name for RBE (#42636)
Update to use remote instance name, primary_instance, for RBE

PR Close #42636
2021-06-24 08:28:57 -07:00
Renovate Bot 356723158a build: lock file maintenance (#42568)
PR Close #42568
2021-06-23 17:36:41 +00:00
codingnuclei d546501ab5 feat(service-worker): add `openWindow`, `focusLastFocusedOrOpen` and `navigateLastFocusedOrOpen` (#42520)
Add `openWindow`, `focusLastFocusedOrOpen` and `navigateLastFocusedOrOpen` abilty to the notificationclick handler such that when either a notification or notification action is clicked the service-worker can act accordinly without the need for the app to be open

PR Close #26907

PR Close #42520
2021-06-23 16:31:09 +00:00
Pete Bacon Darwin 9de65dbdce fix(compiler): should not break a text token on a non-valid start tag (#42605)
Previously the lexer would break out of consuming a text token if it contains
a `<` character. Then if the next characters did not indicate an HTML syntax
item, such as a tag or comment, then it would start a new text token. These
consecutive text tokens are then merged into each other in a post tokenization
step.

In the commit before this, interpolation no longer leaks across text tokens.
The approach given above to handling `<` characters that appear in text is
no longer adequate. This change ensures that the lexer only breaks out of
a text token if the next characters indicate a valid HTML tag, comment,
CDATA etc.

PR Close #42605
2021-06-22 16:37:00 +00:00
Pete Bacon Darwin c873440ad2 fix(compiler): do not allow unterminated interpolation to leak into later tokens (#42605)
When consuming a text token, the lexer tracks whether it is reading characters
from inside an interpolation so that it can identify invalid ICU expressions.
Inside an interpolation there will be no ICU expression so it is safe to
have unmatched `{` characters, but outside an interpolation this is an error.

Previously, if an interpolation was started, by an opening marker (e.g. `{{`)
in a text token but the text came to an end before the closing marker (e.g. `}}`)
then the lexer was not clearing its internal state that tracked that it was
inside an interpolation. When the next text token was being consumed,
the lexer, incorrectly thought it was already within an interpolation.
This resulted in invalid ICU expression errors not being reported.

For example, in the following snippet, the first text block has a prematurely
ended interpolation, and the second text block contains an invalid `{` character.

```
<div>{{</div>
<div>{</div>
```

Previously, the lexer would not have identified this as an error. Now there
will be an EOF error that looks like:

```
TS-995002: Unexpected character "EOF"
(Do you have an unescaped "{" in your template? Use "{{ '{' }}") to escape it.)
```

PR Close #42605
2021-06-22 16:37:00 +00:00
Umair Hafeez 8a67770687 docs(core): improve applicationref.bootstrap docs (#42407)
add proper examples and update usage notes
add references to the method at relevant places in the docs

PR Close #42407
2021-06-22 16:30:37 +00:00
George Kalpakas 9498da1038 fix(service-worker): correctly determine client ID on navigation requests (#42607)
The ServiceWorker assigns an app-version to a each client to ensure that
all subsequent requests for a client are served using the same
app-version. The assignment is done based on the client ID.

Previously, the ServiceWorker would only try to read the client's ID off
of the `FetchEvent`'s `clientId` property. However, for navigation
requests the new client's ID will be set on [resultingClientId][1],
while `clientId` will either be empty or hold the ID of the client where
the request initiated from. See also related discussions in
w3c/ServiceWorker#870 and w3c/ServiceWorker#1266.

In theory, this could lead to the navigation request (i.e. `index.html`)
being served from a different app-version than the subsequent
sub-resource requests (i.e. assets). In practice, the likelihood of this
happening is probably very low though, since it would require the latest
app-version to be updated between the initial navigation request and the
first sub-resource request, which should happen very shortly after the
navigation request.

This commit ensures that the correct client ID is determined even for
navigation requests by also taking the `resultingClientId` property into
account.

[1]: https://developer.mozilla.org/en-US/docs/Web/API/FetchEvent/resultingClientId

PR Close #42607
2021-06-22 16:28:24 +00:00