postcss-reduce-initial 4.0.0-nightly.2020.9.9 → 4.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/CHANGELOG.md ADDED
@@ -0,0 +1,18 @@
1
+ # 4.0.0-rc.0
2
+
3
+ * Breaking: Drops support for Node 0.12, we now require at least Node 4.
4
+ * Breaking: Update PostCSS to 6.0.0.
5
+ * Added: This module can now convert initial values *to* the `initial` keyword,
6
+ but only when the browser support is sufficient. You may use Browserslist to
7
+ supply a list of browsers; we recommend using the config file as the same
8
+ values will be propagated to other cssnano plugins which have the same
9
+ functionality. See https://github.com/ai/browserslist#config-file for
10
+ more details.
11
+
12
+ # 1.0.1
13
+
14
+ * Update the initial value of `user-select` from `none` to `auto`.
15
+
16
+ # 1.0.0
17
+
18
+ * Initial release.
package/README.md CHANGED
@@ -1,6 +1,7 @@
1
1
  # [postcss][postcss]-reduce-initial
2
2
 
3
- > Reduce `initial` definitions to the _actual_ initial value, where possible.
3
+ > Reduce `initial` definitions to the *actual* initial value, where possible.
4
+
4
5
 
5
6
  ## Install
6
7
 
@@ -10,6 +11,7 @@ With [npm](https://npmjs.org/package/postcss-reduce-initial) do:
10
11
  npm install postcss-reduce-initial --save
11
12
  ```
12
13
 
14
+
13
15
  ## Examples
14
16
 
15
17
  See the [data](data) for more conversions. This data is courtesy
@@ -24,7 +26,7 @@ be converted:
24
26
 
25
27
  ```css
26
28
  h1 {
27
- min-width: initial;
29
+ min-width: initial;
28
30
  }
29
31
  ```
30
32
 
@@ -32,10 +34,11 @@ h1 {
32
34
 
33
35
  ```css
34
36
  h1 {
35
- min-width: 0;
37
+ min-width: 0;
36
38
  }
37
39
  ```
38
40
 
41
+
39
42
  ### Convert values back to `initial`
40
43
 
41
44
  When the `initial` value is smaller than the property value, it will
@@ -45,7 +48,7 @@ be converted:
45
48
 
46
49
  ```css
47
50
  h1 {
48
- transform-box: border-box;
51
+ transform-box: border-box;
49
52
  }
50
53
  ```
51
54
 
@@ -53,42 +56,31 @@ h1 {
53
56
 
54
57
  ```css
55
58
  h1 {
56
- transform-box: initial;
59
+ transform-box: initial;
57
60
  }
58
61
  ```
59
62
 
60
63
  This conversion is only applied when you supply a browsers list that all support
61
64
  the `initial` keyword; it's worth noting that Internet Explorer has no support.
62
65
 
63
- ## API
64
-
65
- ### reduceInitial([options])
66
-
67
- #### options
68
-
69
- ##### ignore
70
-
71
- Type: `Array<String>`
72
- Default: `undefined`
73
-
74
- It contains the Array of properties that will be ignored while reducing its value to initial.
75
- Example : `{ ignore : ["min-height"] }`
76
66
 
77
67
  ## Usage
78
68
 
79
69
  See the [PostCSS documentation](https://github.com/postcss/postcss#usage) for
80
70
  examples for your environment.
81
71
 
72
+
82
73
  ## Contributors
83
74
 
84
75
  See [CONTRIBUTORS.md](https://github.com/cssnano/cssnano/blob/master/CONTRIBUTORS.md).
85
76
 
77
+
86
78
  ## License
87
79
 
88
80
  [Template:CSSData] by Mozilla Contributors is licensed under [CC-BY-SA 2.5].
89
81
 
90
- [template:cssdata]: https://developer.mozilla.org/en-US/docs/Template:CSSData
91
- [cc-by-sa 2.5]: http://creativecommons.org/licenses/by-sa/2.5/
82
+ [Template:CSSData]: https://developer.mozilla.org/en-US/docs/Template:CSSData
83
+ [CC-BY-SA 2.5]: http://creativecommons.org/licenses/by-sa/2.5/
92
84
 
93
85
  MIT © [Ben Briggs](http://beneb.info)
94
86
 
@@ -21,8 +21,6 @@
21
21
  "background-repeat": "repeat",
22
22
  "block-overflow": "clip",
23
23
  "block-size": "auto",
24
- "border-block-style": "none",
25
- "border-block-width": "medium",
26
24
  "border-block-end-style": "none",
27
25
  "border-block-end-width": "medium",
28
26
  "border-block-start-style": "none",
@@ -31,14 +29,10 @@
31
29
  "border-bottom-right-radius": "0",
32
30
  "border-bottom-style": "none",
33
31
  "border-bottom-width": "medium",
34
- "border-end-end-radius": "0",
35
- "border-end-start-radius": "0",
36
32
  "border-image-outset": "0",
37
33
  "border-image-slice": "100%",
38
34
  "border-image-source": "none",
39
35
  "border-image-width": "1",
40
- "border-inline-style": "none",
41
- "border-inline-width": "medium",
42
36
  "border-inline-end-style": "none",
43
37
  "border-inline-end-width": "medium",
44
38
  "border-inline-start-style": "none",
@@ -48,8 +42,6 @@
48
42
  "border-right-style": "none",
49
43
  "border-right-width": "medium",
50
44
  "border-spacing": "0",
51
- "border-start-end-radius": "0",
52
- "border-start-start-radius": "0",
53
45
  "border-top-left-radius": "0",
54
46
  "border-top-right-radius": "0",
55
47
  "border-top-style": "none",
@@ -124,13 +116,6 @@
124
116
  "initial-letter": "normal",
125
117
  "initial-letter-align": "auto",
126
118
  "inline-size": "auto",
127
- "inset": "auto",
128
- "inset-block": "auto",
129
- "inset-block-end": "auto",
130
- "inset-block-start": "auto",
131
- "inset-inline": "auto",
132
- "inset-inline-end": "auto",
133
- "inset-inline-start": "auto",
134
119
  "isolation": "auto",
135
120
  "justify-content": "normal",
136
121
  "justify-items": "legacy",
@@ -140,13 +125,12 @@
140
125
  "line-break": "auto",
141
126
  "line-clamp": "none",
142
127
  "line-height": "normal",
128
+ "line-height-step": "0",
143
129
  "list-style-image": "none",
144
130
  "list-style-type": "disc",
145
- "margin-block": "0",
146
131
  "margin-block-end": "0",
147
132
  "margin-block-start": "0",
148
133
  "margin-bottom": "0",
149
- "margin-inline": "0",
150
134
  "margin-inline-end": "0",
151
135
  "margin-inline-start": "0",
152
136
  "margin-left": "0",
@@ -167,12 +151,16 @@
167
151
  "max-lines": "none",
168
152
  "max-width": "none",
169
153
  "min-block-size": "0",
170
- "min-height": "auto",
154
+ "min-height": "0",
171
155
  "min-inline-size": "0",
172
- "min-width": "auto",
156
+ "min-width": "0",
173
157
  "mix-blend-mode": "normal",
174
158
  "object-fit": "fill",
175
159
  "offset-anchor": "auto",
160
+ "offset-block-end": "auto",
161
+ "offset-block-start": "auto",
162
+ "offset-inline-end": "auto",
163
+ "offset-inline-start": "auto",
176
164
  "offset-distance": "0",
177
165
  "offset-path": "none",
178
166
  "offset-position": "auto",
@@ -187,11 +175,9 @@
187
175
  "overflow-block": "auto",
188
176
  "overflow-inline": "auto",
189
177
  "overflow-wrap": "normal",
190
- "padding-block": "0",
191
178
  "padding-block-end": "0",
192
179
  "padding-block-start": "0",
193
180
  "padding-bottom": "0",
194
- "padding-inline": "0",
195
181
  "padding-inline-end": "0",
196
182
  "padding-inline-start": "0",
197
183
  "padding-left": "0",
@@ -211,36 +197,10 @@
211
197
  "row-gap": "normal",
212
198
  "ruby-position": "over",
213
199
  "scale": "none",
214
- "scrollbar-color": "auto",
215
- "scrollbar-width": "auto",
216
200
  "scroll-behavior": "auto",
217
- "scroll-margin": "0",
218
- "scroll-margin-block": "0",
219
- "scroll-margin-block-start": "0",
220
- "scroll-margin-block-end": "0",
221
- "scroll-margin-bottom": "0",
222
- "scroll-margin-inline": "0",
223
- "scroll-margin-inline-start": "0",
224
- "scroll-margin-inline-end": "0",
225
- "scroll-margin-left": "0",
226
- "scroll-margin-right": "0",
227
- "scroll-margin-top": "0",
228
- "scroll-padding": "auto",
229
- "scroll-padding-block": "auto",
230
- "scroll-padding-block-start": "auto",
231
- "scroll-padding-block-end": "auto",
232
- "scroll-padding-bottom": "auto",
233
- "scroll-padding-inline": "auto",
234
- "scroll-padding-inline-start": "auto",
235
- "scroll-padding-inline-end": "auto",
236
- "scroll-padding-left": "auto",
237
- "scroll-padding-right": "auto",
238
- "scroll-padding-top": "auto",
239
- "scroll-snap-align": "none",
240
201
  "scroll-snap-coordinate": "none",
241
202
  "scroll-snap-points-x": "none",
242
203
  "scroll-snap-points-y": "none",
243
- "scroll-snap-stop": "normal",
244
204
  "scroll-snap-type": "none",
245
205
  "shape-image-threshold": "0.0",
246
206
  "shape-margin": "0",
@@ -3,12 +3,10 @@
3
3
  "background-color": "transparent",
4
4
  "background-origin": "padding-box",
5
5
  "background-size": "auto auto",
6
- "border-block-color": "currentcolor",
7
6
  "border-block-end-color": "currentcolor",
8
7
  "border-block-start-color": "currentcolor",
9
8
  "border-bottom-color": "currentcolor",
10
9
  "border-collapse": "separate",
11
- "border-inline-color": "currentcolor",
12
10
  "border-inline-end-color": "currentcolor",
13
11
  "border-inline-start-color": "currentcolor",
14
12
  "border-left-color": "currentcolor",
@@ -20,7 +18,7 @@
20
18
  "mask-clip": "border-box",
21
19
  "mask-mode": "match-source",
22
20
  "mask-origin": "border-box",
23
- "mask-repeat": "repeat",
21
+ "mask-repeat": "no-repeat",
24
22
  "mask-type": "luminance",
25
23
  "ruby-align": "space-around",
26
24
  "ruby-merge": "separate",
package/dist/index.js CHANGED
@@ -1,58 +1,53 @@
1
- "use strict";
1
+ 'use strict';
2
2
 
3
3
  Object.defineProperty(exports, "__esModule", {
4
- value: true
4
+ value: true
5
5
  });
6
- exports.default = void 0;
7
6
 
8
- var _postcss = require("postcss");
7
+ var _postcss = require('postcss');
9
8
 
10
- var _has = _interopRequireDefault(require("has"));
9
+ var _has = require('has');
11
10
 
12
- var _browserslist = _interopRequireDefault(require("browserslist"));
11
+ var _has2 = _interopRequireDefault(_has);
13
12
 
14
- var _caniuseApi = require("caniuse-api");
13
+ var _browserslist = require('browserslist');
15
14
 
16
- var _fromInitial = _interopRequireDefault(require("../data/fromInitial.json"));
15
+ var _browserslist2 = _interopRequireDefault(_browserslist);
17
16
 
18
- var _toInitial = _interopRequireDefault(require("../data/toInitial.json"));
17
+ var _caniuseApi = require('caniuse-api');
18
+
19
+ var _fromInitial = require('../data/fromInitial.json');
20
+
21
+ var _fromInitial2 = _interopRequireDefault(_fromInitial);
22
+
23
+ var _toInitial = require('../data/toInitial.json');
24
+
25
+ var _toInitial2 = _interopRequireDefault(_toInitial);
19
26
 
20
27
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
21
28
 
22
- const initial = 'initial'; // In most of the browser including chrome the initial for `writing-mode` is not `horizontal-tb`. Ref https://github.com/cssnano/cssnano/pull/905
23
-
24
- const defaultIgnoreProps = ['writing-mode'];
25
-
26
- var _default = (0, _postcss.plugin)('postcss-reduce-initial', () => {
27
- return (css, result) => {
28
- const resultOpts = result.opts || {};
29
- const browsers = (0, _browserslist.default)(null, {
30
- stats: resultOpts.stats,
31
- path: __dirname,
32
- env: resultOpts.env
33
- });
34
- const initialSupport = (0, _caniuseApi.isSupported)('css-initial-value', browsers);
35
- css.walkDecls(decl => {
36
- const lowerCasedProp = decl.prop.toLowerCase();
37
- const ignoreProp = defaultIgnoreProps.concat(resultOpts.ignore || []);
38
-
39
- if (ignoreProp.includes(lowerCasedProp)) {
40
- return;
41
- }
42
-
43
- if (initialSupport && (0, _has.default)(_toInitial.default, lowerCasedProp) && decl.value.toLowerCase() === _toInitial.default[lowerCasedProp]) {
44
- decl.value = initial;
45
- return;
46
- }
47
-
48
- if (decl.value.toLowerCase() !== initial || !_fromInitial.default[lowerCasedProp]) {
49
- return;
50
- }
51
-
52
- decl.value = _fromInitial.default[lowerCasedProp];
53
- });
54
- };
29
+ const initial = 'initial';
30
+
31
+ exports.default = (0, _postcss.plugin)('postcss-reduce-initial', () => {
32
+ return (css, result) => {
33
+ const resultOpts = result.opts || {};
34
+ const browsers = (0, _browserslist2.default)(null, {
35
+ stats: resultOpts.stats,
36
+ path: __dirname,
37
+ env: resultOpts.env
38
+ });
39
+ const initialSupport = (0, _caniuseApi.isSupported)('css-initial-value', browsers);
40
+ css.walkDecls(decl => {
41
+ const lowerCasedProp = decl.prop.toLowerCase();
42
+ if (initialSupport && (0, _has2.default)(_toInitial2.default, lowerCasedProp) && decl.value === _toInitial2.default[lowerCasedProp]) {
43
+ decl.value = initial;
44
+ return;
45
+ }
46
+ if (decl.value.toLowerCase() !== initial || !_fromInitial2.default[lowerCasedProp]) {
47
+ return;
48
+ }
49
+ decl.value = _fromInitial2.default[lowerCasedProp];
50
+ });
51
+ };
55
52
  });
56
-
57
- exports.default = _default;
58
- module.exports = exports.default;
53
+ module.exports = exports['default'];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "postcss-reduce-initial",
3
- "version": "4.0.0-nightly.2020.9.9",
3
+ "version": "4.0.1",
4
4
  "description": "Reduce initial definitions to the actual initial value, where possible.",
5
5
  "main": "dist/index.js",
6
6
  "files": [
@@ -10,9 +10,7 @@
10
10
  ],
11
11
  "scripts": {
12
12
  "acquire": "babel-node ./src/acquire.js",
13
- "prebuild": "",
14
- "build": "cross-env BABEL_ENV=publish babel src --config-file ../../babel.config.js --out-dir dist --ignore '**/__tests__/,src/acquire.js'",
15
- "prepublish": ""
13
+ "prepublish": "cross-env BABEL_ENV=publish babel src --out-dir dist --ignore /__tests__/,src/acquire.js"
16
14
  },
17
15
  "keywords": [
18
16
  "css",
@@ -20,6 +18,13 @@
20
18
  "postcss-plugin"
21
19
  ],
22
20
  "license": "MIT",
21
+ "devDependencies": {
22
+ "babel-cli": "^6.0.0",
23
+ "cross-env": "^5.0.0",
24
+ "got": "^8.0.0",
25
+ "html2plaintext": "^2.0.0",
26
+ "write-file": "^1.0.0"
27
+ },
23
28
  "homepage": "https://github.com/cssnano/cssnano",
24
29
  "author": {
25
30
  "name": "Ben Briggs",
@@ -28,15 +33,15 @@
28
33
  },
29
34
  "repository": "cssnano/cssnano",
30
35
  "dependencies": {
31
- "browserslist": "^4.5.6",
36
+ "browserslist": "^4.0.0",
32
37
  "caniuse-api": "^3.0.0",
33
- "has": "^1.0.3",
34
- "postcss": "^7.0.16"
38
+ "has": "^1.0.0",
39
+ "postcss": "^6.0.0"
35
40
  },
36
41
  "bugs": {
37
42
  "url": "https://github.com/cssnano/cssnano/issues"
38
43
  },
39
44
  "engines": {
40
- "node": ">=10.13.0"
45
+ "node": ">=6.9.0"
41
46
  }
42
- }
47
+ }