postcss-colormin 8.0.5 → 9.0.1
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/README.md +1 -1
- package/package.json +5 -7
- package/src/index.js +9 -10
- package/src/lib/computeBrowsersToSupport.js +10 -12
- package/src/lib/getBrowsersForWebBuild.js +2 -4
- package/src/minifyColor.js +8 -7
- package/types/index.d.ts +25 -2
- package/types/index.d.ts.map +1 -1
- package/types/lib/computeBrowsersToSupport.d.ts +2 -2
- package/types/lib/computeBrowsersToSupport.d.ts.map +1 -1
- package/types/lib/getBrowsersForWebBuild.d.ts +2 -2
- package/types/minifyColor.d.ts +1 -1
- package/types/minifyColor.d.ts.map +1 -1
package/README.md
CHANGED
package/package.json
CHANGED
|
@@ -1,19 +1,16 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "postcss-colormin",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "9.0.1",
|
|
4
4
|
"description": "Minify colors in your CSS files with PostCSS.",
|
|
5
5
|
"exports": {
|
|
6
6
|
".": {
|
|
7
7
|
"types": "./types/index.d.ts",
|
|
8
8
|
"default": "./src/index.js"
|
|
9
9
|
},
|
|
10
|
-
"./src": "./src/index.js",
|
|
11
|
-
"./src/index": "./src/index.js",
|
|
12
|
-
"./src/index.js": "./src/*.js",
|
|
13
|
-
"./src/minifyColor": "./src/minifyColor.js",
|
|
14
|
-
"./src/minifyColor.js": "./src/minifyColor.js",
|
|
15
10
|
"./package.json": "./package.json"
|
|
16
11
|
},
|
|
12
|
+
"main": "./src/index.js",
|
|
13
|
+
"types": "./types/index.d.ts",
|
|
17
14
|
"imports": {
|
|
18
15
|
"#getBrowsersList": {
|
|
19
16
|
"node": "./src/lib/computeBrowsersToSupport.js",
|
|
@@ -55,7 +52,7 @@
|
|
|
55
52
|
"url": "https://github.com/cssnano/cssnano/issues"
|
|
56
53
|
},
|
|
57
54
|
"engines": {
|
|
58
|
-
"node": "^22.
|
|
55
|
+
"node": "^22.22.3 || ^24.15.0 || >=26.0"
|
|
59
56
|
},
|
|
60
57
|
"devDependencies": {
|
|
61
58
|
"postcss": "^8.5.26"
|
|
@@ -63,6 +60,7 @@
|
|
|
63
60
|
"peerDependencies": {
|
|
64
61
|
"postcss": "^8.5.26"
|
|
65
62
|
},
|
|
63
|
+
"type": "module",
|
|
66
64
|
"scripts": {
|
|
67
65
|
"test": "node --test"
|
|
68
66
|
}
|
package/src/index.js
CHANGED
|
@@ -1,10 +1,9 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
const valueParser = require('postcss-value-parser');
|
|
6
|
-
const minifyColor = require('./minifyColor');
|
|
1
|
+
import getBrowsersList from '#getBrowsersList';
|
|
2
|
+
import caniuseApi from 'caniuse-api';
|
|
3
|
+
import valueParser from 'postcss-value-parser';
|
|
4
|
+
import minifyColor from './minifyColor.js';
|
|
7
5
|
|
|
6
|
+
const { isSupported } = caniuseApi;
|
|
8
7
|
/** @import browserslist from 'browserslist' */
|
|
9
8
|
|
|
10
9
|
const rgbOrHslRegex = /^(rgb|hsl)a?$/i;
|
|
@@ -180,8 +179,8 @@ function pluginCreator(config = {}) {
|
|
|
180
179
|
},
|
|
181
180
|
};
|
|
182
181
|
}
|
|
183
|
-
|
|
182
|
+
/** @type {true} */
|
|
184
183
|
pluginCreator.postcss = true;
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
184
|
+
const moduleExports = pluginCreator;
|
|
185
|
+
|
|
186
|
+
export { moduleExports as default, moduleExports as 'module.exports' };
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
|
|
1
|
+
import { fileURLToPath } from 'node:url';
|
|
2
|
+
import browserslist from 'browserslist';
|
|
3
|
+
import nodepath from 'node:path';
|
|
2
4
|
|
|
3
|
-
const
|
|
4
|
-
const { dirname } = require('node:path');
|
|
5
|
+
const { dirname } = nodepath;
|
|
5
6
|
|
|
6
7
|
/**
|
|
7
8
|
*
|
|
@@ -12,16 +13,13 @@ const { dirname } = require('node:path');
|
|
|
12
13
|
* @param {browserslist.Options["env"]} [env]
|
|
13
14
|
* @returns {string[]}
|
|
14
15
|
*/
|
|
15
|
-
|
|
16
|
-
options,
|
|
17
|
-
stats,
|
|
18
|
-
from,
|
|
19
|
-
file,
|
|
20
|
-
env
|
|
21
|
-
) {
|
|
16
|
+
function computeBrowsersToSupport(options, stats, from, file, env) {
|
|
22
17
|
return browserslist(options.overrideBrowserslist, {
|
|
23
18
|
stats: options.stats || stats,
|
|
24
|
-
path:
|
|
19
|
+
path:
|
|
20
|
+
options.path || dirname(from || file || fileURLToPath(import.meta.url)),
|
|
25
21
|
env: options.env || env,
|
|
26
22
|
});
|
|
27
|
-
}
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
export default computeBrowsersToSupport;
|
package/src/minifyColor.js
CHANGED
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
const minifierPlugin = require('@colordx/core/plugins/minify');
|
|
1
|
+
import { colordx as colord, extend } from '@colordx/core';
|
|
2
|
+
import hwbPlugin from '@colordx/core/plugins/hwb';
|
|
3
|
+
import namesPlugin from '@colordx/core/plugins/names';
|
|
4
|
+
import minifierPlugin from '@colordx/core/plugins/minify';
|
|
6
5
|
|
|
7
6
|
extend(/** @type {any[]} */ ([hwbPlugin, namesPlugin, minifierPlugin]));
|
|
8
7
|
|
|
@@ -13,7 +12,7 @@ extend(/** @type {any[]} */ ([hwbPlugin, namesPlugin, minifierPlugin]));
|
|
|
13
12
|
* @param {import('./index.js').MinifyColorOptions} options - object with colordx.minify() options
|
|
14
13
|
* @return {string}
|
|
15
14
|
*/
|
|
16
|
-
|
|
15
|
+
function minifyColor(input, options = {}) {
|
|
17
16
|
const instance = colord(input);
|
|
18
17
|
|
|
19
18
|
if (instance.isValid()) {
|
|
@@ -26,4 +25,6 @@ module.exports = function minifyColor(input, options = {}) {
|
|
|
26
25
|
// Possibly malformed, so pass through
|
|
27
26
|
return input;
|
|
28
27
|
}
|
|
29
|
-
}
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
export default minifyColor;
|
package/types/index.d.ts
CHANGED
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
declare const _exports: import("postcss").PluginCreator<Options>;
|
|
2
|
-
export = _exports;
|
|
3
1
|
import type browserslist from 'browserslist';
|
|
4
2
|
export type MinifyColorOptions = {
|
|
5
3
|
hex?: boolean;
|
|
@@ -18,4 +16,29 @@ export type AutoprefixerOptions = {
|
|
|
18
16
|
};
|
|
19
17
|
export type BrowserslistOptions = Pick<browserslist.Options, 'stats' | 'path' | 'env'>;
|
|
20
18
|
export type Options = MinifyColorOptions & AutoprefixerOptions & BrowserslistOptions;
|
|
19
|
+
/**
|
|
20
|
+
* @typedef {object} MinifyColorOptions
|
|
21
|
+
* @property {boolean} [hex]
|
|
22
|
+
* @property {boolean} [alphaHex]
|
|
23
|
+
* @property {boolean} [rgb]
|
|
24
|
+
* @property {boolean} [hsl]
|
|
25
|
+
* @property {boolean} [name]
|
|
26
|
+
* @property {boolean} [transparent]
|
|
27
|
+
* @property {boolean} [transformCustomProperties] Whether to minify colors inside custom property values (default: true)
|
|
28
|
+
*/
|
|
29
|
+
/**
|
|
30
|
+
* @typedef {{ overrideBrowserslist?: string | string[] }} AutoprefixerOptions
|
|
31
|
+
* @typedef {Pick<browserslist.Options, 'stats' | 'path' | 'env'>} BrowserslistOptions
|
|
32
|
+
* @typedef {MinifyColorOptions & AutoprefixerOptions & BrowserslistOptions} Options
|
|
33
|
+
*/
|
|
34
|
+
/**
|
|
35
|
+
* @param {Options} config
|
|
36
|
+
* @return {import('postcss').Plugin}
|
|
37
|
+
*/
|
|
38
|
+
declare function pluginCreator(config?: Options): import('postcss').Plugin;
|
|
39
|
+
declare namespace pluginCreator {
|
|
40
|
+
var postcss: true;
|
|
41
|
+
}
|
|
42
|
+
declare const moduleExports: typeof pluginCreator;
|
|
43
|
+
export { moduleExports as default, moduleExports as 'module.exports' };
|
|
21
44
|
//# sourceMappingURL=index.d.ts.map
|
package/types/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.js"],"names":[],"mappings":"AAMI,OAAQ,KAAA,YAAY,MAAM,cAAc,CAAA;AAoGzC,YAAkB,kBAAkB,GACpC;IAAqB,GAAG,AAAxB,CACA,EADW,OAAO,CAClB;IAAqB,QAAQ,AAA7B,CACA,EADW,OAAO,CAClB;IAAqB,GAAG,AAAxB,CACA,EADW,OAAO,CAClB;IAAqB,GAAG,AAAxB,CACA,EADW,OAAO,CAClB;IAAqB,IAAI,AAAzB,CACA,EADW,OAAO,CAClB;IAAqB,WAAW,AAAhC,CACA,EADW,OAAO,CAClB;;;;IAAqB,yBAAyB,AAA9C,CACF,EADa,OAAO,CACpB;CAAA,CAAA;AAGE,YAAwD,mBAAmB,GAAjE;IAAE,oBAAoB,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,CAAA;CAAE,CAAqB;AAC3E,YAAgE,mBAAmB,GAAzE,IAAI,CAAC,YAAY,CAAC,OAAO,EAAE,OAAO,GAAG,MAAM,GAAG,KAAK,CAAC,CAAqB;AACnF,YAA0E,OAAO,GAAvE,kBAAkB,GAAG,mBAAmB,GAAG,mBAAmB,CAAS;AAdpF;;;;;;;;;GASG;AAEH;;;;GAIG;AAEH;;;GAGG;AACH,iBAAS,aAAa,CAAC,MAAM,GAHlB,OAGuB,GAFtB,OAAO,SAAS,EAAE,MAAM,CAwDnC;kBAtDQ,aAAa;iBAuDX,IAAI;;AAEf,QAAA,MAAM,aAAa,sBAAgB,CAAC;AAEpC,OAAO,EAAE,aAAa,IAAI,OAAO,EAAE,aAAa,IAAI,gBAAgB,EAAE,CAAC"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
import browserslist from 'browserslist';
|
|
2
2
|
/**
|
|
3
3
|
*
|
|
4
4
|
* @param {{overrideBrowserslist?: string | string[] | undefined, stats?: browserslist.Options["stats"], path?: browserslist.Options["path"], env?: browserslist.Options["env"]}} options
|
|
@@ -14,5 +14,5 @@ declare function computeBrowsersToSupport(options: {
|
|
|
14
14
|
path?: browserslist.Options["path"];
|
|
15
15
|
env?: browserslist.Options["env"];
|
|
16
16
|
}, stats: browserslist.Options["stats"], from: string | undefined, file?: string, env?: browserslist.Options["env"]): string[];
|
|
17
|
-
|
|
17
|
+
export default computeBrowsersToSupport;
|
|
18
18
|
//# sourceMappingURL=computeBrowsersToSupport.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"computeBrowsersToSupport.d.ts","sourceRoot":"","sources":["../../src/lib/computeBrowsersToSupport.js"],"names":[],"mappings":";
|
|
1
|
+
{"version":3,"file":"computeBrowsersToSupport.d.ts","sourceRoot":"","sources":["../../src/lib/computeBrowsersToSupport.js"],"names":[],"mappings":"AACA,OAAO,YAAY,MAAM,cAAc,CAAC;AAKxC;;;;;;;;GAQG;AACH,iBAAS,wBAAwB,CAAC,OAAO,EAP9B;IAAC,oBAAoB,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,GAAG,SAAS,CAAC;IAAC,KAAK,CAAC,EAAE,YAAY,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC;IAAC,IAAI,CAAC,EAAE,YAAY,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;IAAC,GAAG,CAAC,EAAE,YAAY,CAAC,OAAO,CAAC,KAAK,CAAC,CAAA;CAOtI,EAAE,KAAK,EANrC,YAAY,CAAC,OAAO,CAAC,OAAO,CAMS,EAAE,IAAI,EAL3C,MAAM,GAAC,SAKoC,EAAE,IAAI,AAJzD,CACA,EADQ,MAIiD,EAAE,GAAG,AAH9D,CACA,EADQ,YAAY,CAAC,OAAO,CAAC,KAAK,CAG4B,GAFpD,MAAM,EAAE,CASpB;eAEc,wBAAwB"}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export
|
|
2
|
-
declare function
|
|
1
|
+
export default _default;
|
|
2
|
+
declare function _default(): string[];
|
|
3
3
|
//# sourceMappingURL=getBrowsersForWebBuild.d.ts.map
|
package/types/minifyColor.d.ts
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
export = minifyColor;
|
|
2
1
|
/**
|
|
3
2
|
* Performs color value minification
|
|
4
3
|
*
|
|
@@ -7,4 +6,5 @@ export = minifyColor;
|
|
|
7
6
|
* @return {string}
|
|
8
7
|
*/
|
|
9
8
|
declare function minifyColor(input: string, options?: import('./index.js').MinifyColorOptions): string;
|
|
9
|
+
export default minifyColor;
|
|
10
10
|
//# sourceMappingURL=minifyColor.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"minifyColor.d.ts","sourceRoot":"","sources":["../src/minifyColor.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"minifyColor.d.ts","sourceRoot":"","sources":["../src/minifyColor.js"],"names":[],"mappings":"AAOA;;;;;;GAMG;AACH,iBAAS,WAAW,CAAC,KAAK,EAJf,MAIe,EAAE,OAAO,GAHxB,OAAO,YAAY,EAAE,kBAGQ,GAF5B,MAAM,CAejB;eAEc,WAAW"}
|