Commit graph

29561 commits

Author SHA1 Message Date
Paul Gschwendtner
12bad6576d fix(compiler-cli): libraries compiled with v16.1+ breaking with Angular framework v16.0.x (#50714)
If a library is compiling with Angular v16.1.0, the library will break
for users that are still on Angular v16.0.x. This happens because the
`DirectiveDeclaration` or `ComponentDeclaration` types are not expecting
an extra field for `signals` metadata. This field was only added to the
generic types in `16.1.0`- so compilations fail with errors like this:

```
Error: node_modules/@angular/material/icon/index.d.ts:204:18 -
  error TS2707: Generic type 'ɵɵComponentDeclaration' requires between 7 and 9 type arguments.
```

To fix this, we quickly roll back the code for inserting this metadata
field. That way, libraries remain compatible with all v16.x framework
versions.

We continue to include the `signals` metadata if `signals: true` is set.
This is not public API anyway right now- so cannot happen- but imagine
we expose some signal APIs in e.g. 16.2.x, then we'd need this metadata
and can reasonably expect signal-component library users to use a more
recent framework core version.

PR Close #50714
2023-06-14 16:27:59 +02:00
Matthieu Riegler
8468df19c9 fix(migrations): Prevent a component from importing itself. (#50554)
This commit fixes the migrations for recursive components.

fixes #50525

PR Close #50554
2023-06-14 15:44:35 +02:00
alkavats1
5dc7a99393 docs: added the alt attribute to the imag tag and replaced the i tag with the em tag (#50570)
PR Close #50570
2023-06-14 15:28:22 +02:00
Matthieu Riegler
0b14e4ef74 feat(router): exposes the fixture of the RouterTestingHarness (#50280)
The component exposed by the fixture is not important thus marked as `unknown`.

Exposing the fixture of the `RouterTestingHarness` allows to use the methods & properties of that fixture and makes it compatible with testing libraries relying on `ComponentFixture`

Fixes #48855

PR Close #50280
2023-06-14 15:27:25 +02:00
Paul Gschwendtner
82adc86353 refactor(compiler-cli): fix incremental compilation breaking when running compiler through closure (#50673)
If the compiler CLI is running through closure compiler, the trait
decorator handlers are converted from classes to functions as ES5
is picked as default output target for the bundled version.

The problem is that currently all trait handlers end up having the
same `name`. i.e. an empty string, and therefore adopting previous
traits from a previous build iteration result in the incorrect handler
being used for e.g. registrering, compiling etc- causing
ambiguous/confusing errors down the line in other parts.

We can look into changing the output target in the future, but even
then we are safer using an actual literal due to property renaming.

```$$closure$$NgModuleDecoratorHandler = function() {}`.

It is is questionable if we should just simply NOT run the compiler
through JSCompiler.

PR Close #50673
2023-06-14 15:26:00 +02:00
Angular Robot
6883a7ebf9 docs: update Angular CLI help [main] (#50711)
Updated Angular CLI help contents.

PR Close #50711
2023-06-14 15:21:19 +02:00
Matthieu Riegler
8d42747971 refactor(core): handle #24571 todos. (#49221)
This commit removes the remaining TODO(issue/24571) in core code base.

PR Close #49221
2023-06-14 12:33:44 +02:00
Matthieu Riegler
c31fe761cf docs: remove allowEmptyCodegenFiles. (#50379)
`allowEmptyCodegenFiles` serves no purpose, no need to mention it.

PR Close #50379
2023-06-14 11:19:47 +02:00
Matthieu Riegler
595d8b54c0 refactor(compiler-cli): deprecate allowEmptyCodegenFiles (#50379)
The `allowEmptyCodegenFiles` is not used anymore.

PR Close #50379
2023-06-14 11:19:46 +02:00
Matthieu Riegler
946df15bc8 refactor(platform-browser): remove unused polyfill (#50661)
The `jasmineToString` on Map isn't used anymore.

PR Close #50661
2023-06-14 10:58:04 +02:00
Matthieu Riegler
ad28cddd41 refactor(platform-browser): replace our own toBeAnInstanceOf with toBeInstanceOf (#50661)
There is no need to maintain that matcher since jasmine provides its own !

PR Close #50661
2023-06-14 10:58:04 +02:00
Matthieu Riegler
0626d12fe1 refactor(platform-browser): remove unused testing matcher (#50661)
We has some custom matchers that aren't used anymore:

* `toContainError`
* `toBePromise`

PR Close #50661
2023-06-14 10:58:04 +02:00
Matthieu Riegler
f199305db6 docs(platform-server): Make links out of @see tags (#50110)
This commit is part of the work for angular#50097 to improve the linking on the online documentation.

PR Close #50110
2023-06-14 10:54:39 +02:00
Matthieu Riegler
20983fc595 docs(localize): Make links out of @see tags (#50110)
This commit is part of the work for angular#50097 to improve the linking on the online documentation.

PR Close #50110
2023-06-14 10:54:39 +02:00
Matthieu Riegler
8cd90bacae docs(docs-infra): throw an error when @link is used with a backtick reference (#50110)
As part of #50097, we'll add this constraint to the @see comments

PR Close #50110
2023-06-14 10:54:39 +02:00
Matthieu Riegler
7d4dc2285b docs(animations): Make links out of @see tags (#50110)
This commit is part of the work for #50097 to improve the linking on the online documentation.

PR Close #50110
2023-06-14 10:54:39 +02:00
Matthieu Riegler
848ba54308 docs(common): Make links out of @see tags (#50110)
This commit is part of the work for #50097 to improve the linking on the online documentation.

PR Close #50110
2023-06-14 10:54:39 +02:00
Matthieu Riegler
028bd90bb1 docs(core): Make links out of @see tags (#50110)
This commit is part of the work for #50097 to improve the linking on the online documentation.

PR Close #50110
2023-06-14 10:54:38 +02:00
Matthieu Riegler
7eb5286d04 docs(forms): Make links out of @see tags (#50110)
This commit is part of the work for #50097 to improve the linking on the online documentation.

PR Close #50110
2023-06-14 10:54:38 +02:00
Matthieu Riegler
a58416903c docs(platform-browser): Make links out of @see tags (#50110)
This commit is part of the work for #50097 to improve the linking on the online documentation.

PR Close #50110
2023-06-14 10:54:38 +02:00
Matthieu Riegler
9209692bde docs(router): Make links out of @see tags (#50110)
This commit is part of the work for #50097 to improve the linking on the online documentation.

PR Close #50110
2023-06-14 10:54:38 +02:00
Matthieu Riegler
c8c00ae485 docs(docs-infra): create code block for links to methods (#50110)
Before this commit, links to methods had to rely on a custom title (or the method name would be displayed).

With this commit, {@link MyClass#myMethod} will ouput a link as `MyClass#myMethod`.
This has a 2nd advantage : We can now rely on the validation by the `checkAnchorLinksProcessor` to ensure the method actually exist.

This commit is part of #50110 to improve linking in the documentation.

PR Close #50110
2023-06-14 10:54:38 +02:00
David-Emmanuel DIVERNOIS
1ad4d55d91 fix(core): extend toSignal to accept any Subscribable (#50162)
Extend toSignal to accept any Subscribable (instead of only Observable)
for consistency with AsyncPipe and for broader compatibility with any
observable library (that is compatible with the Subscribable interface).
This is only a type change as the implementation does not use anything
else than the Subscribable interface anyway.

PR Close #50162
2023-06-14 10:49:56 +02:00
Dylan Hunn
88962b72a9 refactor(compiler): Support safe property reads and keyed reads. (#50594)
Angular's null-safe access operators differ from Javascript's built-in semantics, in that they short-circuit to `null` instead of `undefined`. This necessitates providing a custom transformation, instead of relying on Typescript or Javascript itseld.

The old TemplateDefinitionBuilder uses a top-down approach based on the Visitor pattern, in which it recursively extracts the left-most safe access, and hoists it to a null check at the top. See `expression_converter.ts` for details.

In this commit, we replace that approach with a new bottom-up algorithm, as part of the template pipeline. This requires an intermediate expression type to represent the not-yet-expanded ternary operators, and is split into its own pass.

Null-safe function calls are not yet implemented, since they will rely on a future temporary variable allocation pass.

Co-authored-by: Alex Rickabaugh <alxhub@users.noreply.github.com>

PR Close #50594
2023-06-13 18:59:43 +02:00
Dylan Hunn
1c635be80c refactor(compiler): Support non-null assertions. (#50594)
Because non-null assertions don't affect the generated code, we can just drop them.

PR Close #50594
2023-06-13 18:59:43 +02:00
Dylan Hunn
2c71920c2d refactor(compiler): Add initial support for nullish coalescing. (#50594)
Create a pass that expands nullish coalescing operators into null checks.

This is not yet finished because we need to emit temporary variable assignments, which we will do using a future temporary variable allocation pass. Also, TemplateDefinitionBuilder is a bit quirky, and we still need to exactly match its behavior.

Nevertheless, this is good enough to prevent the diffs from getting ruined as a result of nullish coalescing operations.

PR Close #50594
2023-06-13 18:59:43 +02:00
Dylan Hunn
70db25f206 refactor(compiler): Allow expressions to be deeply cloned. (#50594)
It is sometimes useful to clone an expression tree, in order to copy it and mutate it in a phase, without affecting other subtrees due to the copy-by-reference.

PR Close #50594
2023-06-13 18:59:43 +02:00
Miles Malerba
15ab146e6c refactor(compiler): improve handling of bindings and attributes (#50664)
Refactor attribute and property binding ingestion and add an attribute extraction phase

Co-authored-by: Alex Rickabaugh <alxhub@users.noreply.github.com>
Co-authored-by: Dylan Hunn <dylhunn@users.noreply.github.com>

Only add the value to the ElementAttributes map for style and attribute kinds

Other kinds should not have their value represented in the consts array

Add missing attribute ingesiton for templates

Unify how template and element bindings are ingested

This resolves the issue of missing listener attributes on templates. In
order to avoid emitting extraneous instructions, listener ops on
templates are stripped in the attribute extraction phase instead.

Handle different binding types separately in ingest

Cleanup code and comments

Disable test that fails on new explicit error.

Previously the test was passing because ingestPropertyBinding treated
attribute bindings as normal bindings which happened to be ok for the
particular test. Now there's an explicit error that attrbiute bindings
aren't yet handled which causes the test to fail

Address feeback

PR Close #50664
2023-06-13 18:34:58 +02:00
Pawel Kozlowski
1f0d529090 docs: update CHANGELOG to account for a reverted commit (#50707)
https://github.com/angular/angular/pull/49735 was reverted
we need to adjust the changelog accordingly.

PR Close #50707
2023-06-13 17:55:12 +02:00
Pawel Kozlowski
01d45df6d9 docs: release notes for the v16.1.0 release 2023-06-13 17:12:10 +02:00
Pawel Kozlowski
2782fc2a18 docs: release notes for the v16.0.6 release 2023-06-13 17:01:28 +02:00
Angular Robot
0f299c0061 build: update actions/checkout action to v3.5.3 (#50689)
See associated pull request for more information.

PR Close #50689
2023-06-13 14:48:02 +02:00
Andrew Kushnir
cefa3de3de refactor(common): use transform functions in NgOptimizedImage inputs (#50580)
This commit refactors the code of NgOptimizedImage directive to switch from getter/setter approach to convers inputs to use the `transform` function instead.

PR Close #50580
2023-06-13 13:20:49 +02:00
Andrew Kushnir
307f8eee2c fix(core): avoid duplicated content during hydration while processing a component with i18n (#50644)
This commit updates an internal hydration logic to make sure that the content of components with i18n blocks is cleaned up before we start rendering it.

Resolves #50627.

PR Close #50644
2023-06-13 13:12:07 +02:00
Nikolas Kazepis
ee073cdfae docs: update an example in the RouterEvent description (#50526)
PR Close #50526
2023-06-13 13:08:14 +02:00
Angular Robot
ad82f3ab47 build: update all non-major dependencies (#50583)
See associated pull request for more information.

PR Close #50583
2023-06-13 12:45:12 +02:00
Angular Robot
17dec5bbe7 build: lock file maintenance (#50532)
See associated pull request for more information.

PR Close #50532
2023-06-13 11:46:07 +02:00
Russ
ec9ee9e5bf docs: fix "After you finish" description of first-app-lesson-05.md (#50645)
Lesson 5 previously had the same "After you finish" description as Lesson 4.

PR Close #50645
2023-06-13 11:36:44 +02:00
Kristiyan Kostadinov
1400e5589d docs: update schematic authoring guide to use new utilities (#50667)
Updates the guide for writing `ng add` schematics to include the new authoring utilities. I've also removed the `NodePackageInstallTask` because it's redundant.

PR Close #50667
2023-06-12 19:15:45 +02:00
Kristiyan Kostadinov
fa1e371fce build: update AIO to Angular 16.1 (#50667)
Updates AIO to Angular 16.1.0 to allow for some docs to be updated.

PR Close #50667
2023-06-12 19:15:45 +02:00
Miles Malerba
9429f96f62 test(compiler): Prevent back-sliding on already passing template pipeline tests (#50582)
Add a flag to disable specific tests when testing the template pipeline

Mark the currently failing tests

Add the template pipeline tests to CI

Update package.json

Co-authored-by: Paul Gschwendtner <paulgschwendtner@gmail.com>

PR Close #50582
2023-06-12 18:25:41 +02:00
Pawel Kozlowski
d773589ed2 build: bump up zone.js version for the release (#50680)
The zone.js release commit didn't update the zone.js version
in the package.json so this change fixes it.

PR Close #50680
2023-06-12 17:50:31 +02:00
JiaLiPassion
8eecc0f773 release: cut the zone.js-v0.13.1 release (#50636)
PR Close #50636
2023-06-12 15:48:54 +02:00
Angular Robot
b8a710d605 build: update io_bazel_rules_sass digest to 6e0915e (#50605)
See associated pull request for more information.

PR Close #50605
2023-06-12 15:36:32 +02:00
alkavats1
afb7ea4e8c refactor: removed the unused contructor in lazyModule (#50536)
empty constructor removed and reduced the codesmells

PR Close #50536
2023-06-12 15:35:35 +02:00
Kevin Gay
d5a8ff39b9 build: Update Glob to fast-glob to remove Inflight due to memory leak (#50632)
Update Glob to fast-glob to remove the dependence of Inflight that contains a memory leak

Signed-off-by: Kevin Gay <5970002+GayKevin@users.noreply.github.com>

PR Close #50632
2023-06-12 15:33:47 +02:00
Angular Robot
7166ed17a2 build: update dependency build_bazel_rules_nodejs to v5.8.3 (#50666)
See associated pull request for more information.

PR Close #50666
2023-06-12 15:28:51 +02:00
Matthieu Riegler
d5331c028a docs: update first-app (#50663)
This commit updates the first-app demo to v16.

PR Close #50663
2023-06-12 15:22:27 +02:00
Nate Radebaugh
d23b03d221 docs(core): Add note about testing to NG0203 (#50620)
When running into NG0203 while testing, a solution can be to wrap the
function in the TestBed.runInInjectionContext method.

PR Close #50620
2023-06-12 15:21:10 +02:00
Hadi
9a172a9345 docs: update first-app-lesson-11.md to include info about routerLink (#50348)
Add info about importing RouterLink and RouterOutlet.

The existing document results in an error. The error indicates that the anchor element doesn't have the binding property for routerLink.

The corresponding module (RouterModule) should be imported in the component template.

Add description for RouterModule in housing-location component

The description is added to fix the issue with the anchor element tag binding.

PR Close #50348
2023-06-12 14:26:03 +02:00