diff --git a/packages/react-icons/VERSIONS b/packages/react-icons/VERSIONS index be1a3dbda..ceebabcb6 100644 --- a/packages/react-icons/VERSIONS +++ b/packages/react-icons/VERSIONS @@ -9,7 +9,7 @@ | [Typicons](http://s-ings.com/typicons/) | [CC BY-SA 3.0](https://creativecommons.org/licenses/by-sa/3.0/) | 2.1.2 | 336 | | [Github Octicons icons](https://octicons.github.com/) | [MIT](https://github.com/primer/octicons/blob/master/LICENSE) | 18.3.0 | 264 | | [Feather](https://feathericons.com/) | [MIT](https://github.com/feathericons/feather/blob/master/LICENSE) | 4.29.1 | 287 | -| [Lucide](https://lucide.dev/) | [ISC](https://github.com/lucide-icons/lucide/blob/main/LICENSE) | v4.11.0-15-g7493227d | 1215 | +| [Lucide](https://lucide.dev/) | [ISC](https://github.com/lucide-icons/lucide/blob/main/LICENSE) | v4.12.0-2-g399b45c3 | 1215 | | [Game Icons](https://game-icons.net/) | [CC BY 3.0](https://creativecommons.org/licenses/by/3.0/) | 12920d6565588f0512542a3cb0cdfd36a497f910 | 4040 | | [Weather Icons](https://erikflowers.github.io/weather-icons/) | [SIL OFL 1.1](http://scripts.sil.org/OFL) | 2.0.12 | 219 | | [Devicons](https://vorillaz.github.io/devicons/) | [MIT](https://opensource.org/licenses/MIT) | 1.8.0 | 192 | diff --git a/packages/react-icons/package.json b/packages/react-icons/package.json index af3da9bcb..0ca32775e 100644 --- a/packages/react-icons/package.json +++ b/packages/react-icons/package.json @@ -43,7 +43,7 @@ "lucide-static": "^0.263.0", "p-queue": "^7.3.0", "prettier": "^2.7.1", - "svgo": "^1.3.2", + "svgo": "^3.0.3", "typescript": "^4.8.4" }, "scripts": { diff --git a/packages/react-icons/scripts/svgo.ts b/packages/react-icons/scripts/svgo.ts index ecc7780fa..617985a62 100644 --- a/packages/react-icons/scripts/svgo.ts +++ b/packages/react-icons/scripts/svgo.ts @@ -1,116 +1,34 @@ -import SVGO from "svgo"; +import {Config} from "svgo"; -export const svgo = new SVGO({ +export const svgoConfig: Config = { plugins: [ { - cleanupAttrs: true, - }, - { - removeDoctype: true, - }, - { - removeXMLProcInst: true, - }, - { - removeComments: true, - }, - { - removeMetadata: true, - }, - { - removeTitle: true, - }, - { - removeDesc: true, - }, - { - removeUselessDefs: true, - }, - { - removeEditorsNSData: true, - }, - { - removeEmptyAttrs: true, - }, - { - removeHiddenElems: true, - }, - { - removeEmptyText: true, - }, - { - removeEmptyContainers: true, - }, - { - removeViewBox: false, - }, - { - cleanupEnableBackground: true, - }, - { - convertStyleToAttrs: true, - }, - { - convertColors: { - currentColor: true, + name: 'preset-default', + params: { + overrides: { + removeViewBox: false, + convertColors: { + currentColor: true, + } + }, }, }, { - convertPathData: true, + name: 'convertStyleToAttrs' }, { - convertTransform: true, + name: 'removeDimensions' }, - { - removeUnknownsAndDefaults: true, - }, - { - removeNonInheritableGroupAttrs: true, - }, - { - removeUselessStrokeAndFill: true, - }, - { - removeUnusedNS: true, - }, - { - cleanupIDs: true, - }, - { - cleanupNumericValues: true, - }, - { - moveElemsAttrsToGroup: true, - }, - { - moveGroupAttrsToElems: true, - }, - { - collapseGroups: true, - }, - { - removeRasterImages: false, - }, - { - mergePaths: true, - }, - { - convertShapeToPath: true, - }, - { - sortAttrs: true, - }, - { - removeDimensions: true, - }, - { - removeAttributesBySelector: { - selector: "*:not(svg)", - attributes: ["stroke"], + { + name: 'removeAttributesBySelector', + params: { + selector: "*:not(svg)", + attributes: ["stroke"], + }, }, - }, - { - removeAttrs: { attrs: "data.*" }, - }, - ], -}); + { + name: 'removeAttrs', + params: { attrs: "data.*" }, + }, + ] +} diff --git a/packages/react-icons/scripts/task_all.ts b/packages/react-icons/scripts/task_all.ts index 647a0d655..601032ae3 100644 --- a/packages/react-icons/scripts/task_all.ts +++ b/packages/react-icons/scripts/task_all.ts @@ -4,7 +4,8 @@ import camelcase from "camelcase"; import { icons } from "../src/icons"; import { iconRowTemplate } from "./templates"; import { getIconFiles, convertIconData, rmDirRecursive } from "./logics"; -import { svgo } from "./svgo"; +import { svgoConfig } from "./svgo"; +import { optimize as svgoOptimize } from "svgo"; // eslint-disable-next-line @typescript-eslint/no-unused-vars export async function dirInit({ DIST, LIB, rootDir }) { @@ -65,7 +66,7 @@ export async function writeIconModule(icon, { DIST, LIB, rootDir }) { for (const file of files) { const svgStrRaw = await fs.readFile(file, "utf8"); const svgStr = content.processWithSVGO - ? await svgo.optimize(svgStrRaw).then((result) => result.data) + ? svgoOptimize(svgStrRaw, svgoConfig).data : svgStrRaw; const iconData = await convertIconData(svgStr, content.multiColor); diff --git a/packages/react-icons/scripts/task_files.ts b/packages/react-icons/scripts/task_files.ts index 246682315..ede0d5488 100644 --- a/packages/react-icons/scripts/task_files.ts +++ b/packages/react-icons/scripts/task_files.ts @@ -4,7 +4,8 @@ import camelcase from "camelcase"; import { icons } from "../src/icons"; import { iconRowTemplate } from "./templates"; import { getIconFiles, convertIconData, rmDirRecursive } from "./logics"; -import { svgo } from "./svgo"; +import { svgoConfig } from "./svgo"; +import { optimize as svgoOptimize } from "svgo"; import { IconDefinition } from "./_types"; // eslint-disable-next-line @typescript-eslint/no-unused-vars @@ -49,7 +50,7 @@ export async function writeIconModuleFiles( for (const file of files) { const svgStrRaw = await fs.readFile(file, "utf8"); const svgStr = content.processWithSVGO - ? await svgo.optimize(svgStrRaw).then((result) => result.data) + ? await svgoOptimize(svgStrRaw, svgoConfig).data : svgStrRaw; const iconData = await convertIconData(svgStr, content.multiColor); diff --git a/yarn.lock b/yarn.lock index 91909bda8..e9cb53603 100644 --- a/yarn.lock +++ b/yarn.lock @@ -8255,6 +8255,26 @@ __metadata: languageName: node linkType: hard +"css-tree@npm:^2.2.1": + version: 2.3.1 + resolution: "css-tree@npm:2.3.1" + dependencies: + mdn-data: 2.0.30 + source-map-js: ^1.0.1 + checksum: 493cc24b5c22b05ee5314b8a0d72d8a5869491c1458017ae5ed75aeb6c3596637dbe1b11dac2548974624adec9f7a1f3a6cf40593dc1f9185eb0e8279543fbc0 + languageName: node + linkType: hard + +"css-tree@npm:~2.2.0": + version: 2.2.1 + resolution: "css-tree@npm:2.2.1" + dependencies: + mdn-data: 2.0.28 + source-map-js: ^1.0.1 + checksum: b94aa8cc2f09e6f66c91548411fcf74badcbad3e150345074715012d16333ce573596ff5dfca03c2a87edf1924716db765120f94247e919d72753628ba3aba27 + languageName: node + linkType: hard + "css-what@npm:^3.2.1": version: 3.4.2 resolution: "css-what@npm:3.4.2" @@ -8346,6 +8366,15 @@ __metadata: languageName: node linkType: hard +"csso@npm:5.0.5": + version: 5.0.5 + resolution: "csso@npm:5.0.5" + dependencies: + css-tree: ~2.2.0 + checksum: 0ad858d36bf5012ed243e9ec69962a867509061986d2ee07cc040a4b26e4d062c00d4c07e5ba8d430706ceb02dd87edd30a52b5937fd45b1b6f2119c4993d59a + languageName: node + linkType: hard + "csso@npm:^4.0.2, csso@npm:^4.2.0": version: 4.2.0 resolution: "csso@npm:4.2.0" @@ -15589,6 +15618,20 @@ __metadata: languageName: node linkType: hard +"mdn-data@npm:2.0.28": + version: 2.0.28 + resolution: "mdn-data@npm:2.0.28" + checksum: f51d587a6ebe8e426c3376c74ea6df3e19ec8241ed8e2466c9c8a3904d5d04397199ea4f15b8d34d14524b5de926d8724ae85207984be47e165817c26e49e0aa + languageName: node + linkType: hard + +"mdn-data@npm:2.0.30": + version: 2.0.30 + resolution: "mdn-data@npm:2.0.30" + checksum: d6ac5ac7439a1607df44b22738ecf83f48e66a0874e4482d6424a61c52da5cde5750f1d1229b6f5fa1b80a492be89465390da685b11f97d62b8adcc6e88189aa + languageName: node + linkType: hard + "mdn-data@npm:2.0.4": version: 2.0.4 resolution: "mdn-data@npm:2.0.4" @@ -19628,7 +19671,7 @@ __metadata: lucide-static: ^0.263.0 p-queue: ^7.3.0 prettier: ^2.7.1 - svgo: ^1.3.2 + svgo: ^3.0.3 typescript: ^4.8.4 peerDependencies: react: "*" @@ -22204,7 +22247,7 @@ __metadata: languageName: node linkType: hard -"svgo@npm:^1.2.2, svgo@npm:^1.3.2": +"svgo@npm:^1.2.2": version: 1.3.2 resolution: "svgo@npm:1.3.2" dependencies: @@ -22244,6 +22287,22 @@ __metadata: languageName: node linkType: hard +"svgo@npm:^3.0.3": + version: 3.0.3 + resolution: "svgo@npm:3.0.3" + dependencies: + "@trysound/sax": 0.2.0 + commander: ^7.2.0 + css-select: ^5.1.0 + css-tree: ^2.2.1 + csso: 5.0.5 + picocolors: ^1.0.0 + bin: + svgo: ./bin/svgo + checksum: 0e34c70b9ff429e6c6773a0607063c2893fa655fffe3d0c2ea236764e54f77c6eb0cfc510a05ae11f589e343b59aef5ad210022aa49cd81eb6ad16446e2e0388 + languageName: node + linkType: hard + "symbol-tree@npm:^3.2.4": version: 3.2.4 resolution: "symbol-tree@npm:3.2.4"