first
This commit is contained in:
20
node_modules/postcss-minify-params/LICENSE
generated
vendored
Normal file
20
node_modules/postcss-minify-params/LICENSE
generated
vendored
Normal file
@ -0,0 +1,20 @@
|
||||
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.
|
||||
39
node_modules/postcss-minify-params/README.md
generated
vendored
Normal file
39
node_modules/postcss-minify-params/README.md
generated
vendored
Normal file
@ -0,0 +1,39 @@
|
||||
# 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
|
||||
15
node_modules/postcss-minify-params/node_modules/.bin/browserslist
generated
vendored
Normal file
15
node_modules/postcss-minify-params/node_modules/.bin/browserslist
generated
vendored
Normal file
@ -0,0 +1,15 @@
|
||||
#!/bin/sh
|
||||
basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')")
|
||||
|
||||
case `uname` in
|
||||
*CYGWIN*) basedir=`cygpath -w "$basedir"`;;
|
||||
esac
|
||||
|
||||
if [ -x "$basedir/node" ]; then
|
||||
"$basedir/node" "$basedir/../../../browserslist/cli.js" "$@"
|
||||
ret=$?
|
||||
else
|
||||
node "$basedir/../../../browserslist/cli.js" "$@"
|
||||
ret=$?
|
||||
fi
|
||||
exit $ret
|
||||
7
node_modules/postcss-minify-params/node_modules/.bin/browserslist.cmd
generated
vendored
Normal file
7
node_modules/postcss-minify-params/node_modules/.bin/browserslist.cmd
generated
vendored
Normal file
@ -0,0 +1,7 @@
|
||||
@IF EXIST "%~dp0\node.exe" (
|
||||
"%~dp0\node.exe" "%~dp0\..\..\..\browserslist\cli.js" %*
|
||||
) ELSE (
|
||||
@SETLOCAL
|
||||
@SET PATHEXT=%PATHEXT:;.JS;=;%
|
||||
node "%~dp0\..\..\..\browserslist\cli.js" %*
|
||||
)
|
||||
72
node_modules/postcss-minify-params/package.json
generated
vendored
Normal file
72
node_modules/postcss-minify-params/package.json
generated
vendored
Normal file
@ -0,0 +1,72 @@
|
||||
{
|
||||
"_from": "postcss-minify-params@^5.1.4",
|
||||
"_id": "postcss-minify-params@5.1.4",
|
||||
"_inBundle": false,
|
||||
"_integrity": "sha512-+mePA3MgdmVmv6g+30rn57USjOGSAyuxUmkfiWpzalZ8aiBkdPYjXWtHuwJGm1v5Ojy0Z0LaSYhHaLJQB0P8Jw==",
|
||||
"_location": "/postcss-minify-params",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"type": "range",
|
||||
"registry": true,
|
||||
"raw": "postcss-minify-params@^5.1.4",
|
||||
"name": "postcss-minify-params",
|
||||
"escapedName": "postcss-minify-params",
|
||||
"rawSpec": "^5.1.4",
|
||||
"saveSpec": null,
|
||||
"fetchSpec": "^5.1.4"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/cssnano-preset-default"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/postcss-minify-params/-/postcss-minify-params-5.1.4.tgz",
|
||||
"_shasum": "c06a6c787128b3208b38c9364cfc40c8aa5d7352",
|
||||
"_spec": "postcss-minify-params@^5.1.4",
|
||||
"_where": "C:\\Users\\zhouxueli\\Desktop\\scheduling-app\\node_modules\\cssnano-preset-default",
|
||||
"author": {
|
||||
"name": "Bogdan Chadkin",
|
||||
"email": "trysound@yandex.ru"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/cssnano/cssnano/issues"
|
||||
},
|
||||
"bundleDependencies": false,
|
||||
"dependencies": {
|
||||
"browserslist": "^4.21.4",
|
||||
"cssnano-utils": "^3.1.0",
|
||||
"postcss-value-parser": "^4.2.0"
|
||||
},
|
||||
"deprecated": false,
|
||||
"description": "Minify at-rule params with PostCSS",
|
||||
"devDependencies": {
|
||||
"postcss": "^8.2.15"
|
||||
},
|
||||
"engines": {
|
||||
"node": "^10 || ^12 || >=14.0"
|
||||
},
|
||||
"files": [
|
||||
"src",
|
||||
"LICENSE",
|
||||
"types"
|
||||
],
|
||||
"homepage": "https://github.com/cssnano/cssnano",
|
||||
"keywords": [
|
||||
"postcss",
|
||||
"css",
|
||||
"postcss-plugin",
|
||||
"minify",
|
||||
"optimise",
|
||||
"params"
|
||||
],
|
||||
"license": "MIT",
|
||||
"main": "src/index.js",
|
||||
"name": "postcss-minify-params",
|
||||
"peerDependencies": {
|
||||
"postcss": "^8.2.15"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/cssnano/cssnano.git"
|
||||
},
|
||||
"types": "types/index.d.ts",
|
||||
"version": "5.1.4"
|
||||
}
|
||||
158
node_modules/postcss-minify-params/src/index.js
generated
vendored
Normal file
158
node_modules/postcss-minify-params/src/index.js
generated
vendored
Normal file
@ -0,0 +1,158 @@
|
||||
'use strict';
|
||||
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']);
|
||||
|
||||
/**
|
||||
* @type {import('postcss').PluginCreator<browserslist.Options>}
|
||||
* @param {browserslist.Options} options
|
||||
* @return {import('postcss').Plugin}
|
||||
*/
|
||||
function pluginCreator(options = {}) {
|
||||
const browsers = browserslist(null, {
|
||||
stats: options.stats,
|
||||
path: __dirname,
|
||||
env: options.env,
|
||||
});
|
||||
|
||||
const hasAllBug = browsers.some((browser) => allBugBrowers.has(browser));
|
||||
return {
|
||||
postcssPlugin: 'postcss-minify-params',
|
||||
|
||||
OnceExit(css) {
|
||||
css.walkAtRules((rule) => transform(hasAllBug, rule));
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
pluginCreator.postcss = true;
|
||||
module.exports = pluginCreator;
|
||||
11
node_modules/postcss-minify-params/types/index.d.ts
generated
vendored
Normal file
11
node_modules/postcss-minify-params/types/index.d.ts
generated
vendored
Normal file
@ -0,0 +1,11 @@
|
||||
export = pluginCreator;
|
||||
/**
|
||||
* @type {import('postcss').PluginCreator<browserslist.Options>}
|
||||
* @param {browserslist.Options} options
|
||||
* @return {import('postcss').Plugin}
|
||||
*/
|
||||
declare function pluginCreator(options?: browserslist.Options): import('postcss').Plugin;
|
||||
declare namespace pluginCreator {
|
||||
const postcss: true;
|
||||
}
|
||||
import browserslist = require("browserslist");
|
||||
Reference in New Issue
Block a user