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-colormin | |
| parent | 3336b2356ee6152d9c6ae59bd9b87ccbc0958407 (diff) | |
node: updatemain
Diffstat (limited to 'node_modules/postcss-colormin')
| -rw-r--r-- | node_modules/postcss-colormin/LICENSE-MIT | 22 | ||||
| -rw-r--r-- | node_modules/postcss-colormin/README.md | 45 | ||||
| -rw-r--r-- | node_modules/postcss-colormin/package.json | 48 | ||||
| -rw-r--r-- | node_modules/postcss-colormin/src/index.js | 179 | ||||
| -rw-r--r-- | node_modules/postcss-colormin/src/minifyColor.js | 28 | ||||
| -rw-r--r-- | node_modules/postcss-colormin/types/index.d.ts | 40 | ||||
| -rw-r--r-- | node_modules/postcss-colormin/types/index.d.ts.map | 1 | ||||
| -rw-r--r-- | node_modules/postcss-colormin/types/minifyColor.d.ts | 3 | ||||
| -rw-r--r-- | node_modules/postcss-colormin/types/minifyColor.d.ts.map | 1 |
9 files changed, 0 insertions, 367 deletions
diff --git a/node_modules/postcss-colormin/LICENSE-MIT b/node_modules/postcss-colormin/LICENSE-MIT deleted file mode 100644 index fd0e863a..00000000 --- a/node_modules/postcss-colormin/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-colormin/README.md b/node_modules/postcss-colormin/README.md deleted file mode 100644 index 5059c52b..00000000 --- a/node_modules/postcss-colormin/README.md +++ /dev/null @@ -1,45 +0,0 @@ -# [postcss][postcss]-colormin - -> Minify colors in your CSS files with PostCSS. - -## Install - -With [npm](https://npmjs.org/package/postcss-colormin) do: - -``` -npm install postcss-colormin --save -``` - - -## Example - -```js -var postcss = require('postcss') -var colormin = require('postcss-colormin'); - -var css = 'h1 {color: rgba(255, 0, 0, 1)}'; -console.log(postcss(colormin()).process(css).css); - -// => 'h1 {color:red}' -``` - -For more examples see the [tests](src/__tests__/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) - - -[postcss]: https://github.com/postcss/postcss diff --git a/node_modules/postcss-colormin/package.json b/node_modules/postcss-colormin/package.json deleted file mode 100644 index 0f698d0d..00000000 --- a/node_modules/postcss-colormin/package.json +++ /dev/null @@ -1,48 +0,0 @@ -{ - "name": "postcss-colormin", - "version": "6.1.0", - "description": "Minify colors in your CSS files with PostCSS.", - "main": "src/index.js", - "types": "types/index.d.ts", - "files": [ - "src", - "LICENSE-MIT", - "types" - ], - "keywords": [ - "color", - "colors", - "compression", - "css", - "minify", - "postcss", - "postcss-plugin" - ], - "license": "MIT", - "homepage": "https://github.com/cssnano/cssnano", - "author": { - "name": "Ben Briggs", - "email": "beneb.info@gmail.com", - "url": "http://beneb.info" - }, - "repository": "cssnano/cssnano", - "dependencies": { - "browserslist": "^4.23.0", - "caniuse-api": "^3.0.0", - "colord": "^2.9.3", - "postcss-value-parser": "^4.2.0" - }, - "bugs": { - "url": "https://github.com/cssnano/cssnano/issues" - }, - "engines": { - "node": "^14 || ^16 || >=18.0" - }, - "devDependencies": { - "@types/caniuse-api": "^3.0.6", - "postcss": "^8.4.35" - }, - "peerDependencies": { - "postcss": "^8.4.31" - } -}
\ No newline at end of file diff --git a/node_modules/postcss-colormin/src/index.js b/node_modules/postcss-colormin/src/index.js deleted file mode 100644 index c856c08c..00000000 --- a/node_modules/postcss-colormin/src/index.js +++ /dev/null @@ -1,179 +0,0 @@ -'use strict'; -const { dirname } = require('path'); -const browserslist = require('browserslist'); -const { isSupported } = require('caniuse-api'); -const valueParser = require('postcss-value-parser'); -const minifyColor = require('./minifyColor'); - -/** - * @param {{nodes: valueParser.Node[]}} parent - * @param {(node: valueParser.Node, index: number, parent: {nodes: valueParser.Node[]}) => false | undefined} callback - * @return {void} - */ -function walk(parent, callback) { - parent.nodes.forEach((node, index) => { - const bubble = callback(node, index, parent); - - if (node.type === 'function' && bubble !== false) { - walk(node, callback); - } - }); -} - -/* - * IE 8 & 9 do not properly handle clicks on elements - * with a `transparent` `background-color`. - * - * https://developer.mozilla.org/en-US/docs/Web/Events/click#Internet_Explorer - */ -const browsersWithTransparentBug = new Set(['ie 8', 'ie 9']); -const mathFunctions = new Set(['calc', 'min', 'max', 'clamp']); - -/** - * @param {valueParser.Node} node - * @return {boolean} - */ -function isMathFunctionNode(node) { - if (node.type !== 'function') { - return false; - } - return mathFunctions.has(node.value.toLowerCase()); -} - -/** - * @param {string} value - * @param {Options} options - * @return {string} - */ -function transform(value, options) { - const parsed = valueParser(value); - - walk(parsed, (node, index, parent) => { - if (node.type === 'function') { - if (/^(rgb|hsl)a?$/i.test(node.value)) { - const { value: originalValue } = node; - - node.value = minifyColor(valueParser.stringify(node), options); - /** @type {string} */ (node.type) = 'word'; - - const next = parent.nodes[index + 1]; - - if ( - node.value !== originalValue && - next && - (next.type === 'word' || next.type === 'function') - ) { - parent.nodes.splice( - index + 1, - 0, - /** @type {valueParser.SpaceNode} */ ({ - type: 'space', - value: ' ', - }) - ); - } - } else if (isMathFunctionNode(node)) { - return false; - } - } else if (node.type === 'word') { - node.value = minifyColor(node.value, options); - } - }); - - return parsed.toString(); -} - -/** - * @param {Options} options - * @param {string[]} browsers - * @return {Options} - */ -function addPluginDefaults(options, browsers) { - const defaults = { - // Does the browser support 4 & 8 character hex notation - transparent: - browsers.some((b) => browsersWithTransparentBug.has(b)) === false, - // Does the browser support "transparent" value properly - alphaHex: isSupported('css-rrggbbaa', browsers), - name: true, - }; - return { ...defaults, ...options }; -} - -/** - * @typedef {object} MinifyColorOptions - * @property {boolean} [hex] - * @property {boolean} [alphaHex] - * @property {boolean} [rgb] - * @property {boolean} [hsl] - * @property {boolean} [name] - * @property {boolean} [transparent] - */ - -/** - * @typedef {{ overrideBrowserslist?: string | string[] }} AutoprefixerOptions - * @typedef {Pick<browserslist.Options, 'stats' | 'path' | 'env'>} BrowserslistOptions - * @typedef {MinifyColorOptions & AutoprefixerOptions & BrowserslistOptions} Options - */ - -/** - * @type {import('postcss').PluginCreator<Options>} - * @param {Options} config - * @return {import('postcss').Plugin} - */ -function pluginCreator(config = {}) { - return { - postcssPlugin: 'postcss-colormin', - - /** - * @param {import('postcss').Result & {opts: BrowserslistOptions & {file?: string}}} result - */ - prepare(result) { - const { stats, env, from, file } = result.opts || {}; - const browsers = browserslist(config.overrideBrowserslist, { - stats: config.stats || stats, - path: config.path || dirname(from || file || __filename), - env: config.env || env, - }); - - const cache = new Map(); - const options = addPluginDefaults(config, browsers); - - return { - OnceExit(css) { - css.walkDecls((decl) => { - if ( - /^(composes|font|src$|filter|-webkit-tap-highlight-color)/i.test( - decl.prop - ) - ) { - return; - } - - const value = decl.value; - - if (!value) { - return; - } - - const cacheKey = JSON.stringify({ value, options, browsers }); - - if (cache.has(cacheKey)) { - decl.value = cache.get(cacheKey); - - return; - } - - const newValue = transform(value, options); - - decl.value = newValue; - cache.set(cacheKey, newValue); - }); - }, - }; - }, - }; -} - -pluginCreator.postcss = true; -module.exports = pluginCreator; diff --git a/node_modules/postcss-colormin/src/minifyColor.js b/node_modules/postcss-colormin/src/minifyColor.js deleted file mode 100644 index a9eef7a2..00000000 --- a/node_modules/postcss-colormin/src/minifyColor.js +++ /dev/null @@ -1,28 +0,0 @@ -'use strict'; -const { colord, extend } = require('colord'); -const namesPlugin = require('colord/plugins/names'); -const minifierPlugin = require('colord/plugins/minify'); - -extend(/** @type {any[]} */ ([namesPlugin, minifierPlugin])); - -/** - * Performs color value minification - * - * @param {string} input - CSS value - * @param {import('./index.js').MinifyColorOptions} options - object with colord.minify() options - * @return {string} - */ -module.exports = function minifyColor(input, options = {}) { - const instance = colord(input); - - if (instance.isValid()) { - // Try to shorten the string if it is a valid CSS color value - const minified = instance.minify(options); - - // Fall back to the original input if it's smaller or has equal length - return minified.length < input.length ? minified : input.toLowerCase(); - } else { - // Possibly malformed, so pass through - return input; - } -}; diff --git a/node_modules/postcss-colormin/types/index.d.ts b/node_modules/postcss-colormin/types/index.d.ts deleted file mode 100644 index 5d528130..00000000 --- a/node_modules/postcss-colormin/types/index.d.ts +++ /dev/null @@ -1,40 +0,0 @@ -export = pluginCreator; -/** - * @typedef {object} MinifyColorOptions - * @property {boolean} [hex] - * @property {boolean} [alphaHex] - * @property {boolean} [rgb] - * @property {boolean} [hsl] - * @property {boolean} [name] - * @property {boolean} [transparent] - */ -/** - * @typedef {{ overrideBrowserslist?: string | string[] }} AutoprefixerOptions - * @typedef {Pick<browserslist.Options, 'stats' | 'path' | 'env'>} BrowserslistOptions - * @typedef {MinifyColorOptions & AutoprefixerOptions & BrowserslistOptions} Options - */ -/** - * @type {import('postcss').PluginCreator<Options>} - * @param {Options} config - * @return {import('postcss').Plugin} - */ -declare function pluginCreator(config?: Options): import('postcss').Plugin; -declare namespace pluginCreator { - export { postcss, MinifyColorOptions, AutoprefixerOptions, BrowserslistOptions, Options }; -} -type Options = MinifyColorOptions & AutoprefixerOptions & BrowserslistOptions; -declare var postcss: true; -type MinifyColorOptions = { - hex?: boolean | undefined; - alphaHex?: boolean | undefined; - rgb?: boolean | undefined; - hsl?: boolean | undefined; - name?: boolean | undefined; - transparent?: boolean | undefined; -}; -type AutoprefixerOptions = { - overrideBrowserslist?: string | string[]; -}; -type BrowserslistOptions = Pick<browserslist.Options, 'stats' | 'path' | 'env'>; -import browserslist = require("browserslist"); -//# sourceMappingURL=index.d.ts.map
\ No newline at end of file diff --git a/node_modules/postcss-colormin/types/index.d.ts.map b/node_modules/postcss-colormin/types/index.d.ts.map deleted file mode 100644 index 72aa3940..00000000 --- a/node_modules/postcss-colormin/types/index.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.js"],"names":[],"mappings":";AAsGA;;;;;;;;GAQG;AAEH;;;;GAIG;AAEH;;;;GAIG;AACH,wCAHW,OAAO,GACN,OAAO,SAAS,EAAE,MAAM,CAsDnC;;;;eA5DY,kBAAkB,GAAG,mBAAmB,GAAG,mBAAmB;;;;;;;;;;2BAF9D;IAAE,oBAAoB,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,CAAA;CAAE;2BAC5C,KAAK,oBAAoB,EAAE,OAAO,GAAG,MAAM,GAAG,KAAK,CAAC"}
\ No newline at end of file diff --git a/node_modules/postcss-colormin/types/minifyColor.d.ts b/node_modules/postcss-colormin/types/minifyColor.d.ts deleted file mode 100644 index e582fb8c..00000000 --- a/node_modules/postcss-colormin/types/minifyColor.d.ts +++ /dev/null @@ -1,3 +0,0 @@ -declare function _exports(input: string, options?: import('./index.js').MinifyColorOptions): string; -export = _exports; -//# sourceMappingURL=minifyColor.d.ts.map
\ No newline at end of file diff --git a/node_modules/postcss-colormin/types/minifyColor.d.ts.map b/node_modules/postcss-colormin/types/minifyColor.d.ts.map deleted file mode 100644 index bf83f966..00000000 --- a/node_modules/postcss-colormin/types/minifyColor.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"minifyColor.d.ts","sourceRoot":"","sources":["../src/minifyColor.js"],"names":[],"mappings":"AAciB,iCAJN,MAAM,YACN,OAAO,YAAY,EAAE,kBAAkB,GACtC,MAAM,CAejB"}
\ No newline at end of file |
