Repository navigation
Conversation
|
So there's good news and bad news. 👍 The good news is that everyone that needs to sign a CLA (the pull request submitter and all commit authors) have done so. Everything is all good there. 😕 The bad news is that it appears that one or more commits were authored or co-authored by someone other than the pull request submitter. We need to confirm that all authors are ok with their commits being contributed to this project. Please have them confirm that here in the pull request. Note to project maintainer: This is a terminal state, meaning the ℹ️ Googlers: Go here for more info. |
d997fc8 to
566b109
Compare
|
@JoostK Can you comment on what is blocking this PR specifically? |
|
Blocked on #30591. |
|
@JoostK - does this PR need to sit on top of mine? Perhaps you could try it on top of master and then we can land it sooner...? |
|
@petebacondarwin I did it precautionary to avoid conflicts with your massive PR. If you don't think it would be too painful to rebase your PR on top of this one I can surely apply the changes on top of master. Also, are we fine with the TypeScript patch that is in here? Any concerns regarding the patch may hold off merging this. |
|
I'm happy for my PR to be rebased on top of this. |
Packages that have been compiled using an older version of TypeScript can have their decorators at the top-level of the ES5 bundles, instead of inside the IIFE that is emitted for the class. Before this change, ngcc only took static property assignments inside the IIFE into account, therefore missing the decorators that were assigned at the top-level. This commit extends the ES5 host to look for static properties in two places. Testcases for all bundle formats that contain ES5 have been added to ensure that this works in the various flavours. A patch is included to support UMD bundles. The UMD factory affects how TypeScripts binds the static properties to symbols, see the docblock of the patch function for more details.
566b109 to
ca7565d
Compare
|
CLAs look good, thanks! ℹ️ Googlers: Go here for more info. |
| * Try to retrieve the symbol of a static property on a class. | ||
| * | ||
| * In ES5, a static property can either be set on the inner function declaration inside the class' | ||
| * IIFE, or it can be set on the outer variable declaration. Therefore, the ES2015 host's behavior |
There was a problem hiding this comment.
Do you mean Esm5ReflectionHost's behaviour?
There was a problem hiding this comment.
I don't think so, although the current phrasing is easily misinterpreted I guess. Since the ES2015 host is still always used for actually reading the static prop from a symbol (by calling super), I meant to say that the ES5 host extends on that behaviour by looking in two places.
| })));`, | ||
| }; | ||
|
|
||
| const CTOR_DECORATORS_ARRAY_FILE = { |
There was a problem hiding this comment.
This doesn't appear to be used??
There was a problem hiding this comment.
Correct, got in when cherry-picking from when this commit was on top of yours. Will remove.
| `, | ||
| }; | ||
|
|
||
| const CTOR_DECORATORS_ARRAY_FILE = { |
petebacondarwin
left a comment
There was a problem hiding this comment.
A comment to fix and some unwanted code but otherwise LGTM.
alxhub
left a comment
There was a problem hiding this comment.
- pete's comments, then this looks good!
| } | ||
|
|
||
| const originalGetExpandoInitializer = (ts as any).getExpandoInitializer; | ||
| (ts as any).getExpandoInitializer = |
There was a problem hiding this comment.
Add a comment explaining what this function is.
Also, let's have a graceful failure mode if the function doesn't exist. I think throwing an error explaining that the TS version is incompatible with ngcc is a good approach. It's not likely but TS is free to remove this API whenever they please, and ngcc shouldn't silently stop working or crash without a clear message if they do.
There was a problem hiding this comment.
Do you feel the docblock is not sufficient here?
Regarding the verification, that's a good idea. I will take it one step further and actually use the verification function above to assert that applying the patch has the desired effect.
There was a problem hiding this comment.
The docblock is fine 👍 that sounds good to me!
a47e561 to
de8deec
Compare
de8deec to
2a369e9
Compare
|
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. |
feat(ivy): ngcc - recognize static properties on the outer symbol in ES5
Packages that have been compiled using an older version of TypeScript
can have their decorators at the top-level of the ES5 bundles, instead
of inside the IIFE that is emitted for the class. Before this change,
ngcc only took static property assignments inside the IIFE into account,
therefore missing the decorators that were assigned at the top-level.
This commit extends the ES5 host to look for static properties in two
places. Testcases for all bundle formats that contain ES5 have been added
to ensure that this works in the various flavours.
A patch is included to support UMD bundles. The UMD factory affects how
TypeScripts binds the static properties to symbols, see the docblock of
the patch function for more details.