vite-plugin-svg-spritegen 1.2.3 → 1.2.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/dist/index.js CHANGED
@@ -14,8 +14,9 @@ const buildSvgMap = async (inputConfigs) => {
14
14
  inputConfigs.map(async (inputConfig) => {
15
15
  const { pattern, baseDir, getSymbolId } = inputConfig;
16
16
  const matchedPaths = await fastGlob(pattern, { cwd: baseDir });
17
+ const matchedPathsSorted = matchedPaths.sort((a, b) => a.localeCompare(b));
17
18
  await Promise.all(
18
- matchedPaths.map(async (matchPath) => {
19
+ matchedPathsSorted.map(async (matchPath) => {
19
20
  const filePath = path.join(baseDir, matchPath);
20
21
  const content = await node_fs.promises.readFile(filePath, "utf8");
21
22
  const resolvedInputConfig = {
@@ -103,7 +104,7 @@ const writeSprite = (spritePath, svgMap) => {
103
104
  ]
104
105
  }).data;
105
106
  }
106
- const svgEl = nodeHtmlParser.parse(svg.content).querySelector("svg");
107
+ const svgEl = nodeHtmlParser.parse(content2).querySelector("svg");
107
108
  if (!svgEl) {
108
109
  throw new Error(`SVG file at path "${svg.filePath}" does not contain an svg tag.`);
109
110
  }
package/dist/index.mjs CHANGED
@@ -12,8 +12,9 @@ const buildSvgMap = async (inputConfigs) => {
12
12
  inputConfigs.map(async (inputConfig) => {
13
13
  const { pattern, baseDir, getSymbolId } = inputConfig;
14
14
  const matchedPaths = await fastGlob(pattern, { cwd: baseDir });
15
+ const matchedPathsSorted = matchedPaths.sort((a, b) => a.localeCompare(b));
15
16
  await Promise.all(
16
- matchedPaths.map(async (matchPath) => {
17
+ matchedPathsSorted.map(async (matchPath) => {
17
18
  const filePath = path.join(baseDir, matchPath);
18
19
  const content = await promises.readFile(filePath, "utf8");
19
20
  const resolvedInputConfig = {
@@ -101,7 +102,7 @@ const writeSprite = (spritePath, svgMap) => {
101
102
  ]
102
103
  }).data;
103
104
  }
104
- const svgEl = parse(svg.content).querySelector("svg");
105
+ const svgEl = parse(content2).querySelector("svg");
105
106
  if (!svgEl) {
106
107
  throw new Error(`SVG file at path "${svg.filePath}" does not contain an svg tag.`);
107
108
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vite-plugin-svg-spritegen",
3
- "version": "1.2.3",
3
+ "version": "1.2.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",