From 26105034da4fcce7ac883c899d781f016559310d Mon Sep 17 00:00:00 2001 From: ruki Date: Thu, 8 Nov 2018 00:38:48 +0800 Subject: switch to vuepress --- node_modules/postcss-filter-plugins/dist/index.js | 100 ++++++++++++++++++++++ 1 file changed, 100 insertions(+) create mode 100644 node_modules/postcss-filter-plugins/dist/index.js (limited to 'node_modules/postcss-filter-plugins/dist') diff --git a/node_modules/postcss-filter-plugins/dist/index.js b/node_modules/postcss-filter-plugins/dist/index.js new file mode 100644 index 00000000..23307387 --- /dev/null +++ b/node_modules/postcss-filter-plugins/dist/index.js @@ -0,0 +1,100 @@ +'use strict'; + +exports.__esModule = true; + +var _postcss = require('postcss'); + +var _postcss2 = _interopRequireDefault(_postcss); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +exports.default = _postcss2.default.plugin('postcss-filter-plugins', function () { + var _ref = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}, + _ref$template = _ref.template, + template = _ref$template === undefined ? function (_ref2) { + var postcssPlugin = _ref2.postcssPlugin; + return 'Found duplicate plugin: ' + postcssPlugin; + } : _ref$template, + _ref$silent = _ref.silent, + silent = _ref$silent === undefined ? false : _ref$silent, + _ref$exclude = _ref.exclude, + exclude = _ref$exclude === undefined ? [] : _ref$exclude, + _ref$direction = _ref.direction, + direction = _ref$direction === undefined ? 'both' : _ref$direction; + + var id = Math.random().toString(); + var prev = void 0, + next = void 0, + both = void 0; + + switch (direction) { + case 'both': + both = true; + break; + case 'backward': + prev = true; + break; + case 'forward': + next = true; + break; + } + + var processor = function processor(css, result) { + var previousPlugins = []; + var nextPlugins = []; + var bothPlugins = []; + var filter = false; + var position = 0; + + var detect = function detect(list, plugin) { + var name = plugin.postcssPlugin; + if (typeof name === 'undefined') { + position++; + return; + } + if (~list.indexOf(name)) { + if (!silent) { + result.warn(template(plugin)); + } + result.processor.plugins.splice(position, 1); + } else { + list.push(name); + position++; + } + }; + + while (position < result.processor.plugins.length) { + var plugin = result.processor.plugins[position]; + if (~exclude.indexOf(plugin.postcssPlugin)) { + position++; + continue; + } + if (plugin._id === id) { + position++; + filter = true; + continue; + } else if (plugin.postcssPlugin === 'postcss-filter-plugins') { + position++; + continue; + } + if (both) { + detect(bothPlugins, plugin); + continue; + } + if (filter && next) { + detect(nextPlugins, plugin); + continue; + } + if (!filter && prev) { + detect(previousPlugins, plugin); + continue; + } + position++; + } + }; + + processor._id = id; + + return processor; +}); +module.exports = exports['default']; \ No newline at end of file -- cgit v1.2.3