Commit graph

26397 commits

Author SHA1 Message Date
Jessica Janiuk
dafebcdbd8 docs: release notes for the v15.2.2 release 2023-03-08 10:46:12 -08:00
Angular Robot
8e76107b94 build: update cross-repo angular dependencies (#49367)
See associated pull request for more information.

PR Close #49367
2023-03-08 18:00:27 +00:00
Paul Gschwendtner
c241f63e8d refactor(compiler-cli): remove unused class decorator downlevel code (#49351)
The decorator downlevel transform is never used for actual class
decorators because Angular class decorators rely on immediate execution
for JIT. Initially we also supported downleveling of class decorators
for View Engine library output, but libraries are shipped using partial
compilation output and are not using this transform anymore.

The transform is exclusively used for JIT processing, commonly for
test files to help ease temporal dead-zone/forward-ref issues. We can
remove the class decorator downlevel logic to remove technical debt.

PR Close #49351
2023-03-08 17:59:12 +00:00
Matthieu Riegler
daaf0fd2f6 refactor(core): Remove isObservable() in favor isSubscribable(). (#49295)
The private util `isObservable` was actually just testing the same thing as`isSubscribable()`. As the implementation is closer to the function's name, let's only keep ``isSubscribable`.

PR Close #49295
2023-03-08 17:58:19 +00:00
Jessica Janiuk
5944f5d21e refactor(core): skip hydration annotation (#49345)
This adds the ngSkipHydration annotation, which allows users to
opt hydration boundaries out of hydration. This enables incremental
adoption of hydration by letting users skip hydration on components
that have implementation issues that conflict with hydration.

co-authored-by: AndrewKushnir <akushnir@google.com>

PR Close #49345
2023-03-08 17:56:43 +00:00
Angular Robot
984d0f49b5 build: update cross-repo angular dependencies (#49188)
See associated pull request for more information.

PR Close #49188
2023-03-08 01:54:00 +00:00
Andrew Kushnir
8e0a087674 refactor(core): hydration logic for <ng-container>s (#49303)
This commit incrementally builds on top of #49285 and adds the logic to hydrate <ng-container>s and their contents. This implementation supports simple <ng-container>s that don't have any Angular features (like *ngIf/*ngFor, etc) and are not content-projected.

The subsequent commits will extend the logic further to support more complex scenarios.

PR Close #49303
2023-03-07 23:56:45 +00:00
Matthieu Riegler
436050fcaa docs(docs-infra): Split Error by categories & sort by code. (#49343)
* 2 categories : Runtime errors and Compiler Errors.
* Numeric sort on error code.

PR Close #49343
2023-03-07 19:18:01 +00:00
Sai Kartheek Bommisetty
7749b19e90 docs: update toh-pt5.md (#49307)
PR Close #49307
2023-03-07 19:17:24 +00:00
Vinit Neogi
50a1f80a4d docs(docs-infra): missing "is" in glossary (#49356)
documentation glossary for view hierarchy is missing a "is" to be grammatically correct

Fixes #49352

PR Close #49356
2023-03-07 19:16:41 +00:00
Alan Agius
fdf61974d1 feat(core): drop support for zone.js versions <=0.12.0 (#49331)
BREAKING CHANGE: `zone.js` versions `0.11.x` and `0.12.x` are not longer supported.

PR Close #49331
2023-03-07 19:12:22 +00:00
Jessica Janiuk
ed23974931 Revert "fix(platform-browser): KeyEventsPlugin should keep the same behavior (#49330)" (#49357)
This reverts commit 2312eb53ef.

PR Close #49357
2023-03-07 17:51:04 +00:00
Matthieu Riegler
8551631a5a docs(forms): change error code in filename to match enum value. (#49344)
Error code for bad AsyncValidatorFn is 1101 not 1003.

PR Close #49344
2023-03-07 17:38:01 +00:00
Andrew Kushnir
e48930454a refactor(core): hydration logic for simple element and text nodes (#49285)
This commit incrementally builds on top of https://github.com/angular/angular/pull/49271 and adds the logic to hydrate elements and text nodes that don't have any Angular features (like *ngIf/*ngFor, etc) and are not content-projected.

The subsequent commits will extend the logic further to support more complex scenarios.

Co-authored-by: Jessica Janiuk <jessicajaniuk@google.com>
Co-authored-by: Andrew Kushnir <akushnir@google.com>

PR Close #49285
2023-03-06 19:43:41 +00:00
JiaLiPassion
fc5100986b release: cut the zone.js-0.13 release (#49240)
PR Close #49240
2023-03-06 19:14:20 +00:00
Matthieu Riegler
477237aa85 refactor(animations): handle #24571 todos (#49231)
This commit removes the remaining ones in animations code base

PR Close #49231
2023-03-06 18:45:33 +00:00
JiaLiPassion
2312eb53ef fix(platform-browser): KeyEventsPlugin should keep the same behavior (#49330)
Close #45698

KeyEventsPlugin now has different behavior with EventsPlugin, it will
always run inside ngZone with ngZone.runGuarded() no matter the
component is initialized inside or outside of NgZone, this PR
make sure KeyEventsPlugin bahave the same with other events.

PR Close #49330
2023-03-06 18:45:01 +00:00
Jessica Janiuk
10ffd03e35 ci: update integration test size (#49339)
This updates the uncompressed main file size to fix the broken test status.

PR Close #49339
2023-03-06 18:44:00 +00:00
Alan Agius
1418d1937f test(compiler): add test case for merging objects in tsconfig (#49125)
This commit adds a test case for validate that we do not deep merge objects like like 'paths' and `extendedDiagnostics`.

PR Close #49125
2023-03-06 16:57:28 +00:00
Alan Agius
1407a9aeaf feat(compiler): support multiple configuration files in extends (#49125)
TypeScript 5 support `extends` to be an array, this commit adds support to allow extending `angularCompilerOptions` from multiple config files.

See: https://devblogs.microsoft.com/typescript/announcing-typescript-5-0-beta/#supporting-multiple-configuration-files-in-extends

PR Close #49125
2023-03-06 16:57:28 +00:00
Matthieu Riegler
6203a5e84e refactor(core): Remove ChangeDetectorStatus & isDefaultChangeDetectionStrategy (#49299)
Unused code in core and other packages. They were private exports.

PR Close #49299
2023-03-06 16:57:02 +00:00
Matthieu Riegler
27379d004e refactor(platform-browser): remove ununsed functions. (#49302)
Both `camelCaseToDashCase` and `dashCaseToCamelCase` haven't been used since 2.2.0.

PR Close #49302
2023-03-06 16:56:31 +00:00
Andrew Kushnir
1a1f260583 refactor(core): rename TNode.tViews to TNode.tView (#49313)
Previously (at the early days of Ivy) a TNode used to keep an array of TViews, but the logic was changed since that time, but the `tViews` field remained on TNode interface (+ corresponding typings).

This commit renames TNode.tViews to TNode.tView and cleans up typings.

PR Close #49313
2023-03-06 16:56:00 +00:00
Matthieu Riegler
06b0003ab2 refactor(platform-browser): handle #24571 todos (#49232)
This commit removes the remaining TODO(issue/24571) in platform-browser code base.

PR Close #49232
2023-03-06 16:54:38 +00:00
Jessica Janiuk
4ae4090d3c refactor(platform-server): Implement hydration state transfer machinery (#49271)
**Important note**: this is a first commit in a series of commits that will be needed
to support non-destructive hydration. Stay tuned for further updates!

This commit lays the foundation on top of which more hydration logic will be
added in follow up PRs. This PR includes:

* Initial serialization of hydration data
* Data transfer of hydration annotations from server side to client
* Accessing hydration info and populating internal data structures
* Initial APIs (currently private) that enable hydration (in a tree-shakable manner)
* Cleanup of annotations post hydration
* Initial test infrastructure and basic test cases

This commit does **not** expose any public APIs. They'll be exposed later, when
more hydration logic is implemented to a state when it can cover most common
use-cases.

Co-authored-by: Jessica Janiuk <jessicajaniuk@google.com>
Co-authored-by: Andrew Kushnir <akushnir@google.com>

PR Close #49271
2023-03-06 16:53:37 +00:00
Andrew Scott
e1355e7d16 refactor(migrations): Move ChangeTracker to common utils (#49308)
The `ChangeTracker` is generally useful and could be used by a lot of
migrations instead of having to rewrite similar boilerplate.

PR Close #49308
2023-03-03 22:03:37 +00:00
Paul Gschwendtner
47dda6e1da test: fix router testing example breaking due to non-existent stub (#49293)
We recently migrated the testing example to use the router testing
harness. There was one instance of the previous non-`TestBed` examples
left that still relies on a stub that has already been removed.

This example is not used anywhere and we should rather encourage
a single pattern of testing. i.e. the harness as per recent changes.

This commit removes the broken file.

PR Close #49293
2023-03-03 19:41:35 +00:00
Paul Gschwendtner
c7588683d1 build: always preserve symlinks when executing e2e test commands (#49293)
Currently, examples with test commands like `ng build` are *never*
using the local version of `//packages/compiler-cli`. This is because
the CLI is invoked accidentally from within `external/aio_example_deps`.

Since the CLI relies on importing the compiler-cli, it will always
resolve the dependency from that directory- causing it to be always
the version installed via `aio/examples/tools/shared/package.json`.

We should never resolve symlinks and escape the e2e sandbox. That way
the compiler-cli would be resolved properly and could also become the
locally built one, depending on the test mode (i.e. npm or "local").

PR Close #49293
2023-03-03 19:41:35 +00:00
Paul Gschwendtner
adb337c179 build: ensure chromium is not using sandbox within Bazel sandbox for AIO example e2e tests (#49293)
Chromium is launched via Karma from within the Bazel AIO example e2e
tests. This breaks depending on the platform and sandbox mechanism used.

We should never use Chromium's sandbox on top of Bazel's sandbox
invocation. The Angular CLI exposes a browser exactly for this use-case.

PR Close #49293
2023-03-03 19:41:35 +00:00
Paul Gschwendtner
da1504fec4 build: fix AIO local e2e examples picking up incorrect dependencies (#49293)
Whenever we run example tests using the local framework packages, the
e2e tests will have the local framework packages symlinked in the
`node_modules`.

This works well in general, but due to NodeJS by default resolving
symlinks to the target location, NodeJS will end up looking for
transitive dependencies in the `bazel-bin` instead of in the example
`node_modules` folder. This means that we end up incorrectly resolving
older versions of `@angular/core` that end up existing in the main
project dependencies. This causes errors like:

```
Error: ../../home/circleci/.cache/bazel/_bazel_circleci/9ce5c2144ecf75d11717c0aa41e45a8d/execroot/angular/bazel-out/k8-fastbuild/bin/packages/common/npm_package/http/testing/index.d.ts:12:21 - error TS2307: Cannot find module '@angular/common/http' or its corresponding type declarations.

12 import * as i1 from '@angular/common/http';
                       ~~~~~~~~~~~~~~~~~~~~~~

Error: ../../home/circleci/.cache/bazel/_bazel_circleci/9ce5c2144ecf75d11717c0aa41e45a8d/execroot/angular/bazel-out/k8-fastbuild/bin/packages/common/npm_package/index.d.ts:1630:18 - error TS2707: Generic type 'ɵɵDirectiveDeclaration' requires between 6 and 8 type arguments.

1630     static ɵdir: i0.ɵɵDirectiveDeclaration<NgClass, "[ngClass]", never, { "klass": "class"; "ngClass": "ngClass"; }, {}, never, never, true, never>;
                      ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
```

We can fix this by properly ensuring that NodeJS does not resolve
symlinks, but rather preserves them.

In the error above, the e2e tests end up accidentally resolving
`@angular/core` v14 that comes from `@angular/benchpress`. Angular
Benchpress is installed via `@angular/build-tooling` in the project
root.

PR Close #49293
2023-03-03 19:41:35 +00:00
Paul Gschwendtner
55c37db78f test: fix node and dom types conflict in practical-observable-usage example (#49293)
This causes the e2e tests to fail. The tests were compiled using a
tsconfig with `lib=dom`, but the tests explicitly tried to pull in the
Node types. This causes a conflict for e.g. `AbortController` types.

PR Close #49293
2023-03-03 19:41:35 +00:00
Paul Gschwendtner
36b67152b9 build(docs-infra): fix example e2e tests not failing properly in some situations (#49293)
The `run-example-e2e` script does not properly fail if configured
tests of examples are failing. This happens when a CLI example
configures multiple tests in the `example-config`. Due to incorrect
usage of promises in combination with reduce, only the last test
command had an effect on the overall test conclusion.

A similar issue seems to occur with SystemJS Protractor tests.

This commit fixes the problem and also cleans up the code a little
by switching it to `async/await`.

PR Close #49293
2023-03-03 19:41:35 +00:00
Paul Gschwendtner
67679b3146 build: format run-example-e2e.mjs with prettier (#49293)
Formats the `run-example-e2e.mjs` file with prettier to ease
future diffs.

PR Close #49293
2023-03-03 19:41:35 +00:00
Matthieu Riegler
594e68cc4b refactor(core): Remove ɵivyEnabled (#49296)
The unit tests have been updated in #44120, this export is unused now.

PR Close #49296
2023-03-03 19:41:09 +00:00
Matthieu Riegler
9737df37a9 docs: fix links on untyped forms (#49306)
PR Close #49306
2023-03-03 19:40:00 +00:00
Jessica Janiuk
1ba551b888 Revert "refactor(router): Remove zone code from router scroller (#49238)" (#49311)
This reverts commit 2e568b8a42.

PR Close #49311
2023-03-03 18:31:04 +00:00
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