Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

svgo

Package Overview
Dependencies
Maintainers
3
Versions
104
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

svgo - npm Package Compare versions

Comparing version 2.0.0 to 2.0.1

CHANGELOG-old.md

7

lib/svgo.js

@@ -26,3 +26,3 @@ 'use strict';

const optimize = (svgstr, config) => {
const optimize = (input, config) => {
if (config == null) {

@@ -42,3 +42,4 @@ config = {};

for (let i = 0; i < maxPassCount; i += 1) {
svgjs = svg2js(svgstr);
info.multipassCount = i;
svgjs = svg2js(input);
if (svgjs.error == null) {

@@ -56,4 +57,4 @@ const plugins = config.plugins || defaultPlugins;

}
info.multipassCount = i;
if (svgjs.data.length < prevResultSize) {
input = svgjs.data;
prevResultSize = svgjs.data.length

@@ -60,0 +61,0 @@ } else {

@@ -11,3 +11,3 @@ /* jshint quotmark: false */

const { encodeSVGDatauri, decodeSVGDatauri } = require('./tools.js');
const regSVGFile = /\.svg$/;
const regSVGFile = /\.svg$/i;
const noop = () => {};

@@ -141,3 +141,3 @@

if (opts.indent != null) {
config.js2svg.indent = indent;
config.js2svg.indent = opts.indent;
}

@@ -144,0 +144,0 @@ }

@@ -14,28 +14,27 @@ 'use strict';

module.exports = function(data, info, plugins) {
const perItemPlugins = [];
const perItemReversePlugins = [];
const fullPlugins = [];
// Try to group sequential elements of plugins array
// to optimize ast traversing
const groups = [];
let prev;
for (const plugin of plugins) {
switch(plugin.type) {
if (prev && plugin.type == prev[0].type) {
prev.push(plugin);
} else {
prev = [plugin];
groups.push(prev);
}
}
for (const group of groups) {
switch(group[0].type) {
case 'perItem':
perItemPlugins.push(plugin);
data = perItem(data, info, group);
break;
case 'perItemReverse':
perItemReversePlugins.push(plugin);
data = perItem(data, info, group, true);
break;
case 'full':
fullPlugins.push(plugin);
data = full(data, info, group);
break;
}
}
if (perItemPlugins.length !== 0) {
data = perItem(data, info, perItemPlugins);
}
if (perItemReversePlugins.length !== 0) {
data = perItem(data, info, perItemReversePlugins, true);
}
if (fullPlugins.length !== 0) {
data = full(data, info, fullPlugins);
}
return data;

@@ -42,0 +41,0 @@ };

{
"name": "svgo",
"version": "2.0.0",
"version": "2.0.1",
"description": "Nodejs-based tool for optimizing SVG vector graphics files",

@@ -49,10 +49,4 @@ "keywords": [

"plugins",
"dist",
"examples"
"dist"
],
"directories": {
"bin": "./bin",
"lib": "./lib",
"example": "./examples"
},
"scripts": {

@@ -59,0 +53,0 @@ "test": "nyc --reporter=html --reporter=text mocha \"test/*/_index.js\"",

@@ -623,4 +623,2 @@ /* global a2c */

exports.intersects = function(path1, path2) {
if (path1.length < 3 || path2.length < 3) return false; // nothing to fill
// Collect points of every subpath.

@@ -627,0 +625,0 @@ var points1 = relative2absolute(path1).reduce(gatherPoints, []),

@@ -187,2 +187,3 @@ **english** | [русский](https://github.com/svg/svgo/blob/master/README.ru.md)

* as a web app – [SVGOMG](https://jakearchibald.github.io/svgomg/)
* as a GitHub Action – [SVGO Action](https://github.com/marketplace/actions/svgo-action)
* as a Nodejs module – [examples](https://github.com/svg/svgo/tree/master/examples)

@@ -200,2 +201,5 @@ * as a Grunt task – [grunt-svgmin](https://github.com/sindresorhus/grunt-svgmin)

* as a Rollup plugin - [rollup-plugin-svgo](https://github.com/porsager/rollup-plugin-svgo)
* as a VS Code plugin - [vscode-svgo](https://github.com/1000ch/vscode-svgo)
* as a Atom plugin - [atom-svgo](https://github.com/1000ch/atom-svgo)
* as a Sublime plugin - [Sublime-svgo](https://github.com/1000ch/Sublime-svgo)
* as a Figma plugin - [Advanced SVG Export](https://www.figma.com/c/plugin/782713260363070260/Advanced-SVG-Export)

@@ -202,0 +206,0 @@

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

SocketSocket SOC 2 Logo

Product

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

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc