Commit graph

29561 commits

Author SHA1 Message Date
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
renovate[bot]
abf271e5e7 build(devtools): update dependency webpack to v5.52.0 (rangle/angular-devtools#897)
Co-authored-by: Renovate Bot <bot@renovateapp.com>
2021-09-09 10:01:25 -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
renovate[bot]
b764e15de0 build(devtools): update angular-framework to c6329d9 (rangle/angular-devtools#918)
Co-authored-by: Renovate Bot <bot@renovateapp.com>
2021-09-08 10:50:13 -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
Andrew Scott
ed24c4a78b docs: fix misspelled word in routerLink migration (#43380)
PR Close #43380
2021-09-08 16:23:23 +00:00
Alan Agius
2efc18e675 fix(migrations): migration failed finding tsconfig file (#43343)
With this change we change the logic to locate the tsconfig files. The public API to locate, read and parse the workspace configuration should be use instead of the custom implemented logic.

The custom implemented logic depended on methods which have long been deprecated and are not removed in version 13 of the Angular CLI. This was not caught during development/UT because this repo is using outdated Angular Tooling packages.

This change also updates a number of spec files which previously creating an invalid Angular workspace configuration file.

Closes #43334

PR Close #43343
2021-09-07 23:16:56 +00:00
dario-piotrowicz
9c7d18e892 refactor(common): removed TODO no longer considered necessary (#43378)
The TODO comment suggesting to verify that the target element to
scroll to needs to be an anchor does not longer seems under consideration
so it can be removed

resolves #43348

PR Close #43378
2021-09-07 23:05:32 +00:00
Charles Barnes
d647491679 docs: remove Angular 9 from support table (#43350)
PR Close #43350
2021-09-07 21:29:32 +00:00
dario-piotrowicz
9d789b8d9f docs: fix app-hero-detaill typo (#43349)
PR Close #43349
2021-09-07 21:25:03 +00:00
Alan Agius
2e11be8c91 build: remove unused @types/node-fetch package (#43345)
This package is no longer needed.

PR Close #43345
2021-09-07 21:24:41 +00:00
George Kalpakas
0cd404ca69 build: update feature request template to include core package (#43323)
Update the dropdown list to include core in the list of packages.
PR Close #43323
2021-09-07 21:24:15 +00:00
dario-piotrowicz
359f26e539 refactor(core): fix "behavio" typo in schematics README (#43351)
fix the "behavio" typo in the
schemarics/migrations/router-link-empty-expression README file

PR Close #43351
2021-09-07 18:46:01 +00:00
William Sedlacek
3b6595d450 docs(common): correct typos in jsdoc of http client (#43352)
This corrects four typos in the HttpClient JSDoc
capabilites => capabilities
reuested => requested
wuth => with
responmse => response
PR Close #43352
2021-09-07 18:45:16 +00:00
Ikko Ashimine
da0403e632 refactor: fix typo in postinstall-patches.js (#43362)
refering -> referring
PR Close #43362
2021-09-07 18:44:47 +00:00
Renovate Bot
2be0505334 build: update dependency @types/inquirer to v8 (#43371)
PR Close #43371
2021-09-07 18:44:20 +00:00
Paul Gschwendtner
652a6d36d4 ci: avoid failures when yarn unlinks bazelisk in windows jobs (#43373)
Windows disallows removal of files which are currently being used.
i.e. have active handles. This currently can result in permission denied
failures on the Windows CI jobs where `yarn bazel` resolves to the local
bazelisk installation that can be unlinked by `yarn_install` repository
fetching as part of the Bazel invocation, resulting in errors like:

```
ERROR: An error occurred during the fetch of repository 'npm':
   yarn_install failed: $ node tools/yarn/check-yarn.js
...
[4/5] Linking dependencies...
info If you think this is a bug, please open a bug report with the information provided in "C:\\users\\circleci\\ng\\yarn-error.log".
info Visit https://yarnpkg.com/en/docs/cli/install for documentation about this command.
 (warning " > tsickle@0.34.3" has incorrect peer dependency "typescript@~3.3.1".
error An unexpected error occurred: "EPERM: operation not permitted, unlink 'C:\\users\\circleci\\ng\\node_modules\\@bazel\\bazel-win32_x64\\bazel-0.27.0-windows-x86_64.exe'".
Process stalled
Active handles:
  - Socket
  - Socket
  - Socket
)
```

We workarund this in order to improve CI stability in case the node modules are
being invalidated by Bazel, or through Yarns integrity checking.

PR Close #43373
2021-09-07 18:44:00 +00:00
renovate[bot]
7e270d0d73 build(devtools): update cypress orb to v1.29.0 (rangle/angular-devtools#901)
Co-authored-by: Renovate Bot <bot@renovateapp.com>
2021-09-07 09:36:35 -07:00
renovate[bot]
c6eb437fae build(devtools): update angular-framework to 52c8b39 (rangle/angular-devtools#914)
Co-authored-by: Renovate Bot <bot@renovateapp.com>
2021-09-03 13:53:29 -07:00
Paul Gschwendtner
5472c28fa1 build: check .ng-dev tool configuration in CI (#43322)
Checks the `.ng-dev` tool configuration in CI, compared
to doing it locally when the caretaker intends to perform
a merge and then realizes the config is broken.

PR Close #43322
2021-09-02 21:18:36 +00:00
Paul Gschwendtner
9b2732c0ed build: update bazel setup to latest versions (#43322)
Updates the overall Bazel setup to their latest versions:

* rules_nodejs is updated to stable 4.0.0
* rules_sass is updated to the latest version containing a fix
  for the `@bazel/worker` bug we had a workaround for.
* dev-infra-private is updated to avoid duplicated dependencies.
  We should use a version that also relies on stable rules_nodejs v4.

Note: We are not set on how dependencies for the `bazel/` folder
of the dev-infra package are managed, but we removed `@types/`
packages from the transitive dependencies, so we now need to
manually include `@types/uuid` for building the benchmark driver
utilties. We need to revisit this in the future.

PR Close #43322
2021-09-02 21:18:36 +00:00
Andrew Scott
3c6b653089 feat(router): Option to correctly restore history on failed navigation (#43289)
Exposes implementation from #38884 as a public opt-in option.

From that commit:
> We can’t determine whether the user actually meant the back or
> the forward using the popstate event (triggered by a browser
> back/forward)
> so we instead need to store information on the state and compute the
> distance the user is traveling withing the browser history.
> So by using the History#go method,
> we can bring the user back to the page where he is supposed to be after
> performing the action.

Resolves #13586

PR Close #43289
2021-09-02 17:46:35 +00:00
Ahmed Ayed
c6a93001eb fix(common): synchronise location mock behavior with the navigators (#41730)
* Do not emit url pop on Location.go
* Emit a `popstate` event before each `hashchange` to have the same
behavior of the browser.
* Track the url change in the internal history when calling `simulateHashChange`

The changes to the router tests reflect the goals of the test.
Generally when `Location.go` is used to trigger navigations, it is only
relevant for `HashLocationStrategy` and verifying that the Router picks
up changes from manual URL changes. To do this, we convert those calls
to `simulateHashChange` instead.
Manual URL bar changes to the path when not using the `HashLocationStrategy`
would otherwise trigger a full page refresh so they aren't relevant to
these test scenarios which assert correct behavior during the lifetime
of the router.

[Reference for no `popstate` on `pushState`/`replaceState`](https://developer.mozilla.org/en-US/docs/Web/API/Window/popstate_event)
> Note that just calling history.pushState() or history.replaceState() won't
trigger a popstate event. The popstate event will be triggered by doing a browser
action such as a click on the back or forward button (or calling history.back()
or history.forward() in JavaScript).

[Reference for `popstate` before `hashChange`](https://developer.mozilla.org/en-US/docs/Web/API/Window/popstate_event#when_popstate_is_sent)

>  When the transition occurs, either due to the user triggering the browser's
> "Back" button or otherwise, the popstate event is near the end of the process to transition to the new location
...
> 12. If the value of state changed, the popstate event is sent to the document.
> 13. Any persisted user state is restored, if the browser chooses to do so.
> 14. If the original and new entry's shared the same document, but had different fragments in their URLs, send the hashchange event to the window.

BREAKING CHANGE:

The behavior of the `SpyLocation` used by the `RouterTestingModule` has changed
to match the behavior of browsers. It no longer emits a 'popstate' event
when `Location.go` is called. In addition, `simulateHashChange` now
triggers _both_ a `hashchange` and a `popstate` event.
Tests which use `location.go` and expect the changes to be picked up by
the `Router` should likely change to `simulateHashChange` instead.
Each test is different in what it attempts to assert so there is no
single change that works for all tests. Each test using the `SpyLocation` to
simulate browser URL changes should be evaluated on a case-by-case basis.

fixes #27059

PR Close #41730
2021-09-02 16:53:47 +00:00
ivanwonder
fc3b50e427 fix(language-service): exclude the SafePropertyRead when applying the optional chaining (#43321)
When providing the completion for `SafePropertyRead`, the ts server
will not apply the optional chaining. So no need to shift the start
location of `replacementSpan` back.

PR Close #43321
2021-09-02 16:52:44 +00:00
Enea Jahollari
c7a93e632b docs: enhance spacings in dynamic component loader section examples (#43241)
PR Close #43241
2021-09-02 16:45:09 +00:00