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-minify-params | |
| parent | 3336b2356ee6152d9c6ae59bd9b87ccbc0958407 (diff) | |
node: updatemain
Diffstat (limited to 'node_modules/postcss-minify-params')
| -rw-r--r-- | node_modules/postcss-minify-params/LICENSE | 20 | ||||
| -rw-r--r-- | node_modules/postcss-minify-params/README.md | 39 | ||||
| -rw-r--r-- | node_modules/postcss-minify-params/package.json | 41 | ||||
| -rw-r--r-- | node_modules/postcss-minify-params/src/index.js | 174 | ||||
| -rw-r--r-- | node_modules/postcss-minify-params/types/index.d.ts | 23 | ||||
| -rw-r--r-- | node_modules/postcss-minify-params/types/index.d.ts.map | 1 |
6 files changed, 0 insertions, 298 deletions
diff --git a/node_modules/postcss-minify-params/LICENSE b/node_modules/postcss-minify-params/LICENSE deleted file mode 100644 index 066ee676..00000000 --- a/node_modules/postcss-minify-params/LICENSE +++ /dev/null @@ -1,20 +0,0 @@ -The MIT License (MIT) - -Copyright 2015 Bogdan Chadkin <trysound@yandex.ru> - -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-minify-params/README.md b/node_modules/postcss-minify-params/README.md deleted file mode 100644 index 33a96092..00000000 --- a/node_modules/postcss-minify-params/README.md +++ /dev/null @@ -1,39 +0,0 @@ -# postcss-minify-params [![Build Status][ci-img]][ci] - -> Minify at-rule params with PostCSS. - -```css -@media only screen and ( min-width: 400px, min-height: 500px ) { - h2{ - color:blue - } -} -``` - -```css -@media only screen and (min-width:400px,min-height:500px) { - h2{ - color:blue - } -} -``` - -## Usage - -```js -postcss([ require('postcss-minify-params') ]) -``` - -See [PostCSS] docs for examples for your environment. - -## Contributors - -See [CONTRIBUTORS.md](https://github.com/cssnano/cssnano/blob/master/CONTRIBUTORS.md). - -## License - -MIT © [Bogdan Chadkin](mailto:trysound@yandex.ru) - -[PostCSS]: https://github.com/postcss/postcss -[ci-img]: https://travis-ci.org/cssnano/postcss-minify-params.svg -[ci]: https://travis-ci.org/cssnano/postcss-minify-params diff --git a/node_modules/postcss-minify-params/package.json b/node_modules/postcss-minify-params/package.json deleted file mode 100644 index 9ce899a8..00000000 --- a/node_modules/postcss-minify-params/package.json +++ /dev/null @@ -1,41 +0,0 @@ -{ - "name": "postcss-minify-params", - "version": "6.1.0", - "description": "Minify at-rule params with PostCSS", - "keywords": [ - "postcss", - "css", - "postcss-plugin", - "minify", - "optimise", - "params" - ], - "main": "src/index.js", - "types": "types/index.d.ts", - "files": [ - "src", - "LICENSE", - "types" - ], - "author": "Bogdan Chadkin <trysound@yandex.ru>", - "license": "MIT", - "repository": "cssnano/cssnano", - "bugs": { - "url": "https://github.com/cssnano/cssnano/issues" - }, - "homepage": "https://github.com/cssnano/cssnano", - "dependencies": { - "browserslist": "^4.23.0", - "postcss-value-parser": "^4.2.0", - "cssnano-utils": "^4.0.2" - }, - "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-minify-params/src/index.js b/node_modules/postcss-minify-params/src/index.js deleted file mode 100644 index df65593e..00000000 --- a/node_modules/postcss-minify-params/src/index.js +++ /dev/null @@ -1,174 +0,0 @@ -'use strict'; -const { dirname } = require('path'); -const browserslist = require('browserslist'); -const valueParser = require('postcss-value-parser'); -const { getArguments } = require('cssnano-utils'); - -/** - * Return the greatest common divisor - * of two numbers. - * - * @param {number} a - * @param {number} b - * @return {number} - */ -function gcd(a, b) { - return b ? gcd(b, a % b) : a; -} - -/** - * @param {number} a - * @param {number} b - * @return {[number, number]} - */ -function aspectRatio(a, b) { - const divisor = gcd(a, b); - - return [a / divisor, b / divisor]; -} - -/** - * @param {valueParser.Node[]} args - * @return {string} - */ -function split(args) { - return args.map((arg) => valueParser.stringify(arg)).join(''); -} - -/** - * @param {valueParser.Node} node - * @return {void} - */ -function removeNode(node) { - node.value = ''; - node.type = 'word'; -} - -/** - * @param {unknown[]} items - * @return {string} - */ -function sortAndDedupe(items) { - const a = [...new Set(items)]; - a.sort(); - return a.join(); -} - -/** - * @param {boolean} legacy - * @param {import('postcss').AtRule} rule - * @return {void} - */ -function transform(legacy, rule) { - const ruleName = rule.name.toLowerCase(); - - // We should re-arrange parameters only for `@media` and `@supports` at-rules - if (!rule.params || !['media', 'supports'].includes(ruleName)) { - return; - } - - const params = valueParser(rule.params); - - params.walk((node, index) => { - if (node.type === 'div') { - node.before = node.after = ''; - } else if (node.type === 'function') { - node.before = ''; - if ( - node.nodes[0] && - node.nodes[0].type === 'word' && - node.nodes[0].value.startsWith('--') && - node.nodes[2] === undefined - ) { - node.after = ' '; - } else { - node.after = ''; - } - if ( - node.nodes[4] && - node.nodes[0].value.toLowerCase().indexOf('-aspect-ratio') === 3 - ) { - const [a, b] = aspectRatio( - Number(node.nodes[2].value), - Number(node.nodes[4].value) - ); - - node.nodes[2].value = a.toString(); - node.nodes[4].value = b.toString(); - } - } else if (node.type === 'space') { - node.value = ' '; - } else { - const prevWord = params.nodes[index - 2]; - - if ( - node.value.toLowerCase() === 'all' && - rule.name.toLowerCase() === 'media' && - !prevWord - ) { - const nextWord = params.nodes[index + 2]; - - if (!legacy || nextWord) { - removeNode(node); - } - - if (nextWord && nextWord.value.toLowerCase() === 'and') { - const nextSpace = params.nodes[index + 1]; - const secondSpace = params.nodes[index + 3]; - - removeNode(nextWord); - removeNode(nextSpace); - removeNode(secondSpace); - } - } - } - }, true); - - rule.params = sortAndDedupe(getArguments(params).map(split)); - - if (!rule.params.length) { - rule.raws.afterName = ''; - } -} - -const allBugBrowers = new Set(['ie 10', 'ie 11']); - -/** - * @typedef {{ overrideBrowserslist?: string | string[] }} AutoprefixerOptions - * @typedef {Pick<browserslist.Options, 'stats' | 'path' | 'env'>} BrowserslistOptions - * @typedef {AutoprefixerOptions & BrowserslistOptions} Options - */ - -/** - * @type {import('postcss').PluginCreator<Options>} - * @param {Options} options - * @return {import('postcss').Plugin} - */ -function pluginCreator(options = {}) { - return { - postcssPlugin: 'postcss-minify-params', - - /** - * @param {import('postcss').Result & {opts: BrowserslistOptions & {file?: string}}} result - */ - prepare(result) { - const { stats, env, from, file } = result.opts || {}; - const browsers = browserslist(options.overrideBrowserslist, { - stats: options.stats || stats, - path: options.path || dirname(from || file || __filename), - env: options.env || env, - }); - - const hasAllBug = browsers.some((browser) => allBugBrowers.has(browser)); - - return { - OnceExit(css) { - css.walkAtRules((rule) => transform(hasAllBug, rule)); - }, - }; - }, - }; -} - -pluginCreator.postcss = true; -module.exports = pluginCreator; diff --git a/node_modules/postcss-minify-params/types/index.d.ts b/node_modules/postcss-minify-params/types/index.d.ts deleted file mode 100644 index 43e20c24..00000000 --- a/node_modules/postcss-minify-params/types/index.d.ts +++ /dev/null @@ -1,23 +0,0 @@ -export = pluginCreator; -/** - * @typedef {{ overrideBrowserslist?: string | string[] }} AutoprefixerOptions - * @typedef {Pick<browserslist.Options, 'stats' | 'path' | 'env'>} BrowserslistOptions - * @typedef {AutoprefixerOptions & BrowserslistOptions} Options - */ -/** - * @type {import('postcss').PluginCreator<Options>} - * @param {Options} options - * @return {import('postcss').Plugin} - */ -declare function pluginCreator(options?: Options): import('postcss').Plugin; -declare namespace pluginCreator { - export { postcss, AutoprefixerOptions, BrowserslistOptions, Options }; -} -type Options = AutoprefixerOptions & BrowserslistOptions; -declare var postcss: true; -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-minify-params/types/index.d.ts.map b/node_modules/postcss-minify-params/types/index.d.ts.map deleted file mode 100644 index e466b6f8..00000000 --- a/node_modules/postcss-minify-params/types/index.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.js"],"names":[],"mappings":";AAuIA;;;;GAIG;AAEH;;;;GAIG;AACH,yCAHW,OAAO,GACN,OAAO,SAAS,EAAE,MAAM,CA0BnC;;;;eAhCY,mBAAmB,GAAG,mBAAmB;;2BAFzC;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 |
