Commit graph

31266 commits

Author SHA1 Message Date
Matthieu Riegler
819ff034ce
feat(core): treat directives, pipes, components as by default (#58229)
BREAKING CHANGE: Angular directives, components and pipes are now standalone by default. Specify  for declarations that are currently declared in s.  for v19 will take care of this automatically.
2024-10-16 17:43:24 +02:00
Dzhavat Ushev
9097b734e5 docs(language-service): fix link URLs (#58143)
PR Close #58143
2024-10-16 14:48:13 +00:00
Matthieu Riegler
3f1e7ab6ae feat(core): promote outputFromObservable & outputToObservable to stable. (#58214)
Alongside the promotion of `output()` to stable, we promote those 2 related interops.

PR Close #58214
2024-10-16 14:45:10 +00:00
Kristiyan Kostadinov
61ba23017f refactor(migrations): clean up logic that marks decorator as standalone (#58216)
Cleans up the logic that was marking a decorator as standalone after some of the recent changes by:
* Reusing some of the existing logic instead of duplicating it.
* Ensuring that we don't drop cases like an explicit `standalone: true`.

PR Close #58216
2024-10-16 12:27:59 +00:00
Kristiyan Kostadinov
5971037613 test(compiler): update failing tests (#58217)
Fixes some tests that started failing, because #58154 made it so placeholder-only messages are extracted while #58176 added some tests that only contain placeholders.

PR Close #58217
2024-10-16 09:47:10 +00:00
Kristiyan Kostadinov
e5a6165b54 test(compiler-cli): fix broken test (#58217)
Fixes a test that broke because a pipe wasn't marked explicitly as `standalone: false`.

PR Close #58217
2024-10-16 09:47:10 +00:00
Kristiyan Kostadinov
a3cb530d84 fix(compiler): handle typeof expressions in serializer (#58217)
Fixes that some changes which landed at the same time caused a compilation error in the serialized.

PR Close #58217
2024-10-16 09:47:10 +00:00
Matthieu Riegler
48bfb879c5 refactor(compiler-cli): Don't extract abstract overload multiple times (#57707)
Prior to this commit, each abstract method that was overloaded was extracted. With this commit it will be extracted only once. Every overload was and still will be supported by the signatures.

fixes #57693

PR Close #57707
2024-10-16 07:31:48 +00:00
Matthieu Riegler
0c9d721ac1 feat(compiler): add support for the typeof keyword in template expressions. (#58183)
This commit adds the support for `typeof` in template expressions like interpolation, bindings, control flow blocks etc.

PR Close #58183
2024-10-16 07:31:00 +00:00
Kristiyan Kostadinov
231e6ff6ca feat(compiler-cli): generate the HMR replacement module (#58205)
Adds the ability to generate the function that replaces the component's metadata during HMR. The HMR update module is a function that is loaded dynamically and as such it has some special considerations:
* It isn't bundled, because doing so will result in multiple version of core.
* Since it isn't bundled, all dependencies have to be passed in as parameters. These changes include some special logic to determine and output those dependencies.
* While HMR is enabled, we have to disable the functionality that generates dynamic imports and drop the dependencies inside `@defer` blocks, because we need to retain the ability to refer to them in case they're needed inside the HMR update function.
* The function is returned by the `NgCompiler` as a string for the CLI's sake.

PR Close #58205
2024-10-16 07:22:45 +00:00
Kristiyan Kostadinov
ca651d18d6 refactor(compiler): generate HMR update function (#58205)
Adds some code to the compiler that will generate the HMR update callback function definition.

PR Close #58205
2024-10-16 07:22:45 +00:00
Kristiyan Kostadinov
3930b08be2 refactor(compiler-cli): allow namespace import identifiers to be rewritten (#58205)
Currently only the prefix of namespace imports is configurable, but for HMR we need to know ahead of time what the name of `@angular/core` will be. These changes allow us to rewrite it.

PR Close #58205
2024-10-16 07:22:45 +00:00
Kristiyan Kostadinov
1524069b36 refactor(compiler): output AST visitor not visiting implicit arrow function returns (#58205)
Fixes that the output AST's `RecursiveVisitor` wasn't visiting all the nodes when an arrow function has an implicit return. The problem was that we were calling the `visitExpression` method directly, instead of `.visitExpression`. This doesn't affect existing code since the `RecursiveVisitor` isn't used anywhere, but it will affect future HMR code.

PR Close #58205
2024-10-16 07:22:45 +00:00
Kristiyan Kostadinov
1212f354a7 refactor(core): account for new replaceMetadata signature (#58205)
Updates the runtime code to account for the upcoming changes to `ɵɵreplaceMetadata`.

I also had to reorganize how the `angularCoreEnv` was set up, because `ɵɵreplaceMetadata` needs access to it without triggering a circular dependency.

PR Close #58205
2024-10-16 07:22:45 +00:00
Angular Robot
4288ea8614 docs: update Angular CLI help [main] (#58210)
Updated Angular CLI help contents.

PR Close #58210
2024-10-16 06:43:33 +00:00
Doug Parker
6d33ab5afe refactor(compiler): remove preservePlaceholders (#58176)
While effective, `preservePlaceholders` unfortunately is not viable in google3 at the moment due to some complexities with how TC extracts messages. Therefore this feature is being removed in favor of whitespace trimming of expressions, which is viable for TC and provides most of the same benefit.

This is a partial revert of dab722f9c8.

PR Close #58176
2024-10-16 06:42:37 +00:00
Doug Parker
6c126d5c5d refactor(compiler): trim insignificant whitespace in expressions when preserveSignificantWhitespace === false. (#58176)
This parses and reserializes expressions to normalize their whitespace formatting and make them more durable to insignificant changes in whitespace which might otherwise alter message IDs despite no translator-meaningful change being made.

PR Close #58176
2024-10-16 06:42:37 +00:00
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