postcss-normalize-url
Advanced tools
Comparing version
{ | ||
"name": "postcss-normalize-url", | ||
"version": "5.0.5", | ||
"version": "5.1.0", | ||
"description": "Normalize URLs with PostCSS", | ||
"main": "src/index.js", | ||
"types": "types/index.d.ts", | ||
"files": [ | ||
"src", | ||
"LICENSE-MIT" | ||
"LICENSE-MIT", | ||
"types" | ||
], | ||
@@ -10,0 +12,0 @@ "keywords": [ |
@@ -28,5 +28,10 @@ 'use strict'; | ||
/** | ||
* @param {string} url | ||
* @param {normalize.Options} options | ||
* @return {string} | ||
*/ | ||
function convert(url, options) { | ||
if (isAbsolute(url) || url.startsWith('//')) { | ||
let normalizedURL = null; | ||
let normalizedURL; | ||
@@ -46,2 +51,6 @@ try { | ||
/** | ||
* @param {import('postcss').AtRule} rule | ||
* @return {void} | ||
*/ | ||
function transformNamespace(rule) { | ||
@@ -55,4 +64,5 @@ rule.params = valueParser(rule.params) | ||
) { | ||
node.type = 'string'; | ||
node.quote = node.nodes[0].quote || '"'; | ||
/** @type {valueParser.Node} */ (node).type = 'string'; | ||
/** @type {any} */ (node).quote = | ||
node.nodes[0].type === 'string' ? node.nodes[0].quote : '"'; | ||
node.value = node.nodes[0].value; | ||
@@ -68,2 +78,7 @@ } | ||
/** | ||
* @param {import('postcss').Declaration} decl | ||
* @param {normalize.Options} opts | ||
* @return {void} | ||
*/ | ||
function transformDecl(decl, opts) { | ||
@@ -89,3 +104,3 @@ decl.value = valueParser(decl.value) | ||
if (url.value.length === 0) { | ||
url.quote = ''; | ||
/** @type {any} */ (url).quote = ''; | ||
@@ -108,3 +123,3 @@ return false; | ||
url.value = escaped; | ||
url.type = 'word'; | ||
/** @type {valueParser.Node} */ (url).type = 'word'; | ||
} | ||
@@ -120,2 +135,8 @@ } else { | ||
/** @typedef {normalize.Options} Options */ | ||
/** | ||
* @type {import('postcss').PluginCreator<Options>} | ||
* @param {Options} opts | ||
* @return {import('postcss').Plugin} | ||
*/ | ||
function pluginCreator(opts) { | ||
@@ -122,0 +143,0 @@ opts = Object.assign( |
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
8776
13.75%5
25%158
28.46%0
-100%