vite-plugin-svg-spritegen 1.2.5 → 1.2.7

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,9 +14,8 @@ 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));
18
17
  await Promise.all(
19
- matchedPathsSorted.map(async (matchPath) => {
18
+ matchedPaths.map(async (matchPath) => {
20
19
  const filePath = path.join(baseDir, matchPath);
21
20
  const content = await node_fs.promises.readFile(filePath, "utf8");
22
21
  const resolvedInputConfig = {
@@ -84,7 +83,8 @@ const writeGitignore = async (filePath, spriteName, typesName) => {
84
83
  const writeSprite = (spritePath, svgMap) => {
85
84
  const symbols = [];
86
85
  const definitions = [];
87
- for (const svg of svgMap.values()) {
86
+ const svgSorted = [...svgMap].sort((a, b) => String(a[0]).localeCompare(b[0])).map(([_, svg]) => svg);
87
+ for (const svg of svgSorted) {
88
88
  if (spritePath === svg.filePath) continue;
89
89
  let content2 = svg.content;
90
90
  if (svg.svgo !== false) {
package/dist/index.mjs CHANGED
@@ -12,9 +12,8 @@ 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));
16
15
  await Promise.all(
17
- matchedPathsSorted.map(async (matchPath) => {
16
+ matchedPaths.map(async (matchPath) => {
18
17
  const filePath = path.join(baseDir, matchPath);
19
18
  const content = await promises.readFile(filePath, "utf8");
20
19
  const resolvedInputConfig = {
@@ -82,7 +81,8 @@ const writeGitignore = async (filePath, spriteName, typesName) => {
82
81
  const writeSprite = (spritePath, svgMap) => {
83
82
  const symbols = [];
84
83
  const definitions = [];
85
- for (const svg of svgMap.values()) {
84
+ const svgSorted = [...svgMap].sort((a, b) => String(a[0]).localeCompare(b[0])).map(([_, svg]) => svg);
85
+ for (const svg of svgSorted) {
86
86
  if (spritePath === svg.filePath) continue;
87
87
  let content2 = svg.content;
88
88
  if (svg.svgo !== false) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vite-plugin-svg-spritegen",
3
- "version": "1.2.5",
3
+ "version": "1.2.7",
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",