vite-plugin-svg-spritegen 1.4.4 → 1.4.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -40,10 +40,10 @@ import spriteHref from '~/assets/icons/sprite.svg';
40
40
  import type { FC, SVGProps } from 'react';
41
41
  import type { IconName } from '~/assets/icons/types';
42
42
 
43
- export const IconBase: FC<SVGProps<SVGSVGElement> & { name: IconName }> = ({ name, ...props }) => {
43
+ export const IconBase: FC<SVGProps<SVGSVGElement> & { icon: IconName }> = ({ icon, ...props }) => {
44
44
  return (
45
45
  <svg {...props}>
46
- <use href={`${spriteHref}#${name}`} />
46
+ <use href={`${spriteHref}#${icon}`} />
47
47
  </svg>
48
48
  );
49
49
  };
@@ -52,5 +52,5 @@ export const IconBase: FC<SVGProps<SVGSVGElement> & { name: IconName }> = ({ nam
52
52
  ### Usage Example
53
53
 
54
54
  ```jsx
55
- <Icon name="plus" />
55
+ <Icon icon="plus" />
56
56
  ```
package/dist/index.js CHANGED
@@ -229,7 +229,7 @@ function svgSpritegen(config) {
229
229
  },
230
230
  moduleParsed(info) {
231
231
  if (!isBuild || !stripUnusedResolved.enabled || !srcFilter(info.id) || !info.code) return;
232
- const matchPattern = stripUnusedResolved.matchPattern instanceof RegExp ? stripUnusedResolved.matchPattern : new RegExp(stripUnusedResolved.matchPattern, "ig");
232
+ const matchPattern = new RegExp(stripUnusedResolved.matchPattern, "g");
233
233
  const matches = [...info.code.matchAll(matchPattern)].flatMap(
234
234
  ({ groups }) => (groups == null ? void 0 : groups.icon) ?? []
235
235
  );
package/dist/index.mjs CHANGED
@@ -227,7 +227,7 @@ function svgSpritegen(config) {
227
227
  },
228
228
  moduleParsed(info) {
229
229
  if (!isBuild || !stripUnusedResolved.enabled || !srcFilter(info.id) || !info.code) return;
230
- const matchPattern = stripUnusedResolved.matchPattern instanceof RegExp ? stripUnusedResolved.matchPattern : new RegExp(stripUnusedResolved.matchPattern, "ig");
230
+ const matchPattern = new RegExp(stripUnusedResolved.matchPattern, "g");
231
231
  const matches = [...info.code.matchAll(matchPattern)].flatMap(
232
232
  ({ groups }) => (groups == null ? void 0 : groups.icon) ?? []
233
233
  );
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vite-plugin-svg-spritegen",
3
- "version": "1.4.4",
3
+ "version": "1.4.5",
4
4
  "description": "Vite plugin that generates an svg spritesheet, optionally removing unused svg files.",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.mjs",