Commit graph

29561 commits

Author SHA1 Message Date
Pawel Kozlowski
6b3f0bd0ea docs: control flow API reference (#52397)
Adds API reference for the new built-in control flow.

PR Close #52397
2023-10-27 12:56:51 -07:00
Jeremy Elbourn
9291ffc418 refactor(compiler): extract api docs for inherited members (#52389)
This commit expands docs extraction for classes and interfaces to include inherited members. This relies on the type checker to get the _resolved_ members of the type so that the extractor doesn't need to reason about inheritance rules, which can get tricky (especially with regards to method overloads).

PR Close #52389
2023-10-27 12:54:14 -07:00
Jeremy Elbourn
740d46f93b refactor(compiler): extract decorator API docs (#52389)
This commit adds decorators to the extracted API docs. It makes some
very hard-coded assumptions about the pattern used to declare decorators
that's extremely specific to what the framework does today.

PR Close #52389
2023-10-27 12:54:14 -07:00
Jessica Janiuk
edea54714d docs: Add defer guide (#52380)
This adds a user guide for how to use defer.

PR Close #52380
2023-10-27 12:50:24 -07:00
Ivad
5e651aabe4 docs(docs-infra): fix typo in tap into the observable tutorial example (#52359)
PR Close #52359
2023-10-27 12:49:37 -07:00
Evan Kleiner
e06b73f742 docs: add warning for localhost proxy (#51948)
PR Close #51948
2023-10-27 12:32:19 -07:00
Alex Rickabaugh
bdd61c768a fix(core): replace assertion with more intentional error (#52234)
Issue #50320 shows that in some cases, updating a signal that's a dependency
of a template during change detection of that template can have several
adverse effects. This can happen, for example, if the signal is set during
the lifecycle hook of a directive within the same template that reads the
signal.

This can cause a few things to happen:

* Straightforwardly, it can cause `ExpressionChanged` errors.
* Surprisingly, it can cause an assertion within the `ReactiveLViewConsumer`
  to fail.
* Very surprisingly, it can cause change detection for an `OnPush` component
  to stop working.

The root cause of these later behaviors is subtle, and is ultimately a
desync between the reactive graph and the view tree's notion of "dirty" for
a given view. This will be fixed with further work planned for change
detection to handle such updates directly. Until then, this commit improves
the DX through two changes:

1. The mechanism of "committing" `ReactiveLViewConsumer`s to a view is
   changed to use the `consumerOnSignalRead` hook from the reactive graph.
   This prevents the situation which required the assertion in the first
   place.

2. A `console.warn` warning is added when a view is marked dirty via a
   signal while it's still executing.

The warning informs users that they're pushing data against the direction of
change detection, risking `ExpressionChanged` or other issues. It's a
warning and not an error because the check is overly broad and captures
situations where the application would not actually break as a result, such
as if a `computed` marked the template dirty but still returned the same
value.

PR Close #52234
2023-10-27 11:41:20 -07:00
Angular Robot
7888819063 build: update cross-repo angular dependencies (#52191)
See associated pull request for more information.

PR Close #52191
2023-10-26 14:12:34 -07:00
Alan Agius
cb8a741f14 docs: update SSR doc to reflect version 17 (#52398)
Changes to SSR doc

PR Close #52398
2023-10-26 12:30:59 -07:00
Jessica Janiuk
f1a020b511 fix(migrations): fix broken migration when no control flow is present (#52399)
This addresses a bug that caused the control flow migration to crash when no control flow was present in the template.

PR Close #52399
2023-10-26 09:40:11 -07:00
Pawel Kozlowski
3433728a82 docs: guide for the built-in control flow (#52369)
This change adds a dedicated developer guide for the
built-in control flow.

PR Close #52369
2023-10-26 09:38:56 -07:00
Alan Agius
df86e37fb3 refactor(common): avoid repetitive globalThis in global locales (#52394)
This changes reduced slightly the bundle size as `global` can be minified unlike direct usage of `globalThis`.

PR Close #52394
2023-10-26 09:37:40 -07:00
Andrew Kushnir
8599e1892e build: update zone.js version to 0.14.1 (#52385)
This commit updates the `package.json` of the zone.js package.

PR Close #52385
2023-10-26 09:28:32 -07:00
Andrea Canciani
fc9ba3978c refactor: fix a number of typos throughout the codebase (#52249)
Fix some typos such as `boostrap`, `propery` and more, both in
documentation and in code (comments, identifiers).

PR Close #52249
2023-10-25 16:51:24 -07:00
Susheel Thapa
31c7bc1cf4 docs: fixed typos (#52297)
PR Close #52297
2023-10-25 16:39:04 -07:00
Alan Agius
3598d212a6 docs: update to standalone and routing by default (#52293)
This commit covers several changes:
 - routing enabled by default
 - standalone by default

PR Close #52293
2023-10-25 16:37:52 -07:00
Pawel Kozlowski
30ae5bebf9 docs: remove the dev preview warning from the signals guide (#52375)
Signals are out of dev preview now.

PR Close #52375
2023-10-25 16:37:22 -07:00
Jessica Janiuk
2faba0e129 ci: Add members to fw-migrations pullapprove group (#52378)
This adds jessicajaniuk and AndrewKushnir to the fw-migrations reviewers list.

PR Close #52378
2023-10-25 16:36:55 -07:00
Jessica Janiuk
fc32b29f79 docs: Adjust defer api summary for prefetch clarity (#52379)
This updates language to clarify exactly how prefetch works in a defer block configuration.

PR Close #52379
2023-10-25 16:36:29 -07:00
Alan Agius
16bf04b1f4 release: cut the zone.js-0.14.1 release (#52374)
PR Close #52374
2023-10-25 14:39:43 -07:00
Dylan Hunn
361fc4e3ba docs: release notes for the v17.0.0-rc.1 release 2023-10-25 14:38:01 -07:00
Dylan Hunn
4ca2cea9e1 docs: release notes for the v16.2.11 release 2023-10-25 14:28:58 -07:00
Andrew Scott
0037c213a3 fix(router): RouterTestingHarness should throw if a component is expected but navigation fails (#52357)
The `RouterTestingHarness` should throw an error if the call to `navigateByUrl`
expects a component to be activated but the navigation failed.

fixes #52344

PR Close #52357
2023-10-25 11:04:22 -07:00
AleksanderBodurri
8ee0f27c9e fix(core): load global utils before creating platform injector in the standalone case (#52365)
This is needed so that the providers configured on platform creation are picked up by the injector profiler.

PR Close #52365
2023-10-25 10:51:19 -07:00
AleksanderBodurri
d5dedf49fa fix(core): get root and platform injector providers in special cases (#52365)
Previously, because the platform injector does not have a provider container, this API would fail. Now, we account for this case specifically by returning the found providers immediately, without trying to calculate their importpaths.

Also previously, in the case where a boostrapped standalone component did not import any feature modules, the environment injector connected to that bootstrapped component would be the root injector configured by `bootstrapApplication`. This injector is configured through a `providers` array instead of an `imports` array, and also does not have a provider container. Similarly to the platform case, we account this for this by returning the found providers immediately if there is no provider container for our standalone component.

PR Close #52365
2023-10-25 10:51:19 -07:00
AleksanderBodurri
31b887048a fix(core): emit provider configured event when a service is configured with providedIn (#52365)
Previously this case was missed by the default framework injector profiler. Now in ngDevMode this event emits correctly when a service is configured with `providedIn`. This includes the case where injection tokens are configured with a `providedIn`.

This commit also includes unit tests for this new case in the injector profiler.

PR Close #52365
2023-10-25 10:51:19 -07:00
Osama Heykal
4726203e0d docs: added missing 'next steps' sections (#52229)
PR Close #52229
2023-10-25 10:50:45 -07:00
Jessica Janiuk
61fb6b8b4a docs: Add @defer API reference documentation (#52336)
This adds the initial API reference documentation for the new defer blocks.

PR Close #52336
2023-10-25 10:47:49 -07:00
Jan Kuehle
ebbc7a27e8 refactor: change public const enums to enums (#51670)
Angular recently gained a local compilation mode (see commit
345dd6d81a). This is intended to be used
with the TypeScript compiler option isolatedModules, which bans imports
of const enums.

This changes all const enums tagged with @publicApi to regular enums.

Fixes #46240

PR Close #51670
2023-10-25 10:39:18 -07:00
Jessica Janiuk
9692aeb1a5 fix(migrations): Add support for nested structures inside a switch statement (#52358)
This updates the code to handle switches more elegantly in line with how the other blocks are handled. This allows nesting to be handled just like other blocks.

PR Close #52358
2023-10-25 09:39:46 -07:00
Alvaro Junqueira
56598a16a7 docs: the Component import is not being used (#52323)
PR Close #52323
2023-10-25 09:35:21 -07:00
Naaajii
11e0ef2268 docs(docs-infra): fix codeblock snippet for APP_INITIALIZER (#52354)
fixes broken code snippet for standalone application using APP_INITIALIZER

PR Close #52354
2023-10-25 09:34:45 -07:00
Matthieu Riegler
fda7a84b26 docs(core): fix the language code (#52352)
PR Close #52352
2023-10-25 09:32:17 -07:00
mgechev
dea16201da docs: update the roadmap to reflect the progress as of v17 (#52356)
PR Close #52356
2023-10-25 09:31:46 -07:00
Alan Agius
def719e2ca fix(zone.js): use globalThis instead of global and window (#52367)
`globalThis` global property contains the global `this` value, which is usually akin to the global object. This is needed for better compatibility with CloudFlare workers were global nor window are defined as globals.

PR Close #52367
2023-10-25 09:31:17 -07:00
Alan Agius
7b3d26933e refactor(core): modernize $localize checks (#52368)
Use nullish coalescing.

PR Close #52368
2023-10-25 09:30:51 -07:00
Alan Agius
d775fa1c24 refactor(common): modernize code in locale file (#52368)
Use `globalThis` global property contains the global this value, which is usually akin to the global object.

PR Close #52368
2023-10-25 09:30:51 -07:00
Andrew Scott
76152a5fc6 fix(core): Ensure backwards-referenced transplanted views are refreshed (#51854)
This commit runs change detection in a loop while there are still dirty
views to be refreshed in the tree. At the moment, this only applies to
transplanted views but will also apply to views with changed signals.

fixes angular#49801

PR Close #51854
2023-10-24 14:50:18 -07:00
Kristiyan Kostadinov
c993e9a40e fix(migrations): handle nested classes in control flow migration (#52309)
Fixes that the control flow migration was only processing top-level classes. Nested classes could come up during unit tests.

PR Close #52309
2023-10-24 14:34:16 -07:00
Kristiyan Kostadinov
9e76468905 fix(migrations): handle nested classes in block entities migration (#52309)
Fixes that the block entities migration was only processing top-level classes. Nested classes could come up during unit tests.

PR Close #52309
2023-10-24 14:34:16 -07:00
Alan Agius
c5e30f1d79 perf(http): reduce data transfer when using HTTP caching (#52347)
This commit reduces the property size in the http transfer cache to reduce the page payload.

Before
```html
<script id="ng-state" type="application/json">
{
  "4155228514": {
    "body": "....",
    "headers": {},
    "status": 200,
    "statusText": "OK",
    "url": "http://foo.com/assets/media.json",
    "responseType": "json"
  },
}
</script>
```

Now
```html
<script id="ng-state" type="application/json">
{
  "4155228514": {
    "b": "....",
    "h": {},
    "s": 200,
    "st": "OK",
    "u": "http://foo.com/assets/media.json",
    "rt": "json"
  },
}
</script>
```

PR Close #52347
2023-10-24 14:33:26 -07:00
Joey Perrott
5436890d4c build: lock file maintenance (#52353)
See associated pull request for more information.

PR Close #52353
2023-10-24 14:29:17 -07:00
Jessica Janiuk
90eb879779 fix(migrations): Fixes the root level template offset in control flow migration (#52355)
When migrating an ng-template later on in a file, the migrationResult was not being reset to zero and causing offsets to be double applied due to ng-template nodes being included in the migration loop.

PR Close #52355
2023-10-24 14:22:31 -07:00
Dylan Hunn
d82d58621e refactor(compiler): Don't double-create pipes in switch cases (#52289)
Previously, we would emit *two* pipe creation instructions for each pipe in a switch case. This is because we were visiting both the transformed and raw versions of the pipe bindings.

Now, we clear the raw case expressions array after generating the transformed test expression.

Also, we introduce some new goldens, because our pipe creation order is harmlessly different.

PR Close #52289
2023-10-24 11:07:50 -07:00
Dylan Hunn
17be1a8aca refactor(compiler): Support content projection source maps (#52289)
The `projection` op should map onto the entire corresponding `ng-content`.

PR Close #52289
2023-10-24 11:07:50 -07:00
Dylan Hunn
3343ceb82d refactor(compiler): Update pipe test golden for alternative create order (#52289)
We roughly attempt to match TemplateDefinitionBuilder's pipe creation order, by placing pipe creation instructions after their target elements. However, we cannot fully emulate the "inside-out" ordering TemplateDefinitionBuilder uses when multiple pipes apply to one element, because TemplateDefinitionBuilder creates the pipes as expressions are visited, from the leaves up. Our order is perfectly adequate though.

We also add a non-compatibility-mode ordering, which just appends them to the end of the create block. This is better because it allows for more chaining opportunities.

PR Close #52289
2023-10-24 11:07:49 -07:00
Dylan Hunn
0491fba523 refactor(compiler): Fix a special case involving var counting for singleton propertyInterpolate (#52289)
Singleton property interpolation instructions consume only one variable, but are still emitted as an interpolation instruction (they cannot be collapsed because `propertyInterpolate` implicitly stringifies its argument.)

PR Close #52289
2023-10-24 11:07:49 -07:00
Dylan Hunn
f6cc09b0f4 refactor(compiler): The projection instruction takes an array literal (#52289)
We were incorrectly emiting a extracted constant pool index for the final argument of the projection instruction. It actually takes an array literal.

(N.B.: This means we re-create the array every time! We should probably modify the runtime to use a const index for this.)

Additionally, we alter the projection op to not extend the element op base type.

PR Close #52289
2023-10-24 11:07:49 -07:00
Dylan Hunn
9f839272bd refactor(compiler): Improve the ordering of update ops (#52289)
The correct order of attributes and properties is:

1. Interpolated properties
2. Interpolated attributes
3. Non-interpolated properties
4. Non-interpolated attributes

This includes an additional nuance: singleton attribute interpolations, such as `[attr.foo]="{{bar}}"`, will be "collaped" into a simple `attribute` instruction. However, this is *not* the case for singleton property interpolations! The ordering phase must take this nuance into account to match the TemplateDefinitionBuilder order.

After the project lands, it might be nice to also collapse singleton property interpolations.

PR Close #52289
2023-10-24 11:07:49 -07:00
Dylan Hunn
d55ff744e3 refactor(compiler): Order elements before other phases (#52289)
Previously, we ran the ordering phase near the end of the compilation. However, this meant that phases like slot assignment and variable offset assignment would happen first, and then the nice, monotonically-increasing orders would be scrambled by the reordering.

It's much more intelligible to order first, and then perform these assignments. However, to make this happen, some modifications to the ordering phase are required. In particular, we can no longer rely on `advance` instructions to break up orderable groups.

PR Close #52289
2023-10-24 11:07:49 -07:00