Commit graph

31249 commits

Author SHA1 Message Date
Doug Parker
474163cd1d refactor(compiler): add expression serializer (#58176)
This serializes the expression AST back into a string. This is useful to normalize whitespace in expressions so i18n messages are not affected by insignificant changes (such as going from `{{ foo }}` to `{{\n  foo\n}}`).

PR Close #58176
2024-10-16 06:42:37 +00:00
Alex Rickabaugh
7f0b49d8c4 refactor(core): update effect error handling (#57952)
Previously, effect() would handle errors differently depending on the effect
type. Root effects had a try/catch that would execute them independently and
report errors to `ErrorHandler`, while component effects would "crash" CD.

This commit switches all effects to use the same error handling (errors
always reach the CD error handler).

An additional unrelated refactoring is thrown in which removes the
`pendingTask` machinery from root effects, since they make `ApplicationRef`
dirty and thus trigger the scheduler.

PR Close #57952
2024-10-15 13:02:10 -07:00
Jessica Janiuk
d760cbe71b refactor(core): Update interfaces for handling defer completion (#58206)
This adds properties to the LDeferBlockDetails and ensures the completion functions exist for future incremental hydration use cases.

PR Close #58206
2024-10-15 16:49:27 +00:00
Alan Agius
73c95f521c docs: update browserslist config to include last 2 Android major versions (#58186)
See: https://github.com/angular/angular-cli/pull/28620 for more context.

PR Close #58186
2024-10-15 16:48:58 +00:00
Joey Perrott
780df34d4a ci: run the proper command for post update tasks in renovate (#58207)
Properly run the ng-dev command instead of calling for a yarn script

PR Close #58207
2024-10-15 16:47:58 +00:00
Matthieu Riegler
9ab663e7a2 refactor(migrations): Port standalone migration to standalone by default (#58169)
With this commit, the standalone migration will only migrate code with `standalone: false` to standalone by default (without the standalone attribute)

PR Close #58169
2024-10-15 16:05:14 +00:00
Matthieu Riegler
7ed566524d refactor(compiler-cli): Migrate manually ngtsc tests to standalone by default (#58169)
This commit is part of the migration to standalone by default.

PR Close #58169
2024-10-15 16:05:14 +00:00
Matthieu Riegler
b631bb4111 refactor(compiler-cli): Update Golden partials (#58169)
After flipping the standalone default value, this is reflected in the partial output result.

PR Close #58169
2024-10-15 16:05:14 +00:00
Matthieu Riegler
4157bf0c4e refactor(upgrade): update API golden. (#58169)
`UpgradeComponent` is meant to be used as a subclass, it doesn't need to disable `standalone`.

PR Close #58169
2024-10-15 16:05:14 +00:00
Matthieu Riegler
a34090bc71 refactor(compiler): dynamic default for the partial compiler. (#58169)
Use `semver` in the partial compiler to decide on a default value

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

PR Close #58169
2024-10-15 16:05:14 +00:00
Matthieu Riegler
6b8c494d05 feat(core): flipping the default value for standalone to true (#58169)
With this commit directives, components & pipes are standalone by default.

To be declared in an `NgModule`, those require now `standalone: false`.

PR Close #58169
2024-10-15 16:05:14 +00:00
Paul Gschwendtner
bf9fd31e2e refactor(migrations): wire up best effort and insert TODO flag for queries migration (#58190)
Wires up the new migration flags for the `ng generate` queries migration
entry-point.

PR Close #58190
2024-10-15 13:49:22 +00:00
Paul Gschwendtner
1210c3699d refactor(migrations): add statistics to query migration (#58190)
Adds statistics to the query migration.

PR Close #58190
2024-10-15 13:49:22 +00:00
Paul Gschwendtner
0399ffcf44 refactor(migrations): remove outdated TODOs in queries migration (#58190)
These TODOs are no longer relevant.

PR Close #58190
2024-10-15 13:49:22 +00:00
Paul Gschwendtner
280e240f5f refactor(migrations): improve safety of queries migration when dealing with union types (#58190)
When dealing with union types of queries, we should be conservative in
the default mode and skip migration. That is because `viewChild()`
always includes `undefined`, but we cannot trivially emulate the
behavior where it was initially set to `null` (as an alternative to
`undefined`). Those queries can still be migrated via best effort
mode.

PR Close #58190
2024-10-15 13:49:21 +00:00
Paul Gschwendtner
a748cb06f5 refactor(migrations): move queries problematic pattern check to analyze stage (#58190)
This will improve cross-target problematic pattern detection, with
batch execution.

Notably, unfortunately, the inheritance checking is still suboptimal for
the queries migration, simply because we don't know what fields are
queries during analyze stage. Theoretically we could track all edges of
classes/fields and filter out irrelevant edges during merge phase, but
this seems out of scope for now.

Signal inputs has the fully working checks. Only issue I can see is that
we don't properly propagate incompatibilities from derived to base
classes. This hasn't come up much though, so may be a follow-up based on
need.

PR Close #58190
2024-10-15 13:49:21 +00:00
Matthieu Riegler
97c44a1d6c feat(core): Promote takeUntilDestroyed to stable. (#58200)
`takeUntilDestroyed` is now part of the public API.

PR Close #58200
2024-10-15 12:52:26 +00:00
Paul Gschwendtner
b4de7acbf5 refactor(migrations): improve heuristic of untyped .componentInstance in signal migrations (#58191)
We currently extend `.componentInstance` accesses (which are `any` for
`DebugElement`). We are doing this for `By.directive(T)` invocations,
but can expand this for other common expressions like with harnesses.

E.g.

`harness.query(T).componentInstance`.

PR Close #58191
2024-10-15 12:08:53 +00:00
Daniel Sogl
6782acb007 docs: fix changelog typo (#58188)
PR Close #58188
2024-10-15 07:21:50 +00:00
Angular Robot
711e82e48f build: update scorecard action dependencies (#58202)
See associated pull request for more information.

PR Close #58202
2024-10-15 06:38:06 +00:00
Jessica Janiuk
9224f9b043 refactor(core): Add mouseover to hover dom triggers (#58197)
Unfortunately mouseenter is a synthetic event, meaning it does not bubble in the same ways. So mouseover needs to be included in this list in order to get proper browser replayability of the mouse hovering events.

PR Close #58197
2024-10-14 14:27:04 -07:00
Jessica Janiuk
d8b5f4e0c2 refactor(core): restructure hydration test files (#58196)
This re-organizes the hydration tests to make it easier to add new tests. Incremental hydration can have tests in a separate file after this groundwork is landed.

PR Close #58196
2024-10-14 14:26:26 -07:00
Jessica Janiuk
d6a8d35aec refactor(core): Update defer scheduler to use injector (#58195)
This updates the functions for defer scheduler triggers to use a passed in injector instead of an lview.

PR Close #58195
2024-10-14 14:25:51 -07:00
Matthieu Riegler
517da9532c refactor(core): Setup constant for standalone default value (#58175)
This commit is part of the migration to standalone by default and sets up 2 files with a default value for standalone. They are still `false` in this case to land the change into G3 first. The switch to `true` will be executed in a follow-up PR.

PR Close #58175
2024-10-14 16:01:41 +00:00
Charles Lyding
bbca205d5e refactor(compiler): adjust HMR initializer block for improved Vite support (#58173)
For the HMR initializer block to support being used in a Vite setup with
import analysis, the import call expression needs to be a runtime generated
value and include the `@vite-ignore` special comment. Without the first,
Vite will error prior to loading the application. Without the second, a
warning will be shown for each import which is effectively each component
within the application when HMR is enabled.

PR Close #58173
2024-10-14 15:21:40 +00:00
Charles Lyding
4a6c6505d9 refactor(compiler): support generating URL expressions with dynamic imports (#58173)
The compiler's AST factories now support generating a dynamic import call
expression with either a string literal or an expression. The later is useful
for cases where the URL is dynamically created at runtime. Also, a leading
comment can now be added to the URL for cases where bundler behavior
needs to be included via special comments.

PR Close #58173
2024-10-14 15:21:40 +00:00
Matthieu Riegler
c42759b7a0 refactor(compiler-cli): Update compliance golden partials (#58160)
This commit is part of the update to standalone by default

PR Close #58160
2024-10-14 14:58:58 +00:00
Matthieu Riegler
c7fac7eecb refactor(language-service): Migrate manually ngtsc tests to standalone by default (#58160)
This commit is part of the migration to standalone by default.

PR Close #58160
2024-10-14 14:58:58 +00:00
Matthieu Riegler
7aa3097ab6 refactor(compiler-cli): Migrate manually ngtsc tests to standalone by default (#58160)
This commit is part of the migration to standalone by default.

PR Close #58160
2024-10-14 14:58:58 +00:00
Matthieu Riegler
afcc3ee209 refactor(core): Migrate modules directory with the schematic. (#58160)
All components, directives and pipes will now use standalone as default. Non-standalone decorators have now .

PR Close #58160
2024-10-14 14:58:58 +00:00
Matthieu Riegler
e85021a7ba build: Migrate all integration tests with the schematic. (#58160)
All components, directives and pipes will now use standalone as default. Non-standalone decorators have now .

PR Close #58160
2024-10-14 14:58:58 +00:00
Matthieu Riegler
30766d6b77 refactor(devtools): Migrate with the schematic. (#58160)
All components, directives and pipes will now use standalone as default. Non-standalone decorators have now .

PR Close #58160
2024-10-14 14:58:57 +00:00
Matthieu Riegler
7cd0e8d575 refactor(docs-infra): Migrate with schematic. (#58160)
All components, directives and pipes will now use standalone as default. Non-standalone decorators have now .

PR Close #58160
2024-10-14 14:58:57 +00:00
Matthieu Riegler
09df589e31 refactor(core): Migrate all packages with the explicit-standalone-flag schematic. (#58160)
All components, directives and pipes will now use standalone as default.
Non-standalone decorators have now `standalone: false`.

PR Close #58160
2024-10-14 14:58:57 +00:00
Daniel Kimmich
9373c983fe docs: remove word repetition (#58187)
PR Close #58187
2024-10-14 13:19:41 +00:00
Doug Parker
ba4340875a fix(compiler): ignore placeholder-only i18n messages (#58154)
Message which only contain a single placeholder cannot be translated, there is no static text to be translated. Therefore these messages can be skipped and shouldn't be extracted at all.

Ideally, Angular would throw an error if a message is only a placeholder, since it should not contain an `i18n` attribute at all. However this would be a breaking change and require a migration which isn't in scope right now. We can explore converting this to a hard error sometime in the future.

PR Close #58154
2024-10-13 16:48:34 +00:00
Paul Gschwendtner
37e3b03b52 refactor(migrations): improve readability of strictness logic in input migration (#58168)
This commit improves readability/reasoning of the input converting logic
that does things differently based on strictness flags.

PR Close #58168
2024-10-13 16:47:03 +00:00
Paul Gschwendtner
7e785588a7 refactor(migrations): gracefully proceed migration if there is an invalid query (#58168)
In rare cases, there may be queries that fail Angular compiler-cli
extraction. This should not prevent migration of other queries and
instead be a graceful error.

PR Close #58168
2024-10-13 16:47:03 +00:00
Paul Gschwendtner
2cf88bba9a refactor(language-service): add support for running best-effort queries refactoring (#58168)
This is a follow-up to the VSCode queries code refactoring feature. This
commit adds support for running the refactoring with
`--best-effort-mode`.

PR Close #58168
2024-10-13 16:47:03 +00:00
Paul Gschwendtner
10d294c9d9 refactor(migrations): do not migrate .toArray, .first if query is skipped (#58168)
If a query is skipped for incompatibility reasons, we should not migrate
their `toArray`, `.first` references

PR Close #58168
2024-10-13 16:47:03 +00:00
Paul Gschwendtner
f48354af0b refactor(migrations): support inserting TODOs for queries migration (#58168)
Allows users to enable TODO insertion to see why certain queries did not
get migrated.

PR Close #58168
2024-10-13 16:47:03 +00:00
Paul Gschwendtner
4b089621be refactor(migrations): share TODO insertion logic of input migration (#58168)
This allows us to re-use the same logic in the queries migration.

PR Close #58168
2024-10-13 16:47:03 +00:00
Paul Gschwendtner
a141ee8fb2 refactor(migrations): add best-effort-mode for queries migration (#58168)
Allows users to ignore detected incompatibilities and migrate as much as
possible. Similar to the input migration.

PR Close #58168
2024-10-13 16:47:02 +00:00
Paul Gschwendtner
19369d78ba refactor(migrations): share best effort logic between input and query migration (#58168)
Allows us to easily implement a best effort mode for both migrations.

PR Close #58168
2024-10-13 16:47:02 +00:00
Paul Gschwendtner
349de49964 refactor(migrations): properly detect and skip queries with accessors (#58168)
Currently the migration does not detect queries declared on accessors.
This is fine as we cannot migrate them anyway.

We should still try to detect them and mark them as incompatible so that
we could insert TODOs.

PR Close #58168
2024-10-13 16:47:02 +00:00
Paul Gschwendtner
f84e8ddcd9 ci: disable bazel-saucelabs job (#58162)
Disables the `bazel-saucelabs` job in `main`, and re-uses the PR legacy
saucelabs job to run on `main` instead (which is much more stable and
reliable).

PR Close #58162
2024-10-11 14:07:35 +00:00
Paul Gschwendtner
a59dbb7cd6 refactor(migrations): assign incompatibility reasons for query migration (#58152)
Instead of skipping queries without any reasoning, we should categorize
fields that couldn't be migrated. This is also important for the VSCode
integration— similar to how it's done with the inputs migration.

We are fully sharing the problematic pattern detection etc. This means
we are also sharing the enum. Not super ideal, but enables the best
sharing of code.

PR Close #58152
2024-10-11 11:23:38 +00:00
Angular Robot
b1985932e7 build: update io_bazel_rules_sass digest to 583fc8c (#58155)
See associated pull request for more information.

PR Close #58155
2024-10-11 10:37:56 +00:00
Kristiyan Kostadinov
fc6c76ac67 refactor(core): add internal utility to resolve the component name of a node (#58148)
Adds a utility, meant for internal consumption, that will return the class name of the closest component node to an element.

PR Close #58148
2024-10-11 07:04:40 +00:00
Kristiyan Kostadinov
fb44323c51 fix(compiler-cli): incorrectly generating relative file paths on case-insensitive platforms (#58150)
We're using `path.relative` to compute a relative path between a `SourceFile` and the one of the `rootDirs`. The problem is that the `rootDirs` get passed through `getCanonicalFileName` which lowercases the path in some platforms, while `SourceFile.fileName` is always case-insensitive. This yields a path outside of the project which we were ignoring.

This change passes the `SourceFile.fileName` before passing it through `path.relative` to ensure that we get a valid result.

PR Close #58150
2024-10-11 07:03:15 +00:00