Socket
Socket
Sign inDemoInstall

svgo

Package Overview
Dependencies
17
Maintainers
3
Versions
102
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 2.6.0 to 2.6.1

5

lib/svgo-node.js

@@ -57,2 +57,5 @@ 'use strict';

const optimize = (input, config) => {
if (config == null) {
config = {};
}
if (typeof config !== 'object') {

@@ -66,3 +69,3 @@ throw Error('Config should be an object');

eol: os.EOL === '\r\n' ? 'crlf' : 'lf',
...(config == null ? null : config.js2svg),
...config.js2svg,
},

@@ -69,0 +72,0 @@ });

19

package.json
{
"name": "svgo",
"version": "2.6.0",
"version": "2.6.1",
"description": "Nodejs-based tool for optimizing SVG vector graphics files",

@@ -50,3 +50,3 @@ "keywords": [

"dist",
"!**/**.test.js"
"!**/*.test.js"
],

@@ -95,5 +95,10 @@ "scripts": {

},
"jest": {
"coveragePathIgnorePatterns": [
"fixtures"
]
},
"dependencies": {
"@trysound/sax": "0.2.0",
"colorette": "^1.3.0",
"colorette": "^1.4.0",
"commander": "^7.2.0",

@@ -114,9 +119,9 @@ "css-select": "^4.1.3",

"eslint": "^7.32.0",
"jest": "^27.1.0",
"jest": "^27.2.0",
"mock-stdin": "^1.0.0",
"node-fetch": "^2.6.1",
"node-fetch": "^2.6.2",
"pixelmatch": "^5.2.1",
"playwright": "^1.14.1",
"pngjs": "^6.0.0",
"prettier": "^2.3.2",
"prettier": "^2.4.0",
"rollup": "^2.56.3",

@@ -126,3 +131,3 @@ "rollup-plugin-terser": "^7.0.2",

"tar-stream": "^2.2.0",
"typescript": "^4.4.2"
"typescript": "^4.4.3"
},

@@ -129,0 +134,0 @@ "engines": {

@@ -78,6 +78,12 @@ 'use strict';

'feDisplacementMap',
'feDropShadow',
'feFlood',
'feFuncA',
'feFuncB',
'feFuncG',
'feFuncR',
'feGaussianBlur',
'feImage',
'feMerge',
'feMergeNode',
'feMorphology',

@@ -84,0 +90,0 @@ 'feOffset',

'use strict';
const { elemsGroups } = require('./_collections');
const { detachNodeFromParent } = require('../lib/xast.js');
const { elemsGroups } = require('./_collections.js');
exports.type = 'visitor';
exports.name = 'removeEmptyContainers';
exports.type = 'perItemReverse';
exports.active = true;
exports.description = 'removes empty container elements';

@@ -24,23 +22,38 @@

*
* @param {Object} item current iteration item
* @return {Boolean} if false, item will be filtered out
* @author Kir Belevich
*
* @author Kir Belevich
* @type {import('../lib/types').Plugin<void>}
*/
exports.fn = function (item) {
if (item.type === 'element') {
return (
item.children.length !== 0 ||
elemsGroups.container.includes(item.name) === false ||
item.name === 'svg' ||
// empty patterns may contain reusable configuration
(item.name === 'pattern' && Object.keys(item.attributes).length !== 0) ||
// The 'g' may not have content, but the filter may cause a rectangle
// to be created and filled with pattern.
(item.name === 'g' && item.attributes.filter != null) ||
// empty <mask> hides masked element
(item.name === 'mask' && item.attributes.id != null)
);
}
return true;
exports.fn = () => {
return {
element: {
exit: (node, parentNode) => {
// remove only empty non-svg containers
if (
node.name === 'svg' ||
elemsGroups.container.includes(node.name) === false ||
node.children.length !== 0
) {
return;
}
// empty patterns may contain reusable configuration
if (
node.name === 'pattern' &&
Object.keys(node.attributes).length !== 0
) {
return;
}
// The <g> may not have content, but the filter may cause a rectangle
// to be created and filled with pattern.
if (node.name === 'g' && node.attributes.filter != null) {
return;
}
// empty <mask> hides masked element
if (node.name === 'mask' && node.attributes.id != null) {
return;
}
detachNodeFromParent(node, parentNode);
},
},
};
};

Sorry, the diff of this file is too big to display

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc