Ngcc es5 resolving#25060
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 |
|
You can preview 09d3f7c at https://pr25060-09d3f7c.ngbuilds.io/. |
There was a problem hiding this comment.
or and to --> to
There was a problem hiding this comment.
I think it is also worth having tests like these (to test some aspects of looking for param initializers):
function baz() {
var x;
if (x === void 0) { x = 42; }
return x;
}
var x;
function qux() {
if (x === void 0) { x = 42; }
return x;
}There was a problem hiding this comment.
Great tests you added there 👍
I still think the tests in my previous comment are worth adding too 😁
There was a problem hiding this comment.
I thought I was in keeping with the sentiment of your tests!
There was a problem hiding this comment.
The sentiment is great. It's just that your tests and my tests test different code paths.
(We need both.)
There was a problem hiding this comment.
So many code paths!
|
You can preview aa77e55 at https://pr25060-aa77e55.ngbuilds.io/. |
aa77e55 to
b6c8c85
Compare
|
You can preview b6c8c85 at https://pr25060-b6c8c85.ngbuilds.io/. |
b6c8c85 to
9bb494b
Compare
|
You can preview 9bb494b at https://pr25060-9bb494b.ngbuilds.io/. |
|
You can preview ce7a140 at https://pr25060-ce7a140.ngbuilds.io/. |
ce7a140 to
9bb494b
Compare
9bb494b to
5c46d8f
Compare
|
You can preview 5c46d8f at https://pr25060-5c46d8f.ngbuilds.io/. |
|
Rebased on master (now that #24897 has been merged) and force-pushed. |
|
Sorry for an off-topic question, I wonder if current Previously |
|
@trotyl thanks for linking this. I am pretty sure that Ngcc will not be able to consume the modified UMD file which is all that appears to be left after "securing" a project. That being said, I believe that going forward, one would be able to republish the original secured files after they have been compiled with ngtsc |
| let lookingForParamInitializers = true; | ||
|
|
||
| const statements = node.body && node.body.statements.filter(s => { | ||
| lookingForParamInitializers = |
There was a problem hiding this comment.
Hmm. I'm not a fan of the non-pure filter lambda. Can you implement this as a loop instead?
|
@trotyl good point, and the answer as @petebacondarwin says is indeed no, it won't work with such packages. |
|
@alxhub @petebacondarwin Thanks for reply, I'm fine with that, if finally everything will be on |
ngtsc's static resolver can evaluate function calls where parameters have default values. In TypeScript code these default values live on the function definition, but in ES5 code the default values are represented by statements in the function body. A new ReflectionHost method getDefinitionOfFunction() abstracts over this difference, and allows the static reflector to more accurately evaluate ES5 code.
5c46d8f to
e0e09ad
Compare
|
You can preview e0e09ad at https://pr25060-e0e09ad.ngbuilds.io/. |
|
Superceded by #25090 |
|
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. |
This will replace #25048 when #24897 has landed in master.
Ignoring the fixup commits at the end: the penultimate commit is from #25048 - and the final commit is the meat of this PR.