postcss-reduce-initial 6.0.2 → 6.1.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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "postcss-reduce-initial",
3
- "version": "6.0.2",
3
+ "version": "6.1.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",
@@ -23,7 +23,7 @@
23
23
  },
24
24
  "repository": "cssnano/cssnano",
25
25
  "dependencies": {
26
- "browserslist": "^4.22.2",
26
+ "browserslist": "^4.23.0",
27
27
  "caniuse-api": "^3.0.0"
28
28
  },
29
29
  "bugs": {
@@ -35,8 +35,7 @@
35
35
  "devDependencies": {
36
36
  "@types/caniuse-api": "^3.0.6",
37
37
  "html-to-text": "^9.0.5",
38
- "nanospy": "^1.0.0",
39
- "postcss": "^8.4.32"
38
+ "postcss": "^8.4.35"
40
39
  },
41
40
  "peerDependencies": {
42
41
  "postcss": "^8.4.31"
@@ -1,5 +1,4 @@
1
1
  {
2
- "-webkit-line-clamp": "none",
3
2
  "accent-color": "auto",
4
3
  "align-content": "normal",
5
4
  "align-items": "normal",
@@ -26,7 +25,6 @@
26
25
  "background-position-x": "0%",
27
26
  "background-position-y": "0%",
28
27
  "background-repeat": "repeat",
29
- "block-overflow": "clip",
30
28
  "block-size": "auto",
31
29
  "border-block-style": "none",
32
30
  "border-block-width": "medium",
@@ -182,7 +180,7 @@
182
180
  "mask-border-width": "auto",
183
181
  "mask-composite": "add",
184
182
  "mask-image": "none",
185
- "mask-position": "center",
183
+ "mask-position": "0% 0%",
186
184
  "mask-repeat": "repeat",
187
185
  "mask-size": "auto",
188
186
  "masonry-auto-flow": "pack",
@@ -203,7 +201,7 @@
203
201
  "offset-anchor": "auto",
204
202
  "offset-distance": "0",
205
203
  "offset-path": "none",
206
- "offset-position": "auto",
204
+ "offset-position": "normal",
207
205
  "offset-rotate": "auto",
208
206
  "opacity": "1",
209
207
  "order": "0",
@@ -313,7 +311,6 @@
313
311
  "view-timeline-name": "none",
314
312
  "view-transition-name": "none",
315
313
  "white-space": "normal",
316
- "white-space-trim": "none",
317
314
  "widows": "2",
318
315
  "width": "auto",
319
316
  "will-change": "auto",
package/src/index.js CHANGED
@@ -1,14 +1,21 @@
1
1
  'use strict';
2
+ const { dirname } = require('path');
2
3
  const browserslist = require('browserslist');
3
4
  const { isSupported } = require('caniuse-api');
4
5
  const fromInitial = require('./data/fromInitial.json');
5
6
  const toInitial = require('./data/toInitial.json');
7
+ const ignoreProps = require('./lib/ignoreProps.js');
6
8
 
7
9
  const initial = 'initial';
8
10
 
9
11
  // 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
- const defaultIgnoreProps = ['writing-mode', 'transform-box'];
11
- /** @typedef {{ignore?: string[]}} Options */
12
+ const defaultIgnoreProps = ignoreProps;
13
+
14
+ /**
15
+ * @typedef {{ overrideBrowserslist?: string | string[] }} AutoprefixerOptions
16
+ * @typedef {Pick<browserslist.Options, 'stats' | 'path' | 'env'>} BrowserslistOptions
17
+ * @typedef {{ignore?: string[]} & AutoprefixerOptions & BrowserslistOptions} Options
18
+ */
12
19
 
13
20
  /**
14
21
  * @type {import('postcss').PluginCreator<Options>}
@@ -18,13 +25,16 @@ const defaultIgnoreProps = ['writing-mode', 'transform-box'];
18
25
  function pluginCreator(options = {}) {
19
26
  return {
20
27
  postcssPlugin: 'postcss-reduce-initial',
21
- /** @param {import('postcss').Result & {opts: browserslist.Options & {ignore?: string[]}}} result */
28
+
29
+ /**
30
+ * @param {import('postcss').Result & {opts: BrowserslistOptions & {file?: string}}} result
31
+ */
22
32
  prepare(result) {
23
- const resultOpts = result.opts || {};
24
- const browsers = browserslist(null, {
25
- stats: resultOpts.stats,
26
- path: __dirname,
27
- env: resultOpts.env,
33
+ const { stats, env, from, file } = result.opts || {};
34
+ const browsers = browserslist(options.overrideBrowserslist, {
35
+ stats: options.stats || stats,
36
+ path: options.path || dirname(from || file || __filename),
37
+ env: options.env || env,
28
38
  });
29
39
 
30
40
  const initialSupport = isSupported('css-initial-value', browsers);
@@ -0,0 +1,2 @@
1
+ 'use strict';
2
+ module.exports = ['writing-mode', 'transform-box'];
package/types/index.d.ts CHANGED
@@ -1,5 +1,9 @@
1
1
  export = pluginCreator;
2
- /** @typedef {{ignore?: string[]}} Options */
2
+ /**
3
+ * @typedef {{ overrideBrowserslist?: string | string[] }} AutoprefixerOptions
4
+ * @typedef {Pick<browserslist.Options, 'stats' | 'path' | 'env'>} BrowserslistOptions
5
+ * @typedef {{ignore?: string[]} & AutoprefixerOptions & BrowserslistOptions} Options
6
+ */
3
7
  /**
4
8
  * @type {import('postcss').PluginCreator<Options>}
5
9
  * @param {Options} options
@@ -7,9 +11,15 @@ export = pluginCreator;
7
11
  */
8
12
  declare function pluginCreator(options?: Options): import('postcss').Plugin;
9
13
  declare namespace pluginCreator {
10
- export { postcss, Options };
14
+ export { postcss, AutoprefixerOptions, BrowserslistOptions, Options };
11
15
  }
12
16
  type Options = {
13
17
  ignore?: string[];
14
- };
18
+ } & AutoprefixerOptions & BrowserslistOptions;
15
19
  declare var postcss: true;
20
+ type AutoprefixerOptions = {
21
+ overrideBrowserslist?: string | string[];
22
+ };
23
+ type BrowserslistOptions = Pick<browserslist.Options, 'stats' | 'path' | 'env'>;
24
+ import browserslist = require("browserslist");
25
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.js"],"names":[],"mappings":";AAaA;;;;GAIG;AAEH;;;;GAIG;AACH,yCAHW,OAAO,GACN,OAAO,SAAS,EAAE,MAAM,CAsDnC;;;;eA5DY;IAAC,MAAM,CAAC,EAAE,MAAM,EAAE,CAAA;CAAC,GAAG,mBAAmB,GAAG,mBAAmB;;2BAF/D;IAAE,oBAAoB,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,CAAA;CAAE;2BAC5C,KAAK,oBAAoB,EAAE,OAAO,GAAG,MAAM,GAAG,KAAK,CAAC"}
@@ -0,0 +1,3 @@
1
+ declare const _exports: string[];
2
+ export = _exports;
3
+ //# sourceMappingURL=ignoreProps.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ignoreProps.d.ts","sourceRoot":"","sources":["../../src/lib/ignoreProps.js"],"names":[],"mappings":""}