nuxt-modules / svg-sprite

Optimize SVG files and combine them into sprite
https://codesandbox.io/s/github/nuxt-community/svg-sprite-module/
MIT License
295 stars 41 forks source link

chore(deps): update dependency svgo to v3 - autoclosed #275

Closed renovate[bot] closed 1 year ago

renovate[bot] commented 1 year ago

Mend Renovate

This PR contains the following updates:

Package Change Age Adoption Passing Confidence
svgo ^1.3.2 -> ^3.0.2 age adoption passing confidence

Release Notes

svg/svgo ### [`v3.0.2`](https://togithub.com/svg/svgo/releases/tag/v3.0.2) [Compare Source](https://togithub.com/svg/svgo/compare/v3.0.1...v3.0.2) Installing `@types/csso` no longer required ### [`v3.0.1`](https://togithub.com/svg/svgo/releases/tag/v3.0.1) [Compare Source](https://togithub.com/svg/svgo/compare/v3.0.0...v3.0.1) - store exposed types only in .d.ts files, no longer need to enable js checking - update svgo.browser.js - fixed "begin" attribute cleanup Thanks to [@​Kreeg](https://togithub.com/Kreeg), [@​XhmikosR](https://togithub.com/XhmikosR) and [@​TrySound](https://togithub.com/TrySound) ### [`v3.0.0`](https://togithub.com/svg/svgo/releases/tag/v3.0.0) [Compare Source](https://togithub.com/svg/svgo/compare/v2.8.0...v3.0.0) ### SVGO v3 #### Improvements and fixes - fixed `datauri` option when `multipass` is not enabled - improved default preset warnings #### Breaking channges - Node.js 14+ is required for version - stable package is replaced with native stable sort (required node 12+) ##### Config Typescript types are exposed out of the box. No longer need to install `@types/svgo` ```js // svgo.config.js /** * @​type {import('svgo').Config} */ export default { // svgo configuration } ``` Active flag is no longer supported ```js export default { plugins: [ { name: 'removeDoctype', active: true }, { name: 'removeComments', active: false } ] } ``` `extendDefaultPlugins` is removed, `preset-default` plugin should be used instead when need to customize plugins defaults ```js export default { plugins: [ { name: 'preset-default', params: { overrides: { // plugins customization } } } ] } ``` Enabled sortAttrs plugin by default to get better gzip compression. ```diff - + ``` Can be disabled if necessary ```js export default { plugins: [ { name: 'preset-default', params: { overrides: { sortAttrs: false } } } ] } ``` cleanupIDs plugin is renamed to cleanupIds ```js export default { plugins: [ 'cleanupIds' ] } // or export default { plugins: [ { name: 'preset-default', params: { overrides: { cleanupIds: {} } } } ] } ``` Removed cleanupIds plugin "prefix" param, prefixIds should be used instead ```js export default { plugins: [ 'cleanupIds', { name: 'prefixIds', params: { prefix: 'my-prefix' } } ] } ``` ##### Public API Removed width and height from optimization result. ```js const { width, height } = optimize(svg).info ``` Can be found with custom plugin ```js let width = null let height = null const plugin = { name: 'find-size', fn: () => { return { element: { enter: (node, parentNode) => { if (parentNode.type === 'root') { width = node.attributes.width height = node.attributes.height } } } } } } optimize(svg, { plugins: ['preset-default', plugin] }) ``` Removed error and modernError from optimization result ```js const {data, error, modernError } = optimize(svg) ``` Now all errors are thrown, parsing error can be checked by name ```js try { const { data } = optimize(svg) } catch (error) { if (error.name === 'SvgoParserError') { // formatted error error.toString() } else { // runtime error } } ``` ##### Custom plugins Removed `full`, `perItem` and `perItemReverse` plugin types. `visitor` is the only supported plugin api so `plugin.type` is no longer required. Removed `plugin.active` flag. Removed `plugin.params` used as default params, destructuring with defaults can be used instead `name` and `fn` are only required now ```js const plugin = { name: 'my-custom-plugin', fn: (root, params) => { const { myParam = true } = params return {} } } ``` Removed `createContentItem` and JSAPI class from nodes. All nodes are now plain objects with one exception. parentNode need to be defined to not break builtin plugins. ```js const plugin = { name: 'my-custom-plugin', fn: () => { return { element: { enter: (node) => { if (node === 'g') { const child = { type: 'element', name: 'g', attributes: {}, children: [] } Object.defineProperty(child, 'parentNode', { writable: true, value: node, }) node.children.push(child) } } } } } } ``` Thanks to [@​istarkov](https://togithub.com/istarkov), [@​boidolr](https://togithub.com/boidolr), [@​deining](https://togithub.com/deining), [@​ranman](https://togithub.com/ranman), [@​mondeja](https://togithub.com/mondeja), [@​liamcmitchell-sc](https://togithub.com/liamcmitchell-sc), [@​rogierslag](https://togithub.com/rogierslag), [@​kriskowal](https://togithub.com/kriskowal), [@​hugolpz](https://togithub.com/hugolpz) and [@​TrySound](https://togithub.com/TrySound) ### [`v2.8.0`](https://togithub.com/svg/svgo/releases/tag/v2.8.0) [Compare Source](https://togithub.com/svg/svgo/compare/v2.7.0...v2.8.0) If you enjoy SVGO and would like to support our work, consider sponsoring us directly via our [OpenCollective](https://opencollective.com/svgo). Join us in our [discord](https://discord.gg/z8jX8NYxrE) #### Features and bug fixes - added --no-color flag for testing purposes but you may find it useful ([https://github.com/svg/svgo/pull/1588](https://togithub.com/svg/svgo/pull/1588)) - handle url() in style attributes properly ([https://github.com/svg/svgo/pull/1592](https://togithub.com/svg/svgo/pull/1592)) - removeXMLNS plugin now removes `xmlns:xlink` attribute ([https://github.com/svg/svgo/pull/1508](https://togithub.com/svg/svgo/pull/1508)) - load .cjs configuration only with `require` to fix segfaults in linux ([https://github.com/svg/svgo/pull/1605](https://togithub.com/svg/svgo/pull/1605)) #### Refactorings - simplified and covered with types svg stringifier ([https://github.com/svg/svgo/pull/1593](https://togithub.com/svg/svgo/pull/1593)) - migrated to visitor api and covered with types removeEmptyAttrs plugin ([https://github.com/svg/svgo/pull/1594](https://togithub.com/svg/svgo/pull/1594)) - migrated to visitor api and covered with types inlineStyles plugin ([https://github.com/svg/svgo/pull/1601](https://togithub.com/svg/svgo/pull/1601)) - migrated to picocolors ([https://github.com/svg/svgo/pull/1606](https://togithub.com/svg/svgo/pull/1606)) #### DX I found some users are trying to enable plugins which are not part of default preset, for example ```js { name: 'preset-default', params: { overrides: { cleanupListOfValues: true } } } ``` To fix this I made docs more concrete about plugin (https://github.com/svg/svgo/commit/5165ccb9d1f116b26a30a020e65aadd666012cb1) and introduced a warning when true is specified in overrides (https://github.com/svg/svgo/commit/cb7e9be623b6e2fbbfcb9b67c4c85131e1477925). Please give us feedback if you still have issues. Thanks to [@​IlyaSkriblovsky](https://togithub.com/IlyaSkriblovsky), [@​devongovett](https://togithub.com/devongovett), [@​matheus1lva](https://togithub.com/matheus1lva), [@​omgovich](https://togithub.com/omgovich), [@​renatorib](https://togithub.com/renatorib) and [@​TrySound](https://togithub.com/TrySound) ### [`v2.7.0`](https://togithub.com/svg/svgo/releases/tag/v2.7.0) [Compare Source](https://togithub.com/svg/svgo/compare/v2.6.1...v2.7.0) If you enjoy SVGO and would like to support our work, consider sponsoring us directly via our [OpenCollective](https://opencollective.com/svgo). Join us in our [discord](https://discord.gg/z8jX8NYxrE) #### ES Modules support This release adds support for es modules in svgo.config.js when package.json type field is "module". For projects with mixed cjs and esm svgo.config.mjs and svgo.config.cjs are also supported as fallback. See [https://github.com/svg/svgo/pull/1583](https://togithub.com/svg/svgo/pull/1583) ```js export default { plugins: [ 'preset-default' ] } ``` #### Fixes - added validation to removeAttrs plugin ([https://github.com/svg/svgo/pull/1582](https://togithub.com/svg/svgo/pull/1582)) #### Refactorings Follwing plugins are migrated to the new visitor plugin api and covered with tsdoc - collapseGroups ([https://github.com/svg/svgo/pull/1572](https://togithub.com/svg/svgo/pull/1572)) - mergeStyles ([https://github.com/svg/svgo/pull/1575](https://togithub.com/svg/svgo/pull/1575)) - moveElemsAttrsToGroup ([https://github.com/svg/svgo/pull/1574](https://togithub.com/svg/svgo/pull/1574)) Other internal changes - covered svg parser with tsdoc ([https://github.com/svg/svgo/pull/1584](https://togithub.com/svg/svgo/pull/1584)) - avoided parentNode in style manager which makes us one step closer to releasing new plugin api publicly ([https://github.com/svg/svgo/pull/1576](https://togithub.com/svg/svgo/pull/1576)) - replaced colorette with nanocolors ([https://github.com/svg/svgo/pull/1586](https://togithub.com/svg/svgo/pull/1586)) Thanks to [@​renatorib](https://togithub.com/renatorib), [@​matheus1lva](https://togithub.com/matheus1lva), [@​omgovich](https://togithub.com/omgovich), [@​deepsweet](https://togithub.com/deepsweet), [@​ai](https://togithub.com/ai), [@​samouss](https://togithub.com/samouss) and [@​TrySound](https://togithub.com/TrySound) ### [`v2.6.1`](https://togithub.com/svg/svgo/releases/tag/v2.6.1) [Compare Source](https://togithub.com/svg/svgo/compare/v2.6.0...v2.6.1) - fixed `optimize(svg)` usage without config ([https://github.com/svg/svgo/pull/1573](https://togithub.com/svg/svgo/pull/1573)) - added missing filter primitives to collections ([https://github.com/svg/svgo/pull/1571](https://togithub.com/svg/svgo/pull/1571)) - migrated to visitor plugin api and covered with tsdoc removeEmptyContainers plugin ([https://github.com/svg/svgo/pull/1570](https://togithub.com/svg/svgo/pull/1570)) Thanks to [@​XhmikosR](https://togithub.com/XhmikosR), [@​thewilkybarkid](https://togithub.com/thewilkybarkid), [@​renatorib](https://togithub.com/renatorib), [@​matheus1lva](https://togithub.com/matheus1lva), [@​omgovich](https://togithub.com/omgovich) and [@​TrySound](https://togithub.com/TrySound) ### [`v2.6.0`](https://togithub.com/svg/svgo/releases/tag/v2.6.0) [Compare Source](https://togithub.com/svg/svgo/compare/v2.5.0...v2.6.0) If you enjoy SVGO and would like to support our work, consider sponsoring us directly via our [OpenCollective](https://opencollective.com/svgo). We have some good stuff in this release #### Better syntax errors ([https://github.com/svg/svgo/pull/1553](https://togithub.com/svg/svgo/pull/1553)) Before people struggled to figure out what and why happens with such cryptic error Error: Error in parsing SVG: Unquoted attribute value Line: 1 Column: 29 Char: 6 File: input.svg This gives too little information when a lot of svgs are transformed. New errors look like this, include context and point to exact location with the issue. We hope this will solve many issues when dealing with bundlers and other tools integrations. Error: SvgoParserError: input.svg:2:29: Unquoted attribute value 1 | > 2 | | ^ 3 | 4 | #### pefixIds plugin is now idempotent ([https://github.com/svg/svgo/pull/1561](https://togithub.com/svg/svgo/pull/1561)) To get better compression results SVGO uses multipass option. This option is used to run prefixIds plugin only once to prefix ids and classes properly. Though sometimes users run svgo manually a few times which leads to duplicated prefixes and make code much bigger. To solves this prefixIds was redesigned to add prefix only when it does not exit in ids and classes. Eventually all plugins are planned to be determenistic and idempotent so multipass option would not be necessary and single pass compression could be as effective as possible. #### New js2svg options ([https://github.com/svg/svgo/pull/1546](https://togithub.com/svg/svgo/pull/1546)) js2svg.eol: 'lf' | 'crlf' Allows to customize end of line characters which is usually resolved by os.EOL in node. finalNewline: boolean Ensures SVG output has a final newline which is required for some tools like git. #### Fixes and refactorings Follwing plugins are migrated to the new visitor plugin api and covered with tsdoc - reusePaths ([https://github.com/svg/svgo/pull/1551](https://togithub.com/svg/svgo/pull/1551)) - removeUselessStrokeAndFill ([https://github.com/svg/svgo/pull/1549](https://togithub.com/svg/svgo/pull/1549)) - minifyStyles ([https://github.com/svg/svgo/pull/1552](https://togithub.com/svg/svgo/pull/1552)) - cleanupIDs ([https://github.com/svg/svgo/pull/1556](https://togithub.com/svg/svgo/pull/1556)) - removeEditorsNSData ([https://github.com/svg/svgo/pull/1557](https://togithub.com/svg/svgo/pull/1557)) - removeUnusedNS ([https://github.com/svg/svgo/pull/1559](https://togithub.com/svg/svgo/pull/1559)) - prefixIds ([https://github.com/svg/svgo/pull/1561](https://togithub.com/svg/svgo/pull/1561)) - sortAttrs ([https://github.com/svg/svgo/pull/1564](https://togithub.com/svg/svgo/pull/1564)) Also fixed a few bugs - add xmlns:xlink in reusePaths plugin when missing ([https://github.com/svg/svgo/pull/1555](https://togithub.com/svg/svgo/pull/1555)) - fixed removeNone param in removeUselessStrokeAndFill plugin ([https://github.com/svg/svgo/pull/1549](https://togithub.com/svg/svgo/pull/1549)) Thanks to [@​XhmikosR](https://togithub.com/XhmikosR), [@​matheus1lva](https://togithub.com/matheus1lva), [@​deepsweet](https://togithub.com/deepsweet), [@​omgovich](https://togithub.com/omgovich), [@​adalinesimonian](https://togithub.com/adalinesimonian) and [@​TrySound](https://togithub.com/TrySound) ### [`v2.5.0`](https://togithub.com/svg/svgo/releases/tag/v2.5.0) [Compare Source](https://togithub.com/svg/svgo/compare/v2.4.0...v2.5.0) In this release we have a couple of fixes - fixed removing transform-origin attribute (https://github.com/svg/svgo/commit/680e143daf622bc3ace9e0b82f626507caad0530) - fixed applying transform to path arc with zero radius (https://github.com/svg/svgo/commit/ac8edbaf4163fd7e0934b72175d60e71844d8cf9) Visitor api now get parentNode in enter and exit callback ```js return { element: { enter: (node, parentNode) => { }, exit: (node, parentNode) => { } } } ``` And a lot of plugins are migrated to visitor api and covered them with tsdoc - addAttributesToSVGElement - addClassesToSVGElement - cleanupAttrs - cleanupEnableBackground - cleanupListOfValues - cleanupNumericValues - convertColors - convertEllipseToCircle - convertShapeToPath - convertTransform - mergePaths - removeAttributesBySelector - removeAttrs - removeComments - removeDesc - removeDoctype - removeElementsByAttr - removeEmptyText - removeMetadata - removeRasterImages - removeScriptElement - removeStyleElement - removeTitle - removeXMLProcInst - removeHiddenElems - removeViewBox - removeUselessDefs - removeOffCanvasPaths - removeUnknownsAndDefaults - sortDefsChildren Thanks to [@​XhmikosR](https://togithub.com/XhmikosR), [@​morganney](https://togithub.com/morganney), [@​oBusk](https://togithub.com/oBusk), [@​matheus1lva](https://togithub.com/matheus1lva) and [@​TrySound](https://togithub.com/TrySound) ### [`v2.4.0`](https://togithub.com/svg/svgo/releases/tag/v2.4.0) [Compare Source](https://togithub.com/svg/svgo/compare/v2.3.1...v2.4.0) Hey everybody! In this release I happy to introduce the new plugin "preset-default" which allows to declaratively setup and customize default set of plugins. Previous solution `extendDefaultPlugins` utility prevented parcel users from using cachable json config, svgo-loader and svgo-jsx required svgo to be installed locally. "preset-default" plugin is just another builtin plugi. ```js module.exports = { plugins: [ { name: 'preset-default', params: { overrides: { // customize options builtinPluginName: { optionName: 'optionValue', }, // or disable plugins anotherBuiltinPlugin: false, }, }, }, ], }; ``` We also fixed a few bugs - performance is improved by ~37% for svg with styles ([https://github.com/svg/svgo/pull/1456](https://togithub.com/svg/svgo/pull/1456)) - reset cursor after "closeto" command when applying transformation (https://github.com/svg/svgo/commit/9e578b515a6b23e6ab4bd41f7b28e2655d3bd110) - fixed usage of removed internal methods ([https://github.com/svg/svgo/pull/1479](https://togithub.com/svg/svgo/pull/1479)) - chalk is replaced with smaller colorette ([https://github.com/svg/svgo/pull/1511](https://togithub.com/svg/svgo/pull/1511)) - test files are excluded from published package ([https://github.com/svg/svgo/pull/1458](https://togithub.com/svg/svgo/pull/1458)) - remove more spaces around flag in arc command [https://github.com/svg/svgo/pull/1484](https://togithub.com/svg/svgo/pull/1484) Thanks to [@​TrySound](https://togithub.com/TrySound), [@​ydaniv](https://togithub.com/ydaniv), [@​ludofischer](https://togithub.com/ludofischer), [@​XhmikosR](https://togithub.com/XhmikosR) and [@​joseprio](https://togithub.com/joseprio) ### [`v2.3.1`](https://togithub.com/svg/svgo/releases/tag/v2.3.1) [Compare Source](https://togithub.com/svg/svgo/compare/v2.3.0...v2.3.1) Fixed vulnerability in css-select dependency ([https://github.com/svg/svgo/pull/1485](https://togithub.com/svg/svgo/pull/1485)) Thanks to [@​ericcornelissen](https://togithub.com/ericcornelissen) ### [`v2.3.0`](https://togithub.com/svg/svgo/releases/tag/v2.3.0) [Compare Source](https://togithub.com/svg/svgo/compare/v2.2.2...v2.3.0) Hey, everybody! We have a big release here. - The new plugin is added for merging style elements into one. See [#​1381](https://togithub.com/svg/svgo/issues/1381) Before: ```svg ``` After: ```svg ``` - CLI got new `--exclude` flag which uses regexps to exclude some files from `--folder`. See [#​1409](https://togithub.com/svg/svgo/issues/1409) ```bash svgo --folder=svgs --exclude "invalid-icon" "bad-.+" ``` - Internal AST is migrated to [XAST](https://togithub.com/syntax-tree/xast). This spec makes maintaining plugins easier and may be used as interop with other tools like SVGR. - The new visitor plugin type combines features of "full", "perItem" and "perItemReverse" plugins without loosing simplicity. Eventually only visitor api will be supported. See [#​1454](https://togithub.com/svg/svgo/issues/1454) Also small fixes - override default floatPrecision in plugins with globally specified one (https://github.com/svg/svgo/commit/7389bcddbfadc49de84203b048199b4a397d656a) - fix rendering -0 in path data (https://github.com/svg/svgo/commit/3d4adb6b044ff1361a970ea049f90d5626ea9888) - make browser bundle 30% smaller (https://github.com/svg/svgo/commit/279962207e8c99ca8dd9f0ac093071aabafc8721) - simplified convertPathData plugin (https://github.com/svg/svgo/commit/a04b27a1df12b9e6dc019fb8d50733d3d280a5c5 and https://github.com/svg/svgo/commit/61657433e161b6e5de61d470ac34e302b3aa297b) - prepared for more regression tests (https://github.com/svg/svgo/commit/d89d36eacec7bd52002ef55ec6e2bd698352123e) Thanks to [@​chambo-e](https://togithub.com/chambo-e), [@​strarsis](https://togithub.com/strarsis), [@​XhmikosR](https://togithub.com/XhmikosR), [@​omgovich](https://togithub.com/omgovich) and [@​TrySound](https://togithub.com/TrySound) ### [`v2.2.2`](https://togithub.com/svg/svgo/releases/tag/v2.2.2) [Compare Source](https://togithub.com/svg/svgo/compare/v2.2.1...v2.2.2) - ignore keyframes in computeStyle (https://github.com/svg/svgo/commit/ddbd7046b2aed8133864b2d98feef6a80f665540) ### [`v2.2.1`](https://togithub.com/svg/svgo/releases/tag/v2.2.1) [Compare Source](https://togithub.com/svg/svgo/compare/v2.2.0...v2.2.1) This is a big patch with new style computing ([https://github.com/svg/svgo/pull/1399](https://togithub.com/svg/svgo/pull/1399)) and landed to master regression tests A lot of bugs are fixed - fixed scientific notation parsing in paths (https://github.com/svg/svgo/commit/d6f972c970d3cdd68ccc740e1a610ff0b23fcd34) - forbade invalid `