123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264 |
- "use strict";
- exports.__esModule = true;
- exports.default = void 0;
- var _lazyResult = _interopRequireDefault(require("./lazy-result"));
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
- 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); }
- 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); }
- 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; }
- var Processor = function () {
-
- function Processor(plugins) {
- if (plugins === void 0) {
- plugins = [];
- }
-
- this.version = '7.0.39';
-
- this.plugins = this.normalize(plugins);
- }
-
- var _proto = Processor.prototype;
- _proto.use = function use(plugin) {
- this.plugins = this.plugins.concat(this.normalize([plugin]));
- return this;
- }
-
- ;
- _proto.process = function (_process) {
- function process(_x) {
- return _process.apply(this, arguments);
- }
- process.toString = function () {
- return _process.toString();
- };
- return process;
- }(function (css, opts) {
- if (opts === void 0) {
- opts = {};
- }
- if (this.plugins.length === 0 && opts.parser === opts.stringifier) {
- if (process.env.NODE_ENV !== 'production') {
- if (typeof console !== 'undefined' && console.warn) {
- console.warn('You did not set any plugins, parser, or stringifier. ' + 'Right now, PostCSS does nothing. Pick plugins for your case ' + 'on https://www.postcss.parts/ and use them in postcss.config.js.');
- }
- }
- }
- return new _lazyResult.default(this, css, opts);
- });
- _proto.normalize = function normalize(plugins) {
- var normalized = [];
- for (var _iterator = _createForOfIteratorHelperLoose(plugins), _step; !(_step = _iterator()).done;) {
- var i = _step.value;
- if (i.postcss === true) {
- var plugin = i();
- throw new Error('PostCSS plugin ' + plugin.postcssPlugin + ' requires PostCSS 8.\n' + 'Migration guide for end-users:\n' + 'https://github.com/postcss/postcss/wiki/PostCSS-8-for-end-users');
- }
- if (i.postcss) i = i.postcss;
- if (typeof i === 'object' && Array.isArray(i.plugins)) {
- normalized = normalized.concat(i.plugins);
- } else if (typeof i === 'function') {
- normalized.push(i);
- } else if (typeof i === 'object' && (i.parse || i.stringify)) {
- if (process.env.NODE_ENV !== 'production') {
- throw new Error('PostCSS syntaxes cannot be used as plugins. Instead, please use ' + 'one of the syntax/parser/stringifier options as outlined ' + 'in your PostCSS runner documentation.');
- }
- } else if (typeof i === 'object' && i.postcssPlugin) {
- throw new Error('PostCSS plugin ' + i.postcssPlugin + ' requires PostCSS 8.\n' + 'Migration guide for end-users:\n' + 'https://github.com/postcss/postcss/wiki/PostCSS-8-for-end-users');
- } else {
- throw new Error(i + ' is not a PostCSS plugin');
- }
- }
- return normalized;
- };
- return Processor;
- }();
- var _default = Processor;
- exports.default = _default;
- module.exports = exports.default;
|