-
Notifications
You must be signed in to change notification settings - Fork 24.8k
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
feat: partial compilation of directives #39518
Conversation
0080f3d
to
6911025
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.
Nice! I love how clean the whole PR feels. It is really easy to follow along with what it does.
// Version number of the metadata format. This is used to evolve the metadata | ||
// interface later - the linker will be able to detect which version a library | ||
// is using and interpret its metadata accordingly. | ||
version: 1; |
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.
We talked about using the current framework version number here instead and then doing the checks via semantic version ranges at link time.
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.
If we want to document different interfaces for different version ranges, then we could append something to the name of the interface... for example: R3DeclareDirectiveMetadata_from_11_1_0
or similar.
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.
Yes, but doing that now would also require changes to the selector logic etc. which I felt was better left for another PR.
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.
OK
packages/compiler-cli/linker/src/file_linker/partial_linkers/partial_directive_linker_1.ts
Outdated
Show resolved
Hide resolved
packages/compiler-cli/linker/src/file_linker/partial_linkers/partial_directive_linker_1.ts
Outdated
Show resolved
Hide resolved
packages/compiler-cli/linker/src/file_linker/partial_linkers/partial_directive_linker_1.ts
Outdated
Show resolved
Hide resolved
packages/compiler-cli/linker/src/file_linker/partial_linkers/partial_directive_linker_1.ts
Show resolved
Hide resolved
packages/compiler-cli/linker/src/file_linker/partial_linkers/partial_linker_selector.ts
Outdated
Show resolved
Hide resolved
Also, I am not sure whether these commits should be
|
21ac625
to
292a0a6
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.
LGTM!
meta.set( | ||
'predicate', Array.isArray(query.predicate) ? asLiteral(query.predicate) : query.predicate); | ||
meta.set('descendants', o.literal(query.descendants)); | ||
if (query.descendants) { |
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.
It appears that descendants
is true for ViewChild
, ViewChildren
and ContentChild
. Only ContentChildren
sets it to false. I am not sure which combination of these is the most common. Do you?
If it is not clear-cut, I guess it is simpler to go with the default being false
. At least from a position of least surprise.
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.
I would guess that ViewChild
is most common, but honestly I have no idea what the distribution actually is.
I did consider basically this question but then for the first
flag, which I suspect is more often true
than false
. But it did indeed feel simpler/more consistent to go with false
as a default here.
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.
This looks really clean to me! LGTM!
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.
Reviewed-for: public-api
… prelink target In PR angular#38938 an additional Bazel target was introduced for the compliance tests, as preparation to run the compliance tests in partial compilation mode and then apply the linker transform. The linker plugin itself was not available at the time but has since been implemented, so this commit updates the prelink target of the compliance tests to apply the linker transform using the Babel plugin. Actually emitting partial compilations to be transformed will be done in follow-up work.
… test's prelink target
This commit implements partial code generation for directives, which will be transformed by the linker plugin to fully AOT compiled code in follow-up work.
This commit implements the logic to compile a partial declaration of a directive into its full AOT compilation output.
…nent` to use `ɵɵ` prefix For consistency with other generated code, the partial declaration functions are renamed to use the `ɵɵ` prefix which indicates that it is generated API. This commit also removes the declaration from the public API golden file, as it's not yet considered stable at this point. Once the linker is finalized will these declaration function be included into the golden file.
292a0a6
to
c04f9e3
Compare
After changing |
FYI, presubmit is successful, I'm removing the "presubmit" label. |
… prelink target (#39518) In PR #38938 an additional Bazel target was introduced for the compliance tests, as preparation to run the compliance tests in partial compilation mode and then apply the linker transform. The linker plugin itself was not available at the time but has since been implemented, so this commit updates the prelink target of the compliance tests to apply the linker transform using the Babel plugin. Actually emitting partial compilations to be transformed will be done in follow-up work. PR Close #39518
This commit implements partial code generation for directives, which will be transformed by the linker plugin to fully AOT compiled code in follow-up work. PR Close #39518
…nent` to use `ɵɵ` prefix (#39518) For consistency with other generated code, the partial declaration functions are renamed to use the `ɵɵ` prefix which indicates that it is generated API. This commit also removes the declaration from the public API golden file, as it's not yet considered stable at this point. Once the linker is finalized will these declaration function be included into the golden file. PR Close #39518
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. |
See individual commits.