autoprefixer 9.7.0 → 9.7.4
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 +14 -0
- package/README.md +46 -7
- package/data/prefixes.js +13 -3
- package/lib/autoprefixer.js +1 -1
- package/lib/hacks/grid-template-areas.js +1 -1
- package/lib/hacks/grid-utils.js +1 -1
- package/lib/hacks/transform-decl.js +1 -1
- package/lib/hacks/user-select.js +38 -0
- package/lib/prefixes.js +19 -18
- package/lib/processor.js +18 -17
- package/lib/selector.js +1 -1
- package/lib/transition.js +29 -1
- package/lib/utils.js +1 -1
- package/package.json +9 -7
package/CHANGELOG.md
CHANGED
|
@@ -1,6 +1,20 @@
|
|
|
1
1
|
# Change Log
|
|
2
2
|
This project adheres to [Semantic Versioning](http://semver.org/).
|
|
3
3
|
|
|
4
|
+
## 9.7.4
|
|
5
|
+
* Fix warning text (by Dmitry Ishkov).
|
|
6
|
+
|
|
7
|
+
## 9.7.3
|
|
8
|
+
* Fix compatibility with PostCSS Modules.
|
|
9
|
+
|
|
10
|
+
## 9.7.2
|
|
11
|
+
* Add `-ms-user-select: element` support.
|
|
12
|
+
* Add funding link for `npm fund`.
|
|
13
|
+
|
|
14
|
+
## 9.7.1
|
|
15
|
+
* Avoid unnecessary transitions in prefixed selectors (by Andrey Alexandrov).
|
|
16
|
+
* Fix `fit-content` for Firefox.
|
|
17
|
+
|
|
4
18
|
## 9.7 “Ad Victoriam”
|
|
5
19
|
* Add `AUTOPREFIXER_GRID` env variable to enable Grid Layout polyfill for IE.
|
|
6
20
|
* Fix `Cannot read property 'grid' of undefined` error.
|
package/README.md
CHANGED
|
@@ -95,6 +95,8 @@ Twitter account for news and releases: [@autoprefixer].
|
|
|
95
95
|
- [Warnings](#warnings)
|
|
96
96
|
- [Disabling](#disabling)
|
|
97
97
|
- [Options](#options)
|
|
98
|
+
- [Environment variables](#environment-variables)
|
|
99
|
+
- [Using environment variables to support CSS Grid prefixes in Create React App](#using-environment-variables-to-support-css-grid-prefixes-in-create-react-app)
|
|
98
100
|
- [Grid Autoplacement support in IE](#grid-autoplacement-support-in-ie)
|
|
99
101
|
- [Debug](#debug)
|
|
100
102
|
|
|
@@ -309,7 +311,7 @@ module.exports = {
|
|
|
309
311
|
### CSS-in-JS
|
|
310
312
|
|
|
311
313
|
The best way to use PostCSS with CSS-in-JS is [`astroturf`].
|
|
312
|
-
Add
|
|
314
|
+
Add its loader to your `webpack.config.js`:
|
|
313
315
|
|
|
314
316
|
```js
|
|
315
317
|
module.exports = {
|
|
@@ -622,16 +624,53 @@ to increase performance.
|
|
|
622
624
|
* `no-autoplace`: enable Autoprefixer grid translations
|
|
623
625
|
but *exclude* autoplacement support.
|
|
624
626
|
|
|
625
|
-
Environment variables
|
|
626
|
-
|
|
627
|
+
Environment variables are useful, when you want to change Autoprefixer options but don't have access to config files.
|
|
628
|
+
[Create React App] is a good example of this.
|
|
627
629
|
|
|
628
|
-
|
|
630
|
+
[Create React App]: (https://reactjs.org/docs/create-a-new-react-app.html#create-react-app)
|
|
629
631
|
|
|
630
|
-
|
|
631
|
-
|
|
632
|
+
### Using environment variables to support CSS Grid prefixes in Create React App
|
|
633
|
+
|
|
634
|
+
1. Install the latest version of Autoprefixer and [cross-env](https://www.npmjs.com/package/cross-env):
|
|
635
|
+
|
|
636
|
+
```
|
|
637
|
+
npm install autoprefixer@latest cross-env --save-dev
|
|
638
|
+
```
|
|
639
|
+
|
|
640
|
+
2. Under `"browserslist"` > `"development"` in the package.json file, add `"last 1 ie version"`
|
|
641
|
+
|
|
642
|
+
```
|
|
643
|
+
"browserslist": {
|
|
644
|
+
"production": [
|
|
645
|
+
">0.2%",
|
|
646
|
+
"not dead",
|
|
647
|
+
"not op_mini all"
|
|
648
|
+
],
|
|
649
|
+
"development": [
|
|
650
|
+
"last 1 chrome version",
|
|
651
|
+
"last 1 firefox version",
|
|
652
|
+
"last 1 safari version",
|
|
653
|
+
"last 1 ie version"
|
|
654
|
+
]
|
|
655
|
+
}
|
|
656
|
+
```
|
|
657
|
+
|
|
658
|
+
3. Update `"scripts"` in the package.json file to the following:
|
|
659
|
+
|
|
660
|
+
```
|
|
661
|
+
"scripts": {
|
|
662
|
+
"start": "cross-env AUTOPREFIXER_GRID=autoplace react-scripts start",
|
|
663
|
+
"build": "cross-env AUTOPREFIXER_GRID=autoplace react-scripts build",
|
|
664
|
+
"test": "cross-env AUTOPREFIXER_GRID=autoplace react-scripts test",
|
|
665
|
+
"eject": "react-scripts eject"
|
|
666
|
+
},
|
|
632
667
|
```
|
|
633
668
|
|
|
634
|
-
|
|
669
|
+
Replace `autoplace` with `no-autoplace` in the above example if you prefer to disable Autoprefixer Grid autoplacement support.
|
|
670
|
+
|
|
671
|
+
Now when you run `npm start` you will see CSS Grid prefixes automatically being applied to your output CSS.
|
|
672
|
+
|
|
673
|
+
See also [Browserslist environment variables] for more examples on how to use environment variables in your project.
|
|
635
674
|
|
|
636
675
|
[Browserslist environment variables]: https://github.com/browserslist/browserslist#environment-variables
|
|
637
676
|
|
package/data/prefixes.js
CHANGED
|
@@ -374,9 +374,10 @@ f(require('caniuse-lite/data/features/css3-tabsize'), function (browsers) {
|
|
|
374
374
|
|
|
375
375
|
var intrinsic = require('caniuse-lite/data/features/intrinsic-width');
|
|
376
376
|
|
|
377
|
+
var sizeProps = ['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'];
|
|
377
378
|
f(intrinsic, function (browsers) {
|
|
378
|
-
return prefix(['max-content', 'min-content'
|
|
379
|
-
props:
|
|
379
|
+
return prefix(['max-content', 'min-content'], {
|
|
380
|
+
props: sizeProps,
|
|
380
381
|
feature: 'intrinsic-width',
|
|
381
382
|
browsers: browsers
|
|
382
383
|
});
|
|
@@ -385,7 +386,16 @@ f(intrinsic, {
|
|
|
385
386
|
match: /x|\s#4/
|
|
386
387
|
}, function (browsers) {
|
|
387
388
|
return prefix(['fill', 'fill-available', 'stretch'], {
|
|
388
|
-
props:
|
|
389
|
+
props: sizeProps,
|
|
390
|
+
feature: 'intrinsic-width',
|
|
391
|
+
browsers: browsers
|
|
392
|
+
});
|
|
393
|
+
});
|
|
394
|
+
f(intrinsic, {
|
|
395
|
+
match: /x|\s#5/
|
|
396
|
+
}, function (browsers) {
|
|
397
|
+
return prefix(['fit-content'], {
|
|
398
|
+
props: sizeProps,
|
|
389
399
|
feature: 'intrinsic-width',
|
|
390
400
|
browsers: browsers
|
|
391
401
|
});
|
package/lib/autoprefixer.js
CHANGED
|
@@ -16,7 +16,7 @@ var data = require('../data/prefixes');
|
|
|
16
16
|
|
|
17
17
|
var info = require('./info');
|
|
18
18
|
|
|
19
|
-
var WARNING = '\n' + ' Replace Autoprefixer `browsers` option to Browserslist config.\n' + ' Use `browserslist` key in `package.json` or `.browserslistrc` file.\n' + '\n' + ' Using `browsers` option cause
|
|
19
|
+
var WARNING = '\n' + ' Replace Autoprefixer `browsers` option to Browserslist config.\n' + ' Use `browserslist` key in `package.json` or `.browserslistrc` file.\n' + '\n' + ' Using `browsers` option can cause errors. Browserslist config \n' + ' can be used for Babel, Autoprefixer, postcss-normalize and other tools.\n' + '\n' + ' If you really need to use option, rename it to `overrideBrowserslist`.\n' + '\n' + ' Learn more at:\n' + ' https://github.com/browserslist/browserslist#readme\n' + ' https://twitter.com/browserslist\n' + '\n';
|
|
20
20
|
|
|
21
21
|
function isPlainObject(obj) {
|
|
22
22
|
return Object.prototype.toString.apply(obj) === '[object Object]';
|
|
@@ -18,7 +18,7 @@ var _require = require('./grid-utils'),
|
|
|
18
18
|
inheritGridGap = _require.inheritGridGap;
|
|
19
19
|
|
|
20
20
|
function getGridRows(tpl) {
|
|
21
|
-
return tpl.trim().slice(1, -1).split(/['
|
|
21
|
+
return tpl.trim().slice(1, -1).split(/["']\s*["']?/g);
|
|
22
22
|
}
|
|
23
23
|
|
|
24
24
|
var GridTemplateAreas =
|
package/lib/hacks/grid-utils.js
CHANGED
|
@@ -76,7 +76,7 @@ function (_Declaration) {
|
|
|
76
76
|
decl = _Declaration.prototype.set.call(this, decl, prefix);
|
|
77
77
|
|
|
78
78
|
if (prefix === '-ms-') {
|
|
79
|
-
decl.value = decl.value.replace(/
|
|
79
|
+
decl.value = decl.value.replace(/rotatez/gi, 'rotate');
|
|
80
80
|
}
|
|
81
81
|
|
|
82
82
|
return decl;
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
function _defaults(obj, defaults) { var keys = Object.getOwnPropertyNames(defaults); for (var i = 0; i < keys.length; i++) { var key = keys[i]; var value = Object.getOwnPropertyDescriptor(defaults, key); if (value && value.configurable && obj[key] === undefined) { Object.defineProperty(obj, key, value); } } return obj; }
|
|
4
|
+
|
|
5
|
+
function _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; _defaults(subClass, superClass); }
|
|
6
|
+
|
|
7
|
+
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
8
|
+
|
|
9
|
+
var Declaration = require('../declaration');
|
|
10
|
+
|
|
11
|
+
var UserSelect =
|
|
12
|
+
/*#__PURE__*/
|
|
13
|
+
function (_Declaration) {
|
|
14
|
+
_inheritsLoose(UserSelect, _Declaration);
|
|
15
|
+
|
|
16
|
+
function UserSelect() {
|
|
17
|
+
return _Declaration.apply(this, arguments) || this;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
var _proto = UserSelect.prototype;
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* Change prefixed value for IE
|
|
24
|
+
*/
|
|
25
|
+
_proto.set = function set(decl, prefix) {
|
|
26
|
+
if (prefix === '-ms-' && decl.value === 'contain') {
|
|
27
|
+
decl.value = 'element';
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
return _Declaration.prototype.set.call(this, decl, prefix);
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
return UserSelect;
|
|
34
|
+
}(Declaration);
|
|
35
|
+
|
|
36
|
+
_defineProperty(UserSelect, "names", ['user-select']);
|
|
37
|
+
|
|
38
|
+
module.exports = UserSelect;
|
package/lib/prefixes.js
CHANGED
|
@@ -41,6 +41,7 @@ Declaration.hack(require('./hacks/flex-basis'));
|
|
|
41
41
|
Declaration.hack(require('./hacks/mask-border'));
|
|
42
42
|
Declaration.hack(require('./hacks/mask-composite'));
|
|
43
43
|
Declaration.hack(require('./hacks/align-items'));
|
|
44
|
+
Declaration.hack(require('./hacks/user-select'));
|
|
44
45
|
Declaration.hack(require('./hacks/flex-shrink'));
|
|
45
46
|
Declaration.hack(require('./hacks/break-props'));
|
|
46
47
|
Declaration.hack(require('./hacks/color-adjust'));
|
|
@@ -97,8 +98,8 @@ function () {
|
|
|
97
98
|
this.processor = new Processor(this);
|
|
98
99
|
}
|
|
99
100
|
/**
|
|
100
|
-
|
|
101
|
-
|
|
101
|
+
* Return clone instance to remove all prefixes
|
|
102
|
+
*/
|
|
102
103
|
|
|
103
104
|
|
|
104
105
|
var _proto = Prefixes.prototype;
|
|
@@ -118,8 +119,8 @@ function () {
|
|
|
118
119
|
return this.cleanerCache;
|
|
119
120
|
}
|
|
120
121
|
/**
|
|
121
|
-
|
|
122
|
-
|
|
122
|
+
* Select prefixes from data, which is necessary for selected browsers
|
|
123
|
+
*/
|
|
123
124
|
;
|
|
124
125
|
|
|
125
126
|
_proto.select = function select(list) {
|
|
@@ -195,8 +196,8 @@ function () {
|
|
|
195
196
|
return selected;
|
|
196
197
|
}
|
|
197
198
|
/**
|
|
198
|
-
|
|
199
|
-
|
|
199
|
+
* Sort vendor prefixes
|
|
200
|
+
*/
|
|
200
201
|
;
|
|
201
202
|
|
|
202
203
|
_proto.sort = function sort(prefixes) {
|
|
@@ -212,8 +213,8 @@ function () {
|
|
|
212
213
|
});
|
|
213
214
|
}
|
|
214
215
|
/**
|
|
215
|
-
|
|
216
|
-
|
|
216
|
+
* Cache prefixes data to fast CSS processing
|
|
217
|
+
*/
|
|
217
218
|
;
|
|
218
219
|
|
|
219
220
|
_proto.preprocess = function preprocess(selected) {
|
|
@@ -435,8 +436,8 @@ function () {
|
|
|
435
436
|
}
|
|
436
437
|
}
|
|
437
438
|
/**
|
|
438
|
-
|
|
439
|
-
|
|
439
|
+
* Return unprefixed version of property
|
|
440
|
+
*/
|
|
440
441
|
;
|
|
441
442
|
|
|
442
443
|
_proto.unprefixed = function unprefixed(prop) {
|
|
@@ -449,16 +450,16 @@ function () {
|
|
|
449
450
|
return value;
|
|
450
451
|
}
|
|
451
452
|
/**
|
|
452
|
-
|
|
453
|
-
|
|
453
|
+
* Normalize prefix for remover
|
|
454
|
+
*/
|
|
454
455
|
;
|
|
455
456
|
|
|
456
457
|
_proto.normalize = function normalize(prop) {
|
|
457
458
|
return this.decl(prop).normalize(prop);
|
|
458
459
|
}
|
|
459
460
|
/**
|
|
460
|
-
|
|
461
|
-
|
|
461
|
+
* Return prefixed version of property
|
|
462
|
+
*/
|
|
462
463
|
;
|
|
463
464
|
|
|
464
465
|
_proto.prefixed = function prefixed(prop, prefix) {
|
|
@@ -466,8 +467,8 @@ function () {
|
|
|
466
467
|
return this.decl(prop).prefixed(prop, prefix);
|
|
467
468
|
}
|
|
468
469
|
/**
|
|
469
|
-
|
|
470
|
-
|
|
470
|
+
* Return values, which must be prefixed in selected property
|
|
471
|
+
*/
|
|
471
472
|
;
|
|
472
473
|
|
|
473
474
|
_proto.values = function values(type, prop) {
|
|
@@ -482,8 +483,8 @@ function () {
|
|
|
482
483
|
}
|
|
483
484
|
}
|
|
484
485
|
/**
|
|
485
|
-
|
|
486
|
-
|
|
486
|
+
* Group declaration by unprefixed property to check them
|
|
487
|
+
*/
|
|
487
488
|
;
|
|
488
489
|
|
|
489
490
|
_proto.group = function group(decl) {
|
package/lib/processor.js
CHANGED
|
@@ -360,20 +360,24 @@ function () {
|
|
|
360
360
|
|
|
361
361
|
var unprefixed = _this.prefixes.unprefixed(decl.prop);
|
|
362
362
|
|
|
363
|
-
|
|
364
|
-
var _ref3;
|
|
363
|
+
var list = _this.prefixes.values('add', unprefixed);
|
|
365
364
|
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
_ref3
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
365
|
+
if (Array.isArray(list)) {
|
|
366
|
+
for (var _iterator3 = list, _isArray3 = Array.isArray(_iterator3), _i3 = 0, _iterator3 = _isArray3 ? _iterator3 : _iterator3[Symbol.iterator]();;) {
|
|
367
|
+
var _ref3;
|
|
368
|
+
|
|
369
|
+
if (_isArray3) {
|
|
370
|
+
if (_i3 >= _iterator3.length) break;
|
|
371
|
+
_ref3 = _iterator3[_i3++];
|
|
372
|
+
} else {
|
|
373
|
+
_i3 = _iterator3.next();
|
|
374
|
+
if (_i3.done) break;
|
|
375
|
+
_ref3 = _i3.value;
|
|
376
|
+
}
|
|
374
377
|
|
|
375
|
-
|
|
376
|
-
|
|
378
|
+
var value = _ref3;
|
|
379
|
+
if (value.process) value.process(decl, result);
|
|
380
|
+
}
|
|
377
381
|
}
|
|
378
382
|
|
|
379
383
|
Value.save(_this.prefixes, decl);
|
|
@@ -482,11 +486,8 @@ function () {
|
|
|
482
486
|
}
|
|
483
487
|
|
|
484
488
|
var checker = _ref5;
|
|
485
|
-
|
|
486
|
-
if (!checker.check(decl.value))
|
|
487
|
-
continue;
|
|
488
|
-
}
|
|
489
|
-
|
|
489
|
+
if (!checker.check) continue;
|
|
490
|
+
if (!checker.check(decl.value)) continue;
|
|
490
491
|
unprefixed = checker.unprefixed;
|
|
491
492
|
|
|
492
493
|
var _notHack = _this2.prefixes.group(decl).down(function (other) {
|
package/lib/selector.js
CHANGED
package/lib/transition.js
CHANGED
|
@@ -8,6 +8,8 @@ var vendor = require('postcss').vendor;
|
|
|
8
8
|
|
|
9
9
|
var list = require('postcss').list;
|
|
10
10
|
|
|
11
|
+
var Browsers = require('./browsers');
|
|
12
|
+
|
|
11
13
|
var Transition =
|
|
12
14
|
/*#__PURE__*/
|
|
13
15
|
function () {
|
|
@@ -28,7 +30,8 @@ function () {
|
|
|
28
30
|
|
|
29
31
|
var prefix, prop;
|
|
30
32
|
var add = this.prefixes.add[decl.prop];
|
|
31
|
-
var
|
|
33
|
+
var vendorPrefixes = this.ruleVendorPrefixes(decl);
|
|
34
|
+
var declPrefixes = vendorPrefixes || add && add.prefixes || [];
|
|
32
35
|
var params = this.parse(decl.value);
|
|
33
36
|
var names = params.map(function (i) {
|
|
34
37
|
return _this.findProp(i);
|
|
@@ -69,6 +72,12 @@ function () {
|
|
|
69
72
|
prefix = _i3.value;
|
|
70
73
|
}
|
|
71
74
|
|
|
75
|
+
if (vendorPrefixes && !vendorPrefixes.some(function (p) {
|
|
76
|
+
return prefix.includes(p);
|
|
77
|
+
})) {
|
|
78
|
+
continue;
|
|
79
|
+
}
|
|
80
|
+
|
|
72
81
|
var prefixed = this.prefixes.prefixed(prop, prefix);
|
|
73
82
|
|
|
74
83
|
if (prefixed !== '-ms-transform' && !names.includes(prefixed)) {
|
|
@@ -473,6 +482,25 @@ function () {
|
|
|
473
482
|
}
|
|
474
483
|
|
|
475
484
|
return undefined;
|
|
485
|
+
}
|
|
486
|
+
/**
|
|
487
|
+
* Check if transition prop is inside vendor specific rule
|
|
488
|
+
*/
|
|
489
|
+
;
|
|
490
|
+
|
|
491
|
+
_proto.ruleVendorPrefixes = function ruleVendorPrefixes(decl) {
|
|
492
|
+
var parent = decl.parent;
|
|
493
|
+
|
|
494
|
+
if (parent.type !== 'rule') {
|
|
495
|
+
return false;
|
|
496
|
+
} else if (!parent.selector.includes(':-')) {
|
|
497
|
+
return false;
|
|
498
|
+
}
|
|
499
|
+
|
|
500
|
+
var selectors = Browsers.prefixes().filter(function (s) {
|
|
501
|
+
return parent.selector.includes(':' + s);
|
|
502
|
+
});
|
|
503
|
+
return selectors.length > 0 ? selectors : false;
|
|
476
504
|
};
|
|
477
505
|
|
|
478
506
|
return Transition;
|
package/lib/utils.js
CHANGED
package/package.json
CHANGED
|
@@ -1,8 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "autoprefixer",
|
|
3
|
-
"version": "9.7.
|
|
3
|
+
"version": "9.7.4",
|
|
4
4
|
"description": "Parse CSS and add vendor prefixes to CSS rules using values from the Can I Use website",
|
|
5
5
|
"keywords": ["autoprefixer", "css", "prefix", "postcss", "postcss-plugin"],
|
|
6
|
+
"bin": "./bin/autoprefixer",
|
|
7
|
+
"funding": {
|
|
8
|
+
"type": "tidelift",
|
|
9
|
+
"url": "https://tidelift.com/funding/github/npm/autoprefixer"
|
|
10
|
+
},
|
|
6
11
|
"author": "Andrey Sitnik <andrey@sitnik.ru>",
|
|
7
12
|
"license": "MIT",
|
|
8
13
|
"repository": "postcss/autoprefixer",
|
|
@@ -10,17 +15,14 @@
|
|
|
10
15
|
"node": ">=6.0.0"
|
|
11
16
|
},
|
|
12
17
|
"dependencies": {
|
|
13
|
-
"browserslist": "^4.
|
|
14
|
-
"caniuse-lite": "^1.0.
|
|
18
|
+
"browserslist": "^4.8.3",
|
|
19
|
+
"caniuse-lite": "^1.0.30001020",
|
|
15
20
|
"chalk": "^2.4.2",
|
|
16
21
|
"normalize-range": "^0.1.2",
|
|
17
22
|
"num2fraction": "^1.2.2",
|
|
18
|
-
"postcss": "^7.0.
|
|
23
|
+
"postcss": "^7.0.26",
|
|
19
24
|
"postcss-value-parser": "^4.0.2"
|
|
20
25
|
},
|
|
21
|
-
"bin": {
|
|
22
|
-
"autoprefixer": "./bin/autoprefixer"
|
|
23
|
-
},
|
|
24
26
|
"eslintIgnore": ["build/"],
|
|
25
27
|
"browser": {
|
|
26
28
|
"chalk": false
|