autoprefixer 9.6.2 → 9.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +13 -0
- package/README.md +46 -15
- package/lib/autoprefixer.js +0 -4
- package/lib/hacks/align-self.js +2 -2
- package/lib/hacks/background-size.js +1 -1
- package/lib/hacks/block-logical.js +2 -2
- package/lib/hacks/break-props.js +2 -2
- package/lib/hacks/filter.js +1 -1
- package/lib/hacks/flex-direction.js +2 -2
- package/lib/hacks/flex-flow.js +2 -2
- package/lib/hacks/gradient.js +5 -5
- package/lib/hacks/grid-column-align.js +1 -1
- package/lib/hacks/grid-row-align.js +1 -1
- package/lib/hacks/grid-rows-columns.js +5 -3
- package/lib/hacks/grid-start.js +1 -1
- package/lib/hacks/grid-utils.js +3 -3
- package/lib/hacks/intrinsic.js +1 -1
- package/lib/hacks/text-decoration.js +1 -1
- package/lib/hacks/transform-decl.js +1 -1
- package/lib/processor.js +16 -7
- package/lib/selector.js +56 -16
- package/package.json +5 -4
package/CHANGELOG.md
CHANGED
|
@@ -1,6 +1,19 @@
|
|
|
1
1
|
# Change Log
|
|
2
2
|
This project adheres to [Semantic Versioning](http://semver.org/).
|
|
3
3
|
|
|
4
|
+
## 9.7 “Ad Victoriam”
|
|
5
|
+
* Add `AUTOPREFIXER_GRID` env variable to enable Grid Layout polyfill for IE.
|
|
6
|
+
* Fix `Cannot read property 'grid' of undefined` error.
|
|
7
|
+
|
|
8
|
+
## 9.6.5
|
|
9
|
+
* Fix selector prefixing (by Andrey Alexandrov).
|
|
10
|
+
|
|
11
|
+
## 9.6.4
|
|
12
|
+
* Now the real fix for `'startsWith' of undefined` error.
|
|
13
|
+
|
|
14
|
+
## 9.6.3
|
|
15
|
+
* Fix `Cannot read property 'startsWith' of undefined` error.
|
|
16
|
+
|
|
4
17
|
## 9.6.2
|
|
5
18
|
* Fix false `Replace fill to stretch` warning.
|
|
6
19
|
|
package/README.md
CHANGED
|
@@ -113,10 +113,10 @@ that the config can be shared with other tools such as [babel-preset-env] and
|
|
|
113
113
|
|
|
114
114
|
See [Browserslist docs] for queries, browser names, config format, and defaults.
|
|
115
115
|
|
|
116
|
-
[Browserslist docs]: https://github.com/
|
|
116
|
+
[Browserslist docs]: https://github.com/browserslist/browserslist#queries
|
|
117
117
|
[babel-preset-env]: https://github.com/babel/babel/tree/master/packages/babel-preset-env
|
|
118
118
|
[Best Practices]: https://github.com/browserslist/browserslist#best-practices
|
|
119
|
-
[Browserslist]: https://github.com/
|
|
119
|
+
[Browserslist]: https://github.com/browserslist/browserslist
|
|
120
120
|
[Stylelint]: https://stylelint.io/
|
|
121
121
|
|
|
122
122
|
|
|
@@ -130,6 +130,8 @@ This is why it is disabled by default.
|
|
|
130
130
|
|
|
131
131
|
First, you need to enable Grid prefixes by using either the `grid: "autoplace"`
|
|
132
132
|
option or the `/* autoprefixer grid: autoplace */` control comment.
|
|
133
|
+
Also you can use environment variable to enable Grid:
|
|
134
|
+
`AUTOPREFIXER_GRID=autoplace npm build`.
|
|
133
135
|
|
|
134
136
|
Second, you need to test every fix with Grid in IE. It is not an enable and
|
|
135
137
|
forget feature, but it is still very useful.
|
|
@@ -582,7 +584,7 @@ Available options are:
|
|
|
582
584
|
* `flexbox` (boolean|string): should Autoprefixer add prefixes for flexbox
|
|
583
585
|
properties. With `"no-2009"` value Autoprefixer will add prefixes only
|
|
584
586
|
for final and IE 10 versions of specification. Default is `true`.
|
|
585
|
-
* `grid` (false
|
|
587
|
+
* `grid` (false|`"autoplace"`|`"no-autoplace"`): should Autoprefixer
|
|
586
588
|
add IE 10-11 prefixes for Grid Layout properties?
|
|
587
589
|
* `false` (default): prevent Autoprefixer from outputting
|
|
588
590
|
CSS Grid translations.
|
|
@@ -608,16 +610,45 @@ Plugin object has `info()` method for debugging purpose.
|
|
|
608
610
|
You can use PostCSS processor to process several CSS files
|
|
609
611
|
to increase performance.
|
|
610
612
|
|
|
611
|
-
[usage statistics]: https://github.com/
|
|
613
|
+
[usage statistics]: https://github.com/browserslist/browserslist#custom-usage-data
|
|
612
614
|
[PostCSS API]: http://api.postcss.org
|
|
613
615
|
|
|
616
|
+
## Environment Variables
|
|
617
|
+
|
|
618
|
+
* `AUTOPREFIXER_GRID`: (`autoplace`|`no-autoplace`) should Autoprefixer
|
|
619
|
+
add IE 10-11 prefixes for Grid Layout properties?
|
|
620
|
+
* `autoplace`: enable Autoprefixer grid translations
|
|
621
|
+
and *include* autoplacement support.
|
|
622
|
+
* `no-autoplace`: enable Autoprefixer grid translations
|
|
623
|
+
but *exclude* autoplacement support.
|
|
624
|
+
|
|
625
|
+
Environment variables is useful, when you can change Autoprefixer options.
|
|
626
|
+
For instance, in Create React App.
|
|
627
|
+
|
|
628
|
+
Add variable before CLI command, which will build your CSS:
|
|
629
|
+
|
|
630
|
+
```sh
|
|
631
|
+
AUTOPREFIXER_GRID=autoplace npm build
|
|
632
|
+
```
|
|
633
|
+
|
|
634
|
+
See also [Browserslist environment variables].
|
|
635
|
+
|
|
636
|
+
[Browserslist environment variables]: https://github.com/browserslist/browserslist#environment-variables
|
|
637
|
+
|
|
614
638
|
## Grid Autoplacement support in IE
|
|
615
639
|
|
|
616
|
-
If the `grid` option is set to `"autoplace"`, limited autoplacement support is added to Autoprefixers grid translations. You can also use
|
|
640
|
+
If the `grid` option is set to `"autoplace"`, limited autoplacement support is added to Autoprefixers grid translations. You can also use
|
|
641
|
+
the `/* autoprefixer grid: autoplace */` control comment or
|
|
642
|
+
`AUTOPREFIXER_GRID=autoplace npm build` environment variable.
|
|
617
643
|
|
|
618
|
-
Autoprefixer will only autoplace grid cells if both `grid-template-rows`
|
|
644
|
+
Autoprefixer will only autoplace grid cells if both `grid-template-rows`
|
|
645
|
+
and `grid-template-columns` has been set. If `grid-template`
|
|
646
|
+
or `grid-template-areas` has been set, Autoprefixer will use area based
|
|
647
|
+
cell placement instead.
|
|
619
648
|
|
|
620
|
-
Autoprefixer supports autoplacement by using `nth-child` CSS selectors.
|
|
649
|
+
Autoprefixer supports autoplacement by using `nth-child` CSS selectors.
|
|
650
|
+
It creates [number of columns] x [number of rows] `nth-child` selectors.
|
|
651
|
+
For this reason Autoplacement is only supported within the explicit grid.
|
|
621
652
|
|
|
622
653
|
```css
|
|
623
654
|
/* Input CSS */
|
|
@@ -734,9 +765,10 @@ grid-declaration rule:
|
|
|
734
765
|
}
|
|
735
766
|
```
|
|
736
767
|
|
|
737
|
-
The absolute best way to integrate autoplacement into already existing projects
|
|
738
|
-
to leave autoplacement turned off by default and then use a control
|
|
739
|
-
when needed. This method is far less likely to cause
|
|
768
|
+
The absolute best way to integrate autoplacement into already existing projects
|
|
769
|
+
though is to leave autoplacement turned off by default and then use a control
|
|
770
|
+
comment to enable it when needed. This method is far less likely to cause
|
|
771
|
+
something on the site to break.
|
|
740
772
|
|
|
741
773
|
```css
|
|
742
774
|
/* Disable autoplacement by default in old projects */
|
|
@@ -763,10 +795,10 @@ when needed. This method is far less likely to cause something on the site to br
|
|
|
763
795
|
```
|
|
764
796
|
|
|
765
797
|
Note that the `grid: "no-autoplace"` setting and the
|
|
766
|
-
`/* autoprefixer grid: no-autoplace */` control comment share identical
|
|
767
|
-
to the `grid: true` setting and the `/* autoprefixer grid: on */`
|
|
768
|
-
There is no need to refactor old code to use `no-autoplace`
|
|
769
|
-
`true` and `on` statements.
|
|
798
|
+
`/* autoprefixer grid: no-autoplace */` control comment share identical
|
|
799
|
+
functionality to the `grid: true` setting and the `/* autoprefixer grid: on */`
|
|
800
|
+
control comment. There is no need to refactor old code to use `no-autoplace`
|
|
801
|
+
in place of the old `true` and `on` statements.
|
|
770
802
|
|
|
771
803
|
### Autoplacement limitations
|
|
772
804
|
|
|
@@ -1020,7 +1052,6 @@ JS API is also available:
|
|
|
1020
1052
|
console.log(autoprefixer().info())
|
|
1021
1053
|
```
|
|
1022
1054
|
|
|
1023
|
-
|
|
1024
1055
|
## Security Contact
|
|
1025
1056
|
|
|
1026
1057
|
To report a security vulnerability, please use the [Tidelift security contact].
|
package/lib/autoprefixer.js
CHANGED
|
@@ -87,10 +87,6 @@ module.exports = postcss.plugin('autoprefixer', function () {
|
|
|
87
87
|
reqs = options.browsers;
|
|
88
88
|
}
|
|
89
89
|
|
|
90
|
-
if (typeof options.grid === 'undefined') {
|
|
91
|
-
options.grid = false;
|
|
92
|
-
}
|
|
93
|
-
|
|
94
90
|
var brwlstOpts = {
|
|
95
91
|
ignoreUnknownVersions: options.ignoreUnknownVersions,
|
|
96
92
|
stats: options.stats
|
package/lib/hacks/align-self.js
CHANGED
|
@@ -22,8 +22,8 @@ function (_Declaration) {
|
|
|
22
22
|
var _proto = AlignSelf.prototype;
|
|
23
23
|
|
|
24
24
|
_proto.check = function check(decl) {
|
|
25
|
-
return decl.parent && decl.parent.
|
|
26
|
-
return
|
|
25
|
+
return decl.parent && !decl.parent.some(function (i) {
|
|
26
|
+
return i.prop && i.prop.startsWith('grid-');
|
|
27
27
|
});
|
|
28
28
|
}
|
|
29
29
|
/**
|
|
@@ -25,7 +25,7 @@ function (_Declaration) {
|
|
|
25
25
|
_proto.set = function set(decl, prefix) {
|
|
26
26
|
var value = decl.value.toLowerCase();
|
|
27
27
|
|
|
28
|
-
if (prefix === '-webkit-' && value.
|
|
28
|
+
if (prefix === '-webkit-' && !value.includes(' ') && value !== 'contain' && value !== 'cover') {
|
|
29
29
|
decl.value = decl.value + ' ' + decl.value;
|
|
30
30
|
}
|
|
31
31
|
|
|
@@ -23,7 +23,7 @@ function (_Declaration) {
|
|
|
23
23
|
* Use old syntax for -moz- and -webkit-
|
|
24
24
|
*/
|
|
25
25
|
_proto.prefixed = function prefixed(prop, prefix) {
|
|
26
|
-
if (prop.
|
|
26
|
+
if (prop.includes('-start')) {
|
|
27
27
|
return prefix + prop.replace('-block-start', '-before');
|
|
28
28
|
}
|
|
29
29
|
|
|
@@ -35,7 +35,7 @@ function (_Declaration) {
|
|
|
35
35
|
;
|
|
36
36
|
|
|
37
37
|
_proto.normalize = function normalize(prop) {
|
|
38
|
-
if (prop.
|
|
38
|
+
if (prop.includes('-before')) {
|
|
39
39
|
return prop.replace('-before', '-block-start');
|
|
40
40
|
}
|
|
41
41
|
|
package/lib/hacks/break-props.js
CHANGED
|
@@ -31,11 +31,11 @@ function (_Declaration) {
|
|
|
31
31
|
;
|
|
32
32
|
|
|
33
33
|
_proto.normalize = function normalize(prop) {
|
|
34
|
-
if (prop.
|
|
34
|
+
if (prop.includes('inside')) {
|
|
35
35
|
return 'break-inside';
|
|
36
36
|
}
|
|
37
37
|
|
|
38
|
-
if (prop.
|
|
38
|
+
if (prop.includes('before')) {
|
|
39
39
|
return 'break-before';
|
|
40
40
|
}
|
|
41
41
|
|
package/lib/hacks/filter.js
CHANGED
|
@@ -24,7 +24,7 @@ function (_Declaration) {
|
|
|
24
24
|
*/
|
|
25
25
|
_proto.check = function check(decl) {
|
|
26
26
|
var v = decl.value;
|
|
27
|
-
return v.toLowerCase().
|
|
27
|
+
return !v.toLowerCase().includes('alpha(') && !v.includes('DXImageTransform.Microsoft') && !v.includes('data:image/svg+xml');
|
|
28
28
|
};
|
|
29
29
|
|
|
30
30
|
return Filter;
|
|
@@ -59,8 +59,8 @@ function (_Declaration) {
|
|
|
59
59
|
orient = v;
|
|
60
60
|
dir = v;
|
|
61
61
|
} else {
|
|
62
|
-
orient = v.
|
|
63
|
-
dir = v.
|
|
62
|
+
orient = v.includes('row') ? 'horizontal' : 'vertical';
|
|
63
|
+
dir = v.includes('reverse') ? 'reverse' : 'normal';
|
|
64
64
|
}
|
|
65
65
|
|
|
66
66
|
var cloned = this.clone(decl);
|
package/lib/hacks/flex-flow.js
CHANGED
|
@@ -53,8 +53,8 @@ function (_Declaration) {
|
|
|
53
53
|
}
|
|
54
54
|
|
|
55
55
|
var value = values[0];
|
|
56
|
-
var orient = value.
|
|
57
|
-
var dir = value.
|
|
56
|
+
var orient = value.includes('row') ? 'horizontal' : 'vertical';
|
|
57
|
+
var dir = value.includes('reverse') ? 'reverse' : 'normal';
|
|
58
58
|
var cloned = this.clone(decl);
|
|
59
59
|
cloned.prop = prefix + 'box-orient';
|
|
60
60
|
cloned.value = orient;
|
package/lib/hacks/gradient.js
CHANGED
|
@@ -149,7 +149,7 @@ function (_Value) {
|
|
|
149
149
|
nodes[0].value = this.normalizeUnit(nodes[0].value, 2 * Math.PI);
|
|
150
150
|
} else if (/-?\d+(.\d+)?turn/.test(nodes[0].value)) {
|
|
151
151
|
nodes[0].value = this.normalizeUnit(nodes[0].value, 1);
|
|
152
|
-
} else if (nodes[0].value.
|
|
152
|
+
} else if (nodes[0].value.includes('deg')) {
|
|
153
153
|
var num = parseFloat(nodes[0].value);
|
|
154
154
|
num = range.wrap(0, 360, num);
|
|
155
155
|
nodes[0].value = num + "deg";
|
|
@@ -249,7 +249,7 @@ function (_Value) {
|
|
|
249
249
|
if (params.length > 0) {
|
|
250
250
|
if (params[0].value === 'to') {
|
|
251
251
|
this.fixDirection(params);
|
|
252
|
-
} else if (params[0].value.
|
|
252
|
+
} else if (params[0].value.includes('deg')) {
|
|
253
253
|
this.fixAngle(params);
|
|
254
254
|
} else if (this.isRadial(params)) {
|
|
255
255
|
this.fixRadial(params);
|
|
@@ -362,11 +362,11 @@ function (_Value) {
|
|
|
362
362
|
return false;
|
|
363
363
|
}
|
|
364
364
|
|
|
365
|
-
if (nodes[0] && nodes[0].value.
|
|
365
|
+
if (nodes[0] && nodes[0].value.includes('deg')) {
|
|
366
366
|
return false;
|
|
367
367
|
}
|
|
368
368
|
|
|
369
|
-
if (string.
|
|
369
|
+
if (string.includes('px') || string.includes('-corner') || string.includes('-side')) {
|
|
370
370
|
return false;
|
|
371
371
|
}
|
|
372
372
|
|
|
@@ -558,7 +558,7 @@ function (_Value) {
|
|
|
558
558
|
_proto.add = function add(decl, prefix) {
|
|
559
559
|
var p = decl.prop;
|
|
560
560
|
|
|
561
|
-
if (p.
|
|
561
|
+
if (p.includes('mask')) {
|
|
562
562
|
if (prefix === '-webkit-' || prefix === '-webkit- old') {
|
|
563
563
|
return _Value.prototype.add.call(this, decl, prefix);
|
|
564
564
|
}
|
|
@@ -23,7 +23,7 @@ function (_Declaration) {
|
|
|
23
23
|
* Do not prefix flexbox values
|
|
24
24
|
*/
|
|
25
25
|
_proto.check = function check(decl) {
|
|
26
|
-
return decl.value.
|
|
26
|
+
return !decl.value.includes('flex-') && decl.value !== 'baseline';
|
|
27
27
|
}
|
|
28
28
|
/**
|
|
29
29
|
* Change property name for IE
|
|
@@ -23,7 +23,7 @@ function (_Declaration) {
|
|
|
23
23
|
* Do not prefix flexbox values
|
|
24
24
|
*/
|
|
25
25
|
_proto.check = function check(decl) {
|
|
26
|
-
return decl.value.
|
|
26
|
+
return !decl.value.includes('flex-') && decl.value !== 'baseline';
|
|
27
27
|
}
|
|
28
28
|
/**
|
|
29
29
|
* Change property name for IE
|
|
@@ -68,7 +68,9 @@ function (_Declaration) {
|
|
|
68
68
|
return false;
|
|
69
69
|
}
|
|
70
70
|
|
|
71
|
-
var processor = new Processor({
|
|
71
|
+
var processor = new Processor({
|
|
72
|
+
options: {}
|
|
73
|
+
});
|
|
72
74
|
var status = processor.gridStatus(parent, result);
|
|
73
75
|
var gap = getGridGap(decl);
|
|
74
76
|
gap = inheritGridGap(decl, gap) || gap;
|
|
@@ -113,7 +115,7 @@ function (_Declaration) {
|
|
|
113
115
|
if (!rowDecl && hasGridTemplate) {
|
|
114
116
|
return undefined;
|
|
115
117
|
} else if (!rowDecl && !hasGridTemplate) {
|
|
116
|
-
decl.warn(result,
|
|
118
|
+
decl.warn(result, 'Autoplacement does not work without grid-template-rows property');
|
|
117
119
|
return undefined;
|
|
118
120
|
}
|
|
119
121
|
/**
|
|
@@ -126,7 +128,7 @@ function (_Declaration) {
|
|
|
126
128
|
});
|
|
127
129
|
|
|
128
130
|
if (!columnDecl && !hasGridTemplate) {
|
|
129
|
-
decl.warn(result,
|
|
131
|
+
decl.warn(result, 'Autoplacement does not work without grid-template-columns property');
|
|
130
132
|
}
|
|
131
133
|
/**
|
|
132
134
|
* Autoplace grid items
|
package/lib/hacks/grid-start.js
CHANGED
|
@@ -24,7 +24,7 @@ function (_Declaration) {
|
|
|
24
24
|
*/
|
|
25
25
|
_proto.check = function check(decl) {
|
|
26
26
|
var value = decl.value;
|
|
27
|
-
return value.
|
|
27
|
+
return !value.includes('/') || value.includes('span');
|
|
28
28
|
}
|
|
29
29
|
/**
|
|
30
30
|
* Return a final spec property
|
package/lib/hacks/grid-utils.js
CHANGED
|
@@ -783,7 +783,7 @@ function warnTemplateSelectorNotFound(decl, result) {
|
|
|
783
783
|
}); // warn user if we didn't find template
|
|
784
784
|
|
|
785
785
|
if (!gridTemplateFound && duplicatesFound) {
|
|
786
|
-
decl.warn(result,
|
|
786
|
+
decl.warn(result, 'Autoprefixer cannot find a grid-template ' + ("containing the duplicate grid-area \"" + decl.value + "\" ") + ("with full selector matching: " + slicedSelectorArr.join(' ')));
|
|
787
787
|
}
|
|
788
788
|
}
|
|
789
789
|
}
|
|
@@ -800,14 +800,14 @@ function warnIfGridRowColumnExists(decl, result) {
|
|
|
800
800
|
var rule = decl.parent;
|
|
801
801
|
var decls = [];
|
|
802
802
|
rule.walkDecls(/^grid-(row|column)/, function (d) {
|
|
803
|
-
if (
|
|
803
|
+
if (!d.prop.endsWith('-end') && !d.value.startsWith('span')) {
|
|
804
804
|
decls.push(d);
|
|
805
805
|
}
|
|
806
806
|
});
|
|
807
807
|
|
|
808
808
|
if (decls.length > 0) {
|
|
809
809
|
decls.forEach(function (d) {
|
|
810
|
-
d.warn(result,
|
|
810
|
+
d.warn(result, 'You already have a grid-area declaration present in the rule. ' + ("You should use either grid-area or " + d.prop + ", not both"));
|
|
811
811
|
});
|
|
812
812
|
}
|
|
813
813
|
|
package/lib/hacks/intrinsic.js
CHANGED
package/lib/processor.js
CHANGED
|
@@ -79,17 +79,18 @@ function () {
|
|
|
79
79
|
});
|
|
80
80
|
|
|
81
81
|
function insideGrid(decl) {
|
|
82
|
-
return decl.parent.some(function (
|
|
83
|
-
|
|
84
|
-
var
|
|
85
|
-
var
|
|
82
|
+
return decl.parent.nodes.some(function (node) {
|
|
83
|
+
if (node.type !== 'decl') return false;
|
|
84
|
+
var displayGrid = node.prop === 'display' && /(inline-)?grid/.test(node.value);
|
|
85
|
+
var gridTemplate = node.prop.startsWith('grid-template');
|
|
86
|
+
var gridGap = /^grid-([A-z]+-)?gap/.test(node.prop);
|
|
86
87
|
return displayGrid || gridTemplate || gridGap;
|
|
87
88
|
});
|
|
88
89
|
}
|
|
89
90
|
|
|
90
91
|
function insideFlex(decl) {
|
|
91
|
-
return decl.parent.some(function (
|
|
92
|
-
return
|
|
92
|
+
return decl.parent.some(function (node) {
|
|
93
|
+
return node.prop === 'display' && /(inline-)?flex/.test(node.value);
|
|
93
94
|
});
|
|
94
95
|
}
|
|
95
96
|
|
|
@@ -738,8 +739,16 @@ function () {
|
|
|
738
739
|
} else {
|
|
739
740
|
value = isParentGrid;
|
|
740
741
|
}
|
|
741
|
-
} else {
|
|
742
|
+
} else if (typeof this.prefixes.options.grid !== 'undefined') {
|
|
742
743
|
value = this.prefixes.options.grid;
|
|
744
|
+
} else if (typeof process.env.AUTOPREFIXER_GRID !== 'undefined') {
|
|
745
|
+
if (process.env.AUTOPREFIXER_GRID === 'autoplace') {
|
|
746
|
+
value = 'autoplace';
|
|
747
|
+
} else {
|
|
748
|
+
value = true;
|
|
749
|
+
}
|
|
750
|
+
} else {
|
|
751
|
+
value = false;
|
|
743
752
|
}
|
|
744
753
|
}
|
|
745
754
|
|
package/lib/selector.js
CHANGED
|
@@ -4,6 +4,9 @@ function _defaults(obj, defaults) { var keys = Object.getOwnPropertyNames(defaul
|
|
|
4
4
|
|
|
5
5
|
function _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; _defaults(subClass, superClass); }
|
|
6
6
|
|
|
7
|
+
var _require = require('postcss'),
|
|
8
|
+
list = _require.list;
|
|
9
|
+
|
|
7
10
|
var OldSelector = require('./old-selector');
|
|
8
11
|
|
|
9
12
|
var Prefixer = require('./prefixer');
|
|
@@ -74,29 +77,66 @@ function (_Prefixer) {
|
|
|
74
77
|
;
|
|
75
78
|
|
|
76
79
|
_proto.prefixeds = function prefixeds(rule) {
|
|
80
|
+
var _this2 = this;
|
|
81
|
+
|
|
77
82
|
if (rule._autoprefixerPrefixeds) {
|
|
78
|
-
|
|
83
|
+
if (rule._autoprefixerPrefixeds[this.name]) {
|
|
84
|
+
return rule._autoprefixerPrefixeds;
|
|
85
|
+
}
|
|
86
|
+
} else {
|
|
87
|
+
rule._autoprefixerPrefixeds = {};
|
|
79
88
|
}
|
|
80
89
|
|
|
81
90
|
var prefixeds = {};
|
|
82
91
|
|
|
83
|
-
|
|
84
|
-
var
|
|
92
|
+
if (rule.selector.includes(',')) {
|
|
93
|
+
var ruleParts = list.comma(rule.selector);
|
|
94
|
+
var toProcess = ruleParts.filter(function (el) {
|
|
95
|
+
return el.includes(_this2.name);
|
|
96
|
+
});
|
|
97
|
+
|
|
98
|
+
var _loop = function _loop() {
|
|
99
|
+
if (_isArray) {
|
|
100
|
+
if (_i >= _iterator.length) return "break";
|
|
101
|
+
_ref = _iterator[_i++];
|
|
102
|
+
} else {
|
|
103
|
+
_i = _iterator.next();
|
|
104
|
+
if (_i.done) return "break";
|
|
105
|
+
_ref = _i.value;
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
var prefix = _ref;
|
|
109
|
+
prefixeds[prefix] = toProcess.map(function (el) {
|
|
110
|
+
return _this2.replace(el, prefix);
|
|
111
|
+
}).join(', ');
|
|
112
|
+
};
|
|
85
113
|
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
if (
|
|
92
|
-
_ref = _i.value;
|
|
114
|
+
for (var _iterator = this.possible(), _isArray = Array.isArray(_iterator), _i = 0, _iterator = _isArray ? _iterator : _iterator[Symbol.iterator]();;) {
|
|
115
|
+
var _ref;
|
|
116
|
+
|
|
117
|
+
var _ret = _loop();
|
|
118
|
+
|
|
119
|
+
if (_ret === "break") break;
|
|
93
120
|
}
|
|
121
|
+
} else {
|
|
122
|
+
for (var _iterator2 = this.possible(), _isArray2 = Array.isArray(_iterator2), _i2 = 0, _iterator2 = _isArray2 ? _iterator2 : _iterator2[Symbol.iterator]();;) {
|
|
123
|
+
var _ref2;
|
|
124
|
+
|
|
125
|
+
if (_isArray2) {
|
|
126
|
+
if (_i2 >= _iterator2.length) break;
|
|
127
|
+
_ref2 = _iterator2[_i2++];
|
|
128
|
+
} else {
|
|
129
|
+
_i2 = _iterator2.next();
|
|
130
|
+
if (_i2.done) break;
|
|
131
|
+
_ref2 = _i2.value;
|
|
132
|
+
}
|
|
94
133
|
|
|
95
|
-
|
|
96
|
-
|
|
134
|
+
var prefix = _ref2;
|
|
135
|
+
prefixeds[prefix] = this.replace(rule.selector, prefix);
|
|
136
|
+
}
|
|
97
137
|
}
|
|
98
138
|
|
|
99
|
-
rule._autoprefixerPrefixeds = prefixeds;
|
|
139
|
+
rule._autoprefixerPrefixeds[this.name] = prefixeds;
|
|
100
140
|
return rule._autoprefixerPrefixeds;
|
|
101
141
|
}
|
|
102
142
|
/**
|
|
@@ -116,8 +156,8 @@ function (_Prefixer) {
|
|
|
116
156
|
|
|
117
157
|
var some = false;
|
|
118
158
|
|
|
119
|
-
for (var key in prefixeds) {
|
|
120
|
-
var prefixed = prefixeds[key];
|
|
159
|
+
for (var key in prefixeds[this.name]) {
|
|
160
|
+
var prefixed = prefixeds[this.name][key];
|
|
121
161
|
|
|
122
162
|
if (before.selector === prefixed) {
|
|
123
163
|
if (prefix === key) {
|
|
@@ -159,7 +199,7 @@ function (_Prefixer) {
|
|
|
159
199
|
}
|
|
160
200
|
|
|
161
201
|
var cloned = this.clone(rule, {
|
|
162
|
-
selector: prefixeds[prefix]
|
|
202
|
+
selector: prefixeds[this.name][prefix]
|
|
163
203
|
});
|
|
164
204
|
rule.parent.insertBefore(rule, cloned);
|
|
165
205
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "autoprefixer",
|
|
3
|
-
"version": "9.
|
|
3
|
+
"version": "9.7.0",
|
|
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
6
|
"author": "Andrey Sitnik <andrey@sitnik.ru>",
|
|
@@ -10,17 +10,18 @@
|
|
|
10
10
|
"node": ">=6.0.0"
|
|
11
11
|
},
|
|
12
12
|
"dependencies": {
|
|
13
|
-
"browserslist": "^4.7.
|
|
14
|
-
"caniuse-lite": "^1.0.
|
|
13
|
+
"browserslist": "^4.7.2",
|
|
14
|
+
"caniuse-lite": "^1.0.30001004",
|
|
15
15
|
"chalk": "^2.4.2",
|
|
16
16
|
"normalize-range": "^0.1.2",
|
|
17
17
|
"num2fraction": "^1.2.2",
|
|
18
|
-
"postcss": "^7.0.
|
|
18
|
+
"postcss": "^7.0.19",
|
|
19
19
|
"postcss-value-parser": "^4.0.2"
|
|
20
20
|
},
|
|
21
21
|
"bin": {
|
|
22
22
|
"autoprefixer": "./bin/autoprefixer"
|
|
23
23
|
},
|
|
24
|
+
"eslintIgnore": ["build/"],
|
|
24
25
|
"browser": {
|
|
25
26
|
"chalk": false
|
|
26
27
|
},
|