postcss 5.0.10 → 5.0.14
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.
Potentially problematic release.
This version of postcss might be problematic. Click here for more details.
- package/CHANGELOG.md +16 -0
- package/README.md +178 -695
- package/d.ts/at-rule.d.ts +0 -2
- package/d.ts/css-syntax-error.d.ts +0 -1
- package/d.ts/parser.d.ts +0 -1
- package/docs/api.md +4 -4
- package/docs/guidelines/plugin.md +3 -3
- package/docs/plugins.md +572 -0
- package/docs/source-maps.md +68 -0
- package/docs/writing-a-plugin.md +27 -0
- package/lib/at-rule.js +36 -31
- package/lib/comment.js +33 -18
- package/lib/container.js +62 -36
- package/lib/css-syntax-error.js +13 -23
- package/lib/declaration.js +33 -18
- package/lib/input.js +17 -17
- package/lib/lazy-result.js +25 -20
- package/lib/list.js +1 -5
- package/lib/map-generator.js +34 -33
- package/lib/node.js +66 -44
- package/lib/parse.js +6 -6
- package/lib/parser.js +17 -39
- package/lib/postcss.js +14 -14
- package/lib/previous-map.js +20 -18
- package/lib/processor.js +9 -11
- package/lib/result.js +8 -8
- package/lib/root.js +22 -13
- package/lib/rule.js +25 -16
- package/lib/stringifier.js +2 -4
- package/lib/stringify.js +4 -5
- package/lib/tokenize.js +2 -3
- package/lib/vendor.js +1 -4
- package/lib/warn-once.js +3 -2
- package/lib/warning.js +7 -3
- package/package.json +21 -18
package/lib/result.js
CHANGED
@@ -1,17 +1,17 @@
|
|
1
1
|
'use strict';
|
2
2
|
|
3
|
-
|
4
|
-
|
5
|
-
var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ('value' in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })();
|
6
|
-
|
7
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
|
3
|
+
var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })();
|
8
4
|
|
9
|
-
|
5
|
+
exports.__esModule = true;
|
10
6
|
|
11
7
|
var _warning = require('./warning');
|
12
8
|
|
13
9
|
var _warning2 = _interopRequireDefault(_warning);
|
14
10
|
|
11
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
12
|
+
|
13
|
+
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
14
|
+
|
15
15
|
var Result = (function () {
|
16
16
|
function Result(processor, root, opts) {
|
17
17
|
_classCallCheck(this, Result);
|
@@ -37,7 +37,7 @@ var Result = (function () {
|
|
37
37
|
}
|
38
38
|
}
|
39
39
|
|
40
|
-
this.messages.push(new _warning2
|
40
|
+
this.messages.push(new _warning2.default(text, opts));
|
41
41
|
};
|
42
42
|
|
43
43
|
Result.prototype.warnings = function warnings() {
|
@@ -56,5 +56,5 @@ var Result = (function () {
|
|
56
56
|
return Result;
|
57
57
|
})();
|
58
58
|
|
59
|
-
exports
|
59
|
+
exports.default = Result;
|
60
60
|
module.exports = exports['default'];
|
package/lib/root.js
CHANGED
@@ -2,12 +2,6 @@
|
|
2
2
|
|
3
3
|
exports.__esModule = true;
|
4
4
|
|
5
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
|
6
|
-
|
7
|
-
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } }
|
8
|
-
|
9
|
-
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; }
|
10
|
-
|
11
5
|
var _container = require('./container');
|
12
6
|
|
13
7
|
var _container2 = _interopRequireDefault(_container);
|
@@ -16,15 +10,26 @@ var _warnOnce = require('./warn-once');
|
|
16
10
|
|
17
11
|
var _warnOnce2 = _interopRequireDefault(_warnOnce);
|
18
12
|
|
13
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
14
|
+
|
15
|
+
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
16
|
+
|
17
|
+
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; }
|
18
|
+
|
19
|
+
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; }
|
20
|
+
|
19
21
|
var Root = (function (_Container) {
|
20
22
|
_inherits(Root, _Container);
|
21
23
|
|
22
24
|
function Root(defaults) {
|
23
25
|
_classCallCheck(this, Root);
|
24
26
|
|
25
|
-
_Container.call(this, defaults);
|
26
|
-
|
27
|
-
|
27
|
+
var _this = _possibleConstructorReturn(this, _Container.call(this, defaults));
|
28
|
+
|
29
|
+
_this.type = 'root';
|
30
|
+
|
31
|
+
if (!_this.nodes) _this.nodes = [];
|
32
|
+
return _this;
|
28
33
|
}
|
29
34
|
|
30
35
|
Root.prototype.removeChild = function removeChild(child) {
|
@@ -82,18 +87,22 @@ var Root = (function (_Container) {
|
|
82
87
|
return lazy.stringify();
|
83
88
|
};
|
84
89
|
|
90
|
+
/* istanbul ignore next */
|
91
|
+
|
85
92
|
Root.prototype.remove = function remove(child) {
|
86
|
-
_warnOnce2
|
93
|
+
(0, _warnOnce2.default)('Root#remove is deprecated. Use Root#removeChild');
|
87
94
|
this.removeChild(child);
|
88
95
|
};
|
89
96
|
|
97
|
+
/* istanbul ignore next */
|
98
|
+
|
90
99
|
Root.prototype.prevMap = function prevMap() {
|
91
|
-
_warnOnce2
|
100
|
+
(0, _warnOnce2.default)('Root#prevMap is deprecated. Use Root#source.input.map');
|
92
101
|
return this.source.input.map;
|
93
102
|
};
|
94
103
|
|
95
104
|
return Root;
|
96
|
-
})(_container2
|
105
|
+
})(_container2.default);
|
97
106
|
|
98
|
-
exports
|
107
|
+
exports.default = Root;
|
99
108
|
module.exports = exports['default'];
|
package/lib/rule.js
CHANGED
@@ -1,14 +1,8 @@
|
|
1
1
|
'use strict';
|
2
2
|
|
3
|
-
|
4
|
-
|
5
|
-
var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ('value' in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })();
|
6
|
-
|
7
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
|
3
|
+
var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })();
|
8
4
|
|
9
|
-
|
10
|
-
|
11
|
-
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; }
|
5
|
+
exports.__esModule = true;
|
12
6
|
|
13
7
|
var _container = require('./container');
|
14
8
|
|
@@ -22,21 +16,32 @@ var _list = require('./list');
|
|
22
16
|
|
23
17
|
var _list2 = _interopRequireDefault(_list);
|
24
18
|
|
19
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
20
|
+
|
21
|
+
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
22
|
+
|
23
|
+
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; }
|
24
|
+
|
25
|
+
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; }
|
26
|
+
|
25
27
|
var Rule = (function (_Container) {
|
26
28
|
_inherits(Rule, _Container);
|
27
29
|
|
28
30
|
function Rule(defaults) {
|
29
31
|
_classCallCheck(this, Rule);
|
30
32
|
|
31
|
-
_Container.call(this, defaults);
|
32
|
-
|
33
|
-
|
33
|
+
var _this = _possibleConstructorReturn(this, _Container.call(this, defaults));
|
34
|
+
|
35
|
+
_this.type = 'rule';
|
36
|
+
|
37
|
+
if (!_this.nodes) _this.nodes = [];
|
38
|
+
return _this;
|
34
39
|
}
|
35
40
|
|
36
41
|
_createClass(Rule, [{
|
37
42
|
key: 'selectors',
|
38
43
|
get: function get() {
|
39
|
-
return _list2
|
44
|
+
return _list2.default.comma(this.selector);
|
40
45
|
},
|
41
46
|
set: function set(values) {
|
42
47
|
var match = this.selector ? this.selector.match(/,\s*/) : null;
|
@@ -46,17 +51,21 @@ var Rule = (function (_Container) {
|
|
46
51
|
}, {
|
47
52
|
key: '_selector',
|
48
53
|
get: function get() {
|
49
|
-
|
54
|
+
/* istanbul ignore next */
|
55
|
+
(0, _warnOnce2.default)('Rule#_selector is deprecated. Use Rule#raws.selector');
|
56
|
+
/* istanbul ignore next */
|
50
57
|
return this.raws.selector;
|
51
58
|
},
|
52
59
|
set: function set(val) {
|
53
|
-
|
60
|
+
/* istanbul ignore next */
|
61
|
+
(0, _warnOnce2.default)('Rule#_selector is deprecated. Use Rule#raws.selector');
|
62
|
+
/* istanbul ignore next */
|
54
63
|
this.raws.selector = val;
|
55
64
|
}
|
56
65
|
}]);
|
57
66
|
|
58
67
|
return Rule;
|
59
|
-
})(_container2
|
68
|
+
})(_container2.default);
|
60
69
|
|
61
|
-
exports
|
70
|
+
exports.default = Rule;
|
62
71
|
module.exports = exports['default'];
|
package/lib/stringifier.js
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
|
3
3
|
exports.__esModule = true;
|
4
4
|
|
5
|
-
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(
|
5
|
+
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
6
6
|
|
7
7
|
var defaultRaw = {
|
8
8
|
colon: ': ',
|
@@ -79,8 +79,6 @@ var Stringifier = (function () {
|
|
79
79
|
};
|
80
80
|
|
81
81
|
Stringifier.prototype.body = function body(node) {
|
82
|
-
if (!node.nodes) return;
|
83
|
-
|
84
82
|
var last = node.nodes.length - 1;
|
85
83
|
while (last > 0) {
|
86
84
|
if (node.nodes[last].type !== 'comment') break;
|
@@ -331,5 +329,5 @@ var Stringifier = (function () {
|
|
331
329
|
return Stringifier;
|
332
330
|
})();
|
333
331
|
|
334
|
-
exports
|
332
|
+
exports.default = Stringifier;
|
335
333
|
module.exports = exports['default'];
|
package/lib/stringify.js
CHANGED
@@ -1,17 +1,16 @@
|
|
1
1
|
'use strict';
|
2
2
|
|
3
3
|
exports.__esModule = true;
|
4
|
-
exports
|
5
|
-
|
6
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
|
4
|
+
exports.default = stringify;
|
7
5
|
|
8
6
|
var _stringifier = require('./stringifier');
|
9
7
|
|
10
8
|
var _stringifier2 = _interopRequireDefault(_stringifier);
|
11
9
|
|
10
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
11
|
+
|
12
12
|
function stringify(node, builder) {
|
13
|
-
var str = new _stringifier2
|
13
|
+
var str = new _stringifier2.default(builder);
|
14
14
|
str.stringify(node);
|
15
15
|
}
|
16
|
-
|
17
16
|
module.exports = exports['default'];
|
package/lib/tokenize.js
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
'use strict';
|
2
2
|
|
3
3
|
exports.__esModule = true;
|
4
|
-
exports
|
4
|
+
exports.default = tokenize;
|
5
5
|
var SINGLE_QUOTE = 39; // `''
|
6
6
|
var DOUBLE_QUOTE = 34; // `"'
|
7
7
|
var BACKSLASH = 92; // `\'
|
@@ -169,7 +169,7 @@ function tokenize(input) {
|
|
169
169
|
escape = !escape;
|
170
170
|
}
|
171
171
|
code = css.charCodeAt(next + 1);
|
172
|
-
if (escape &&
|
172
|
+
if (escape && code !== SLASH && code !== SPACE && code !== NEWLINE && code !== TAB && code !== CR && code !== FEED) {
|
173
173
|
next += 1;
|
174
174
|
}
|
175
175
|
tokens.push(['word', css.slice(pos, next + 1), line, pos - offset, line, next - offset]);
|
@@ -219,5 +219,4 @@ function tokenize(input) {
|
|
219
219
|
|
220
220
|
return tokens;
|
221
221
|
}
|
222
|
-
|
223
222
|
module.exports = exports['default'];
|
package/lib/vendor.js
CHANGED
@@ -1,8 +1,7 @@
|
|
1
1
|
'use strict';
|
2
2
|
|
3
3
|
exports.__esModule = true;
|
4
|
-
exports
|
5
|
-
|
4
|
+
exports.default = {
|
6
5
|
prefix: function prefix(prop) {
|
7
6
|
if (prop[0] === '-') {
|
8
7
|
var sep = prop.indexOf('-', 1);
|
@@ -11,7 +10,6 @@ exports['default'] = {
|
|
11
10
|
return '';
|
12
11
|
}
|
13
12
|
},
|
14
|
-
|
15
13
|
unprefixed: function unprefixed(prop) {
|
16
14
|
if (prop[0] === '-') {
|
17
15
|
var sep = prop.indexOf('-', 1);
|
@@ -20,6 +18,5 @@ exports['default'] = {
|
|
20
18
|
return prop;
|
21
19
|
}
|
22
20
|
}
|
23
|
-
|
24
21
|
};
|
25
22
|
module.exports = exports['default'];
|
package/lib/warn-once.js
CHANGED
@@ -1,7 +1,9 @@
|
|
1
1
|
'use strict';
|
2
2
|
|
3
3
|
exports.__esModule = true;
|
4
|
-
exports
|
4
|
+
exports.default = warnOnce;
|
5
|
+
/* istanbul ignore next */
|
6
|
+
|
5
7
|
var printed = {};
|
6
8
|
|
7
9
|
function warnOnce(message) {
|
@@ -10,5 +12,4 @@ function warnOnce(message) {
|
|
10
12
|
|
11
13
|
if (typeof console !== 'undefined' && console.warn) console.warn(message);
|
12
14
|
}
|
13
|
-
|
14
15
|
module.exports = exports['default'];
|
package/lib/warning.js
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
|
3
3
|
exports.__esModule = true;
|
4
4
|
|
5
|
-
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(
|
5
|
+
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
6
6
|
|
7
7
|
var Warning = (function () {
|
8
8
|
function Warning(text) {
|
@@ -27,7 +27,11 @@ var Warning = (function () {
|
|
27
27
|
|
28
28
|
Warning.prototype.toString = function toString() {
|
29
29
|
if (this.node) {
|
30
|
-
return this.node.error(this.text, {
|
30
|
+
return this.node.error(this.text, {
|
31
|
+
plugin: this.plugin,
|
32
|
+
index: this.index,
|
33
|
+
word: this.word
|
34
|
+
}).message;
|
31
35
|
} else if (this.plugin) {
|
32
36
|
return this.plugin + ': ' + this.text;
|
33
37
|
} else {
|
@@ -38,5 +42,5 @@ var Warning = (function () {
|
|
38
42
|
return Warning;
|
39
43
|
})();
|
40
44
|
|
41
|
-
exports
|
45
|
+
exports.default = Warning;
|
42
46
|
module.exports = exports['default'];
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "postcss",
|
3
|
-
"version": "5.0.
|
3
|
+
"version": "5.0.14",
|
4
4
|
"description": "Tool for transforming styles with JS plugins",
|
5
5
|
"engines": {
|
6
6
|
"node": ">=0.12"
|
@@ -26,26 +26,29 @@
|
|
26
26
|
},
|
27
27
|
"devDependencies": {
|
28
28
|
"concat-with-sourcemaps": "1.0.4",
|
29
|
-
"postcss-parser-tests": "5.0.
|
29
|
+
"postcss-parser-tests": "5.0.5",
|
30
30
|
"gulp-json-editor": "2.2.1",
|
31
|
-
"gulp-istanbul": "0.10.
|
32
|
-
"run-sequence": "1.1.
|
33
|
-
"babel-eslint": "
|
34
|
-
"gulp-eslint": "1.
|
35
|
-
"gulp-mocha": "2.
|
36
|
-
"gulp-babel": "
|
31
|
+
"gulp-istanbul": "0.10.3",
|
32
|
+
"run-sequence": "1.1.5",
|
33
|
+
"babel-eslint": "5.0.0-beta6",
|
34
|
+
"gulp-eslint": "1.1.1",
|
35
|
+
"gulp-mocha": "2.2.0",
|
36
|
+
"gulp-babel": "6.1.1",
|
37
37
|
"strip-ansi": "3.0.0",
|
38
|
-
"gulp-shell": "0.5.
|
39
|
-
"yaspeller": "2.
|
40
|
-
"fs-extra": "0.
|
41
|
-
"isparta": "
|
42
|
-
"eslint": "1.
|
43
|
-
"sinon": "1.17.
|
44
|
-
"mocha": "2.3.
|
38
|
+
"gulp-shell": "0.5.1",
|
39
|
+
"yaspeller": "2.6.0",
|
40
|
+
"fs-extra": "0.26.3",
|
41
|
+
"isparta": "4.0.0",
|
42
|
+
"eslint": "1.10.3",
|
43
|
+
"sinon": "1.17.2",
|
44
|
+
"mocha": "2.3.4",
|
45
45
|
"gulp": "3.9.0",
|
46
|
-
"chai": "3.
|
47
|
-
"del": "2.0
|
48
|
-
"babel-
|
46
|
+
"chai": "3.4.1",
|
47
|
+
"del": "2.2.0",
|
48
|
+
"babel-plugin-add-module-exports": "0.1.2",
|
49
|
+
"babel-preset-es2015-loose": "6.1.4",
|
50
|
+
"babel-preset-stage-0": "6.3.13",
|
51
|
+
"babel-core": "6.3.26"
|
49
52
|
},
|
50
53
|
"scripts": {
|
51
54
|
"test": "gulp"
|