diff options
| author | ruki <waruqi@gmail.com> | 2018-11-08 00:38:48 +0800 |
|---|---|---|
| committer | ruki <waruqi@gmail.com> | 2018-11-07 21:53:09 +0800 |
| commit | 26105034da4fcce7ac883c899d781f016559310d (patch) | |
| tree | c459a5dc4e3aa0972d9919033ece511ce76dd129 /node_modules/postcss-filter-plugins | |
| parent | 2c77f00f1a7ecb6c8192f9c16d3b2001b254a107 (diff) | |
| download | xmake-docs-26105034da4fcce7ac883c899d781f016559310d.tar.gz xmake-docs-26105034da4fcce7ac883c899d781f016559310d.zip | |
switch to vuepress
Diffstat (limited to 'node_modules/postcss-filter-plugins')
| -rw-r--r-- | node_modules/postcss-filter-plugins/CHANGELOG.md | 24 | ||||
| -rw-r--r-- | node_modules/postcss-filter-plugins/LICENSE-MIT | 22 | ||||
| -rw-r--r-- | node_modules/postcss-filter-plugins/README.md | 132 | ||||
| -rw-r--r-- | node_modules/postcss-filter-plugins/dist/index.js | 100 | ||||
| -rw-r--r-- | node_modules/postcss-filter-plugins/package.json | 56 |
5 files changed, 334 insertions, 0 deletions
diff --git a/node_modules/postcss-filter-plugins/CHANGELOG.md b/node_modules/postcss-filter-plugins/CHANGELOG.md new file mode 100644 index 00000000..317bfe83 --- /dev/null +++ b/node_modules/postcss-filter-plugins/CHANGELOG.md @@ -0,0 +1,24 @@ +# 2.0.3 + +* Remove vulnerable downstream dependency + +# 2.0.2 + +* Bumped uniqid to `4.0.0`. + +# 2.0.1 + +* Bumped uniqid to `3.0.0` (thanks to @papandreou). + +# 2.0.0 + +* Upgraded to PostCSS 5. + +# 1.0.1 + +* Fixes an integration issue with cssnano & cssnext, caused by processors that + do not expose a `postcssPlugin` property. + +# 1.0.0 + +* Initial release. diff --git a/node_modules/postcss-filter-plugins/LICENSE-MIT b/node_modules/postcss-filter-plugins/LICENSE-MIT new file mode 100644 index 00000000..fd0e863a --- /dev/null +++ b/node_modules/postcss-filter-plugins/LICENSE-MIT @@ -0,0 +1,22 @@ +Copyright (c) Ben Briggs <beneb.info@gmail.com> (http://beneb.info) + +Permission is hereby granted, free of charge, to any person +obtaining a copy of this software and associated documentation +files (the "Software"), to deal in the Software without +restriction, including without limitation the rights to use, +copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the +Software is furnished to do so, subject to the following +conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES +OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT +HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +OTHER DEALINGS IN THE SOFTWARE. diff --git a/node_modules/postcss-filter-plugins/README.md b/node_modules/postcss-filter-plugins/README.md new file mode 100644 index 00000000..4627bc61 --- /dev/null +++ b/node_modules/postcss-filter-plugins/README.md @@ -0,0 +1,132 @@ +# [postcss][postcss]-filter-plugins [][ci] + +> Exclude/warn on duplicated PostCSS plugins. + +## Install + +With [npm](https://npmjs.org/package/postcss-filter-plugins) do: + +```console +$ npm install postcss-filter-plugins --save +``` + +## Example + +Note that this plugin does not actually transform your CSS; instead, it ensures +that plugins in the PostCSS instance are not duplicated. It is intended to be +used by plugin packs such as [cssnano] or [cssnext]. + +```js +var counter = postcss.plugin('counter', function () { + return function (css) { + css.eachDecl('foo', function (decl) { + let value = parseInt(decl.value, 10); + value += 1; + decl.value = String(value); + }); + } +}); + +var css = 'h1 { foo: 1 }'; +var out = postcss([ + filter(), + counter(), + counter() +]).process(css).css; + +console.log(out); +// => h1 { foo: 2 } +// Note that you will get a PostCSS warning in the message registry +``` + +## API + +### filterPlugins([options]) + +#### options + +##### direction + +Type: `string` +Default: `'both'` + +Pass `'forward'`, `'backward'`, or `'both'` to customise the direction in which the +plugin will look in the plugins array. See the [tests] for examples on how this +works. + +```js +postcss([ filter({ + direction: 'forward' +}) ]).process(css).css); +``` + +##### exclude + +Type: `array` +Default: `[] (empty)` + +Plugins that should be excluded from the filter. Pass an array of plugin names. + +```js +postcss([ filter({ + exclude: ['postcss-cssstats'] +}) ]).process(css).css); +``` + +##### silent + +Type: `boolean` +Default: `false` + +Set this to true to disable the plugin from emitting any PostCSS warnings. + +```js +postcss([ filter({ + silent: true +}) ]).process(css).css); +``` + +##### template + +Type: `function` +Default: `format function` + +This function will be passed each PostCSS plugin object. You are expected to +return a string from each call, which is then used to warn the user about her +duplicated plugins. + +```js +postcss([ filter({ + template: function (plugin) { + return 'Duplicate plugin found: ' + plugin.postcssPlugin; + } +}) ]).process(css).css); +``` + +## Usage + +See the [PostCSS documentation](https://github.com/postcss/postcss#usage) for +examples for your environment. + +## Contributors + +Thanks goes to these wonderful people ([emoji key](https://github.com/kentcdodds/all-contributors#emoji-key)): + +<!-- ALL-CONTRIBUTORS-LIST:START - Do not remove or modify this section --> +| [<img src="https://avatars.githubusercontent.com/u/1282980?v=3" width="100px;"/><br /><sub>Ben Briggs</sub>](http://beneb.info)<br />[💻](https://github.com/postcss/postcss-filter-plugins/commits?author=ben-eb) [📖](https://github.com/postcss/postcss-filter-plugins/commits?author=ben-eb) 👀 [⚠️](https://github.com/postcss/postcss-filter-plugins/commits?author=ben-eb) | [<img src="https://avatars.githubusercontent.com/u/157534?v=3" width="100px;"/><br /><sub>Maxime Thirouin</sub>](https://moox.io/)<br />[📖](https://github.com/postcss/postcss-filter-plugins/commits?author=MoOx) | [<img src="https://avatars.githubusercontent.com/u/373545?v=3" width="100px;"/><br /><sub>Andreas Lind</sub>](https://github.com/papandreou)<br />[💻](https://github.com/postcss/postcss-filter-plugins/commits?author=papandreou) | +| :---: | :---: | :---: | +<!-- ALL-CONTRIBUTORS-LIST:END --> + +This project follows the [all-contributors](https://github.com/kentcdodds/all-contributors) specification. +Contributions of any kind welcome! + + +## License + +MIT © [Ben Briggs](http://beneb.info) + +[ci]: https://travis-ci.org/postcss/postcss-filter-plugins +[cssnano]: http://cssnano.co +[cssnext]: http://cssnext.io +[postcss]: https://github.com/postcss/postcss +[tests]: src/__tests__ 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 diff --git a/node_modules/postcss-filter-plugins/package.json b/node_modules/postcss-filter-plugins/package.json new file mode 100644 index 00000000..2181eabb --- /dev/null +++ b/node_modules/postcss-filter-plugins/package.json @@ -0,0 +1,56 @@ +{ + "name": "postcss-filter-plugins", + "version": "2.0.3", + "description": "Exclude/warn on duplicated PostCSS plugins.", + "main": "dist/index.js", + "scripts": { + "contributorAdd": "all-contributors add", + "contributorGenerate": "all-contributors generate", + "pretest": "eslint src", + "prepublish": "del-cli dist && BABEL_ENV=publish babel src --out-dir dist --ignore /__tests__/", + "test": "ava src/__tests__/", + "test-012": "ava src/__tests__/" + }, + "files": [ + "LICENSE-MIT", + "dist" + ], + "keywords": [ + "css", + "postcss", + "postcss-plugin" + ], + "license": "MIT", + "devDependencies": { + "all-contributors-cli": "^3.0.5", + "ava": "^0.16.0", + "babel-cli": "^6.4.5", + "babel-core": "^6.4.5", + "babel-plugin-add-module-exports": "^0.2.0", + "babel-preset-es2015": "^6.3.13", + "babel-preset-es2015-loose": "^7.0.0", + "babel-preset-stage-0": "^6.3.13", + "babel-register": "^6.9.0", + "del-cli": "^0.2.0", + "eslint": "^3.0.0", + "eslint-config-cssnano": "^3.0.0", + "eslint-plugin-babel": "^3.3.0", + "eslint-plugin-import": "^1.10.2" + }, + "homepage": "https://github.com/postcss/postcss-filter-plugins", + "author": { + "name": "Ben Briggs", + "email": "beneb.info@gmail.com", + "url": "http://beneb.info" + }, + "repository": "postcss/postcss-filter-plugins", + "dependencies": { + "postcss": "^5.0.4" + }, + "ava": { + "require": "babel-register" + }, + "eslintConfig": { + "extends": "cssnano" + } +} |
