Commit graph

31111 commits

Author SHA1 Message Date
Paul Gschwendtner
00a79d0ee2 refactor(migrations): properly migrate inputs marked as optional via question mark (#58031)
Currently if inputs are marked as optional via the question mark syntax,
we add `undefined` only if there is an explicit type. This is wrong as
we should do the same if there is just an initializer.

This commit fixes this.

PR Close #58031
2024-10-01 16:34:54 +00:00
Matthieu Riegler
fb321966aa build: Add LICENSE file to the generated packages (#58033)
This commit adds a parameter to `ng_package` to specify a license file that will be bundled with the generated packages.

fixes #58029

PR Close #58033
2024-10-01 16:34:27 +00:00
Sam Verschueren
d60bb51bad docs: use proper workdir for tutorial and playground (#56063)
PR Close #56063
2024-10-01 16:09:54 +00:00
arturovt
3b35c4e8f3 fix(docs-infra): allow tutorial component to be GCed (#58028)
This commit updates the tutorial component's functionality to unsubscribe from the route
data observable and stop monitoring the resizer element when the component is destroyed.
This is necessary because `monitor` adds event listeners that prevent the element and
component from being garbage collected.

PR Close #58028
2024-10-01 13:51:06 +00:00
jnizet
057cf7fb6b fix(http): preserve all headers from Headers object (#57802)
when initialized from a `Headers` object containing multiple values for the same header, `HttpHeaders` now contains all the header values instead of only having one of them.

Fixes #57798

PR Close #57802
2024-10-01 13:48:35 +00:00
Paul Gschwendtner
9ce839fc7d test(migrations): add test for statistic collection tsurge (#58019)
Adds a test for statistic testing of Tsurge

PR Close #58019
2024-10-01 11:29:00 +00:00
Paul Gschwendtner
273444ab9a refactor(migrations): support getting statistics in tsurge testing (#58019)
This allows us to test statistics in future commits.

PR Close #58019
2024-10-01 11:28:59 +00:00
Paul Gschwendtner
6b57fcd4ee refactor(migrations): track statistics of signal input migration (#58019)
Track statistics of signal input migration. This allows us to see
progress the migration made.

PR Close #58019
2024-10-01 11:28:59 +00:00
Paul Gschwendtner
9f08ff2baf refactor(migrations): support statistic tracking in tsurge migrations (#58019)
We should support tracking statistics in Tsurge migrations. This allows
us to print them after migration, or run migrations periodically as
large scale changes to track to progress.

TODO is an internal implementation that eventually runs periodcally
in LSC modes.

PR Close #58019
2024-10-01 11:28:59 +00:00
ilir.beqiri
e77a163474 docs: update the name of the sub-navigation item at error encyclopedia menu (#57997)
PR Close #57997
2024-10-01 08:32:08 +00:00
Andrew Scott
ed57c5c9c8 docs: export ComponentInputBindingFeature which is part of the public API (#57962)
this fixes a missing export of ComponentInputBindingFeature

PR Close #57962
2024-10-01 08:30:03 +00:00
Angular Robot
78bc349638 build: update scorecard action dependencies (#58024)
See associated pull request for more information.

PR Close #58024
2024-10-01 08:25:10 +00:00
Andrew Scott
2ece9dff75 docs(router): Document missing input for route binding (#57697)
This commit clearly documents the approach used by router input binding
when an input is not present in the route data.

resolves #52946

PR Close #57697
2024-10-01 08:09:32 +00:00
arturovt
22dafa658b fix(http): cleanup JSONP script listeners once loading completed (#57877)
This commit removes event listeners from the `script` element once loading is
complete. If the element is not garbage collected properly, in Firefox, the script
element still appears in the memory tree view, captured by
`__zone_symbol__loadfalse -> HTMLScriptElement -> GC Roots`. We should always be good
citizens and clean up event listeners when we no longer need them, as browser's garbage
collectors work differently. Calling `remove()` on the node doesn't guarantee that the
node can be collected.

PR Close #57877
2024-10-01 08:08:40 +00:00
Thanh Truong
7bfe62a23e docs: add deferrable views tutorial (#57934)
Add a new tutorial "Deferrable Views" to the tutorials page.

PR Close #57934
2024-10-01 07:07:20 +00:00
Andres Olivares
bb46b6b051 refactor(devtools): Use chrome.devtools.performance types (#58015)
The chrome.devtools.performance types were added to the DefinitelyTyped
module and as such we don't need to make use of any to circumvent
the missing types.

See: https://github.com/DefinitelyTyped/DefinitelyTyped/pull/70231

PR Close #58015
2024-10-01 07:04:54 +00:00
Matthieu Riegler
f2bea3b73d refactor(platform-server): remove HttpClientModule import (#58016)
This import is not necessary anymore.

fixes #57983

PR Close #58016
2024-09-30 13:41:48 -07:00
Kristiyan Kostadinov
ef577b2d2b fix(migrations): delete constructor if it only has super call (#58013)
Adds some logic to the `inject` migration that will remove constructors that are made up of only a `super` call after the migration.

PR Close #58013
2024-09-30 13:39:43 -07:00
Santosh Yadav
81a5c5d7c7 docs: correct line number for localize example (#57999)
PR Close #57999
2024-09-30 13:39:01 -07:00
Angular Robot
e19510019c build: update io_bazel_rules_sass digest to 7bceee9 (#57998)
See associated pull request for more information.

PR Close #57998
2024-09-30 13:36:36 -07:00
Andrew Scott
bb06d3eecd ci: add atscott to unavailable list (#57995)
I will not be available to review PRs for a while

PR Close #57995
2024-09-30 13:34:24 -07:00
Paul Gschwendtner
cfa60cbdde refactor(migrations): migrate QueryList first and last accesses (#57992)
Instead of leaving incorrect `.first` and `.last` accesses for migrated
queries, we can migrate them to an equivalent using `at()`.

Notably, we need to use an non-null assertion to be on the safe side,
given that the current `first` and `last` types are not typed to include
a potential `undefined`.

We may add a TODO in the future.

PR Close #57992
2024-09-30 13:33:45 -07:00
Paul Gschwendtner
806db68556 refactor(migrations): skip query migration if problematic QueryList usages are discovered (#57992)
If we see a reference to e.g. `QueryList#changes`, we should skip
migration to be on the safe side. Similar for other fields of query
lists.

PR Close #57992
2024-09-30 13:33:45 -07:00
Aristeidis Bampakos
242a3c2a8f docs(docs-infra): use angular.dev in the pull request template (#57990)
PR Close #57990
2024-09-30 13:32:59 -07:00
Aristeidis Bampakos
842b5e9546 docs(docs-infra): link issue template in the new docs (#57989)
PR Close #57989
2024-09-30 13:32:20 -07:00
Kristiyan Kostadinov
682da6f59f refactor(core): fix typo in function name (#57988)
Fixes a typo in the `replaceMetadata` function name.

PR Close #57988
2024-09-30 13:31:24 -07:00
Andrew Kushnir
5c967f37b1 ci: make PullApprove config up-to-date (#57985)
This commit updates PullApprove config:

- Removes Dylan
- Adds Alex to the `fw-forms` group
- Adds Charles to the `fw-language-service` group

PR Close #57985
2024-09-30 13:30:42 -07:00
Angular Robot
68686768f9 docs: update Angular CLI help [main] (#57984)
Updated Angular CLI help contents.

PR Close #57984
2024-09-30 13:29:51 -07:00
Paul Gschwendtner
5c4305f024 feat(language-service): support migrating full classes to signal inputs in VSCode (#57975)
This commit expands the VScode integration of the signal input migration
to allow migration of full classes and all their inputs. This enables a
faster workflow than just migrating every member individually.

In addition, we now properly support migrating classes that are
unexported and no actual metadata is available in `ngtsc` (but this is
fine for the migration).

PR Close #57975
2024-09-30 13:29:21 -07:00
arturovt
e8b2d5fad8 fix(common): skip checking whether SVGs are oversized (#57966)
Prior to this commit, the `ImagePerformanceWarning` class was checking all `img`
elements in the DOM to determine whether they were oversized after the DOM loading
was complete. We should not check SVGs because they are vector-based and can scale
infinitely without losing quality.

Closes #57941

PR Close #57966
2024-09-30 13:28:45 -07:00
Kristiyan Kostadinov
33fe252c58 fix(compiler-cli): do not report unused declarations coming from an imported array (#57940)
Some apps follow a pattern where they have an array of common declarations which is imported in most standalone components, but only some of the declarations are used. Such cases will currently raise the unused imports diagnostic but can be hard to fix, because it would require either removing declarations from the common array which can break other components, or copying only the necessary declarations from the array. Since neither of these solutions is great, this commit tweaks the logic for the diagnostic so that unused imports coming from _exported_ arrays are not reported (either from the same file or another one).

PR Close #57940
2024-09-30 13:27:29 -07:00
Charles Lyding
2545743ad1 refactor(core): support external runtime styles via a component feature (#57922)
The shared style host now has the capability to add component styles as
link elements with external style references. This is currently unused
within the runtime but is an enabling feature for upcoming features such
as automatic component style HMR and development server deferred
stylesheet processing. Instead of inline style content that is then
added to a `style` element for each host node, a `link` element with a
stylesheet `rel` attribute and a `href` attribute can now be created.
The development server must be configured to provide the relevant
component stylesheet upon request. The Angular CLI development server
will provide this functionality once this capability is enabled.
Since the primary use of this capability is development mode and will
not be used for production code, server (SSR) style reuse is currently
not yet implemented but may be implemented in the future.

A component feature is used to provide the DOM renderer access to any
external styles that were emitted at compile time. When external styles
are present, the `getExternalStyles` function will be present on the
runtime component metadata object. The DOM render will use this function
to access and encapsulate the external style URLs as required by the
component.

PR Close #57922
2024-09-30 13:25:12 -07:00
mgechev
7d1998fa73 docs: set expiry date to the developer survey (#57981)
Close the developer survey on September 27, 2024

PR Close #57981
2024-09-30 12:51:27 -07:00
mgechev
bb747f144a docs: add expiry to the top banner (#57981)
Adding an expiry date to the banner similarly to
aio so we can automatically hide it when we reach
a certain date.

PR Close #57981
2024-09-30 12:51:27 -07:00
Andrew Kushnir
fbd5579a68 ci: update integration test payload size (#57986)
This commit updates a golden file with payload sizes for integration apps. One of the sizes got dropped below the threshold (but not significantly), most likely due to changes merged earlier (dependency updates, CLI changes, etc).

PR Close #57986
2024-09-27 07:49:38 +00:00
Joey Perrott
0aae371649 build: update @angular/build-tooling to latest version (#57979)
Update @angular/build-tooling to the latest version

PR Close #57979
2024-09-26 14:30:15 -07:00
Alan Agius
8f73199e9f fix(docs-infra): update getAnswerFiles to ensure compatibility with non-POSIX file systems (#57970)
This update modifies the `getAnswerFiles` function to support file systems that do not adhere to POSIX standards.

Prior to this change this method will always fail with the below:

```
Error: Invalid state: could not find start of answers path
```

PR Close #57970
2024-09-26 14:29:44 -07:00
Paul Gschwendtner
ff028b8e06 refactor(migrations): fix batch test of signal input migration failing (#57961)
The batch test was failing (it doesn't run on CI for resource reasons)
because incompatibilities were not properly "incorporated" in batch
execution mode (due to enum values of 0 being incorrectly checked via
truthy).

This is only visible in batch scenarios in two cases:

 - when a class was manually instantiated, between targets
 - when a class was overridden by a derived class, between targets

PR Close #57961
2024-09-26 14:29:04 -07:00
Paul Gschwendtner
2fe393ac60 refactor(migrations): improve tsurge diff helper to simplify output (#57961)
Instead of printing the full diff, which may be a super large file or
golden, we only print context around lines with diff. This makes the
diffs much more actionable and readable.

PR Close #57961
2024-09-26 14:29:03 -07:00
Kristiyan Kostadinov
c44f087482 refactor(core): add initial implementation of function to replace metadata at runtime (#57953)
Adds the new `ɵɵreplaceMedata` function that can be used to replace the metadata of a component class and re-render all instances in place without refreshing the page. The function isn't used anywhere at the moment, but it will be necessary for future functionality.

PR Close #57953
2024-09-26 14:28:35 -07:00
Charles Lyding
ea5442637c refactor(platform-browser): further reduce runtime code size of shared style host (#57951)
The `SharedStylesHost` class has been refactored to further reduce
the runtime code size. SSR generated component styles are now added directly
into the usage records to avoid the need for additional data structures and
lookups when adding a component style. The code reduction in a prerelease
newly generated Angular CLI application for production is ~190 bytes.

Before:
```
Initial chunk files   | Names         |  Raw size | Estimated transfer size
main-3X2VHGTM.js      | main          | 208.26 kB |                56.30 kB
polyfills-FFHMD2TL.js | polyfills     |  34.52 kB |                11.28 kB
styles-5INURTSO.css   | styles        |   0 bytes |                 0 bytes

                      | Initial total | 242.78 kB |                67.58 kB
```

After:
```
Initial chunk files   | Names         |  Raw size | Estimated transfer size
main-MGOZ6Q4F.js      | main          | 208.07 kB |                56.26 kB
polyfills-FFHMD2TL.js | polyfills     |  34.52 kB |                11.28 kB
styles-5INURTSO.css   | styles        |   0 bytes |                 0 bytes

                      | Initial total | 242.59 kB |                67.54 kB
```

PR Close #57951
2024-09-26 14:28:00 -07:00
Angular Robot
187c3b221b build: update all non-major dependencies (#57938)
See associated pull request for more information.

PR Close #57938
2024-09-26 14:27:16 -07:00
Alex Rickabaugh
d9687f43dd feat(compiler-cli): 'strictStandalone' flag enforces standalone (#57935)
Add the `strictStandalone` flag to `angularCompilerOptions`. When set to
true, the compiler will require that all declarations of components,
directive, and pipes be standalone. When `standalone: false` is provided,
an error is raised.

Note that until the default value of the standalone flag is flipped, this
does not catch the case where a declaration does not specify a value for
`standalone`.

The default value of the `strictStandalone` flag is `false`.

PR Close #57935
2024-09-26 14:22:24 -07:00
Kristiyan Kostadinov
3240598158 fix(core): provide flag to opt into manual cleanup for after render hooks (#57917)
Adds a `manualCleanup` flag to `afterRender` and `afterNextRender`, similarly to `effect`. The reason is that currently if the hook is created outside of an injection context, it requires an injector to be passed in. In some cases that injector might be an injector that is never destroyed (e.g. `EnvironmentInjector`) which can give a false sense of security users thinking that the hook will be cleaned up automatically. We fell into this in the CDK which caused a memory leak (see https://github.com/angular/components/pull/29709). With the `manualCleanup` option users explicitly opt into cleaning the hook up themselves.

PR Close #57917
2024-09-26 14:20:54 -07:00
Swami
418ffccf0b docs: correct HashLocationStrategy example url (#57908)
PR Close #57908
2024-09-26 14:20:00 -07:00
Thomas Nguyen
5f356fc092 refactor(core): Remove global event delegation code. (#57893)
This is no longer needed since we are no longer experimenting with it.

PR Close #57893
2024-09-26 14:18:17 -07:00
Alex Rickabaugh
5f56a65837 fix(upgrade): support input signal bindings (#57020)
`@angular/upgrade` writes to inputs when downgrading an Angular 2+ component
into an Angular.JS adapter. Previously, it wrote directly to the input
property, which isn't compatible with input signals. It also handles
`ngOnChanges` directly.

The correct way to support input signals would be to refactor upgrade to use
`ComponentRef.setInput`, which also handles `ngOnChanges` internally.
However, this refactoring might be more breaking since it would change the
timing of certain operations. Instead, this commit updates the code to
recognize `InputSignal` and write it through the `InputSignalNode`. This
avoids the above breaking changes for now, until a bigger refactoring can be
tested.

Fixes #56860.

PR Close #57020
2024-09-26 14:14:14 -07:00
Enea Jahollari
39ccaf4cc4 fix(compiler-cli): correctly get the type of nested function call expressions (#57010)
This PR fixes a bug where the type of a nested function call expression was incorrectly being returned as null.

PR Close #57010
2024-09-26 14:13:03 -07:00
arturovt
c3115b882e fix(common): execute checks and remove placeholder when image is already loaded (#55444)
With this commit, we're now able to perform checks even when the image has already
been loaded (e.g., from the browser cache), and its `load` event would never be triggered.
We use the [complete](https://html.spec.whatwg.org/#dom-img-complete) property, as specified,
which indicates that the image state is fully available when the user agent has retrieved all
the image data. This approach effectively triggers checks, as we no longer solely rely on the
`load` event and consider that the image may already be loaded.

This will not remove the placeholder until the `load` event fires (and it won't fire if the
image is already "there").

This prevents memory leaks in development mode, as `load` and `error` event listeners are
still attached to the image element.

PR Close #55444
2024-09-26 14:12:00 -07:00
Andrew Scott
1549afe10e release: cut the v19.0.0-next.7 release 2024-09-25 10:14:36 -07:00