Commit graph

29561 commits

Author SHA1 Message Date
Matthieu Riegler
87ef880ed3 refactor(core): cleanup DebugElement (#50896)
* `style` is never `null`.
* adding some typing
* Add 2 todos per #49777

PR Close #50896
2023-10-13 12:24:15 +02:00
Matthieu Riegler
a0dc12bfe8 refactor(core): deprecate the NgProbeToken (#51396)
DEPRECATED: NgProbeToken

The `NgProbeToken` is not used internally since the transition from View Engine to Ivy. The token has no utility and can be removed from applications and libraries.

PR Close #51396
2023-10-13 12:19:05 +02:00
Ward Bell
f2513c540a docs: Phase 2 Sample Code Conversions to Standalone (#51918)
Phase 2 sample code conversions per instructions in doc: https://docs.google.com/document/d/1QqnVK8Mc0O1gU9ctPrs-JJ42V9_dHCuEttD_01pXh34/edit

**Included**

1. ajs-quick-reference

Minor changes to remove references to NgModule. Converted sample to standalone.

2. architecture

Migrated the code sample. Made minor changes to remove references to NgModule. I explicitly deprecated the `architecture-module.md` page and removed it from the navigation.

4. deprecations / deprecations-guide

Migrated the code sample which required pulling NgModule and Reactive Forms material into a new `deprecated` folder. Made minor changes to clarify when advice was specific to NgModule (see `loadChildren` in particular).

5. displaying-data

Deleted this `displaying-data` sample entirely as there is no need for a sample app just to display a single, vanilla data binding in the deprecated `zone.md` page. Replaced reference in `zone.md` with an inline code snippet.

10. ngcontainer

Converted the code sample. There is no guide page for this sample. It can be displayed in Stackblitz

**Excluded**

3. cli-builder

Code sample is not an app; nothing to convert.

6-9 - related to getting-started and setup.

Waiting until Angular team is ready to proceed.

11. providers

This is in its own commit and PR 51918 because it may not make sense to convert. See that PR for details.

12. routing-with-urlmatcher

No work needed. Already Standalone.

13 schematics-for-libraries

Non-trivial (see doc notes) and Angular may decide to leave as is. Should have own PR.

14 setup

Non-trivial (see doc notes) and Angular may decide to leave as is. Should have own PR.

PR Close #51918
2023-10-13 11:20:08 +02:00
Kristiyan Kostadinov
4d83a2ea00 refactor(core): clean up viewport trigger event tracking (#52156)
When the `viewport` triggers were first introduced, we ended up having to use a service to keep track of them, because using the same global event handling as the other events led to some inconsistent test failures. It looks like the failures were caused by the same bug fixed #52115 so now we can switch back to the previous approach which is a bit more compact.

PR Close #52156
2023-10-13 11:16:26 +02:00
Miroslav Foltýn
187f1439bb docs(router): add clarification for behavior of paramsInheritanceStrategy: 'emptyOnly' (#52170)
Follows up to the https://github.com/angular/angular/issues/52108 which was opened due to the confusion surrounding paramsInheritanceStrategy: 'emptyOnly'.

PR Close #52170
2023-10-13 11:14:19 +02:00
Andrew Kushnir
efea62fc41 test(core): verify directive order inside and outside of @defer blocks (#52194)
This test verifies that the order does not change when a particular part of code is wrapped by the `@defer` block.

PR Close #52194
2023-10-13 11:10:20 +02:00
cexbrayat
20e7e21679 fix(core): do not remove used ng-template nodes in control flow migration (#52186)
This fixes an issue where `ng-template` nodes were removed even when used in other places than control flow directives.

Template to migrate:
```html
<ng-template #blockUsedElsewhere><div>Block</div></ng-template>
<ng-container *ngTemplateOutlet="blockUsedElsewhere"></ng-container>
```

Before:
```html
<ng-container *ngTemplateOutlet="blockUsedElsewhere"></ng-container>
```

After:
```html
<ng-template #blockUsedElsewhere><div>Block</div></ng-template>
<ng-container *ngTemplateOutlet="blockUsedElsewhere"></ng-container>
```

PR Close #52186
2023-10-12 19:28:23 +02:00
Jessica Janiuk
c121d3992a refactor(core): Add better error handling to control flow migration (#52189)
This adds some clear error handling and messaging for when errors occur during the control flow migration.

PR Close #52189
2023-10-12 19:27:00 +02:00
cexbrayat
37c8fd79ac fix(core): handle for alias with as in control flow migration (#52183)
This adds the support of `let index as myIndex` in `*ngFor` for the control flow migration.

Before: `@for (itm of items; track itm)`
After: `@for (itm of items; track itm; let myIndex = $index)`

PR Close #52183
2023-10-12 19:15:19 +02:00
Matthieu Riegler
1c4a3677eb refactor(animations): make AnimationBuilder tree-shakable (#52097)
This commit allows also to use the `AnimationBuilder` when using `provideAnimationsAsync()`

fixes #52096

PR Close #52097
2023-10-12 18:13:22 +02:00
Nicolas Frizzarin
f3eebaf76c docs: add Nicolas Frizzarin to GDE resources (#52003)
This PR add Nicolas Frizzarin to the GDE resources

docs: fix typo on description

PR Close #52003
2023-10-12 17:44:41 +02:00
cexbrayat
b1cb0b395b fix(common): missing space in ngSwitch equality warning (#52180)
This adds a missing space between the sentences of the `===` vs `==` ngSwitch warning.

PR Close #52180
2023-10-12 15:44:46 +02:00
Andrew Kushnir
908f660a72 refactor(core): better organization of @defer runtime code (#52152)
This commit splits the `render3/instructions/defer.ts` file (that contained most of the runtime code) into smalle
r files that are easier to maintain.

There are no functional changes in this PR, just organizing code.

PR Close #52152
2023-10-12 12:43:54 +02:00
Angular Robot
11c29f9cc3 build: update cross-repo angular dependencies (#52159)
See associated pull request for more information.

PR Close #52159
2023-10-12 12:42:24 +02:00
Pawel Kozlowski
4da0dbedf5 Revert "refactor(compiler-cli): remove MethodIdentifier type (#49611)" (#52174)
This reverts commit c2b1a242e8.

PR Close #52174
2023-10-12 12:35:48 +02:00
Matthieu Riegler
c2b1a242e8 refactor(compiler-cli): remove MethodIdentifier type (#49611)
`MethodIdentifier` is unused as is `IdentifierKind.Method`. They both can be removed.

PR Close #49611
2023-10-11 12:34:49 -07:00
Angular Robot
221f882b28 docs: update Angular CLI help [main] (#52168)
Updated Angular CLI help contents.

PR Close #52168
2023-10-11 12:19:22 -07:00
Angular Robot
bffee4389b docs: update events (#52053)
Generated `events.json` with the latest events retrieved from the Firebase DB.

PR Close #52053
2023-10-11 12:18:05 -07:00
Matthieu Riegler
0198d21231 fix(compiler): apply style on :host attributes in prod builds. (#49118)
In prod builds, selectors are optimized and spaces a removed. #48558 introduced a regression on selectors without spaces. This commit fixes tihs.

Fixes #49100

PR Close #49118
2023-10-11 11:32:19 -07:00
Andrew Scott
12aeed8b94 docs: release notes for the v17.0.0-next.8 release 2023-10-11 10:19:41 -07:00
Andrew Scott
faad22a3f2 release: bump the next branch to v17.1.0-next.0 2023-10-11 10:19:41 -07:00
Andrew Scott
44a75aa0f8 docs: release notes for the v16.2.9 release 2023-10-11 10:06:23 -07:00
Angular Robot
87340a453d build: update io_bazel_rules_sass digest to 9a327e5 (#52119)
See associated pull request for more information.

PR Close #52119
2023-10-11 09:23:07 -07:00
Pawel Kozlowski
e90694259e perf(core): build-in for should update indexes only when views were added / removed (#52051)
This change adjust the built-in for algorithm of dealing with embedded views
to update the repeater context (and more specifically - its index field)
only when views were added / removed "in the middle of LContainer" (in places
other than the LContainer end).

This skip iteration over the entire LContainer in most cases - and most importantly
in cases where no diff change was detected.
"

PR Close #52051
2023-10-11 09:16:31 -07:00
Jessica Janiuk
f66faca3ce refactor(core): control flow migration cleanup (#52151)
This adds a console warning to make it clear to users the migration is developer preview. It also shuffles around some code for better organization.

PR Close #52151
2023-10-11 09:16:04 -07:00
Linus Wieland
3434359f64 docs(animations): fix typo in state name of keyframes example (#52155)
PR Close #52155
2023-10-11 09:15:03 -07:00
Dylan Hunn
449830f24e feat(language-service): Complete inside @switch (#52153)
We now visit the unknown nodes inside a `@switch` block, enabling completions in that context.

PR Close #52153
2023-10-11 09:14:13 -07:00
Kristiyan Kostadinov
9d19c8e317 fix(compiler): don't allocate variable to for loop expression (#52158)
Currently the compiler allocates a variable slot to the `@for` loop expression which ends up unused since we don't store the result on the `LView`.

PR Close #52158
2023-10-11 09:12:57 -07:00
Paul Gschwendtner
77284d9dd0 ci: run bazel saucelabs job only on push builds
As part of the CircleCI migration it looks like we started
running the Bazel saucelabs job for all pull requests. This
was not done before because we weren't confident with the stability
of this job yet. This commit moves it back so that we don't block
pull requests with a job that is not considered stable.
2023-10-11 13:19:51 +02:00
Paul Gschwendtner
6c02c61399 ci: remove circleci required status from angular robot
The build job moved from CircleCI to GitHub actions, so we currently
mark all PRs as pending unnnecessarily.

In the future, this will be replaced by the unified status check. It's
set up here but was disabled at some point. Needs more investigation.
2023-10-11 13:19:51 +02:00
Jeremy Elbourn
fcc000e803 build: add targets for api doc generation (#52034)
This adds `generate_api_docs` targets to all of the packages for which we publish api reference docs. One known issue here is that any type information that comes from another package (e.g. router depending on core) currently resolve to `any` because the other sources are not available in the program. This can be tackled in a follow-up commit.

This commit also updates the install patch for `@angular/build-tools` to use the local version of compiler-cli.

PR Close #52034
2023-10-10 16:18:50 -07:00
Matthieu Riegler
ddd7212ee2 fix(forms): reset() call with null values on nested group (#48830)
Non typed forms allow to pass null to nested groups when calling `formGroup.reset()`, this commit prevent an undefined access.

fixes #20509

PR Close #48830
2023-10-10 15:34:31 -07:00
Payam Valadkhan
59ba2a6e9f feat(bazel): make forbidOrphanComponents option configurable (#52061)
Now users can configure the option `forbidOrphanComponents` in the tsconfig's angularCompilerOptions part.

PR Close #52061
2023-10-10 15:30:26 -07:00
Payam Valadkhan
1a4aee7e49 feat(core): show runtime error for orphan component rendering (#52061)
A runtime error will be thrown if a non-standalone component is being rendered without its NgModule loaded in the browser. This error is thrown only in dev mode and only if the Angular option `forbidOrphanComponents` is set to true. The error contains useful info to find the orphan component in the source code.

PR Close #52061
2023-10-10 15:30:26 -07:00
Payam Valadkhan
3047bdd36c refactor(core): add an API to deps tracker to check if a component is orphan (#52061)
A new method `isOrphanComponent` is added to the deps tracker API to check if the NgModule declaring this component, if exists, is loaded into the browser.

PR Close #52061
2023-10-10 15:30:26 -07:00
Payam Valadkhan
5fba8902d8 refactor(core): add forbidOrphanRendering option to class debug info (#52061)
The flag `forbidOrphanRendering` is only set for non-standalone components, and indicates that the dev mode runtime should through error if the component is rendered without its ngModule loaded in the browser. This runtime error can help with further debugging.

PR Close #52061
2023-10-10 15:30:26 -07:00
Payam Valadkhan
1eefa0c9c4 refactor(compiler-cli): include forbidOrphanComponents option in component's debug info (#52061)
A new flag added to the component's debug info to determine whether to throw runtime error (in dev mode) if component is being rendered without its NgModule. This flag is only set for non-standalone components.

PR Close #52061
2023-10-10 15:30:26 -07:00
Payam Valadkhan
e8201a5962 refactor(compiler-cli): add a compiler option to enable checking for orphan component (#52061)
Orphan component is an anti-pattern in Angular where a component is rendered while the NgModule declaring it is not installed. It is not easy to capture this scenario, specially in compile time. But it is possible to capture a special case in runtime where the component is being rendered without its NgModule even loaded into the browser. This change adds a flag in cli compiler option to enable such checking, and throwing a runtime exception if it happens. Note that such check is only done in dev mode.

Currently the check requires some generated code that is behind ngJitMode flag (i.e., call to ɵɵsetNgModuleScope), and the new flag can be set only if JIT mode is enabled (i.e., supportJitMode=true) otherwise an error will be thrown.

The orphan component is a main blocker for rolling out local compilation in g3. This option is needed for identifying and isolating such cases.

PR Close #52061
2023-10-10 15:30:26 -07:00
Sylvain DEDIEU
da056a1fe2 fix(common): add missing types field for @angular/common/locales of exports in package.json (#52080)
Add a types entry in the packages/common/package.json exports "./locales/*" section

Fixes #52011

PR Close #52080
2023-10-10 14:33:44 -07:00
Angular Robot
11588a1a07 build: update dependency @types/jasmine to v5 (#52060)
See associated pull request for more information.

PR Close #52060
2023-10-10 14:08:02 -07:00
Kristiyan Kostadinov
5a969e06b7 build: remove Windows CI check (#52140)
Based on recent discussions, these changes remove the Windows CI check because it has been too flaky for too long. Furthermore, we've concluded that the simulated file system in the compiler tests already catches the same set of bugs as running the tests on a real Windows system.

PR Close #52140
2023-10-10 14:07:03 -07:00
Alex Castle
3c4be44f7a docs(core): fix missing text in oversized image warning message (#52147)
add text to fix warning message that trails ends mid-sentence

PR Close #52147
2023-10-10 14:01:23 -07:00
Paul Gschwendtner
496ee47b3d docs: add error guide for assertNotInReactiveContext. (#52138)
Adds an error guide for `assertNotInReactiveContext` and provides some
more context/ and guidance for fixing common errors.

PR Close #52138
2023-10-10 13:56:56 -07:00
Paul Gschwendtner
df58c0b714 fix(core): disallow afterRender in reactive contexts (#52138)
Using `afterRender` schedules long-living lifecycle hooks. Scheduling
such hooks inside reactive contexts could mean that many of the
same hooks would be scheduled, quickly piling up every time a
consumed signal changes. This is likely unintended and could degrade
application performance or result in unexpected behavior.

Additionally, scheduling `afterRender` inside a `computed` is considered
a side effect. Computed expressions are expected to be pure/ i.e. free
of side effects. We can avoid this caveat by detecting the reactive
context in development.

PR Close #52138
2023-10-10 13:56:56 -07:00
Paul Gschwendtner
5d61221ed7 fix(core): disallow using effect inside reactive contexts (#52138)
Using an `effect` inside a `computed` is a clear violation of
the conceptual idea of computed's being pure/ side-effect free.
Additionally, scheduling new effects from an existing actively
running effect is likely unintended as this could degrage application
performance or result in unintentional behaviors. Multiple long-living
effects would be scheduled every time the effect expressions runs.

For these reasons, we are explicitly preventing this pitfal, by
disallowing using `effect` inside reactive contexts.

PR Close #52138
2023-10-10 13:56:56 -07:00
Jeremy Elbourn
a49ee46dae docs(docs-infra): add support for block syntax to dgeni (#52123)
This adds the new block syntax to dgeni docs pipeline, mainly copying
the way that elements (`<ng-content>` etc.) work. Actual doc content is
just a placeholder for this PR.

PR Close #52123
2023-10-10 13:55:04 -07:00
Matthieu Riegler
965ce5a8c5 feat(migrations): Schematics for TransferState, StateKey and makeStateKey migration. (#49594)
These 3 classes have been moved from platform-browser to core by #49563

PR Close #49594
2023-10-10 13:12:36 -07:00
AleksanderBodurri
8b91864d02 test(devtools): create unit tests for injector tree transformation functions (#51719)
Creates set of unit tests for each function in the data transformation pipeline that enables injector metadata to be visualized as d3 graphs.

PR Close #51719
2023-10-10 13:10:50 -07:00
AleksanderBodurri
8bdbbf4510 feat(devtools): Implement initial DI debugging features in devtools (#51719)
This commit introduces 2 new features into DevTools.

Directive level dependency inspection: Users can now view which dependencies their directives have injected in the property viewer tab. This view displays not only the dependency but also the resolution path that was used to service the injection.

Injector graph inspection: Users can now view a visualization of the element and environment hierarchies in their application. These trees are displayed separately but on the same page in the Injector Tree tab. User can click on individual injectors to view a list of all the providers configured in that injector, as well as highlight the resolution path from that injector to the root (with the corresponding environment injector connection highlighted as well).

PR Close #51719
2023-10-10 13:10:50 -07:00
AleksanderBodurri
50ad074505 fix(core): framework debug APIs getDependenciesForTokenInInjector and getInjectorMetadata (#51719)
Previously getDependenciesForTokenInInjector was unable to determine which node on a view serviced a specific injection. Now it is able to filter out those injections that did not come from the specific node for the NodeInjector passed into it.

Previously getInjectorMetadata was incorrectly looking up DOM elements for some directives (for example NgForOf) where an LContainer was created. Now the LContainer case is handled, and the non LContainer case uses `getFirstNativeNode` to more accurately get the element we want.

PR Close #51719
2023-10-10 13:10:50 -07:00