autoprefixer 6.7.6 → 7.1.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.
Files changed (66) hide show
  1. package/AUTHORS +1 -0
  2. package/CHANGELOG.md +23 -0
  3. package/README.md +10 -16
  4. package/data/prefixes.js +551 -517
  5. package/lib/at-rule.js +55 -38
  6. package/lib/autoprefixer.js +89 -63
  7. package/lib/brackets.js +59 -39
  8. package/lib/browsers.js +102 -65
  9. package/lib/declaration.js +212 -121
  10. package/lib/hacks/align-content.js +65 -38
  11. package/lib/hacks/align-items.js +62 -38
  12. package/lib/hacks/align-self.js +63 -36
  13. package/lib/hacks/appearance.js +42 -0
  14. package/lib/hacks/background-size.js +29 -20
  15. package/lib/hacks/block-logical.js +36 -21
  16. package/lib/hacks/border-image.js +26 -16
  17. package/lib/hacks/border-radius.js +60 -39
  18. package/lib/hacks/break-props.js +69 -44
  19. package/lib/hacks/cross-fade.js +40 -37
  20. package/lib/hacks/display-flex.js +81 -31
  21. package/lib/hacks/display-grid.js +29 -19
  22. package/lib/hacks/filter-value.js +66 -45
  23. package/lib/hacks/filter.js +26 -17
  24. package/lib/hacks/flex-basis.js +60 -30
  25. package/lib/hacks/flex-direction.js +85 -53
  26. package/lib/hacks/flex-flow.js +67 -49
  27. package/lib/hacks/flex-grow.js +45 -26
  28. package/lib/hacks/flex-shrink.js +60 -30
  29. package/lib/hacks/flex-spec.js +18 -8
  30. package/lib/hacks/flex-values.js +39 -20
  31. package/lib/hacks/flex-wrap.js +29 -20
  32. package/lib/hacks/flex.js +68 -43
  33. package/lib/hacks/fullscreen.js +31 -21
  34. package/lib/hacks/gradient.js +462 -302
  35. package/lib/hacks/grid-column-align.js +55 -0
  36. package/lib/hacks/grid-end.js +53 -28
  37. package/lib/hacks/grid-row-align.js +39 -19
  38. package/lib/hacks/grid-start.js +80 -48
  39. package/lib/hacks/grid-template.js +91 -55
  40. package/lib/hacks/image-rendering.js +63 -33
  41. package/lib/hacks/image-set.js +28 -20
  42. package/lib/hacks/inline-logical.js +32 -17
  43. package/lib/hacks/intrinsic.js +66 -0
  44. package/lib/hacks/justify-content.js +69 -42
  45. package/lib/hacks/mask-border.js +36 -21
  46. package/lib/hacks/order.js +58 -35
  47. package/lib/hacks/pixelated.js +44 -30
  48. package/lib/hacks/placeholder.js +40 -25
  49. package/lib/hacks/text-emphasis-position.js +27 -20
  50. package/lib/hacks/transform-decl.js +94 -52
  51. package/lib/hacks/writing-mode.js +37 -27
  52. package/lib/info.js +117 -78
  53. package/lib/old-selector.js +84 -58
  54. package/lib/old-value.js +22 -20
  55. package/lib/prefixer.js +164 -95
  56. package/lib/prefixes.js +446 -351
  57. package/lib/processor.js +394 -278
  58. package/lib/resolution.js +135 -75
  59. package/lib/selector.js +145 -84
  60. package/lib/supports.js +330 -210
  61. package/lib/transition.js +396 -243
  62. package/lib/utils.js +84 -48
  63. package/lib/value.js +118 -80
  64. package/package.json +54 -14
  65. package/lib/hacks/justify-items.js +0 -31
  66. package/lib/hacks/stretch.js +0 -45
package/lib/utils.js CHANGED
@@ -1,57 +1,93 @@
1
- (function() {
2
- var list;
1
+ 'use strict';
3
2
 
4
- list = require('postcss/lib/list');
3
+ var list = require('postcss/lib/list');
5
4
 
6
- module.exports = {
7
- error: function(text) {
8
- var err;
9
- err = new Error(text);
10
- err.autoprefixer = true;
11
- throw err;
5
+ module.exports = {
6
+
7
+ /**
8
+ * Throw special error, to tell beniary,
9
+ * that this error is from Autoprefixer.
10
+ */
11
+ error: function error(text) {
12
+ var err = new Error(text);
13
+ err.autoprefixer = true;
14
+ throw err;
12
15
  },
13
- uniq: function(array) {
14
- var filtered, i, j, len;
15
- filtered = [];
16
- for (j = 0, len = array.length; j < len; j++) {
17
- i = array[j];
18
- if (filtered.indexOf(i) === -1) {
19
- filtered.push(i);
16
+
17
+
18
+ /**
19
+ * Return array, that doesn’t contain duplicates.
20
+ */
21
+ uniq: function uniq(array) {
22
+ var filtered = [];
23
+ for (var _iterator = array, _isArray = Array.isArray(_iterator), _i = 0, _iterator = _isArray ? _iterator : _iterator[Symbol.iterator]();;) {
24
+ var _ref;
25
+
26
+ if (_isArray) {
27
+ if (_i >= _iterator.length) break;
28
+ _ref = _iterator[_i++];
29
+ } else {
30
+ _i = _iterator.next();
31
+ if (_i.done) break;
32
+ _ref = _i.value;
33
+ }
34
+
35
+ var i = _ref;
36
+
37
+ if (filtered.indexOf(i) === -1) {
38
+ filtered.push(i);
39
+ }
20
40
  }
21
- }
22
- return filtered;
41
+ return filtered;
23
42
  },
24
- removeNote: function(string) {
25
- if (string.indexOf(' ') === -1) {
26
- return string;
27
- } else {
28
- return string.split(' ')[0];
29
- }
43
+
44
+
45
+ /**
46
+ * Return "-webkit-" on "-webkit- old"
47
+ */
48
+ removeNote: function removeNote(string) {
49
+ if (string.indexOf(' ') === -1) {
50
+ return string;
51
+ } else {
52
+ return string.split(' ')[0];
53
+ }
30
54
  },
31
- escapeRegexp: function(string) {
32
- return string.replace(/[.?*+\^\$\[\]\\(){}|\-]/g, '\\$&');
55
+
56
+
57
+ /**
58
+ * Escape RegExp symbols
59
+ */
60
+ escapeRegexp: function escapeRegexp(string) {
61
+ return string.replace(/[.?*+\^\$\[\]\\(){}|\-]/g, '\\$&');
33
62
  },
34
- regexp: function(word, escape) {
35
- if (escape == null) {
36
- escape = true;
37
- }
38
- if (escape) {
39
- word = this.escapeRegexp(word);
40
- }
41
- return RegExp("(^|[\\s,(])(" + word + "($|[\\s(,]))", "gi");
63
+
64
+
65
+ /**
66
+ * Return regexp to check, that CSS string contain word
67
+ */
68
+ regexp: function regexp(word) {
69
+ var escape = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
70
+
71
+ if (escape) {
72
+ word = this.escapeRegexp(word);
73
+ }
74
+ return new RegExp('(^|[\\s,(])(' + word + '($|[\\s(,]))', 'gi');
42
75
  },
43
- editList: function(value, callback) {
44
- var changed, join, origin;
45
- origin = list.comma(value);
46
- changed = callback(origin, []);
47
- if (origin === changed) {
48
- return value;
49
- } else {
50
- join = value.match(/,\s*/);
51
- join = join ? join[0] : ', ';
52
- return changed.join(join);
53
- }
54
- }
55
- };
56
76
 
57
- }).call(this);
77
+
78
+ /**
79
+ * Change comma list
80
+ */
81
+ editList: function editList(value, callback) {
82
+ var origin = list.comma(value);
83
+ var changed = callback(origin, []);
84
+
85
+ if (origin === changed) {
86
+ return value;
87
+ } else {
88
+ var join = value.match(/,\s*/);
89
+ join = join ? join[0] : ', ';
90
+ return changed.join(join);
91
+ }
92
+ }
93
+ };
package/lib/value.js CHANGED
@@ -1,108 +1,146 @@
1
- (function() {
2
- var OldValue, Prefixer, Value, utils, vendor,
3
- extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; },
4
- hasProp = {}.hasOwnProperty;
1
+ 'use strict';
5
2
 
6
- Prefixer = require('./prefixer');
3
+ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
7
4
 
8
- OldValue = require('./old-value');
5
+ function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
9
6
 
10
- utils = require('./utils');
7
+ function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
11
8
 
12
- vendor = require('postcss/lib/vendor');
9
+ var Prefixer = require('./prefixer');
10
+ var OldValue = require('./old-value');
11
+ var utils = require('./utils');
13
12
 
14
- Value = (function(superClass) {
15
- extend(Value, superClass);
13
+ var vendor = require('postcss/lib/vendor');
14
+
15
+ var Value = function (_Prefixer) {
16
+ _inherits(Value, _Prefixer);
16
17
 
17
18
  function Value() {
18
- return Value.__super__.constructor.apply(this, arguments);
19
+ _classCallCheck(this, Value);
20
+
21
+ return _possibleConstructorReturn(this, _Prefixer.apply(this, arguments));
19
22
  }
20
23
 
21
- Value.save = function(prefixes, decl) {
22
- var already, cloned, prefix, prefixed, prop, propPrefix, ref, results, rule, trimmed, value;
23
- prop = decl.prop;
24
- ref = decl._autoprefixerValues;
25
- results = [];
26
- for (prefix in ref) {
27
- value = ref[prefix];
28
- if (value === decl.value) {
29
- continue;
30
- }
31
- propPrefix = vendor.prefix(prop);
32
- if (propPrefix === prefix) {
33
- results.push(decl.value = value);
34
- } else if (propPrefix === '-pie-') {
35
- continue;
36
- } else {
37
- prefixed = prefixes.prefixed(prop, prefix);
38
- rule = decl.parent;
39
- if (rule.every(function(i) {
40
- return i.prop !== prefixed;
41
- })) {
42
- trimmed = value.replace(/\s+/, ' ');
43
- already = rule.some(function(i) {
44
- return i.prop === decl.prop && i.value.replace(/\s+/, ' ') === trimmed;
45
- });
46
- if (!already) {
47
- cloned = this.clone(decl, {
48
- value: value
49
- });
50
- results.push(decl.parent.insertBefore(decl, cloned));
24
+ /**
25
+ * Clone decl for each prefixed values
26
+ */
27
+ Value.save = function save(prefixes, decl) {
28
+ var _this2 = this;
29
+
30
+ var prop = decl.prop;
31
+ var result = [];
32
+
33
+ for (var prefix in decl._autoprefixerValues) {
34
+ var value = decl._autoprefixerValues[prefix];
35
+
36
+ if (value === decl.value) {
37
+ continue;
38
+ }
39
+
40
+ var item = void 0;
41
+ var propPrefix = vendor.prefix(prop);
42
+
43
+ if (propPrefix === prefix) {
44
+ item = decl.value = value;
45
+ } else if (propPrefix === '-pie-') {
46
+ continue;
51
47
  } else {
52
- results.push(void 0);
48
+ (function () {
49
+ var prefixed = prefixes.prefixed(prop, prefix);
50
+ var rule = decl.parent;
51
+ if (rule.every(function (i) {
52
+ return i.prop !== prefixed;
53
+ })) {
54
+ var trimmed = value.replace(/\s+/, ' ');
55
+ var already = rule.some(function (i) {
56
+ return i.prop === decl.prop && i.value.replace(/\s+/, ' ') === trimmed;
57
+ });
58
+
59
+ if (!already) {
60
+ var cloned = _this2.clone(decl, { value: value });
61
+ item = decl.parent.insertBefore(decl, cloned);
62
+ }
63
+ }
64
+ })();
53
65
  }
54
- } else {
55
- results.push(void 0);
56
- }
66
+
67
+ result.push(item);
57
68
  }
58
- }
59
- return results;
60
- };
61
69
 
62
- Value.prototype.check = function(decl) {
63
- var value;
64
- value = decl.value;
65
- if (value.indexOf(this.name) !== -1) {
66
- return !!value.match(this.regexp());
67
- } else {
68
- return false;
69
- }
70
+ return result;
70
71
  };
71
72
 
72
- Value.prototype.regexp = function() {
73
- return this.regexpCache || (this.regexpCache = utils.regexp(this.name));
73
+ /**
74
+ * Is declaration need to be prefixed
75
+ */
76
+
77
+
78
+ Value.prototype.check = function check(decl) {
79
+ var value = decl.value;
80
+ if (value.indexOf(this.name) !== -1) {
81
+ return !!value.match(this.regexp());
82
+ } else {
83
+ return false;
84
+ }
74
85
  };
75
86
 
76
- Value.prototype.replace = function(string, prefix) {
77
- return string.replace(this.regexp(), '$1' + prefix + '$2');
87
+ /**
88
+ * Lazy regexp loading
89
+ */
90
+
91
+
92
+ Value.prototype.regexp = function regexp() {
93
+ return this.regexpCache || (this.regexpCache = utils.regexp(this.name));
78
94
  };
79
95
 
80
- Value.prototype.value = function(decl) {
81
- if (decl.raws.value && decl.raws.value.value === decl.value) {
82
- return decl.raws.value.raw;
83
- } else {
84
- return decl.value;
85
- }
96
+ /**
97
+ * Add prefix to values in string
98
+ */
99
+
100
+
101
+ Value.prototype.replace = function replace(string, prefix) {
102
+ return string.replace(this.regexp(), '$1' + prefix + '$2');
86
103
  };
87
104
 
88
- Value.prototype.add = function(decl, prefix) {
89
- var value;
90
- decl._autoprefixerValues || (decl._autoprefixerValues = {});
91
- value = decl._autoprefixerValues[prefix] || this.value(decl);
92
- value = this.replace(value, prefix);
93
- if (value) {
94
- return decl._autoprefixerValues[prefix] = value;
95
- }
105
+ /**
106
+ * Get value with comments if it was not changed
107
+ */
108
+
109
+
110
+ Value.prototype.value = function value(decl) {
111
+ if (decl.raws.value && decl.raws.value.value === decl.value) {
112
+ return decl.raws.value.raw;
113
+ } else {
114
+ return decl.value;
115
+ }
96
116
  };
97
117
 
98
- Value.prototype.old = function(prefix) {
99
- return new OldValue(this.name, prefix + this.name);
118
+ /**
119
+ * Save values with next prefixed token
120
+ */
121
+
122
+
123
+ Value.prototype.add = function add(decl, prefix) {
124
+ if (!decl._autoprefixerValues) {
125
+ decl._autoprefixerValues = {};
126
+ }
127
+ var value = decl._autoprefixerValues[prefix] || this.value(decl);
128
+ value = this.replace(value, prefix);
129
+ if (value) {
130
+ decl._autoprefixerValues[prefix] = value;
131
+ }
100
132
  };
101
133
 
102
- return Value;
134
+ /**
135
+ * Return function to fast find prefixed value
136
+ */
137
+
103
138
 
104
- })(Prefixer);
139
+ Value.prototype.old = function old(prefix) {
140
+ return new OldValue(this.name, prefix + this.name);
141
+ };
105
142
 
106
- module.exports = Value;
143
+ return Value;
144
+ }(Prefixer);
107
145
 
108
- }).call(this);
146
+ module.exports = Value;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "autoprefixer",
3
- "version": "6.7.6",
3
+ "version": "7.1.0",
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,33 +13,73 @@
13
13
  "license": "MIT",
14
14
  "repository": "postcss/autoprefixer",
15
15
  "dependencies": {
16
- "browserslist": "^1.7.5",
17
- "caniuse-db": "^1.0.30000628",
16
+ "browserslist": "^2.1.2",
17
+ "caniuse-lite": "^1.0.30000669",
18
18
  "normalize-range": "^0.1.2",
19
19
  "num2fraction": "^1.2.2",
20
- "postcss": "^5.2.15",
20
+ "postcss": "^6.0.1",
21
21
  "postcss-value-parser": "^3.2.3"
22
22
  },
23
23
  "devDependencies": {
24
- "browserify": "^14.1.0",
24
+ "babel-eslint": "^7.2.3",
25
+ "babel-plugin-transform-class-properties": "^6.24.1",
26
+ "babel-preset-env": "^1.4.0",
27
+ "browserify": "^14.3.0",
28
+ "eslint": "^3.19.0",
25
29
  "eslint-config-postcss": "^2.0.2",
26
- "fs-extra": "^2.0.0",
30
+ "fs-extra": "^3.0.1",
27
31
  "gulp": "^3.9.1",
28
- "gulp-coffee": "^2.3.3",
29
- "gulp-eslint": "^3.0.1",
32
+ "gulp-babel": "^6.1.2",
33
+ "gulp-coffee": "^2.3.4",
30
34
  "gulp-json-editor": "^2.2.1",
31
- "gulp-mocha": "^3.0.1",
32
35
  "gulp-replace": "^0.5.4",
33
- "mocha": "^3.2.0",
34
- "should": "^11.2.0",
36
+ "jest": "^20.0.1",
37
+ "lint-staged": "^3.4.1",
38
+ "pre-commit": "^1.2.2",
35
39
  "vinyl-source-stream": "^1.1.0",
36
- "coffee-script": "^1.12.4"
40
+ "babel-register": "^6.24.0"
37
41
  },
38
42
  "scripts": {
39
- "test": "gulp"
43
+ "lint-staged": "lint-staged",
44
+ "lint": "eslint *.js lib/*.js data/*.js test/*.js",
45
+ "test": "jest && npm run lint && gulp"
40
46
  },
47
+ "lint-staged": {
48
+ "*.js": "eslint"
49
+ },
50
+ "pre-commit": [
51
+ "lint-staged"
52
+ ],
41
53
  "eslintConfig": {
42
- "extends": "eslint-config-postcss/es5"
54
+ "extends": "eslint-config-postcss",
55
+ "parser": "babel-eslint",
56
+ "rules": {
57
+ "complexity": "off",
58
+ "camelcase": "off"
59
+ },
60
+ "env": {
61
+ "jest": true
62
+ }
63
+ },
64
+ "babel": {
65
+ "presets": [
66
+ [
67
+ "env", {
68
+ "targets": {
69
+ "browsers": "last 1 version",
70
+ "node": 4
71
+ },
72
+ "loose": true
73
+ }
74
+ ]
75
+ ],
76
+ "plugins": [
77
+ [
78
+ "transform-class-properties", {
79
+ "spec": true
80
+ }
81
+ ]
82
+ ]
43
83
  },
44
84
  "main": "lib/autoprefixer"
45
85
  }
@@ -1,31 +0,0 @@
1
- (function() {
2
- var Declaration, JustifyItems,
3
- extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; },
4
- hasProp = {}.hasOwnProperty;
5
-
6
- Declaration = require('../declaration');
7
-
8
- JustifyItems = (function(superClass) {
9
- extend(JustifyItems, superClass);
10
-
11
- function JustifyItems() {
12
- return JustifyItems.__super__.constructor.apply(this, arguments);
13
- }
14
-
15
- JustifyItems.names = ['justify-items', 'grid-column-align'];
16
-
17
- JustifyItems.prototype.prefixed = function(prop, prefix) {
18
- return prefix + (prefix === '-ms-' ? 'grid-column-align' : prop);
19
- };
20
-
21
- JustifyItems.prototype.normalize = function(prop) {
22
- return 'justify-items';
23
- };
24
-
25
- return JustifyItems;
26
-
27
- })(Declaration);
28
-
29
- module.exports = JustifyItems;
30
-
31
- }).call(this);
@@ -1,45 +0,0 @@
1
- (function() {
2
- var OldValue, Stretch, Value,
3
- extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; },
4
- hasProp = {}.hasOwnProperty;
5
-
6
- OldValue = require('../old-value');
7
-
8
- Value = require('../value');
9
-
10
- Stretch = (function(superClass) {
11
- extend(Stretch, superClass);
12
-
13
- function Stretch() {
14
- return Stretch.__super__.constructor.apply(this, arguments);
15
- }
16
-
17
- Stretch.names = ['stretch', 'fill', 'fill-available'];
18
-
19
- Stretch.prototype.replace = function(string, prefix) {
20
- if (prefix === '-moz-') {
21
- return string.replace(this.regexp(), '$1-moz-available$3');
22
- } else if (prefix === '-webkit-') {
23
- return string.replace(this.regexp(), '$1-webkit-fill-available$3');
24
- } else {
25
- return Stretch.__super__.replace.apply(this, arguments);
26
- }
27
- };
28
-
29
- Stretch.prototype.old = function(prefix) {
30
- if (prefix === '-moz-') {
31
- return new OldValue(this.name, '-moz-available');
32
- } else if (prefix === '-webkit-') {
33
- return new OldValue(this.name, '-webkit-fill-available');
34
- } else {
35
- return Stretch.__super__.old.apply(this, arguments);
36
- }
37
- };
38
-
39
- return Stretch;
40
-
41
- })(Value);
42
-
43
- module.exports = Stretch;
44
-
45
- }).call(this);