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-svgo/CHANGELOG.md | 67 ++++++++++++ node_modules/postcss-svgo/LICENSE-MIT | 22 ++++ node_modules/postcss-svgo/README.md | 130 +++++++++++++++++++++++ node_modules/postcss-svgo/dist/index.js | 108 +++++++++++++++++++ node_modules/postcss-svgo/dist/lib/url.js | 9 ++ node_modules/postcss-svgo/node_modules/.bin/svgo | 1 + node_modules/postcss-svgo/package.json | 67 ++++++++++++ 7 files changed, 404 insertions(+) create mode 100644 node_modules/postcss-svgo/CHANGELOG.md create mode 100644 node_modules/postcss-svgo/LICENSE-MIT create mode 100644 node_modules/postcss-svgo/README.md create mode 100644 node_modules/postcss-svgo/dist/index.js create mode 100644 node_modules/postcss-svgo/dist/lib/url.js create mode 120000 node_modules/postcss-svgo/node_modules/.bin/svgo create mode 100644 node_modules/postcss-svgo/package.json (limited to 'node_modules/postcss-svgo') diff --git a/node_modules/postcss-svgo/CHANGELOG.md b/node_modules/postcss-svgo/CHANGELOG.md new file mode 100644 index 00000000..4a547e8f --- /dev/null +++ b/node_modules/postcss-svgo/CHANGELOG.md @@ -0,0 +1,67 @@ +# 2.1.6 + +* Resolves an issue where postcss-svgo would convert colours to hex codes + without URL-encoding the `#`. + +# 2.1.5 + +* Bump svgo to v0.7.x. + +# 2.1.4 + +* Fixes an issue where postcss-svgo would throw with some SVGs that were + not properly URI encoded. + +# 2.1.3 + +* Upgrade is-svg to version 2. + +# 2.1.2 + +* Fixes an issue with processing some malformed URIs (thanks to @TrySound). + +# 2.1.1 + +* Bump SVGO to 0.6.1 (thanks to @shinnn). + +# 2.1.0 + +* Adds `encode` option (thanks to @TrySound). + +# 2.0.4 + +* Updates postcss-value-parser to version 3 (thanks to @TrySound). + +# 2.0.3 + +* Uses postcss-value-parser instead of async-replace to reduce cssnano's + download size (thanks to @TrySound). + +# 2.0.2 + +* Fixed an issue where the module was not handling exceptions from + decoding URLs. +* The module will now convert all SVG wrapping quotes to single quotes, which + is consistent with SVGO's output. + +# 2.0.1 + +* Fixed an issue where the `charset` definition was being removed from the + SVG source, breaking IE compatibility (thanks to @ophyros). + +# 2.0.0 + +* Upgraded to PostCSS 5.0. + +# 1.1.0 + +* Adds support for uri-encoded SVG files, for better compatibility + with postcss-svg. + +# 1.0.1 + +* Push ES5 build to npm. + +# 1.0.0 + +* Initial release. diff --git a/node_modules/postcss-svgo/LICENSE-MIT b/node_modules/postcss-svgo/LICENSE-MIT new file mode 100644 index 00000000..fd0e863a --- /dev/null +++ b/node_modules/postcss-svgo/LICENSE-MIT @@ -0,0 +1,22 @@ +Copyright (c) Ben Briggs (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-svgo/README.md b/node_modules/postcss-svgo/README.md new file mode 100644 index 00000000..59a685e7 --- /dev/null +++ b/node_modules/postcss-svgo/README.md @@ -0,0 +1,130 @@ +# [postcss][postcss]-svgo [![Build Status](https://travis-ci.org/ben-eb/postcss-svgo.svg?branch=master)][ci] [![NPM version](https://badge.fury.io/js/postcss-svgo.svg)][npm] [![Dependency Status](https://gemnasium.com/ben-eb/postcss-svgo.svg)][deps] + +> Optimise inline SVG with PostCSS. + + +## Install + +With [npm](https://npmjs.org/package/postcss-svgo) do: + +``` +npm install postcss-svgo --save +``` + + +## Example + +### Input + +```css +h1 { + background: url('data:image/svg+xml;charset=utf-8,'); +} +``` + +### Output + +```css +h1 { + background: url('data:image/svg+xml;charset=utf-8,'); +} +``` + + +## API + +### `svgo([options])` + +Note that postcss-svgo is an *asynchronous* processor. It cannot be used +like this: + +```js +var result = postcss([ svgo() ]).process(css).css; +console.log(result); +``` + +Instead make sure your PostCSS runner uses the asynchronous API: + +```js +postcss([ svgo() ]).process(css).then(function (result) { + console.log(result.css); +}); +``` + +#### options + +##### encode + +Type: `boolean` +Default: `undefined` + +If `true`, it will encode URL-unsafe characters such as `<`, `>` and `&`; +`false` will decode these characters, and `undefined` will neither encode nor +decode the original input. Note that regardless of this setting, `#` will +always be URL-encoded. + +##### plugins + +Optionally, you can customise the output by specifying the `plugins` option. You +will need to provide the config in comma separated objects, like the example +below. Note that you can either disable the plugin by setting it to `false`, +or pass different options to change the default behaviour. + +```js +var postcss = require('postcss'); +var svgo = require('postcss-svgo'); + +var opts = { + plugins: [{ + removeDoctype: false + }, { + removeComments: false + }, { + cleanupNumericValues: { + floatPrecision: 2 + } + }, { + convertColors: { + names2hex: false, + rgb2hex: false + } + }] +}; + +postcss([ svgo(opts) ]).process(css).then(function (result) { + console.log(result.css) +}); +``` + +You can view the [full list of plugins here][plugins]. + + +## 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)): + + +| [
Ben Briggs](http://beneb.info)
[๐Ÿ’ป](https://github.com/ben-eb/postcss-svgo/commits?author=ben-eb) [๐Ÿ“–](https://github.com/ben-eb/postcss-svgo/commits?author=ben-eb) ๐Ÿ‘€ [โš ๏ธ](https://github.com/ben-eb/postcss-svgo/commits?author=ben-eb) | [
Sebastian Misch](https://sebastian-misch.de)
[๐Ÿ’ป](https://github.com/ben-eb/postcss-svgo/commits?author=sbstnmsch) [โš ๏ธ](https://github.com/ben-eb/postcss-svgo/commits?author=sbstnmsch) | [
ะ’ัั‡ะตัะปะฐะฒ ะ›ััˆะตะฝะบะพ](https://github.com/ophyros)
[๐Ÿ’ป](https://github.com/ben-eb/postcss-svgo/commits?author=ophyros) [โš ๏ธ](https://github.com/ben-eb/postcss-svgo/commits?author=ophyros) | [
shinnn](https://shinnn.github.io)
[๐Ÿ’ป](https://github.com/ben-eb/postcss-svgo/commits?author=shinnn) | [
Jung-gun Lim](https://github.com/j6lim)
[๐Ÿ›](https://github.com/ben-eb/postcss-svgo/issues?q=author%3Aj6lim) | [
Bogdan Chadkin](https://github.com/TrySound)
[๐Ÿ’ป](https://github.com/ben-eb/postcss-svgo/commits?author=TrySound) ๐Ÿ‘€ [โš ๏ธ](https://github.com/ben-eb/postcss-svgo/commits?author=TrySound) | [
Piotr Walczyszyn](http://outof.me)
[๐Ÿ›](https://github.com/ben-eb/postcss-svgo/issues?q=author%3Apwalczyszyn) | +| :---: | :---: | :---: | :---: | :---: | :---: | :---: | + + +This project follows the [all-contributors] specification. Contributions of +any kind welcome! + +## License + +MIT ยฉ [Ben Briggs](http://beneb.info) + + +[all-contributors]: https://github.com/kentcdodds/all-contributors +[ci]: https://travis-ci.org/ben-eb/postcss-svgo +[deps]: https://gemnasium.com/ben-eb/postcss-svgo +[npm]: http://badge.fury.io/js/postcss-svgo +[postcss]: https://github.com/postcss/postcss +[plugins]: https://github.com/svg/svgo/tree/master/plugins diff --git a/node_modules/postcss-svgo/dist/index.js b/node_modules/postcss-svgo/dist/index.js new file mode 100644 index 00000000..466a6356 --- /dev/null +++ b/node_modules/postcss-svgo/dist/index.js @@ -0,0 +1,108 @@ +'use strict'; + +exports.__esModule = true; + +var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; + +var _postcss = require('postcss'); + +var _postcss2 = _interopRequireDefault(_postcss); + +var _postcssValueParser = require('postcss-value-parser'); + +var _postcssValueParser2 = _interopRequireDefault(_postcssValueParser); + +var _svgo = require('svgo'); + +var _svgo2 = _interopRequireDefault(_svgo); + +var _isSvg = require('is-svg'); + +var _isSvg2 = _interopRequireDefault(_isSvg); + +var _url = require('./lib/url'); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +var PLUGIN = 'postcss-svgo'; +var dataURI = /data:image\/svg\+xml(;(charset=)?utf-8)?,/; + +function minifyPromise(svgo, decl, opts) { + var promises = []; + + decl.value = (0, _postcssValueParser2.default)(decl.value).walk(function (node) { + if (node.type !== 'function' || node.value !== 'url' || !node.nodes.length) { + return; + } + var value = node.nodes[0].value; + + var decodedUri = void 0, + isUriEncoded = void 0; + + try { + decodedUri = (0, _url.decode)(value); + isUriEncoded = decodedUri !== value; + } catch (e) { + // Swallow exception if we cannot decode the value + isUriEncoded = false; + } + + if (isUriEncoded) { + value = decodedUri; + } + if (opts.encode !== undefined) { + isUriEncoded = opts.encode; + } + + var svg = value.replace(dataURI, ''); + + if (!(0, _isSvg2.default)(svg)) { + return; + } + + promises.push(new Promise(function (resolve, reject) { + return svgo.optimize(svg, function (result) { + if (result.error) { + return reject(PLUGIN + ': ' + result.error); + } + var data = isUriEncoded ? (0, _url.encode)(result.data) : result.data; + // Should always encode # otherwise we yield a broken SVG + // in Firefox (works in Chrome however). See this issue: + // https://github.com/ben-eb/cssnano/issues/245 + data = data.replace(/#/g, '%23'); + node.nodes[0] = _extends({}, node.nodes[0], { + value: 'data:image/svg+xml;charset=utf-8,' + data, + quote: isUriEncoded ? '"' : '\'', + type: 'string', + before: '', + after: '' + }); + return resolve(); + }); + })); + + return false; + }); + + return Promise.all(promises).then(function () { + return decl.value = decl.value.toString(); + }); +} + +exports.default = _postcss2.default.plugin(PLUGIN, function () { + var opts = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; + + var svgo = new _svgo2.default(opts); + return function (css) { + return new Promise(function (resolve, reject) { + var promises = []; + css.walkDecls(function (decl) { + if (dataURI.test(decl.value)) { + promises.push(minifyPromise(svgo, decl, opts)); + } + }); + return Promise.all(promises).then(resolve, reject); + }); + }; +}); +module.exports = exports['default']; \ No newline at end of file diff --git a/node_modules/postcss-svgo/dist/lib/url.js b/node_modules/postcss-svgo/dist/lib/url.js new file mode 100644 index 00000000..21aaa158 --- /dev/null +++ b/node_modules/postcss-svgo/dist/lib/url.js @@ -0,0 +1,9 @@ +'use strict'; + +exports.__esModule = true; +exports.encode = encode; +function encode(data) { + return data.replace(/"/g, '\'').replace(/%/g, '%25').replace(//g, '%3E').replace(/&/g, '%26').replace(/#/g, '%23').replace(/\s+/g, ' '); +}; + +var decode = exports.decode = decodeURIComponent; \ No newline at end of file diff --git a/node_modules/postcss-svgo/node_modules/.bin/svgo b/node_modules/postcss-svgo/node_modules/.bin/svgo new file mode 120000 index 00000000..a8d8be9a --- /dev/null +++ b/node_modules/postcss-svgo/node_modules/.bin/svgo @@ -0,0 +1 @@ +../../../svgo/bin/svgo \ No newline at end of file diff --git a/node_modules/postcss-svgo/package.json b/node_modules/postcss-svgo/package.json new file mode 100644 index 00000000..a5ebd016 --- /dev/null +++ b/node_modules/postcss-svgo/package.json @@ -0,0 +1,67 @@ +{ + "name": "postcss-svgo", + "version": "2.1.6", + "description": "Optimise inline SVG with PostCSS.", + "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__/", + "report": "nyc report --reporter=html", + "test": "nyc --reporter=text ava src/__tests__", + "test-012": "nyc --reporter=text ava src/__tests__" + }, + "files": [ + "LICENSE-MIT", + "dist" + ], + "keywords": [ + "css", + "minify", + "optimise", + "postcss", + "postcss-plugin", + "svg", + "svgo" + ], + "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", + "coveralls": "^2.11.6", + "del-cli": "^0.2.0", + "eslint": "^3.0.0", + "eslint-config-cssnano": "^3.0.0", + "eslint-plugin-babel": "^3.3.0", + "eslint-plugin-import": "^2.0.1", + "nyc": "^10.0.0", + "pleeease-filters": "^3.0.0" + }, + "homepage": "https://github.com/ben-eb/postcss-svgo", + "author": { + "name": "Ben Briggs", + "email": "beneb.info@gmail.com", + "url": "http://beneb.info" + }, + "repository": "ben-eb/postcss-svgo", + "dependencies": { + "is-svg": "^2.0.0", + "postcss": "^5.0.14", + "postcss-value-parser": "^3.2.3", + "svgo": "^0.7.0" + }, + "ava": { + "require": "babel-register" + }, + "eslintConfig": { + "extends": "cssnano" + } +} -- cgit v1.2.3