@iconify/tools 5.0.0 → 5.0.2

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.
@@ -164,12 +164,16 @@ async function figmaDownloadImages(nodes, cache) {
164
164
  callback: (index) => {
165
165
  return new Promise((resolve, reject) => {
166
166
  const item = filtered[index];
167
- sendAPIQuery({ uri: item.url }, cache).then((data) => {
168
- if (typeof data === "string") {
167
+ sendAPIQuery({ uri: item.url }, cache).then((response) => {
168
+ if (!response.success) {
169
+ reject(response.error);
170
+ return;
171
+ }
172
+ if (typeof response.content === "string") {
169
173
  count++;
170
- item.content = data;
174
+ item.content = response.content;
171
175
  resolve(void 0);
172
- } else reject(data);
176
+ } else reject(response.content);
173
177
  }).catch(reject);
174
178
  });
175
179
  },
package/lib/svg/index.js CHANGED
@@ -1,4 +1,4 @@
1
- import { iconToSVG, trimSVG } from "@iconify/utils";
1
+ import { iconToSVG, prettifySVG, trimSVG } from "@iconify/utils";
2
2
  import { parseXMLContent, stringifyXMLContent } from "@cyberalien/svg-utils";
3
3
  import { parseViewBox } from "@cyberalien/svg-utils/lib/svg/viewbox/parse.js";
4
4
 
@@ -26,20 +26,22 @@ var SVG = class {
26
26
  const value = data.attributes[key];
27
27
  svgAttributes += " " + key + "=\"" + value + "\"";
28
28
  }
29
- return "<svg" + svgAttributes + ">" + data.body + "</svg>";
29
+ const svg = "<svg" + svgAttributes + ">" + data.body + "</svg>";
30
+ return prettyPrint === true ? prettifySVG(svg) || svg : trimSVG(svg);
30
31
  }
31
32
  const $root = this.$svg;
32
33
  const attribs = $root.attribs;
33
34
  const box = this.viewBox;
34
35
  if (!attribs["viewBox"]) attribs["viewBox"] = `${box.left} ${box.top} ${box.width} ${box.height}`;
35
36
  for (const prop of ["width", "height"]) if (!attribs[prop]) attribs[prop] = box[prop];
36
- return stringifyXMLContent([$root], { prettyPrint });
37
+ const result = stringifyXMLContent([$root], { prettyPrint });
38
+ return prettyPrint === false ? trimSVG(result) : result;
37
39
  }
38
40
  /**
39
41
  * Get SVG as string without whitespaces
40
42
  */
41
43
  toMinifiedString(customisations) {
42
- return trimSVG(this.toString(customisations, false));
44
+ return this.toString(customisations, false);
43
45
  }
44
46
  /**
45
47
  * Get SVG as string with whitespaces
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "type": "module",
4
4
  "description": "Collection of functions for cleaning up and parsing SVG for Iconify project",
5
5
  "author": "Vjacheslav Trushkin",
6
- "version": "5.0.0",
6
+ "version": "5.0.2",
7
7
  "license": "MIT",
8
8
  "bugs": "https://github.com/iconify/tools/issues",
9
9
  "homepage": "https://github.com/iconify/tools",
@@ -18,27 +18,27 @@
18
18
  "@iconify/types": "^2.0.0",
19
19
  "@iconify/utils": "^3.1.0",
20
20
  "fflate": "^0.8.2",
21
- "modern-tar": "^0.7.2",
21
+ "modern-tar": "^0.7.3",
22
22
  "pathe": "^2.0.3",
23
23
  "svgo": "^4.0.0"
24
24
  },
25
25
  "devDependencies": {
26
- "@eslint/eslintrc": "^3.3.1",
27
- "@eslint/js": "^9.39.1",
26
+ "@eslint/eslintrc": "^3.3.3",
27
+ "@eslint/js": "^9.39.2",
28
28
  "@types/jest": "^30.0.0",
29
- "@types/node": "^24.10.1",
30
- "@typescript-eslint/eslint-plugin": "^8.48.0",
31
- "@typescript-eslint/parser": "^8.48.0",
29
+ "@types/node": "^24.10.4",
30
+ "@typescript-eslint/eslint-plugin": "^8.50.1",
31
+ "@typescript-eslint/parser": "^8.50.1",
32
32
  "cross-env": "^10.1.0",
33
- "eslint": "^9.39.1",
33
+ "eslint": "^9.39.2",
34
34
  "eslint-config-prettier": "^10.1.8",
35
35
  "eslint-plugin-prettier": "^5.5.4",
36
36
  "globals": "^16.5.0",
37
- "prettier": "^3.6.2",
37
+ "prettier": "^3.7.4",
38
38
  "rimraf": "^6.1.2",
39
- "tsdown": "^0.16.7",
39
+ "tsdown": "^0.18.3",
40
40
  "typescript": "^5.9.3",
41
- "vitest": "^4.0.14"
41
+ "vitest": "^4.0.16"
42
42
  },
43
43
  "exports": {
44
44
  "./*": "./*",