react-icons-sprite 0.4.0 → 0.5.0

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/dist/icon.mjs CHANGED
@@ -1,7 +1,7 @@
1
1
  import { jsx } from "react/jsx-runtime";
2
2
 
3
3
  //#region src/icon.tsx
4
- const ReactIconsSpriteIcon = ({ iconId,...rest }) => {
4
+ const ReactIconsSpriteIcon = ({ iconId, ...rest }) => {
5
5
  const iconHref = `__SPRITE_URL_PLACEHOLDER__#${iconId}`;
6
6
  return /* @__PURE__ */ jsx("svg", {
7
7
  height: "1em",
@@ -35,12 +35,11 @@ const reactIconsSprite = (options = {}) => {
35
35
  const generatedHash = createHash("sha256").update(spriteXml).digest("hex").slice(0, 8);
36
36
  const emitFileOptions = {
37
37
  type: "asset",
38
- source: spriteXml
38
+ source: spriteXml,
39
+ fileName: fileName ? fileName : `react-icons-sprite-${generatedHash}.svg`
39
40
  };
40
- if (fileName) emitFileOptions.fileName = fileName;
41
- else emitFileOptions.name = "react-icons-sprite.svg";
42
41
  const assetId = this.emitFile(emitFileOptions);
43
- const finalUrl = `/${this.getFileName(assetId)}?v=${encodeURIComponent(generatedHash)}`;
42
+ const finalUrl = `/${this.getFileName(assetId)}`;
44
43
  for (const [, item] of Object.entries(bundle)) if (item.type === "chunk" && typeof item.code === "string") {
45
44
  if (item.code.includes(PLACEHOLDER)) item.code = item.code.replaceAll(PLACEHOLDER, finalUrl);
46
45
  }
@@ -4,7 +4,7 @@ import { Compiler, WebpackPluginInstance } from "webpack";
4
4
  type ReactIconsSpriteWebpackPluginOptions = {
5
5
  /**
6
6
  * If passed, this exact string will be used for the emitted file name.
7
- * If fileName is omitted, name will be generated as `react-icons-sprite.svg`.
7
+ * If fileName is omitted, name will be generated as `react-icons-sprite-[hash].svg`.
8
8
  * This is useful when, for example, multiple sprite sheets are generated during client and server builds.
9
9
  */
10
10
  fileName?: string;
@@ -19,7 +19,7 @@ var ReactIconsSpriteWebpackPlugin = class {
19
19
  }, async () => {
20
20
  const spriteXml = await buildSprite(collector.toList());
21
21
  const generatedHash = createHash("sha256").update(spriteXml).digest("hex").slice(0, 8);
22
- const name = this.fileName ?? "react-icons-sprite.svg";
22
+ const name = this.fileName ?? `react-icons-sprite-${generatedHash}.svg`;
23
23
  const RawSource = compiler.webpack?.sources?.RawSource;
24
24
  if (!RawSource) throw new Error("[react-icons-sprite] Unable to access webpack RawSource");
25
25
  compilation.emitAsset(name, new RawSource(spriteXml));
@@ -27,7 +27,7 @@ var ReactIconsSpriteWebpackPlugin = class {
27
27
  let base = "";
28
28
  if (typeof outputPublicPath === "string" && outputPublicPath !== "auto") base = outputPublicPath.endsWith("/") ? outputPublicPath : `${outputPublicPath}/`;
29
29
  else base = "/";
30
- const finalUrl = `${base}${name}?v=${encodeURIComponent(generatedHash)}`;
30
+ const finalUrl = `${base}${name}`;
31
31
  for (const asset of compilation.getAssets()) {
32
32
  const filename = asset.name;
33
33
  if (!/\.(js|mjs|cjs)$/i.test(filename)) continue;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-icons-sprite",
3
- "version": "0.4.0",
3
+ "version": "0.5.0",
4
4
  "type": "module",
5
5
  "license": "MIT",
6
6
  "description": "",
@@ -29,11 +29,6 @@
29
29
  "types": "./dist/webpack/loader.d.mts",
30
30
  "import": "./dist/webpack/loader.mjs",
31
31
  "default": "./dist/webpack/loader.mjs"
32
- },
33
- "./turbopack": {
34
- "types": "./dist/turbopack/plugin.d.mts",
35
- "import": "./dist/turbopack/plugin.mjs",
36
- "default": "./dist/turbopack/plugin.mjs"
37
32
  }
38
33
  },
39
34
  "publishConfig": {
@@ -68,18 +63,18 @@
68
63
  "@babel/parser": "7.28.5",
69
64
  "@babel/traverse": "7.28.5",
70
65
  "@babel/types": "7.28.5",
71
- "@biomejs/biome": "2.3.5",
66
+ "@biomejs/biome": "2.3.7",
72
67
  "@types/babel__generator": "7.27.0",
73
68
  "@types/babel__traverse": "7.28.0",
74
- "@types/node": "24.9.1",
69
+ "@types/node": "24.10.1",
75
70
  "@types/react-dom": "19.2.3",
76
71
  "react": "19.2.0",
77
72
  "react-dom": "19.2.0",
78
73
  "react-icons": "5.5.0",
79
- "tsdown": "0.16.3",
74
+ "tsdown": "0.16.6",
80
75
  "typescript": "5.9.3",
81
- "vite": "7.2.2",
82
- "webpack": "5.102.1"
76
+ "vite": "7.2.4",
77
+ "webpack": "5.103.0"
83
78
  },
84
79
  "keywords": [
85
80
  "vite",