-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
fix(es/minifier): Preserve cooked
while compressing template literals
#7773
Conversation
minify()
cooked
while compressing template literals
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.
swc-bump:
- swc_ecma_minifier
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 think this algorithm is still faulty. We never reinitialize cur_cooked
to a Some(_)
, so we'll only push cooked values for the first quasi? What about all the other quasis?
I think the better algorithm here is to just peek the last item in quasis
, and mutate the value directly when we find a string literal.
I added logic for setting |
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.
My point is that that the second quasi in the following situations will not have a cooked
value, when it should:
foo`
\x<-invalid, so no cooked
${'this breaks splits the quasis'}
this should have a cooked
`;
foo`
\x<-invalid, so no cooked
${'this breaks splits the quasis'}
this should have a cooked
${'this breaks splits the quasis'}
this should also have a cooked
`;
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.
Automated review comment generated by auto-rebase script
Description:
Related issue:
minify()
#7770