@iconify/tools 2.0.14 → 2.0.15

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.
Files changed (309) hide show
  1. package/lib/colors/attribs.cjs +30 -0
  2. package/lib/colors/attribs.d.ts +13 -10
  3. package/lib/colors/attribs.mjs +7 -13
  4. package/lib/colors/parse.cjs +269 -0
  5. package/lib/colors/parse.d.ts +15 -11
  6. package/lib/colors/parse.mjs +27 -31
  7. package/lib/colors/validate.cjs +52 -0
  8. package/lib/colors/validate.d.ts +11 -4
  9. package/lib/colors/validate.mjs +19 -6
  10. package/lib/css/parse.cjs +26 -0
  11. package/lib/css/parse.d.ts +3 -1
  12. package/lib/css/parse.mjs +8 -6
  13. package/lib/css/parser/error.cjs +25 -0
  14. package/lib/css/parser/error.d.ts +4 -2
  15. package/lib/css/parser/error.mjs +2 -4
  16. package/lib/css/parser/export.cjs +48 -0
  17. package/lib/css/parser/export.d.ts +5 -2
  18. package/lib/css/parser/export.mjs +4 -6
  19. package/lib/css/parser/strings.cjs +77 -0
  20. package/lib/css/parser/strings.d.ts +6 -3
  21. package/lib/css/parser/strings.mjs +4 -6
  22. package/lib/css/parser/text.cjs +135 -0
  23. package/lib/css/parser/text.d.ts +8 -5
  24. package/lib/css/parser/text.mjs +3 -8
  25. package/lib/css/parser/tokens.cjs +184 -0
  26. package/lib/css/parser/tokens.d.ts +6 -3
  27. package/lib/css/parser/tokens.mjs +7 -13
  28. package/lib/css/parser/tree.cjs +42 -0
  29. package/lib/css/parser/tree.d.ts +5 -2
  30. package/lib/css/parser/tree.mjs +2 -4
  31. package/lib/css/parser/types.cjs +2 -0
  32. package/lib/css/parser/types.d.ts +13 -11
  33. package/lib/css/parser/types.mjs +1 -0
  34. package/lib/download/api/cache.cjs +86 -0
  35. package/lib/download/api/cache.d.ts +8 -5
  36. package/lib/download/api/cache.mjs +14 -19
  37. package/lib/download/api/download.cjs +28 -0
  38. package/lib/download/api/download.d.ts +5 -2
  39. package/lib/download/api/download.mjs +8 -9
  40. package/lib/download/api/index.cjs +51 -0
  41. package/lib/download/api/index.d.ts +5 -2
  42. package/lib/download/api/index.mjs +8 -6
  43. package/lib/download/api/types.cjs +2 -0
  44. package/lib/download/api/types.d.ts +4 -2
  45. package/lib/download/api/types.mjs +1 -0
  46. package/lib/download/git/branch.cjs +22 -0
  47. package/lib/download/git/branch.d.ts +5 -2
  48. package/lib/download/git/branch.mjs +5 -5
  49. package/lib/download/git/hash.cjs +15 -0
  50. package/lib/download/git/hash.d.ts +5 -2
  51. package/lib/download/git/hash.mjs +5 -5
  52. package/lib/download/git/index.cjs +76 -0
  53. package/lib/download/git/index.d.ts +10 -8
  54. package/lib/download/git/index.mjs +41 -26
  55. package/lib/download/git/reset.cjs +41 -0
  56. package/lib/download/git/reset.d.ts +3 -1
  57. package/lib/download/git/reset.mjs +29 -5
  58. package/lib/download/github/hash.cjs +32 -0
  59. package/lib/download/github/hash.d.ts +5 -2
  60. package/lib/download/github/hash.mjs +10 -7
  61. package/lib/download/github/index.cjs +98 -0
  62. package/lib/download/github/index.d.ts +11 -9
  63. package/lib/download/github/index.mjs +23 -17
  64. package/lib/download/github/types.cjs +2 -0
  65. package/lib/download/github/types.d.ts +3 -1
  66. package/lib/download/github/types.mjs +1 -0
  67. package/lib/download/gitlab/hash.cjs +32 -0
  68. package/lib/download/gitlab/hash.d.ts +5 -2
  69. package/lib/download/gitlab/hash.mjs +10 -6
  70. package/lib/download/gitlab/index.cjs +98 -0
  71. package/lib/download/gitlab/index.d.ts +11 -9
  72. package/lib/download/gitlab/index.mjs +24 -18
  73. package/lib/download/gitlab/types.cjs +7 -0
  74. package/lib/download/gitlab/types.d.ts +4 -2
  75. package/lib/download/gitlab/types.mjs +3 -5
  76. package/lib/download/helpers/untar.cjs +14 -0
  77. package/lib/download/helpers/untar.d.ts +3 -1
  78. package/lib/download/helpers/untar.mjs +4 -5
  79. package/lib/download/helpers/unzip.cjs +19 -0
  80. package/lib/download/helpers/unzip.d.ts +3 -1
  81. package/lib/download/helpers/unzip.mjs +6 -7
  82. package/lib/download/index.cjs +64 -0
  83. package/lib/download/index.d.ts +18 -13
  84. package/lib/download/index.mjs +46 -19
  85. package/lib/download/npm/index.cjs +82 -0
  86. package/lib/download/npm/index.d.ts +10 -8
  87. package/lib/download/npm/index.mjs +16 -13
  88. package/lib/download/npm/types.cjs +2 -0
  89. package/lib/download/npm/types.d.ts +3 -1
  90. package/lib/download/npm/types.mjs +1 -0
  91. package/lib/download/npm/version.cjs +23 -0
  92. package/lib/download/npm/version.d.ts +7 -4
  93. package/lib/download/npm/version.mjs +8 -10
  94. package/lib/download/types/modified.cjs +2 -0
  95. package/lib/download/types/modified.d.ts +3 -1
  96. package/lib/download/types/modified.mjs +1 -0
  97. package/lib/download/types/sources.cjs +2 -0
  98. package/lib/download/types/sources.d.ts +4 -2
  99. package/lib/download/types/sources.mjs +1 -0
  100. package/lib/export/directory.cjs +45 -0
  101. package/lib/export/directory.d.ts +11 -4
  102. package/lib/export/directory.mjs +8 -8
  103. package/lib/export/helpers/custom-files.cjs +28 -0
  104. package/lib/export/helpers/custom-files.d.ts +4 -2
  105. package/lib/export/helpers/custom-files.mjs +8 -9
  106. package/lib/export/helpers/prepare.cjs +36 -0
  107. package/lib/export/helpers/prepare.d.ts +5 -3
  108. package/lib/export/helpers/prepare.mjs +7 -9
  109. package/lib/export/helpers/types-version.cjs +22 -0
  110. package/lib/export/helpers/types-version.d.ts +3 -1
  111. package/lib/export/helpers/types-version.mjs +15 -37
  112. package/lib/export/icon-package.cjs +59 -0
  113. package/lib/export/icon-package.d.ts +12 -5
  114. package/lib/export/icon-package.mjs +15 -16
  115. package/lib/export/json-package.cjs +133 -0
  116. package/lib/export/json-package.d.ts +12 -5
  117. package/lib/export/json-package.mjs +20 -21
  118. package/lib/icon-set/index.cjs +589 -0
  119. package/lib/icon-set/index.d.ts +9 -6
  120. package/lib/icon-set/index.mjs +40 -53
  121. package/lib/icon-set/match.cjs +58 -0
  122. package/lib/icon-set/match.d.ts +10 -3
  123. package/lib/icon-set/match.mjs +5 -6
  124. package/lib/icon-set/merge.cjs +83 -0
  125. package/lib/icon-set/merge.d.ts +9 -2
  126. package/lib/icon-set/merge.mjs +15 -10
  127. package/lib/icon-set/props.cjs +28 -0
  128. package/lib/icon-set/props.d.ts +8 -4
  129. package/lib/icon-set/props.mjs +7 -10
  130. package/lib/icon-set/types.cjs +2 -0
  131. package/lib/icon-set/types.d.ts +19 -17
  132. package/lib/icon-set/types.mjs +1 -0
  133. package/lib/import/directory.cjs +76 -0
  134. package/lib/import/directory.d.ts +11 -5
  135. package/lib/import/directory.mjs +36 -11
  136. package/lib/import/figma/index.cjs +105 -0
  137. package/lib/import/figma/index.d.ts +15 -5
  138. package/lib/import/figma/index.mjs +40 -13
  139. package/lib/import/figma/nodes.cjs +86 -0
  140. package/lib/import/figma/nodes.d.ts +13 -4
  141. package/lib/import/figma/nodes.mjs +3 -11
  142. package/lib/import/figma/query.cjs +218 -0
  143. package/lib/import/figma/query.d.ts +18 -9
  144. package/lib/import/figma/query.mjs +9 -12
  145. package/lib/import/figma/types/api.cjs +2 -0
  146. package/lib/import/figma/types/api.d.ts +8 -7
  147. package/lib/import/figma/types/api.mjs +1 -0
  148. package/lib/import/figma/types/nodes.cjs +2 -0
  149. package/lib/import/figma/types/nodes.d.ts +16 -9
  150. package/lib/import/figma/types/nodes.mjs +1 -0
  151. package/lib/import/figma/types/options.cjs +2 -0
  152. package/lib/import/figma/types/options.d.ts +17 -10
  153. package/lib/import/figma/types/options.mjs +1 -0
  154. package/lib/import/figma/types/result.cjs +2 -0
  155. package/lib/import/figma/types/result.d.ts +12 -5
  156. package/lib/import/figma/types/result.mjs +1 -0
  157. package/lib/index.cjs +137 -0
  158. package/lib/index.d.ts +65 -44
  159. package/lib/index.mjs +83 -94
  160. package/lib/misc/bump-version.cjs +17 -0
  161. package/lib/misc/bump-version.d.ts +3 -1
  162. package/lib/misc/bump-version.mjs +2 -4
  163. package/lib/misc/compare-dirs.cjs +75 -0
  164. package/lib/misc/compare-dirs.d.ts +4 -2
  165. package/lib/misc/compare-dirs.mjs +12 -12
  166. package/lib/misc/exec.cjs +25 -0
  167. package/lib/misc/exec.d.ts +6 -4
  168. package/lib/misc/exec.mjs +4 -5
  169. package/lib/misc/keyword.cjs +19 -0
  170. package/lib/misc/keyword.d.ts +3 -1
  171. package/lib/misc/keyword.mjs +2 -4
  172. package/lib/misc/scan.cjs +51 -0
  173. package/lib/misc/scan.d.ts +7 -6
  174. package/lib/misc/scan.mjs +6 -7
  175. package/lib/misc/write-json.cjs +11 -0
  176. package/lib/misc/write-json.d.ts +3 -1
  177. package/lib/misc/write-json.mjs +5 -6
  178. package/lib/optimise/flags.cjs +252 -0
  179. package/lib/optimise/flags.d.ts +7 -2
  180. package/lib/optimise/flags.mjs +18 -19
  181. package/lib/optimise/global-style.cjs +154 -0
  182. package/lib/optimise/global-style.d.ts +7 -2
  183. package/lib/optimise/global-style.mjs +18 -15
  184. package/lib/optimise/scale.cjs +26 -0
  185. package/lib/optimise/scale.d.ts +7 -2
  186. package/lib/optimise/scale.mjs +5 -5
  187. package/lib/optimise/svgo.cjs +83 -0
  188. package/lib/optimise/svgo.d.ts +10 -6
  189. package/lib/optimise/svgo.mjs +6 -9
  190. package/lib/svg/analyse/error.cjs +18 -0
  191. package/lib/svg/analyse/error.d.ts +5 -2
  192. package/lib/svg/analyse/error.mjs +2 -4
  193. package/lib/svg/analyse/types.cjs +2 -0
  194. package/lib/svg/analyse/types.d.ts +11 -11
  195. package/lib/svg/analyse/types.mjs +1 -0
  196. package/lib/svg/analyse.cjs +291 -0
  197. package/lib/svg/analyse.d.ts +8 -3
  198. package/lib/svg/analyse.mjs +15 -30
  199. package/lib/svg/cleanup/attribs.cjs +41 -0
  200. package/lib/svg/cleanup/attribs.d.ts +7 -2
  201. package/lib/svg/cleanup/attribs.mjs +6 -12
  202. package/lib/svg/cleanup/bad-tags.cjs +51 -0
  203. package/lib/svg/cleanup/bad-tags.d.ts +7 -2
  204. package/lib/svg/cleanup/bad-tags.mjs +10 -25
  205. package/lib/svg/cleanup/inline-style.cjs +64 -0
  206. package/lib/svg/cleanup/inline-style.d.ts +7 -2
  207. package/lib/svg/cleanup/inline-style.mjs +14 -19
  208. package/lib/svg/cleanup/root-svg.cjs +81 -0
  209. package/lib/svg/cleanup/root-svg.d.ts +7 -2
  210. package/lib/svg/cleanup/root-svg.mjs +7 -18
  211. package/lib/svg/cleanup/svgo-style.cjs +38 -0
  212. package/lib/svg/cleanup/svgo-style.d.ts +7 -2
  213. package/lib/svg/cleanup/svgo-style.mjs +16 -11
  214. package/lib/svg/cleanup.cjs +32 -0
  215. package/lib/svg/cleanup.d.ts +7 -2
  216. package/lib/svg/cleanup.mjs +21 -9
  217. package/lib/svg/data/attributes.cjs +355 -0
  218. package/lib/svg/data/attributes.d.ts +27 -25
  219. package/lib/svg/data/attributes.mjs +90 -115
  220. package/lib/svg/data/tags.cjs +137 -0
  221. package/lib/svg/data/tags.d.ts +25 -23
  222. package/lib/svg/data/tags.mjs +25 -49
  223. package/lib/svg/index.cjs +130 -0
  224. package/lib/svg/index.d.ts +16 -5
  225. package/lib/svg/index.mjs +48 -14
  226. package/lib/svg/parse-style.cjs +134 -0
  227. package/lib/svg/parse-style.d.ts +12 -8
  228. package/lib/svg/parse-style.mjs +11 -9
  229. package/lib/svg/parse.cjs +42 -0
  230. package/lib/svg/parse.d.ts +11 -7
  231. package/lib/svg/parse.mjs +2 -4
  232. package/package.json +99 -94
  233. package/lib/colors/attribs.js +0 -26
  234. package/lib/colors/parse.js +0 -341
  235. package/lib/colors/validate.js +0 -48
  236. package/lib/css/parse.js +0 -23
  237. package/lib/css/parser/error.js +0 -27
  238. package/lib/css/parser/export.js +0 -69
  239. package/lib/css/parser/strings.js +0 -93
  240. package/lib/css/parser/text.js +0 -171
  241. package/lib/css/parser/tokens.js +0 -200
  242. package/lib/css/parser/tree.js +0 -44
  243. package/lib/css/parser/types.js +0 -2
  244. package/lib/download/api/cache.js +0 -108
  245. package/lib/download/api/download.js +0 -27
  246. package/lib/download/api/index.js +0 -52
  247. package/lib/download/api/types.js +0 -2
  248. package/lib/download/git/branch.js +0 -22
  249. package/lib/download/git/hash.js +0 -14
  250. package/lib/download/git/index.js +0 -75
  251. package/lib/download/git/reset.js +0 -16
  252. package/lib/download/github/hash.js +0 -28
  253. package/lib/download/github/index.js +0 -116
  254. package/lib/download/github/types.js +0 -2
  255. package/lib/download/gitlab/hash.js +0 -27
  256. package/lib/download/gitlab/index.js +0 -115
  257. package/lib/download/gitlab/types.js +0 -7
  258. package/lib/download/helpers/untar.js +0 -14
  259. package/lib/download/helpers/unzip.js +0 -18
  260. package/lib/download/index.js +0 -27
  261. package/lib/download/npm/index.js +0 -91
  262. package/lib/download/npm/types.js +0 -2
  263. package/lib/download/npm/version.js +0 -27
  264. package/lib/download/types/modified.js +0 -2
  265. package/lib/download/types/sources.js +0 -2
  266. package/lib/export/directory.js +0 -52
  267. package/lib/export/helpers/custom-files.js +0 -32
  268. package/lib/export/helpers/prepare.js +0 -49
  269. package/lib/export/helpers/types-version.js +0 -12
  270. package/lib/export/icon-package.js +0 -77
  271. package/lib/export/json-package.js +0 -156
  272. package/lib/icon-set/index.js +0 -749
  273. package/lib/icon-set/match.js +0 -66
  274. package/lib/icon-set/merge.js +0 -90
  275. package/lib/icon-set/props.js +0 -34
  276. package/lib/icon-set/types.js +0 -2
  277. package/lib/import/directory.js +0 -59
  278. package/lib/import/figma/index.js +0 -90
  279. package/lib/import/figma/nodes.js +0 -106
  280. package/lib/import/figma/query.js +0 -244
  281. package/lib/import/figma/types/api.js +0 -12
  282. package/lib/import/figma/types/nodes.js +0 -2
  283. package/lib/import/figma/types/options.js +0 -2
  284. package/lib/import/figma/types/result.js +0 -2
  285. package/lib/index.js +0 -103
  286. package/lib/misc/bump-version.js +0 -19
  287. package/lib/misc/compare-dirs.js +0 -84
  288. package/lib/misc/exec.js +0 -26
  289. package/lib/misc/keyword.js +0 -31
  290. package/lib/misc/scan.js +0 -55
  291. package/lib/misc/write-json.js +0 -11
  292. package/lib/optimise/flags.js +0 -312
  293. package/lib/optimise/global-style.js +0 -185
  294. package/lib/optimise/scale.js +0 -42
  295. package/lib/optimise/svgo.js +0 -99
  296. package/lib/svg/analyse/error.js +0 -22
  297. package/lib/svg/analyse/types.js +0 -2
  298. package/lib/svg/analyse.js +0 -352
  299. package/lib/svg/cleanup/attribs.js +0 -51
  300. package/lib/svg/cleanup/bad-tags.js +0 -65
  301. package/lib/svg/cleanup/inline-style.js +0 -77
  302. package/lib/svg/cleanup/root-svg.js +0 -107
  303. package/lib/svg/cleanup/svgo-style.js +0 -35
  304. package/lib/svg/cleanup.js +0 -24
  305. package/lib/svg/data/attributes.js +0 -403
  306. package/lib/svg/data/tags.js +0 -188
  307. package/lib/svg/index.js +0 -134
  308. package/lib/svg/parse-style.js +0 -151
  309. package/lib/svg/parse.js +0 -49
@@ -1,12 +0,0 @@
1
- "use strict";
2
- /**
3
- * Basic document structure
4
- */
5
- // Various types for items
6
- // interface FigmaColor {
7
- // r: number;
8
- // g: number;
9
- // b: number;
10
- // a: number;
11
- // }
12
- Object.defineProperty(exports, "__esModule", { value: true });
@@ -1,2 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
@@ -1,2 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
@@ -1,2 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
package/lib/index.js DELETED
@@ -1,103 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.sendAPIQuery = exports.bumpVersion = exports.cleanupIconKeyword = exports.execAsync = exports.untar = exports.unzip = exports.compareDirectories = exports.scanDirectory = exports.prepareDirectoryForExport = exports.writeJSONFile = exports.exportJSONPackage = exports.exportIconPackage = exports.exportToDirectory = exports.cleanupGlobalStyle = exports.scaleSVG = exports.deOptimisePaths = exports.runSVGO = exports.validateColors = exports.isEmptyColor = exports.parseColors = exports.downloadPackage = exports.getPackageVersion = exports.getNPMVersion = exports.downloadNPMPackage = exports.getGitLabRepoHash = exports.downloadGitLabRepo = exports.getGitHubRepoHash = exports.downloadGitHubRepo = exports.resetGitRepoContents = exports.getGitRepoBranch = exports.getGitRepoHash = exports.downloadGitRepo = exports.importDirectory = exports.importFromFigma = exports.mergeIconSets = exports.blankIconSet = exports.IconSet = exports.convertStyleToAttrs = exports.cleanupSVGRoot = exports.cleanupInlineStyle = exports.checkBadTags = exports.removeBadAttributes = exports.cleanupSVG = exports.analyseSVGStructure = exports.parseSVGStyle = exports.parseSVG = exports.SVG = void 0;
4
- // SVG class and functions
5
- var index_1 = require("./svg/index");
6
- Object.defineProperty(exports, "SVG", { enumerable: true, get: function () { return index_1.SVG; } });
7
- var parse_1 = require("./svg/parse");
8
- Object.defineProperty(exports, "parseSVG", { enumerable: true, get: function () { return parse_1.parseSVG; } });
9
- var parse_style_1 = require("./svg/parse-style");
10
- Object.defineProperty(exports, "parseSVGStyle", { enumerable: true, get: function () { return parse_style_1.parseSVGStyle; } });
11
- var analyse_1 = require("./svg/analyse");
12
- Object.defineProperty(exports, "analyseSVGStructure", { enumerable: true, get: function () { return analyse_1.analyseSVGStructure; } });
13
- // SVG cleanup
14
- var cleanup_1 = require("./svg/cleanup");
15
- Object.defineProperty(exports, "cleanupSVG", { enumerable: true, get: function () { return cleanup_1.cleanupSVG; } });
16
- var attribs_1 = require("./svg/cleanup/attribs");
17
- Object.defineProperty(exports, "removeBadAttributes", { enumerable: true, get: function () { return attribs_1.removeBadAttributes; } });
18
- var bad_tags_1 = require("./svg/cleanup/bad-tags");
19
- Object.defineProperty(exports, "checkBadTags", { enumerable: true, get: function () { return bad_tags_1.checkBadTags; } });
20
- var inline_style_1 = require("./svg/cleanup/inline-style");
21
- Object.defineProperty(exports, "cleanupInlineStyle", { enumerable: true, get: function () { return inline_style_1.cleanupInlineStyle; } });
22
- var root_svg_1 = require("./svg/cleanup/root-svg");
23
- Object.defineProperty(exports, "cleanupSVGRoot", { enumerable: true, get: function () { return root_svg_1.cleanupSVGRoot; } });
24
- var svgo_style_1 = require("./svg/cleanup/svgo-style");
25
- Object.defineProperty(exports, "convertStyleToAttrs", { enumerable: true, get: function () { return svgo_style_1.convertStyleToAttrs; } });
26
- // IconSet class
27
- var index_2 = require("./icon-set/index");
28
- Object.defineProperty(exports, "IconSet", { enumerable: true, get: function () { return index_2.IconSet; } });
29
- Object.defineProperty(exports, "blankIconSet", { enumerable: true, get: function () { return index_2.blankIconSet; } });
30
- var merge_1 = require("./icon-set/merge");
31
- Object.defineProperty(exports, "mergeIconSets", { enumerable: true, get: function () { return merge_1.mergeIconSets; } });
32
- // Import
33
- var index_3 = require("./import/figma/index");
34
- Object.defineProperty(exports, "importFromFigma", { enumerable: true, get: function () { return index_3.importFromFigma; } });
35
- var directory_1 = require("./import/directory");
36
- Object.defineProperty(exports, "importDirectory", { enumerable: true, get: function () { return directory_1.importDirectory; } });
37
- // Download (for import)
38
- var index_4 = require("./download/git/index");
39
- Object.defineProperty(exports, "downloadGitRepo", { enumerable: true, get: function () { return index_4.downloadGitRepo; } });
40
- var hash_1 = require("./download/git/hash");
41
- Object.defineProperty(exports, "getGitRepoHash", { enumerable: true, get: function () { return hash_1.getGitRepoHash; } });
42
- var branch_1 = require("./download/git/branch");
43
- Object.defineProperty(exports, "getGitRepoBranch", { enumerable: true, get: function () { return branch_1.getGitRepoBranch; } });
44
- var reset_1 = require("./download/git/reset");
45
- Object.defineProperty(exports, "resetGitRepoContents", { enumerable: true, get: function () { return reset_1.resetGitRepoContents; } });
46
- var index_5 = require("./download/github/index");
47
- Object.defineProperty(exports, "downloadGitHubRepo", { enumerable: true, get: function () { return index_5.downloadGitHubRepo; } });
48
- var hash_2 = require("./download/github/hash");
49
- Object.defineProperty(exports, "getGitHubRepoHash", { enumerable: true, get: function () { return hash_2.getGitHubRepoHash; } });
50
- var index_6 = require("./download/gitlab/index");
51
- Object.defineProperty(exports, "downloadGitLabRepo", { enumerable: true, get: function () { return index_6.downloadGitLabRepo; } });
52
- var hash_3 = require("./download/gitlab/hash");
53
- Object.defineProperty(exports, "getGitLabRepoHash", { enumerable: true, get: function () { return hash_3.getGitLabRepoHash; } });
54
- var index_7 = require("./download/npm/index");
55
- Object.defineProperty(exports, "downloadNPMPackage", { enumerable: true, get: function () { return index_7.downloadNPMPackage; } });
56
- var version_1 = require("./download/npm/version");
57
- Object.defineProperty(exports, "getNPMVersion", { enumerable: true, get: function () { return version_1.getNPMVersion; } });
58
- Object.defineProperty(exports, "getPackageVersion", { enumerable: true, get: function () { return version_1.getPackageVersion; } });
59
- var index_8 = require("./download/index");
60
- Object.defineProperty(exports, "downloadPackage", { enumerable: true, get: function () { return index_8.downloadPackage; } });
61
- // Manipulation
62
- var parse_2 = require("./colors/parse");
63
- Object.defineProperty(exports, "parseColors", { enumerable: true, get: function () { return parse_2.parseColors; } });
64
- Object.defineProperty(exports, "isEmptyColor", { enumerable: true, get: function () { return parse_2.isEmptyColor; } });
65
- var validate_1 = require("./colors/validate");
66
- Object.defineProperty(exports, "validateColors", { enumerable: true, get: function () { return validate_1.validateColors; } });
67
- var svgo_1 = require("./optimise/svgo");
68
- Object.defineProperty(exports, "runSVGO", { enumerable: true, get: function () { return svgo_1.runSVGO; } });
69
- var flags_1 = require("./optimise/flags");
70
- Object.defineProperty(exports, "deOptimisePaths", { enumerable: true, get: function () { return flags_1.deOptimisePaths; } });
71
- var scale_1 = require("./optimise/scale");
72
- Object.defineProperty(exports, "scaleSVG", { enumerable: true, get: function () { return scale_1.scaleSVG; } });
73
- var global_style_1 = require("./optimise/global-style");
74
- Object.defineProperty(exports, "cleanupGlobalStyle", { enumerable: true, get: function () { return global_style_1.cleanupGlobalStyle; } });
75
- // Export
76
- var directory_2 = require("./export/directory");
77
- Object.defineProperty(exports, "exportToDirectory", { enumerable: true, get: function () { return directory_2.exportToDirectory; } });
78
- var icon_package_1 = require("./export/icon-package");
79
- Object.defineProperty(exports, "exportIconPackage", { enumerable: true, get: function () { return icon_package_1.exportIconPackage; } });
80
- var json_package_1 = require("./export/json-package");
81
- Object.defineProperty(exports, "exportJSONPackage", { enumerable: true, get: function () { return json_package_1.exportJSONPackage; } });
82
- // Misc: files, directories and archives
83
- var write_json_1 = require("./misc/write-json");
84
- Object.defineProperty(exports, "writeJSONFile", { enumerable: true, get: function () { return write_json_1.writeJSONFile; } });
85
- var prepare_1 = require("./export/helpers/prepare");
86
- Object.defineProperty(exports, "prepareDirectoryForExport", { enumerable: true, get: function () { return prepare_1.prepareDirectoryForExport; } });
87
- var scan_1 = require("./misc/scan");
88
- Object.defineProperty(exports, "scanDirectory", { enumerable: true, get: function () { return scan_1.scanDirectory; } });
89
- var compare_dirs_1 = require("./misc/compare-dirs");
90
- Object.defineProperty(exports, "compareDirectories", { enumerable: true, get: function () { return compare_dirs_1.compareDirectories; } });
91
- var unzip_1 = require("./download/helpers/unzip");
92
- Object.defineProperty(exports, "unzip", { enumerable: true, get: function () { return unzip_1.unzip; } });
93
- var untar_1 = require("./download/helpers/untar");
94
- Object.defineProperty(exports, "untar", { enumerable: true, get: function () { return untar_1.untar; } });
95
- // Misc: other
96
- var exec_1 = require("./misc/exec");
97
- Object.defineProperty(exports, "execAsync", { enumerable: true, get: function () { return exec_1.execAsync; } });
98
- var keyword_1 = require("./misc/keyword");
99
- Object.defineProperty(exports, "cleanupIconKeyword", { enumerable: true, get: function () { return keyword_1.cleanupIconKeyword; } });
100
- var bump_version_1 = require("./misc/bump-version");
101
- Object.defineProperty(exports, "bumpVersion", { enumerable: true, get: function () { return bump_version_1.bumpVersion; } });
102
- var index_9 = require("./download/api/index");
103
- Object.defineProperty(exports, "sendAPIQuery", { enumerable: true, get: function () { return index_9.sendAPIQuery; } });
@@ -1,19 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.bumpVersion = void 0;
4
- /**
5
- * Bump version number
6
- */
7
- function bumpVersion(version) {
8
- const versionParts = version.split('.');
9
- const lastPart = versionParts.pop();
10
- const num = parseInt(lastPart);
11
- if (isNaN(num) || num + '' !== lastPart) {
12
- versionParts.push(lastPart + '.1');
13
- }
14
- else {
15
- versionParts.push(num + 1 + '');
16
- }
17
- return versionParts.join('.');
18
- }
19
- exports.bumpVersion = bumpVersion;
@@ -1,84 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.compareDirectories = void 0;
4
- const fs_1 = require("fs");
5
- const prepare_1 = require("../export/helpers/prepare");
6
- const scan_1 = require("./scan");
7
- /**
8
- * Extensions that are treated as text
9
- */
10
- const textFileExtensions = [
11
- 'json',
12
- 'ts',
13
- 'js',
14
- 'mjs',
15
- 'cjs',
16
- 'jsx',
17
- 'tsx',
18
- 'vue',
19
- 'svelte',
20
- 'svg',
21
- 'txt',
22
- 'md',
23
- ];
24
- /**
25
- * Compare directories. Returns true if files are identical, false if different
26
- */
27
- async function compareDirectories(dir1, dir2, options) {
28
- dir1 = (0, prepare_1.normalizeDir)(dir1);
29
- dir2 = (0, prepare_1.normalizeDir)(dir2);
30
- // Get all files
31
- const files1 = await (0, scan_1.scanDirectory)(dir1);
32
- const files2 = await (0, scan_1.scanDirectory)(dir2);
33
- if (files1.length !== files2.length) {
34
- return false;
35
- }
36
- // Options
37
- options = options || {};
38
- const ignoreNewLine = options.ignoreNewLine !== false;
39
- const ignoreVersions = options.ignoreVersions !== false;
40
- const textExtensions = new Set((options.textExtensions || []).concat(textFileExtensions));
41
- // Check all files
42
- for (let i = 0; i < files1.length; i++) {
43
- const file = files1[i];
44
- if (files2.indexOf(file) === -1) {
45
- return false;
46
- }
47
- const ext = file.split('.').pop().toLowerCase();
48
- const isText = textExtensions.has(ext);
49
- if (!isText) {
50
- // Compare binary files
51
- const content1 = await fs_1.promises.readFile(dir1 + '/' + file);
52
- const content2 = await fs_1.promises.readFile(dir2 + '/' + file);
53
- if (Buffer.compare(content1, content2) !== 0) {
54
- return false;
55
- }
56
- continue;
57
- }
58
- // Text files
59
- let content1 = await fs_1.promises.readFile(dir1 + '/' + file, 'utf8');
60
- let content2 = await fs_1.promises.readFile(dir2 + '/' + file, 'utf8');
61
- if (content1 === content2) {
62
- continue;
63
- }
64
- if (ignoreNewLine) {
65
- // Remove space before new line (\r\n -> \n), remove new line at the end
66
- content1 = content1.replace(/\s+\n/g, '\n').trimRight();
67
- content2 = content2.replace(/\s+\n/g, '\n').trimRight();
68
- }
69
- if (ignoreVersions && file.split('/').pop() === 'package.json') {
70
- // Ignore versions in package.json
71
- const data1 = JSON.parse(content1);
72
- const data2 = JSON.parse(content2);
73
- delete data1.version;
74
- delete data2.version;
75
- content1 = JSON.stringify(data1);
76
- content2 = JSON.stringify(data2);
77
- }
78
- if (content1 !== content2) {
79
- return false;
80
- }
81
- }
82
- return true;
83
- }
84
- exports.compareDirectories = compareDirectories;
package/lib/misc/exec.js DELETED
@@ -1,26 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.execAsync = void 0;
4
- const child_process_1 = require("child_process");
5
- /**
6
- * Exec as Promise
7
- */
8
- function execAsync(cmd, options) {
9
- return new Promise((fulfill, reject) => {
10
- (0, child_process_1.exec)(cmd, {
11
- ...options,
12
- encoding: 'utf8',
13
- }, (error, stdout, stderr) => {
14
- if (error) {
15
- reject(error);
16
- }
17
- else {
18
- fulfill({
19
- stdout,
20
- stderr,
21
- });
22
- }
23
- });
24
- });
25
- }
26
- exports.execAsync = execAsync;
@@ -1,31 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.cleanupIconKeyword = void 0;
4
- /**
5
- * Clean up keyword
6
- */
7
- function cleanupIconKeyword(keyword, convertCamelCase = false) {
8
- // Convert camelCase to dash-case
9
- if (convertCamelCase) {
10
- keyword = keyword.replace(/[A-Z]+/g, (chars) => '_' + chars.toLowerCase());
11
- }
12
- // Replace stuff
13
- keyword = keyword
14
- .toLowerCase()
15
- .trim()
16
- // Replace few characters with dash
17
- .replace(/[_.:]/g, '-')
18
- // Remove bad characters
19
- .replace(/[^a-z0-9-]/g, '')
20
- // Replace repeating dash
21
- .replace(/[-]+/g, '-');
22
- // Remove '-' at start and end
23
- if (keyword.slice(0, 1) === '-') {
24
- keyword = keyword.slice(1);
25
- }
26
- if (keyword.slice(-1) === '-') {
27
- keyword = keyword.slice(0, -1);
28
- }
29
- return keyword;
30
- }
31
- exports.cleanupIconKeyword = cleanupIconKeyword;
package/lib/misc/scan.js DELETED
@@ -1,55 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.scanDirectory = void 0;
4
- const fs_1 = require("fs");
5
- async function scanDirectory(path, callback, subdirs = true) {
6
- const results = [];
7
- if (path.length && path.slice(-1) !== '/') {
8
- path += '/';
9
- }
10
- async function scan(subdir) {
11
- const files = await fs_1.promises.readdir(path + subdir);
12
- for (let i = 0; i < files.length; i++) {
13
- const filename = files[i];
14
- if (filename.slice(0, 1) === '.') {
15
- // Exclude hidden items
16
- continue;
17
- }
18
- const stat = await fs_1.promises.stat(path + subdir + filename);
19
- if (stat.isDirectory()) {
20
- if (subdirs) {
21
- await scan(subdir + filename + '/');
22
- }
23
- continue;
24
- }
25
- if (!stat.isFile()) {
26
- continue;
27
- }
28
- const parts = filename.split('.');
29
- const ext = parts.length > 1 ? '.' + parts.pop() : '';
30
- const file = parts.join('.');
31
- // Callback
32
- let callbackResult;
33
- if (callback) {
34
- callbackResult = callback(ext, file, subdir, path, stat);
35
- if (callbackResult instanceof Promise) {
36
- callbackResult = await callbackResult;
37
- }
38
- if (callbackResult === void 0 ||
39
- callbackResult === false ||
40
- callbackResult === null) {
41
- // Skip file
42
- continue;
43
- }
44
- }
45
- else {
46
- callbackResult = true;
47
- }
48
- // Add item
49
- results.push(callbackResult === true ? subdir + filename : callbackResult);
50
- }
51
- }
52
- await scan('');
53
- return results;
54
- }
55
- exports.scanDirectory = scanDirectory;
@@ -1,11 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.writeJSONFile = void 0;
4
- const fs_1 = require("fs");
5
- /**
6
- * Write JSON file
7
- */
8
- async function writeJSONFile(filename, data) {
9
- return fs_1.promises.writeFile(filename, JSON.stringify(data, null, '\t') + '\n');
10
- }
11
- exports.writeJSONFile = writeJSONFile;
@@ -1,312 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.deOptimisePaths = void 0;
4
- const parse_1 = require("../svg/parse");
5
- /**
6
- * Command constants
7
- */
8
- const CLOSE_PATH = 1;
9
- const MOVE_TO = 2;
10
- const HORIZ_LINE_TO = 4;
11
- const VERT_LINE_TO = 8;
12
- const LINE_TO = 16;
13
- const CURVE_TO = 32;
14
- const SMOOTH_CURVE_TO = 64;
15
- const QUAD_TO = 128;
16
- const SMOOTH_QUAD_TO = 256;
17
- const ARC = 512;
18
- /**
19
- * Number of arguments for each command
20
- */
21
- const argCount = {
22
- [MOVE_TO]: 2,
23
- [LINE_TO]: 2,
24
- [HORIZ_LINE_TO]: 1,
25
- [VERT_LINE_TO]: 1,
26
- [CLOSE_PATH]: 0,
27
- [QUAD_TO]: 4,
28
- [SMOOTH_QUAD_TO]: 2,
29
- [CURVE_TO]: 6,
30
- [SMOOTH_CURVE_TO]: 4,
31
- [ARC]: 7,
32
- };
33
- /**
34
- * Check if character is a digit
35
- */
36
- const isDigit = (num) => num >= 48 && num <= 57;
37
- /**
38
- * Check if character is white space
39
- */
40
- const isWhiteSpace = (num) => num === 32 || num === 9 || num === 13 || num === 10;
41
- /**
42
- * Clean up path
43
- *
44
- * @param {string} path
45
- * @return {string}
46
- */
47
- function cleanPath(path) {
48
- const commands = [];
49
- const length = path.length;
50
- let currentNumber = '';
51
- let currentNumberHasExp = false;
52
- let currentNumberHasExpDigits = false;
53
- let currentNumberHasDecimal = false;
54
- let canParseCommandOrComma = true;
55
- let currentCommand = null;
56
- let currentCommandType = null;
57
- let currentArgs = [];
58
- let i = 0;
59
- const finishCommand = () => {
60
- if (currentCommand !== null) {
61
- commands.push({
62
- command: currentCommand,
63
- params: currentArgs.slice(0),
64
- });
65
- currentArgs = [];
66
- canParseCommandOrComma = true;
67
- // Change command for lines after moving
68
- switch (currentCommand) {
69
- case 'M':
70
- currentCommand = 'L';
71
- break;
72
- case 'm':
73
- currentCommand = 'l';
74
- break;
75
- }
76
- }
77
- };
78
- const parseNumber = () => {
79
- // Number ended - validate it
80
- if (currentNumber !== '' && currentCommandType) {
81
- let value = Number(currentNumber);
82
- if (isNaN(value)) {
83
- throw new Error('Invalid number "' + currentNumber + '" at ' + i);
84
- }
85
- // Validate arc arguments
86
- if (currentCommandType === ARC) {
87
- if (currentArgs.length < 2 && value <= 0) {
88
- throw new Error('Expected positive number, got "' + value + '" at ' + i);
89
- }
90
- // eslint-disable-next-line no-constant-condition
91
- while (true) {
92
- // Not flag
93
- if (currentArgs.length < 3 || currentArgs.length > 4) {
94
- break;
95
- }
96
- // Valid flag
97
- if (currentNumber === '0' || currentNumber === '1') {
98
- break;
99
- }
100
- // Unpack flag
101
- const slice = currentNumber.slice(0, 1);
102
- const newNumber = currentNumber.slice(1);
103
- const newValue = Number(newNumber);
104
- if (slice === '0' || slice === '1') {
105
- // Valid flag
106
- if (isNaN(newValue)) {
107
- throw new Error('Invalid number "' + currentNumber + '" at ' + i);
108
- }
109
- currentArgs.push(slice);
110
- currentNumber = newNumber;
111
- value = newValue;
112
- continue;
113
- }
114
- throw new Error('Expected a flag, got "' + currentNumber + '" at ' + i);
115
- }
116
- }
117
- // Add current number to arguments list
118
- currentArgs.push(currentNumber);
119
- if (currentArgs.length === argCount[currentCommandType]) {
120
- finishCommand();
121
- }
122
- currentNumber = '';
123
- currentNumberHasExpDigits = false;
124
- currentNumberHasExp = false;
125
- currentNumberHasDecimal = false;
126
- canParseCommandOrComma = true;
127
- }
128
- };
129
- for (i = 0; i < length; i++) {
130
- const char = path[i];
131
- const num = char.charCodeAt(0);
132
- // Test for number
133
- if (isDigit(num)) {
134
- currentNumber += char;
135
- currentNumberHasExpDigits = currentNumberHasExp;
136
- continue;
137
- }
138
- // Test for exponential number
139
- if (char === 'e' || char === 'E') {
140
- currentNumber += char;
141
- currentNumberHasExp = true;
142
- continue;
143
- }
144
- // Test for number signs
145
- if ((char === '-' || char === '+') &&
146
- currentNumberHasExp &&
147
- !currentNumberHasExpDigits) {
148
- currentNumber += char;
149
- continue;
150
- }
151
- // Decimal point
152
- if (char === '.' && !currentNumberHasExp && !currentNumberHasDecimal) {
153
- currentNumber += char;
154
- currentNumberHasDecimal = true;
155
- continue;
156
- }
157
- // Number ended - validate it
158
- parseNumber();
159
- // White space
160
- if (isWhiteSpace(num)) {
161
- continue;
162
- }
163
- // Only one comma per command
164
- if (canParseCommandOrComma && char === ',') {
165
- canParseCommandOrComma = false;
166
- continue;
167
- }
168
- // New number
169
- if (char === '+' || char === '-' || char === '.') {
170
- currentNumber = char;
171
- currentNumberHasDecimal = char === '.';
172
- continue;
173
- }
174
- // Expecting new command, so argument should be empty
175
- if (currentArgs.length > 0) {
176
- throw new Error('Unexpected command at ' + i);
177
- }
178
- // Test comma, reset value
179
- if (!canParseCommandOrComma) {
180
- throw new Error('Command cannot follow comma at ' + i + '');
181
- }
182
- canParseCommandOrComma = false;
183
- // Detect next command
184
- currentCommand = char;
185
- switch (char) {
186
- case 'z':
187
- case 'Z':
188
- // Close path
189
- commands.push({
190
- command: char,
191
- params: [],
192
- });
193
- canParseCommandOrComma = true;
194
- currentCommandType = null;
195
- currentCommand = null;
196
- break;
197
- case 'h':
198
- case 'H':
199
- // Horizontal move
200
- currentCommandType = HORIZ_LINE_TO;
201
- break;
202
- case 'v':
203
- case 'V':
204
- // Vertical move
205
- currentCommandType = VERT_LINE_TO;
206
- break;
207
- case 'm':
208
- case 'M':
209
- // Move to
210
- currentCommandType = MOVE_TO;
211
- break;
212
- case 'l':
213
- case 'L':
214
- // Line to
215
- currentCommandType = LINE_TO;
216
- break;
217
- case 'c':
218
- case 'C':
219
- // Curve
220
- currentCommandType = CURVE_TO;
221
- break;
222
- case 's':
223
- case 'S':
224
- // Smooth curve
225
- currentCommandType = SMOOTH_CURVE_TO;
226
- break;
227
- case 'q':
228
- case 'Q':
229
- // Quadratic bezier curve
230
- currentCommandType = QUAD_TO;
231
- break;
232
- case 't':
233
- case 'T':
234
- // Smooth quadratic bezier curve
235
- currentCommandType = SMOOTH_QUAD_TO;
236
- break;
237
- case 'a':
238
- case 'A':
239
- // Elliptic arc
240
- currentCommandType = ARC;
241
- break;
242
- default:
243
- throw new Error('Unexpected character "' + char + '" at ' + i);
244
- }
245
- }
246
- // Parse last number
247
- parseNumber();
248
- // Add last command
249
- if (currentArgs.length) {
250
- if (!currentCommandType) {
251
- throw new Error('Empty path');
252
- }
253
- if (currentArgs.length !== argCount[currentCommandType]) {
254
- throw new Error('Unexpected end of path at ' + i);
255
- }
256
- finishCommand();
257
- }
258
- // Build path
259
- let output = '';
260
- commands.forEach((item) => {
261
- output += item.command;
262
- item.params.forEach((value, index) => {
263
- if (index > 0) {
264
- const char = value[0];
265
- // noinspection FallThroughInSwitchStatementJS
266
- switch (char) {
267
- case '-':
268
- case '+':
269
- // Number - no space
270
- break;
271
- case '.':
272
- // Dot - no space if previous entry was command
273
- if (index < 1) {
274
- break;
275
- }
276
- // No space if previous entry had dot
277
- if (item.params[index - 1].indexOf('.') !== -1) {
278
- break;
279
- }
280
- // no-fallthrough
281
- default:
282
- output += ' ';
283
- }
284
- }
285
- output += value;
286
- });
287
- });
288
- return output;
289
- }
290
- /**
291
- * De-optimise paths. Compressed paths are still not supported by some software.
292
- */
293
- async function deOptimisePaths(svg) {
294
- await (0, parse_1.parseSVG)(svg, (item) => {
295
- if (item.tagName !== 'path') {
296
- return;
297
- }
298
- const d = item.element.attribs.d;
299
- if (typeof d === 'string') {
300
- try {
301
- const optimised = cleanPath(d);
302
- if (optimised !== d) {
303
- item.$element.attr('d', optimised);
304
- }
305
- }
306
- catch (err) {
307
- //
308
- }
309
- }
310
- });
311
- }
312
- exports.deOptimisePaths = deOptimisePaths;