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
🚀 Flatten Literals in TemplateLiterals #27516
🚀 Flatten Literals in TemplateLiterals #27516
Conversation
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
let add = `/rtv/bar`; |
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.
Terser seems to accomplish all of these.
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.
Looking at the output of our build process, it is not for us. Would prefer to have less reliance on terser for these kinds of changes.
name: 'flatten-stringish-literals', | ||
visitor: { | ||
BinaryExpression: { | ||
exit(path) { |
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 we can simplify this a lot using Babel's evaluator: https://astexplorer.net/#/gist/2f15d0fd95e70d31d1eb9314d68d5b94/b6b9de562a4f71911db7585d0564d74aff85bf41
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.
Absolutely. Good idea, will address in a followup.
* Refactor to support more cases * Fix bug in function-declarations prohibiting other plugins from working * yarn lock was out of date somehow * Merge stringish literals * Add in output for tests * Remove console log debugging
Remove unnecessary work.
This change will eventually be upstreamed into Closure Compiler, and can be removed after upgrading to a newer version.