postcss-reduce-initial 5.1.2 → 6.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/package.json +2 -2
- package/src/index.js +5 -3
- package/types/index.d.ts +9 -3
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "postcss-reduce-initial",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "6.0.0",
|
|
4
4
|
"description": "Reduce initial definitions to the actual initial value, where possible.",
|
|
5
5
|
"main": "src/index.js",
|
|
6
6
|
"types": "types/index.d.ts",
|
|
@@ -30,7 +30,7 @@
|
|
|
30
30
|
"url": "https://github.com/cssnano/cssnano/issues"
|
|
31
31
|
},
|
|
32
32
|
"engines": {
|
|
33
|
-
"node": "^
|
|
33
|
+
"node": "^14 || ^16 || >=18.0"
|
|
34
34
|
},
|
|
35
35
|
"devDependencies": {
|
|
36
36
|
"@types/caniuse-api": "^3.0.2",
|
package/src/index.js
CHANGED
|
@@ -8,12 +8,14 @@ const initial = 'initial';
|
|
|
8
8
|
|
|
9
9
|
// In most of the browser including chrome the initial for `writing-mode` is not `horizontal-tb`. Ref https://github.com/cssnano/cssnano/pull/905
|
|
10
10
|
const defaultIgnoreProps = ['writing-mode', 'transform-box'];
|
|
11
|
+
/** @typedef {{ignore?: string[]}} Options */
|
|
11
12
|
|
|
12
13
|
/**
|
|
13
|
-
* @type {import('postcss').PluginCreator<
|
|
14
|
+
* @type {import('postcss').PluginCreator<Options>}
|
|
15
|
+
* @param {Options} options
|
|
14
16
|
* @return {import('postcss').Plugin}
|
|
15
17
|
*/
|
|
16
|
-
function pluginCreator() {
|
|
18
|
+
function pluginCreator(options = {}) {
|
|
17
19
|
return {
|
|
18
20
|
postcssPlugin: 'postcss-reduce-initial',
|
|
19
21
|
/** @param {import('postcss').Result & {opts: browserslist.Options & {ignore?: string[]}}} result */
|
|
@@ -31,7 +33,7 @@ function pluginCreator() {
|
|
|
31
33
|
css.walkDecls((decl) => {
|
|
32
34
|
const lowerCasedProp = decl.prop.toLowerCase();
|
|
33
35
|
const ignoreProp = new Set(
|
|
34
|
-
defaultIgnoreProps.concat(
|
|
36
|
+
defaultIgnoreProps.concat(options.ignore || [])
|
|
35
37
|
);
|
|
36
38
|
|
|
37
39
|
if (ignoreProp.has(lowerCasedProp)) {
|
package/types/index.d.ts
CHANGED
|
@@ -1,9 +1,15 @@
|
|
|
1
1
|
export = pluginCreator;
|
|
2
|
+
/** @typedef {{ignore?: string[]}} Options */
|
|
2
3
|
/**
|
|
3
|
-
* @type {import('postcss').PluginCreator<
|
|
4
|
+
* @type {import('postcss').PluginCreator<Options>}
|
|
5
|
+
* @param {Options} options
|
|
4
6
|
* @return {import('postcss').Plugin}
|
|
5
7
|
*/
|
|
6
|
-
declare function pluginCreator(): import('postcss').Plugin;
|
|
8
|
+
declare function pluginCreator(options?: Options): import('postcss').Plugin;
|
|
7
9
|
declare namespace pluginCreator {
|
|
8
|
-
|
|
10
|
+
export { postcss, Options };
|
|
9
11
|
}
|
|
12
|
+
type Options = {
|
|
13
|
+
ignore?: string[];
|
|
14
|
+
};
|
|
15
|
+
declare var postcss: true;
|