Commit graph

29561 commits

Author SHA1 Message Date
Matthieu Riegler
fce0602fa1 refactor(common): remove BrowserPlatformLocation from private exports. (#49301)
`BrowserPlatformLocation` was add to the public API by #48488.

PR Close #49301
2023-03-03 16:39:54 +00:00
Angular Robot
51d7cfbac6 build: update all non-major dependencies (#49267)
See associated pull request for more information.

PR Close #49267
2023-03-02 14:09:14 -08:00
Andrew Scott
ea32c3289a feat(router): Expose information about the last successful Navigation (#49235)
The `Router` already has the `getCurrentNavigation()` helper function to
expose information about the ongoing navigation.
`lastSuccessfulNavigation` is actually already exposed in the
`Navigation` object. This commit only _slightly_ extends the current API
surface by providing access to the `lastSuccessfulNavigation` object
outside of an ongoing navigation.

fixes #45685

PR Close #49235
2023-03-02 21:50:39 +00:00
Kristiyan Kostadinov
10c8eae6d4 refactor(migrations): expose current file in import remapper (#49288)
Passes the path of the current file to the import remapper. Useful if we want to generate absolute paths.

PR Close #49288
2023-03-02 21:48:34 +00:00
Dylan Hunn
675fe2fabc refactor(core): Clean up getNgZone implementation. (#49241)
The current implementation is a bit confusing to read. Get rid of some of the operator soup.

PR Close #49241
2023-03-02 21:48:05 +00:00
Matthieu Riegler
e57d5db045 refactor(core): remove unused r2 debug code (#49292)
`_createNgProbeR2` isn't called anymore, `ɵgetDebugNodeR2` isn't needed anymore. We can now remove it from the export in Core.

PR Close #49292
2023-03-02 21:47:25 +00:00
Andrew Scott
e7948d30c5 docs(router): Update component testing to user RouterTestingHarness (#48553)
This commit updates the documentation on testing the
`Router` to use the `RouterTestingHarness` rather than stubs.

The stubs described in the previous form of this document actually
creates tests which are incapable of catching bugs related to the
component's interaction with the `Router`. In addition, managing the
stubs is more difficult than using the real `Router` classes.

Stubbing something like the `RouterLink` is quite harmful because it
neither tests the actual URL being created, nor the end result of the
navigation. There have been serveral bug fixes in the Router over the
years the would change the outcome of these but would not be caught by
tests which create a stub.

PR Close #48553
2023-03-02 13:17:17 -08:00
Paul Gschwendtner
e9bda8a5d7 build: remove ts-node forking bug workaround (#49289)
In the past, `ts-node` had a bug that prevented forking processes
when used in combination with `--esm`.

We contributed a fix upstream to `ts-node` to fix this, and this
commit updates to the latest version so that we can simplify our
`ng-dev` invocation.

32d07e2b2f

Fixes #46858

PR Close #49289
2023-03-02 13:16:19 -08:00
Matthieu Riegler
3f650bd200 refactor(core): Remove isListLikeIterable from private export. (#49297)
PR #48433 removed the last external usage of `isListLikeIterable`. We can now remove it from the private exports.

PR Close #49297
2023-03-02 20:53:01 +00:00
Matthieu Riegler
cc34d5b6ef refactor(core): Application ref/init code cleaning (#49206)
* With tsc improvements some types can be refined.
* Removing unnecessary non-null assertions.
* Using std native methods instand of custom functions
* Using @ts-expect-error instead of `any` type assertion to keep code navigation.

PR Close #49206
2023-03-02 20:01:39 +00:00
Matthieu Riegler
3aec17e11c docs: Add NG8107 entry : Optional chain not nullable extended diagnostic (#49287)
PR Close #49287
2023-03-02 19:56:37 +00:00
Matthieu Riegler
8beb8526be refactor: remove duplicate key from component metadata (#49065)
`directiveMetadata()` already assigns the `standalone` property to the `R3ComponentMetadataFacade` there is no need to do it twice.

PR Close #49065
2023-03-01 22:36:50 +00:00
Matthieu Riegler
6d9e979be1 refactor(router): use native functions instead of custom utils (#49209)
* flatten() => flat()
* forEach() => Object.entries/values/keys().forEach()
* and() => every()

PR Close #49209
2023-03-01 22:35:07 +00:00
Alan Agius
b5278cc115 feat(platform-server): renderApplication now accepts a bootstrapping method (#49248)
The `renderApplication` now also accepts a bootstrapping function call with return `Promise<ApplicationRef>`as the first parameter.

Example:
```ts
 const bootstrap = () => bootstrapApplication(RootComponent, appConfig);

 const output: string = await renderApplication(bootstrap);
```

PR Close #49248
2023-03-01 22:31:33 +00:00
Andrew Scott
2e568b8a42 refactor(router): Remove zone code from router scroller (#49238)
This zone code was added with the incorrect assumption that it would
avoid scheduling a new change detection by creating the timeout outside
of the Angular zone. However, it has recently been (re)discovered that
calling `zone.run` when you are outside the angular zone results in a
synchronous change detection. With that, this bit of code doesn't
actually accomplish what it set out to do so it can be removed.

minimal repro: https://stackblitz.com/edit/angular-hbzbqs?file=src%2Fmain.ts

PR Close #49238
2023-03-01 12:34:22 -08:00
Alan Agius
c41a21658c refactor(common): remove deprecated XhrFactory export from http entrypoint (#49251)
The deprecated `XhrFactory` export from `@angular/common/http` has been removed.

BREAKING CHANGE:

Deprecated `XhrFactory` export from `@angular/common/http` has been removed. Use `XhrFactory` from `@angular/common` instead.

PR Close #49251
2023-03-01 12:33:03 -08:00
Alan Agius
17abe6dc96 refactor(platform-server): remove deprecated renderModuleFactory (#49247)
The deprecated `renderModuleFactory` has been removed as it is no longer necessary with Ivy.

BREAKING CHANGE: `renderModuleFactory` has been removed. Use `renderModule` instead.

PR Close #49247
2023-03-01 12:32:32 -08:00
Alan Agius
4e9531f777 feat(core): add mergeApplicationConfig method (#49253)
This commits add a utility method to merge multiple `ApplicationConfiguration` into one from left to right.  This is useful for server rendering were an application might have several configurations.

Usage Example:
```ts
const config = mergeApplicationConfig(appConfig, appServerConfig);
```

PR Close #49253
2023-03-01 11:20:31 -08:00
Alan Agius
3aa85a8087 refactor(platform-browser): move ApplicationConfig to core (#49253)
This is needed to provide the merge configuration method which will reside in core.

DEPRECATED: `ApplicationConfig` has moved, please import `ApplicationConfig` from `@angular/core` instead.

PR Close #49253
2023-03-01 11:20:31 -08:00
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