jaywcjlove / svgtofont

Read a set of SVG icons and ouput a TTF/EOT/WOFF/WOFF2/SVG font.
https://jaywcjlove.github.io/svgtofont
MIT License
515 stars 81 forks source link

fix(deps): update dependency svgo to v3 #185

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 ~2.8.0 -> ~3.0.0 age adoption passing confidence

Release Notes

svg/svgo ### [`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)

Configuration

šŸ“… Schedule: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined).

šŸš¦ Automerge: Disabled by config. Please merge this manually once you are satisfied.

ā™» Rebasing: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.

šŸ”• Ignore: Close this PR and you won't be reminded about this update again.



This PR has been generated by Mend Renovate. View repository job log here.