New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support deferred blocks in partial compilation #54908
Conversation
d5f55aa
to
deaa7d1
Compare
deaa7d1
to
6395a29
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@crisbeto the change looks great 👍 Huge thanks for splitting the change into multiple commits, it made it much easier to review.
@alxhub could you please take a look at this change when you get a chance? Would love to get your feedback on the shape of partially compiled components. Thank you. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM with one comment
…n the binder Switches to tracking the deferred blocks in a flat array in the binder to ensure that their template order is maintained. This will be relevant in the next commits where we'll match deferred blocks by their index. Note that the current map we have technically guarantees the insertion order in the spec, but the array is a bit more explicit.
Updates the type of the resolver function to be any `Expression` since JIT may receive a function reference rather than a `ArrowFunctionExpr`.
Updates the linker's AST host to add the ability to extract a function's parameters. This will be required for the next commits.
…data Adds the `ɵɵngDeclareClassMetadataAsync` function that will be produced during partial compilation for component classes that have deferred dependencies. At runtime the dependencies will be resolved before setting the metadata.
6395a29
to
b7cf26b
Compare
Builds on top of the previous changes to add support for deferred blocks during partial compilation. To do this, the following changes had to be made: * The metadata passed into `ɵɵngDeclareComponent` has an additional field called `deferBlockDependencies` which has an array of the dependency loading functions for each defer block in the template. During linking, the dependency functions are loaded by matching their template index to the index in the `deferBlockDependencies` array. * There's a new `ɵɵngDeclareClassMetadataAsync` function that is created for components that have deferred dependencies. It gets transpiled to `setClassMetadataAsync` and works in the same way by capturing a dependency loading function and setting the metadata after the dependencies are resolved. It also has some extra fields for capturing the version which are standard in linker-generated code. * Deferred import statements are now stripped in partial compilation mode, similar to full compilation.
b7cf26b
to
76365a5
Compare
This PR was merged into the repository by commit 5bd188a. |
Updates the type of the resolver function to be any `Expression` since JIT may receive a function reference rather than a `ArrowFunctionExpr`. PR Close #54908
…ks (#54908) Builds on top of the previous changes to add support for deferred blocks during partial compilation. To do this, the following changes had to be made: * The metadata passed into `ɵɵngDeclareComponent` has an additional field called `deferBlockDependencies` which has an array of the dependency loading functions for each defer block in the template. During linking, the dependency functions are loaded by matching their template index to the index in the `deferBlockDependencies` array. * There's a new `ɵɵngDeclareClassMetadataAsync` function that is created for components that have deferred dependencies. It gets transpiled to `setClassMetadataAsync` and works in the same way by capturing a dependency loading function and setting the metadata after the dependencies are resolved. It also has some extra fields for capturing the version which are standard in linker-generated code. * Deferred import statements are now stripped in partial compilation mode, similar to full compilation. PR Close #54908
…n the binder (angular#54908) Switches to tracking the deferred blocks in a flat array in the binder to ensure that their template order is maintained. This will be relevant in the next commits where we'll match deferred blocks by their index. Note that the current map we have technically guarantees the insertion order in the spec, but the array is a bit more explicit. PR Close angular#54908
Updates the type of the resolver function to be any `Expression` since JIT may receive a function reference rather than a `ArrowFunctionExpr`. PR Close angular#54908
…angular#54908) Updates the linker's AST host to add the ability to extract a function's parameters. This will be required for the next commits. PR Close angular#54908
…data (angular#54908) Adds the `ɵɵngDeclareClassMetadataAsync` function that will be produced during partial compilation for component classes that have deferred dependencies. At runtime the dependencies will be resolved before setting the metadata. PR Close angular#54908
…ks (angular#54908) Builds on top of the previous changes to add support for deferred blocks during partial compilation. To do this, the following changes had to be made: * The metadata passed into `ɵɵngDeclareComponent` has an additional field called `deferBlockDependencies` which has an array of the dependency loading functions for each defer block in the template. During linking, the dependency functions are loaded by matching their template index to the index in the `deferBlockDependencies` array. * There's a new `ɵɵngDeclareClassMetadataAsync` function that is created for components that have deferred dependencies. It gets transpiled to `setClassMetadataAsync` and works in the same way by capturing a dependency loading function and setting the metadata after the dependencies are resolved. It also has some extra fields for capturing the version which are standard in linker-generated code. * Deferred import statements are now stripped in partial compilation mode, similar to full compilation. PR Close angular#54908
This issue has been automatically locked due to inactivity. Read more about our automatic conversation locking policy. This action has been performed automatically by a bot. |
Includes some changes that are necessary to support
@defer
blocks in partial compilation mode.refactor(compiler): ensure defer blocks maintain the template order in the binder
Switches to tracking the deferred blocks in a flat array in the binder to ensure that their template order is maintained. This will be relevant in the next commits where we'll match deferred blocks by their index.
Note that the current map we have technically guarantees the insertion order in the spec, but the array is a bit more explicit.
refactor(compiler): widen type of resolver function
Updates the type of the resolver function to be any
Expression
since JIT may receive a function reference rather than aArrowFunctionExpr
.refactor(compiler-cli): add method for extracting function parameters
Updates the linker's AST host to add the ability to extract a function's parameters. This will be required for the next commits.
refactor(core): introduce API for declaring asynchronous partial metadata
Adds the
ɵɵngDeclareClassMetadataAsync
function that will be produced during partial compilation for component classes that have deferred dependencies. At runtime the dependencies will be resolved before setting the metadata.feat(compiler-cli): add partial compilation support for deferred blocks
Builds on top of the previous changes to add support for deferred blocks during partial compilation. To do this, the following changes had to be made:
ɵɵngDeclareComponent
has an additional field calleddeferBlockDependencies
which has an array of the dependency loading functions for each defer block in the template. During linking, the dependency functions are loaded by matching their template index to the index in thedeferBlockDependencies
array.ɵɵngDeclareClassMetadataAsync
function that is created for components that have deferred dependencies. It gets transpiled tosetClassMetadataAsync
and works in the same way by capturing a dependency loading function and setting the metadata after the dependencies are resolved. It also has some extra fields for capturing the version which are standard in linker-generated code.