diff options
Diffstat (limited to 'node_modules/postcss-normalize-url')
| -rw-r--r-- | node_modules/postcss-normalize-url/CHANGELOG.md | 103 | ||||
| -rw-r--r-- | node_modules/postcss-normalize-url/LICENSE-MIT | 22 | ||||
| -rw-r--r-- | node_modules/postcss-normalize-url/README.md | 60 | ||||
| -rw-r--r-- | node_modules/postcss-normalize-url/dist/index.js | 101 | ||||
| -rw-r--r-- | node_modules/postcss-normalize-url/package.json | 60 |
5 files changed, 346 insertions, 0 deletions
diff --git a/node_modules/postcss-normalize-url/CHANGELOG.md b/node_modules/postcss-normalize-url/CHANGELOG.md new file mode 100644 index 00000000..b315034e --- /dev/null +++ b/node_modules/postcss-normalize-url/CHANGELOG.md @@ -0,0 +1,103 @@ +# 3.0.8 + +* Fixes `@namespace` URL conversion; now the semantics of the URL are preserved + and only the `url(foo)` to `"foo"` optimisation is performed. + +# 3.0.7 + +* Fix `main` field in `package.json`. + +# 3.0.6 + +* Now compiled with Babel 6. + +# 3.0.5 + +* Fixes an issue where base64 encoded OpenType font urls were being erroneously + converted by the module (thanks to @ln-e). + +# 3.0.4 + +* Fixes incorrect minification of empty non-url functions. + +# 3.0.3 + +* Updates postcss-value-parser to version 3 (thanks to @TrySound). + +# 3.0.2 + +* Fixes incorrect minification of chrome-extension urls. + +# 3.0.1 + +* Bump postcss-value-parser to `2.0.2`. + +# 3.0.0 + +* Upgraded to PostCSS 5. + +# 2.1.3 + +* Replaces trim space nodes function with a built in method + of postcss-value-parser. + +# 2.1.2 + +* postcss-normalize-url now uses postcss-value-parser to iterate + url values (thanks to @TrySound). +* Fixed `@namespace` URL reduction behaviour. (thanks to @TrySound). + +# 2.1.1 + +* Increased performance by using a single call to `eachInside` rather than two. + +# 2.1.0 + +* Adds `keepWWW` option. +* Compatibility fixes for `is-absolute-url@2.0.0`. + +# 2.0.3 + +* Fixes an issue where embedded base 64 data was being converted as if it were + a URL. + +# 2.0.2 + +* Addresses an issue where relative path separators were converted to + backslashes on Windows. + +# 2.0.1 + +* Documentation/metadata tweaks for plugin guidelines compatibility. +* Bump css-list to 0.1.0, use instead of postcss.list.space for namespace + rule normalization. + +# 2.0.0 + +* Improved URL detection when using two or more in the same declaration. +* node 0.10 is no longer supported. + +# 1.2.1 + +* Patch to address incorrect transformation of `@document` rules. + +# 1.2.0 + +* Fixes an issue where options could not be passed through. +* Support for normalising URLs in `@namespace` rules. + +# 1.1.0 + +* Now uses the PostCSS `4.1` plugin API. + +# 1.0.2 + +* Adds a JSHint config, code tidied up. + +# 1.0.1 + +* Bug fix; does not transform embedded base 64 or svg images. + +# 1.0.0 + +* Initial release. diff --git a/node_modules/postcss-normalize-url/LICENSE-MIT b/node_modules/postcss-normalize-url/LICENSE-MIT new file mode 100644 index 00000000..fd0e863a --- /dev/null +++ b/node_modules/postcss-normalize-url/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-normalize-url/README.md b/node_modules/postcss-normalize-url/README.md new file mode 100644 index 00000000..6347552d --- /dev/null +++ b/node_modules/postcss-normalize-url/README.md @@ -0,0 +1,60 @@ +# [postcss][postcss]-normalize-url [][ci] [][npm] [][deps] + +> [Normalize URLs](https://github.com/sindresorhus/normalize-url) with PostCSS. + +## Install + +With [npm](https://npmjs.org/package/postcss-normalize-url) do: + +``` +npm install postcss-normalize-url --save +``` + +## Example + +### Input + +```css +h1 { + background: url("http://site.com:80/image.jpg") +} +``` + +### Output + +```css +h1 { + background: url(http://site.com/image.jpg) +} +``` + +Note that this module will also try to normalize relative URLs, and is capable +of stripping unnecessary quotes. For more examples, see the [tests](test.js). + +## Usage + +See the [PostCSS documentation](https://github.com/postcss/postcss#usage) for +examples for your environment. + +## API + +### normalize([options]) + +Please see the [normalize-url documentation][docs]. By default, +`normalizeProtocol` & `stripFragment` are set to `false`; `stripWWW` to `true`. + +## Contributing + +Pull requests are welcome. If you add functionality, then please add unit tests +to cover it. + +## License + +MIT © [Ben Briggs](http://beneb.info) + +[docs]: https://github.com/sindresorhus/normalize-url#options + +[ci]: https://travis-ci.org/ben-eb/postcss-normalize-url +[deps]: https://gemnasium.com/ben-eb/postcss-normalize-url +[npm]: http://badge.fury.io/js/postcss-normalize-url +[postcss]: https://github.com/postcss/postcss diff --git a/node_modules/postcss-normalize-url/dist/index.js b/node_modules/postcss-normalize-url/dist/index.js new file mode 100644 index 00000000..5b0857c4 --- /dev/null +++ b/node_modules/postcss-normalize-url/dist/index.js @@ -0,0 +1,101 @@ +'use strict'; + +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 _path = require('path'); + +var _path2 = _interopRequireDefault(_path); + +var _postcss = require('postcss'); + +var _postcss2 = _interopRequireDefault(_postcss); + +var _postcssValueParser = require('postcss-value-parser'); + +var _postcssValueParser2 = _interopRequireDefault(_postcssValueParser); + +var _normalizeUrl = require('normalize-url'); + +var _normalizeUrl2 = _interopRequireDefault(_normalizeUrl); + +var _isAbsoluteUrl = require('is-absolute-url'); + +var _isAbsoluteUrl2 = _interopRequireDefault(_isAbsoluteUrl); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +var multiline = /\\[\r\n]/; +var escapeChars = /([\s\(\)"'])/g; + +function convert(url, options) { + if ((0, _isAbsoluteUrl2.default)(url) || !url.indexOf('//')) { + return (0, _normalizeUrl2.default)(url, options); + } + return _path2.default.normalize(url).replace(new RegExp('\\' + _path2.default.sep, 'g'), '/'); +} + +function transformNamespace(rule) { + rule.params = (0, _postcssValueParser2.default)(rule.params).walk(function (node) { + if (node.type === 'function' && node.value === 'url' && node.nodes.length) { + node.type = 'string'; + node.quote = node.nodes[0].quote || '"'; + node.value = node.nodes[0].value; + } + if (node.type === 'string') { + node.value = node.value.trim(); + } + return false; + }).toString(); +} + +function transformDecl(decl, opts) { + decl.value = (0, _postcssValueParser2.default)(decl.value).walk(function (node) { + if (node.type !== 'function' || node.value !== 'url' || !node.nodes.length) { + return false; + } + + var url = node.nodes[0]; + var escaped = void 0; + + node.before = node.after = ''; + url.value = url.value.trim().replace(multiline, ''); + + if (~url.value.indexOf('data:image/') || ~url.value.indexOf('data:application/') || ~url.value.indexOf('data:font/')) { + return false; + } + + if (!~url.value.indexOf('chrome-extension')) { + url.value = convert(url.value, opts); + } + + if (escapeChars.test(url.value)) { + escaped = url.value.replace(escapeChars, '\\$1'); + if (escaped.length < url.value.length + (url.type === 'string' ? 2 : 0)) { + url.value = escaped; + url.type = 'word'; + } + } else { + url.type = 'word'; + } + + return false; + }).toString(); +} + +module.exports = _postcss2.default.plugin('postcss-normalize-url', function (opts) { + opts = _extends({ + normalizeProtocol: false, + stripFragment: false, + stripWWW: true + }, opts); + + return function (css) { + css.walk(function (node) { + if (node.type === 'decl') { + return transformDecl(node, opts); + } else if (node.type === 'atrule' && node.name === 'namespace') { + return transformNamespace(node); + } + }); + }; +});
\ No newline at end of file diff --git a/node_modules/postcss-normalize-url/package.json b/node_modules/postcss-normalize-url/package.json new file mode 100644 index 00000000..11afd499 --- /dev/null +++ b/node_modules/postcss-normalize-url/package.json @@ -0,0 +1,60 @@ +{ + "name": "postcss-normalize-url", + "version": "3.0.8", + "description": "Normalize URLs with PostCSS", + "main": "dist/index.js", + "files": [ + "dist", + "LICENSE-MIT" + ], + "scripts": { + "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__" + }, + "keywords": [ + "css", + "normalize", + "optimise", + "optimisation", + "postcss", + "postcss-plugin", + "url" + ], + "license": "MIT", + "dependencies": { + "is-absolute-url": "^2.0.0", + "normalize-url": "^1.4.0", + "postcss": "^5.0.14", + "postcss-value-parser": "^3.2.3" + }, + "devDependencies": { + "ava": "^0.17.0", + "babel-cli": "^6.3.17", + "babel-core": "^6.3.26", + "babel-plugin-add-module-exports": "^0.2.1", + "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": "^2.0.1" + }, + "homepage": "https://github.com/ben-eb/postcss-normalize-url", + "author": { + "name": "Ben Briggs", + "email": "beneb.info@gmail.com", + "url": "http://beneb.info" + }, + "repository": "ben-eb/postcss-normalize-url", + "eslintConfig": { + "extends": "cssnano" + }, + "ava": { + "require": "babel-register" + } +} |
