Commit graph

26342 commits

Author SHA1 Message Date
Alan Agius
2beffeba8c build: remove core-js-bundle from dependencies (#49259)
This is no longer needed as Angular is ever green.

PR Close #49259
2023-03-01 11:19:48 -08:00
Andrew Kushnir
030060e3dc refactor(core): use lower-level API to annotate TransferState class (#49272)
This commit updates the `TransferState` class and replaces the `@Injectable` decorator with a lower-level function call. This is a common practice for token defined in `core`, for example:

* https://github.com/angular/angular/blob/main/packages/core/src/change_detection/differs/iterable_differs.ts#L193-L196
* https://github.com/angular/angular/blob/main/packages/core/src/di/injector.ts#L121-L126

This is needed to avoid cirular references when using `TransferState` in other locations in `core`, for
example: https://github.com/angular/angular/pull/49271. Circular dependencies are coming from the fact t
hat the `@Injectable` from the `packages/core/src/di/injectable.ts` file refers to a number of extra symbols.

PR Close #49272
2023-03-01 11:19:10 -08:00
Andrew Kushnir
41bed349a8 refactor(core): move APP_BOOTSTRAP_LISTENER to avoid circular deps (#49273)
This commit moves the `APP_BOOTSTRAP_LISTENER` token into the `application_ref.ts` to avoid a risk of circular dependencies. The main problem is that the token refers to the `ComponentRef`, which in turn refers to more symbols, thus making the `application_tokens.ts` file susceptible to circular dependencies. Such a dependency was identified in https://github.com/angular/angular/pull/49271.

PR Close #49273
2023-03-01 11:18:27 -08:00
Kristiyan Kostadinov
2fbaee3cbe fix(migrations): add protractor support if protractor imports are detected (#49274)
The new `bootstrapApplication` API doesn't include Protractor support anymore which may cause existing e2e tests to break after the migration. These changes add some logic that will provide Protractor support if any imports to `protractor` or `protractor/*` are detected.

PR Close #49274
2023-03-01 11:13:56 -08:00
Andrew Kushnir
3673ea0621 release: cut the v16.0.0-next.1 release 2023-03-01 11:06:37 -08:00
Andrew Kushnir
5663104798 docs: release notes for the v15.2.1 release 2023-03-01 10:56:06 -08:00
Stephanie Tuerk
66f7519547 docs: clarify ActivatedRouter injection location (#49270)
The example in the code snippet below this line of text shows `ActivatedRouter` being injected into a component's constructor. When I read instruction to inject A`ActivatedRouter` into **application's** constructor, I assumed this meant the constructor for `app.component.ts`. 

Editing to clarify/match code example below.
PR Close #49270
2023-02-28 17:13:36 -08:00
Jessica Janiuk
a08a8ff108 fix(platform-server): bundle @angular/domino in via esbuild (#49229)
This removes one line that should effectively bundle the
angular fork of domino in via esbuild.

PR Close #49229
2023-02-28 13:34:50 -08:00
Joey Perrott
7fd650a898 build: update lint path for @angular/build-tooling rules (#49266)
Update to the new path.

PR Close #49266
2023-02-28 11:56:28 -08:00
Angular Robot
05d684f959 build: update cross-repo angular dependencies (#49266)
See associated pull request for more information.

PR Close #49266
2023-02-28 11:56:28 -08:00
Alan Agius
e9edea363c fix(core): update zone.js peerDependencies ranges (#49244)
This ensures that the latest version of zone.js is supported.

PR Close #49244
2023-02-28 11:55:53 -08:00
Pawel Kozlowski
0f5c8003cc feat(core): introduce concept of DestroyRef (#49158)
DestroyRef represents a concept of lifecycle scope where destroy
callbacks can be registered. Such callbacks are automatically
executed when a given scope ends it lifecycle.

In practice the most common  lifecycle scopes would be represented by:
 - a component or en embedded view;
 - instance of `EnvironnementInjector`.

PR Close #49158
2023-02-28 11:52:09 -08:00
Alan Agius
f594725951 refactor(core): remove Node.js v14 support (#49255)
BREAKING CHANGE: Node.js v14 support has been removed

Node.js v14 is planned to be End-of-Life on 2023-04-30. Angular will stop supporting Node.js v14 in Angular v16. Angular v16 will continue to officially support Node.js versions v16 and v18.

PR Close #49255
2023-02-28 11:00:25 -08:00
Angular Robot
0c805f128e build: update bazel setup (#48240)
See associated pull request for more information.

PR Close #48240
2023-02-28 10:57:12 -08:00
Matthieu Riegler
7b9a082c92 refactor(core): Drop Symbol.iterator shim (#49207)
We are targeting evergreen browsers, we can drop the shim.

PR Close #49207
2023-02-28 10:05:41 -08:00
Kristiyan Kostadinov
87affadb87 fix(migrations): avoid migrating the same class multiple times in standalone migration (#49245)
If a class is declared in multiple modules, the standalone migration may end up generating invalid code. While declaring a class in multiple modules is an error, it can happen with modules in tests. These changes avoid the issue by using a `Set` to track the classes being migrated.

PR Close #49245
2023-02-28 10:04:54 -08:00
Virginia Dooley
dba747f7f8 docs: New doc extract from original HTTP doc to be retired. (#48915)
PR Close #48915
2023-02-28 09:32:29 -08:00
Virginia Dooley
9553a9a2a1 docs: New doc extract from original HTTP doc to be retired. (#48912)
PR Close #48912
2023-02-28 09:31:30 -08:00
Virginia Dooley
557ae661ed docs: New doc extract from original HTTP doc to be retired. (#48908)
PR Close #48908
2023-02-28 09:30:13 -08:00
Virginia Dooley
a51b5cf73c docs: New document extracted from the original Communicating with backend services using HTTP document, which is to be retired. (#47971)
PR Close #47971
2023-02-28 09:29:12 -08:00
Kristiyan Kostadinov
99d874fe3b feat(core): add support for TypeScript 5.0 (#49126)
Updates the project to support TypeScript 5.0 and to resolve any errors that came up as a result of the update.

PR Close #49126
2023-02-28 08:24:47 -08:00
Matthieu Riegler
6d30f607a0 docs(router): Improving linking (#49203)
Add links to @see elements and suggest a more explicit alternative for the depreciation of `CanActivate`.

PR Close #49203
2023-02-28 08:24:11 -08:00
Andrew Scott
31f210bf2c fix(router): Router.createUrlTree should work with any ActivatedRoute (#48508)
This change makes the `createUrlTreeFromSnapshot` added in #45877 the
default and only behavior in the Router. This now addreses #42191, #38276, #22763,
and #48472 without needing to create custom handling to
call `createUrlTreeFromSnapshot` (since it's now called by `Router.createUrlTree`).

BREAKING CHANGE: Tests which mock `ActivatedRoute` instances may need to be adjusted
because Router.createUrlTree now does the right thing in more
scenarios. This means that tests with invalid/incomplete ActivatedRoute mocks
may behave differently than before. Additionally, tests may now navigate
to a real URL where before they would navigate to the root. Ensure that
tests provide expected routes to match.
There is rarely production impact, but it has been found that relative
navigations when using an `ActivatedRoute` that does not appear in the
current router state were effectively ignored in the past. By creating
the correct URLs, this sometimes resulted in different navigation
behavior in the application. Most often, this happens when attempting to
create a navigation that only updates query params using an empty
command array, for example `router.navigate([], {relativeTo: route,
queryParams: newQueryParams})`. In this case, the `relativeTo` property
should be removed.

PR Close #48508
2023-02-28 08:21:20 -08:00
Matthieu Riegler
8869289c09 refactor(platform-server): handle #24571 todos (#49233)
This commit removes the remaining TODO(issue/24571) in platform-server code base.

PR Close #49233
2023-02-28 08:19:56 -08:00
Matthieu Riegler
2423a04092 docs: remove TODO from doc example (#49233)
This commit removes a TODO(issue/24571) that leaking into the docs examples

PR Close #49233
2023-02-28 08:19:56 -08:00
Matthieu Riegler
477e000a07 refactor(elements): handle #24571 todos (#49233)
This commit removes the remaining TODO(issue/24571) in elements code base.

PR Close #49233
2023-02-28 08:19:56 -08:00
Angular Robot
75f48fe4a6 build: update eslint dependencies to v5.54.0 (#49243)
See associated pull request for more information.

PR Close #49243
2023-02-28 08:19:06 -08:00
Angular Robot
1c64e2b5ec build: update github/codeql-action action to v2.2.5 (#49242)
See associated pull request for more information.

PR Close #49242
2023-02-28 08:18:21 -08:00
Matthieu Riegler
e3c4f6fd05 docs: improve section title in TOH-pt4 (#49208)
fixes #49165

PR Close #49208
2023-02-28 08:16:38 -08:00
Alan Agius
0544b86727 ci: add several dependencies to renovate ignore list (#49258)
Add ignored dependencies in Renovate config. These have been collected from the dependency dashboard (https://github.com/angular/angular/issues/46728)

The reason for this change is that Renovate is re-opened dependency updates for ignored PRs.

Example:
https://github.com/angular/angular/pull/49256
https://github.com/angular/angular/pull/47852

PR Close #49258
2023-02-28 08:15:04 -08:00
Virginia Dooley
ca6ea0d2b7 docs: New document extracted from the original Communicating with backend services using HTTP document, which is to be retired. (#47937)
PR Close #47937
2023-02-27 15:24:40 -08:00
Andrew Kushnir
459fbb31d1 refactor(platform-browser): rename transfer_state.ts -> transfer_state_module.ts (#49222)
After the move of the `TransferState` logic, this file only contains a module that used to have the `TransferState` in provider list (but was refactored a while ago after `TransferState` became tree-shakable).

PR Close #49222
2023-02-27 13:08:40 -08:00
Andrew Kushnir
a5dc9960dc refactor(core): move TransferState implementation to core (#49222)
This commit moves the `TransferState` class implementation to `@angular/core`. This class will be needed in core in followup changes and `core` can not depend on `platform-browser` package.

The `core` package does **not** export those symbols into public API surface.
The `platform-browser` package re-exports the symbols under same names for backwards-compatibility.

PR Close #49222
2023-02-27 13:08:40 -08:00
Andrew Scott
455c728525 feat(router): helper functions to convert class guards to functional (#48709)
This commit introduces helper functions to easily convert `Injectable`s with
functions compatible with `Route` guards to the corresponding guard functions.
These functions will serve to aid in migrating off of the now deprecated
class-based guards, but also provide an easy avenue to still defining
guards as `Injectable` classes if that is desired.

PR Close #48709
2023-02-27 11:52:47 -08:00
Iván Navarro
7e35a917c5 fix(router): add error message when using loadComponent with a NgModule (#49164)
Add a more specific error message when defining a lazy-loaded route using
`loadComponent` and passing it a NgModule instead of a standalone component,
when the user should actually be using `loadChildren`.

PR Close #49164
2023-02-27 10:09:55 -08:00
Doug Parker
3c079a74c9 release: bump DevTools version (#49121)
PR Close #49121
2023-02-27 10:07:53 -08:00
Matthieu Riegler
d420ab94e6 refactor(common): Use isPromise from @angular/core (#49210)
This commit removes `isPromise()` from Common as it's a duplicate function that can be imported from `@angular/core`.

PR Close #49210
2023-02-27 10:03:20 -08:00
Vincent
3c9d49a4d7 fix(common): make Location.normalize() return the correct path when the base path contains characters that interfere with regex syntax. (#49181)
Fix the function stripping the base path from the URL, as the current implementation uses the base path as part of a regex, which wrongly makes paths fails that contain characters such as a parenthesis (example: C:/Users/MyUser(Test)/project).

Fixes #49179

PR Close #49181
2023-02-27 10:02:33 -08:00
Andrew Kushnir
b4703a7686 refactor(core): add previous sibling node reference to TNode (#49223)
This commit updates the `TNode` to include a reference to the previous sibling node. Currently, TNode has references to the next sibling and parent nodes, but in followup changes we'd need to have access to previous TNodes (to determine position of the current node).

PR Close #49223
2023-02-27 10:00:25 -08:00
Paul Gschwendtner
47ef9e83c7 build: cleanup unused dependencies (#49227)
Cleans up a few more unused dependencies.

Related: https://github.com/angular/angular/pull/49226

PR Close #49227
2023-02-27 08:05:59 -08:00
Aristeidis Bampakos
1d08a93a51 docs: change link for Angular Projects book (#49198)
PR Close #49198
2023-02-27 08:05:20 -08:00
Aristeidis Bampakos
27b986e119 docs: add new edition of Learning Angular book (#49199)
PR Close #49199
2023-02-27 08:04:34 -08:00
Matthieu Riegler
3f488eafea docs: bump first-app to 15.2 (#49217)
The stackblitz demo of the quick-start guide was broken with incompatible dependencies.
This commit fixes this.

Fixes #49213

PR Close #49217
2023-02-27 08:03:46 -08:00
JiaLiPassion
d1ac3aa14e fix(zone.js): zone-node only patch Promise.prototype.then (#49144)
Close #47872

zone-node only patches `Promise.prototype.then` instead of patch
`Promise` itself. So the new NodeJS `SafePromise` will not complain
the Promise.prototype.then called on incompatible receiver.

We should also do this change on browser zone.js patch, but it will
be a big breaking change, because Promise.prototype.then will not work
with `fakeAsync` any longer.

PR Close #49144
2023-02-27 08:02:43 -08:00
Andrew Kushnir
74258f3652 refactor(platform-browser): move TransferState init logic into its constructor (#49191)
This commit updates the TransferState class to move its init logic from the `useFactory` function to its constructor. The change is needed to make the init behavior consistent across different injection scenarios and tolerate the issue described in https://github.com/angular/angular/issues/49190.

PR Close #49191
2023-02-24 10:41:16 -08:00
Jessica Janiuk
76731ae5c8 refactor(platform-server): Switch to using angular fork of domino (#49189)
This changes the dependency on Domino to use the recently forked version.

PR Close #49189
2023-02-24 09:33:07 -08:00
Andrew Kushnir
02f4599669 refactor(core): avoid creating DOM nodes before creating a TNode (#49172)
This commit updates the `elementStart` instruction to avoid creating DOM nodes before creating a corresponding TNode. This refactoring is needed to make sure this internal logic is consistent across all instructions.

PR Close #49172
2023-02-24 08:29:05 -08:00
Paul Gschwendtner
b6c6dfd278 fix(compiler-cli): do not persist component analysis if template/styles are missing (#49184)
Consider the following scenario:

1. A TS file with a component and templateUrl exists
2. The template file does not exist.
3. First build: ngtsc will properly report the error, via a FatalDiagnosticError
4. The template file is now created
5. Second build: ngtsc still reports the same errror.

ngtsc persists the analysis data of the component and never invalidates
it when the template/style file becomes available later.

This breaks incremental builds and potentially common workflows
where resource files are added later after the TS file is created. This
did surface as an issue in the Angular CLI yet because Webpack requires
users to re-start the process when a new file is added. With ESBuild
this will change and this also breaks incremental builds with
Bazel/Blaze workers.

To fix this, we have a few options:

* Invalidate the analysis when e.g. the template file is missing. Never
  caching it means that it will be re-analyzed on every build iteration.
* Add the resource dependency to ngtsc's incremental file graph. ngtsc
  will then know via `host.getModifiedResources` when the file becomes
  available- and fresh analysis of component would occur.

The first approach is straightforward to implement and was chosen here.
The second approach would allow ngtsc to re-use more of the analysis
when we know that e.g. the template file still not there, but it
increases complexity unnecessarily because there is no **single**
obvious resource path for e.g. a `templateUrl`. The URL is attempted
to be resolved using multiple strategies, such as TS program root dirs,
or there is support for a custom resolution through
`host.resourceNameToFileName`.

It would be possible to determine some candidate paths and add them to
the dependency tracker, but it seems incomplete given possible external
resolvers like `resourceNameToFileName` and also would likely not have
a sufficient-enough impact given that a broken component decorator is
not expected to remain for too long between N incremental build
iterations.

PR Close #49184
2023-02-24 08:24:07 -08:00
Kristiyan Kostadinov
7dd19570e8 fix(migrations): delete barrel exports in standalone migration (#49176)
Adds some logic to automatically delete `export * from './foo'` style imports. Previously they weren't being picked up, because finding all the references using the language service doesn't include barrel exports.

PR Close #49176
2023-02-24 08:23:01 -08:00
Kristiyan Kostadinov
79cdfeb392 feat(compiler): drop support for TypeScript 4.8 (#49155)
Drops support for TypeScript 4.8 from the compiler and removes all of the compatibility code we had for it.

BREAKING CHANGE:
* TypeScript 4.8 is no longer supported.

PR Close #49155
2023-02-23 10:39:43 -08:00