mirror of
https://github.com/pure-admin/vue-pure-admin.git
synced 2025-11-21 14:13:36 +08:00
docs:更新文档
This commit is contained in:
6
node_modules/icss-utils/LICENSE.md
generated
vendored
Normal file
6
node_modules/icss-utils/LICENSE.md
generated
vendored
Normal file
@@ -0,0 +1,6 @@
|
||||
ISC License (ISC)
|
||||
Copyright 2018 Glen Maddern
|
||||
|
||||
Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted, provided that the above copyright notice and this permission notice appear in all copies.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
84
node_modules/icss-utils/README.md
generated
vendored
Normal file
84
node_modules/icss-utils/README.md
generated
vendored
Normal file
@@ -0,0 +1,84 @@
|
||||
[](https://travis-ci.org/css-modules/icss-utils)
|
||||
|
||||
# ICSS Utils
|
||||
|
||||
## replaceSymbols
|
||||
|
||||
Governs the way tokens are searched & replaced during the linking stage of ICSS loading.
|
||||
|
||||
This is broken into its own module in case the behaviour needs to be replicated in other PostCSS plugins
|
||||
(i.e. [CSS Modules Values](https://github.com/css-modules/postcss-modules-values))
|
||||
|
||||
```js
|
||||
import { replaceSymbols, replaceValueSymbols } from "icss-utils";
|
||||
|
||||
replaceSymbols(css, replacements);
|
||||
replaceValueSymbols(string, replacements);
|
||||
```
|
||||
|
||||
Where:
|
||||
|
||||
- `css` is the PostCSS tree you're working with
|
||||
- `replacements` is an JS object of `symbol: "replacement"` pairs, where all occurrences of `symbol` are replaced with `replacement`.
|
||||
|
||||
A symbol is a string of alphanumeric, `-` or `_` characters. A replacement can be any string. They are replaced in the following places:
|
||||
|
||||
- In the value of a declaration, i.e. `color: my_symbol;` or `box-shadow: 0 0 blur spread shadow-color`
|
||||
- In a media expression i.e. `@media small {}` or `@media screen and not-large {}`
|
||||
|
||||
## extractICSS(css, removeRules = true)
|
||||
|
||||
Extracts and remove (if removeRules is equal true) from PostCSS tree `:import` and `:export` statements.
|
||||
|
||||
```js
|
||||
import postcss from "postcss";
|
||||
import { extractICSS } from "icss-utils";
|
||||
|
||||
const css = postcss.parse(`
|
||||
:import(colors) {
|
||||
a: b;
|
||||
}
|
||||
:export {
|
||||
c: d;
|
||||
}
|
||||
`);
|
||||
|
||||
extractICSS(css);
|
||||
/*
|
||||
{
|
||||
icssImports: {
|
||||
colors: {
|
||||
a: 'b'
|
||||
}
|
||||
},
|
||||
icssExports: {
|
||||
c: 'd'
|
||||
}
|
||||
}
|
||||
*/
|
||||
```
|
||||
|
||||
## createICSSRules(icssImports, icssExports)
|
||||
|
||||
Converts icss imports and exports definitions to postcss ast
|
||||
|
||||
```js
|
||||
createICSSRules(
|
||||
{
|
||||
colors: {
|
||||
a: "b"
|
||||
}
|
||||
},
|
||||
{
|
||||
c: "d"
|
||||
}
|
||||
);
|
||||
```
|
||||
|
||||
## License
|
||||
|
||||
ISC
|
||||
|
||||
---
|
||||
|
||||
Glen Maddern, Bogdan Chadkin and Evilebottnawi 2015-present.
|
||||
65
node_modules/icss-utils/lib/createICSSRules.js
generated
vendored
Normal file
65
node_modules/icss-utils/lib/createICSSRules.js
generated
vendored
Normal file
@@ -0,0 +1,65 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.default = void 0;
|
||||
|
||||
var _postcss = _interopRequireDefault(require("postcss"));
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
const createImports = imports => {
|
||||
return Object.keys(imports).map(path => {
|
||||
const aliases = imports[path];
|
||||
const declarations = Object.keys(aliases).map(key => _postcss.default.decl({
|
||||
prop: key,
|
||||
value: aliases[key],
|
||||
raws: {
|
||||
before: "\n "
|
||||
}
|
||||
}));
|
||||
const hasDeclarations = declarations.length > 0;
|
||||
|
||||
const rule = _postcss.default.rule({
|
||||
selector: `:import('${path}')`,
|
||||
raws: {
|
||||
after: hasDeclarations ? "\n" : ""
|
||||
}
|
||||
});
|
||||
|
||||
if (hasDeclarations) {
|
||||
rule.append(declarations);
|
||||
}
|
||||
|
||||
return rule;
|
||||
});
|
||||
};
|
||||
|
||||
const createExports = exports => {
|
||||
const declarations = Object.keys(exports).map(key => _postcss.default.decl({
|
||||
prop: key,
|
||||
value: exports[key],
|
||||
raws: {
|
||||
before: "\n "
|
||||
}
|
||||
}));
|
||||
|
||||
if (declarations.length === 0) {
|
||||
return [];
|
||||
}
|
||||
|
||||
const rule = _postcss.default.rule({
|
||||
selector: `:export`,
|
||||
raws: {
|
||||
after: "\n"
|
||||
}
|
||||
}).append(declarations);
|
||||
|
||||
return [rule];
|
||||
};
|
||||
|
||||
const createICSSRules = (imports, exports) => [...createImports(imports), ...createExports(exports)];
|
||||
|
||||
var _default = createICSSRules;
|
||||
exports.default = _default;
|
||||
52
node_modules/icss-utils/lib/extractICSS.js
generated
vendored
Normal file
52
node_modules/icss-utils/lib/extractICSS.js
generated
vendored
Normal file
@@ -0,0 +1,52 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.default = void 0;
|
||||
const importPattern = /^:import\(("[^"]*"|'[^']*'|[^"']+)\)$/;
|
||||
|
||||
const getDeclsObject = rule => {
|
||||
const object = {};
|
||||
rule.walkDecls(decl => {
|
||||
const before = decl.raws.before ? decl.raws.before.trim() : "";
|
||||
object[before + decl.prop] = decl.value;
|
||||
});
|
||||
return object;
|
||||
};
|
||||
|
||||
const extractICSS = (css, removeRules = true) => {
|
||||
const icssImports = {};
|
||||
const icssExports = {};
|
||||
css.each(node => {
|
||||
if (node.type === "rule") {
|
||||
if (node.selector.slice(0, 7) === ":import") {
|
||||
const matches = importPattern.exec(node.selector);
|
||||
|
||||
if (matches) {
|
||||
const path = matches[1].replace(/'|"/g, "");
|
||||
icssImports[path] = Object.assign(icssImports[path] || {}, getDeclsObject(node));
|
||||
|
||||
if (removeRules) {
|
||||
node.remove();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (node.selector === ":export") {
|
||||
Object.assign(icssExports, getDeclsObject(node));
|
||||
|
||||
if (removeRules) {
|
||||
node.remove();
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
return {
|
||||
icssImports,
|
||||
icssExports
|
||||
};
|
||||
};
|
||||
|
||||
var _default = extractICSS;
|
||||
exports.default = _default;
|
||||
39
node_modules/icss-utils/lib/index.js
generated
vendored
Normal file
39
node_modules/icss-utils/lib/index.js
generated
vendored
Normal file
@@ -0,0 +1,39 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
Object.defineProperty(exports, "replaceValueSymbols", {
|
||||
enumerable: true,
|
||||
get: function get() {
|
||||
return _replaceValueSymbols.default;
|
||||
}
|
||||
});
|
||||
Object.defineProperty(exports, "replaceSymbols", {
|
||||
enumerable: true,
|
||||
get: function get() {
|
||||
return _replaceSymbols.default;
|
||||
}
|
||||
});
|
||||
Object.defineProperty(exports, "extractICSS", {
|
||||
enumerable: true,
|
||||
get: function get() {
|
||||
return _extractICSS.default;
|
||||
}
|
||||
});
|
||||
Object.defineProperty(exports, "createICSSRules", {
|
||||
enumerable: true,
|
||||
get: function get() {
|
||||
return _createICSSRules.default;
|
||||
}
|
||||
});
|
||||
|
||||
var _replaceValueSymbols = _interopRequireDefault(require("./replaceValueSymbols.js"));
|
||||
|
||||
var _replaceSymbols = _interopRequireDefault(require("./replaceSymbols.js"));
|
||||
|
||||
var _extractICSS = _interopRequireDefault(require("./extractICSS.js"));
|
||||
|
||||
var _createICSSRules = _interopRequireDefault(require("./createICSSRules.js"));
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
25
node_modules/icss-utils/lib/replaceSymbols.js
generated
vendored
Normal file
25
node_modules/icss-utils/lib/replaceSymbols.js
generated
vendored
Normal file
@@ -0,0 +1,25 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.default = void 0;
|
||||
|
||||
var _replaceValueSymbols = _interopRequireDefault(require("./replaceValueSymbols.js"));
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
const replaceSymbols = (css, replacements) => {
|
||||
css.walk(node => {
|
||||
if (node.type === "decl" && node.value) {
|
||||
node.value = (0, _replaceValueSymbols.default)(node.value.toString(), replacements);
|
||||
} else if (node.type === "rule" && node.selector) {
|
||||
node.selector = (0, _replaceValueSymbols.default)(node.selector.toString(), replacements);
|
||||
} else if (node.type === "atrule" && node.params) {
|
||||
node.params = (0, _replaceValueSymbols.default)(node.params.toString(), replacements);
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
var _default = replaceSymbols;
|
||||
exports.default = _default;
|
||||
25
node_modules/icss-utils/lib/replaceValueSymbols.js
generated
vendored
Normal file
25
node_modules/icss-utils/lib/replaceValueSymbols.js
generated
vendored
Normal file
@@ -0,0 +1,25 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.default = void 0;
|
||||
const matchValueName = /[$]?[\w-]+/g;
|
||||
|
||||
const replaceValueSymbols = (value, replacements) => {
|
||||
let matches;
|
||||
|
||||
while (matches = matchValueName.exec(value)) {
|
||||
const replacement = replacements[matches[0]];
|
||||
|
||||
if (replacement) {
|
||||
value = value.slice(0, matches.index) + replacement + value.slice(matchValueName.lastIndex);
|
||||
matchValueName.lastIndex -= matches[0].length - replacement.length;
|
||||
}
|
||||
}
|
||||
|
||||
return value;
|
||||
};
|
||||
|
||||
var _default = replaceValueSymbols;
|
||||
exports.default = _default;
|
||||
118
node_modules/icss-utils/package.json
generated
vendored
Normal file
118
node_modules/icss-utils/package.json
generated
vendored
Normal file
@@ -0,0 +1,118 @@
|
||||
{
|
||||
"_args": [
|
||||
[
|
||||
"icss-utils@4.1.1",
|
||||
"J:\\Github\\CURD-TS"
|
||||
]
|
||||
],
|
||||
"_development": true,
|
||||
"_from": "icss-utils@4.1.1",
|
||||
"_id": "icss-utils@4.1.1",
|
||||
"_inBundle": false,
|
||||
"_integrity": "sha1-IRcLU3ie4nRHwvR91oMIFAP5pGc=",
|
||||
"_location": "/icss-utils",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"type": "version",
|
||||
"registry": true,
|
||||
"raw": "icss-utils@4.1.1",
|
||||
"name": "icss-utils",
|
||||
"escapedName": "icss-utils",
|
||||
"rawSpec": "4.1.1",
|
||||
"saveSpec": null,
|
||||
"fetchSpec": "4.1.1"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/postcss-modules-local-by-default",
|
||||
"/postcss-modules-values"
|
||||
],
|
||||
"_resolved": "http://192.168.250.101:4873/icss-utils/-/icss-utils-4.1.1.tgz",
|
||||
"_spec": "4.1.1",
|
||||
"_where": "J:\\Github\\CURD-TS",
|
||||
"author": {
|
||||
"name": "Glen Maddern"
|
||||
},
|
||||
"babel": {
|
||||
"presets": [
|
||||
[
|
||||
"@babel/preset-env",
|
||||
{
|
||||
"targets": {
|
||||
"node": 6
|
||||
}
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/css-modules/icss-utils/issues"
|
||||
},
|
||||
"dependencies": {
|
||||
"postcss": "^7.0.14"
|
||||
},
|
||||
"description": "ICSS utils for postcss ast",
|
||||
"devDependencies": {
|
||||
"@babel/cli": "^7.1.0",
|
||||
"@babel/core": "^7.1.0",
|
||||
"@babel/preset-env": "^7.1.0",
|
||||
"babel-eslint": "^10.0.1",
|
||||
"babel-jest": "^24.1.0",
|
||||
"eslint": "^5.14.1",
|
||||
"husky": "^1.3.1",
|
||||
"jest": "^24.1.0",
|
||||
"lint-staged": "^8.1.4",
|
||||
"prettier": "^1.16.4"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 6"
|
||||
},
|
||||
"eslintConfig": {
|
||||
"parser": "babel-eslint",
|
||||
"parserOptions": {
|
||||
"sourceType": "module"
|
||||
},
|
||||
"env": {
|
||||
"es6": true,
|
||||
"jest": true
|
||||
},
|
||||
"extends": "eslint:recommended"
|
||||
},
|
||||
"files": [
|
||||
"lib"
|
||||
],
|
||||
"homepage": "https://github.com/css-modules/icss-utils#readme",
|
||||
"husky": {
|
||||
"hooks": {
|
||||
"pre-commit": "lint-staged"
|
||||
}
|
||||
},
|
||||
"keywords": [
|
||||
"css",
|
||||
"modules",
|
||||
"icss",
|
||||
"postcss"
|
||||
],
|
||||
"license": "ISC",
|
||||
"lint-staged": {
|
||||
"*.js": [
|
||||
"prettier --write",
|
||||
"eslint",
|
||||
"git add"
|
||||
]
|
||||
},
|
||||
"main": "lib/index.js",
|
||||
"name": "icss-utils",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/css-modules/icss-utils.git"
|
||||
},
|
||||
"scripts": {
|
||||
"build": "babel --out-dir lib src",
|
||||
"lint": "eslint . --ignore-path .gitignore",
|
||||
"prepublish": "yarn test && yarn run build",
|
||||
"pretest": "npm run lint",
|
||||
"test": "npm run test:only",
|
||||
"test:only": "jest"
|
||||
},
|
||||
"version": "4.1.1"
|
||||
}
|
||||
Reference in New Issue
Block a user