30853 Commits

Author SHA1 Message Date
Paul Gschwendtner 6ae7d5e0bc ci: update license checking to latest version (#57205)
This may help with detecting the license of google-protobuf- which
is a transitive dependency of `@bazel/worker`

PR Close #57205
2024-07-31 16:02:11 +00:00
Paul Gschwendtner 187666480f test: update symbol golden after lock file maintenance (#57205)
Lock file maintenance updated Terser, which impacts the bundle
optimizations being tested via the symbol golden tests.

There was a small noticable change in the symbol golden where
`withDomHydration` is now preserved, and the underlying function
that was previously detected is gone. Seemingly Terser now inlines
this function and had to preserve `withDomHydration` as the entry point.

PR Close #57205
2024-07-31 16:02:11 +00:00
Paul Gschwendtner 2d314865c8 build: lock file maintenance (#57205)
See associated pull request for more information.

PR Close #57205
2024-07-31 16:02:11 +00:00
Paul Gschwendtner d35e7f2a68 build: replace deprecated inquirer with new npm package (#57205)
The new package comes with types by default, and also has a nicer
API.

The old package had broken types and couldn't be used anymore; and
it's deprecated/unmaintained. We did a similar switch in
angular/dev-infra.

PR Close #57205
2024-07-31 16:02:11 +00:00
Paul Gschwendtner e11c0c42d2 fix(compiler-cli): run JIT transforms on @NgModule classes with jit: true (#57212)
This commit is similar to 98ed5b609e, and
makes use of the preparation work implemented there.

Similar to directives and components marked via `jit: true`, we also
need to do the same for JIT marked `@NgModule` classes. This is mostly
important for downleveling of decorators to support dependency injection
of such classes.

Inside Google3, migrating from `ts_library` to `ng_module` turns of
decorator downleveling, so the `jit: true` for NgModule's is implicitly
requesting/reliant on this transform— as expected.

PR Close #57212
2024-07-31 14:14:14 +00:00
Angular Robot 3afd7f00b2 build: update scorecard action dependencies (#57150)
See associated pull request for more information.

PR Close #57150
2024-07-31 14:00:40 +00:00
Jeremy Elbourn 6f014615f8 docs: add docs authoring guide (#56505)
This new contributor guide includes information for authoring Angular
documentation.

PR Close #56505
2024-07-31 13:58:53 +00:00
Badshah d84d407358 docs: fix appRoutes constant was not passed correctly to provideRouter (#57070)
PR Close #57070
2024-07-31 13:58:21 +00:00
Enea Jahollari 147eee4253 feat(migrations): add migration to convert standalone component routes to be lazy loaded (#56428)
This schematic helps developers to convert eagerly loaded component routes to lazy loaded routes

PR Close #56428
2024-07-30 20:00:37 +00:00
Andrew Scott b558f99150 refactor(core): Update callback schedulers to cancel pending timers (#57186)
Rather than leaving the timers around as no-ops, this commit updates the
logic to also attempt to clear or cancel the timers. This is helpful for
the eventual goal of running the scheduler in the `fakeAsync` zone (if
the test is running in `fakeAsync`) rather than scheduling in the root
zone and making it impossible to flush.

PR Close #57186
2024-07-30 18:05:09 +00:00
Andrew Scott b3836c2f1c refactor(core): Private option to rethrow ApplicationRef.tick errors in tests (#57153)
This creates a private option that can be used internally while we
migrate this to the default and only behavior. ~200 tests in TGP have errors
that are being swallowed (console.log) and not causing the test to fail.
We can first explicitly opt those out, flip the default internally, then
"fix" them by adding expect...toThrow.

PR Close #57153
2024-07-30 18:04:27 +00:00
Andrew Scott 8098945d7b docs: update instructions for zoneless with NgModule bootstrap (#57060)
It no longer requires ngZone: 'noop' because NgZone can be configured in providers

PR Close #57060
2024-07-30 18:03:35 +00:00
Andrew Scott 2a4f488a6c fix(core): warnings for oversized images and lazy-lcp present with bootstrapModule (#57060)
This commit adds the `ImagePerformanceWarning` to the common bootstrap
code rather than only starting it when using `bootstrapApplication`.

PR Close #57060
2024-07-30 18:03:35 +00:00
Andrew Scott 3da0254478 refactor(core): de-duplicate bootstrap code between bootstrapApplication and bootstrapModule (#57060)
This commit de-duplicates the code for bootstrapping between
`bootstrapApplication` and `bootstrapModule`. A majority of the
bootstrap code was identical between the two, with some minor
differences that can be handled with a function overload.

PR Close #57060
2024-07-30 18:03:35 +00:00
Andrew Scott 3459289ef0 feat(core): bootstrapModule can configure NgZone in providers (#57060)
This commit allows configuring `NgZone` through the providers for
`bootstrapModule`. Prior to this change, developers had to configure
`NgZone` in the `BootstrapOptions`.

PR Close #57060
2024-07-30 18:03:35 +00:00
Bouguima, Walid 03553c485d docs: broken HammerLoader reference fix (#55836)
*Fixing broken documentation reference to HammerLoader in HammerLoaderInjectionToken page

PR Close #55836
2024-07-30 16:56:33 +00:00
David LJ a6a1b796fd docs: update app shell model link (#57162)
PR Close #57162
2024-07-30 16:55:43 +00:00
Paweł Kubiak 12eb0053d9 fix(docs-infra): skip navigation to card if user clicks on anchor (#57081)
fix(docs-infra): skip navigation to card if user clicks on anchor

If user clicks on anchor inside member card (Reference) then skip navigation to card section and allow to navigate to anchor link.

Use correct RxJs operator.
Fix DI: destroy ReferenceScrollHandler when navigate outside of reference pages.

fix: scroll to the of the card only after click on card header
fix: remove import of filter operator

PR Close #57081
2024-07-30 16:52:43 +00:00
Enea Jahollari 96ecb8218c docs: fix formatting and highlighting issues (#57144)
PR Close #57144
2024-07-30 16:52:09 +00:00
Andrew Scott 79ab8c486a docs: More updates to components scenarios guide (#57052)
PR Close #57052
2024-07-30 16:51:11 +00:00
Angular Robot 165973bfbc build: update all non-major dependencies (#57178)
See associated pull request for more information.

PR Close #57178
2024-07-30 16:44:42 +00:00
Kristiyan Kostadinov a752178f28 fix(core): hydration error in some let declaration setups (#57173)
Fixes that we were throwing an assertion error during hydration if a `@let` declaration is used before and immediately inside of a container.

Fixes #57160.

PR Close #57173
2024-07-30 16:43:46 +00:00
Sheik Althaf 49884518a0 refactor(devtools): use signal apis in injection and router tree (#57047)
Refactor the injection and router tree components to use signal apis, in future we can make the components onPush and zoneless

PR Close #57047
2024-07-30 16:42:14 +00:00
David LJ d7864e0fb8 docs: update ng generate command references (#57161)
PR Close #57161
2024-07-30 16:41:38 +00:00
Joey Perrott 2d8635d29d refactor(docs-infra): migrate @angular/docs from dev-infra into adev directory (#57132)
To increase the ease of development we are moving @angular/docs into the adev directory within this repo. While
we are doing this to improve our development experience in the short term, efforts are also in place
to maintain a division between this @angular/docs (shared) code and adev itself, so that it can be extracted
back out in the future when components is ready to leverage it as well.

PR Close #57132
2024-07-30 15:51:26 +00:00
Angular Robot dd56270bb3 build: update dependency typescript to v5.5.4 (#57090)
See associated pull request for more information.

PR Close #57090
2024-07-29 13:53:18 -07:00
Kristiyan Kostadinov b99f8f9a14 docs: add documentation for the inject migration (#57141)
Adds a reference for the `inject()` migration to ADEV.

PR Close #57141
2024-07-29 13:52:50 -07:00
David LJ f1c5f770c1 docs: fix invalid link formatting in sw config (#57170)
PR Close #57170
2024-07-29 13:52:24 -07:00
Angular Robot 314d732dce build: update dependency @babel/generator to v7.25.0 (#57152)
See associated pull request for more information.

PR Close #57152
2024-07-29 13:50:15 -07:00
Andrew Scott 3a63c9ebbe fix(core): errors during ApplicationRef.tick should be rethrown for zoneless tests (#56993)
The behavior of `ComponentFixture` for zoneless tests was decided somewhat through guesswork, trial, and error. In addition, working on the zoneless fixture revealed oddities in the behavior of the zone-based fixture, or behaviors that we felt were counterintuitive. The most consequential difference is how change detection works: `detectChanges` goes through ApplicationRef.tick in zoneless while it is `changeDetectorRef.detectChanges` in the zone fixture.

We felt that running change detection through `ApplicationRef.tick` was important for several reasons:
* Aligning application behavior more closely with the test behavior (almost all views are attached to application ref in reality)
* Ensuring that afterRender* hooks are executed when calling `fixture.detectChanges`
* Ensuring that the change detection runs again if render hooks update state

This change, however, has some noticeable consequences that will break some tests, mostly around how errors are handled. `ApplicationRef.tick` catches errors that happen during change detection and reports them to the ErrorHandler from DI. The default error handler only logs the error to the console. This will break tests which have `expect(() => fixture.detectChanges()).toThrow()`. In addition, it allows tests to pass when there are real errors encountered during change detection.

This change ensures that errors from `ApplicationRef.tick` are rethrown
and will fail the test. We should also do a follow-up investigation to
determine whether we can/should also do this for the zone-based
`ComponentFixture`.

fixes #56977

PR Close #56993
2024-07-29 13:49:00 -07:00
Aristeidis Bampakos b3b9bd8925 docs: use new blog in links of new documentation (#56052)
PR Close #56052
2024-07-29 13:48:37 -07:00
Tyler Hendrickson 2eb2d445db docs: improve spelling and grammar for error NG0956 (#57164)
PR Close #57164
2024-07-29 13:48:06 -07:00
Matthieu Riegler f1c8f9765e docs(docs-infra): fix visual glitch, (#57172)
When on a certain width, the tab-bar width glitch back-and-forth and forcing the 2 other buttons to reduce their width. This glitches appeared when we introduced that 2nd button.

fixes #57143

PR Close #57172
2024-07-29 13:47:38 -07:00
Kristiyan Kostadinov ba0df30ef6 fix(migrations): remove unused imports in inject migration (#57179)
The `inject` migration can leave some unused imports behind when it removes decorators like `@Inject`. These changes add some logic to remove them.

PR Close #57179
2024-07-29 13:47:14 -07:00
Kristiyan Kostadinov 7a40234fb7 refactor(migrations): optimize some of the import utilities (#57179)
Makes a few optimizations in the utilities we use for dealing with imports in migrations. I didn't end up using these in the inject migration, but they should still come in handy. Includes:
1. Exiting `isReferenceToImport` early when the node being checked is an identifier and it doesn't match the identifier of the import. This saves us some type checker calls.
2. Adds the ability to pass a single string to `getImportSpecifiers`. This saves us unnecessary arrays and for loops.

PR Close #57179
2024-07-29 13:47:14 -07:00
Kristiyan Kostadinov 2ffa417665 refactor(migrations): add the ability to remove imports in the change tracker (#57179)
Updates the `ChangeTracker` to integrate the changes from #57110.

PR Close #57179
2024-07-29 13:47:14 -07:00
Kristiyan Kostadinov 67e09404db fix(compiler): reduce chance of conflicts between generated factory and local variables (#57181)
Currently we use some short variable names like `t` and `r` in the generated factory functions. They can conflict with local symbols with the same names, if they're used for DI.

These changes add a `ɵ` to the generated variables to reduce the chance of conflicts.

Fixes #57168.

PR Close #57181
2024-07-29 13:46:48 -07:00
Alan Agius d108320ea3 ci: replace matchDepPatterns with matchPackageNames (#57175)
Dev-infra recently upgraded to Renovate version 38. This update causes `matchDepPatterns` to only accept RegExp. Since we require a glob pattern, we will now use `matchPackageNames`, which supports glob patterns and is already used in the configuration.
2024-07-29 10:50:45 +02:00
marktechson ca8bd5be99 docs: add open in IDX support (#57099)
This change adds a menu to the in-browser code editor on adev and adds the option for open in IDX.

PR Close #57099
2024-07-26 10:02:57 -07:00
cexbrayat 56816bbdb2 refactor(compiler-cli): typo in compilePoisonedComponents option name (#57126)
The recently introduced option (in a22f1428) has a typo in its name

PR Close #57126
2024-07-26 10:02:34 -07:00
Kristiyan Kostadinov 2158b8dafb refactor(compiler-cli): add the ability to remove imports from the import manager (#57110)
Extends the `ImportManager` to allow for imports to be removed. This will be useful in automated migrations.

PR Close #57110
2024-07-26 10:01:18 -07:00
Andrew Scott be45346f2d fix(docs-infra): only run matchMedia on client (#57121)
Use afterNextRender to avoid running matchMedia on the server

PR Close #57121
2024-07-26 10:00:55 -07:00
Kristiyan Kostadinov aae9646a1b fix(migrations): unwrap injected forwardRef (#57127)
Updates the inject migration to unwrap the `forwardRef` call in cases like `constructor(@Inject(forwardRef(() => Foo)) foo: Foo);`, because the `forwardRef` will type the initializer to `any` and it shouldn't be necessary.

PR Close #57127
2024-07-26 10:00:32 -07:00
Kristiyan Kostadinov cb442a0ce7 fix(migrations): account for parameters with union types (#57127)
This can up in Material where we had a `constructor(@Optiona() foo: Foo | null)` which ended up producing incorrect code, because the union type was preserved.

These changes resolve the issue by picking out the first non-literal type from the union for the `inject` call.

PR Close #57127
2024-07-26 10:00:32 -07:00
Kristiyan Kostadinov 1cf616f671 fix(migrations): remove generic arguments from the injected type reference (#57127)
Currently if an injected type has type arguments, we copy it over together with the type arguments to inject, because `inject()` isn't able to infer the generic properly otherwise. E.g. if there's `constructor(el: ElementRef<HTMLElement>)` we produce `inject<ElementRef<HTMLElement>>(ElementRef<HTMLElement>);`.

These changes drop the generics from the `inject()` parameter since we're overwriting the type anyway. The example from above would become `inject<ElementRef<HTMLElement>>(ElementRef);`.

PR Close #57127
2024-07-26 10:00:32 -07:00
Kristiyan Kostadinov 166166d79e fix(migrations): add alias to inject migration (#57127)
Adds a shorter alias to the inject migration.

PR Close #57127
2024-07-26 10:00:32 -07:00
Kristiyan Kostadinov 0f0a1f2836 fix(compiler-cli): emitting references to ngtypecheck files (#57138)
Follow-up to #56961 which doesn't appear to have caught all the cases. This change moves the pre-emit untagging to `NgCompiler.prepareEmit` which seems to cover a bit more comared to `NgtscProgram.emit`.

Fixes #57135.

PR Close #57138
2024-07-26 10:00:05 -07:00
cexbrayat ca89ef9141 fix(core): handle shorthand assignment in the inject migration (#57134)
Currently the migration updates:

```ts
constructor(@Inject(LOCALE_ID) locale: string) {
  console.log({ locale });
}
```

to:

```ts
constructor() {
  console.log({ locale });
}
```

This fixes the migration, and results in:

```
constructor() {
  const locale = inject(LOCALE_ID);
  console.log({ locale });
}
```

PR Close #57134
2024-07-25 18:43:45 -07:00
Andrew Scott 6609a94733 release: cut the v18.2.0-next.2 release 18.2.0-next.2 2024-07-24 11:34:08 -07:00
Andrew Scott c2779eb9f1 docs: release notes for the v18.1.2 release 2024-07-24 10:57:01 -07:00