-
-
Notifications
You must be signed in to change notification settings - Fork 740
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
Small syntax enhancement to TMPLIT_EXPR #1033
Comments
Heya, this looks good from my end, thanks - a PR is welcome 🙂 |
Hi, |
You can just create a PR, then it works as expected :) |
Had to remember how to do it in this non-enterprise version of Github. It's a bit different than how we use it. 😅 |
We need some changes to the PR, see failed tests. |
The Lint error wants to optimize the regexp by removing the escape character I added. |
Hi, for some reason version 3.2.2 doesn't contain the fix. |
Oh, dang - somehow it indeed didn't make it into the dist files. Okay for you to wait for 3.2.3 for that? |
Yes, no pb, nothing's gonna happen until next week on our side. |
Hi, |
Monday, the latest :) |
Background & Context
const TMPLIT_EXPR = seal(/\${[\w\W]*}/gm);
Projects that use XSLT can inline 3rd party libs before pushing out the response to the browser. While doing so they can perform code resolution/substitutions on ${} espressions. Unfortunately the
${[\w\W]*}
part can be misinterpreted as an expression even though it's in a regexp, and because it obviously doesn't resolve to anything during the transformation, it gets wiped out as a result and causes a syntax error when the browser gets it.Result:
const TMPLIT_EXPR = seal(/\/gm);
Proposed workaround
The solution is extremely simple and doesn't change anything to how the regexp operates, and would improve compatibility with a wider range of mission critical projects build on "older" tech like XSLT.
All that is needed is to escape the first curly brace like so:
const TMPLIT_EXPR = seal(/\$\{[\w\W]*}/gm);
Would you like me to create a PR for this?
The text was updated successfully, but these errors were encountered: