diff options
| author | littleblack111 <littleblack11111@gmail.com> | 2026-05-18 23:10:59 +0800 |
|---|---|---|
| committer | littleblack111 <littleblack11111@gmail.com> | 2026-05-18 23:41:44 +0800 |
| commit | fc87c009806dcc98867f6b58efe29b042aa01dee (patch) | |
| tree | 8f59b3f4a5b66e9dfef2d40c8d318e258a521228 /node_modules/postcss-normalize-url | |
| parent | 3336b2356ee6152d9c6ae59bd9b87ccbc0958407 (diff) | |
node: updatemain
Diffstat (limited to 'node_modules/postcss-normalize-url')
| -rw-r--r-- | node_modules/postcss-normalize-url/LICENSE-MIT | 22 | ||||
| -rw-r--r-- | node_modules/postcss-normalize-url/README.md | 48 | ||||
| -rw-r--r-- | node_modules/postcss-normalize-url/package.json | 44 | ||||
| -rw-r--r-- | node_modules/postcss-normalize-url/src/index.js | 151 | ||||
| -rw-r--r-- | node_modules/postcss-normalize-url/src/normalize.js | 153 | ||||
| -rw-r--r-- | node_modules/postcss-normalize-url/types/index.d.ts | 10 | ||||
| -rw-r--r-- | node_modules/postcss-normalize-url/types/index.d.ts.map | 1 | ||||
| -rw-r--r-- | node_modules/postcss-normalize-url/types/normalize.d.ts | 7 | ||||
| -rw-r--r-- | node_modules/postcss-normalize-url/types/normalize.d.ts.map | 1 |
9 files changed, 0 insertions, 437 deletions
diff --git a/node_modules/postcss-normalize-url/LICENSE-MIT b/node_modules/postcss-normalize-url/LICENSE-MIT deleted file mode 100644 index fd0e863a..00000000 --- a/node_modules/postcss-normalize-url/LICENSE-MIT +++ /dev/null @@ -1,22 +0,0 @@ -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 deleted file mode 100644 index e5d0ac74..00000000 --- a/node_modules/postcss-normalize-url/README.md +++ /dev/null @@ -1,48 +0,0 @@ -# [postcss][postcss]-normalize-url - -> [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/index.js). - -## Usage - -See the [PostCSS documentation](https://github.com/postcss/postcss#usage) for -examples for your environment. - -## Contributors - -See [CONTRIBUTORS.md](https://github.com/cssnano/cssnano/blob/master/CONTRIBUTORS.md). - -## License - -MIT © [Ben Briggs](http://beneb.info) - -[docs]: https://github.com/sindresorhus/normalize-url#options -[postcss]: https://github.com/postcss/postcss diff --git a/node_modules/postcss-normalize-url/package.json b/node_modules/postcss-normalize-url/package.json deleted file mode 100644 index 1cd0430a..00000000 --- a/node_modules/postcss-normalize-url/package.json +++ /dev/null @@ -1,44 +0,0 @@ -{ - "name": "postcss-normalize-url", - "version": "6.0.2", - "description": "Normalize URLs with PostCSS", - "main": "src/index.js", - "types": "types/index.d.ts", - "files": [ - "src", - "LICENSE-MIT", - "types" - ], - "keywords": [ - "css", - "normalize", - "optimise", - "optimisation", - "postcss", - "postcss-plugin", - "url" - ], - "license": "MIT", - "dependencies": { - "postcss-value-parser": "^4.2.0" - }, - "homepage": "https://github.com/cssnano/cssnano", - "author": { - "name": "Ben Briggs", - "email": "beneb.info@gmail.com", - "url": "http://beneb.info" - }, - "repository": "cssnano/cssnano", - "bugs": { - "url": "https://github.com/cssnano/cssnano/issues" - }, - "engines": { - "node": "^14 || ^16 || >=18.0" - }, - "devDependencies": { - "postcss": "^8.4.35" - }, - "peerDependencies": { - "postcss": "^8.4.31" - } -}
\ No newline at end of file diff --git a/node_modules/postcss-normalize-url/src/index.js b/node_modules/postcss-normalize-url/src/index.js deleted file mode 100644 index 3542dcf8..00000000 --- a/node_modules/postcss-normalize-url/src/index.js +++ /dev/null @@ -1,151 +0,0 @@ -'use strict'; -const path = require('path'); -const valueParser = require('postcss-value-parser'); -const normalize = require('./normalize.js'); - -const multiline = /\\[\r\n]/; -// eslint-disable-next-line no-useless-escape -const escapeChars = /([\s\(\)"'])/g; - -// Scheme: https://tools.ietf.org/html/rfc3986#section-3.1 -// Absolute URL: https://tools.ietf.org/html/rfc3986#section-4.3 -const ABSOLUTE_URL_REGEX = /^[a-zA-Z][a-zA-Z\d+\-.]*?:/; -// Windows paths like `c:\` -const WINDOWS_PATH_REGEX = /^[a-zA-Z]:\\/; - -/** - * Originally in sindresorhus/is-absolute-url - * - * @param {string} url - */ -function isAbsolute(url) { - if (WINDOWS_PATH_REGEX.test(url)) { - return false; - } - return ABSOLUTE_URL_REGEX.test(url); -} - -/** - * @param {string} url - * @return {string} - */ -function convert(url) { - if (isAbsolute(url) || url.startsWith('//')) { - let normalizedURL; - - try { - normalizedURL = normalize(url); - } catch (e) { - normalizedURL = url; - } - - return normalizedURL; - } - - // `path.normalize` always returns backslashes on Windows, need replace in `/` - return path.normalize(url).replace(new RegExp('\\' + path.sep, 'g'), '/'); -} - -/** - * @param {import('postcss').AtRule} rule - * @return {void} - */ -function transformNamespace(rule) { - rule.params = valueParser(rule.params) - .walk((node) => { - if ( - node.type === 'function' && - node.value.toLowerCase() === 'url' && - node.nodes.length - ) { - /** @type {valueParser.Node} */ (node).type = 'string'; - /** @type {any} */ (node).quote = - node.nodes[0].type === 'string' ? node.nodes[0].quote : '"'; - node.value = node.nodes[0].value; - } - if (node.type === 'string') { - node.value = node.value.trim(); - } - return false; - }) - .toString(); -} - -/** - * @param {import('postcss').Declaration} decl - * @return {void} - */ -function transformDecl(decl) { - decl.value = valueParser(decl.value) - .walk((node) => { - if (node.type !== 'function' || node.value.toLowerCase() !== 'url') { - return false; - } - - node.before = node.after = ''; - - if (!node.nodes.length) { - return false; - } - let url = node.nodes[0]; - let escaped; - - url.value = url.value.trim().replace(multiline, ''); - - // Skip empty URLs - // Empty URL function equals request to current stylesheet where it is declared - if (url.value.length === 0) { - /** @type {any} */ (url).quote = ''; - - return false; - } - - if (/^data:(.*)?,/i.test(url.value)) { - return false; - } - - if (!/^.+-extension:\//i.test(url.value)) { - url.value = convert(url.value); - } - - if (escapeChars.test(url.value) && url.type === 'string') { - escaped = url.value.replace(escapeChars, '\\$1'); - - if (escaped.length < url.value.length + 2) { - url.value = escaped; - /** @type {valueParser.Node} */ (url).type = 'word'; - } - } else { - url.type = 'word'; - } - - return false; - }) - .toString(); -} - -/** - * @type {import('postcss').PluginCreator<void>} - * @return {import('postcss').Plugin} - */ -function pluginCreator() { - return { - postcssPlugin: 'postcss-normalize-url', - - OnceExit(css) { - css.walk((node) => { - if (node.type === 'decl') { - return transformDecl(node); - } else if ( - node.type === 'atrule' && - node.name.toLowerCase() === 'namespace' - ) { - return transformNamespace(node); - } - }); - }, - }; -} - -pluginCreator.postcss = true; -module.exports = pluginCreator; diff --git a/node_modules/postcss-normalize-url/src/normalize.js b/node_modules/postcss-normalize-url/src/normalize.js deleted file mode 100644 index e6597e0d..00000000 --- a/node_modules/postcss-normalize-url/src/normalize.js +++ /dev/null @@ -1,153 +0,0 @@ -'use strict'; -/* Derived from normalize-url https://github.com/sindresorhus/normalize-url/main/index.js by Sindre Sorhus */ - -// https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/Data_URIs -const DATA_URL_DEFAULT_MIME_TYPE = 'text/plain'; -const DATA_URL_DEFAULT_CHARSET = 'us-ascii'; - -const supportedProtocols = new Set(['https:', 'http:', 'file:']); - -/** - * @param {string} urlString - * @return {boolean} */ -function hasCustomProtocol(urlString) { - try { - const { protocol } = new URL(urlString); - return protocol.endsWith(':') && !supportedProtocols.has(protocol); - } catch { - return false; - } -} - -/** - * @param {string} urlString - * @return {string} */ -function normalizeDataURL(urlString) { - const match = /^data:(?<type>[^,]*?),(?<data>[^#]*?)(?:#(?<hash>.*))?$/.exec( - urlString - ); - - if (!match) { - throw new Error(`Invalid URL: ${urlString}`); - } - - let { type, data, hash } = - /** @type {{type: string, data: string, hash: string}} */ (match.groups); - const mediaType = type.split(';'); - - let isBase64 = false; - if (mediaType[mediaType.length - 1] === 'base64') { - mediaType.pop(); - isBase64 = true; - } - - // Lowercase MIME type - const mimeType = mediaType.shift()?.toLowerCase() ?? ''; - const attributes = mediaType - .map( - /** @type {(string: string) => string} */ (attribute) => { - let [key, value = ''] = attribute - .split('=') - .map( - /** @type {(string: string) => string} */ (string) => string.trim() - ); - - // Lowercase `charset` - if (key === 'charset') { - value = value.toLowerCase(); - - if (value === DATA_URL_DEFAULT_CHARSET) { - return ''; - } - } - - return `${key}${value ? `=${value}` : ''}`; - } - ) - .filter(Boolean); - - const normalizedMediaType = [...attributes]; - - if (isBase64) { - normalizedMediaType.push('base64'); - } - - if ( - normalizedMediaType.length > 0 || - (mimeType && mimeType !== DATA_URL_DEFAULT_MIME_TYPE) - ) { - normalizedMediaType.unshift(mimeType); - } - - return `data:${normalizedMediaType.join(';')},${ - isBase64 ? data.trim() : data - }${hash ? `#${hash}` : ''}`; -} - -/** - * @param {string} urlString - * @return {string} - */ -function normalizeUrl(urlString) { - urlString = urlString.trim(); - - // Data URL - if (/^data:/i.test(urlString)) { - return normalizeDataURL(urlString); - } - - if (hasCustomProtocol(urlString)) { - return urlString; - } - - const hasRelativeProtocol = urlString.startsWith('//'); - const isRelativeUrl = !hasRelativeProtocol && /^\.*\//.test(urlString); - - // Prepend protocol - if (!isRelativeUrl) { - urlString = urlString.replace(/^(?!(?:\w+:)?\/\/)|^\/\//, 'http:'); - } - - const urlObject = new URL(urlString); - - // Remove duplicate slashes if not preceded by a protocol - if (urlObject.pathname) { - urlObject.pathname = urlObject.pathname.replace( - /(?<!\b[a-z][a-z\d+\-.]{1,50}:)\/{2,}/g, - '/' - ); - } - - // Decode URI octets - if (urlObject.pathname) { - try { - urlObject.pathname = decodeURI(urlObject.pathname); - } catch { - /* Do nothing */ - } - } - - if (urlObject.hostname) { - // Remove trailing dot - urlObject.hostname = urlObject.hostname.replace(/\.$/, ''); - } - - urlObject.pathname = urlObject.pathname.replace(/\/$/, ''); - - // Take advantage of many of the Node `url` normalizations - urlString = urlObject.toString(); - - // Remove ending `/` - if (urlObject.pathname === '/' && urlObject.hash === '') { - urlString = urlString.replace(/\/$/, ''); - } - - // Restore relative protocol - if (hasRelativeProtocol) { - urlString = urlString.replace(/^http:\/\//, '//'); - } - - return urlString; -} - -module.exports = normalizeUrl; diff --git a/node_modules/postcss-normalize-url/types/index.d.ts b/node_modules/postcss-normalize-url/types/index.d.ts deleted file mode 100644 index e449e8b4..00000000 --- a/node_modules/postcss-normalize-url/types/index.d.ts +++ /dev/null @@ -1,10 +0,0 @@ -export = pluginCreator; -/** - * @type {import('postcss').PluginCreator<void>} - * @return {import('postcss').Plugin} - */ -declare function pluginCreator(): import('postcss').Plugin; -declare namespace pluginCreator { - let postcss: true; -} -//# sourceMappingURL=index.d.ts.map
\ No newline at end of file diff --git a/node_modules/postcss-normalize-url/types/index.d.ts.map b/node_modules/postcss-normalize-url/types/index.d.ts.map deleted file mode 100644 index 80037cc2..00000000 --- a/node_modules/postcss-normalize-url/types/index.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.js"],"names":[],"mappings":";AA8HA;;;GAGG;AACH,kCAFY,OAAO,SAAS,EAAE,MAAM,CAmBnC"}
\ No newline at end of file diff --git a/node_modules/postcss-normalize-url/types/normalize.d.ts b/node_modules/postcss-normalize-url/types/normalize.d.ts deleted file mode 100644 index 5199c748..00000000 --- a/node_modules/postcss-normalize-url/types/normalize.d.ts +++ /dev/null @@ -1,7 +0,0 @@ -export = normalizeUrl; -/** - * @param {string} urlString - * @return {string} - */ -declare function normalizeUrl(urlString: string): string; -//# sourceMappingURL=normalize.d.ts.map
\ No newline at end of file diff --git a/node_modules/postcss-normalize-url/types/normalize.d.ts.map b/node_modules/postcss-normalize-url/types/normalize.d.ts.map deleted file mode 100644 index 17f6add1..00000000 --- a/node_modules/postcss-normalize-url/types/normalize.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"normalize.d.ts","sourceRoot":"","sources":["../src/normalize.js"],"names":[],"mappings":";AAsFA;;;GAGG;AACH,yCAHW,MAAM,GACL,MAAM,CA8DjB"}
\ No newline at end of file |
