autoprefixer 7.0.0 → 7.1.2
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 +15 -0
- package/README.md +26 -10
- package/data/prefixes.js +31 -3
- package/lib/brackets.js +11 -23
- package/lib/hacks/appearance.js +42 -0
- package/lib/hacks/intrinsic.js +73 -0
- package/lib/hacks/text-decoration.js +41 -0
- package/lib/old-selector.js +2 -2
- package/lib/prefixes.js +4 -2
- package/lib/processor.js +34 -20
- package/lib/supports.js +1 -3
- package/package.json +15 -13
- package/lib/hacks/stretch.js +0 -59
package/CHANGELOG.md
CHANGED
|
@@ -1,6 +1,21 @@
|
|
|
1
1
|
# Change Log
|
|
2
2
|
This project adheres to [Semantic Versioning](http://semver.org/).
|
|
3
3
|
|
|
4
|
+
## 7.1.2
|
|
5
|
+
* Fix `text-decoration` shortcut support.
|
|
6
|
+
|
|
7
|
+
## 7.1.1
|
|
8
|
+
* Remove non-`-webkit-` intrinsic prefixes in Grid Layout (by 一丝).
|
|
9
|
+
|
|
10
|
+
## 7.1 “Universitas litterarum”
|
|
11
|
+
* Add `unicode-bidi` support.
|
|
12
|
+
* Add `-webkit-appearance` support for Edge.
|
|
13
|
+
* Add `from` option to `info()`.
|
|
14
|
+
* Fix intrinsic widths prefixes in Grid Layout.
|
|
15
|
+
|
|
16
|
+
## 7.0.1
|
|
17
|
+
* Fix Autoprefixer for old JS runtimes.
|
|
18
|
+
|
|
4
19
|
## 7.0 “Coelestem adspicit lucem”
|
|
5
20
|
* Remove node.js 0.12 support.
|
|
6
21
|
* Use PostCSS 6.0.
|
package/README.md
CHANGED
|
@@ -184,6 +184,28 @@ browsers list.
|
|
|
184
184
|
|
|
185
185
|
[`browserslist` config]: https://github.com/ai/browserslist#config-file
|
|
186
186
|
|
|
187
|
+
#### What is unprefixed version for `-webkit-min-device-pixel-ratio`?
|
|
188
|
+
|
|
189
|
+
```css
|
|
190
|
+
@media (min-resolution: 2dppx) {
|
|
191
|
+
.image {
|
|
192
|
+
background-image: url(image@2x.png);
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
```
|
|
196
|
+
|
|
197
|
+
Will be compiled to:
|
|
198
|
+
|
|
199
|
+
```css
|
|
200
|
+
@media (-webkit-min-device-pixel-ratio: 2),
|
|
201
|
+
(-o-min-device-pixel-ratio: 2/1),
|
|
202
|
+
(min-resolution: 2dppx) {
|
|
203
|
+
.image {
|
|
204
|
+
background-image: url(image@2x.png);
|
|
205
|
+
}
|
|
206
|
+
}
|
|
207
|
+
```
|
|
208
|
+
|
|
187
209
|
#### Does it add polyfills?
|
|
188
210
|
|
|
189
211
|
No. Autoprefixer only adds prefixes.
|
|
@@ -227,15 +249,9 @@ wrote `-webkit-gradient` without W3C’s `gradient`,
|
|
|
227
249
|
Autoprefixer will not add other prefixes.
|
|
228
250
|
|
|
229
251
|
But [PostCSS] has a plugins to convert CSS to unprefixed state.
|
|
230
|
-
Use
|
|
231
|
-
|
|
232
|
-
* [postcss-unprefix]
|
|
233
|
-
* [postcss-flexboxfixer]
|
|
234
|
-
* [postcss-gradientfixer]
|
|
252
|
+
Use [postcss-unprefix] before Autoprefixer.
|
|
235
253
|
|
|
236
|
-
[postcss-
|
|
237
|
-
[postcss-flexboxfixer]: https://github.com/hallvors/postcss-flexboxfixer
|
|
238
|
-
[postcss-unprefix]: https://github.com/yisibl/postcss-unprefix
|
|
254
|
+
[postcss-unprefix]: https://github.com/gucong3000/postcss-unprefix
|
|
239
255
|
|
|
240
256
|
#### Does Autoprefixer add `-epub-` prefix?
|
|
241
257
|
|
|
@@ -281,10 +297,10 @@ and [other PostCSS plugins].
|
|
|
281
297
|
```js
|
|
282
298
|
module.exports = {
|
|
283
299
|
module: {
|
|
284
|
-
|
|
300
|
+
rules: [
|
|
285
301
|
{
|
|
286
302
|
test: /\.css$/,
|
|
287
|
-
|
|
303
|
+
use: ["style-loader", "css-loader", "postcss-loader"]
|
|
288
304
|
}
|
|
289
305
|
]
|
|
290
306
|
}
|
package/data/prefixes.js
CHANGED
|
@@ -389,7 +389,7 @@ f(require('caniuse-lite/data/features/css3-tabsize.js'), function (browsers) {
|
|
|
389
389
|
// Intrinsic & extrinsic sizing
|
|
390
390
|
f(require('caniuse-lite/data/features/intrinsic-width.js'), function (browsers) {
|
|
391
391
|
return prefix(['max-content', 'min-content', 'fit-content', 'fill', 'fill-available', 'stretch'], {
|
|
392
|
-
props: ['width', 'min-width', 'max-width', 'height', 'min-height', 'max-height', 'inline-size', 'min-inline-size', 'max-inline-size', 'block-size', 'min-block-size', 'max-block-size'],
|
|
392
|
+
props: ['width', 'min-width', 'max-width', 'height', 'min-height', 'max-height', 'inline-size', 'min-inline-size', 'max-inline-size', 'block-size', 'min-block-size', 'max-block-size', 'grid', 'grid-template', 'grid-template-rows', 'grid-template-columns', 'grid-auto-columns', 'grid-auto-rows'],
|
|
393
393
|
feature: 'intrinsic-width',
|
|
394
394
|
browsers: browsers
|
|
395
395
|
});
|
|
@@ -434,7 +434,7 @@ f(require('caniuse-lite/data/features/pointer.js'), function (browsers) {
|
|
|
434
434
|
var decoration = require('caniuse-lite/data/features/text-decoration.js');
|
|
435
435
|
|
|
436
436
|
f(decoration, function (browsers) {
|
|
437
|
-
return prefix(['text-decoration-style', 'text-decoration-color', 'text-decoration-line'], {
|
|
437
|
+
return prefix(['text-decoration-style', 'text-decoration-color', 'text-decoration-line', 'text-decoration'], {
|
|
438
438
|
feature: 'text-decoration',
|
|
439
439
|
browsers: browsers
|
|
440
440
|
});
|
|
@@ -568,7 +568,8 @@ f(logicalProps, { match: /x\s#2/ }, function (browsers) {
|
|
|
568
568
|
});
|
|
569
569
|
|
|
570
570
|
// CSS appearance
|
|
571
|
-
|
|
571
|
+
var appearance = require('caniuse-lite/data/features/css-appearance.js');
|
|
572
|
+
f(appearance, { match: /#2|x/ }, function (browsers) {
|
|
572
573
|
return prefix(['appearance'], {
|
|
573
574
|
feature: 'css-appearance',
|
|
574
575
|
browsers: browsers
|
|
@@ -672,4 +673,31 @@ f(require('caniuse-lite/data/features/css-any-link.js'), function (browsers) {
|
|
|
672
673
|
feature: 'css-any-link',
|
|
673
674
|
browsers: browsers
|
|
674
675
|
});
|
|
676
|
+
});
|
|
677
|
+
|
|
678
|
+
// unicode-bidi
|
|
679
|
+
var bidi = require('caniuse-lite/data/features/css-unicode-bidi.js');
|
|
680
|
+
|
|
681
|
+
f(bidi, function (browsers) {
|
|
682
|
+
return prefix(['isolate'], {
|
|
683
|
+
props: ['unicode-bidi'],
|
|
684
|
+
feature: 'css-unicode-bidi',
|
|
685
|
+
browsers: browsers
|
|
686
|
+
});
|
|
687
|
+
});
|
|
688
|
+
|
|
689
|
+
f(bidi, { match: /y x|a x #2/ }, function (browsers) {
|
|
690
|
+
return prefix(['plaintext'], {
|
|
691
|
+
props: ['unicode-bidi'],
|
|
692
|
+
feature: 'css-unicode-bidi',
|
|
693
|
+
browsers: browsers
|
|
694
|
+
});
|
|
695
|
+
});
|
|
696
|
+
|
|
697
|
+
f(bidi, { match: /y x/ }, function (browsers) {
|
|
698
|
+
return prefix(['isolate-override'], {
|
|
699
|
+
props: ['unicode-bidi'],
|
|
700
|
+
feature: 'css-unicode-bidi',
|
|
701
|
+
browsers: browsers
|
|
702
|
+
});
|
|
675
703
|
});
|
package/lib/brackets.js
CHANGED
|
@@ -15,20 +15,8 @@ var brackets = {
|
|
|
15
15
|
var current = [''];
|
|
16
16
|
var stack = [current];
|
|
17
17
|
|
|
18
|
-
for (var
|
|
19
|
-
var
|
|
20
|
-
|
|
21
|
-
if (_isArray) {
|
|
22
|
-
if (_i >= _iterator.length) break;
|
|
23
|
-
_ref = _iterator[_i++];
|
|
24
|
-
} else {
|
|
25
|
-
_i = _iterator.next();
|
|
26
|
-
if (_i.done) break;
|
|
27
|
-
_ref = _i.value;
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
var sym = _ref;
|
|
31
|
-
|
|
18
|
+
for (var i = 0; i < str.length; i++) {
|
|
19
|
+
var sym = str[i];
|
|
32
20
|
if (sym === '(') {
|
|
33
21
|
current = [''];
|
|
34
22
|
last(stack).push(current);
|
|
@@ -51,19 +39,19 @@ var brackets = {
|
|
|
51
39
|
*/
|
|
52
40
|
stringify: function stringify(ast) {
|
|
53
41
|
var result = '';
|
|
54
|
-
for (var
|
|
55
|
-
var
|
|
42
|
+
for (var _iterator = ast, _isArray = Array.isArray(_iterator), _i = 0, _iterator = _isArray ? _iterator : _iterator[Symbol.iterator]();;) {
|
|
43
|
+
var _ref;
|
|
56
44
|
|
|
57
|
-
if (
|
|
58
|
-
if (
|
|
59
|
-
|
|
45
|
+
if (_isArray) {
|
|
46
|
+
if (_i >= _iterator.length) break;
|
|
47
|
+
_ref = _iterator[_i++];
|
|
60
48
|
} else {
|
|
61
|
-
|
|
62
|
-
if (
|
|
63
|
-
|
|
49
|
+
_i = _iterator.next();
|
|
50
|
+
if (_i.done) break;
|
|
51
|
+
_ref = _i.value;
|
|
64
52
|
}
|
|
65
53
|
|
|
66
|
-
var i =
|
|
54
|
+
var i = _ref;
|
|
67
55
|
|
|
68
56
|
if ((typeof i === 'undefined' ? 'undefined' : _typeof(i)) === 'object') {
|
|
69
57
|
result += '(' + brackets.stringify(i) + ')';
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
4
|
+
|
|
5
|
+
function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
|
|
6
|
+
|
|
7
|
+
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
|
|
8
|
+
|
|
9
|
+
var Declaration = require('../declaration');
|
|
10
|
+
var utils = require('../utils');
|
|
11
|
+
|
|
12
|
+
var Appearance = function (_Declaration) {
|
|
13
|
+
_inherits(Appearance, _Declaration);
|
|
14
|
+
|
|
15
|
+
function Appearance(name, prefixes, all) {
|
|
16
|
+
_classCallCheck(this, Appearance);
|
|
17
|
+
|
|
18
|
+
var _this = _possibleConstructorReturn(this, _Declaration.call(this, name, prefixes, all));
|
|
19
|
+
|
|
20
|
+
if (_this.prefixes) {
|
|
21
|
+
_this.prefixes = utils.uniq(_this.prefixes.map(function (i) {
|
|
22
|
+
if (i === '-ms-') {
|
|
23
|
+
return '-webkit-';
|
|
24
|
+
} else {
|
|
25
|
+
return i;
|
|
26
|
+
}
|
|
27
|
+
}));
|
|
28
|
+
}
|
|
29
|
+
return _this;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
return Appearance;
|
|
33
|
+
}(Declaration);
|
|
34
|
+
|
|
35
|
+
Object.defineProperty(Appearance, 'names', {
|
|
36
|
+
enumerable: true,
|
|
37
|
+
writable: true,
|
|
38
|
+
value: ['appearance']
|
|
39
|
+
});
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
module.exports = Appearance;
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
4
|
+
|
|
5
|
+
function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
|
|
6
|
+
|
|
7
|
+
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
|
|
8
|
+
|
|
9
|
+
var OldValue = require('../old-value');
|
|
10
|
+
var Value = require('../value');
|
|
11
|
+
|
|
12
|
+
function _regexp(name) {
|
|
13
|
+
return new RegExp('(^|[\\s,(])(' + name + '($|[\\s),]))', 'gi');
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
var Intrinsic = function (_Value) {
|
|
17
|
+
_inherits(Intrinsic, _Value);
|
|
18
|
+
|
|
19
|
+
function Intrinsic() {
|
|
20
|
+
_classCallCheck(this, Intrinsic);
|
|
21
|
+
|
|
22
|
+
return _possibleConstructorReturn(this, _Value.apply(this, arguments));
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
Intrinsic.prototype.regexp = function regexp() {
|
|
26
|
+
if (!this.regexpCache) this.regexpCache = _regexp(this.name);
|
|
27
|
+
return this.regexpCache;
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
Intrinsic.prototype.isStretch = function isStretch() {
|
|
31
|
+
return this.name === 'stretch' || this.name === 'fill' || this.name === 'fill-available';
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
Intrinsic.prototype.replace = function replace(string, prefix) {
|
|
35
|
+
if (prefix === '-moz-' && this.isStretch()) {
|
|
36
|
+
return string.replace(this.regexp(), '$1-moz-available$3');
|
|
37
|
+
} else if (prefix === '-webkit-' && this.isStretch()) {
|
|
38
|
+
return string.replace(this.regexp(), '$1-webkit-fill-available$3');
|
|
39
|
+
} else {
|
|
40
|
+
return _Value.prototype.replace.call(this, string, prefix);
|
|
41
|
+
}
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
Intrinsic.prototype.old = function old(prefix) {
|
|
45
|
+
var prefixed = prefix + this.name;
|
|
46
|
+
if (this.isStretch()) {
|
|
47
|
+
if (prefix === '-moz-') {
|
|
48
|
+
prefixed = '-moz-available';
|
|
49
|
+
} else if (prefix === '-webkit-') {
|
|
50
|
+
prefixed = '-webkit-fill-available';
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
return new OldValue(this.name, prefixed, prefixed, _regexp(prefixed));
|
|
54
|
+
};
|
|
55
|
+
|
|
56
|
+
Intrinsic.prototype.add = function add(decl, prefix) {
|
|
57
|
+
if (decl.prop.indexOf('grid') !== -1 && prefix !== '-webkit-') {
|
|
58
|
+
return undefined;
|
|
59
|
+
}
|
|
60
|
+
return _Value.prototype.add.call(this, decl, prefix);
|
|
61
|
+
};
|
|
62
|
+
|
|
63
|
+
return Intrinsic;
|
|
64
|
+
}(Value);
|
|
65
|
+
|
|
66
|
+
Object.defineProperty(Intrinsic, 'names', {
|
|
67
|
+
enumerable: true,
|
|
68
|
+
writable: true,
|
|
69
|
+
value: ['max-content', 'min-content', 'fit-content', 'fill', 'fill-available', 'stretch']
|
|
70
|
+
});
|
|
71
|
+
|
|
72
|
+
|
|
73
|
+
module.exports = Intrinsic;
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
4
|
+
|
|
5
|
+
function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
|
|
6
|
+
|
|
7
|
+
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
|
|
8
|
+
|
|
9
|
+
var Declaration = require('../declaration');
|
|
10
|
+
|
|
11
|
+
var BASIC = ['none', 'underline', 'overline', 'line-through', 'blink', 'inherit', 'initial', 'unset'];
|
|
12
|
+
|
|
13
|
+
var TextDecoration = function (_Declaration) {
|
|
14
|
+
_inherits(TextDecoration, _Declaration);
|
|
15
|
+
|
|
16
|
+
function TextDecoration() {
|
|
17
|
+
_classCallCheck(this, TextDecoration);
|
|
18
|
+
|
|
19
|
+
return _possibleConstructorReturn(this, _Declaration.apply(this, arguments));
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* Do not add prefixes for basic values.
|
|
24
|
+
*/
|
|
25
|
+
TextDecoration.prototype.check = function check(decl) {
|
|
26
|
+
return decl.value.split(/\s+/).some(function (i) {
|
|
27
|
+
return BASIC.indexOf(i) === -1;
|
|
28
|
+
});
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
return TextDecoration;
|
|
32
|
+
}(Declaration);
|
|
33
|
+
|
|
34
|
+
Object.defineProperty(TextDecoration, 'names', {
|
|
35
|
+
enumerable: true,
|
|
36
|
+
writable: true,
|
|
37
|
+
value: ['text-decoration']
|
|
38
|
+
});
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
module.exports = TextDecoration;
|
package/lib/old-selector.js
CHANGED
|
@@ -19,7 +19,7 @@ var OldSelector = function () {
|
|
|
19
19
|
}
|
|
20
20
|
|
|
21
21
|
/**
|
|
22
|
-
* Is rule
|
|
22
|
+
* Is rule a hack without unprefixed version bottom
|
|
23
23
|
*/
|
|
24
24
|
|
|
25
25
|
|
|
@@ -71,7 +71,7 @@ var OldSelector = function () {
|
|
|
71
71
|
};
|
|
72
72
|
|
|
73
73
|
/**
|
|
74
|
-
* Does rule contain
|
|
74
|
+
* Does rule contain an unnecessary prefixed selector
|
|
75
75
|
*/
|
|
76
76
|
|
|
77
77
|
|
package/lib/prefixes.js
CHANGED
|
@@ -27,6 +27,7 @@ Declaration.hack(require('./hacks/flex-grow'));
|
|
|
27
27
|
Declaration.hack(require('./hacks/flex-wrap'));
|
|
28
28
|
Declaration.hack(require('./hacks/grid-start'));
|
|
29
29
|
Declaration.hack(require('./hacks/align-self'));
|
|
30
|
+
Declaration.hack(require('./hacks/appearance'));
|
|
30
31
|
Declaration.hack(require('./hacks/flex-basis'));
|
|
31
32
|
Declaration.hack(require('./hacks/mask-border'));
|
|
32
33
|
Declaration.hack(require('./hacks/align-items'));
|
|
@@ -40,16 +41,17 @@ Declaration.hack(require('./hacks/block-logical'));
|
|
|
40
41
|
Declaration.hack(require('./hacks/grid-template'));
|
|
41
42
|
Declaration.hack(require('./hacks/inline-logical'));
|
|
42
43
|
Declaration.hack(require('./hacks/grid-row-align'));
|
|
43
|
-
Declaration.hack(require('./hacks/grid-column-align'));
|
|
44
44
|
Declaration.hack(require('./hacks/transform-decl'));
|
|
45
45
|
Declaration.hack(require('./hacks/flex-direction'));
|
|
46
46
|
Declaration.hack(require('./hacks/image-rendering'));
|
|
47
|
+
Declaration.hack(require('./hacks/text-decoration'));
|
|
47
48
|
Declaration.hack(require('./hacks/justify-content'));
|
|
48
49
|
Declaration.hack(require('./hacks/background-size'));
|
|
50
|
+
Declaration.hack(require('./hacks/grid-column-align'));
|
|
49
51
|
Declaration.hack(require('./hacks/text-emphasis-position'));
|
|
50
52
|
|
|
51
|
-
Value.hack(require('./hacks/stretch'));
|
|
52
53
|
Value.hack(require('./hacks/gradient'));
|
|
54
|
+
Value.hack(require('./hacks/intrinsic'));
|
|
53
55
|
Value.hack(require('./hacks/pixelated'));
|
|
54
56
|
Value.hack(require('./hacks/image-set'));
|
|
55
57
|
Value.hack(require('./hacks/cross-fade'));
|
package/lib/processor.js
CHANGED
|
@@ -31,19 +31,19 @@ var Processor = function () {
|
|
|
31
31
|
|
|
32
32
|
css.walkAtRules(function (rule) {
|
|
33
33
|
if (rule.name === 'keyframes') {
|
|
34
|
-
if (!_this.
|
|
34
|
+
if (!_this.disabled(rule)) {
|
|
35
35
|
return keyframes && keyframes.process(rule);
|
|
36
36
|
}
|
|
37
37
|
} else if (rule.name === 'viewport') {
|
|
38
|
-
if (!_this.
|
|
38
|
+
if (!_this.disabled(rule)) {
|
|
39
39
|
return viewport && viewport.process(rule);
|
|
40
40
|
}
|
|
41
41
|
} else if (rule.name === 'supports') {
|
|
42
|
-
if (_this.prefixes.options.supports !== false && !_this.
|
|
42
|
+
if (_this.prefixes.options.supports !== false && !_this.disabled(rule)) {
|
|
43
43
|
return supports.process(rule);
|
|
44
44
|
}
|
|
45
45
|
} else if (rule.name === 'media' && rule.params.indexOf('-resolution') !== -1) {
|
|
46
|
-
if (!_this.
|
|
46
|
+
if (!_this.disabled(rule)) {
|
|
47
47
|
return resolution && resolution.process(rule);
|
|
48
48
|
}
|
|
49
49
|
}
|
|
@@ -53,7 +53,7 @@ var Processor = function () {
|
|
|
53
53
|
|
|
54
54
|
// Selectors
|
|
55
55
|
css.walkRules(function (rule) {
|
|
56
|
-
if (_this.
|
|
56
|
+
if (_this.disabled(rule)) return undefined;
|
|
57
57
|
|
|
58
58
|
return _this.prefixes.add.selectors.map(function (selector) {
|
|
59
59
|
return selector.process(rule, result);
|
|
@@ -61,7 +61,7 @@ var Processor = function () {
|
|
|
61
61
|
});
|
|
62
62
|
|
|
63
63
|
css.walkDecls(function (decl) {
|
|
64
|
-
if (_this.
|
|
64
|
+
if (_this.disabledDecl(decl)) return undefined;
|
|
65
65
|
|
|
66
66
|
if (decl.prop === 'display' && decl.value === 'box') {
|
|
67
67
|
result.warn('You should write display: flex by final spec ' + 'instead of display: box', { node: decl });
|
|
@@ -82,7 +82,7 @@ var Processor = function () {
|
|
|
82
82
|
if (decl.value.indexOf('fill-available') !== -1) {
|
|
83
83
|
result.warn('Replace fill-available to stretch, ' + 'because spec had been changed', { node: decl });
|
|
84
84
|
} else if (decl.value.indexOf('fill') !== -1) {
|
|
85
|
-
result.warn('Replace fill to stretch, because spec had been changed', { node: decl });
|
|
85
|
+
result.warn('Replace fill to stretch, ' + 'because spec had been changed', { node: decl });
|
|
86
86
|
}
|
|
87
87
|
}
|
|
88
88
|
|
|
@@ -92,7 +92,7 @@ var Processor = function () {
|
|
|
92
92
|
}
|
|
93
93
|
if (decl.prop === 'grid-row') {
|
|
94
94
|
if (decl.value.indexOf('/') !== -1 && decl.value.indexOf('span') === -1) {
|
|
95
|
-
result.warn('IE supports only grid-row with / and span. ' + 'You should add grid: false option
|
|
95
|
+
result.warn('IE supports only grid-row with / and span. ' + 'You should add grid: false option ' + 'to Autoprefixer and use some JS grid polyfill ' + 'for full spec support', { node: decl });
|
|
96
96
|
}
|
|
97
97
|
}
|
|
98
98
|
}
|
|
@@ -139,7 +139,7 @@ var Processor = function () {
|
|
|
139
139
|
|
|
140
140
|
// Values
|
|
141
141
|
return css.walkDecls(function (decl) {
|
|
142
|
-
if (_this.
|
|
142
|
+
if (_this.disabledValue(decl)) return;
|
|
143
143
|
|
|
144
144
|
var unprefixed = _this.prefixes.unprefixed(decl.prop);
|
|
145
145
|
for (var _iterator = _this.prefixes.values('add', unprefixed), _isArray = Array.isArray(_iterator), _i = 0, _iterator = _isArray ? _iterator : _iterator[Symbol.iterator]();;) {
|
|
@@ -175,7 +175,7 @@ var Processor = function () {
|
|
|
175
175
|
|
|
176
176
|
css.walkAtRules(function (rule, i) {
|
|
177
177
|
if (_this2.prefixes.remove['@' + rule.name]) {
|
|
178
|
-
if (!_this2.
|
|
178
|
+
if (!_this2.disabled(rule)) {
|
|
179
179
|
rule.parent.removeChild(i);
|
|
180
180
|
}
|
|
181
181
|
} else if (rule.name === 'media' && rule.params.indexOf('-resolution') !== -1 && resolution) {
|
|
@@ -188,7 +188,7 @@ var Processor = function () {
|
|
|
188
188
|
var _loop = function _loop(checker) {
|
|
189
189
|
css.walkRules(function (rule, i) {
|
|
190
190
|
if (checker.check(rule)) {
|
|
191
|
-
if (!_this2.
|
|
191
|
+
if (!_this2.disabled(rule)) {
|
|
192
192
|
rule.parent.removeChild(i);
|
|
193
193
|
}
|
|
194
194
|
}
|
|
@@ -213,7 +213,7 @@ var Processor = function () {
|
|
|
213
213
|
}
|
|
214
214
|
|
|
215
215
|
return css.walkDecls(function (decl, i) {
|
|
216
|
-
if (_this2.
|
|
216
|
+
if (_this2.disabled(decl)) return;
|
|
217
217
|
|
|
218
218
|
var rule = decl.parent;
|
|
219
219
|
var unprefixed = _this2.prefixes.unprefixed(decl.prop);
|
|
@@ -289,26 +289,40 @@ var Processor = function () {
|
|
|
289
289
|
*/
|
|
290
290
|
|
|
291
291
|
|
|
292
|
-
Processor.prototype.
|
|
292
|
+
Processor.prototype.disabledValue = function disabledValue(node) {
|
|
293
293
|
if (this.prefixes.options.grid === false && node.type === 'decl') {
|
|
294
294
|
if (node.prop === 'display' && node.value.indexOf('grid') !== -1) {
|
|
295
295
|
return true;
|
|
296
296
|
}
|
|
297
|
-
if (node.prop.indexOf('grid') !== -1 || node.prop === 'justify-items') {
|
|
298
|
-
return true;
|
|
299
|
-
}
|
|
300
297
|
}
|
|
301
298
|
if (this.prefixes.options.flexbox === false && node.type === 'decl') {
|
|
302
299
|
if (node.prop === 'display' && node.value.indexOf('flex') !== -1) {
|
|
303
300
|
return true;
|
|
304
301
|
}
|
|
302
|
+
}
|
|
303
|
+
|
|
304
|
+
return this.disabled(node);
|
|
305
|
+
};
|
|
306
|
+
|
|
307
|
+
/**
|
|
308
|
+
* Check for grid/flexbox options.
|
|
309
|
+
*/
|
|
310
|
+
|
|
311
|
+
|
|
312
|
+
Processor.prototype.disabledDecl = function disabledDecl(node) {
|
|
313
|
+
if (this.prefixes.options.grid === false && node.type === 'decl') {
|
|
314
|
+
if (node.prop.indexOf('grid') !== -1 || node.prop === 'justify-items') {
|
|
315
|
+
return true;
|
|
316
|
+
}
|
|
317
|
+
}
|
|
318
|
+
if (this.prefixes.options.flexbox === false && node.type === 'decl') {
|
|
305
319
|
var other = ['order', 'justify-content', 'align-items', 'align-content'];
|
|
306
320
|
if (node.prop.indexOf('flex') !== -1 || other.indexOf(node.prop) !== -1) {
|
|
307
321
|
return true;
|
|
308
322
|
}
|
|
309
323
|
}
|
|
310
324
|
|
|
311
|
-
return this.
|
|
325
|
+
return this.disabled(node);
|
|
312
326
|
};
|
|
313
327
|
|
|
314
328
|
/**
|
|
@@ -316,7 +330,7 @@ var Processor = function () {
|
|
|
316
330
|
*/
|
|
317
331
|
|
|
318
332
|
|
|
319
|
-
Processor.prototype.
|
|
333
|
+
Processor.prototype.disabled = function disabled(node) {
|
|
320
334
|
if (node._autoprefixerDisabled !== undefined) {
|
|
321
335
|
return node._autoprefixerDisabled;
|
|
322
336
|
} else if (node.nodes) {
|
|
@@ -339,13 +353,13 @@ var Processor = function () {
|
|
|
339
353
|
if (status !== undefined) {
|
|
340
354
|
result = !status;
|
|
341
355
|
} else if (node.parent) {
|
|
342
|
-
result = this.
|
|
356
|
+
result = this.disabled(node.parent);
|
|
343
357
|
}
|
|
344
358
|
|
|
345
359
|
node._autoprefixerDisabled = result;
|
|
346
360
|
return node._autoprefixerDisabled;
|
|
347
361
|
} else if (node.parent) {
|
|
348
|
-
node._autoprefixerDisabled = this.
|
|
362
|
+
node._autoprefixerDisabled = this.disabled(node.parent);
|
|
349
363
|
return node._autoprefixerDisabled;
|
|
350
364
|
} else {
|
|
351
365
|
// unknown state
|
package/lib/supports.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "autoprefixer",
|
|
3
|
-
"version": "7.
|
|
3
|
+
"version": "7.1.2",
|
|
4
4
|
"description": "Parse CSS and add vendor prefixes to CSS rules using values from the Can I Use website",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"autoprefixer",
|
|
@@ -13,37 +13,39 @@
|
|
|
13
13
|
"license": "MIT",
|
|
14
14
|
"repository": "postcss/autoprefixer",
|
|
15
15
|
"dependencies": {
|
|
16
|
-
"browserslist": "^2.1.
|
|
17
|
-
"caniuse-lite": "^1.0.
|
|
16
|
+
"browserslist": "^2.1.5",
|
|
17
|
+
"caniuse-lite": "^1.0.30000697",
|
|
18
18
|
"normalize-range": "^0.1.2",
|
|
19
19
|
"num2fraction": "^1.2.2",
|
|
20
|
-
"postcss": "^6.0.
|
|
20
|
+
"postcss": "^6.0.6",
|
|
21
21
|
"postcss-value-parser": "^3.2.3"
|
|
22
22
|
},
|
|
23
23
|
"devDependencies": {
|
|
24
24
|
"babel-eslint": "^7.2.3",
|
|
25
25
|
"babel-plugin-transform-class-properties": "^6.24.1",
|
|
26
|
-
"babel-preset-env": "^1.
|
|
27
|
-
"
|
|
28
|
-
"
|
|
26
|
+
"babel-preset-env": "^1.6.0",
|
|
27
|
+
"babelify": "^7.3.0",
|
|
28
|
+
"browserify": "^14.4.0",
|
|
29
|
+
"eslint": "^4.1.1",
|
|
29
30
|
"eslint-config-postcss": "^2.0.2",
|
|
30
31
|
"fs-extra": "^3.0.1",
|
|
31
32
|
"gulp": "^3.9.1",
|
|
32
33
|
"gulp-babel": "^6.1.2",
|
|
33
34
|
"gulp-coffee": "^2.3.4",
|
|
34
|
-
"gulp-eslint": "^3.0.1",
|
|
35
|
-
"gulp-jest": "^1.0.0",
|
|
36
35
|
"gulp-json-editor": "^2.2.1",
|
|
37
|
-
"gulp-replace": "^0.
|
|
38
|
-
"jest": "^
|
|
39
|
-
"lint-staged": "^
|
|
36
|
+
"gulp-replace": "^0.6.1",
|
|
37
|
+
"jest": "^20.0.4",
|
|
38
|
+
"lint-staged": "^4.0.1",
|
|
40
39
|
"pre-commit": "^1.2.2",
|
|
40
|
+
"size-limit": "^0.5.0",
|
|
41
41
|
"vinyl-source-stream": "^1.1.0",
|
|
42
42
|
"babel-register": "^6.24.0"
|
|
43
43
|
},
|
|
44
44
|
"scripts": {
|
|
45
45
|
"lint-staged": "lint-staged",
|
|
46
|
-
"
|
|
46
|
+
"lint": "eslint *.js lib/*.js data/*.js test/*.js",
|
|
47
|
+
"size": "size-limit --babili 250KB build/lib/autoprefixer.js",
|
|
48
|
+
"test": "jest && npm run lint && gulp && npm run size"
|
|
47
49
|
},
|
|
48
50
|
"lint-staged": {
|
|
49
51
|
"*.js": "eslint"
|
package/lib/hacks/stretch.js
DELETED
|
@@ -1,59 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
4
|
-
|
|
5
|
-
function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
|
|
6
|
-
|
|
7
|
-
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
|
|
8
|
-
|
|
9
|
-
var OldValue = require('../old-value');
|
|
10
|
-
var Value = require('../value');
|
|
11
|
-
|
|
12
|
-
var Stretch = function (_Value) {
|
|
13
|
-
_inherits(Stretch, _Value);
|
|
14
|
-
|
|
15
|
-
function Stretch() {
|
|
16
|
-
_classCallCheck(this, Stretch);
|
|
17
|
-
|
|
18
|
-
return _possibleConstructorReturn(this, _Value.apply(this, arguments));
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
/**
|
|
22
|
-
* Different prefix for WebKit and Firefox
|
|
23
|
-
*/
|
|
24
|
-
Stretch.prototype.replace = function replace(string, prefix) {
|
|
25
|
-
if (prefix === '-moz-') {
|
|
26
|
-
return string.replace(this.regexp(), '$1-moz-available$3');
|
|
27
|
-
} else if (prefix === '-webkit-') {
|
|
28
|
-
return string.replace(this.regexp(), '$1-webkit-fill-available$3');
|
|
29
|
-
} else {
|
|
30
|
-
return _Value.prototype.replace.call(this, string, prefix);
|
|
31
|
-
}
|
|
32
|
-
};
|
|
33
|
-
|
|
34
|
-
/**
|
|
35
|
-
* Different name for WebKit and Firefox
|
|
36
|
-
*/
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
Stretch.prototype.old = function old(prefix) {
|
|
40
|
-
if (prefix === '-moz-') {
|
|
41
|
-
return new OldValue(this.name, '-moz-available');
|
|
42
|
-
} else if (prefix === '-webkit-') {
|
|
43
|
-
return new OldValue(this.name, '-webkit-fill-available');
|
|
44
|
-
} else {
|
|
45
|
-
return _Value.prototype.old.call(this, prefix);
|
|
46
|
-
}
|
|
47
|
-
};
|
|
48
|
-
|
|
49
|
-
return Stretch;
|
|
50
|
-
}(Value);
|
|
51
|
-
|
|
52
|
-
Object.defineProperty(Stretch, 'names', {
|
|
53
|
-
enumerable: true,
|
|
54
|
-
writable: true,
|
|
55
|
-
value: ['stretch', 'fill', 'fill-available']
|
|
56
|
-
});
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
module.exports = Stretch;
|