This pull request fixes the babel-plugin-transform-jsx-to-htm plugin output for JSX inputs like this:
<>
<Foo />
{Bar}
</>
Before the fix the plugin crashes with the following error message:
Number of TemplateLiteral quasis should be exactly one more than the number of expressions.
Expected 3 quasis but got 2
The fix is to always ensure that a template literal expression ends with a quasi, even when the quasi is an empty string. New static string content is then always applied to the (currently) last quasi in the template. When an expression is added a new empty quasi is immediately appended after that.
Kudos to @cristianbote for noticing a problem on wmr output that was caused by this issue. It appears that this fix also fixes the wmr problem.
This pull request also adds a test illustrating the problem.
This pull request fixes the babel-plugin-transform-jsx-to-htm plugin output for JSX inputs like this:
Before the fix the plugin crashes with the following error message:
The fix is to always ensure that a template literal expression ends with a quasi, even when the quasi is an empty string. New static string content is then always applied to the (currently) last quasi in the template. When an expression is added a new empty quasi is immediately appended after that.
Kudos to @cristianbote for noticing a problem on wmr output that was caused by this issue. It appears that this fix also fixes the wmr problem.
This pull request also adds a test illustrating the problem.