first
This commit is contained in:
22
node_modules/postcss-normalize-whitespace/LICENSE-MIT
generated
vendored
Normal file
22
node_modules/postcss-normalize-whitespace/LICENSE-MIT
generated
vendored
Normal file
@ -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.
|
44
node_modules/postcss-normalize-whitespace/README.md
generated
vendored
Normal file
44
node_modules/postcss-normalize-whitespace/README.md
generated
vendored
Normal file
@ -0,0 +1,44 @@
|
||||
# [postcss][postcss]-normalize-whitespace
|
||||
|
||||
> Normalize whitespace with PostCSS.
|
||||
|
||||
## Install
|
||||
|
||||
With [npm](https://npmjs.org/package/postcss-normalize-whitespace) do:
|
||||
|
||||
```
|
||||
npm install postcss-normalize-whitespace --save
|
||||
```
|
||||
|
||||
## Example
|
||||
|
||||
### Input
|
||||
|
||||
```css
|
||||
h1{
|
||||
width: calc(10px - ( 100px / var(--test) ))
|
||||
}
|
||||
```
|
||||
|
||||
### Output
|
||||
|
||||
```css
|
||||
h1{
|
||||
width: calc(10px - 100px / var(--test))
|
||||
}
|
||||
```
|
||||
|
||||
## 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
|
68
node_modules/postcss-normalize-whitespace/package.json
generated
vendored
Normal file
68
node_modules/postcss-normalize-whitespace/package.json
generated
vendored
Normal file
@ -0,0 +1,68 @@
|
||||
{
|
||||
"_from": "postcss-normalize-whitespace@^5.1.1",
|
||||
"_id": "postcss-normalize-whitespace@5.1.1",
|
||||
"_inBundle": false,
|
||||
"_integrity": "sha512-83ZJ4t3NUDETIHTa3uEg6asWjSBYL5EdkVB0sDncx9ERzOKBVJIUeDO9RyA9Zwtig8El1d79HBp0JEi8wvGQnA==",
|
||||
"_location": "/postcss-normalize-whitespace",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"type": "range",
|
||||
"registry": true,
|
||||
"raw": "postcss-normalize-whitespace@^5.1.1",
|
||||
"name": "postcss-normalize-whitespace",
|
||||
"escapedName": "postcss-normalize-whitespace",
|
||||
"rawSpec": "^5.1.1",
|
||||
"saveSpec": null,
|
||||
"fetchSpec": "^5.1.1"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/cssnano-preset-default"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/postcss-normalize-whitespace/-/postcss-normalize-whitespace-5.1.1.tgz",
|
||||
"_shasum": "08a1a0d1ffa17a7cc6efe1e6c9da969cc4493cfa",
|
||||
"_spec": "postcss-normalize-whitespace@^5.1.1",
|
||||
"_where": "C:\\Users\\zhouxueli\\Desktop\\scheduling-app\\node_modules\\cssnano-preset-default",
|
||||
"author": {
|
||||
"name": "Ben Briggs",
|
||||
"email": "beneb.info@gmail.com",
|
||||
"url": "http://beneb.info"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/cssnano/cssnano/issues"
|
||||
},
|
||||
"bundleDependencies": false,
|
||||
"dependencies": {
|
||||
"postcss-value-parser": "^4.2.0"
|
||||
},
|
||||
"deprecated": false,
|
||||
"description": "Trim whitespace inside and around CSS rules & declarations.",
|
||||
"devDependencies": {
|
||||
"postcss": "^8.2.15"
|
||||
},
|
||||
"engines": {
|
||||
"node": "^10 || ^12 || >=14.0"
|
||||
},
|
||||
"files": [
|
||||
"src",
|
||||
"LICENSE-MIT",
|
||||
"types"
|
||||
],
|
||||
"homepage": "https://github.com/cssnano/cssnano",
|
||||
"keywords": [
|
||||
"css",
|
||||
"postcss",
|
||||
"postcss-plugin"
|
||||
],
|
||||
"license": "MIT",
|
||||
"main": "src/index.js",
|
||||
"name": "postcss-normalize-whitespace",
|
||||
"peerDependencies": {
|
||||
"postcss": "^8.2.15"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/cssnano/cssnano.git"
|
||||
},
|
||||
"types": "types/index.d.ts",
|
||||
"version": "5.1.1"
|
||||
}
|
108
node_modules/postcss-normalize-whitespace/src/index.js
generated
vendored
Normal file
108
node_modules/postcss-normalize-whitespace/src/index.js
generated
vendored
Normal file
@ -0,0 +1,108 @@
|
||||
'use strict';
|
||||
const valueParser = require('postcss-value-parser');
|
||||
|
||||
const atrule = 'atrule';
|
||||
const decl = 'decl';
|
||||
const rule = 'rule';
|
||||
const variableFunctions = new Set(['var', 'env', 'constant']);
|
||||
|
||||
/**
|
||||
* @param {valueParser.Node} node
|
||||
* @return {void}
|
||||
*/
|
||||
function reduceCalcWhitespaces(node) {
|
||||
if (node.type === 'space') {
|
||||
node.value = ' ';
|
||||
} else if (node.type === 'function') {
|
||||
if (!variableFunctions.has(node.value.toLowerCase())) {
|
||||
node.before = node.after = '';
|
||||
}
|
||||
}
|
||||
}
|
||||
/**
|
||||
* @param {valueParser.Node} node
|
||||
* @return {void | false}
|
||||
*/
|
||||
function reduceWhitespaces(node) {
|
||||
if (node.type === 'space') {
|
||||
node.value = ' ';
|
||||
} else if (node.type === 'div') {
|
||||
node.before = node.after = '';
|
||||
} else if (node.type === 'function') {
|
||||
if (!variableFunctions.has(node.value.toLowerCase())) {
|
||||
node.before = node.after = '';
|
||||
}
|
||||
if (node.value.toLowerCase() === 'calc') {
|
||||
valueParser.walk(node.nodes, reduceCalcWhitespaces);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @type {import('postcss').PluginCreator<void>}
|
||||
* @return {import('postcss').Plugin}
|
||||
*/
|
||||
function pluginCreator() {
|
||||
return {
|
||||
postcssPlugin: 'postcss-normalize-whitespace',
|
||||
|
||||
OnceExit(css) {
|
||||
const cache = new Map();
|
||||
|
||||
css.walk((node) => {
|
||||
const { type } = node;
|
||||
|
||||
if ([decl, rule, atrule].includes(type) && node.raws.before) {
|
||||
node.raws.before = node.raws.before.replace(/\s/g, '');
|
||||
}
|
||||
|
||||
if (type === decl) {
|
||||
// Ensure that !important values do not have any excess whitespace
|
||||
if (node.important) {
|
||||
node.raws.important = '!important';
|
||||
}
|
||||
|
||||
// Remove whitespaces around ie 9 hack
|
||||
node.value = node.value.replace(/\s*(\\9)\s*/, '$1');
|
||||
const value = node.value;
|
||||
|
||||
if (cache.has(value)) {
|
||||
node.value = cache.get(value);
|
||||
} else {
|
||||
const parsed = valueParser(node.value);
|
||||
const result = parsed.walk(reduceWhitespaces).toString();
|
||||
|
||||
// Trim whitespace inside functions & dividers
|
||||
node.value = result;
|
||||
cache.set(value, result);
|
||||
}
|
||||
|
||||
if (node.prop.startsWith('--') && node.value === '') {
|
||||
node.value = ' ';
|
||||
}
|
||||
// Remove extra semicolons and whitespace before the declaration
|
||||
if (node.raws.before) {
|
||||
const prev = node.prev();
|
||||
|
||||
if (prev && prev.type !== rule) {
|
||||
node.raws.before = node.raws.before.replace(/;/g, '');
|
||||
}
|
||||
}
|
||||
|
||||
node.raws.between = ':';
|
||||
node.raws.semicolon = false;
|
||||
} else if (type === rule || type === atrule) {
|
||||
node.raws.between = node.raws.after = '';
|
||||
node.raws.semicolon = false;
|
||||
}
|
||||
});
|
||||
|
||||
// Remove final newline
|
||||
css.raws.after = '';
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
pluginCreator.postcss = true;
|
||||
module.exports = pluginCreator;
|
9
node_modules/postcss-normalize-whitespace/types/index.d.ts
generated
vendored
Normal file
9
node_modules/postcss-normalize-whitespace/types/index.d.ts
generated
vendored
Normal file
@ -0,0 +1,9 @@
|
||||
export = pluginCreator;
|
||||
/**
|
||||
* @type {import('postcss').PluginCreator<void>}
|
||||
* @return {import('postcss').Plugin}
|
||||
*/
|
||||
declare function pluginCreator(): import('postcss').Plugin;
|
||||
declare namespace pluginCreator {
|
||||
const postcss: true;
|
||||
}
|
Reference in New Issue
Block a user