-
Notifications
You must be signed in to change notification settings - Fork 155
Conversation
'makeDecorator', | ||
'makePropDecorator', | ||
'makeParamDecorator', | ||
'makeMetadataCtor', |
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.
instead of listing them here, would it not be better to to leave some kind of comment in the original source code which would mark the function as pure? This way as functions are discovered they can be added automatically not just by Angular team but by application developers?
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 see this is a hack for the
- Better comment emit on tokens microsoft/TypeScript#17689
- Keep leadingComments of CallExpression microsoft/TypeScript#17606
But it sounds like from reading the Issue that the comment is there but it is in a wrong location?
// Should match be /\/\*@__PURE__\*\/ (makeDecorator|etc)\(/, where 'etc' is all others in the | ||
// whitelist, separated by '|'; | ||
const regex = [ | ||
/\/\*@__PURE__\*\/ /, |
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.
#__PURE__
is also valid per https://github.com/mishoo/UglifyJS2
@mhevery I tried to see if the comment was indeed somewhere else by adding the following code to a visitor:
Then I tested for this input:
The comment is indeed there. I think it is possible to make a general purpose transform to add back lost comments but at that point it would be better to just invest time fixing the bug in TS instead. It's important to note that Build Optimizer can update its TS version independently of the project TS, so it does not need to wait for Angular to support a newly released TS. I'd also like some clarification on what is truly needed for the Bazel integration though... It seems to me that it is incidental that these comments are being added to those functions prior to Build Optimizer running. If all that is needed is that they be there prior to Uglify, then perhaps it is better to have Build Optimizer add them instead. |
Uglify also has the However, the danger of assuming that a function with a particular name has no side effects (whether using this transformer or the |
|
@mhevery I'm not sure this PR needs to be merged actually. In angular/angular#21880 what prevented Build Optimizer from shedding as much code was mostly configuration items. Parity with closure was reached without these changes. |
Ok, let's close it for now...
…On Tue, Jan 30, 2018 at 9:16 AM, Filipe Silva ***@***.***> wrote:
@mhevery <https://github.com/mhevery> I'm not sure this PR needs to be
merged actually. In angular/angular#21880
<angular/angular#21880> what prevented Build
Optimizer from shedding as much code was mostly configuration items. Parity
with closure was reached without these changes.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#412 (comment)>, or mute
the thread
<https://github.com/notifications/unsubscribe-auth/AAG1T7dhOXmo4gfOALGKFWz9F3eREJO9ks5tP05PgaJpZM4RuRFx>
.
|
This transform exists as a workaround for the following TS issues:
It forces call expressions in a whitelist to have a leading PURE comment.
Once TS fixes this problem for call expressions, Build Optimizer should be updated and this transform removed.