sindresorhus / pupa

Simple micro templating
MIT License
362 stars 22 forks source link

Replace regex parsing with a full parser #25

Closed conartist6 closed 2 years ago

conartist6 commented 3 years ago

Some previously parseable templates will now be errors We are now much more permissive about possible keys Introduced support for escaping

As noted above this is breaking and would be prudent to release as a new major version.

conartist6 commented 3 years ago

This will also fix some unreported weird issues the current implementation has since it is possible to double-interpolate, i.e. the failing case is:

pupa('{{key}}', {key: '{x}'});

That will blow up because x is missing in data because pupa treats {x} as part of the template expression which it is not.

sindresorhus commented 3 years ago

Thanks for working on this. I agree, this is a better solution.

Would you be able to add more tests? Especially, for invalid input, to ensure there are no security vulnerabilities or obvious bugs in the parsing.

sindresorhus commented 3 years ago

This will also fix some unreported weird issues the current implementation has since it is possible to double-interpolate, i.e. the failing case is:

Would you be able to add a test for that?

sindresorhus commented 2 years ago

I really appreciate you sharing this. However, I don't have the time to do the required changes to make this mergable.