unplugin / unplugin-icons

🤹 Access thousands of icons as components on-demand universally.
https://www.npmjs.com/package/unplugin-icons
MIT License
3.66k stars 131 forks source link

fix(compiler-solid): Props replacement not working with multiline starttags #301

Closed NathanHuisman closed 10 months ago

NathanHuisman commented 10 months ago

Description

Props replacement wasn't working because the lookbehind only included the symbol '.', which doesn't match newlines.

According to the XML spec, newlines can be included in the spacing in a starttag.

This was a very quick fix, so I figured I did not need to create an issue

Input:

<svg
  width="35"
  height="44"
  viewBox="0 0 35 44"
  fill="currentColor"
  xmlns="http://www.w3.org/2000/svg"
  role="presentation"
>
<!-- (left out, irrelevant) -->
</svg>

Output before fix:

export default (props = {}) => <svg
  width="35"
  height="44"
  viewBox="0 0 35 44"
  fill="currentColor"
  xmlns="http://www.w3.org/2000/svg"
  role="presentation"
>
{/* (left out, irrelevant) */}
</svg>

Output after fix:

export default (props = {}) => <svg
  width="35"
  height="44"
  viewBox="0 0 35 44"
  fill="currentColor"
  xmlns="http://www.w3.org/2000/svg"
  role="presentation"
{...props}>
{/* (left out, irrelevant) */}
</svg>