New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

postcss-color-function

Package Overview
Dependencies
Maintainers
1
Versions
11
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

postcss-color-function - npm Package Compare versions

Comparing version 2.0.0 to 2.0.1

5

CHANGELOG.md

@@ -0,1 +1,6 @@

# 2.0.1 - 2016-03-15
- Fixed: whitespace are retained between color() usage.
([#27](https://github.com/postcss/postcss-color-function/pull/27))
# 2.0.0 - 2015-09-07

@@ -2,0 +7,0 @@

29

index.js

@@ -5,3 +5,3 @@ /**

var postcss = require("postcss")
var balanced = require("balanced-match")
var parser = require("postcss-value-parser")
var colorFn = require("css-color-function")

@@ -21,3 +21,3 @@ var helpers = require("postcss-message-helpers")

decl.value = helpers.try(function transformColorValue() {
return transformColor(decl.value, decl.source)
return transformColor(decl.value)
}, decl.source)

@@ -34,20 +34,11 @@ })

*/
function transformColor(string, source) {
var index = string.search(/(^|[^\w\-])color\(/)
function transformColor(string) {
return parser(string).walk(function(node) {
if (node.type !== "function" || node.value !== "color") {
return
}
if (index === -1) {
return string
}
// NOTE: regexp search beginning of line of non char symbol before `color(`.
// Offset used for second case.
index = index === 0 ? index : index + 1
var fn = string.slice(index)
var balancedMatches = balanced("(", ")", fn)
if (!balancedMatches) {
throw new Error("Missing closing parentheses in '" + string + "'", source)
}
return string.slice(0, index) + colorFn.convert("color(" + balancedMatches.body + ")") + transformColor(balancedMatches.post)
node.value = colorFn.convert(parser.stringify(node))
node.type = "word"
}).toString()
}
{
"name": "postcss-color-function",
"version": "2.0.0",
"version": "2.0.1",
"description": "PostCSS plugin to transform W3C CSS color function to more compatible CSS.",

@@ -15,6 +15,3 @@ "keywords": [

"license": "MIT",
"repository": {
"type": "git",
"url": "https://github.com/postcss/postcss-color-function.git"
},
"repository": "https://github.com/postcss/postcss-color-function.git",
"files": [

@@ -24,6 +21,6 @@ "index.js"

"dependencies": {
"balanced-match": "^0.1.0",
"css-color-function": "^1.2.0",
"postcss": "^5.0.4",
"postcss-message-helpers": "^2.0.0"
"postcss-message-helpers": "^2.0.0",
"postcss-value-parser": "^3.3.0"
},

@@ -33,2 +30,3 @@ "devDependencies": {

"jshint": "^2.5.6",
"npmpub": "^3.1.0",
"tape": "^3.0.0"

@@ -38,4 +36,5 @@ },

"lint": "jscs *.js **/*.js && jshint . --exclude-path .gitignore",
"test": "npm run lint && tape test"
"test": "npm run lint && tape test",
"release": "npmpub"
}
}

@@ -109,2 +109,2 @@ # postcss-color-function [![Build Status](https://travis-ci.org/postcss/postcss-color-function.svg)](https://travis-ci.org/postcss/postcss-color-function)

[specs]: (http://dev.w3.org/csswg/css-color/#modifying-colors)
[specs]: http://dev.w3.org/csswg/css-color/#modifying-colors
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