28731 Commits

Author SHA1 Message Date
Dylan Hunn 049e4ab596 release: cut the v17.0.6 release 17.0.6 2023-12-06 10:15:26 -08:00
Jessica Janiuk e8d01f995b refactor(migrations): Update comments to be more accurate (#53396)
This comment change better clarifies what these regexes do which should alleviate future confusion.

PR Close #53396
2023-12-06 09:45:44 -08:00
Andrew Scott c509ba43f1 Revert "Revert "fix(router): Ensure canMatch guards run on wildcard routes (#53239)" (#53339)" (#53342)
This reverts commit ac8eb5b943.

PR Close #53342
2023-12-06 09:44:19 -08:00
Dylan Hunn aaf199f282 refactor(compiler): Support unary ops in template pipeline (#53376)
Template Pipeline can now ingest and emit unary ops, such as `+` and `-`.

PR Close #53376
2023-12-06 09:43:36 -08:00
Dylan Hunn 648edaa508 refactor(compiler): template pipeline support for i18n blocks (#53376)
Blocks can contain i18n expressions. We already have most of the logic to make them work; we were just missing some ingestion code.

PR Close #53376
2023-12-06 09:43:36 -08:00
Dylan Hunn 755356c1bc refactor(compiler): Separate ownership and target for i18n expressions, and various refactors (#53376)
I18n expressions logically have both a target and an owner:
- For i18n text expressions, the owner is the i18nStart instruction. The target is initially the same, but later moves to be the last slot consumer in the i18n block.
- For i18n attribute expressions, the owner is the I18nAttributes config instruction, whereas the target is the ElementCreate that hosts the attribute.

This refactor makes the code clearer in quite a few plases.

Additionally, we now perform a lot of the i18n processing earlier. For example, re-targeting and re-ordering of i18n expressions happens *before* apply instructions are generated. As a result, the re-ordering logic is a lot simpler.

These changes also have consequences on i18n const collection, along with a couple other minor changes.

PR Close #53376
2023-12-06 09:43:36 -08:00
Kristiyan Kostadinov 66ecf4c274 fix(compiler-cli): add compiler option to disable control flow content projection diagnostic (#53387)
These changes add an option to the `extendedDiagnostics` field that allows the check from #53190 to be disabled. This is a follow-up based on a recent discussion.

PR Close #53387
2023-12-06 09:43:10 -08:00
Kristiyan Kostadinov 74e6ce5d23 fix(compiler-cli): add diagnostic for control flow that prevents content projection (#53387)
This is a follow-up to the fix from #52414. It adds a diagnostic that will tell users when a control flow is preventing its direct descendants from being projected into a specific component slot.

PR Close #53387
2023-12-06 09:43:10 -08:00
Kristiyan Kostadinov cfa80dc107 test(core): add tests for control flow content projection with ng-container (#53387)
The control flow projection diagnostic will mention `ng-container` as a workaround for projection multiple nodes. These changes add a couple of tests to ensure that the approach works.

PR Close #53387
2023-12-06 09:43:10 -08:00
Kristiyan Kostadinov ec9cc38015 refactor(compiler-cli): expose ng-content selectors and preserveWhitespaces during template type checking (#53387)
These changes expose the `ngContentSelectors` and `preserveWhitespaces` metadata to the TCB so they can be used in the next commit to implement a new diagnostic.

PR Close #53387
2023-12-06 09:43:10 -08:00
Kristiyan Kostadinov cbbd9f3f19 refactor(compiler): expose utility for creating CSS selectors from AST nodes (#53387)
When doing directive matching in the compiler, we need to be able to create a selector from an AST node. We already have the utility, but these changes simplify the public API and expose it so it can be used in `compiler-cli`.

PR Close #53387
2023-12-06 09:43:10 -08:00
Jessica Janiuk 836aeba01d fix(migrations): Change CF Migration ng-template placeholder generation and handling (#53394)
Using more unique characters makes it easier to parse placeholders that may contain JS logic, making it more flexible.

fixes: #53386
fixes: #53385
fixes: #53384

PR Close #53394
2023-12-06 09:42:43 -08:00
Alex Rickabaugh d4fdba5679 Revert "refactor(core): output an error guide link in prod mode (#53324)" (#53392)
This reverts commit f245aba782.

Reason: breaks g3

PR Close #53392
2023-12-06 07:23:24 -08:00
Matthieu Riegler 7c863d728c refactor(devtools): run control flow migration. (#53353)
Let's update the devtools with the latest improvements !

PR Close #53353
2023-12-05 17:20:09 -08:00
Jessica Janiuk 2a4e3f5373 fix(migrations): handle templates outside of component in cf migration (#53368)
If a template is passed in as an input, the ng-template will not exist in the same component template. This will leave a template placeholder behind. This fix ensures that template placeholder gets turned into a template outlet.

fixes: #53361

PR Close #53368
2023-12-05 17:19:37 -08:00
Jessica Janiuk 5104a89b30 fix(migrations): handle nested ng-template replacement safely in CF migration (#53368)
When there are ng-templates nested inside other ng-templates, the replacement and removal of the templates gets disrupted. Re-processing the templates in the file along the way resolves this issue.

fixes: #53362

PR Close #53368
2023-12-05 17:19:37 -08:00
Dylan Hunn 708131dc01 refactor(compiler): Initial support for i18n attributes (#53341)
Add support for i18n attributes:
- Generate i18n contexts from i18n attributes, and extract the eventual messages into the constant pool.
- Emit I18nAttributes config instructions when needed.
- Use the generated i18n variable in the appropriate places, including extracted attribute instructions, as well as I18nAttributes config arrays.

PR Close #53341
2023-12-05 17:13:59 -08:00
Matthieu Riegler 20ea149a85 refactor(devtools): enables typescript strict option (#53340)
Enabling `strict` is part of an effort to improve the quality of the devtools code base.
One of the direct side effect is to enable `noImplicitAny`, `strictPropertyInitialization` and `strictBindCallApply`.

This commit also replaces `fullTemplateTypeCheck` with `stringTemplates`.

PR Close #53340
2023-12-05 12:42:56 -08:00
Srinath Vayalpati 2d2eaec2ae docs: fixed wrong template string placeholder (#53286)
PR Close #53286
2023-12-04 21:50:35 -08:00
Joey Perrott 40e8577faf build: set up markdown pipeline for the reference section (#53290)
Set up the markdown pipeline to include the required source files.

PR Close #53290
2023-12-04 21:47:14 -08:00
Joey Perrott dae3e24d14 build: set up markdown pipeline for the tools section (#53290)
Set up the markdown pipeline to include the required source files.

PR Close #53290
2023-12-04 21:47:14 -08:00
Joey Perrott 036a2fdc0c build: set up markdown pipeline for service-workers section (#53290)
Set up the markdown pipeline to include the required source files.

PR Close #53290
2023-12-04 21:47:14 -08:00
Joey Perrott 9140b027fa build: set up markdown pipeline for runtime-performance part of the best-practices section (#53290)
Set up the markdown pipeline to include the required source files.

PR Close #53290
2023-12-04 21:47:13 -08:00
Joey Perrott 857f29b9e9 build: set up markdown pipeline for best-practices section (#53290)
Set up the markdown pipeline to include the required source files.

PR Close #53290
2023-12-04 21:47:13 -08:00
Joey Perrott 1e424863eb build: set up markdown pipeline for introduction section (#53290)
Set up the markdown pipeline to include the required source files.

PR Close #53290
2023-12-04 21:47:13 -08:00
Joey Perrott 8fc9ff0e9e build: set up markdown pipeline for essentials of the introduction section (#53290)
Set up the markdown pipeline to include the required source files.

PR Close #53290
2023-12-04 21:47:13 -08:00
Joey Perrott cb460f81cc build: set up markdown pipeline for testing directory of the content guide (#53290)
Set up the markdown pipeline to include the required source files.

PR Close #53290
2023-12-04 21:47:13 -08:00
Joey Perrott a18b6b9284 build: set up markdown pipeline for templates directory of the content guide (#53290)
Set up the markdown pipeline to include the required source files.

PR Close #53290
2023-12-04 21:47:13 -08:00
Joey Perrott ef553363da build: set up markdown pipeline for signals directory of the content guide (#53290)
Set up the markdown pipeline to include the required source files.

PR Close #53290
2023-12-04 21:47:13 -08:00
Joey Perrott 4736efc94f build: set up markdown pipeline for pipes directory of the content guide (#53290)
Set up the markdown pipeline to include the required source files.

PR Close #53290
2023-12-04 21:47:12 -08:00
Joey Perrott 069dcd11c8 build: set up markdown pipeline for routing directory of the content guide (#53290)
Set up the markdown pipeline to include the required source files.

PR Close #53290
2023-12-04 21:47:12 -08:00
Joey Perrott 0d7f679d0f build: set up markdown pipeline for ngmodules directory of the content guide (#53290)
Set up the markdown pipeline to include the required source files.

PR Close #53290
2023-12-04 21:47:12 -08:00
Joey Perrott 24c4c77870 build: set up markdown pipeline for i18n directory of the content guide (#53290)
Set up the markdown pipeline to include the required source files.

PR Close #53290
2023-12-04 21:47:12 -08:00
Joey Perrott cb34d35db7 build: set up markdown pipeline for http directory of the content guide (#53290)
Set up the markdown pipeline to include the required source files.

PR Close #53290
2023-12-04 21:47:12 -08:00
Joey Perrott 7af3237935 build: set up markdown pipeline for forms directory of the content guide (#53290)
Set up the markdown pipeline to include the required source files.

PR Close #53290
2023-12-04 21:47:12 -08:00
Joey Perrott 6312d63b47 build: set up markdown pipeline for directives directory of the content guide (#53290)
Set up the markdown pipeline to include the required source files.

PR Close #53290
2023-12-04 21:47:11 -08:00
Joey Perrott 7e2fe81b74 build: set up markdown pipeline for di directory of the content guide (#53290)
Set up the markdown pipeline to include the required source files.

PR Close #53290
2023-12-04 21:47:11 -08:00
Joey Perrott 86f0f4adf8 build: set up markdown pipeline for components directory of the content guide (#53290)
Set up the markdown pipeline to include the required source files.

PR Close #53290
2023-12-04 21:47:11 -08:00
Joey Perrott 90625890c0 build: fix name for animations markdown target (#53290)
Use the animations name as the target name instead of test

PR Close #53290
2023-12-04 21:47:11 -08:00
Joey Perrott bc1d323345 build: set up markdown pipeline for root directory of the content guide (#53290)
Set up the markdown pipeline to include the required source files.

PR Close #53290
2023-12-04 21:47:11 -08:00
Kristiyan Kostadinov 6ec7a42b95 fix(compiler-cli): avoid conflicts with built-in global variables in for loop blocks (#53319)
Currently we generate the following TCB for a `@for` loop:

```ts
// @for (item of items; track item) {...}

for (const item of this.items) {
  var _t1 = item;
  // Do things with `_t1`
}
```

This is problematic if the item name is the same as a global variable (e.g. `document`), because when the TCB has references to that variable (e.g. `document.createElement`), it'll find the loop initializer instead of the global variable.

These changes fix the issue by generating the following instead:

```ts
for (const _t1 of this.items) {
  // Do things with `_t1`
}
```

Fixes #53293.

PR Close #53319
2023-12-04 21:45:18 -08:00
Andrew Kushnir 187ba05f1e refactor(core): skip disconnected nodes while computing node path for hydration (#53317)
In certain cases Angular hydration logic can not rely on the order in which elements are present in a template (for example, in content-projection use-cases) and there is a need to serialize a path from one node to another, so that hydration can locate an element on a page. The logic attempts to use an immediate parent element as an anchor and compute the path from it. If it fails - the path is computed starting from the <body> (this is a fallback).

This commit updates the logic to walk up the parents tree if an immediate parent (from a template) is disconnected from the DOM. This helps to shorten the lookup path and make it more stable.

PR Close #53317
2023-12-04 21:44:08 -08:00
Tomasz Ducin 25cfccbadf refactor(devtools): filtering providers by token within "injector tree" tab (#53313)
In some injectors, there are LOTS of providers, making it slightly inconvenient to search for a certain one. This commit introduces a search-by-token for providers of a specific injector.

PR Close #53313
2023-12-04 21:43:34 -08:00
Jessica Janiuk 26e40c7f89 fix(migrations): CF Migration fix missing alias for bound ngifs (#53296)
Empty aliases are considered the item in an ngFor, and ngIf was skipping that value.

fixes: #53291

PR Close #53296
2023-12-04 21:42:58 -08:00
Andrew Kushnir 493c412706 refactor(core): output an error guide link in prod mode (#53324)
Currently, the link to an error guide is only included into an error message in dev mode. This change makes the `Find more at https://angular.io/errors/NG0XYZ` appear in the error message even in prod mode. Note: the rest of the error message is still tree-shaken away in prod mode (as it happens today).

PR Close #53324
2023-12-04 21:42:28 -08:00
Jessica Janiuk 0db75ab5b1 fix(migrations): remove setting that removes comments in CF migration (#53350)
This setting was added to prevent comment duplication, since the TS AST printer includes prior line comments as part of a given line with no way to really avoid that.
However in component imports, it is not safe to remove comments as they could be load bearing for some.

PR Close #53350
2023-12-04 21:41:41 -08:00
JoostK 0a53f96094 fix(core): cleanup signal consumers for all views (#53351)
This commit fixes a memory leak where signal consumers would not be cleaned up for
descendant views when a view is destroyed, because the cleanup logic was only invoked
for the view that is itself being destroyed.

PR Close #53351
2023-12-04 21:41:13 -08:00
Miles Malerba dc27bea972 test(compiler): Update golden partial file (#53327)
Update the golden partial file to include the newly added tests in this
PR.

PR Close #53327
2023-12-04 14:24:22 -08:00
Miles Malerba 326a6023ca refactor(compiler): Fix structural directive i18n placeholders (#53327)
Previously we recorded separate param values for a strucural directive
and the element tag it goes on. We then later attempted to combine those
into a single value. However in some cases this merging logic matched
the directive with the wrong tag.

This change implements an alternate approach where we match the
directive to its element tag from the start, while we're traversing the
ops. This should be a more robust solution.

PR Close #53327
2023-12-04 14:24:22 -08:00
Miles Malerba ea4c9b5dcb refactor(compiler): Add missing projection arguments (#53327)
We previously failed to populate the attributes property on projection
ops, this commit populates it and later strips out the "select"
attribute.

PR Close #53327
2023-12-04 14:24:22 -08:00