Commit Graph

27506 Commits

Author SHA1 Message Date
Alex Rickabaugh 98d9626746 refactor(compiler): pipeline phase to generate advance() instructions (#48580)
When executing the template update pass, the runtime keeps an internal
declaration slot pointer for which declaration (element, template, etc) is
the current subject of any binding or interpolation instructions. In between
update operations which reference different declarations, this pointer needs to
be adjusted, which is the job of the `advance()` instruction.

This commit introduces `phaseGenerateAdvance()` which inserts `advance()`
operations wherever necessary to satisfy this runtime requirement.

PR Close #48580
2023-04-11 11:46:52 -07:00
Alex Rickabaugh a2bfed4661 refactor(compiler): pipeline phase to count variable slots (#48580)
Operations and expressions in component update blocks can make use of variable
slots for storing data between executions (for example, the previous values of
expressions to use in change detection comparisons). The runtime must be told
how many variable slots to allocate for each view in a component declaration.

This commit adds a `phaseVarCounting()` phase to count the number of variables
used in different operations and expressions in a view. It makes uses of a new
marker trait `ConsumesVarsTrait` to determine which operations & expressions to
consider.

PR Close #48580
2023-04-11 11:46:52 -07:00
Alex Rickabaugh 4c0dc352fa refactor(compiler): pipeline phase to handle declaration slot allocations (#48580)
Every declaration a template is stored in a data slot in the runtime. The
indices of these slots are passed to the declaration instructions in the
creation mode. In the update mode, several instructions (like `reference()` for
local references) also use the slot indices to reference declared items.

This commit introduces `phaseSlotAllocation()` to the template pipeline, which
allocates slots for declarations which need them, and propagates those slot
indices to other instructions which need to reference declared items via their
slot indices. To perform this association, the `XrefId` of the declared items
is used to link declarations with usages.

Slot allocation is abstracted from operations by the way of a new concept in the
pipeline: traits. A trait is a "mixin" on an operation, expression, or both that
allows phases to process any operation/expression which implements the trait
without needing specific logic for each concrete implementing type. Two traits
are introduced to support slot allocation: the `ConsumesSlotOpTrait` for
declarations which require a slot to be allocated, and the
`UsesSlotIndexExprTrait` for expressions which reference a declaration by its
slot index.

PR Close #48580
2023-04-11 11:46:52 -07:00
Alex Rickabaugh 64df0efcca refactor(compiler): pipeline phase to lift element attributes into const arrays (#48580)
This commit serializes the attributes on element-like structures in the template
and converts them to constant arrays, which it lifts into the `consts` array for
the entire component compilation.

PR Close #48580
2023-04-11 11:46:52 -07:00
Alex Rickabaugh deae02ecef refactor(compiler): pipeline phase to merge sequential elementstart/elementend (#48580)
As an optimization, the runtime provides an `element()` instruction to use in
place of `elementStart()` and `elementEnd()` when there are no instructions
between them. This commit merges `ElementStart` and `ElementEnd` IR operations
into `Element` operations in that special case.

PR Close #48580
2023-04-11 11:46:52 -07:00
Alex Rickabaugh 199569d9ec refactor(compiler): pipeline phase to extract localref constants (#48580)
Local references declared on elements need to be represented in element/template
instructions via an index into the `consts` array. This commit adds the
`phaseLocalRefs()` phase to lift local reference declarations into the `consts`
array accordingly.

PR Close #48580
2023-04-11 11:46:52 -07:00
Alex Rickabaugh be46d2b9b7 refactor(compiler): pipeline phase to resolve view contexts (#48580)
`phaseResolveContexts()` resolves `ir.ContextExpr` expressions within views.
Each `ir.ContextExpr` represents a reference to a particular view context. For
the context of the view being compiled, this is available in the view's template
function `ctx` parameter. For parent views, this is available in context
variables which were added previously.

`phaseResolveContexts()` replaces these `ir.ContextExpr` operations with
resolved references to the requested views.

PR Close #48580
2023-04-11 11:46:51 -07:00
Alex Rickabaugh 2ced721460 refactor(compiler): pipeline phase to lexically resolve names in a view (#48580)
This commit introduces `phaseResolveNames()` to the template pipeline. This
phase processes any `ir.LexicalReadExpr`s, which represent unresolved
identifiers from the user's expressions in the template, and attempts to match
them to concepts in the lexical scope of the template (such as local refs) or
to a property read of a component or embedded view context.

PR Close #48580
2023-04-11 11:46:51 -07:00
Alex Rickabaugh 369fd7a540 refactor(compiler): pipeline phase to generate variables (#48580)
This commit implements the first "phase" of the template pipeline. Phases are
individual steps in compilation that perform a transformation of the IR in order
to move closer to generating runtime code for the template.

This first phase is `phaseGenerateVariables()`. This phase introduces variable
definition operations into the IR to define variables in each view. These
variables either represent internal operations (saving/restoring the view
context for listeners, for example) or variables created from user-defined names
such as local references or template context properties.

Every view has all possibly-referenced variables generated, regardless of
whether they're actually referenced by other operations. A future phase will
optimize the variables in each view, inlining those which are only read once and
removing those which are not referenced at all.

PR Close #48580
2023-04-11 11:46:51 -07:00
Alex Rickabaugh 99a2068a5b refactor(compiler): ingest() operation for a template into the template pipeline (#48580)
This commit implements `ingest()`, which converts a parsed template AST into
template pipeline IR. This is the first step of template compilation.

PR Close #48580
2023-04-11 11:46:51 -07:00
Alex Rickabaugh 874d156e67 refactor(compiler): template pipeline ops/exprs to represent input templates (#48580)
This commit adds the IR operations and expressions required to "ingest" a
template into the template pipeline. They form the starting point for template
compilation.

Ingestion is implemented in a following commit.

PR Close #48580
2023-04-11 11:46:51 -07:00
Alex Rickabaugh 4348d26b6a refactor(compiler): introduce custom o.Expression types for template pipeline (#48580)
This commit adds support for custom derived `o.Expression` types in the template
pipeline. A base class is added with one current implementor
(`ir.LexicalReadExpr`). `ir.Expression`s encode semantic operations within
expression ASTs of IR operations.

PR Close #48580
2023-04-11 11:46:51 -07:00
Alex Rickabaugh 7e977d99e0 refactor(compiler): introduce the core of the template pipeline (#48580)
This commit introduces the "template pipeline", a new compilation flow for
template compilation. This new flow is intended to eventually replace the
`TemplateDefinitionBuilder`. For now, it's being implemented in parallel with
the existing system with the goal of eventually passing all of the existing
compliance tests.

The new pipeline is based on an "intermediate representation" of a template -
operations which semantically encode what needs to happen at runtime to render
and change-detect the template. Using an IR allows for different concerns of
template compilation to be processed independently, which solves the biggest
problem with `TemplateDefinitionBuilder` today (the lack of separation of
concerns).

This commit introduces the IR concept of an operation and related typings, as
well as the structures used to represent templates and views during compilation.
Future commits will expand on this foundation as work on the pipeline proceeds.

PR Close #48580
2023-04-11 11:46:51 -07:00
Andrew Kushnir cf46dfb215 ci: disable size tracking CI job in favor of integration tests size checks (#49788)
Currently we have multiple integration apps which are instrumented with the payload size checks. In addition to that, there is a separate CI job that performs similar checks. The checks in CI job are redundant, thus this commit disables a separate CI job.

PR Close #49788
2023-04-11 10:48:00 -07:00
Brandon Roberts 0b3677e149 fix(http): ensure new cache state is returned on each request (#49749)
The cache state is only used only the first server request. Restarting the server uses the cache on first request.

Subsequent requests skip the cache because the value is mutated.

This change ensures a new cache state is returned on every request.

PR Close #49749
2023-04-11 10:40:04 -07:00
Nikola Kološnjaji 8272b5b3e6 docs: Typo (#49781)
PR Close #49781
2023-04-11 10:27:51 -07:00
Paul Gschwendtner d5e02427ea build: create script to update integration lock files (#49787)
* Adds a small script to conveniently re-generate lock files for
  integration tests.
* Updates the `.gitignore` for integration tests to ignore node
  modules. Some tests do not have a `.gitignore` (like the CLI
  boilerplate tests).

PR Close #49787
2023-04-11 10:26:43 -07:00
Paul Gschwendtner 4238ed8fb6 build: sort integration package.json dependencies (#49787)
This commits contains changes proposes by running `yarn install`
for these integration tests.

PR Close #49787
2023-04-11 10:26:43 -07:00
Paul Gschwendtner 63673ddd3f build: re-add lock files for integration tests (#49787)
The lock files for integration tests have been accidentally
removed with: https://github.com/angular/angular/commit/612eaca3c55b1304e0018abc1ee10aba27b642a7

This commit re-adds them.

PR Close #49787
2023-04-11 10:26:42 -07:00
De Wildt ee816e171f revert "fixup! fix(router): fix = not parsed in router segment name" (#47332)
This reverts commit 2279f4d4620eba083a9832ed096890b69a25ec42.

Reverting that commit based off PR feedback that this change should only affect the parsing of sergments and node encoding of the url

PR Close #47332
2023-04-11 09:16:31 -07:00
dewildt 748c33ca6b fix(router): fix = not parsed in router segment name (#47332)
fix router segment name parsing to allow segements to container an unscaped = character. Currently if you have a url like /some-site/folder=/some-file then then middle segment "folder=" will stop parsing at the = sign and register that part of the path as just "folder"

Fixes #21381

PR Close #47332
2023-04-11 09:16:31 -07:00
Andrew Kushnir b98ecbc0ce build: update minimum supported Node version from 16.13.0 -> 16.14.0 (#49771)
This commit updates the minimum supported Node version across packages from 16.13.0 -> 16.14.0 to ensure compatibility with dependencies.

PR Close #49771
2023-04-11 07:56:31 -07:00
Andrew Kushnir 10644b1deb ci: move error pages outside of the public-api group (#49770)
Currently, a change in an error guide triggers a review for the `public-api` group (requests 3 reviewers and al least 2 must approve). This is overly aggressive and we can relax this by moving the guides under `fw-core` and extended diagnistics under `fw-compiler`. In this case 1 reviewer would be requested.

PR Close #49770
2023-04-10 13:29:57 -07:00
Andrew Kushnir f7b4491353 docs: adding a note on comment nodes in the server-rendered output (#49765)
PR Close #49765
2023-04-10 12:24:20 -07:00
Kristiyan Kostadinov 41b7ec4eb9 refactor(migrations): log a link to the standalone migration (#49752)
Resolves an old TODO about adding a link to the standalone migration guide.

PR Close #49752
2023-04-10 09:04:02 -07:00
Andrew Kushnir 83262dc0f9 refactor(core): do not enable hydration when server response was incorrect (#49750)
This commit updates the logic to avoid enabling hydration in case server response doesn't contain hydration-related info serialized. It can happen when `provideClientHydration()` call only happens on the client, but not on the server.

PR Close #49750
2023-04-10 09:03:20 -07:00
Matthieu Riegler 893eef39fc docs: update docs about prodMode. (#49745)
Following angular#49723, this commit updates the doc to reflect the actual message prompted in the console.

PR Close #49745
2023-04-10 09:02:29 -07:00
Andrew Kushnir fe34de47bf refactor(core): add a warning when hydration annotation is missing in server response (#49743)
This commit updates the logic to detect a situation when hydration support was enabled only on the client. If that happens, Angular produces a warning in a console with a link to the error guide.

PR Close #49743
2023-04-07 09:41:55 -07:00
Joey Perrott 8ad31d53b0 ci: remove lock-closed action (#49650)
Remove the lock-closed asction as it has been centralized within dev-infra

PR Close #49650
2023-04-06 15:37:14 -07:00
Matthieu Riegler ed8a595408 docs: Improve previous version navigation (#49063)
In archive mode the link to the current doc will now point to same page.
If the page doesn't exist anymore, it will show a contextualized warning message.

See #46850

PR Close #49063
2023-04-06 11:07:00 -07:00
Andrew Kushnir fe58f0a383 refactor(core): update the link in hydration stats message (#49728)
Currently, the link points to https://angular.io/guides/hydration and there are 2 issues with it: the `guides/hydration` should actually be `guide/hydration` and the guide is only available at https://next.angular.io, but not at https://angular.io. It will be available at https://angular.io once v16 final is released. For now, we can point to https://next.angular.io, so that developers testing hydration during the pre-release period can follow the link.

PR Close #49728
2023-04-06 11:00:59 -07:00
Andrew Kushnir bf1b5b424f refactor(core): drop a reference to enableProdMode() in a console.log (#49723)
New `ng new` apps no longer generate `enableProdMode` calls when an app is created. The prod mode is enabled via CLI flags (and configuration in the `angular.json` if needed).

PR Close #49723
2023-04-06 11:00:26 -07:00
Andrew Kushnir e08d6797ad refactor(core): skip hydration for components that use ShadowDom encapsulation (#49722)
The Domino DOM emulation library doesn't support shadow DOM. For such components we can not guarantee that client and server representations would match perfectly. To avoid hydration mismatch errors, such components are opted out of hydration.

PR Close #49722
2023-04-06 10:59:26 -07:00
Andrew Kushnir 5bf2b7da6f refactor(core): skip hydration for components that use i18n (instead of throwing an error) (#49722)
Currently, non-destructive hydration for i18n blocks is not supported (but support is coming!).
This commit updates the serialization logic from throwing an error when it comes across an i18n
block to annotating a component with a skip hydration flag.

PR Close #49722
2023-04-06 10:59:26 -07:00
Joey Perrott ec0b44da8c docs: release notes for the v13.4.0 release 2023-04-06 11:46:19 -06:00
Dylan Hunn 726f09c01e docs: release notes for the v16.0.0-next.7 release 2023-04-05 20:00:53 -07:00
Dylan Hunn d3beaaf3f4 release: bump the next branch to v16.1.0-next.0 2023-04-05 20:00:53 -07:00
Dylan Hunn a7479545db docs: release notes for the v15.2.6 release 2023-04-05 19:46:21 -07:00
Matthieu Riegler 40ed152d21 refactor(animations): remove #9100 todos. (#49407)
Breaking change: On `AnimationPlayer.setPosition` the argument is now of type `number`

PR Close #49407
2023-04-05 19:33:52 -07:00
Matthieu Riegler 9bd9a11f4e refactor(platform-browser): remove deprecated BrowserTransferStateModule symbol (#49718)
The `TransferState` class was updated in v14 in a way that the `BrowserTransferStateModule` was no longer required. The `BrowserTransferStateModule` was deprecated in v14.1 and it's currently empty. This commit removes the `BrowserTransferStateModule`.

BREAKING CHANGE: The deprecated `BrowserTransferStateModule` was removed, since it's no longer needed. The `TransferState` class can be injected without providing the module. The `BrowserTransferStateModule` was empty starting from v14 and you can just remove the reference to that module from your applications.

PR Close #49718
2023-04-05 13:00:25 -07:00
Alan Agius dc9651b3a5 refactor(platform-browser): remove empty begin and end methods from renderer (#49630)
This methods are optional and thus not needed to be defined.

PR Close #49630
2023-04-05 11:42:57 -07:00
Alan Agius d37e21c582 refactor(animations): remove Domino specific logic (#49630)
These workarounds are no longer required following the fixes in https://github.com/angular/domino/pull/14/

PR Close #49630
2023-04-05 11:42:57 -07:00
Alan Agius 4f3abbcf93 refactor(platform-server): remove ServerRendererFactory2 and EmulatedEncapsulationServerRenderer2 (#49630)
These methods are no longer required following the fixes in https://github.com/angular/domino/pull/14/

PR Close #49630
2023-04-05 11:42:57 -07:00
Alan Agius 42f2f41f9e refactor(platform-browser): update renderer to be able to remove ServerRendererFactory2 and EmulatedEncapsulationServerRenderer2 (#49630)
This commits updates the render to able to handle the slight differences between platform-server and platform-browser.

This is needed to eventually be able to remove `ServerRendererFactory2` and `EmulatedEncapsulationServerRenderer2` from platform-server.

PR Close #49630
2023-04-05 11:42:57 -07:00
Alex Rickabaugh a6fc8b3cee refactor(core): add explicit import for ngDevMode (#49708)
This commit adds an explicit import of the ngDevMode definition to the
files in the signal package which use it.

PR Close #49708
2023-04-05 11:10:09 -07:00
Alex Rickabaugh a4732c6cde refactor(core): export additional symbols from the signals index (#49708)
This commit adds a few missing exports from the signals index.

PR Close #49708
2023-04-05 11:10:09 -07:00
Alex Rickabaugh 10795288b0 refactor(core): add postSignalSetFn hook for WritableSignal (#49708)
This commit adds a hook to `WritableSignal` that is called whenever the
signal's value is updated via the mutation API. This hook allows consumers
to implement logic which is synchronous with signal sets (e.g. executing
effects). It's currently unused.

PR Close #49708
2023-04-05 11:10:09 -07:00
Alan Agius 77bdf77968 build: combine @bazel/concatjs patches (#49714)
This commit combines all the `@bazel/concatjs` patches

PR Close #49714
2023-04-05 10:54:29 -07:00
Angular Robot 1c16be4728 build: update domino digest to aa8de34 (#49716)
See associated pull request for more information.

PR Close #49716
2023-04-05 10:52:49 -07:00
Pawel Kozlowski df1dfc4c17 fix(core): make sure that lifecycle hooks are not tracked (#49701)
Angular lifecycle hooks should never be run as part of the reactive
context: we do not expect that signal reads in lifecycle hooks
report to any consumers.

In the current Angular some of the lifecycle hooks can be flushed
early, while executting template update pass. We need to make sure
that signal reads in those lifecycle hooks do not register as part
of the effect that marks components for check.
"

PR Close #49701
2023-04-05 10:48:22 -07:00