postcss-svgo
Advanced tools
Comparing version
{ | ||
"name": "postcss-svgo", | ||
"version": "5.0.4", | ||
"version": "5.1.0", | ||
"description": "Optimise inline SVG with PostCSS.", | ||
"main": "src/index.js", | ||
"types": "types/index.d.ts", | ||
"files": [ | ||
"LICENSE-MIT", | ||
"src" | ||
"src", | ||
"types" | ||
], | ||
@@ -38,2 +40,3 @@ "keywords": [ | ||
"devDependencies": { | ||
"@types/svgo": "^2.6.2", | ||
"postcss": "^8.2.15" | ||
@@ -40,0 +43,0 @@ }, |
@@ -18,4 +18,4 @@ 'use strict'; | ||
* @param {string} input the SVG string | ||
* @param {boolean} encode whether to encode the result | ||
* @return {object} the minification result | ||
* @param {Options} opts | ||
* @return {{result: string, isUriEncoded: boolean}} the minification result | ||
*/ | ||
@@ -34,3 +34,3 @@ function minifySVG(input, opts) { | ||
if (isUriEncoded) { | ||
svg = decodedUri; | ||
svg = /** @type {string} */ (decodedUri); | ||
} | ||
@@ -52,5 +52,14 @@ | ||
return { result: result.data, isUriEncoded }; | ||
return { | ||
result: /** @type {import('svgo').OptimizedSvg}*/ (result).data, | ||
isUriEncoded, | ||
}; | ||
} | ||
/** | ||
* @param {import('postcss').Declaration} decl | ||
* @param {Options} opts | ||
* @param {import('postcss').Result} postcssResult | ||
* @return {void} | ||
*/ | ||
function minify(decl, opts, postcssResult) { | ||
@@ -67,4 +76,6 @@ const parsed = valueParser(decl.value); | ||
} | ||
let { value, quote } = /** @type {valueParser.StringNode} */ ( | ||
node.nodes[0] | ||
); | ||
let { value, quote } = node.nodes[0]; | ||
let optimizedValue; | ||
@@ -113,3 +124,8 @@ | ||
} | ||
/** @typedef {{encode?: boolean, plugins?: object[]} & import('svgo').OptimizeOptions} Options */ | ||
/** | ||
* @type {import('postcss').PluginCreator<Options>} | ||
* @param {Options} opts | ||
* @return {import('postcss').Plugin} | ||
*/ | ||
function pluginCreator(opts = {}) { | ||
@@ -116,0 +132,0 @@ return { |
'use strict'; | ||
/** | ||
* @param {string} data | ||
* @return {string} | ||
*/ | ||
function encode(data) { | ||
@@ -3,0 +7,0 @@ return data |
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
13520
11.24%8
60%167
36.89%0
-100%2
100%