autoprefixer 7.1.2 → 7.1.6
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 +17 -0
- package/README.md +10 -8
- package/data/prefixes.js +3 -1
- package/lib/autoprefixer.js +3 -1
- package/lib/brackets.js +10 -5
- package/lib/declaration.js +14 -8
- package/lib/hacks/flex-direction.js +10 -3
- package/lib/hacks/gradient.js +4 -1
- package/lib/hacks/placeholder.js +4 -2
- package/lib/processor.js +72 -53
- package/lib/resolution.js +6 -6
- package/lib/selector.js +2 -2
- package/lib/supports.js +36 -31
- package/lib/transition.js +25 -20
- package/lib/utils.js +6 -6
- package/lib/value.js +40 -25
- package/package.json +19 -16
package/CHANGELOG.md
CHANGED
|
@@ -1,6 +1,23 @@
|
|
|
1
1
|
# Change Log
|
|
2
2
|
This project adheres to [Semantic Versioning](http://semver.org/).
|
|
3
3
|
|
|
4
|
+
## 7.1.6
|
|
5
|
+
* Add warning for using `browserslist` option instead of `browsers`.
|
|
6
|
+
* Add warning for multiple control comments in the same scope.
|
|
7
|
+
* Fix `Invalid array length` error during indent changes.
|
|
8
|
+
|
|
9
|
+
## 7.1.5
|
|
10
|
+
* Fix `::placeholder` prefix for Edge.
|
|
11
|
+
* Fix `inherit`/`initial`/`unset` values for `flex-direction`.
|
|
12
|
+
* Fix RegExp usage in gradients (by Yet Another Minion).
|
|
13
|
+
|
|
14
|
+
## 7.1.4
|
|
15
|
+
* Fix `radial-gradient` direction conversion.
|
|
16
|
+
* Fix `image-set` in `cursor`.
|
|
17
|
+
|
|
18
|
+
## 7.1.3
|
|
19
|
+
* Add warning for old `radial-gradient` direction syntax.
|
|
20
|
+
|
|
4
21
|
## 7.1.2
|
|
5
22
|
* Fix `text-decoration` shortcut support.
|
|
6
23
|
|
package/README.md
CHANGED
|
@@ -299,7 +299,7 @@ module.exports = {
|
|
|
299
299
|
module: {
|
|
300
300
|
rules: [
|
|
301
301
|
{
|
|
302
|
-
test:
|
|
302
|
+
test: /\.css$/,
|
|
303
303
|
use: ["style-loader", "css-loader", "postcss-loader"]
|
|
304
304
|
}
|
|
305
305
|
]
|
|
@@ -356,17 +356,19 @@ with [other PostCSS plugins].
|
|
|
356
356
|
### Other Build Tools:
|
|
357
357
|
|
|
358
358
|
* **Ruby on Rails**: [autoprefixer-rails]
|
|
359
|
+
* **Neutrino**: [neutrino-middleware-postcss]
|
|
360
|
+
* **Jekyll**: add `autoprefixer-rails` and `jekyll-assets` to `Gemfile`
|
|
359
361
|
* **Brunch**: [postcss-brunch]
|
|
360
362
|
* **Broccoli**: [broccoli-postcss]
|
|
361
363
|
* **Middleman**: [middleman-autoprefixer]
|
|
362
364
|
* **Mincer**: add `autoprefixer` npm package and enable it:
|
|
363
365
|
`environment.enable('autoprefixer')`
|
|
364
|
-
* **Jekyll**: add `autoprefixer-rails` and `jekyll-assets` to `Gemfile`
|
|
365
366
|
|
|
366
|
-
[
|
|
367
|
-
[autoprefixer
|
|
368
|
-
[
|
|
369
|
-
[postcss
|
|
367
|
+
[neutrino-middleware-postcss]: https://www.npmjs.com/package/neutrino-middleware-postcss
|
|
368
|
+
[middleman-autoprefixer]: https://github.com/middleman/middleman-autoprefixer
|
|
369
|
+
[autoprefixer-rails]: https://github.com/ai/autoprefixer-rails
|
|
370
|
+
[broccoli-postcss]: https://github.com/jeffjewiss/broccoli-postcss
|
|
371
|
+
[postcss-brunch]: https://github.com/iamvdo/postcss-brunch
|
|
370
372
|
|
|
371
373
|
### Preprocessors
|
|
372
374
|
|
|
@@ -403,8 +405,8 @@ let style = prefixer({
|
|
|
403
405
|
You can use the [postcss-cli] to run Autoprefixer from CLI:
|
|
404
406
|
|
|
405
407
|
```sh
|
|
406
|
-
npm install
|
|
407
|
-
postcss *.css --use autoprefixer -d build/
|
|
408
|
+
npm install postcss-cli autoprefixer
|
|
409
|
+
npx postcss *.css --use autoprefixer -d build/
|
|
408
410
|
```
|
|
409
411
|
|
|
410
412
|
See `postcss -h` for help.
|
package/data/prefixes.js
CHANGED
|
@@ -339,6 +339,8 @@ f(require('caniuse-lite/data/features/css-placeholder.js'), function (browsers)
|
|
|
339
339
|
|
|
340
340
|
if (name === 'firefox' && parseFloat(version) <= 18) {
|
|
341
341
|
return i + ' old';
|
|
342
|
+
} else if (name === 'ie') {
|
|
343
|
+
return i + ' old';
|
|
342
344
|
} else {
|
|
343
345
|
return i;
|
|
344
346
|
}
|
|
@@ -595,7 +597,7 @@ f(require('caniuse-lite/data/features/css-regions.js'), function (browsers) {
|
|
|
595
597
|
// CSS image-set
|
|
596
598
|
f(require('caniuse-lite/data/features/css-image-set.js'), function (browsers) {
|
|
597
599
|
return prefix(['image-set'], {
|
|
598
|
-
props: ['background', 'background-image', 'border-image', 'mask', 'list-style', 'list-style-image', 'content'
|
|
600
|
+
props: ['background', 'background-image', 'border-image', 'cursor', 'mask', 'mask-image', 'list-style', 'list-style-image', 'content'],
|
|
599
601
|
feature: 'css-image-set',
|
|
600
602
|
browsers: browsers
|
|
601
603
|
});
|
package/lib/autoprefixer.js
CHANGED
|
@@ -52,6 +52,8 @@ module.exports = postcss.plugin('autoprefixer', function () {
|
|
|
52
52
|
|
|
53
53
|
if (options.browser) {
|
|
54
54
|
throw new Error('Change `browser` option to `browsers` in Autoprefixer');
|
|
55
|
+
} else if (options.browserslist) {
|
|
56
|
+
throw new Error('Change `browserslist` option to `browsers` in Autoprefixer');
|
|
55
57
|
}
|
|
56
58
|
|
|
57
59
|
if (options.browsers) {
|
|
@@ -81,7 +83,7 @@ module.exports = postcss.plugin('autoprefixer', function () {
|
|
|
81
83
|
});
|
|
82
84
|
timeCapsule(result, prefixes);
|
|
83
85
|
if (options.remove !== false) {
|
|
84
|
-
prefixes.processor.remove(css);
|
|
86
|
+
prefixes.processor.remove(css, result);
|
|
85
87
|
}
|
|
86
88
|
if (options.add !== false) {
|
|
87
89
|
prefixes.processor.add(css, result);
|
package/lib/brackets.js
CHANGED
|
@@ -21,13 +21,17 @@ var brackets = {
|
|
|
21
21
|
current = [''];
|
|
22
22
|
last(stack).push(current);
|
|
23
23
|
stack.push(current);
|
|
24
|
-
|
|
24
|
+
continue;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
if (sym === ')') {
|
|
25
28
|
stack.pop();
|
|
26
29
|
current = last(stack);
|
|
27
30
|
current.push('');
|
|
28
|
-
|
|
29
|
-
current[current.length - 1] += sym;
|
|
31
|
+
continue;
|
|
30
32
|
}
|
|
33
|
+
|
|
34
|
+
current[current.length - 1] += sym;
|
|
31
35
|
}
|
|
32
36
|
|
|
33
37
|
return stack[0];
|
|
@@ -55,9 +59,10 @@ var brackets = {
|
|
|
55
59
|
|
|
56
60
|
if ((typeof i === 'undefined' ? 'undefined' : _typeof(i)) === 'object') {
|
|
57
61
|
result += '(' + brackets.stringify(i) + ')';
|
|
58
|
-
|
|
59
|
-
result += i;
|
|
62
|
+
continue;
|
|
60
63
|
}
|
|
64
|
+
|
|
65
|
+
result += i;
|
|
61
66
|
}
|
|
62
67
|
return result;
|
|
63
68
|
}
|
package/lib/declaration.js
CHANGED
|
@@ -143,7 +143,9 @@ var Declaration = function (_Prefixer) {
|
|
|
143
143
|
var diff = max - utils.removeNote(prefix).length;
|
|
144
144
|
|
|
145
145
|
var before = decl.raw('before');
|
|
146
|
-
|
|
146
|
+
if (diff > 0) {
|
|
147
|
+
before += Array(diff).fill(' ').join('');
|
|
148
|
+
}
|
|
147
149
|
|
|
148
150
|
return before;
|
|
149
151
|
};
|
|
@@ -227,15 +229,19 @@ var Declaration = function (_Prefixer) {
|
|
|
227
229
|
|
|
228
230
|
|
|
229
231
|
Declaration.prototype.process = function process(decl) {
|
|
230
|
-
if (this.needCascade(decl)) {
|
|
231
|
-
var prefixes = _Prefixer.prototype.process.call(this, decl);
|
|
232
|
-
if (prefixes && prefixes.length) {
|
|
233
|
-
this.restoreBefore(decl);
|
|
234
|
-
decl.raws.before = this.calcBefore(prefixes, decl);
|
|
235
|
-
}
|
|
236
|
-
} else {
|
|
232
|
+
if (!this.needCascade(decl)) {
|
|
237
233
|
_Prefixer.prototype.process.call(this, decl);
|
|
234
|
+
return;
|
|
238
235
|
}
|
|
236
|
+
|
|
237
|
+
var prefixes = _Prefixer.prototype.process.call(this, decl);
|
|
238
|
+
|
|
239
|
+
if (!prefixes || !prefixes.length) {
|
|
240
|
+
return;
|
|
241
|
+
}
|
|
242
|
+
|
|
243
|
+
this.restoreBefore(decl);
|
|
244
|
+
decl.raws.before = this.calcBefore(prefixes, decl);
|
|
239
245
|
};
|
|
240
246
|
|
|
241
247
|
/**
|
|
@@ -48,9 +48,16 @@ var FlexDirection = function (_Declaration) {
|
|
|
48
48
|
return undefined;
|
|
49
49
|
}
|
|
50
50
|
|
|
51
|
-
var
|
|
52
|
-
var orient =
|
|
53
|
-
|
|
51
|
+
var v = decl.value;
|
|
52
|
+
var orient = void 0,
|
|
53
|
+
dir = void 0;
|
|
54
|
+
if (v === 'inherit' || v === 'initial' || v === 'unset') {
|
|
55
|
+
orient = v;
|
|
56
|
+
dir = v;
|
|
57
|
+
} else {
|
|
58
|
+
orient = v.indexOf('row') !== -1 ? 'horizontal' : 'vertical';
|
|
59
|
+
dir = v.indexOf('reverse') !== -1 ? 'reverse' : 'normal';
|
|
60
|
+
}
|
|
54
61
|
|
|
55
62
|
var cloned = this.clone(decl);
|
|
56
63
|
cloned.prop = prefix + 'box-orient';
|
package/lib/hacks/gradient.js
CHANGED
|
@@ -174,6 +174,7 @@ var Gradient = function (_Value) {
|
|
|
174
174
|
if (params[0].value === 'to') {
|
|
175
175
|
return params;
|
|
176
176
|
}
|
|
177
|
+
isDirection.lastIndex = 0; // reset search index of global regexp
|
|
177
178
|
if (!isDirection.test(params[0].value)) {
|
|
178
179
|
return params;
|
|
179
180
|
}
|
|
@@ -270,15 +271,17 @@ var Gradient = function (_Value) {
|
|
|
270
271
|
var second = [];
|
|
271
272
|
var i = void 0;
|
|
272
273
|
|
|
274
|
+
var div = void 0;
|
|
273
275
|
for (i = 4; i < params.length; i++) {
|
|
274
276
|
if (params[i].type === 'div') {
|
|
277
|
+
div = params[i];
|
|
275
278
|
break;
|
|
276
279
|
} else {
|
|
277
280
|
second.push(params[i]);
|
|
278
281
|
}
|
|
279
282
|
}
|
|
280
283
|
|
|
281
|
-
params.splice.apply(params, [0, i].concat(second, [
|
|
284
|
+
params.splice.apply(params, [0, i].concat(second, [div, first]));
|
|
282
285
|
};
|
|
283
286
|
|
|
284
287
|
Gradient.prototype.revertDirection = function revertDirection(word) {
|
package/lib/hacks/placeholder.js
CHANGED
|
@@ -21,7 +21,7 @@ var Placeholder = function (_Selector) {
|
|
|
21
21
|
* Add old mozilla to possible prefixes
|
|
22
22
|
*/
|
|
23
23
|
Placeholder.prototype.possible = function possible() {
|
|
24
|
-
return _Selector.prototype.possible.call(this).concat('-moz- old');
|
|
24
|
+
return _Selector.prototype.possible.call(this).concat(['-moz- old', '-ms- old']);
|
|
25
25
|
};
|
|
26
26
|
|
|
27
27
|
/**
|
|
@@ -33,6 +33,8 @@ var Placeholder = function (_Selector) {
|
|
|
33
33
|
if (prefix === '-webkit-') {
|
|
34
34
|
return '::-webkit-input-placeholder';
|
|
35
35
|
} else if (prefix === '-ms-') {
|
|
36
|
+
return '::-ms-input-placeholder';
|
|
37
|
+
} else if (prefix === '-ms- old') {
|
|
36
38
|
return ':-ms-input-placeholder';
|
|
37
39
|
} else if (prefix === '-moz- old') {
|
|
38
40
|
return ':-moz-placeholder';
|
|
@@ -47,7 +49,7 @@ var Placeholder = function (_Selector) {
|
|
|
47
49
|
Object.defineProperty(Placeholder, 'names', {
|
|
48
50
|
enumerable: true,
|
|
49
51
|
writable: true,
|
|
50
|
-
value: ['
|
|
52
|
+
value: ['::placeholder']
|
|
51
53
|
});
|
|
52
54
|
|
|
53
55
|
|
package/lib/processor.js
CHANGED
|
@@ -4,7 +4,8 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Cons
|
|
|
4
4
|
|
|
5
5
|
var Value = require('./value');
|
|
6
6
|
|
|
7
|
-
var
|
|
7
|
+
var OLD_LINEAR = /(^|[^-])linear-gradient\(\s*(top|left|right|bottom)/i;
|
|
8
|
+
var OLD_RADIAL = /(^|[^-])radial-gradient\(\s*\d+(\w*|%)\s+\d+(\w*|%)\s*,/i;
|
|
8
9
|
|
|
9
10
|
var SIZES = ['width', 'height', 'min-width', 'max-width', 'min-height', 'max-height', 'inline-size', 'min-inline-size', 'max-inline-size', 'block-size', 'min-block-size', 'max-block-size'];
|
|
10
11
|
|
|
@@ -31,19 +32,19 @@ var Processor = function () {
|
|
|
31
32
|
|
|
32
33
|
css.walkAtRules(function (rule) {
|
|
33
34
|
if (rule.name === 'keyframes') {
|
|
34
|
-
if (!_this.disabled(rule)) {
|
|
35
|
+
if (!_this.disabled(rule, result)) {
|
|
35
36
|
return keyframes && keyframes.process(rule);
|
|
36
37
|
}
|
|
37
38
|
} else if (rule.name === 'viewport') {
|
|
38
|
-
if (!_this.disabled(rule)) {
|
|
39
|
+
if (!_this.disabled(rule, result)) {
|
|
39
40
|
return viewport && viewport.process(rule);
|
|
40
41
|
}
|
|
41
42
|
} else if (rule.name === 'supports') {
|
|
42
|
-
if (_this.prefixes.options.supports !== false && !_this.disabled(rule)) {
|
|
43
|
+
if (_this.prefixes.options.supports !== false && !_this.disabled(rule, result)) {
|
|
43
44
|
return supports.process(rule);
|
|
44
45
|
}
|
|
45
46
|
} else if (rule.name === 'media' && rule.params.indexOf('-resolution') !== -1) {
|
|
46
|
-
if (!_this.disabled(rule)) {
|
|
47
|
+
if (!_this.disabled(rule, result)) {
|
|
47
48
|
return resolution && resolution.process(rule);
|
|
48
49
|
}
|
|
49
50
|
}
|
|
@@ -53,7 +54,7 @@ var Processor = function () {
|
|
|
53
54
|
|
|
54
55
|
// Selectors
|
|
55
56
|
css.walkRules(function (rule) {
|
|
56
|
-
if (_this.disabled(rule)) return undefined;
|
|
57
|
+
if (_this.disabled(rule, result)) return undefined;
|
|
57
58
|
|
|
58
59
|
return _this.prefixes.add.selectors.map(function (selector) {
|
|
59
60
|
return selector.process(rule, result);
|
|
@@ -61,17 +62,22 @@ var Processor = function () {
|
|
|
61
62
|
});
|
|
62
63
|
|
|
63
64
|
css.walkDecls(function (decl) {
|
|
64
|
-
if (_this.disabledDecl(decl)) return undefined;
|
|
65
|
+
if (_this.disabledDecl(decl, result)) return undefined;
|
|
65
66
|
|
|
66
67
|
if (decl.prop === 'display' && decl.value === 'box') {
|
|
67
68
|
result.warn('You should write display: flex by final spec ' + 'instead of display: box', { node: decl });
|
|
68
69
|
return undefined;
|
|
69
70
|
}
|
|
70
71
|
if (decl.value.indexOf('linear-gradient') !== -1) {
|
|
71
|
-
if (
|
|
72
|
+
if (OLD_LINEAR.test(decl.value)) {
|
|
72
73
|
result.warn('Gradient has outdated direction syntax. ' + 'New syntax is like `to left` instead of `right`.', { node: decl });
|
|
73
74
|
}
|
|
74
75
|
}
|
|
76
|
+
if (decl.value.indexOf('radial-gradient') !== -1) {
|
|
77
|
+
if (OLD_RADIAL.test(decl.value)) {
|
|
78
|
+
result.warn('Gradient has outdated direction syntax. ' + 'New syntax is like `closest-side at 0 0` ' + 'instead of `0 0, closest-side`.', { node: decl });
|
|
79
|
+
}
|
|
80
|
+
}
|
|
75
81
|
if (decl.prop === 'text-emphasis-position') {
|
|
76
82
|
if (decl.value === 'under' || decl.value === 'over') {
|
|
77
83
|
result.warn('You should use 2 values for text-emphasis-position ' + 'For example, `under left` instead of just `under`.', { node: decl });
|
|
@@ -139,7 +145,7 @@ var Processor = function () {
|
|
|
139
145
|
|
|
140
146
|
// Values
|
|
141
147
|
return css.walkDecls(function (decl) {
|
|
142
|
-
if (_this.disabledValue(decl)) return;
|
|
148
|
+
if (_this.disabledValue(decl, result)) return;
|
|
143
149
|
|
|
144
150
|
var unprefixed = _this.prefixes.unprefixed(decl.prop);
|
|
145
151
|
for (var _iterator = _this.prefixes.values('add', unprefixed), _isArray = Array.isArray(_iterator), _i = 0, _iterator = _isArray ? _iterator : _iterator[Symbol.iterator]();;) {
|
|
@@ -167,7 +173,7 @@ var Processor = function () {
|
|
|
167
173
|
*/
|
|
168
174
|
|
|
169
175
|
|
|
170
|
-
Processor.prototype.remove = function remove(css) {
|
|
176
|
+
Processor.prototype.remove = function remove(css, result) {
|
|
171
177
|
var _this2 = this;
|
|
172
178
|
|
|
173
179
|
// At-rules
|
|
@@ -175,7 +181,7 @@ var Processor = function () {
|
|
|
175
181
|
|
|
176
182
|
css.walkAtRules(function (rule, i) {
|
|
177
183
|
if (_this2.prefixes.remove['@' + rule.name]) {
|
|
178
|
-
if (!_this2.disabled(rule)) {
|
|
184
|
+
if (!_this2.disabled(rule, result)) {
|
|
179
185
|
rule.parent.removeChild(i);
|
|
180
186
|
}
|
|
181
187
|
} else if (rule.name === 'media' && rule.params.indexOf('-resolution') !== -1 && resolution) {
|
|
@@ -188,7 +194,7 @@ var Processor = function () {
|
|
|
188
194
|
var _loop = function _loop(checker) {
|
|
189
195
|
css.walkRules(function (rule, i) {
|
|
190
196
|
if (checker.check(rule)) {
|
|
191
|
-
if (!_this2.disabled(rule)) {
|
|
197
|
+
if (!_this2.disabled(rule, result)) {
|
|
192
198
|
rule.parent.removeChild(i);
|
|
193
199
|
}
|
|
194
200
|
}
|
|
@@ -213,7 +219,7 @@ var Processor = function () {
|
|
|
213
219
|
}
|
|
214
220
|
|
|
215
221
|
return css.walkDecls(function (decl, i) {
|
|
216
|
-
if (_this2.disabled(decl)) return;
|
|
222
|
+
if (_this2.disabled(decl, result)) return;
|
|
217
223
|
|
|
218
224
|
var rule = decl.parent;
|
|
219
225
|
var unprefixed = _this2.prefixes.unprefixed(decl.prop);
|
|
@@ -257,19 +263,23 @@ var Processor = function () {
|
|
|
257
263
|
|
|
258
264
|
var checker = _ref3;
|
|
259
265
|
|
|
260
|
-
if (checker.check(decl.value)) {
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
266
|
+
if (!checker.check(decl.value)) {
|
|
267
|
+
continue;
|
|
268
|
+
}
|
|
269
|
+
|
|
270
|
+
unprefixed = checker.unprefixed;
|
|
271
|
+
var _notHack = _this2.prefixes.group(decl).down(function (other) {
|
|
272
|
+
return other.value.indexOf(unprefixed) !== -1;
|
|
273
|
+
});
|
|
274
|
+
|
|
275
|
+
if (_notHack) {
|
|
276
|
+
rule.removeChild(i);
|
|
277
|
+
return;
|
|
278
|
+
}
|
|
279
|
+
|
|
280
|
+
if (checker.clean) {
|
|
281
|
+
checker.clean(decl);
|
|
282
|
+
return;
|
|
273
283
|
}
|
|
274
284
|
}
|
|
275
285
|
});
|
|
@@ -289,7 +299,7 @@ var Processor = function () {
|
|
|
289
299
|
*/
|
|
290
300
|
|
|
291
301
|
|
|
292
|
-
Processor.prototype.disabledValue = function disabledValue(node) {
|
|
302
|
+
Processor.prototype.disabledValue = function disabledValue(node, result) {
|
|
293
303
|
if (this.prefixes.options.grid === false && node.type === 'decl') {
|
|
294
304
|
if (node.prop === 'display' && node.value.indexOf('grid') !== -1) {
|
|
295
305
|
return true;
|
|
@@ -301,7 +311,7 @@ var Processor = function () {
|
|
|
301
311
|
}
|
|
302
312
|
}
|
|
303
313
|
|
|
304
|
-
return this.disabled(node);
|
|
314
|
+
return this.disabled(node, result);
|
|
305
315
|
};
|
|
306
316
|
|
|
307
317
|
/**
|
|
@@ -309,7 +319,7 @@ var Processor = function () {
|
|
|
309
319
|
*/
|
|
310
320
|
|
|
311
321
|
|
|
312
|
-
Processor.prototype.disabledDecl = function disabledDecl(node) {
|
|
322
|
+
Processor.prototype.disabledDecl = function disabledDecl(node, result) {
|
|
313
323
|
if (this.prefixes.options.grid === false && node.type === 'decl') {
|
|
314
324
|
if (node.prop.indexOf('grid') !== -1 || node.prop === 'justify-items') {
|
|
315
325
|
return true;
|
|
@@ -322,7 +332,7 @@ var Processor = function () {
|
|
|
322
332
|
}
|
|
323
333
|
}
|
|
324
334
|
|
|
325
|
-
return this.disabled(node);
|
|
335
|
+
return this.disabled(node, result);
|
|
326
336
|
};
|
|
327
337
|
|
|
328
338
|
/**
|
|
@@ -330,41 +340,45 @@ var Processor = function () {
|
|
|
330
340
|
*/
|
|
331
341
|
|
|
332
342
|
|
|
333
|
-
Processor.prototype.disabled = function disabled(node) {
|
|
343
|
+
Processor.prototype.disabled = function disabled(node, result) {
|
|
334
344
|
if (node._autoprefixerDisabled !== undefined) {
|
|
335
345
|
return node._autoprefixerDisabled;
|
|
336
|
-
}
|
|
346
|
+
}
|
|
347
|
+
|
|
348
|
+
if (node.nodes) {
|
|
337
349
|
var status = undefined;
|
|
338
350
|
node.each(function (i) {
|
|
339
351
|
if (i.type !== 'comment') {
|
|
340
352
|
return undefined;
|
|
341
353
|
}
|
|
342
|
-
if (/(!\s*)?autoprefixer:\s*off/i.test(i.text)) {
|
|
343
|
-
status
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
354
|
+
if (/(!\s*)?autoprefixer:\s*(off|on)/i.test(i.text)) {
|
|
355
|
+
if (typeof status !== 'undefined') {
|
|
356
|
+
result.warn('Second Autoprefixer control comment ' + 'was ignored. Autoprefixer applies control ' + 'comment to whole block, not to next rules.', { node: i });
|
|
357
|
+
} else {
|
|
358
|
+
status = /on/i.test(i.text);
|
|
359
|
+
}
|
|
348
360
|
}
|
|
349
361
|
return undefined;
|
|
350
362
|
});
|
|
351
363
|
|
|
352
|
-
var
|
|
364
|
+
var value = false;
|
|
353
365
|
if (status !== undefined) {
|
|
354
|
-
|
|
366
|
+
value = !status;
|
|
355
367
|
} else if (node.parent) {
|
|
356
|
-
|
|
368
|
+
value = this.disabled(node.parent, result);
|
|
357
369
|
}
|
|
358
370
|
|
|
359
|
-
node._autoprefixerDisabled =
|
|
371
|
+
node._autoprefixerDisabled = value;
|
|
360
372
|
return node._autoprefixerDisabled;
|
|
361
|
-
}
|
|
362
|
-
|
|
373
|
+
}
|
|
374
|
+
|
|
375
|
+
if (node.parent) {
|
|
376
|
+
node._autoprefixerDisabled = this.disabled(node.parent, result);
|
|
363
377
|
return node._autoprefixerDisabled;
|
|
364
|
-
} else {
|
|
365
|
-
// unknown state
|
|
366
|
-
return false;
|
|
367
378
|
}
|
|
379
|
+
|
|
380
|
+
// unknown state
|
|
381
|
+
return false;
|
|
368
382
|
};
|
|
369
383
|
|
|
370
384
|
/**
|
|
@@ -421,14 +435,19 @@ var Processor = function () {
|
|
|
421
435
|
|
|
422
436
|
var i = _ref4;
|
|
423
437
|
|
|
424
|
-
if (i.prop
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
438
|
+
if (i.prop !== 'display') {
|
|
439
|
+
continue;
|
|
440
|
+
}
|
|
441
|
+
|
|
442
|
+
if (i.value.indexOf('flex') !== -1) {
|
|
443
|
+
return 'flex';
|
|
444
|
+
}
|
|
445
|
+
|
|
446
|
+
if (i.value.indexOf('grid') !== -1) {
|
|
447
|
+
return 'grid';
|
|
430
448
|
}
|
|
431
449
|
}
|
|
450
|
+
|
|
432
451
|
return false;
|
|
433
452
|
};
|
|
434
453
|
|
package/lib/resolution.js
CHANGED
|
@@ -118,13 +118,13 @@ var Resolution = function (_Prefixer) {
|
|
|
118
118
|
var _loop = function _loop(prefix) {
|
|
119
119
|
if (prefix === '-moz-' && rule.params.indexOf('dpi') !== -1) {
|
|
120
120
|
return 'continue';
|
|
121
|
-
} else {
|
|
122
|
-
var processed = query.replace(regexp, function (str) {
|
|
123
|
-
var parts = str.match(split);
|
|
124
|
-
return _this3.prefixQuery(prefix, parts[1], parts[2], parts[3], parts[4]);
|
|
125
|
-
});
|
|
126
|
-
prefixed.push(processed);
|
|
127
121
|
}
|
|
122
|
+
|
|
123
|
+
var processed = query.replace(regexp, function (str) {
|
|
124
|
+
var parts = str.match(split);
|
|
125
|
+
return _this3.prefixQuery(prefix, parts[1], parts[2], parts[3], parts[4]);
|
|
126
|
+
});
|
|
127
|
+
prefixed.push(processed);
|
|
128
128
|
};
|
|
129
129
|
|
|
130
130
|
for (var _iterator3 = prefixes, _isArray3 = Array.isArray(_iterator3), _i3 = 0, _iterator3 = _isArray3 ? _iterator3 : _iterator3[Symbol.iterator]();;) {
|
package/lib/selector.js
CHANGED
|
@@ -31,9 +31,9 @@ var Selector = function (_Prefixer) {
|
|
|
31
31
|
Selector.prototype.check = function check(rule) {
|
|
32
32
|
if (rule.selector.indexOf(this.name) !== -1) {
|
|
33
33
|
return !!rule.selector.match(this.regexp());
|
|
34
|
-
} else {
|
|
35
|
-
return false;
|
|
36
34
|
}
|
|
35
|
+
|
|
36
|
+
return false;
|
|
37
37
|
};
|
|
38
38
|
|
|
39
39
|
/**
|
package/lib/supports.js
CHANGED
|
@@ -217,15 +217,18 @@ var Supports = function () {
|
|
|
217
217
|
if (!this.isNot(nodes[i - 1]) && this.isProp(nodes[i]) && this.isOr(nodes[i + 1])) {
|
|
218
218
|
if (this.toRemove(nodes[i][0], all)) {
|
|
219
219
|
nodes.splice(i, 2);
|
|
220
|
-
|
|
221
|
-
i += 2;
|
|
222
|
-
}
|
|
223
|
-
} else {
|
|
224
|
-
if (_typeof(nodes[i]) === 'object') {
|
|
225
|
-
nodes[i] = this.remove(nodes[i], all);
|
|
220
|
+
continue;
|
|
226
221
|
}
|
|
227
|
-
|
|
222
|
+
|
|
223
|
+
i += 2;
|
|
224
|
+
continue;
|
|
228
225
|
}
|
|
226
|
+
|
|
227
|
+
if (_typeof(nodes[i]) === 'object') {
|
|
228
|
+
nodes[i] = this.remove(nodes[i], all);
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
i += 1;
|
|
229
232
|
}
|
|
230
233
|
return nodes;
|
|
231
234
|
};
|
|
@@ -239,15 +242,15 @@ var Supports = function () {
|
|
|
239
242
|
var _this = this;
|
|
240
243
|
|
|
241
244
|
return nodes.map(function (i) {
|
|
242
|
-
if ((typeof i === 'undefined' ? 'undefined' : _typeof(i))
|
|
243
|
-
if (i.length === 1 && _typeof(i[0]) === 'object') {
|
|
244
|
-
return _this.cleanBrackets(i[0]);
|
|
245
|
-
} else {
|
|
246
|
-
return _this.cleanBrackets(i);
|
|
247
|
-
}
|
|
248
|
-
} else {
|
|
245
|
+
if ((typeof i === 'undefined' ? 'undefined' : _typeof(i)) !== 'object') {
|
|
249
246
|
return i;
|
|
250
247
|
}
|
|
248
|
+
|
|
249
|
+
if (i.length === 1 && _typeof(i[0]) === 'object') {
|
|
250
|
+
return _this.cleanBrackets(i[0]);
|
|
251
|
+
}
|
|
252
|
+
|
|
253
|
+
return _this.cleanBrackets(i);
|
|
251
254
|
});
|
|
252
255
|
};
|
|
253
256
|
|
|
@@ -287,20 +290,20 @@ var Supports = function () {
|
|
|
287
290
|
Supports.prototype.normalize = function normalize(nodes) {
|
|
288
291
|
var _this2 = this;
|
|
289
292
|
|
|
290
|
-
if ((typeof nodes === 'undefined' ? 'undefined' : _typeof(nodes))
|
|
291
|
-
nodes = nodes.filter(function (i) {
|
|
292
|
-
return i !== '';
|
|
293
|
-
});
|
|
294
|
-
if (typeof nodes[0] === 'string' && nodes[0].indexOf(':') !== -1) {
|
|
295
|
-
return [brackets.stringify(nodes)];
|
|
296
|
-
} else {
|
|
297
|
-
return nodes.map(function (i) {
|
|
298
|
-
return _this2.normalize(i);
|
|
299
|
-
});
|
|
300
|
-
}
|
|
301
|
-
} else {
|
|
293
|
+
if ((typeof nodes === 'undefined' ? 'undefined' : _typeof(nodes)) !== 'object') {
|
|
302
294
|
return nodes;
|
|
303
295
|
}
|
|
296
|
+
|
|
297
|
+
nodes = nodes.filter(function (i) {
|
|
298
|
+
return i !== '';
|
|
299
|
+
});
|
|
300
|
+
if (typeof nodes[0] === 'string' && nodes[0].indexOf(':') !== -1) {
|
|
301
|
+
return [brackets.stringify(nodes)];
|
|
302
|
+
}
|
|
303
|
+
|
|
304
|
+
return nodes.map(function (i) {
|
|
305
|
+
return _this2.normalize(i);
|
|
306
|
+
});
|
|
304
307
|
};
|
|
305
308
|
|
|
306
309
|
/**
|
|
@@ -316,14 +319,16 @@ var Supports = function () {
|
|
|
316
319
|
var prefixed = _this3.prefixed(i[0]);
|
|
317
320
|
if (prefixed.length > 1) {
|
|
318
321
|
return _this3.convert(prefixed);
|
|
319
|
-
} else {
|
|
320
|
-
return i;
|
|
321
322
|
}
|
|
322
|
-
|
|
323
|
-
return _this3.add(i, all);
|
|
324
|
-
} else {
|
|
323
|
+
|
|
325
324
|
return i;
|
|
326
325
|
}
|
|
326
|
+
|
|
327
|
+
if ((typeof i === 'undefined' ? 'undefined' : _typeof(i)) === 'object') {
|
|
328
|
+
return _this3.add(i, all);
|
|
329
|
+
}
|
|
330
|
+
|
|
331
|
+
return i;
|
|
327
332
|
});
|
|
328
333
|
};
|
|
329
334
|
|
package/lib/transition.js
CHANGED
|
@@ -167,24 +167,26 @@ var Transition = function () {
|
|
|
167
167
|
|
|
168
168
|
|
|
169
169
|
Transition.prototype.checkForWarning = function checkForWarning(result, decl) {
|
|
170
|
-
if (decl.prop
|
|
171
|
-
|
|
172
|
-
if (i.type !== 'decl') {
|
|
173
|
-
return undefined;
|
|
174
|
-
}
|
|
175
|
-
if (i.prop.indexOf('transition-') !== 0) {
|
|
176
|
-
return undefined;
|
|
177
|
-
}
|
|
178
|
-
if (i.prop === 'transition-property') {
|
|
179
|
-
return undefined;
|
|
180
|
-
}
|
|
181
|
-
|
|
182
|
-
if (list.comma(i.value).length > 1) {
|
|
183
|
-
decl.warn(result, 'Replace transition-property to transition, ' + 'because Autoprefixer could not support ' + 'any cases of transition-property ' + 'and other transition-*');
|
|
184
|
-
}
|
|
185
|
-
return false;
|
|
186
|
-
});
|
|
170
|
+
if (decl.prop !== 'transition-property') {
|
|
171
|
+
return;
|
|
187
172
|
}
|
|
173
|
+
|
|
174
|
+
decl.parent.each(function (i) {
|
|
175
|
+
if (i.type !== 'decl') {
|
|
176
|
+
return undefined;
|
|
177
|
+
}
|
|
178
|
+
if (i.prop.indexOf('transition-') !== 0) {
|
|
179
|
+
return undefined;
|
|
180
|
+
}
|
|
181
|
+
if (i.prop === 'transition-property') {
|
|
182
|
+
return undefined;
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
if (list.comma(i.value).length > 1) {
|
|
186
|
+
decl.warn(result, 'Replace transition-property to transition, ' + 'because Autoprefixer could not support ' + 'any cases of transition-property ' + 'and other transition-*');
|
|
187
|
+
}
|
|
188
|
+
return false;
|
|
189
|
+
});
|
|
188
190
|
};
|
|
189
191
|
|
|
190
192
|
/**
|
|
@@ -220,9 +222,10 @@ var Transition = function () {
|
|
|
220
222
|
|
|
221
223
|
if (double || smaller) {
|
|
222
224
|
decl.remove();
|
|
223
|
-
|
|
224
|
-
decl.value = value;
|
|
225
|
+
return;
|
|
225
226
|
}
|
|
227
|
+
|
|
228
|
+
decl.value = value;
|
|
226
229
|
};
|
|
227
230
|
|
|
228
231
|
/**
|
|
@@ -431,7 +434,9 @@ var Transition = function () {
|
|
|
431
434
|
if (prop.indexOf('flex') !== -1 || other.indexOf(prop) !== -1) {
|
|
432
435
|
if (this.prefixes.options.flexbox === false) {
|
|
433
436
|
return true;
|
|
434
|
-
}
|
|
437
|
+
}
|
|
438
|
+
|
|
439
|
+
if (this.prefixes.options.flexbox === 'no-2009') {
|
|
435
440
|
return prefix.indexOf('2009') !== -1;
|
|
436
441
|
}
|
|
437
442
|
}
|
package/lib/utils.js
CHANGED
|
@@ -48,9 +48,9 @@ module.exports = {
|
|
|
48
48
|
removeNote: function removeNote(string) {
|
|
49
49
|
if (string.indexOf(' ') === -1) {
|
|
50
50
|
return string;
|
|
51
|
-
} else {
|
|
52
|
-
return string.split(' ')[0];
|
|
53
51
|
}
|
|
52
|
+
|
|
53
|
+
return string.split(' ')[0];
|
|
54
54
|
},
|
|
55
55
|
|
|
56
56
|
|
|
@@ -84,10 +84,10 @@ module.exports = {
|
|
|
84
84
|
|
|
85
85
|
if (origin === changed) {
|
|
86
86
|
return value;
|
|
87
|
-
} else {
|
|
88
|
-
var join = value.match(/,\s*/);
|
|
89
|
-
join = join ? join[0] : ', ';
|
|
90
|
-
return changed.join(join);
|
|
91
87
|
}
|
|
88
|
+
|
|
89
|
+
var join = value.match(/,\s*/);
|
|
90
|
+
join = join ? join[0] : ', ';
|
|
91
|
+
return changed.join(join);
|
|
92
92
|
}
|
|
93
93
|
};
|
package/lib/value.js
CHANGED
|
@@ -30,41 +30,56 @@ var Value = function (_Prefixer) {
|
|
|
30
30
|
var prop = decl.prop;
|
|
31
31
|
var result = [];
|
|
32
32
|
|
|
33
|
-
|
|
33
|
+
var _loop = function _loop(prefix) {
|
|
34
34
|
var value = decl._autoprefixerValues[prefix];
|
|
35
35
|
|
|
36
36
|
if (value === decl.value) {
|
|
37
|
-
continue;
|
|
37
|
+
return 'continue';
|
|
38
38
|
}
|
|
39
39
|
|
|
40
40
|
var item = void 0;
|
|
41
41
|
var propPrefix = vendor.prefix(prop);
|
|
42
42
|
|
|
43
|
+
if (propPrefix === '-pie-') {
|
|
44
|
+
return 'continue';
|
|
45
|
+
}
|
|
46
|
+
|
|
43
47
|
if (propPrefix === prefix) {
|
|
44
48
|
item = decl.value = value;
|
|
45
|
-
|
|
46
|
-
continue;
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
});
|
|
58
|
-
|
|
59
|
-
if (!already) {
|
|
60
|
-
var cloned = _this2.clone(decl, { value: value });
|
|
61
|
-
item = decl.parent.insertBefore(decl, cloned);
|
|
62
|
-
}
|
|
63
|
-
}
|
|
64
|
-
})();
|
|
49
|
+
result.push(item);
|
|
50
|
+
return 'continue';
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
var prefixed = prefixes.prefixed(prop, prefix);
|
|
54
|
+
var rule = decl.parent;
|
|
55
|
+
|
|
56
|
+
if (!rule.every(function (i) {
|
|
57
|
+
return i.prop !== prefixed;
|
|
58
|
+
})) {
|
|
59
|
+
result.push(item);
|
|
60
|
+
return 'continue';
|
|
65
61
|
}
|
|
66
62
|
|
|
63
|
+
var trimmed = value.replace(/\s+/, ' ');
|
|
64
|
+
var already = rule.some(function (i) {
|
|
65
|
+
return i.prop === decl.prop && i.value.replace(/\s+/, ' ') === trimmed;
|
|
66
|
+
});
|
|
67
|
+
|
|
68
|
+
if (already) {
|
|
69
|
+
result.push(item);
|
|
70
|
+
return 'continue';
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
var cloned = _this2.clone(decl, { value: value });
|
|
74
|
+
item = decl.parent.insertBefore(decl, cloned);
|
|
75
|
+
|
|
67
76
|
result.push(item);
|
|
77
|
+
};
|
|
78
|
+
|
|
79
|
+
for (var prefix in decl._autoprefixerValues) {
|
|
80
|
+
var _ret = _loop(prefix);
|
|
81
|
+
|
|
82
|
+
if (_ret === 'continue') continue;
|
|
68
83
|
}
|
|
69
84
|
|
|
70
85
|
return result;
|
|
@@ -77,11 +92,11 @@ var Value = function (_Prefixer) {
|
|
|
77
92
|
|
|
78
93
|
Value.prototype.check = function check(decl) {
|
|
79
94
|
var value = decl.value;
|
|
80
|
-
if (value.indexOf(this.name)
|
|
81
|
-
return !!value.match(this.regexp());
|
|
82
|
-
} else {
|
|
95
|
+
if (value.indexOf(this.name) === -1) {
|
|
83
96
|
return false;
|
|
84
97
|
}
|
|
98
|
+
|
|
99
|
+
return !!value.match(this.regexp());
|
|
85
100
|
};
|
|
86
101
|
|
|
87
102
|
/**
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "autoprefixer",
|
|
3
|
-
"version": "7.1.
|
|
3
|
+
"version": "7.1.6",
|
|
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,39 +13,38 @@
|
|
|
13
13
|
"license": "MIT",
|
|
14
14
|
"repository": "postcss/autoprefixer",
|
|
15
15
|
"dependencies": {
|
|
16
|
-
"browserslist": "^2.1
|
|
17
|
-
"caniuse-lite": "^1.0.
|
|
16
|
+
"browserslist": "^2.5.1",
|
|
17
|
+
"caniuse-lite": "^1.0.30000748",
|
|
18
18
|
"normalize-range": "^0.1.2",
|
|
19
19
|
"num2fraction": "^1.2.2",
|
|
20
|
-
"postcss": "^6.0.
|
|
20
|
+
"postcss": "^6.0.13",
|
|
21
21
|
"postcss-value-parser": "^3.2.3"
|
|
22
22
|
},
|
|
23
23
|
"devDependencies": {
|
|
24
|
-
"babel-eslint": "^
|
|
24
|
+
"babel-eslint": "^8.0.1",
|
|
25
25
|
"babel-plugin-transform-class-properties": "^6.24.1",
|
|
26
|
-
"babel-preset-env": "^1.6.
|
|
26
|
+
"babel-preset-env": "^1.6.1",
|
|
27
27
|
"babelify": "^7.3.0",
|
|
28
|
-
"browserify": "^14.
|
|
29
|
-
"eslint": "^4.
|
|
28
|
+
"browserify": "^14.5.0",
|
|
29
|
+
"eslint": "^4.9.0",
|
|
30
30
|
"eslint-config-postcss": "^2.0.2",
|
|
31
|
-
"fs-extra": "^
|
|
31
|
+
"fs-extra": "^4.0.2",
|
|
32
32
|
"gulp": "^3.9.1",
|
|
33
|
-
"gulp-babel": "^
|
|
33
|
+
"gulp-babel": "^7.0.0",
|
|
34
34
|
"gulp-coffee": "^2.3.4",
|
|
35
35
|
"gulp-json-editor": "^2.2.1",
|
|
36
36
|
"gulp-replace": "^0.6.1",
|
|
37
|
-
"jest": "^
|
|
38
|
-
"lint-staged": "^4.0
|
|
37
|
+
"jest": "^21.2.1",
|
|
38
|
+
"lint-staged": "^4.3.0",
|
|
39
39
|
"pre-commit": "^1.2.2",
|
|
40
|
-
"size-limit": "^0.
|
|
40
|
+
"size-limit": "^0.11.6",
|
|
41
41
|
"vinyl-source-stream": "^1.1.0",
|
|
42
|
-
"babel-register": "^6.
|
|
42
|
+
"babel-register": "^6.26.0"
|
|
43
43
|
},
|
|
44
44
|
"scripts": {
|
|
45
45
|
"lint-staged": "lint-staged",
|
|
46
46
|
"lint": "eslint *.js lib/*.js data/*.js test/*.js",
|
|
47
|
-
"
|
|
48
|
-
"test": "jest && npm run lint && gulp && npm run size"
|
|
47
|
+
"test": "jest && npm run lint && gulp && size-limit"
|
|
49
48
|
},
|
|
50
49
|
"lint-staged": {
|
|
51
50
|
"*.js": "eslint"
|
|
@@ -53,6 +52,10 @@
|
|
|
53
52
|
"pre-commit": [
|
|
54
53
|
"lint-staged"
|
|
55
54
|
],
|
|
55
|
+
"size-limit": [{
|
|
56
|
+
"path": "build/lib/autoprefixer.js",
|
|
57
|
+
"limit": "239 KB"
|
|
58
|
+
}],
|
|
56
59
|
"eslintConfig": {
|
|
57
60
|
"extends": "eslint-config-postcss",
|
|
58
61
|
"parser": "babel-eslint",
|