3 exports.__esModule = true;
5 var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol ? "symbol" : typeof obj; };
7 var _lazyResult = require('./lazy-result');
9 var _lazyResult2 = _interopRequireDefault(_lazyResult);
11 function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
13 function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
15 var Processor = function () {
16 function Processor() {
17 var plugins = arguments.length <= 0 || arguments[0] === undefined ? [] : arguments[0];
19 _classCallCheck(this, Processor);
21 this.version = '5.0.14';
23 this.plugins = this.normalize(plugins);
26 Processor.prototype.use = function use(plugin) {
27 this.plugins = this.plugins.concat(this.normalize([plugin]));
31 Processor.prototype.process = function process(css) {
32 var opts = arguments.length <= 1 || arguments[1] === undefined ? {} : arguments[1];
34 return new _lazyResult2.default(this, css, opts);
37 Processor.prototype.normalize = function normalize(plugins) {
39 for (var _iterator = plugins, _isArray = Array.isArray(_iterator), _i = 0, _iterator = _isArray ? _iterator : _iterator[Symbol.iterator]();;) {
43 if (_i >= _iterator.length) break;
44 _ref = _iterator[_i++];
46 _i = _iterator.next();
53 if (i.postcss) i = i.postcss;
55 if ((typeof i === 'undefined' ? 'undefined' : _typeof(i)) === 'object' && Array.isArray(i.plugins)) {
56 normalized = normalized.concat(i.plugins);
57 } else if (typeof i === 'function') {
60 throw new Error(i + ' is not a PostCSS plugin');
69 exports.default = Processor;
70 module.exports = exports['default'];