Commit graph

21803 commits

Author SHA1 Message Date
Joe Martin (Crowdstaffing)
c136a050c9 docs: update capitalization (#43451)
Update capitalization per review.

PR Close #43451
2021-09-14 15:51:30 -07:00
Andrew Scott
3ec9ee65b9 refactor(router): Remove TODO and slightly adjust eager browserUrlTree update (#43426)
No test was added for this case because I can't think of a test case to
write that would work.

This change updates the code for a consistent mental model of setting
the `browserUrlTree`. It's only meant to track the `UrlTree` that the
`UrlHandlingStrategy` is set to extract, not the full `rawUrl`. Notice
that everywhere else, the `browserUrlTree` is set to
`urlAfterRedirects`, which is computed based on the extracted URL, _not_
the `rawUrl`.

PR Close #43426
2021-09-14 11:11:43 -07:00
Andrew Scott
5163999fb9 test(router): Add tests to document expected behavior (#43449)
PR #43102 broke some use-cases. These tests document expected behavior
and would have prevented #43446 and #43447. Recent changes have already
addressed these issues, but it would still be a good idea to cover these
use-cases in tests as well.

PR Close #43449
2021-09-14 11:11:08 -07:00
Renovate Bot
71e432305b build: lock file maintenance (#43285)
PR Close #43285
2021-09-14 11:08:59 -07:00
Andrew Scott
796da641f0 fix(router): Do not modify parts of URL excluded from with 'eager' updates (#43421)
The previous code would set the browser URL to be only the part that's
extracted by the `UrlHandlingStrategy`. However, there may be parts of
the URL which are _should not_ be handled by the Angular Router. This
change updates the code to set the browser URL in the same way that's
done with `'deferred'`: Merging the extracted URL after redirects with
the whole raw URL of the navigation, which includes parts not handled by
the `UrlHandlingStrategy`.

PR Close #43421
2021-09-14 08:35:15 -07:00
David Shevitz
e8e41efcea docs: add guidelines for localizing angular documentation (#43314)
PR Close #43314
2021-09-14 08:32:51 -07:00
George Kalpakas
bdefeb1f11 perf(docs-infra): reduce unnecessary whitespace in API docs (#43435)
The HTML for the docs pages is generated by Dgeni based on some
[Nunjucks][1] templates.

Previously, these templates were set up in a way that introduced a lot
excess whitespace in the generated HTML, unnecessarily bloating the
corresponding JSON files that need to be downloaded in order to view a
certain docs page. This has been discussed in #28105 and was again
observed while investigating #43285.

This commit refactors some of the templates related to API docs (which
seem to be the most affected ones) to drastically reduce the amount of
excess whitespace. More specifically, the total size of all files in
`generated/docs/api/` was reduced from ~13MB to ~7MB.

Besides the reduced payload size for each API page, this change will
also reduce the amount of memory needed by the ServiceWorker to cache
the API pages that have been visited by a user.

NOTE:
The affected files are not eagerly downloaded when navigating to
angular.io. Instead, each file is downloaded individually, as soon as a
user visits the corresponding API docs page. Therefore, the impact of
this change will be relatively small for most users.

[1]: https://mozilla.github.io/nunjucks/

PR Close #43435
2021-09-14 08:29:50 -07:00
George Kalpakas
39800c1768 build(docs-infra): update remark-html to 13.0.2 (#43435)
NOTE:
This [version][1] includes a breaking fix ([commit b0b1ba5c5][2]), which
turns sanitization on by default. Since, we don't need sanitization (the
HTML is authored by docs authors and tooling and should be safe), this
commit restores the old behavior by setting the [sanitize][3] option to
`false`.

[1]: https://github.com/remarkjs/remark-html/releases/tag/13.0.2
[2]: b0b1ba5c55
[3]: https://github.com/remarkjs/remark-html#optionssanitize

PR Close #43435
2021-09-14 08:29:50 -07:00
George Kalpakas
549b372458 build(docs-infra): update github-slugger to 1.4.0 (#43435)
NOTE:
This [version][1] includes a breaking fix ([commit af59f343d][2]). More
specifically `github-slugger` will no longer trim the text of a heading
before generating an ID and (with whitespace converted to `-`) this
results in different heading IDs:
**Before:** `<h3>  foo bar  </h3>` --> `<h3 id="foo-bar">...`
**After:** `<h3>  foo bar  </h3>` --> `<h3 id="--foo-bar--">...`

The different IDs now break some of our anchor-links, becuase
`github-slugger` is used by [rehype-slug][3], which is in turn used by
our [autolinkHeadings][4] dgeni post-processor.

To avoid the issue with broken anchor links, we update the
`renderMethodDetail()` nunjucks macro to omit excess whitespace in
headings.

[1]: https://github.com/Flet/github-slugger/releases/tag/v1.4.0
[2]: af59f343dc
[3]: https://github.com/rehypejs/rehype-slug
[4]: 75a3c778b1/aio/tools/transforms/angular-base-package/post-processors/autolink-headings.js (L3)

PR Close #43435
2021-09-14 08:29:49 -07:00
Andrew Scott
0e8548f667 fix(router): Allow renavigating to failed URLs (#43424)
There are situations where the Router does not currently clean up failed navigations
correctly. While this is problematic on its own, we can mitigate some of
the damage by processing any URL when we get a navigation request when
the internal router state is out of sync.

Each of the added tests would fail without this change.

fixes #34795

PR Close #43424
2021-09-13 14:48:00 -07:00
Pei Wang
5ccc9e8a1d build: Exclude tsconfig-tsec.json files from sync with g3 (#43108)
Those files are for tsec_test only and therefore irrelevant to google3.

PR Close #43108
2021-09-13 14:45:57 -07:00
Pei Wang
006bf654b9 build: Upgrade tsec to 0.1.9 (#43108)
Upgrade tsec version form 0.1.8 to 0.1.9. The new version has a minor
bug fix.

PR Close #43108
2021-09-13 14:45:57 -07:00
Pei Wang
188a46971f build: Use aspects to gather srcs and deps for tsec_test. (#43108)
This is to replace the implicitly created ts_library_forwared rules and
keep changes related to tsec/bazel integration solely in tools/tsec.bzl.

PR Close #43108
2021-09-13 14:45:57 -07:00
Pei Wang
d12d068c37 build: Turn tsec checks into bazel tests. (#43108)
Introduce two new bazel rules: tsec_test and tsec_config, for
describing the tsec checks and the tsconfig file needed for such
checks, respectively. Currently, tsec_test only checks the srcs
of a ts_library or ng_module. It does not check direct or transitive
dependencies. Also, tsconfig files need to be manually maintained
to make sure tsec can read all necessary input (including global
symbols).

PR Close #43108
2021-09-13 14:45:57 -07:00
Pei Wang
509031c734 build: Enable tsec checks for critical packages. (#43108)
tsec is a static analyzer that discovers Trusted Types violations.
Deploy tsec to make sure there will be no TT regression in several
critical packages, including core, platform-browser, platform-server
and their dependencies. Existing violations have been reviewed and
exempted in packages/tsec-exemption.json. Future changes to the
exemption list requires security review.

PR Close #43108
2021-09-13 14:45:57 -07:00
Andrew Scott
79eee5509f docs(router): Add documentation for the router reset rawUrlTree (#43420)
Add documentation to the router and an additional test based on more
complete understanding of how things work.

PR Close #43420
2021-09-13 14:41:23 -07:00
Naveed Ahmed
59353c6305 fix(service-worker): clear service worker cache in safety worker (#43324)
clear angular service worker cache in safety worker to ensure stale
or broken contents are not served in future requests

Fixes #43163

PR Close #43324
2021-09-13 14:34:32 -07:00
mezhik91
de682ebb1f docs: add Dmytro Mezhenskyi to GDE resources (#43282)
PR Close #43282
2021-09-13 12:57:00 -07:00
dario-piotrowicz
6d8a711f5c docs: remove unnecessary "https://angular.io/" from aio links (#43425)
PR Close #43425
2021-09-13 09:24:07 -07:00
Renovate Bot
75a3c778b1 build: update dependency karma to v6 (#43413)
PR Close #43413
2021-09-10 10:56:47 -07:00
mgechev
578aba1939 docs: add ngUpgrade maintenance timeline (#43379)
Add details about the maintenance timeline for ngUpgrade, reflecting
the deprecation of AngularJS.

PR Close #43379
2021-09-10 09:23:11 -07:00
dario-piotrowicz
df177d9176 docs: amend code related to string-expressions for property binding (#43366)
resolves #43287

PR Close #43366
2021-09-10 09:22:14 -07:00
Aristeidis Bampakos
7c2434da7f docs: add Architect Training to resources (#43327)
PR Close #43327
2021-09-09 14:53:59 -07:00
Andrew Scott
cbac0c3514 docs: Add documentation and TODOs for cleanup (#43391)
* Document `currentUrlTree`, `browserUrlTree`, and `rawUrlTree`
* Add a couple `TODO` comments to investigate changes based on understanding

PR Close #43391
2021-09-09 14:53:27 -07:00
Andrew Kushnir
012209f55f Revert "refactor(router): clean up unnecessary flag in restoreHistory function" (#43409)
This reverts commit 061a456e39.

PR Close #43409
2021-09-09 14:23:30 -07:00
Aristeidis Bampakos
b31adaf6cc docs: add Angular Projects book in resources (#43130)
PR Close #43130
2021-09-09 11:33:37 -07:00
David Shevitz
a0fe89919f docs: update the reviewed tag for what-is-angular topic (#43213)
PR Close #43213
2021-09-09 11:30:31 -07:00
Amadou Sall
4761842440 docs: remove extraneous word in the Dependency injection in action guide (#43255)
PR Close #43255
2021-09-09 11:27:30 -07:00
Michele Stieven
2d93e9c0fd docs: add Michele Stieven to GDE resources (#43233)
PR Close #43233
2021-09-09 11:21:03 -07:00
Bjarki
99f63dc13b fix(docs-infra): bump aio size limit (#42800)
Increase the aio size tracking limit as a result of Trusted Types
refactoring.

PR Close #42800
2021-09-09 11:17:00 -07:00
Bjarki
672dfd0ad5 build(docs-infra): enable tsec security checker (#42800)
tsec is a TypeScript compiler wrapper for restricting use of
security-sensitive DOM APIs, in particular those that could lead to XSS
or Trusted Types violations. Add it as a linter to aio to prevent future
Trusted Types regressions on angular.io.

Also introduces security_exemptions.json, which lists the known,
security-reviewed tsec security violations. New entries can only be
added to this file after a security review, in particular making sure
that the corresponding code does not cause XSS vulnerabilities or
Trusted Types violations.

PR Close #42800
2021-09-09 11:17:00 -07:00
Bjarki
025cf9302b build(docs-infra): send CSP reports for Trusted Types violations (#42800)
Configure Firebase to serve a CSP header on angular.io that enables
Trusted Types in report-only mode. This causes any Trusted Types
violations that may occur as users browser angular.io to generate a CSP
report that is sent to csp.withgoogle.com, where it is processed by
Google's CSP report collector.

This is a non-breaking change that allows us to evaluate whether
angular.io is fully compatible with Trusted Types, at which point we can
start enforcing Trusted Types.

PR Close #42800
2021-09-09 11:17:00 -07:00
Bjarki
b668f6d2ff build(docs-infra): enable Trusted Types enforcement in angular.json (#42800)
Configure angular.json to serve a CSP header that enabled Trusted Types
in enforcement mode, both in e2e tests and when running the local
development server. This should help prevent regressions related to
Trusted Types in the angular.io app.

PR Close #42800
2021-09-09 11:17:00 -07:00
Bjarki
2670e964ec fix(docs-infra): pass a TrustedScriptURL to ServiceWorkerModule (#42800)
Fix a Trusted Types violation in ServiceWorkerModule that occurs when
initializing the service worker from a string URL, by passing a
TrustedScriptURL instead.

PR Close #42800
2021-09-09 11:17:00 -07:00
Bjarki
a4676aa2c1 fix(docs-infra): make doc-viewer compatible with Trusted Types (#42800)
Change DocumentContents.contents to a TrustedHTML and update users
accordingly.

PR Close #42800
2021-09-09 11:17:00 -07:00
Bjarki
2b267209a1 fix(docs-infra): make custom icon registry compatible with Trusted Types (#42800)
Change SvgIconInfo.svgSource to be a TrustedHTML and update all its
users accordingly. Also introduce the svg template tag function for
building TrustedHTML from constant SVG sources.

PR Close #42800
2021-09-09 11:16:59 -07:00
Bjarki
e3f5b41706 fix(docs-infra): make pretty-printer compatible with Trusted Types (#42800)
Change the PrettyPrinter interface to accept a TrustedHTML and patch
prettify.js so that it makes use of that value without modification.
Update all users of the service to produce, and pass in a TrustedHTML.

PR Close #42800
2021-09-09 11:16:59 -07:00
Bjarki
d29f4ab09a fix(docs-infra): fix simple Trusted Types violations (#42800)
Also introduce a dependency on the Trusted Types type definitions and a
Trusted Types polyfill, safevalues. Create a security module for common,
security-reviewed transformations into Trusted Types.

PR Close #42800
2021-09-09 11:16:59 -07:00
Bjarki
b601419cd1 fix(docs-infra): fix Trusted Types violation in Analytics snippet (#42800)
The Google Analytics snippet loads its runtime by dynamically creating a
script element and assigning a URL to its src attribute. This causes a
Trusted Types violation.

To fix this, create an inline Trusted Types policy called 'aio#analytics'
to bless the script URL, which is a trusted constant.

PR Close #42800
2021-09-09 11:16:59 -07:00
Andrew Scott
f57f0edd23 refactor(router): clean up unnecessary flag in restoreHistory function (#43382)
This restores the `finalize` function to directly call
`resetUrlToCurrentUrlTree`, as it was before efb440eb2f.
This allows us to simplify the `restoreHistory` function because it no
longer needs to handle the call from `finalize` where it should not
reset the internal router state.

PR Close #43382
2021-09-09 09:22:05 -07:00
Alan Agius
6c84c5f513 fix(animations): emit pure annotations to static property initializers (#43344)
Currently the pure annotations comments are not emitted because unless the entire expression is wrapped in braces.

See the below TypeScript playgrounds

https://www.typescriptlang.org/play?target=99&module=1&ts=4.4.2&ssl=8&ssc=1&pln=1&pc=1#code/MYGwhgzhAEByCuIQEkB2ArApsALgewCdoBvAXwFgAoKzADwAdCdowAjCHAsXaUSGNFlyESVaNA5gcAS2BwAqgBlF0ALzQA9ACpoAAQD6+gAryASgFFD0LRuipMAdziIUGbPgIAKAJQBuKhTUlMB4qBB4IJgAdCB4AOaegu6EUbBKin5UQA
```js
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.Injector = void 0;
class NullInjector {
}
class Injector {
}
exports.Injector = Injector;
Injector.NULL = new NullInjector();
console.log(Injector.NULL);

```

https://www.typescriptlang.org/play?target=99&module=1&ts=4.4.2&ssl=4&ssc=18&pln=4&pc=33#code/MYGwhgzhAEByCuIQEkB2ArApsALgewCdoBvAXwFgAoKzADwAdCdowAjCHAsXaUSGNFlyESVaNA5gcAS2BwAqgBlF0ALzQAFAHoAVNAACAfUMAFeQCUAoseg6t0VJgDucRCgzZ8BDQEofAbioKakpgPFQIPBBMADoQPABzDUFPQhjYJUUAqiA

```js
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.Injector = void 0;
class NullInjector {
}
class Injector {
}
exports.Injector = Injector;
Injector.NULL = ( /* @__PURE__ */new NullInjector());
console.log(Injector.NULL);
```

PR Close #43344
2021-09-09 09:21:24 -07:00
Alan Agius
c80278ac4a fix(core): emit pure annotations to static property initializers (#43344)
Currently the pure annotations comments are not emitted because unless the entire expression is wrapped in braces.

See the below TypeScript playgrounds

https://www.typescriptlang.org/play?target=99&module=1&ts=4.4.2&ssl=8&ssc=1&pln=1&pc=1#code/MYGwhgzhAEByCuIQEkB2ArApsALgewCdoBvAXwFgAoKzADwAdCdowAjCHAsXaUSGNFlyESVaNA5gcAS2BwAqgBlF0ALzQA9ACpoAAQD6+gAryASgFFD0LRuipMAdziIUGbPgIAKAJQBuKhTUlMB4qBB4IJgAdCB4AOaegu6EUbBKin5UQA
```js
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.Injector = void 0;
class NullInjector {
}
class Injector {
}
exports.Injector = Injector;
Injector.NULL = new NullInjector();
console.log(Injector.NULL);

```

https://www.typescriptlang.org/play?target=99&module=1&ts=4.4.2&ssl=4&ssc=18&pln=4&pc=33#code/MYGwhgzhAEByCuIQEkB2ArApsALgewCdoBvAXwFgAoKzADwAdCdowAjCHAsXaUSGNFlyESVaNA5gcAS2BwAqgBlF0ALzQAFAHoAVNAACAfUMAFeQCUAoseg6t0VJgDucRCgzZ8BDQEofAbioKakpgPFQIPBBMADoQPABzDUFPQhjYJUUAqiA

```js
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.Injector = void 0;
class NullInjector {
}
class Injector {
}a
exports.Injector = Injector;
Injector.NULL = ( /* @__PURE__ */new NullInjector());
console.log(Injector.NULL);
```

PR Close #43344
2021-09-09 09:21:24 -07:00
Renovate Bot
4c307ad8d7 build: update dependency source-map-support to v0.5.20 (#43401)
PR Close #43401
2021-09-09 09:20:30 -07:00
Renovate Bot
66f13dade5 build: update all non-major dependencies (#43274)
PR Close #43274
2021-09-09 09:18:43 -07:00
George Kalpakas
e064509613 docs(bazel): fix outdated redirect URL for /guide/bazel (#43376)
The file we are redirecting `/guide/bazel` to was moved from
`bazel/src/schematics/README.md` to `bazel/docs/BAZEL_SCHEMATICS.md` in
commit 71b8c9ab29.

Update the Firebase configuration to use the new path in the redirect
URL.

PR Close #43376
2021-09-09 09:17:40 -07:00
Charles Lyding
5fea50c070 docs: remove references to differential loading (#43060)
Support for IE11 has been dropped in v13. IE11 was the last browser officially support by Angular that required ES5 code. As a result of its removal, differential loading is no longer required and the Angular CLI has removed all differential loading functional for v13. This commit removes all references to differential loading from the documentation.

PR Close #43060
2021-09-09 09:15:21 -07:00
Andrew Kushnir
f94e48e427 docs: drop IE 11 from browser compatibility docs (#43034)
Support for IE 11 was deprecated in v12 and in v13 the support is fully dropped. This commit updates the browser compatibility docs and removes IE 11 as a supported browser.

PR Close #43034
2021-09-09 09:14:47 -07:00
Andrew Scott
9e039ca68b fix(router): Only trigger router navigation on popstate events from Location subscription (#43328)
With the merging of #41730, our tests now more closely emulate real
browser behavior. This means that we can make changes to the `Router` which depend
on actual browser behavior rather than incorrectly mocked test behavior.

This change updates the logic in the `Router` to only trigger
navigations on `popstate` events. Since our `SpyLocation` now triggers
the `popstate` event correctly on `simulateHashChange`, `back`,
`forward`, and `simulatePopState`, we are able to rely on this being
true for all of these navigations in tests when using `SpyLocation` (the
default for `RouterTestingModule`).

In addition, this behavior relies on documented browser behavior: The
`popstate` event happens due to browser transitions as a result of user
triggered "back" button or otherwise.
https://developer.mozilla.org/en-US/docs/Web/API/Window/popstate_event#when_popstate_is_sent

In addition, this change chooses `popstate` over `hashchange` because it
is the event that is already being used for navigations since the
documented behavior of browsers is that `popstate` happens before
`hashchange`.

fixes #41782

PR Close #43328
2021-09-08 16:53:49 +00:00
Andrew Scott
93c9932d17
release: cut the v13.0.0-next.5 release (#43394) 2021-09-08 09:45:42 -07:00
Andrew Scott
9c7a0194d4
docs: release notes for the v12.2.5 release (#43393) 2021-09-08 09:42:34 -07:00