autoprefixer 9.8.7 → 10.0.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.
Files changed (80) hide show
  1. package/CHANGELOG.md +999 -0
  2. package/README.md +0 -3
  3. package/bin/autoprefixer +11 -11
  4. package/data/prefixes.js +799 -545
  5. package/lib/at-rule.js +23 -50
  6. package/lib/autoprefixer.js +108 -97
  7. package/lib/brackets.js +31 -44
  8. package/lib/browsers.js +54 -71
  9. package/lib/declaration.js +122 -178
  10. package/lib/hacks/align-content.js +24 -54
  11. package/lib/hacks/align-items.js +23 -53
  12. package/lib/hacks/align-self.js +32 -60
  13. package/lib/hacks/animation.js +11 -29
  14. package/lib/hacks/appearance.js +19 -35
  15. package/lib/hacks/backdrop-filter.js +16 -31
  16. package/lib/hacks/background-clip.js +19 -36
  17. package/lib/hacks/background-size.js +16 -31
  18. package/lib/hacks/block-logical.js +28 -36
  19. package/lib/hacks/border-image.js +9 -27
  20. package/lib/hacks/border-radius.js +22 -44
  21. package/lib/hacks/break-props.js +38 -51
  22. package/lib/hacks/color-adjust.js +11 -30
  23. package/lib/hacks/cross-fade.js +29 -48
  24. package/lib/hacks/display-flex.js +32 -61
  25. package/lib/hacks/display-grid.js +12 -32
  26. package/lib/hacks/filter-value.js +8 -25
  27. package/lib/hacks/filter.js +13 -27
  28. package/lib/hacks/flex-basis.js +21 -54
  29. package/lib/hacks/flex-direction.js +41 -77
  30. package/lib/hacks/flex-flow.js +33 -61
  31. package/lib/hacks/flex-grow.js +16 -43
  32. package/lib/hacks/flex-shrink.js +21 -54
  33. package/lib/hacks/flex-spec.js +7 -10
  34. package/lib/hacks/flex-wrap.js +11 -32
  35. package/lib/hacks/flex.js +27 -58
  36. package/lib/hacks/fullscreen.js +10 -30
  37. package/lib/hacks/gradient.js +240 -330
  38. package/lib/hacks/grid-area.js +25 -43
  39. package/lib/hacks/grid-column-align.js +14 -34
  40. package/lib/hacks/grid-end.js +30 -45
  41. package/lib/hacks/grid-row-align.js +14 -34
  42. package/lib/hacks/grid-row-column.js +20 -39
  43. package/lib/hacks/grid-rows-columns.js +75 -99
  44. package/lib/hacks/grid-start.js +17 -39
  45. package/lib/hacks/grid-template-areas.js +59 -76
  46. package/lib/hacks/grid-template.js +40 -61
  47. package/lib/hacks/grid-utils.js +686 -716
  48. package/lib/hacks/image-rendering.js +24 -47
  49. package/lib/hacks/image-set.js +10 -30
  50. package/lib/hacks/inline-logical.js +26 -32
  51. package/lib/hacks/intrinsic.js +40 -53
  52. package/lib/hacks/justify-content.js +26 -57
  53. package/lib/hacks/mask-border.js +28 -36
  54. package/lib/hacks/mask-composite.js +41 -57
  55. package/lib/hacks/order.js +22 -52
  56. package/lib/hacks/overscroll-behavior.js +16 -37
  57. package/lib/hacks/pixelated.js +16 -40
  58. package/lib/hacks/place-self.js +18 -41
  59. package/lib/hacks/placeholder-shown.js +9 -28
  60. package/lib/hacks/placeholder.js +15 -38
  61. package/lib/hacks/text-decoration-skip-ink.js +14 -29
  62. package/lib/hacks/text-decoration.js +20 -31
  63. package/lib/hacks/text-emphasis-position.js +9 -28
  64. package/lib/hacks/transform-decl.js +43 -69
  65. package/lib/hacks/user-select.js +19 -27
  66. package/lib/hacks/writing-mode.js +19 -36
  67. package/lib/info.js +63 -93
  68. package/lib/old-selector.js +39 -60
  69. package/lib/old-value.js +17 -25
  70. package/lib/prefixer.js +83 -110
  71. package/lib/prefixes.js +233 -336
  72. package/lib/processor.js +420 -416
  73. package/lib/resolution.js +62 -98
  74. package/lib/selector.js +91 -139
  75. package/lib/supports.js +194 -246
  76. package/lib/transition.js +170 -265
  77. package/lib/utils.js +49 -72
  78. package/lib/value.js +77 -116
  79. package/lib/vendor.js +14 -0
  80. package/package.json +23 -12
package/lib/utils.js CHANGED
@@ -1,103 +1,80 @@
1
- "use strict";
2
-
3
- function _createForOfIteratorHelperLoose(o, allowArrayLike) { var it; if (typeof Symbol === "undefined" || o[Symbol.iterator] == null) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; return function () { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } it = o[Symbol.iterator](); return it.next.bind(it); }
4
-
5
- function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
6
-
7
- function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
8
-
9
- var list = require('postcss').list;
1
+ let { list } = require('postcss')
10
2
 
11
3
  module.exports = {
12
4
  /**
13
- * Throw special error, to tell beniary,
14
- * that this error is from Autoprefixer.
15
- */
16
- error: function error(text) {
17
- var err = new Error(text);
18
- err.autoprefixer = true;
19
- throw err;
5
+ * Throw special error, to tell beniary,
6
+ * that this error is from Autoprefixer.
7
+ */
8
+ error (text) {
9
+ let err = new Error(text)
10
+ err.autoprefixer = true
11
+ throw err
20
12
  },
21
13
 
22
14
  /**
23
- * Return array, that doesn’t contain duplicates.
24
- */
25
- uniq: function uniq(array) {
26
- var filtered = [];
27
-
28
- for (var _iterator = _createForOfIteratorHelperLoose(array), _step; !(_step = _iterator()).done;) {
29
- var i = _step.value;
30
-
31
- if (!filtered.includes(i)) {
32
- filtered.push(i);
33
- }
34
- }
35
-
36
- return filtered;
15
+ * Return array, that doesn’t contain duplicates.
16
+ */
17
+ uniq (array) {
18
+ return [...new Set(array)]
37
19
  },
38
20
 
39
21
  /**
40
- * Return "-webkit-" on "-webkit- old"
41
- */
42
- removeNote: function removeNote(string) {
22
+ * Return "-webkit-" on "-webkit- old"
23
+ */
24
+ removeNote (string) {
43
25
  if (!string.includes(' ')) {
44
- return string;
26
+ return string
45
27
  }
46
28
 
47
- return string.split(' ')[0];
29
+ return string.split(' ')[0]
48
30
  },
49
31
 
50
32
  /**
51
- * Escape RegExp symbols
52
- */
53
- escapeRegexp: function escapeRegexp(string) {
54
- return string.replace(/[$()*+-.?[\\\]^{|}]/g, '\\$&');
33
+ * Escape RegExp symbols
34
+ */
35
+ escapeRegexp (string) {
36
+ return string.replace(/[$()*+-.?[\\\]^{|}]/g, '\\$&')
55
37
  },
56
38
 
57
39
  /**
58
- * Return regexp to check, that CSS string contain word
59
- */
60
- regexp: function regexp(word, escape) {
61
- if (escape === void 0) {
62
- escape = true;
63
- }
64
-
40
+ * Return regexp to check, that CSS string contain word
41
+ */
42
+ regexp (word, escape = true) {
65
43
  if (escape) {
66
- word = this.escapeRegexp(word);
44
+ word = this.escapeRegexp(word)
67
45
  }
68
-
69
- return new RegExp("(^|[\\s,(])(" + word + "($|[\\s(,]))", 'gi');
46
+ return new RegExp(`(^|[\\s,(])(${word}($|[\\s(,]))`, 'gi')
70
47
  },
71
48
 
72
49
  /**
73
- * Change comma list
74
- */
75
- editList: function editList(value, callback) {
76
- var origin = list.comma(value);
77
- var changed = callback(origin, []);
50
+ * Change comma list
51
+ */
52
+ editList (value, callback) {
53
+ let origin = list.comma(value)
54
+ let changed = callback(origin, [])
78
55
 
79
56
  if (origin === changed) {
80
- return value;
57
+ return value
81
58
  }
82
59
 
83
- var join = value.match(/,\s*/);
84
- join = join ? join[0] : ', ';
85
- return changed.join(join);
60
+ let join = value.match(/,\s*/)
61
+ join = join ? join[0] : ', '
62
+ return changed.join(join)
86
63
  },
87
64
 
88
65
  /**
89
- * Split the selector into parts.
90
- * It returns 3 level deep array because selectors can be comma
91
- * separated (1), space separated (2), and combined (3)
92
- * @param {String} selector selector string
93
- * @return {Array<Array<Array>>} 3 level deep array of split selector
94
- * @see utils.test.js for examples
95
- */
96
- splitSelector: function splitSelector(selector) {
97
- return list.comma(selector).map(function (i) {
98
- return list.space(i).map(function (k) {
99
- return k.split(/(?=\.|#)/g);
100
- });
101
- });
66
+ * Split the selector into parts.
67
+ * It returns 3 level deep array because selectors can be comma
68
+ * separated (1), space separated (2), and combined (3)
69
+ * @param {String} selector selector string
70
+ * @return {Array<Array<Array>>} 3 level deep array of split selector
71
+ * @see utils.test.js for examples
72
+ */
73
+ splitSelector (selector) {
74
+ return list.comma(selector).map(i => {
75
+ return list.space(i).map(k => {
76
+ return k.split(/(?=\.|#)/g)
77
+ })
78
+ })
102
79
  }
103
- };
80
+ }
package/lib/value.js CHANGED
@@ -1,164 +1,125 @@
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
- var vendor = require('postcss').vendor;
8
-
9
- var Prefixer = require('./prefixer');
10
-
11
- var OldValue = require('./old-value');
12
-
13
- var utils = require('./utils');
14
-
15
- var Value = /*#__PURE__*/function (_Prefixer) {
16
- _inheritsLoose(Value, _Prefixer);
17
-
18
- function Value() {
19
- return _Prefixer.apply(this, arguments) || this;
20
- }
1
+ let Prefixer = require('./prefixer')
2
+ let OldValue = require('./old-value')
3
+ let vendor = require('./vendor')
4
+ let utils = require('./utils')
21
5
 
6
+ class Value extends Prefixer {
22
7
  /**
23
- * Clone decl for each prefixed values
24
- */
25
- Value.save = function save(prefixes, decl) {
26
- var _this = this;
27
-
28
- var prop = decl.prop;
29
- var result = [];
8
+ * Clone decl for each prefixed values
9
+ */
10
+ static save (prefixes, decl) {
11
+ let prop = decl.prop
12
+ let result = []
30
13
 
31
- var _loop = function _loop(prefix) {
32
- var value = decl._autoprefixerValues[prefix];
14
+ for (let prefix in decl._autoprefixerValues) {
15
+ let value = decl._autoprefixerValues[prefix]
33
16
 
34
17
  if (value === decl.value) {
35
- return "continue";
18
+ continue
36
19
  }
37
20
 
38
- var item = void 0;
39
- var propPrefix = vendor.prefix(prop);
21
+ let item
22
+ let propPrefix = vendor.prefix(prop)
40
23
 
41
24
  if (propPrefix === '-pie-') {
42
- return "continue";
25
+ continue
43
26
  }
44
27
 
45
28
  if (propPrefix === prefix) {
46
- item = decl.value = value;
47
- result.push(item);
48
- return "continue";
29
+ item = decl.value = value
30
+ result.push(item)
31
+ continue
49
32
  }
50
33
 
51
- var prefixed = prefixes.prefixed(prop, prefix);
52
- var rule = decl.parent;
34
+ let prefixed = prefixes.prefixed(prop, prefix)
35
+ let rule = decl.parent
53
36
 
54
- if (!rule.every(function (i) {
55
- return i.prop !== prefixed;
56
- })) {
57
- result.push(item);
58
- return "continue";
37
+ if (!rule.every(i => i.prop !== prefixed)) {
38
+ result.push(item)
39
+ continue
59
40
  }
60
41
 
61
- var trimmed = value.replace(/\s+/, ' ');
62
- var already = rule.some(function (i) {
63
- return i.prop === decl.prop && i.value.replace(/\s+/, ' ') === trimmed;
64
- });
42
+ let trimmed = value.replace(/\s+/, ' ')
43
+ let already = rule.some(
44
+ i => i.prop === decl.prop && i.value.replace(/\s+/, ' ') === trimmed
45
+ )
65
46
 
66
47
  if (already) {
67
- result.push(item);
68
- return "continue";
48
+ result.push(item)
49
+ continue
69
50
  }
70
51
 
71
- var cloned = _this.clone(decl, {
72
- value: value
73
- });
74
-
75
- item = decl.parent.insertBefore(decl, cloned);
76
- result.push(item);
77
- };
78
-
79
- for (var prefix in decl._autoprefixerValues) {
80
- var _ret = _loop(prefix);
52
+ let cloned = this.clone(decl, { value })
53
+ item = decl.parent.insertBefore(decl, cloned)
81
54
 
82
- if (_ret === "continue") continue;
55
+ result.push(item)
83
56
  }
84
57
 
85
- return result;
58
+ return result
86
59
  }
87
- /**
88
- * Is declaration need to be prefixed
89
- */
90
- ;
91
-
92
- var _proto = Value.prototype;
93
-
94
- _proto.check = function check(decl) {
95
- var value = decl.value;
96
60
 
61
+ /**
62
+ * Is declaration need to be prefixed
63
+ */
64
+ check (decl) {
65
+ let value = decl.value
97
66
  if (!value.includes(this.name)) {
98
- return false;
67
+ return false
99
68
  }
100
69
 
101
- return !!value.match(this.regexp());
70
+ return !!value.match(this.regexp())
102
71
  }
103
- /**
104
- * Lazy regexp loading
105
- */
106
- ;
107
72
 
108
- _proto.regexp = function regexp() {
109
- return this.regexpCache || (this.regexpCache = utils.regexp(this.name));
110
- }
111
73
  /**
112
- * Add prefix to values in string
113
- */
114
- ;
115
-
116
- _proto.replace = function replace(string, prefix) {
117
- return string.replace(this.regexp(), "$1" + prefix + "$2");
74
+ * Lazy regexp loading
75
+ */
76
+ regexp () {
77
+ return this.regexpCache || (this.regexpCache = utils.regexp(this.name))
118
78
  }
79
+
119
80
  /**
120
- * Get value with comments if it was not changed
121
- */
122
- ;
81
+ * Add prefix to values in string
82
+ */
83
+ replace (string, prefix) {
84
+ return string.replace(this.regexp(), `$1${prefix}$2`)
85
+ }
123
86
 
124
- _proto.value = function value(decl) {
87
+ /**
88
+ * Get value with comments if it was not changed
89
+ */
90
+ value (decl) {
125
91
  if (decl.raws.value && decl.raws.value.value === decl.value) {
126
- return decl.raws.value.raw;
92
+ return decl.raws.value.raw
127
93
  } else {
128
- return decl.value;
94
+ return decl.value
129
95
  }
130
96
  }
131
- /**
132
- * Save values with next prefixed token
133
- */
134
- ;
135
97
 
136
- _proto.add = function add(decl, prefix) {
98
+ /**
99
+ * Save values with next prefixed token
100
+ */
101
+ add (decl, prefix) {
137
102
  if (!decl._autoprefixerValues) {
138
- decl._autoprefixerValues = {};
103
+ decl._autoprefixerValues = {}
139
104
  }
105
+ let value = decl._autoprefixerValues[prefix] || this.value(decl)
140
106
 
141
- var value = decl._autoprefixerValues[prefix] || this.value(decl);
142
- var before;
143
-
107
+ let before
144
108
  do {
145
- before = value;
146
- value = this.replace(value, prefix);
147
- if (value === false) return;
148
- } while (value !== before);
109
+ before = value
110
+ value = this.replace(value, prefix)
111
+ if (value === false) return
112
+ } while (value !== before)
149
113
 
150
- decl._autoprefixerValues[prefix] = value;
114
+ decl._autoprefixerValues[prefix] = value
151
115
  }
152
- /**
153
- * Return function to fast find prefixed value
154
- */
155
- ;
156
116
 
157
- _proto.old = function old(prefix) {
158
- return new OldValue(this.name, prefix + this.name);
159
- };
160
-
161
- return Value;
162
- }(Prefixer);
117
+ /**
118
+ * Return function to fast find prefixed value
119
+ */
120
+ old (prefix) {
121
+ return new OldValue(this.name, prefix + this.name)
122
+ }
123
+ }
163
124
 
164
- module.exports = Value;
125
+ module.exports = Value
package/lib/vendor.js ADDED
@@ -0,0 +1,14 @@
1
+ module.exports = {
2
+ prefix (prop) {
3
+ let match = prop.match(/^(-\w+-)/)
4
+ if (match) {
5
+ return match[0]
6
+ }
7
+
8
+ return ''
9
+ },
10
+
11
+ unprefixed (prop) {
12
+ return prop.replace(/^-\w+-/, '')
13
+ }
14
+ }
package/package.json CHANGED
@@ -1,28 +1,39 @@
1
1
  {
2
2
  "name": "autoprefixer",
3
- "version": "9.8.7",
3
+ "version": "10.0.2",
4
4
  "description": "Parse CSS and add vendor prefixes to CSS rules using values from the Can I Use website",
5
- "keywords": ["autoprefixer", "css", "prefix", "postcss", "postcss-plugin"],
6
- "bin": "./bin/autoprefixer",
5
+ "engines": {
6
+ "node": "^10 || ^12 || >=14"
7
+ },
8
+ "keywords": [
9
+ "autoprefixer",
10
+ "css",
11
+ "prefix",
12
+ "postcss",
13
+ "postcss-plugin"
14
+ ],
15
+ "main": "lib/autoprefixer.js",
16
+ "bin": "bin/autoprefixer",
7
17
  "funding": {
8
- "type": "tidelift",
9
- "url": "https://tidelift.com/funding/github/npm/autoprefixer"
18
+ "type": "opencollective",
19
+ "url": "https://opencollective.com/postcss/"
10
20
  },
11
21
  "author": "Andrey Sitnik <andrey@sitnik.ru>",
12
22
  "license": "MIT",
13
23
  "repository": "postcss/autoprefixer",
24
+ "peerDependencies": {
25
+ "postcss": "^8.1.0"
26
+ },
14
27
  "dependencies": {
15
- "browserslist": "^4.12.0",
16
- "caniuse-lite": "^1.0.30001109",
17
- "nanocolors": "^0.2.8",
28
+ "browserslist": "^4.14.7",
29
+ "caniuse-lite": "^1.0.30001157",
30
+ "colorette": "^1.2.1",
18
31
  "normalize-range": "^0.1.2",
19
32
  "num2fraction": "^1.2.2",
20
- "postcss": "^7.0.32",
21
33
  "postcss-value-parser": "^4.1.0"
22
34
  },
23
35
  "browser": {
24
36
  "colorette": false,
25
37
  "chalk": false
26
- },
27
- "main": "lib/autoprefixer"
28
- }
38
+ }
39
+ }