@csstools/postcss-color-function 4.0.11 → 5.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,10 +1,15 @@
1
1
  # Changes to PostCSS Color Function
2
2
 
3
- ### 4.0.11
3
+ ### 5.0.0
4
4
 
5
- _August 22, 2025_
5
+ _January 14, 2026_
6
6
 
7
- - Updated [`@csstools/css-color-parser`](https://github.com/csstools/postcss-plugins/tree/main/packages/css-color-parser) to [`3.1.0`](https://github.com/csstools/postcss-plugins/tree/main/packages/css-color-parser/CHANGELOG.md#310) (minor)
8
- - Updated [`@csstools/postcss-progressive-custom-properties`](https://github.com/csstools/postcss-plugins/tree/main/plugins/postcss-progressive-custom-properties) to [`4.2.0`](https://github.com/csstools/postcss-plugins/tree/main/plugins/postcss-progressive-custom-properties/CHANGELOG.md#420) (minor)
7
+ - Updated: Support for Node `20.19.0` or later (major).
8
+ - Removed: `commonjs` API. In supported Node versions `require(esm)` will work without needing to make code changes.
9
+ - Updated [`@csstools/css-tokenizer`](https://github.com/csstools/postcss-plugins/tree/main/packages/css-tokenizer) to [`4.0.0`](https://github.com/csstools/postcss-plugins/tree/main/packages/css-tokenizer/CHANGELOG.md#400) (major)
10
+ - Updated [`@csstools/utilities`](https://github.com/csstools/postcss-plugins/tree/main/packages/utilities) to [`3.0.0`](https://github.com/csstools/postcss-plugins/tree/main/packages/utilities/CHANGELOG.md#300) (major)
11
+ - Updated [`@csstools/css-parser-algorithms`](https://github.com/csstools/postcss-plugins/tree/main/packages/css-parser-algorithms) to [`4.0.0`](https://github.com/csstools/postcss-plugins/tree/main/packages/css-parser-algorithms/CHANGELOG.md#400) (major)
12
+ - Updated [`@csstools/postcss-progressive-custom-properties`](https://github.com/csstools/postcss-plugins/tree/main/plugins/postcss-progressive-custom-properties) to [`5.0.0`](https://github.com/csstools/postcss-plugins/tree/main/plugins/postcss-progressive-custom-properties/CHANGELOG.md#500) (major)
13
+ - Updated [`@csstools/css-color-parser`](https://github.com/csstools/postcss-plugins/tree/main/packages/css-color-parser) to [`4.0.0`](https://github.com/csstools/postcss-plugins/tree/main/packages/css-color-parser/CHANGELOG.md#400) (major)
9
14
 
10
15
  [Full CHANGELOG](https://github.com/csstools/postcss-plugins/tree/main/plugins/postcss-color-function/CHANGELOG.md)
package/dist/index.d.ts CHANGED
@@ -11,5 +11,6 @@ export declare type pluginOptions = {
11
11
  /** Transform the color() function in CSS. */
12
12
  declare const postcssPlugin: PluginCreator<pluginOptions>;
13
13
  export default postcssPlugin;
14
+ export { postcssPlugin as 'module.exports' }
14
15
 
15
16
  export { }
package/dist/index.mjs CHANGED
@@ -1 +1 @@
1
- import s from"@csstools/postcss-progressive-custom-properties";import{tokenize as o}from"@csstools/css-tokenizer";import{color as r,SyntaxFlag as e,serializeRGB as t}from"@csstools/css-color-parser";import{hasFallback as c,hasSupportsAtRuleAncestor as i}from"@csstools/utilities";import{replaceComponentValues as n,parseCommaSeparatedListOfComponentValues as l,isFunctionNode as a,stringify as p}from"@csstools/css-parser-algorithms";const u=/\bcolor\(/i,m=/^color$/i,basePlugin=s=>({postcssPlugin:"postcss-color-function",Declaration(f){const g=f.value;if(!u.test(g))return;if(c(f))return;if(i(f,u))return;const v=o({css:g}),x=n(l(v),s=>{if(!a(s)||!m.test(s.getName()))return;const o=r(s);return o&&!(o.syntaxFlags.has(e.Experimental)||o.syntaxFlags.has(e.HasNoneKeywords)||o.syntaxFlags.has(e.RelativeColorSyntax))?t(o):void 0}),P=p(x);P!==g&&(f.cloneBefore({value:P}),s?.preserve||f.remove())}});basePlugin.postcss=!0;const postcssPlugin=o=>{const r=Object.assign({preserve:!1,enableProgressiveCustomProperties:!0},o);return r.enableProgressiveCustomProperties&&r.preserve?{postcssPlugin:"postcss-color-function",plugins:[s(),basePlugin(r)]}:basePlugin(r)};postcssPlugin.postcss=!0;export{postcssPlugin as default};
1
+ import s from"@csstools/postcss-progressive-custom-properties";import{tokenize as o}from"@csstools/css-tokenizer";import{color as e,SyntaxFlag as r,serializeRGB as t}from"@csstools/css-color-parser";import{hasFallback as c,hasSupportsAtRuleAncestor as i}from"@csstools/utilities";import{replaceComponentValues as n,parseCommaSeparatedListOfComponentValues as l,isFunctionNode as a,stringify as p}from"@csstools/css-parser-algorithms";const u=/\bcolor\(/i,m=/^color$/i,basePlugin=s=>({postcssPlugin:"postcss-color-function",Declaration(f){const g=f.value;if(!u.test(g))return;if(c(f))return;if(i(f,u))return;const v=o({css:g}),x=n(l(v),s=>{if(!a(s)||!m.test(s.getName()))return;const o=e(s);return o&&!(o.syntaxFlags.has(r.Experimental)||o.syntaxFlags.has(r.HasNoneKeywords)||o.syntaxFlags.has(r.RelativeColorSyntax))?t(o):void 0}),P=p(x);P!==g&&(f.cloneBefore({value:P}),s?.preserve||f.remove())}});basePlugin.postcss=!0;const postcssPlugin=o=>{const e=Object.assign({preserve:!1,enableProgressiveCustomProperties:!0},o);return e.enableProgressiveCustomProperties&&e.preserve?{postcssPlugin:"postcss-color-function",plugins:[s(),basePlugin(e)]}:basePlugin(e)};postcssPlugin.postcss=!0;export{postcssPlugin as default,postcssPlugin as"module.exports"};
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@csstools/postcss-color-function",
3
3
  "description": "Use the color() function in CSS",
4
- "version": "4.0.11",
4
+ "version": "5.0.0",
5
5
  "author": "Jonathan Neal <jonathantneal@hotmail.com>",
6
6
  "license": "MIT-0",
7
7
  "funding": [
@@ -15,20 +15,13 @@
15
15
  }
16
16
  ],
17
17
  "engines": {
18
- "node": ">=18"
18
+ "node": ">=20.19.0"
19
19
  },
20
20
  "type": "module",
21
- "main": "dist/index.cjs",
22
- "module": "dist/index.mjs",
23
21
  "exports": {
24
22
  ".": {
25
- "import": {
26
- "types": "./dist/index.d.ts",
27
- "default": "./dist/index.mjs"
28
- },
29
- "require": {
30
- "default": "./dist/index.cjs"
31
- }
23
+ "types": "./dist/index.d.ts",
24
+ "default": "./dist/index.mjs"
32
25
  }
33
26
  },
34
27
  "files": [
@@ -38,11 +31,11 @@
38
31
  "dist"
39
32
  ],
40
33
  "dependencies": {
41
- "@csstools/css-color-parser": "^3.1.0",
42
- "@csstools/css-parser-algorithms": "^3.0.5",
43
- "@csstools/css-tokenizer": "^3.0.4",
44
- "@csstools/postcss-progressive-custom-properties": "^4.2.0",
45
- "@csstools/utilities": "^2.0.0"
34
+ "@csstools/css-color-parser": "^4.0.0",
35
+ "@csstools/css-parser-algorithms": "^4.0.0",
36
+ "@csstools/css-tokenizer": "^4.0.0",
37
+ "@csstools/postcss-progressive-custom-properties": "^5.0.0",
38
+ "@csstools/utilities": "^3.0.0"
46
39
  },
47
40
  "peerDependencies": {
48
41
  "postcss": "^8.4"
package/dist/index.cjs DELETED
@@ -1 +0,0 @@
1
- "use strict";var s=require("@csstools/postcss-progressive-custom-properties"),e=require("@csstools/css-tokenizer"),o=require("@csstools/css-color-parser"),r=require("@csstools/utilities"),t=require("@csstools/css-parser-algorithms");const a=/\bcolor\(/i,n=/^color$/i,basePlugin=s=>({postcssPlugin:"postcss-color-function",Declaration(i){const c=i.value;if(!a.test(c))return;if(r.hasFallback(i))return;if(r.hasSupportsAtRuleAncestor(i,a))return;const l=e.tokenize({css:c}),u=t.replaceComponentValues(t.parseCommaSeparatedListOfComponentValues(l),s=>{if(!t.isFunctionNode(s)||!n.test(s.getName()))return;const e=o.color(s);return e&&!(e.syntaxFlags.has(o.SyntaxFlag.Experimental)||e.syntaxFlags.has(o.SyntaxFlag.HasNoneKeywords)||e.syntaxFlags.has(o.SyntaxFlag.RelativeColorSyntax))?o.serializeRGB(e):void 0}),p=t.stringify(u);p!==c&&(i.cloneBefore({value:p}),s?.preserve||i.remove())}});basePlugin.postcss=!0;const postcssPlugin=e=>{const o=Object.assign({preserve:!1,enableProgressiveCustomProperties:!0},e);return o.enableProgressiveCustomProperties&&o.preserve?{postcssPlugin:"postcss-color-function",plugins:[s(),basePlugin(o)]}:basePlugin(o)};postcssPlugin.postcss=!0,module.exports=postcssPlugin;