postcss-color-functional-notation
Advanced tools
Comparing version 4.0.0 to 4.0.1
@@ -172,3 +172,5 @@ 'use strict'; | ||
const onCSSDeclaration = decl => { | ||
const onCSSDeclaration = (decl, { | ||
result | ||
}) => { | ||
const { | ||
@@ -179,3 +181,16 @@ value: originalValue | ||
if (hasAnyColorFunction(originalValue)) { | ||
const valueAST = postcssValuesParser.parse(originalValue); | ||
let valueAST; | ||
try { | ||
valueAST = postcssValuesParser.parse(originalValue, { | ||
ignoreUnknownWords: true | ||
}); | ||
} catch (error) { | ||
decl.warn(result, `Failed to parse value '${originalValue}' as a color function. Leaving the original value intact.`); | ||
} | ||
if (typeof valueAST === 'undefined') { | ||
return; | ||
} | ||
valueAST.walkType('func', onCSSFunction); | ||
@@ -182,0 +197,0 @@ const modifiedValue = String(valueAST); |
@@ -170,3 +170,5 @@ import { parse } from 'postcss-values-parser'; | ||
const onCSSDeclaration = decl => { | ||
const onCSSDeclaration = (decl, { | ||
result | ||
}) => { | ||
const { | ||
@@ -177,3 +179,16 @@ value: originalValue | ||
if (hasAnyColorFunction(originalValue)) { | ||
const valueAST = parse(originalValue); | ||
let valueAST; | ||
try { | ||
valueAST = parse(originalValue, { | ||
ignoreUnknownWords: true | ||
}); | ||
} catch (error) { | ||
decl.warn(result, `Failed to parse value '${originalValue}' as a color function. Leaving the original value intact.`); | ||
} | ||
if (typeof valueAST === 'undefined') { | ||
return; | ||
} | ||
valueAST.walkType('func', onCSSFunction); | ||
@@ -180,0 +195,0 @@ const modifiedValue = String(valueAST); |
{ | ||
"name": "postcss-color-functional-notation", | ||
"version": "4.0.0", | ||
"version": "4.0.1", | ||
"description": "Use space and slash separated color notation in CSS", | ||
@@ -29,3 +29,3 @@ "author": "Jonathan Neal <jonathantneal@hotmail.com>", | ||
"dependencies": { | ||
"postcss-values-parser": "6.0.0" | ||
"postcss-values-parser": "6.0.1" | ||
}, | ||
@@ -36,10 +36,10 @@ "peerDependencies": { | ||
"devDependencies": { | ||
"@babel/core": "7.15.5", | ||
"@babel/preset-env": "7.15.6", | ||
"eslint": "7.32.0", | ||
"postcss": "8.3.6", | ||
"postcss-tape": "6.0.1", | ||
"pre-commit": "1.2.2", | ||
"rollup": "2.56.3", | ||
"rollup-plugin-babel": "4.4.0" | ||
"@babel/core": "^7.16.0", | ||
"@babel/preset-env": "^7.16.4", | ||
"eslint": "^8.2.0", | ||
"postcss": "^8.3.11", | ||
"postcss-tape": "^6.0.1", | ||
"pre-commit": "^1.2.2", | ||
"rollup": "^2.60.0", | ||
"rollup-plugin-babel": "^4.4.0" | ||
}, | ||
@@ -46,0 +46,0 @@ "babel": { |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
28994
325
1
+ Addedpostcss-values-parser@6.0.1(transitive)
- Removedpostcss-values-parser@6.0.0(transitive)
Updatedpostcss-values-parser@6.0.1