autoprefixer 7.1.5 → 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 CHANGED
@@ -1,6 +1,11 @@
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
+
4
9
  ## 7.1.5
5
10
  * Fix `::placeholder` prefix for Edge.
6
11
  * Fix `inherit`/`initial`/`unset` values for `flex-direction`.
@@ -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);
@@ -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
- before += Array(diff).fill(' ').join('');
146
+ if (diff > 0) {
147
+ before += Array(diff).fill(' ').join('');
148
+ }
147
149
 
148
150
  return before;
149
151
  };
package/lib/processor.js CHANGED
@@ -32,19 +32,19 @@ var Processor = function () {
32
32
 
33
33
  css.walkAtRules(function (rule) {
34
34
  if (rule.name === 'keyframes') {
35
- if (!_this.disabled(rule)) {
35
+ if (!_this.disabled(rule, result)) {
36
36
  return keyframes && keyframes.process(rule);
37
37
  }
38
38
  } else if (rule.name === 'viewport') {
39
- if (!_this.disabled(rule)) {
39
+ if (!_this.disabled(rule, result)) {
40
40
  return viewport && viewport.process(rule);
41
41
  }
42
42
  } else if (rule.name === 'supports') {
43
- if (_this.prefixes.options.supports !== false && !_this.disabled(rule)) {
43
+ if (_this.prefixes.options.supports !== false && !_this.disabled(rule, result)) {
44
44
  return supports.process(rule);
45
45
  }
46
46
  } else if (rule.name === 'media' && rule.params.indexOf('-resolution') !== -1) {
47
- if (!_this.disabled(rule)) {
47
+ if (!_this.disabled(rule, result)) {
48
48
  return resolution && resolution.process(rule);
49
49
  }
50
50
  }
@@ -54,7 +54,7 @@ var Processor = function () {
54
54
 
55
55
  // Selectors
56
56
  css.walkRules(function (rule) {
57
- if (_this.disabled(rule)) return undefined;
57
+ if (_this.disabled(rule, result)) return undefined;
58
58
 
59
59
  return _this.prefixes.add.selectors.map(function (selector) {
60
60
  return selector.process(rule, result);
@@ -62,7 +62,7 @@ var Processor = function () {
62
62
  });
63
63
 
64
64
  css.walkDecls(function (decl) {
65
- if (_this.disabledDecl(decl)) return undefined;
65
+ if (_this.disabledDecl(decl, result)) return undefined;
66
66
 
67
67
  if (decl.prop === 'display' && decl.value === 'box') {
68
68
  result.warn('You should write display: flex by final spec ' + 'instead of display: box', { node: decl });
@@ -145,7 +145,7 @@ var Processor = function () {
145
145
 
146
146
  // Values
147
147
  return css.walkDecls(function (decl) {
148
- if (_this.disabledValue(decl)) return;
148
+ if (_this.disabledValue(decl, result)) return;
149
149
 
150
150
  var unprefixed = _this.prefixes.unprefixed(decl.prop);
151
151
  for (var _iterator = _this.prefixes.values('add', unprefixed), _isArray = Array.isArray(_iterator), _i = 0, _iterator = _isArray ? _iterator : _iterator[Symbol.iterator]();;) {
@@ -173,7 +173,7 @@ var Processor = function () {
173
173
  */
174
174
 
175
175
 
176
- Processor.prototype.remove = function remove(css) {
176
+ Processor.prototype.remove = function remove(css, result) {
177
177
  var _this2 = this;
178
178
 
179
179
  // At-rules
@@ -181,7 +181,7 @@ var Processor = function () {
181
181
 
182
182
  css.walkAtRules(function (rule, i) {
183
183
  if (_this2.prefixes.remove['@' + rule.name]) {
184
- if (!_this2.disabled(rule)) {
184
+ if (!_this2.disabled(rule, result)) {
185
185
  rule.parent.removeChild(i);
186
186
  }
187
187
  } else if (rule.name === 'media' && rule.params.indexOf('-resolution') !== -1 && resolution) {
@@ -194,7 +194,7 @@ var Processor = function () {
194
194
  var _loop = function _loop(checker) {
195
195
  css.walkRules(function (rule, i) {
196
196
  if (checker.check(rule)) {
197
- if (!_this2.disabled(rule)) {
197
+ if (!_this2.disabled(rule, result)) {
198
198
  rule.parent.removeChild(i);
199
199
  }
200
200
  }
@@ -219,7 +219,7 @@ var Processor = function () {
219
219
  }
220
220
 
221
221
  return css.walkDecls(function (decl, i) {
222
- if (_this2.disabled(decl)) return;
222
+ if (_this2.disabled(decl, result)) return;
223
223
 
224
224
  var rule = decl.parent;
225
225
  var unprefixed = _this2.prefixes.unprefixed(decl.prop);
@@ -299,7 +299,7 @@ var Processor = function () {
299
299
  */
300
300
 
301
301
 
302
- Processor.prototype.disabledValue = function disabledValue(node) {
302
+ Processor.prototype.disabledValue = function disabledValue(node, result) {
303
303
  if (this.prefixes.options.grid === false && node.type === 'decl') {
304
304
  if (node.prop === 'display' && node.value.indexOf('grid') !== -1) {
305
305
  return true;
@@ -311,7 +311,7 @@ var Processor = function () {
311
311
  }
312
312
  }
313
313
 
314
- return this.disabled(node);
314
+ return this.disabled(node, result);
315
315
  };
316
316
 
317
317
  /**
@@ -319,7 +319,7 @@ var Processor = function () {
319
319
  */
320
320
 
321
321
 
322
- Processor.prototype.disabledDecl = function disabledDecl(node) {
322
+ Processor.prototype.disabledDecl = function disabledDecl(node, result) {
323
323
  if (this.prefixes.options.grid === false && node.type === 'decl') {
324
324
  if (node.prop.indexOf('grid') !== -1 || node.prop === 'justify-items') {
325
325
  return true;
@@ -332,7 +332,7 @@ var Processor = function () {
332
332
  }
333
333
  }
334
334
 
335
- return this.disabled(node);
335
+ return this.disabled(node, result);
336
336
  };
337
337
 
338
338
  /**
@@ -340,7 +340,7 @@ var Processor = function () {
340
340
  */
341
341
 
342
342
 
343
- Processor.prototype.disabled = function disabled(node) {
343
+ Processor.prototype.disabled = function disabled(node, result) {
344
344
  if (node._autoprefixerDisabled !== undefined) {
345
345
  return node._autoprefixerDisabled;
346
346
  }
@@ -351,29 +351,29 @@ var Processor = function () {
351
351
  if (i.type !== 'comment') {
352
352
  return undefined;
353
353
  }
354
- if (/(!\s*)?autoprefixer:\s*off/i.test(i.text)) {
355
- status = false;
356
- return false;
357
- } else if (/(!\s*)?autoprefixer:\s*on/i.test(i.text)) {
358
- status = true;
359
- return false;
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
+ }
360
360
  }
361
361
  return undefined;
362
362
  });
363
363
 
364
- var result = false;
364
+ var value = false;
365
365
  if (status !== undefined) {
366
- result = !status;
366
+ value = !status;
367
367
  } else if (node.parent) {
368
- result = this.disabled(node.parent);
368
+ value = this.disabled(node.parent, result);
369
369
  }
370
370
 
371
- node._autoprefixerDisabled = result;
371
+ node._autoprefixerDisabled = value;
372
372
  return node._autoprefixerDisabled;
373
373
  }
374
374
 
375
375
  if (node.parent) {
376
- node._autoprefixerDisabled = this.disabled(node.parent);
376
+ node._autoprefixerDisabled = this.disabled(node.parent, result);
377
377
  return node._autoprefixerDisabled;
378
378
  }
379
379
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "autoprefixer",
3
- "version": "7.1.5",
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,8 +13,8 @@
13
13
  "license": "MIT",
14
14
  "repository": "postcss/autoprefixer",
15
15
  "dependencies": {
16
- "browserslist": "^2.5.0",
17
- "caniuse-lite": "^1.0.30000744",
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
20
  "postcss": "^6.0.13",
@@ -23,10 +23,10 @@
23
23
  "devDependencies": {
24
24
  "babel-eslint": "^8.0.1",
25
25
  "babel-plugin-transform-class-properties": "^6.24.1",
26
- "babel-preset-env": "^1.6.0",
26
+ "babel-preset-env": "^1.6.1",
27
27
  "babelify": "^7.3.0",
28
- "browserify": "^14.4.0",
29
- "eslint": "^4.8.0",
28
+ "browserify": "^14.5.0",
29
+ "eslint": "^4.9.0",
30
30
  "eslint-config-postcss": "^2.0.2",
31
31
  "fs-extra": "^4.0.2",
32
32
  "gulp": "^3.9.1",
@@ -35,7 +35,7 @@
35
35
  "gulp-json-editor": "^2.2.1",
36
36
  "gulp-replace": "^0.6.1",
37
37
  "jest": "^21.2.1",
38
- "lint-staged": "^4.2.3",
38
+ "lint-staged": "^4.3.0",
39
39
  "pre-commit": "^1.2.2",
40
40
  "size-limit": "^0.11.6",
41
41
  "vinyl-source-stream": "^1.1.0",